I want to rotate a polygon (for example this arrow) by replacing the hardcoded offsets values with a function where can pass in the nord pointing offset and the amount of degrees I want the arrow to rotate at.
I tried using a Rotation matrix but that did not work well.
Probably because the distance of
1 Lat. != 1 Long.
What I'm trying to do with this:
The arrow must represent a vehicle and rotate on the direction the vehicle is heading.
double centerLatitude = pos.Coordinate.Point.Position.Latitude;
double centerLongitude = pos.Coordinate.Point.Position.Longitude;
MapPolygon mapPolygon = new MapPolygon();
mapPolygon.Path = new Geopath(new List<BasicGeoposition>() {
new BasicGeoposition() {Longitude=centerLongitude, Latitude=centerLatitude},//top of the arrow
new BasicGeoposition() {Longitude=centerLongitude-0.001, Latitude=centerLatitude-0.0010},
new BasicGeoposition() {Longitude=centerLongitude-0.001, Latitude=centerLatitude-0.0030},
new BasicGeoposition() {Longitude=centerLongitude+0.001, Latitude=centerLatitude-0.0030},
new BasicGeoposition() {Longitude=centerLongitude+0.001, Latitude=centerLatitude-0.0010},
});
mapPolygon.ZIndex = 1;
mapPolygon.FillColor = Colors.Orange;
mapPolygon.StrokeColor = Colors.Blue;
mapPolygon.StrokeThickness = 2;
mapPolygon.StrokeDashed = false;
MainMap.MapElements.Add(mapPolygon);
MapPolygons are bound to coordinates on the map. Rotation transforms in UWP won't apply to MapPolygons. If you want to rotate a MapPolygon, you have to calculate the rotated coordinates. The Bing Maps V8 map control (web) provides a function for doing this. Here are the two different ways it does this:
Spatially accurate (may not look the same due to map projection)
Pixel Accurate (will look the same as you rotate it, but won't be spatially accurate)