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

Mark Pendergraft markp at Meadgilman.com
Sun Jan 4 01:06:52 EST 2009


did you ever find a solution to this problem?  I have code that draws a
polygon and sends it to server side code which then updates a feature
source.  however the polygon the user initially drew doesn't dissapear, and
furthermore if the user tries to refresh the map after it's drawn it errors
out at the Fusion.Tool.Canvas.Polygon draw() method.
Also the function has issues with a user zooming while the polygon is being
drawn.
Thanks
-Mark P.


foolfish wrote:
> 
> 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://n2.nabble.com/i-can-draw-digital-object%2Cbut-how-to-clear-the-digital-object--tp1815551p2108326.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list