• IActiveView坐标转换


    PageLayoutControl页面坐标与地理坐标的相互转换:

    1, 页面坐标到地理坐标的转换分两步:

    (1)将IPageLayout转为IActiveView,IActiveView.ScreenDisplay.DisplayTransformation.FromMapPoin(); 将页面坐标转为屏幕坐标;

    (2)将FocusMap转为IActiveView,IActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(); 将屏幕坐标转为地理坐标。

    2, 地理坐标转换为页面坐标也是分两步:

    (1)将FocusMap转为IActiveView,IActiveView.ScreenDisplay.DisplayTransformation.FromMapPoint();将地理坐标转为屏幕坐标;

    (2)将IPageLayout转为IActiveView,IActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint();将屏幕坐标转为页面坐标。

    此外,其IDisplayTransformation.FromPoints方法可以将point(1/72 inch) distance转为map distance;IDisplayTransformation.ToPoints方法可以将map distance转为point distance。



    例1、屏幕坐标转为地理坐标:

    public IPoint GetMapCoordinatesFromScreenCoordinates(IPoint screenPoint, IActiveView activeView)
            {
                if (screenPoint == null || screenPoint.IsEmpty || activeView == null)
                {
                    return null;
                }
                IScreenDisplay screenDisplay = activeView.ScreenDisplay;
                IDisplayTransformation displayTransformation = screenDisplay.DisplayTransformation;
    
                return displayTransformation.ToMapPoint((System.Int32)screenPoint.X, (System.Int32)screenPoint.Y);
            }
    

    例2、地理坐标转为屏幕坐标:

    public IPoint GetScreenCoordinatesFromMapCoorindates(IPoint mapPoint, IActiveView activeView)
            {
                if (mapPoint == null || mapPoint.IsEmpty || activeView == null)
                {
                    return null;
                }
                IScreenDisplay screenDisplay = activeView.ScreenDisplay;
                IDisplayTransformation displayTransformation = screenDisplay.DisplayTransformation;
                System.Int32 x;
                System.Int32 y;
                displayTransformation.FromMapPoint(mapPoint, out x, out y);
                IPoint returnPoint = new PointClass();
                returnPoint.PutCoords(x, y);
                return returnPoint;
            }



  • 相关阅读:
    php读取excel文件的实例代码
    PHP连接局域网MYSQL数据库的实例
    一个经典实用的iptables shell脚本
    PHP中strtotime函数使用方法分享
    php strtotime 函数UNIX时间戳
    解析php时间戳与日期的转换
    有关Mysql连接问题
    PHP获取时间日期的多种方法
    PHP引用符&的用法详细解析
    PHP获取与操作php.ini文件的几个函数示例
  • 原文地址:https://www.cnblogs.com/tuboshu/p/10752396.html
Copyright © 2020-2023  润新知