其他分享
首页 > 其他分享> > ArcGIS Pro地图范围和视野范围

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.

标签:Pro,Envelope,ArcGIS,envelopeBuilder,Active,new,MapView,mapSize,范围
来源: https://www.cnblogs.com/gisoracle/p/16268417.html