• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Topology.Envelope类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中DotSpatial.Topology.Envelope的典型用法代码示例。如果您正苦于以下问题:C# Envelope类的具体用法?C# Envelope怎么用?C# Envelope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Envelope类属于DotSpatial.Topology命名空间,在下文中一共展示了Envelope类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DetermineZoomLevel

        /// <summary>
        ///
        /// </summary>
        /// <param name="envelope"></param>
        /// <param name="rectangle"></param>
        /// <returns></returns>
        public static int DetermineZoomLevel(Envelope envelope, Rectangle rectangle)
        {
            double metersAcross = EarthRadiusKms * envelope.Width * Math.PI / 180; //find the arc length represented by the displayed map
            metersAcross *= Math.Cos(envelope.Center().Y * Math.PI / 180); //correct for the center latitude

            double metersAcrossPerPixel = metersAcross / rectangle.Width; //find the resolution in meters per pixel

            //find zoomlevel such that metersAcrossPerPix is close
            for (int i = 2; i < 19; i++)
            {
                double groundRes = GroundResolution(envelope.Center().Y, i);

                if (metersAcrossPerPixel > groundRes)
                {
                    //System.Diagnostics.Debug.WriteLine("metersPerPixel: " + metersAcrossPerPixel);
                    //System.Diagnostics.Debug.WriteLine("groundRes:      " + groundRes);
                    //double ratio = metersAcrossPerPixel / groundRes;
                    //System.Diagnostics.Debug.WriteLine("ratio: " + ratio);

                    //fix zoom level..
                    //changed to a slightly lower zoom level to increase readability
                    if (i > 2 && i < 18) return i - 1;

                    ////MessageBox.Show("MAPP: "+metersAcrossPerPixel+" , zoom: "+(i-1));
                    return i;
                }
            }

            return -1;
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:36,代码来源:TileCalculator.cs


示例2: Tile

 public Tile(int x, int y, int zoomLevel, Envelope envelope, Bitmap bitmap)
 {
     X = x;
     Y = y;
     ZoomLevel = zoomLevel;
     Envelope = envelope;
     Bitmap = bitmap;
 }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:8,代码来源:Tile.cs


示例3: ToEnvelope

        /// <summary>
        /// Generates a new envelope based on the extents of this shapefile.
        /// </summary>
        /// <returns>An Envelope</returns>
        public static IEnvelope ToEnvelope(this ShapefileHeader header)
        {
            if (header == null) throw new ArgumentNullException("header");

            var env = new Envelope(header.Xmin, header.Xmax, header.Ymin, header.Ymax, header.Zmin, header.Zmax);
            env.Minimum.M = header.Mmin;
            env.Maximum.M = header.Mmax;
            return env;
        }
开发者ID:hanchao,项目名称:DotSpatial,代码行数:13,代码来源:ShapefileHeaderExtensions.cs


示例4: ExpandEnv

        private static void ExpandEnv(Envelope env, SqlGeometry geom)
        {
            for (int i = 0, c = geom.STNumPoints().Value; i < c; i++)
            {
                SqlGeometry geomPoint = geom.STPointN(i + 1);

                env.ExpandToInclude(geomPoint.STX.Value, geomPoint.STY.Value);
            }
        }
开发者ID:interworks,项目名称:FastShapefile,代码行数:9,代码来源:Sql2Shape.cs


示例5: GetTile

 private Bitmap GetTile(int x, int y, Envelope envelope, int zoom)
 {
     Bitmap bm;
     try
     {
         bm = _serviceProvider.GetBitmap(x, y, envelope, zoom) ?? Resources.nodata;
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
         bm = Resources.nodata;
     }
     return bm;
 }
开发者ID:joelmuzz,项目名称:DotSpatial,代码行数:14,代码来源:TileManager.cs


示例6: GetBitmap

        public override Bitmap GetBitmap(int x, int y, Envelope envelope, int zoom)
        {
            try
            {
                var url = _url;
                if (url == null)
                {
                    return null;
                }

                if (url.Contains("{key}"))
                {
                    var quadKey = TileCalculator.TileXYToBingQuadKey(x, y, zoom);
                    url = url.Replace("{key}", quadKey);
                }
                else
                {
                    url = url.Replace("{zoom}", zoom.ToString(CultureInfo.InvariantCulture));
                    url = url.Replace("{x}", x.ToString(CultureInfo.InvariantCulture));
                    url = url.Replace("{y}", y.ToString(CultureInfo.InvariantCulture));
                }

                using (var client = new WebClient())
                {
                    var stream = client.OpenRead(url);
                    if (stream != null)
                    {
                        var bitmap = new Bitmap(stream);
                        stream.Flush();
                        stream.Close();
                        return bitmap;
                    }
                }
            }
            catch (Exception ex)
            {
                if (ex is WebException ||
                    ex is TimeoutException)
                {
                    return ExceptionToBitmap(ex, 256, 256);
                }
                Debug.WriteLine(ex.Message);
            }

            return null;
        }
开发者ID:hanchao,项目名称:DotSpatial,代码行数:46,代码来源:OtherServiceProvider.cs


示例7: GetBitmap

        public override Bitmap GetBitmap(int x, int y, Envelope envelope, int zoom)
        {
            var ts = TileSource;
            if (ts == null) return null;

            var zoomS = zoom.ToString(CultureInfo.InvariantCulture);
            try
            {
                var index = new TileIndex(x, y, zoom.ToString(CultureInfo.InvariantCulture));
                var tc = TileCache;
                var bytes = tc != null ? tc.Find(index) : null;
                if (bytes == null)
                {
                    var mapVertices = new[]
                    {
                        envelope.TopLeft().X, envelope.TopLeft().Y,
                        envelope.BottomRight().X, envelope.BottomRight().Y
                    };
                    double[] viewExtentZ = { 0.0, 0.0 };
                    Reproject.ReprojectPoints(mapVertices, viewExtentZ, Wgs84Proj, _data.CrsProjectionInfo, 0, mapVertices.Length / 2);
                    var geogEnv = new Envelope(mapVertices[0], mapVertices[2], mapVertices[1], mapVertices[3]);
                    bytes = ts.Provider.GetTile(new TileInfo {Extent = ToBrutileExtent(geogEnv), Index = index});
                    var bm = new Bitmap(new MemoryStream(bytes));
                    if (tc != null)
                    {
                        tc.Add(index, bytes);
                    }
                    return bm;
                }
                return new Bitmap(new MemoryStream(bytes));
            }
            catch (Exception ex)
            {
                if (ex is WebException ||
                    ex is TimeoutException)
                {
                    return ExceptionToBitmap(ex, TileSource.Schema.GetTileWidth(zoomS), TileSource.Schema.GetTileHeight(zoomS));
                }
                Debug.WriteLine(ex.Message);
            }
            return null;
        }
开发者ID:hanchao,项目名称:DotSpatial,代码行数:42,代码来源:WmsServiceProvider.cs


示例8: GetBitmap

        public override Bitmap GetBitmap(int x, int y, Envelope envelope, int zoom)
        {
            var ts = TileSource;
            if (ts == null) return null;

            var zoomS = zoom.ToString(CultureInfo.InvariantCulture);
            try
            {
                var index = new TileIndex(x, y, zoomS);
                var tc = TileCache;
                var bytes = tc != null ? tc.Find(index) : null;
                if (bytes == null)
                {
                    var extent = ToBrutileExtent(envelope);
                    var tileInfo = ts.Schema.GetTilesInView(extent, zoomS).FirstOrDefault();
                    if (tileInfo == null)
                    {
                        return null;
                    }
                    tileInfo.Index = index;
                    bytes = ts.Provider.GetTile(tileInfo);
                    var bm = new Bitmap(new MemoryStream(bytes));
                    if (tc != null)
                    {
                        tc.Add(index, bytes);
                    }
                    return bm;
                }
                return new Bitmap(new MemoryStream(bytes));
            }
            catch (Exception ex)
            {
                if (ex is WebException ||
                    ex is TimeoutException)
                {
                    return ExceptionToBitmap(ex, TileSource.Schema.GetTileWidth(zoomS), TileSource.Schema.GetTileHeight(zoomS));
                }
                Debug.WriteLine(ex.Message);
            }
            return null;
        }
开发者ID:hanchao,项目名称:DotSpatial,代码行数:41,代码来源:BrutileServiceProvider.cs


示例9: GetTiles

        public Tile[,] GetTiles(Envelope envelope, Rectangle bounds)
        {
            Coordinate mapTopLeft = envelope.TopLeft();
            Coordinate mapBottomRight = envelope.BottomRight();

            //Clip the coordinates so they are in the range of the web mercator projection
            mapTopLeft.Y = TileCalculator.Clip(mapTopLeft.Y, TileCalculator.MinLatitude, TileCalculator.MaxLatitude);
            mapTopLeft.X = TileCalculator.Clip(mapTopLeft.X, TileCalculator.MinLongitude, TileCalculator.MaxLongitude);

            mapBottomRight.Y = TileCalculator.Clip(mapBottomRight.Y, TileCalculator.MinLatitude, TileCalculator.MaxLatitude);
            mapBottomRight.X = TileCalculator.Clip(mapBottomRight.X, TileCalculator.MinLongitude, TileCalculator.MaxLongitude);

            int zoom = TileCalculator.DetermineZoomLevel(envelope, bounds);

            Point topLeftTileXY = TileCalculator.LatLongToTileXY(mapTopLeft, zoom);
            Point btmRightTileXY = TileCalculator.LatLongToTileXY(mapBottomRight, zoom);

            var tileMatrix = new Tile[(int)(btmRightTileXY.X - topLeftTileXY.X) + 1, (int)(btmRightTileXY.Y - topLeftTileXY.Y) + 1];

            Parallel.For((int) topLeftTileXY.Y, (int) btmRightTileXY.Y + 1,
                         y => Parallel.For((int) topLeftTileXY.X, (int) btmRightTileXY.X + 1,
                                           x =>
                                               {
                                                   var currTopLeftPixXY = TileCalculator.TileXYToTopLeftPixelXY(x, y);
                                                   var currTopLeftCoord =TileCalculator.PixelXYToLatLong((int) currTopLeftPixXY.X,
                                                                                       (int) currTopLeftPixXY.Y, zoom);

                                                   var currBtmRightPixXY = TileCalculator.TileXYToBottomRightPixelXY(x,
                                                                                                                     y);
                                                   var currBtmRightCoord =TileCalculator.PixelXYToLatLong((int) currBtmRightPixXY.X,
                                                                                       (int) currBtmRightPixXY.Y, zoom);

                                                   var currEnv = new Envelope(currTopLeftCoord, currBtmRightCoord);

                                                   var tile = GetTile(x, y, currEnv, zoom);
                                                   tileMatrix[x - (int) topLeftTileXY.X, y - (int) topLeftTileXY.Y] =tile;
                                               }
                                  ));

            return tileMatrix;
        }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:41,代码来源:TileManager.cs


示例10: ShapefileReader

        public ShapefileReader(string path, IGeometryFactory geometryFactory = null, GeometryTransform transform = null)
        {
            _gf = geometryFactory ?? new GeometryFactory();
            _reader = new BinaryReader(new FileStream(path, FileMode.Open, FileAccess.Read));
            ShapeHeader = ShapefileHeader.Read(_reader);
            ShapeEnvelope = new Envelope();

            switch (ShapeHeader.ShapeType)
            {
                case ShapefileGeometryType.Point:
                case ShapefileGeometryType.PointZ:
                    _shapeFunc = ReadPoint;
                    break;
                case ShapefileGeometryType.PolyLine:
                case ShapefileGeometryType.PolyLineZ:
                    _shapeFunc = ReadPolyLine;
                    break;
                case ShapefileGeometryType.Polygon:
                case ShapefileGeometryType.PolygonZ:
                    _shapeFunc = ReadPolygon;
                    break;
                case ShapefileGeometryType.MultiPoint:
                case ShapefileGeometryType.MultiPointZ:
                    _shapeFunc = ReadMultiPoint;
                    break;
                default:
                    throw new Exception("Shape type is not supported");
            }

            if (transform != null)
            {
                _transform = transform;

                Func<IGeometry> origFun = _shapeFunc;
                _shapeFunc = () =>
                {
                    return _transform.Apply(origFun());
                };
            }
        }
开发者ID:interworks,项目名称:FastShapefile,代码行数:40,代码来源:ShapefileReader.cs


示例11: GetTiles

        public Tiles GetTiles(Envelope envelope, Rectangle bounds, BackgroundWorker bw)
        {
            var mapTopLeft = envelope.TopLeft();
            var mapBottomRight = envelope.BottomRight();

            //Clip the coordinates so they are in the range of the web mercator projection
            mapTopLeft.Y = TileCalculator.Clip(mapTopLeft.Y, TileCalculator.MinLatitude, TileCalculator.MaxLatitude);
            mapTopLeft.X = TileCalculator.Clip(mapTopLeft.X, TileCalculator.MinLongitude, TileCalculator.MaxLongitude);

            mapBottomRight.Y = TileCalculator.Clip(mapBottomRight.Y, TileCalculator.MinLatitude, TileCalculator.MaxLatitude);
            mapBottomRight.X = TileCalculator.Clip(mapBottomRight.X, TileCalculator.MinLongitude, TileCalculator.MaxLongitude);

            var zoom = TileCalculator.DetermineZoomLevel(envelope, bounds);

            var topLeftTileXY = TileCalculator.LatLongToTileXY(mapTopLeft, zoom);
            var btmRightTileXY = TileCalculator.LatLongToTileXY(mapBottomRight, zoom);

            var tileMatrix = new Bitmap[(int)(btmRightTileXY.X - topLeftTileXY.X) + 1, (int)(btmRightTileXY.Y - topLeftTileXY.Y) + 1];
            var po = new ParallelOptions { MaxDegreeOfParallelism = -1 };
            Parallel.For((int)topLeftTileXY.Y, (int)btmRightTileXY.Y + 1, po,
                         (y, loopState) => Parallel.For((int)topLeftTileXY.X, (int)btmRightTileXY.X + 1, po,
                                           (x, loopState2) =>
                                           {
                                               if (bw.CancellationPending)
                                               {
                                                   loopState.Stop();
                                                   loopState2.Stop();
                                                   return;
                                               }
                                               var currEnv = GetTileEnvelope(x, y, zoom);
                                               tileMatrix[x - (int)topLeftTileXY.X, y - (int)topLeftTileXY.Y] = GetTile(x, y, currEnv, zoom);
                                           }
                                  ));

            return new Tiles(tileMatrix,
                GetTileEnvelope((int)topLeftTileXY.X, (int)topLeftTileXY.Y, zoom),  // top left tile = tileMatrix[0,0]
                GetTileEnvelope((int)btmRightTileXY.X, (int)btmRightTileXY.Y, zoom) // bottom right tile = tileMatrix[last, last]
                );
        }
开发者ID:joelmuzz,项目名称:DotSpatial,代码行数:39,代码来源:TileManager.cs


示例12: GetTile

        /// <summary>
        ///
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="envelope"></param>
        /// <param name="zoom"></param>
        /// <returns></returns>
        public Tile GetTile(int x, int y, Envelope envelope, int zoom)
        {
            Bitmap bitmap = _tileCache.Get(zoom, x, y);
            if (null == bitmap)
            {
                bitmap = GetViaBrutile(x, y, zoom, envelope);
            }
            if (null != bitmap)
            {
                var tile = new Tile(x, y, zoom, envelope, bitmap);
                return tile;
            }
            try
            {
                string url = _tileServerUrl;

                if (url.Contains("{key}"))
                {
                    string quadKey = TileCalculator.TileXYToBingQuadKey(x, y, zoom);
                    url = url.Replace("{key}", quadKey);
                }
                else
                {
                    url = url.Replace("{zoom}", zoom.ToString());
                    url = url.Replace("{x}", x.ToString());
                    url = url.Replace("{y}", y.ToString());
                }

                var client = new WebClient();
                var stream = client.OpenRead(url);

                if (stream != null)
                    bitmap = new Bitmap(stream);

                var tile = new Tile(x, y, zoom, envelope, bitmap);

                if (stream != null)
                {
                    stream.Flush();
                    stream.Close();
                }

                //Put the tile in the cache
                _tileCache.Put(tile);

                return tile;
            }
            catch (Exception ex)
            {
                // We may see a 400 (Bad Request) when the user is zoomed in too far.
                Debug.WriteLine(ex.Message);

                //Return a No Data Available tile
                var noDataTile = new Tile(x, y, zoom, envelope, resources.NoDataTile);

                return noDataTile;
            }
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:66,代码来源:TileManager.cs


示例13: DeselectAll_Click

 /// <summary>
 /// Deselect all features in all layers
 /// </summary>
 private void DeselectAll_Click(object sender, EventArgs e)
 {
     IEnvelope env = new Envelope();
     App.Map.MapFrame.ClearSelection(out env);
     
     //foreach (IMapLayer layer in App.Map.MapFrame.GetAllLayers())
     //{
     //    IMapFeatureLayer mapFeatureLayer = layer as IMapFeatureLayer;
     //    {
     //        mapFeatureLayer.UnSelectAll();
     //    }
     //}
 }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:16,代码来源:MenuBarPlugin.cs


示例14: OnMouseUp

        /// <summary>
        /// Handles the Mouse Up situation
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseUp(GeoMouseArgs e)
        {
            if (Map == null) Map = e.Map;
            Stopwatch sw = new Stopwatch();
            sw.Start();
            if (_isDragging == false) return;
            _currentPoint = e.Location;
            _isDragging = false;
            //Map.Invalidate(); // Get rid of the selection box
            //Application.DoEvents();
            IEnvelope env = new Envelope(_geoStartPoint.X, e.GeographicLocation.X,
                _geoStartPoint.Y, e.GeographicLocation.Y);
            IEnvelope tolerant = env;

            if (_startPoint.X == e.X && _startPoint.Y == e.Y)
            {
                // click selection doesn't work quite right without some tiny tolerance.
                double tol = Map.MapFrame.ViewExtents.Width / 10000;
                env.ExpandBy(tol);
            }

            if (Math.Abs(_startPoint.X - e.X) < 8 && Math.Abs(_startPoint.Y - e.Y) < 8)
            {
                Coordinate c1 = e.Map.PixelToProj(new Point(e.X - 4, e.Y - 4));
                Coordinate c2 = e.Map.PixelToProj(new Point(e.X + 4, e.Y + 4));
                tolerant = new Envelope(c1, c2);
            }

            former = null;
            foreach (var l in Map.MapFrame.GetAllLayers())
            {
                if (l.IsSelected)
                {
                    former = l;
                    l.IsSelected = false;
                }
            }
            if (former == null && Map.MapFrame.IsSelected)
            {
                former = Map.MapFrame;
            }
            Map.MapFrame.IsSelected = true;
            Map.MapFrame.SuspendEvents();
            HandleSelection(tolerant, env);
            Map.MapFrame.IsSelected = false;
            if (former != null)
            {
                former.IsSelected = true;
            }
            Map.MapFrame.ResumeEvents();
            // Force an invalidate to clear the dotted lines, even if we haven't changed anything.
            e.Map.Invalidate();
            //e.Map.MapFrame.Initialize();
            sw.Stop();

            Debug.WriteLine("Initialize: " + sw.ElapsedMilliseconds);
            base.OnMouseUp(e);
            Map.IsBusy = false;
        }
开发者ID:joelmuzz,项目名称:DotSpatial,代码行数:63,代码来源:MapFunctionSelect.cs


示例15: GetEnvelope

 private IEnvelope GetEnvelope()
 {
     IEnvelope env = new Envelope();
     foreach (IFeature f in this)
     {
         env.ExpandToInclude(f.Envelope);
     }
     return env;
 }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:9,代码来源:FeatureSelection.cs


示例16: InvertSelection

        /// <summary>
        /// Inverts the selection based on the current SelectionMode
        /// </summary>
        /// <param name="region">The geographic region to reverse the selected state</param>
        /// <param name="affectedArea">The affected area to invert</param>
        public bool InvertSelection(IEnvelope region, out IEnvelope affectedArea)
        {
            SuspendChanges();
            bool flipped = false;
            affectedArea = new Envelope();

            IDictionary<IFeature, IDrawnState> states = Filter.DrawnStates;
            foreach (KeyValuePair<IFeature, IDrawnState> kvp in states)
            {
                bool doFlip = false;
                IFeature f = kvp.Key;
                if (SelectionMode == SelectionMode.IntersectsExtent)
                {
                    if (region.Intersects(f.Envelope))
                    {
                        kvp.Value.IsSelected = !kvp.Value.IsSelected;
                        affectedArea.ExpandToInclude(f.Envelope);
                    }
                }
                else if (SelectionMode == SelectionMode.ContainsExtent)
                {
                    if (region.Contains(f.Envelope))
                    {
                        kvp.Value.IsSelected = !kvp.Value.IsSelected;
                        affectedArea.ExpandToInclude(f.Envelope);
                    }
                }
                IPolygon reg = region.ToPolygon();
                IGeometry geom = Geometry.FromBasicGeometry(f.BasicGeometry);
                switch (SelectionMode)
                {
                    case SelectionMode.Contains:
                        if (region.Intersects(f.Envelope))
                        {
                            if (reg.Contains(geom)) doFlip = true;
                        }
                        break;
                    case SelectionMode.CoveredBy:
                        if (reg.CoveredBy(geom)) doFlip = true;
                        break;
                    case SelectionMode.Covers:
                        if (reg.Covers(geom)) doFlip = true;
                        break;
                    case SelectionMode.Disjoint:
                        if (reg.Disjoint(geom)) doFlip = true;
                        break;
                    case SelectionMode.Intersects:
                        if (region.Intersects(f.Envelope))
                        {
                            if (reg.Intersects(geom)) doFlip = true;
                        }
                        break;
                    case SelectionMode.Overlaps:
                        if (reg.Overlaps(geom)) doFlip = true;
                        break;
                    case SelectionMode.Touches:
                        if (reg.Touches(geom)) doFlip = true;
                        break;
                    case SelectionMode.Within:
                        if (reg.Within(geom)) doFlip = true;
                        break;
                }
                if (doFlip)
                {
                    flipped = true;
                    kvp.Value.IsSelected = !kvp.Value.IsSelected;
                    affectedArea.ExpandToInclude(f.Envelope);
                }
            }
            ResumeChanges();
            return flipped;
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:77,代码来源:FeatureSelection.cs


示例17: UnSelect

 /// <summary>
 /// Adds any members found in the specified region to the selected state as long as SelectionEnabled is set to true.
 /// </summary>
 /// <param name="tolerant">The geographic region where selection occurs that is tolerant for point or linestrings.</param>
 /// <param name="strict">The tight envelope to use for polygons.</param>
 /// <param name="mode">The selection mode.</param>
 /// <param name="affectedArea">The envelope affected area.</param>
 /// <returns>Boolean, true if any members were added to the selection.</returns>
 public bool UnSelect(IEnvelope tolerant, IEnvelope strict, SelectionMode mode, out IEnvelope affectedArea)
 {
     affectedArea = new Envelope();
     if (MapFrame == null) return false;
     return MapFrame.UnSelect(tolerant, strict, mode, out affectedArea);
 }
开发者ID:nikson898,项目名称:dot-spatial,代码行数:14,代码来源:Map.cs


示例18: InvertSelection

        /// <summary>
        /// This method inverts the selection for the specified region.  Members already a part of the selection
        /// will be removed from the selection, while members that are not a part of the selection will be added
        /// to the selection.
        /// </summary>
        /// <param name="tolerant">
        /// The region specifying where features should be added or removed from the
        /// selection.
        /// </param>
        /// <param name="strict">
        /// With polygon selection it is better not to allow any tolerance since the
        ///  polygons already contain it.
        /// </param>
        /// <param name="selectionMode">
        /// The SelectionModes enumeration that clarifies how the features should
        /// interact with the region.
        /// </param>
        /// <param name="affectedArea">
        /// The geographic region that will be impacted by the changes.
        /// </param>
        /// <returns>
        /// The invert selection.
        /// </returns>
        public override bool InvertSelection(IEnvelope tolerant, IEnvelope strict, SelectionMode selectionMode,
                                             out IEnvelope affectedArea)
        {
            if (!_drawnStatesNeeded && !_editMode)
            {
                AssignFastDrawnStates();
            }

            IEnvelope region = tolerant;
            if (DataSet.FeatureType == FeatureType.Polygon)
            {
                region = strict;
            }

            affectedArea = new Envelope();
            bool changed = false;

            _selection.SelectionMode = selectionMode;
            if (IsWithinLegendSelection() || _scheme.IsWithinLegendSelection())
            {
                changed = _selection.InvertSelection(region, out affectedArea);
            }
            else
            {
                if (!_drawnStatesNeeded)
                {
                    AssignFastDrawnStates();
                }

                SuspendChangeEvent();
                _selection.SuspendChanges();
                List<IFeatureCategory> categories = _scheme.GetCategories().ToList();
                foreach (IFeatureCategory category in categories)
                {
                    if (!category.IsWithinLegendSelection())
                    {
                        continue;
                    }

                    _selection.RegionCategory = category;
                    if (_selection.AddRegion(region, out affectedArea))
                    {
                        changed = true;
                    }

                    _selection.RegionCategory = null;
                }

                _selection.ResumeChanges();
                ResumeChangeEvent();
            }

            return changed;
        }
开发者ID:joelmuzz,项目名称:DotSpatial,代码行数:77,代码来源:FeatureLayer.cs


示例19: Intersects

 /// <summary>
 /// Test the point q to see whether it intersects the Envelope
 /// defined by p1-p2.
 /// </summary>
 /// <param name="p1">One extremal point of the envelope.</param>
 /// <param name="p2">Another extremal point of the envelope.</param>
 /// <param name="q">Point to test for intersection.</param>
 /// <returns><c>true</c> if q intersects the envelope p1-p2.</returns>
 public static bool Intersects(Coordinate p1, Coordinate p2, Coordinate q)
 {
     Envelope env = new Envelope(p1, p2);
     return env.Intersects(q);
 }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:13,代码来源:Envelope.cs


示例20: ClearSelection

 /// <summary>
 /// Removes any members from existing in the selected state
 /// </summary>
 public bool ClearSelection(out IEnvelope affectedArea)
 {
     affectedArea = new Envelope();
     if (MapFrame == null) return false;
     return MapFrame.ClearSelection(out affectedArea);
 }
开发者ID:nikson898,项目名称:dot-spatial,代码行数:9,代码来源:Map.cs



注:本文中的DotSpatial.Topology.Envelope类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DowntimeCollection_Demo.DB类代码示例发布时间:2022-05-24
下一篇:
C# Projections.ProjectionInfo类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap