[mapguide-users] Fusion and Digitizing
Mark Pendergraft
markp at Meadgilman.com
Fri Jan 23 15:58:23 EST 2009
Absolutely.
My biggest beef with digitizing in Fusion is that when you digitize an
object (point/polygon/etc.) it stays on the map. The existing functions
don't have a clear method to remove the digitized object, and my
programming skills aren't good enough that I want to mess with it.
It's very simple,
Add a reference to MapGuideViewerApi.js and call DigitizePolygon()
The DigitizePolygon function requires that you pass it a handler
Something similar to the following:
DigitizePolygon(CreateJobByPolygon);
function CreateJobByPolygon(polygon) {
var geomText = polygon.Count;
for (var i = 0; i < polygon.Count; i++){
geomText += "," + polygon.Point(i).X + "," + polygon.Point(i).Y;
}
Fusion.getWidgetById('Map').setCursor('auto');
// here you would send your geomText to a web service, or aspx page
that would turn the coordinates into a linear ring
// and then a polygon from there. The geomText variable (in this
particular situation) evaluates to something similar to
// 3,5000.00,5000.00,5050.00,5050.00,5100.00,5100.00
}
Of course you can format the way the coordinates are sent to your
application any way you want.
I would also recommend calling the DigitizePolygon() function from an
InvokeScript() widget, as I had some problems when I tried to actually
create a widget and call it from there. Also, I prefer to change my
cursor when the widget is activated, you can see I put it back to 'auto'
in the CreateJobByPolygon() function, but I like to set it to
'crosshair' before the DigitizePolygon function is called.
-Mark P.
-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Stefan
Dalakov
Sent: Friday, January 23, 2009 12:35 PM
To: MapGuide Users Mail List
Subject: [mapguide-users] Fusion and Digitizing
Hi all,
From what I read here, should I conclude that digitizing functions in
Fusion are not yet fully supported ?
I need to digitize a polygon on the map and save it permanently. I have
this working with AJAX viewer, but would like to port it to Fusion
Has anyone succeeded to do this ?
Stefan Dalakov
_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
More information about the mapguide-users
mailing list