Rectangle drawing rotated along with the map

1150
5
11-24-2010 09:49 PM
bernardnguyen
New Contributor
We ran into this issue where when we rotate the map for example 45 degrees and draw a rectangle, this rectangular drawing also get rotated.  This is not the behavior that we have in mind since the drawing is supposed to zoom into the area of the drawn rectangle.  Is there a way that we could reset the rotation of the drawing?

Help appreciated,
Bernard N
0 Kudos
5 Replies
DominiqueBroux
Esri Frequent Contributor
When you rotate the map, you rotate at the same time all the layers inside the map including the graphicslayer.
This is 'By Design' else the result would be very stange in most cases.

For your case, I think that the best way is you to calculate the geometry (polyline or polygon) of your rectangle in order this rectangle looks not rotated for the the user (would nee a few sine and cosine:)).
0 Kudos
bernardnguyen
New Contributor
I don't even think its possible anymore.

Since, the drawing is a built-in feature and to enable it you simply set IsEnabled = true to start drawing.  As soon as you click on a point and start dragging the rectangle is being drawn on the screen so I doubt that I can override this part of the rendering.  I checked the layer's properties but couldnt find anything useful.

private void InitApp()
{
MyDrawObject = new Draw(myMap)
                {
                    FillSymbol = DefaultFillSymbol,
                    DrawMode = DrawMode.Rectangle
                };

                MyDrawObject.DrawComplete += myDrawObject_DrawComplete;
}

private void radBtnZoomIn_Click(object sender, RoutedEventArgs e)
{
            MyDrawObject.IsEnabled = true;
            _toolMode = "zoomin";
}



Thanks for your help.


Bernard
0 Kudos
DominiqueBroux
Esri Frequent Contributor
You are right. I don't think it's possible with the built-in draw object.

You could write your own draw which would draw a rectangle over the map, but I guess it's not that simple.
0 Kudos
jmmGeoToo
Emerging Contributor
I want to clarify the issue here...

The rectangle in question is not a cartographic element or markup but rather the visual indicator of the rectangular selection and marquee zoom tools.  Are these being rendered (during mouse-down events only as they are immediately deleted on mouse-up) in the graphics layer?
0 Kudos
JenniferNery
Esri Regular Contributor
From the previous posts, I believe the rectangle is a graphic with envelope geometry, created by Draw object and added to a GraphicsLayer.

Because if it were the rectangle used for zoom to selection, it would have been removed from the map before the zoom.
0 Kudos