protected void Spatial(string fieldName, string shapeWKT, SpatialRelation relation, double distErrorPercent) { fieldName = EnsureValidFieldName(fieldName, isNestedPath: false); var tokens = GetCurrentWhereTokens(); AppendOperatorIfNeeded(tokens); NegateIfNeeded(tokens, fieldName); var wktToken = ShapeToken.Wkt(AddQueryParameter(shapeWKT)); QueryToken relationToken; switch (relation) { case SpatialRelation.Within: relationToken = WhereToken.Within(fieldName, wktToken, distErrorPercent); break; case SpatialRelation.Contains: relationToken = WhereToken.Contains(fieldName, wktToken, distErrorPercent); break; case SpatialRelation.Disjoint: relationToken = WhereToken.Disjoint(fieldName, wktToken, distErrorPercent); break; case SpatialRelation.Intersects: relationToken = WhereToken.Intersects(fieldName, wktToken, distErrorPercent); break; default: throw new ArgumentOutOfRangeException(nameof(relation), relation, null); } tokens.AddLast(relationToken); }
protected void Spatial(string fieldName, string shapeWkt, SpatialRelation relation, SpatialUnits?units, double distErrorPercent) { fieldName = EnsureValidFieldName(fieldName, isNestedPath: false); var tokens = GetCurrentWhereTokens(); AppendOperatorIfNeeded(tokens); NegateIfNeeded(tokens, fieldName); var wktToken = ShapeToken.Wkt(AddQueryParameter(shapeWkt), units); WhereOperator whereOperator; switch (relation) { case SpatialRelation.Within: whereOperator = WhereOperator.Spatial_Within; break; case SpatialRelation.Contains: whereOperator = WhereOperator.Spatial_Contains; break; case SpatialRelation.Disjoint: whereOperator = WhereOperator.Spatial_Disjoint; break; case SpatialRelation.Intersects: whereOperator = WhereOperator.Spatial_Intersects; break; default: throw new ArgumentOutOfRangeException(nameof(relation), relation, null); } tokens.AddLast(WhereToken.Create(whereOperator, fieldName, null, new WhereToken.WhereOptions(wktToken, distErrorPercent))); }
protected override ShapeToken GetShapeToken(Func <object, string> addQueryParameter) { return(ShapeToken.Wkt(addQueryParameter(_shapeWkt))); }