我从http://forums.arcgis.com/threads/30635-How-to-Select-Feature-by-XY-Location-and-Highlight-it-in-ArcMap-9.3-programmatically网站借用了这个代码
它涉及到放大到一个任命。但我不知道如何实现这一点。或者我需要或使用的一些参考资料。
因为我是arcgis和c#的新手。如果有人有更多的经验可以帮助我,这将是非常感谢。
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);
}发布于 2013-10-23 13:43:14
我从你的评论,你希望为ArcMap添加,而不是一个独立的WPF应用程序。我相信这个链接会让你开始。这是一个循序渐进的过程,用于为ArcMap创建加载项。
ins/0001000001ms000000/
开发需要Visual。
如果这件事对你有帮助的话,请把它标记为答案。谢谢
https://stackoverflow.com/questions/19538759
复制相似问题