ThinkGeo.com    |     Documentation    |     Premium Support

Rotation questions

  1. After rotating the map, when I click on it the point returned is not the exact point that I have clicked on. I tried to rotate the selected point using the following code, but it doesn’t appear to work. I’m not sure which center point I should be using.

    var point = e.MouseDevice.GetPosition(map);
    var screenPointF = new ScreenPointF((float)point.X, (float)point.Y);
    result = ExtentHelper.ToWorldCoordinate(map.CurrentExtent, screenPointF, (float)map.ActualWidth, (float)map.ActualHeight);
    result.Rotate(this.map.CurrentExtent.GetCenterPoint(), (float)(360 - this._rotationAngle));

  2. Also, after rotating the map the Bing Overlay doesn’t fill in the edges correctly. As shown below, the far outside tiles are not shown on the map.

Hi Clay,

Could you please let us know how you implement the rotation?

From your question 2, it should be element rotation, that’s a special rotation for WPF edition.

And we support rotation projection and raster rotation.

So please let us know your rotataion way and what’s the data type you are using.

More valid code should be helpful.

Regards,

Don

The map is rotated using the following code:

FrameworkElement element = GetElement(this.map, "EventCanvas");
        FrameworkElement allEventCanvas = GetElement(this.map, "AllEventCanvas");
        if (element != null && allEventCanvas != null)
        {
            if (allEventCanvas.ActualHeight < ActualHeight * 2)
            {
                allEventCanvas.Height = ActualHeight * 2;
                allEventCanvas.Width = ActualWidth * 2;
                allEventCanvas.Margin = new Thickness(-ActualWidth / 2, -ActualHeight / 2, 0, 0);
            }
            element.RenderTransform = new RotateTransform(this._rotationAngle, this.map.ActualWidth / 2, this.map.ActualHeight / 2);
        }

Hi Clay,

This is rotate the element, that means the map container is rotated by WPF, so you will see the blank area, that make sense.

And when element is rotated, I don’t think the screen point is correct for our map.

Please try to use RotationProjection instead of this way.

Regards,

Don

That actually makes it a little worse. It runs the map outside the bounds of the grid that it is in.

This is how it looks using my original code:

Hi Clay,

That’s very strange, because it looks the layer had been render out of map now.

Could you please show us the code you are using now so we can try to reproduce it?

We also need to know the detail dll version and data source type.

Regards,

Don