• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Autodesk MapGuide Developer

    Reply
    *Fernando.Digicadd

    addPolylinePrimitive

    103 Views, 2 Replies
    10-24-2001 09:00 AM
    Hi!

    Anyone knows how to use "addPolylinePrimitive"?? if yes, please send me
    one example.


    Thanks

    Fernando
    fernando@digicadd.com.br
    Please use plain text.
    *Kumar, Ramana

    Re: addPolylinePrimitive

    10-30-2001 02:23 PM in reply to: *Fernando.Digicadd
    Please find the attached htm file and modify it to your specific needs.

    Hope this helps.
    Regards,
    Ramana

    "Fernando.Digicadd" wrote in message
    news:EBB29153AC6745AD55845BF1DE4644CC@in.WebX.maYIadrTaRb...
    > Hi!
    >
    > Anyone knows how to use "addPolylinePrimitive"?? if yes, please send
    me
    > one example.
    >
    >
    > Thanks
    >
    > Fernando
    > fernando@digicadd.com.br
    >
    >
    >
    >
    Please use plain text.
    *Kumar, Ramana

    Re:

    10-30-2001 02:34 PM in reply to: *Fernando.Digicadd
    Problem in sending the attachments. Find the
    contents(code) below.


    size=2><html>
    <head>
     <title>Redlining</title>
    <script
    language="javascript">

     

    function getThisMap()
    {
        if
    (navigator.appName == "Netscape")
           
    return document.myMap;
       
    else
            return
    window.myMap;
    }

     

    function add_pgon()
    {
    // get map
    object
    var map = getThisMap();
    // exit function if 'Polygon Name' text box
    is empty
    if (document.the_form.the_textbox.value == "")
    {
    alert("Please
    enter a polygon name.")
    return;
    }
    // if browser is Netscape, use 'Ex'
    version and pass
    // observer applet; if browser is Internet Explorer,
    //
    use 'non-Ex' version with no argument
    if (navigator.appName ==
    "Netscape")
    map.digitizePolygonEx(document.obs);
    else
    map.digitizePolygon();
    }

     

    function onDigitizedPolygon(map, numPoints,
    points)
    {
    // create variable and assign it user-specified value
    // from
    'Polygon Name' text box
    var formText =
    document.the_form.the_textbox.value;
    // create redline layer, or get it if it
    already exists
    var myLayer = map.getMapLayer("My Redline Layer");
    if
    (myLayer == null)
    myLayer = map.createLayer("redline", "My Redline
    Layer");
    // create redline object or get it if it exists (getMapObject
    //
    takes an object key as its value, while createMapObject takes
    // a key and a
    name -- the formText variable supplies both of
    // those values)
    var obj =
    myLayer.getMapObject(formText);
    if (obj == null)
    var obj =
    myLayer.createMapObject(formText, formText, "");
    // create MGCollection that
    holds user-specified polygon vertices
    var user_vertices =
    map.createObject("mgcollection");
    user_vertices.add(numPoints);
    // use
    MGCollection to create polyline primitive and add it to
    // redline
    object
    obj.addPolylinePrimitive(points, user_vertices, false);
    // clear
    contents of 'Polygon Name' text box
    document.the_form.the_textbox.value =
    "";
    }

     

    function save_it()
    {
        var
    fName = "c:\\My Documents\\my_map.mwf";   // use '/' or '\\', not
    '\'
        var password = prompt("Please enter a password.",
    "");

     

        if ( getThisMap().saveMWF(fName,
    password) )
            alert("Map has been
    saved!");
       
    else
            alert("Unable to save
    map.");
    }
    </script>

     

    <SCRIPT
    LANGUAGE="VBScript">
        Sub myMap_onDigitizedPolygon(map,
    numPoints, points)
           
    onDigitizedPolygon map, numPoints, points
        End
    Sub
    </SCRIPT>

     

    </head>

     

    <body>
    <OBJECT ID="myMap" WIDTH=1000
    HEIGHT=500
        
    CLASSID="CLSID:62789780-B744-11D0-986B-00609731A21D"
        
    CODEBASE="
    href="ftp://ftp.autodesk.com/pub/mapguide/viewer/mgaxctrl.cab#3,0,5,3">ftp://ftp.autodesk.com/pub/m...
    ">
        
    <PARAM NAME="URL" VALUE="
    href="http://localhost/maps/sample.mwf">http://localhost/maps/sample.mwf
    ">
        
    <EMBED SRC="
    href="http://localhost/maps/sample.mwf?STATUSBAR=ON">http://localhost/maps/sample.mwf?STATUSBAR=ON
    "
        
    ALIGN="baseline" BORDER="0" WIDTH="1000"
    HEIGHT="500"
         NAME="myMap"
    TYPE="application/x-mwf">
    </OBJECT>

     

    <SCRIPT LANGUAGE="JAVAScript">

     

    </SCRIPT>

     

    <FORM NAME="the_form">
    Polygon Name:
    <INPUT TYPE="text" VALUE="" NAME="the_textbox">
    <INPUT TYPE="button"
    VALUE="Add/Update Polygon" OnClick="add_pgon();"
    NAME="a_button">
    <INPUT TYPE="button" VALUE="Save It!"
    OnClick="save_it();"
    NAME="another_button">
    </FORM>

     


    </body>
    </html>

    Ramana

     

     

     



    style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">Please
    find the attached htm file and modify it to your specific needs.

    Hope
    this helps.
    Regards,
    Ramana

    "Fernando.Digicadd"
    <fernando@digicadd.com.br> wrote in
    message
    news:EBB29153AC6745AD55845BF1DE4644CC@in.WebX.maYIadrTaRb...
    >
    Hi!
    >
    >     Anyone knows how to use
    "addPolylinePrimitive"?? if yes, please send
    me
    > one
    example.
    >
    >
    > Thanks
    >
    > Fernando
    >
    fernando@digicadd.com.br
    >
    >
    >
    >












    codeBase=ftp://ftp.autodesk.com/pub/mapguide/viewer/mgaxctrl.cab#3,0,5,3
    classid=CLSID:62789780-B744-11D0-986B-00609731A21D width=1000 height=500>

    ALIGN="baseline" BORDER="0" WIDTH="1000" HEIGHT="500" NAME="myMap"
    TYPE="application/x-mwf">



    Polygon Name:

    Please use plain text.