[mapguide-users] i can draw digital object,but how to clear the digital object?

foolfish xjimmyshcn at sohu.com
Fri Jun 6 04:35:33 EDT 2008


env: mapguide open source 2.0.1 + mapgudie studio 2009 + visual studio
2005(c#)

I can draw digital object at client in fusion ,but i don't know how to
delete the digital object。
Does anyone know ? thanks~

Note: the MapGuideViewerApi.js can't be use directly,it should be modified:
1)after var mapWidgetId = 'Map'; add the follow line:
var Fusion = window.top.Fusion;
2)find LineHandlers.prototype, delete the superfluous comma after mouseMove:
function(e) {}
2)find RectangleHandlers.prototype, delete the superfluous comma after
mouseMove: function(e) {}

here is my code in the page in Task Pane

---------------------------------------------------------------------------------------
<head>
...
<script type="text/javascript" src="/mapguide/fusion/lib/fusion.js" >
</script>
<script type="text/javascript"
src="/mapguide/fusion/MapGuide/MapGuideViewerApi.js" > </script>

<script type="text/javascript">
function OnDigitizePoint(obj)
{
 alert(obj.X.toString()+","+obj.Y.toString())
}
function OnDigitizeLine(obj)
{
    var tmpstr="";
    for (i=0;i<obj.Count;i++)
    {     
     
tmpstr+=(obj.points[i].X).toString()+","+(obj.points[i].Y).toString()+"\n";
    }
    alert(tmpstr);
}
function OnDigitizeLineString(obj)
{
    var tmpstr="";
    for (i=0;i<obj.Count;i++)
    {     
     
tmpstr+=(obj.points[i].X).toString()+","+(obj.points[i].Y).toString()+"\n";
    }
    alert(tmpstr);
}
function OnDigitizeRectangle(obj)
{
alert("("+obj.Point1.X.toString()+","+obj.Point1.Y.toString()+")("+obj.Point2.X.toString()+","+obj.Point2.Y.toString()+")")
}
function OnDigitizePolygon(obj)
{
    var tmpstr="";
    for (i=0;i<obj.Count;i++)
    {     
     
tmpstr+=(obj.points[i].X).toString()+","+(obj.points[i].Y).toString()+"\n";
    }
    alert(tmpstr);
}
</script>
...
</head>

---------------------------------------------------------------------------------------
<body>
...
        <input id="Button1" type="button" value="Point"
onclick="DigitizePoint(OnDigitizePoint)"  />
        <input id="Button2" type="button" value="Line"
onclick="DigitizeLine(OnDigitizeLine)"  />
        <input id="Button3" type="button" value="LineString"
onclick="DigitizeLineString(OnDigitizeLineString)"  />
        <input id="Button4" type="button" value="Rectangle"
onclick="DigitizeRectangle(OnDigitizeRectangle)"  />
        <input id="Button5" type="button" value="Polygon"
onclick="DigitizePolygon(OnDigitizePolygon)"  />
...
</body>

---------------------------------------------------------------------------------------
:-):-):-):-):-):-):-(:-):-(:-):-):-):-(:-):-D;-)
-- 
View this message in context: http://www.nabble.com/i-can-draw-digital-object%2Cbut-how-to-clear-the-digital-object--tp17687296p17687296.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list