我从这个网站借用了这段代码 http://forums.arcgis.com/threads/30635-How-to-Select-Feature-by-XY-Location-and-Highlight-it-in-ArcMap-9.3-programmatically
它涉及缩放到mappoint。 但我不知道如何实现这一点。 或者我需要或使用的参考文献。
因为我是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);
}
答案 0 :(得分:0)
我从您的评论中得到了您希望为ArcMap而不是独立的WPF应用添加内容。我相信这个链接会让你开始。这是为ArcMap创建添加项的分步过程
您需要Visual Studio进行开发。
如果有帮助,请将此标记为答案。 感谢