Rotatable shape
Rotatable shape
I'm looking for a way to rotate shapes drawn onto the map so that I can align  measured GPS potions with their heading. I have tried using the TriangleUp class and added a RotateTransform as it's RenderTransform but I can't get the shape to rotate. Any Idea how i can rotate the shapes?
			
			
									
						
							Joost Claessen
Senior Technical Consultant
PTV Benelux
			
						Senior Technical Consultant
PTV Benelux
- Oliver Heilig
- Posts: 160
- Joined: Tue May 13, 2014 12:10 pm
- Location: Karlsruhe, Germany
- Contact:
Re: Rotatable shape
Hello Joost,
you can rotate any WPF element for the map using the RenderTransform property. One caveat: You cannot directly set the RenderTransform of the element. Because the RenderTransform set by the map control, you need to put it in a container first. Here's a sample to rotate the ballons for https://github.com/ptv-logistics/xserve ... ultiCanvas
Oli
			
							
			
									
						
							you can rotate any WPF element for the map using the RenderTransform property. One caveat: You cannot directly set the RenderTransform of the element. Because the RenderTransform set by the map control, you need to put it in a container first. Here's a sample to rotate the ballons for https://github.com/ptv-logistics/xserve ... ultiCanvas
Oli
Code: Select all
public void AddBalloon(MultiCanvasShapeLayer layer, double lat, double lon, Color color, string text, string tooltip)
{
    // create and initialize balloon
    var balloon = new Balloon
    {
        Color = color,
        Text = text,
        ToolTip = tooltip,
        RenderTransform = new RotateTransform(45), // rotation
        RenderTransformOrigin = new System.Windows.Point(0.5, 0.5) // rotation center
    };
    var balloonContainer = new Grid();
    balloonContainer.Children.Add(balloon);
    // set geo location
    ShapeCanvas.SetLocation(balloonContainer, new System.Windows.Point(lon, lat));
    // optional use adaptive (zoom-dependent scaling)
    ShapeCanvas.SetScale(balloonContainer, 2.5);
    ShapeCanvas.SetScaleFactor(balloonContainer, 0.1);
    // add to map
    layer.TopShapes.Add(balloonContainer);
}Oliver Heilig
Chief Developer Logistic Services
PTV GROUP - Germany
https://github.com/oliverheilig/
			
						Chief Developer Logistic Services
PTV GROUP - Germany
https://github.com/oliverheilig/
Re: Rotatable shape
Works like a charm. Thnx for the info.
			
			
									
						
							Joost Claessen
Senior Technical Consultant
PTV Benelux
			
						Senior Technical Consultant
PTV Benelux
