我从本网站 http://forums.arcgis.com/threads/30635-How-to-Select-Feature-by-XY-Location-and-Highlight-it-in-ArcMap-9.3-programmaticallyArcGIS中使用的参考
它涉及缩放到一个MapPoint借用了这个代码。 但我不知道如何实现这一点。 或至少需要或使用的引用。
因为我在arcgis和c#总noob。 如果有更多经验的人可以帮助我 它将不胜感激。
public static void CaptureMapCoordinates(int x, int y)
{
// get the map coordinates from the screen coordinates
IPoint pScreenPoint = new ESRI.ArcGIS.Geometry.Point();
IPoint pMapPoint = new ESRI.ArcGIS.Geometry.Point();
IEnvelope pEnv = new EnvelopeClass();
pScreenPoint.X = x;
pScreenPoint.Y = y;
pMapPoint = GetMapCoordinatesFromScreenCoordinates(pScreenPoint, pActiveView);
pEnv = pActiveView.Extent;
pEnv.CenterAt(pMapPoint);
pActiveView.Extent = pEnv;
pActiveView.Refresh();
}
private static IPoint GetMapCoordinatesFromScreenCoordinates(IPoint pScreenPoint, IActiveView pActiveView)
{
IScreenDisplay pScreenDisplay;
IDisplayTransformation pDisplayTransformation;
if (pScreenPoint == null || pScreenPoint.IsEmpty || pActiveView == null)
{
return null;
}
pScreenDisplay = pActiveView.ScreenDisplay;
pDisplayTransformation = pScreenDisplay.DisplayTransformation;
return pDisplayTransformation.ToMapPoint((int)pScreenPoint.X, (int)pScreenPoint.Y);
}
你想达到什么目的?要在WPF应用程序中将要素图层添加到底图中,然后在点击/单击要素图层的要素时,是否要将该位置放大?你已经完成底图部分和要素图层部分了吗?您是否已经使用ESRI API参考创建了一个WPF应用程序? – azmuhak
@azmuhak我想放大zo坐标(如果可以在可停靠的窗口中通过事件)我只需要给它坐标,它就会去那里。 – Robin
明白了。你还可以在上面的评论中回答我的其他问题吗? – azmuhak