private Feature[] QueryByGeometry(Shape shape, enumSpatialRelation enumSpatialRelation) { if (_reader == null) { BeginRead(); } if (_reader == null) { return(null); } using (IDbConnection conn = DbConnectionFactory.CreateDbConnection(_dbConnectionString)) { if (conn == null)//数据库连接已经关闭或链接池没有可用连接 { return(null); } conn.Open(); // Feature[] fets = _reader.Read(shape.Envelope, null, conn); if (fets != null) { foreach (Feature f in fets) { f.SetFeatureClass(_featureClass); } } return(fets); } }
void Reset() { _geometry = null; _whereclause = null; _relation = enumSpatialRelation.Intersect; }
public QueryFilter(Shape geometry, enumSpatialRelation rel, string whereClause) { _geometry = geometry; _relation = rel; _whereclause = whereClause; }
public QueryFilter(Shape geomtry, enumSpatialRelation rel) : this(geomtry) { _relation = rel; }
private Feature[] QueryByComplex(Shape shape, enumSpatialRelation rel, string whereClause) { throw new NotImplementedException(); }
private Feature[] QueryByGeometry(Shape shape, enumSpatialRelation rel) { if (shape == null) { return(null); } if (!_isReady) { BeginRead(); } if (_reader == null) { return(null); } Feature[] allfeatures = _reader.Features; if (allfeatures == null || allfeatures.Length == 0) { return(null); } List <Feature> retfets = new List <Feature>(); foreach (Feature fet in allfeatures) { if (fet.Geometry == null) { continue; } fet.SetFeatureClass(_featureClass); switch (rel) { case enumSpatialRelation.Intersect: if (fet.Geometry.Envelope.IsInteractived(shape.Envelope)) { retfets.Add(fet); } break; case enumSpatialRelation.Contains: if (shape.Envelope.Contains(fet.Geometry.Envelope)) { retfets.Add(fet); } break; case enumSpatialRelation.Within: if (fet.Geometry.Envelope.Contains(shape.Envelope)) { retfets.Add(fet); } break; case enumSpatialRelation.Disjoint: if (!fet.Geometry.Envelope.IsInteractived(shape.Envelope)) { retfets.Add(fet); } break; default: throw new NotSupportedException("数据源\"" + GetType().ToString() + "\"不支持类型为\"" + rel.ToString() + "\"的空间查询。"); } } return(retfets.Count > 0 ? retfets.ToArray() : null); }