Rotate a geometry object (and derived types) around its center point?

1427
5
07-21-2016 04:07 PM
JacobNosal
New Contributor III

I have selected a feature and want to display it horizontally across my screen. I have found the angle of rotation already, but there doesn't seem to be any support for rotating an object of type Geometry around its center point by some angle. I would like to keep this as a feature and not move into the Graphics realm.

0 Kudos
5 Replies
LucasDanzinger
Esri Frequent Contributor

Are you saying you just want to render it on the screen with a rotation? Or do you actually want to rotate the entire geometry and update the geometry of the feature?

0 Kudos
JacobNosal
New Contributor III

Well, I suppose that I'd like to rotate the entirety of the geometry. But I'm not wanting to update the feature that it came from. To clarify, I've selected a feature from a feature table and called queryEnvelope() to return the enclosing envelope of the feature. It is this envelope that I want to rotate as a way to set the extent of the map.

0 Kudos
LucasDanzinger
Esri Frequent Contributor

So once you get the envelope back, you then want to zoom the map to that envelope, but you also want to rotate the map's extent by some degree?

0 Kudos
JacobNosal
New Contributor III

The map rotation was a hack to get some other functionality working. My desire would be to rotate the envelope and set the extent to the envelope -- which would negate the map rotation portion of my question. I really just want to be able to rotate a Geometry object around its centroid by a given angle.

I would add that this would be near equivalent (in my mind) to setting the map rotation and the calling ZoomTo(geom), but that method always seems to zoom in too far. It cuts out large portions of the features I want to zoom to, rendering it useless without zooming out.

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Yea, I am not sure how you would go about manipulating the geometries like that, other than doing some math on your own. I'm not sure what that would entail. We are looking to add rotation renderers in the future, so features could be rotated by an attribute field in the associated table. In your case, I think you need to zoom to, then rotate map. You may need to manually add some padding around the envelope by buffering it. Then zoom to that, and it should be slightly zoomed out further. In our Quartz release (which is available in beta right now), you can zoom to a geometry, and set the padding in device independent pixels, so that should likely fix the issue of it zooming in too far.