• ArcGIS Pro地图范围和视野范围


    atialReference sr3857 = SpatialReferenceBuilder.CreateSpatialReference(3857);
    // Builder constructors need to run on the MCT.
    using (SpatialReferenceBuilder srBuilder = new SpatialReferenceBuilder(3857))
    {
        // do something with the builder
        sr3857 = srBuilder.ToSpatialReference();
    }
    ArcGIS.Core.Geometry.Polygon envPoly = null;
    Envelope mapExtent = (Envelope)GeometryEngine.Instance.Project(MapView.Active.Extent, sr3857);
    
    private Envelope BuildEnvelope(MapPoint mapPt, Envelope inputEnvelope)
    {
        EnvelopeBuilder envelopeBuilder = new EnvelopeBuilder(SpatialReferences.WebMercator);
        envelopeBuilder.XMin = inputEnvelope.XMin;
        envelopeBuilder.YMin = inputEnvelope.YMin;
        envelopeBuilder.XMax = inputEnvelope.XMax;
        envelopeBuilder.YMax = inputEnvelope.YMax;
    
        return envelopeBuilder.ToGeometry();
    }
    Envelope mapExtent = BuildEnvelope(MapView.Active.Extent)
    
    Envelope mapExtent = EnvelopeBuilder.CreateEnvelope(MapView.Active.Extent, SpatialReferences.WebMercator);
    
    Envelope mapExtent = EnvelopeBuilder.CreateEnvelope(MapView.Active.Extent, SpatialReferences.WebMercator);
    

    Size mapSize = MapView.Active.GetViewSize();
    MapPoint pt1 = MapView.Active.ClientToMap(new Point(0, 0));
    MapPoint pt2 = MapView.Active.ClientToMap(new Point(mapSize.Width * scale, 0));
    MapPoint pt3 = MapView.Active.ClientToMap(new Point(mapSize.Width * scale, mapSize.Height * scale));
    MapPoint pt4 = MapView.Active.ClientToMap(new Point(0, mapSize.Height * scale));

    Point mapClientPt = MapView.Active.MapToClient(screenMapPt);

    bool ptIntersects = (mapClientPt.X >= 0) && (mapClientPt.Y >= 0) && (mapClientPt.X <= mapSize.Width * scale) && (mapClientPt.Y <= mapSize.Height * scale);

    This produces the exact results that I am looking for.  Once I have the rectangle I can then check to see if the mouse intersects it or not.

    Thanks again to the Esri ArcGIS Pro SDK team.

  • 相关阅读:
    SQL SERVER 2008 SA禁用,Windows帐户被删
    SQL Server表结构修改脚本
    请教高手,如何取得Target属性
    Installing Reporting Services on Windows 7, Vista or Windows Server 2008 无权限(rsAccessDenied)解决方法
    请教:如何在子页面关闭时把焦点设置到父页面的服务器控件上?
    order by newid() sql随机查询
    JS干货,笔记大全
    破解XP密码
    直接连接*.mdf 文件 获取随机数据
    总结C#获取当前路径的7种方法(转)
  • 原文地址:https://www.cnblogs.com/gisoracle/p/16268417.html
Copyright © 2020-2023  润新知