Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用参考资料的arcgis_C#_Arcgis - Fatal编程技术网

C# 使用参考资料的arcgis

C# 使用参考资料的arcgis,c#,arcgis,C#,Arcgis,我从这个网站上借用了这个代码 它涉及到缩放到贴图点。 但我不知道如何实现这一点。 或者我需要或使用的参考资料 因为我在arcgis和c完全是个笨蛋。 如果有经验多一点的人能帮我 非常感谢 public static void CaptureMapCoordinates(int x, int y) { // get the map coordinates from the screen coordinates IPoint pScreenPoint = n

我从这个网站上借用了这个代码

它涉及到缩放到贴图点。 但我不知道如何实现这一点。 或者我需要或使用的参考资料

因为我在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);
    }

我从您的评论中得知,您希望为ArcMap制作外接程序,而不是独立的WPF应用程序。我相信这个链接会让你开始。这是为ArcMap创建外接程序的逐步过程

您将需要Visual Studio进行开发

如果这对您有帮助,请将其标记为答案。
谢谢

你想实现什么目标?是否要在WPF应用程序中将要素图层添加到底图中,然后在点击/单击要素图层的要素时,是否要放大该位置?您是否已经完成了底图部分和要素图层部分?你已经创建了一个带有ESRI API引用的WPF应用程序吗?@azmuhak我想缩放zo坐标,如果可能的话,通过可停靠窗口中的事件,我只给它坐标,它就会去那里。明白了。您还可以回答我在上述评论中的其他问题吗?@azmuhak我还没有创建wpf应用程序,但我希望可以在外接程序应用程序中实现这一点。@azmuhak我想创建一个外接程序,当我单击其中一个名称arcmap将转到该位置时,该外接程序的一部分是正确的。但这并没有帮助我实现我所需要的缩放。如果你知道这方面的任何事情,将不胜感激。你得到的代码是好的。但是在代码前后都有很多东西丢失了。我谈论的是项目设置和添加服务引用,以及编写标记文件和c类,最终将在其中添加这两个方法。这就是为什么我共享了这个链接来帮助您入门,当您使用这个链接上的信息创建了一个基本的加载项,然后尝试在这个基本项目中添加这些函数。如果在这一点上出现任何问题,请在此处发布,我们将看到如何解决。