Beispiel #1
0
        /// <summary>
        /// Returns geometry Object IDs whose bounding box intersects 'bbox'
        /// </summary>
        /// <param name="bbox"></param>
        /// <returns></returns>
        public Collection <uint> GetObjectIDsInView(SharpMap.Geometries.BoundingBox bbox)
        {
            _OgrLayer.SetSpatialFilterRect(bbox.Min.X, bbox.Min.Y, bbox.Max.X, bbox.Max.Y);
            OGR.Feature _OgrFeature = null;
            _OgrLayer.ResetReading();

            Collection <uint> _ObjectIDs = new Collection <uint>();

            while ((_OgrFeature = _OgrLayer.GetNextFeature()) != null)
            {
                _ObjectIDs.Add((uint)_OgrFeature.GetFID());
                _OgrFeature.Dispose();
            }
            return(_ObjectIDs);
        }
Beispiel #2
0
        /// <summary>
        /// Returns geometries within the specified bounding box
        /// </summary>
        /// <param name="bbox"></param>
        /// <returns></returns>
        public Collection <SharpMap.Geometries.Geometry> GetGeometriesInView(SharpMap.Geometries.BoundingBox bbox)
        {
            Collection <SharpMap.Geometries.Geometry> geoms = new Collection <SharpMap.Geometries.Geometry>();

            _OgrLayer.SetSpatialFilterRect(bbox.Left, bbox.Bottom, bbox.Right, bbox.Top);
            OGR.Feature _OgrFeature = null;

            _OgrLayer.ResetReading();
            while ((_OgrFeature = _OgrLayer.GetNextFeature()) != null)
            {
                geoms.Add(this.ParseOgrGeometry(_OgrFeature.GetGeometryRef()));
                _OgrFeature.Dispose();
            }

            return(geoms);
        }
Beispiel #3
0
 /// <summary>
 /// Returns the geometry corresponding to the Object ID
 /// </summary>
 /// <param name="oid">Object ID</param>
 /// <returns>geometry</returns>
 public SharpMap.Geometries.Geometry GetGeometryByID(uint oid)
 {
     using (OGR.Feature _OgrFeature = _OgrLayer.GetFeature((int)oid))
         return(this.ParseOgrGeometry(_OgrFeature.GetGeometryRef()));
 }