Hello,
i'm using arcgis\engine 9.3 with .net c# language.
i'm trying to add some custom 3d capabilities to arcmap,
my current step is to synchronize between the 2d arcmap view and the 3d globecontrol view.
but i'm facing some difficulties 😞
arcmap needs center point and scale,
i'm setting the center point to axGlobeControl.GlobeDisplay.ActiveViewer.Camera.Target
but how to set scale?
currently i'm using this code:
but it doesnt give the expected behavior.
void SetMapView(object sender, ESRI.ArcGIS.Geometry.IPoint TgtPoint, ESRI.ArcGIS.Geometry.IPoint ObsPoint, double spaceLeng)
{
try
{
ArcMap.Document.ActiveView.Activate(ArcMap.Application.hWnd);
ESRI.ArcGIS.Geometry.IPoint[] points = new ESRI.ArcGIS.Geometry.IPoint[2];
points[0] = ObsPoint;
points[1] = TgtPoint;
ESRI.ArcGIS.Geometry.Envelope newExtent = new ESRI.ArcGIS.Geometry.Envelope();
newExtent.DefineFromPoints(ref points);
newExtent.CenterAt(TgtPoint);
ArcMap.Document.ActiveView.Extent = (ESRI.ArcGIS.Geometry.IEnvelope)newExtent;
m_map.MapScale = spaceLeng * 100000; // 100000 is for test
ArcMap.Document.ActiveView.Refresh();
//ArcMap.Document.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
--------------------------------------------------------------------
TgtPoint = axGlobeControl.GlobeDisplay.ActiveViewer.Camera.Target
ObsPoint = axGlobeControl.GlobeDisplay.ActiveViewer.Camera.Observer
spaceLeng = axGlobeControl.GlobeDisplay.ActiveViewer.Camera.ViewingDistance
--------------------------------------------------------------------
- axGlobeControl.GlobeDisplay.ActiveViewer.Camera.ViewingDistance is not effected when zoom in and out
- when the camera is not vertical above the globe surface the "newExtent" in the previous code gives view that is zoomed in or out more than wanted.
thanks in advance.