Drawing Polygon in VE5
I am converting a VE4 application to VE5
i have code to draw a polygon in runtime in VE4 the code is follows:
map.AttachEvent(
'oncontextmenu', mapContextMenu);how can i implement this in VE5.
I am converting a VE4 application to VE5
i have code to draw a polygon in runtime in VE4 the code is follows:
map.AttachEvent(
'oncontextmenu', mapContextMenu);how can i implement this in VE5.
If you're tying the drawing action to a mouse event, then attach explore the VEMap.Events node for the sample code. Drawing a Polygon simply requires adding that type of VEShape to the map, which is also there in the documentation.
Personally, I favor the MSDN docs here: http://msdn2.microsoft.com/en-us/library/bb429565.aspx
The interactive SDK is useful as you can copy/paste complete segments of both html and .js to test this type of function: http://dev.live.com/virtualearth/sdk/
Hi Jared,
Can u briefly elaborate or explain me how to draw ploygon in VE 5.
In VE4 we used -->map.AttachEvent('oncontextmenu', lmContextMenu); but in VE5 we cannot use this, any other similat event in VE5. Can u suggest of show some good examples of Drawing pLoygon.
How we drawing a ploygon :
Current Functionality>There is a toolbar at the top, the user clicks on Draw Polygon button, then the user clicks on various places on the map resulting in various points and the pushpins are displayed on those points , now the user again needs to click on The DrawPolygon tool on the toolbar which displays the lines and the inner color of the polygon.
Desired Functionality> There is a toolbar at the top, the user clicks on Draw Polygon button, then the user clicks on the map and on various point and the pushpins are displayed on those points , now the user needs to rightclick on last pushpin point which displays the lines and the inner color of the polygon.
Waiting for ur quick and helpful reply.
Regards,
Vishal
Vishal,
there is an awesome post for drawing with V5 at the VE wiki:
http://www.viavirtualearth.com/Wiki/Drawing-Tool+for+VE+v5.ashx
gives a nice preview of the next point and the polygon, thanks to Johannes Kebeck.
John.
Hello Jared,
Can u tell me how to draw a ploygon on VE 5. How can I end a polygon drawing at a certain point. For e.g. suppose I want to close a polygon on right mouse click button event, in that case how should I attach this kind of event (i.e. map.AttachEvent)in VE 5.
Please suggest me a solution.
Regards,
Vishal
Hello Jared,
Can u tell me how to draw a ploygon on VE 5. How can I end a polygon drawing at a certain point. For e.g. suppose I want to close a polygon on right mouse click button event, in that case how should I attach this kind of event (i.e. map.AttachEvent)in VE 5.
Please suggest me a solution.
Regards,
Vishal
To close a polygon the last point in the array needs to be first.It would be a nice feature if VE altered the API so that a polygon was automatically closed i.e. the last point does not have to be added to the point’s array.
GIS Logic