Rotating the map

Mar 23, 2009 at 11:23 AM
Hi guys,

first of all, congratulations for this great control. I'm trying to create a prototype for surface using VE and it's saving me a lot of time. I'm having problems rotating the map and I wonder if any of you have any possible solution. First I tried using a separated transparent window but then I had some problems with the pushpins. I saw in the code you are creating a ManipulationProcessor accepting every king of manipulation but rotation:

            this.manipulationProcessor = new Affine2DManipulationProcessor(
                Affine2DManipulations.TranslateX |
                Affine2DManipulations.TranslateY |
                Affine2DManipulations.Scale |
                this, false);

I tried to change that into 

            this.manipulationProcessor = new Affine2DManipulationProcessor(
                Affine2DManipulations.TranslateX |
                Affine2DManipulations.TranslateY |
                Affine2DManipulations.Scale |
                this, false);

And then, use the Roll property of the map when any delta change was done. I got the rotation to work but then the zooming functionality was lost. Is there any way to get rotation to work without changing SurfaceVEMap class or has any of you used my approach and then discarded it because of any limitation.

Thanks in advance,
David Martos
Mar 23, 2009 at 4:18 PM
Yes, I originally had Affine2DManipulations.Rotate as an option in there but in informal user testing found that caused unintentional rotations.

Put two finger on Surface close together, but one is slightly higher (45 degree angle when fingers are close).  Spread the finger apart for the scale manipulation straight out.  When fingers are far apart, the angle might be 5 degrees, causing significant map rotation.

We determined this was generally undesirable and instead used external rotation mechanisms that require more deliberate thought.  For example, put the map inside a ScatterViewItem, or animate the Angle property of a RotateTransform inside its RenderTransform.

The Roll property affects the camera, rather than the rotation of the entire map, and may or may not work as intended.
Mar 24, 2009 at 11:06 AM
Thank you Josh. I'll try to use a RotateTransform as you suggest.
Jul 1, 2009 at 9:43 AM


Usertesting aside, we wanted to try the maprotation first hand. As everyone we watched naturally tried to rotate the map and wondered why it wasnt possible.

I did, what davidmartos has done and basically have the same problem, that zooming funcionallity is lost. The manipulation eventargs always state 0.0 expansionvelocity. Since you had rotation at one point, could you please elaborate, what needs to be done to have zooming and rotation work? This would be really helpfull.

Thanks in advance,


Jul 1, 2009 at 1:12 PM


I don't remember what else needed to change for rotation to work within that same manipulation processor.  You could try leaving that one alone and adding a second manipulation processor that duplicates that one, except it has translate and rotate instead of translate and scale.  Then use the second manipulation processor to change the rotation of the map.

Jul 8, 2009 at 7:57 AM

Ok, I found out what causes the problem with loosing scaling. It's actually not a poblem with the delta event. It's a side effect of changing the roll property.

This sets isDependencyPropertiesDirty to true and this causes to redraw the map in the raiseviewchanged function:

if (isDependencyPropertiesDirty)

 I also wanted to try it with a rotatetransform. But that causes other undesired effects or I just don't know where to put it. You can't just rotate the viewport because it leaves blank space in the corners of my application and it does not recognize the rotation inside the map, so the movement direction is wrong when the map is rotated.


Jul 8, 2009 at 11:31 AM
Edited Jul 8, 2009 at 12:33 PM

I played around with rotation but did not get any farther yet. What I found out is, that neither a transformation on the view point or changing the roll property give me the desiered results.

And isn't actually putting the vemap inside a scatterview or any other thing that I could transform, the same as changing the cameras roll? Because what we actually see is a projection of the camera itself, so changing roll and transforming the projection would be the same. Or am I missing something here?

What I would like to do is rotate the camera around the centerpoint of the map that it points to, not rotating the camera in place. But I have absolutly no idea how to do that. I found this articel but don't get any farther. Maybe my math is just to rusty. The globecontrol has it's own rotate/pitch controls wich do exactly that. If you go at you can actually see how its done.

Go to "Work With 3dMaps/ Set alt., heading, and pitch". Setting the heading would be exactly what I want to accomplish, but the vemap does not have the function SetHeading.

If anyone can point me to a direction on how to implement these I would be really glad, because I'm out of ideas.

EDIT: I found a way of rotating around a point with the GlobeControl.Host.Navigation.FlyAround function, I now just need to find out the centerpoint the camera points to.

EDIT2: Found something interessting They seem to do rotate just fine. Should be available when win 7 launches.


Jul 9, 2009 at 10:09 AM

I got a lot farther with the rotation and it's working smoothly now. I have the same problem however as when I update the roll property. I use a Jumpcamera to get to the correct point and the jumping actually is what causes the problem.

It's interfering with the zoom and Pan functionallity when it's set. Is there a way to wait for the zoom/pan to complete bevor applying the jumpcamera?

Jul 9, 2009 at 10:19 PM

It sounds like you worked out a lot of things yourself, which is good.  You also seem like you've gone in a different direction as how I originally tested roll manipulations, so I don't know everything that you're trying here.

If your jumpcamera is interfering with pan/zoom, perhaps you are calling jumpcamera constantly.  Try calling it only when you need to update the roll.

Jul 26, 2009 at 4:46 AM

Hi, simon_b

you need the centerpoint:

GeodeticCameraSnapshot camera = this.Host.Navigation.CameraSnapshot;
Location = camera.Position.Location;

could you tell me the way to got the rotation angle? (when two finger touch the earth and rotation)

Jan 4, 2010 at 6:54 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.