public void BeginGeometry(OpenGisGeometryType type) { if (_geomCollection == null) { _geomCollection = new SinkGeometryCollection <OpenGisGeometryType>(type); if (type == OpenGisGeometryType.GeometryCollection) { _isGeometryCollection = true; } } _currentGeometry = new SinkGeometry <OpenGisGeometryType>(type); if (_isGeometryCollection && _nestLevel > 0) { if (_nestLevel == 1) { _geomCollection.SubItems.Add(new SinkGeometryCollection <OpenGisGeometryType>(type)); } _geomCollection.SubItems.Last().Add(_currentGeometry); } else { _geomCollection.Add(_currentGeometry); } _nestLevel++; }
private IGeometryObject GeometryFromSinkGeometryCollection(SinkGeometryCollection <OpenGisGeometryType> sinkCollection) { IGeometryObject _geometry = null; switch (sinkCollection.GeometryType) { case OpenGisGeometryType.Point: _geometry = ConstructGeometryPart(sinkCollection[0]); ((Point)_geometry).BoundingBoxes = this.BoundingBox; break; case OpenGisGeometryType.MultiPoint: _geometry = new MultiPoint(sinkCollection.Skip(1) .Select(g => (Point)ConstructGeometryPart(g)) .ToList()); ((MultiPoint)_geometry).BoundingBoxes = this.BoundingBox; break; case OpenGisGeometryType.LineString: _geometry = ConstructGeometryPart(sinkCollection[0]); ((LineString)_geometry).BoundingBoxes = this.BoundingBox; break; case OpenGisGeometryType.MultiLineString: _geometry = new MultiLineString(sinkCollection.Skip(1) .Select(g => (LineString)ConstructGeometryPart(g)) .ToList()); ((MultiLineString)_geometry).BoundingBoxes = this.BoundingBox; break; case OpenGisGeometryType.Polygon: _geometry = ConstructGeometryPart(sinkCollection.First()); ((Polygon)_geometry).BoundingBoxes = this.BoundingBox; break; case OpenGisGeometryType.MultiPolygon: _geometry = new MultiPolygon(sinkCollection.Skip(1) .Select(g => (Polygon)ConstructGeometryPart(g)) .ToList()); ((MultiPolygon)_geometry).BoundingBoxes = this.BoundingBox; break; default: throw new NotSupportedException("Geometry type " + sinkCollection.GeometryType.ToString() + " is not possible in GetConstructedGeometry."); } return(_geometry); }