How to add Shape with AddShape()

May 5, 2009 at 12:27 PM
Can anyone give som info on how to use this method to add shapes to a map ?
May 5, 2009 at 1:32 PM
AddShape is not fully built out right now.  It has very rudimentary support for polylines, but you'd have to build your own class that derives from VEShape that sets its ShapeType to ShapeType.Polyline.  Store the points you want to have in VEShape.Points.

How that works could change in the future though.

You could also access VEMap.GlobeControl directly and use the Virtual Earth API for adding shapes, but you'll also have to add references to the MapPoint dlls.  See here for VE3D documentation:
May 5, 2009 at 6:56 PM
The map.globeControl (VEMap.globeControl type) is of type InfoStrat.VE.PublicEventsGlobeControl and not of the type Microsoft.MapPoint.Rendering3D.GlobeControl... !?

How can I add a push pin like the exemple from the interactive SDK ? how do I get the instance to the map object of the VE3D ?
      function AddPushpin()
          var shape = new VEShape(VEShapeType.Pushpin, map.GetCenter());
          shape.SetTitle('My pushpin');
          shape.SetDescription('This is shape number '+pinid);
Code from

May 5, 2009 at 7:06 PM
Yes, it is an InfoStrat.VE.PublicEventsGlobeControl, which derives from Microsoft.MapPoint.Rendering3D.GlobeControl.  This was necessary to expose certain events as public (hence the name.)

If you need to call something on the GlobeControl, just use VEMap.globeControl. 

The sample code provided shows how to add a pushpin in XAML.  To add it in code you instantiate a VEPushpin (or SurfaceVEPushPin on Surface), set the various properties, and add it to the VEMap.Items collection.  VEPushPin is a content control, so you can set the VEPushPin.Content to a string if you want or you can add any other control (textblock, buttons, images, etc.) to make it more interactive.

The interactive SDK is only valid for Virtual Earth in the browser.  Check out the VE3D control documentation from the link in my last post.
Jul 13, 2009 at 9:40 PM

Hi, I tried to add a polyline by deriving a class from VEShape. Set ShapeType.Polyline.  Stored two points in VEShape.Points. The result is: it only shows a short trace of discrete pixels near the end points. Is there a setting I can change to make it work?


Jul 14, 2009 at 12:30 AM
Edited Jul 14, 2009 at 12:30 AM


Please review this thread to see if it helps: