private void AssertThat(IGeometry geometry, SpatialRelation relation, IRavenIndexable geometry2, bool expected) { InitRaven(new TestIndex()); var doc = new GeoDoc { Geometry = geometry }; using (var session = Store.OpenSession()) { session.Store(doc); session.SaveChanges(); } using (var session = Store.OpenSession()) { var result = session.Query <GeoDoc, TestIndex>() .Geo(x => x.Geometry, x => x.RelatesToShape(geometry2, relation)) .Customize(x => x.WaitForNonStaleResults()) .Any(); var relationString = relation.ToString().ToLowerInvariant(); bool s = false; if (relationString.EndsWith("s")) { s = true; relationString = relationString.Substring(0, relationString.Length - 1); } var msg = string.Format("Geometry {0}{1} {2} {3}", s ? "does" : "is", result ? "" : " not", relationString, _writer.Write(geometry2.GetSpatial4nShape())); Assert.That(result, Is.EqualTo(expected), msg); } }
public abstract T RelatesToShape(IRavenIndexable geometry, SpatialRelation relation);
public T Contains(IRavenIndexable geometry) { return(RelatesToShape(geometry, SpatialRelation.Contains)); }
public T Intersects(IRavenIndexable geometry) { return(RelatesToShape(geometry, SpatialRelation.Intersects)); }
public T Within(IRavenIndexable geometry) { return(RelatesToShape(geometry, SpatialRelation.Within)); }
public string GetValue(IRavenIndexable target) { return target == null ? null : target.GetIndexString(); }
public override IDocumentQuery <T> RelatesToShape(IRavenIndexable geometry, SpatialRelation relation) { return(_query.RelatesToShape(SpatialField.NameFor(_propertySelector), _writer.Write(geometry.GetSpatial4nShape()), relation)); }
public override IRavenQueryable <T> RelatesToShape(IRavenIndexable geometry, SpatialRelation relation) { return(_source.Customize(x => x.RelatesToShape(SpatialField.NameFor(_property), _writer.Write(geometry.GetSpatial4nShape()), relation))); }