Draw route and route animations...

Nov 19, 2009 at 3:53 PM
Edited Nov 20, 2009 at 1:45 AM

Hi there,

I wonder if anyone can show me how to draw routes as well as implement route animations provided the location info has already been available. For example: I have the coordinates of the detail route trails (points) of some vehicles and then I need to redraw (step by step: animations) those history route trails on the map. Thank you very much.

Regards,

Trung Hoang

Developer
Nov 19, 2009 at 6:40 PM
Edited Nov 19, 2009 at 6:55 PM
You can for example:
In a routing panel will be available.
void OnRouteCalculated(object sender, EventArgs e)
{
routeLayer.Children.Clear();
RouteResultArgs args = (RouteResultArgs)e;
if (args == null)
return;
DeepEarth.Client.Services.Bing.VERouteService.RoutePath path = args.Result.RoutePath;
GisSharpBlog.NetTopologySuite.Geometries.Coordinate[] coordinates = new
GisSharpBlog.NetTopologySuite.Geometries.Coordinate[path.Points.Count];
for (int i = 0; i < path.Points.Count; i++)
{
coordinates[i] = new GisSharpBlog.NetTopologySuite.Geometries.Coordinate(
path.Points[i].Longitude, path.Points[i].Latitude);
}
EditGeometry editGeom = new EditGeometry();
editGeom.MapInstance = MapInstance;
GisSharpBlog.NetTopologySuite.Geometries.LineString ls = new GisSharpBlog.NetTopologySuite.Geometries.LineString(coordinates);
var selectGeom = new SelectGeometry(ls, styles["style 1"], MapInstance);
RenderGeometry(selectGeom.Geometry, "style 1", routeLayer);
LocationRect locationRect = new LocationRect(
new Microsoft.Maps.MapControl.Location(args.Result.Summary.BoundingRectangle.Northeast.Latitude, args.Result.Summary.BoundingRectangle.Northeast.Longitude),
new Microsoft.Maps.MapControl.Location(args.Result.Summary.BoundingRectangle.Southwest.Latitude, args.Result.Summary.BoundingRectangle.Southwest.Longitude)
);
MapInstance.SetView(locationRect);
}
public SelectGeometry CurrentGeometry { get; set; }
void RenderGeometry(GeoAPI.Geometries.IGeometry geometry, string styleID, EnhancedMapLayer layer)
{
CurrentGeometry = new SelectGeometry(geometry, styles[styleID], MapInstance);
layer.AddChild(CurrentGeometry,
DeepEarth.Client.BingMaps.Convertors.CoordinateConvertor.ConvertBack(geometry.Centroid.Coordinate),
Microsoft.Maps.MapControl.PositionOrigin.Center);
}
Nov 20, 2009 at 4:44 AM

Dear perf!

Could you explain a little bit more about this - steps do to when I have a list of coordinates (points)? because I am absolutely new to this control. I guess that what you mean is the routing panel is not available at the moment, right? so I have to wait... By the way, when i look at here http://www.microsoft.com/maps/isdk/silverlight/default.htm#MapControlInteractiveSdk.Tutorials.Services.Route . I wonder whether what you mean in the code is to use geocode to look for the right location of street for my each of the location info (GPS coordinate of points) then can render it on the routing panel?  

Thank you very much.

 

 

Developer
Nov 24, 2009 at 10:00 PM

Middlevn. There is a directionpanel available now in the source under Client/Controls/DeepEarth.Client.Controls.DirectionPanel.