Dear All,
Background: ArcGIS Engine 9.3.1 windows application using .NET SDK.
I am opening a windows form on click of custom command present in ArcMap. I have a scenecontrol in this form. On form load, I am loading .sxd and then I am executng a small query and then selecting the features. After tat, I have to zoom to selected features during form load itself.
I am trying below piece of code to zoom to envelope of selected features (envv, below, is envelope of selected features, got by Union of all envelopes)
axSceneControl1.Scene.SceneGraph.ActiveViewer.Camera.ZoomToRect(envv);
axSceneControl1.Scene.SceneGraph.ActiveViewer.Redraw(true);
Interestingly, the "ZoomToRect" method above expects screen envelope of type IEnvelope.
How can I convert envelope to screen envelope?.
I have below piece of code to convert into screen, but it requires 'IActiveView' object.
ESRI.ArcGIS.Display.IScreenDisplay screenDisplay = activeView.ScreenDisplay;ESRI.ArcGIS.Display.IDisplayTransformation displayTransformation = screenDisplay.DisplayTransformation;displayTransformation.FromMapPoint(mapPoint, out x, out y);
I tried getting activeView object by casting axSceneControl into IBasicMap and then casting the result into IActiveView.But it is returning wrong values.
Since I have the scenecontrol in the windows form, do i need to implement IApplication interface to access activeview?
If this method is incorrect, then how to achieve zoom to selected features in scene form?
With Regards,
Muzammil.