I am trying to implement a selection mechanism to select a series of MapShapes from a particular layer. The stategy that I use is to create a MapPath and set the Data item to be a MapGeometryGroup.
For each shape that is selected (and these are either MapPaths or MapPolygons), I create a MapGeometry from it, and then add that geometry to the group.
Works perfectly!
However, I now need to shrink each of the geometries by 10%, and align them in the center of the original shapes. So for each of the MapGeometries I have added a Transform
I have two problems;
1. The translate doesn't take me to the correct origin to apply the ScaleTransform so that I don't move my X, Y coordinates in the scale
2. If I add two shapes to the Group, then the transform seems to be applied to both MapGeometries in the Group, rather than applying just to itself.
Any help would be appreciated
Thanks
Simon
For each shape that is selected (and these are either MapPaths or MapPolygons), I create a MapGeometry from it, and then add that geometry to the group.
Works perfectly!
However, I now need to shrink each of the geometries by 10%, and align them in the center of the original shapes. So for each of the MapGeometries I have added a Transform
LocationRect locationRect = mapShape.GeographicalBounds;
locationRect.MapControl = MapControl;
TransformGroup transformGroup =
new
TransformGroup();
transformGroup.Children.Add(
new
TranslateTransform(-locationRect.Northwest.Latitude, locationRect.Northwest.Longitude));
transformGroup.Children.Add(
new
ScaleTransform(0.9, 0.9));
transformGroup.Children.Add(
new
TranslateTransform(locationRect.Center.Longitude, mapShape.GeographicalBounds.Center.Latitude));
mapGeometry.Transform = transformGroup;
I have two problems;
1. The translate doesn't take me to the correct origin to apply the ScaleTransform so that I don't move my X, Y coordinates in the scale
2. If I add two shapes to the Group, then the transform seems to be applied to both MapGeometries in the Group, rather than applying just to itself.
Any help would be appreciated
Thanks
Simon