Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
 public abstract T RelatesToShape(IRavenIndexable geometry, SpatialRelation relation);
Esempio n. 3
0
 public T Contains(IRavenIndexable geometry)
 {
     return(RelatesToShape(geometry, SpatialRelation.Contains));
 }
Esempio n. 4
0
 public T Intersects(IRavenIndexable geometry)
 {
     return(RelatesToShape(geometry, SpatialRelation.Intersects));
 }
Esempio n. 5
0
 public T Within(IRavenIndexable geometry)
 {
     return(RelatesToShape(geometry, SpatialRelation.Within));
 }
Esempio n. 6
0
 public string GetValue(IRavenIndexable target)
 {
     return target == null ? null : target.GetIndexString();
 }
Esempio n. 7
0
 public override IDocumentQuery <T> RelatesToShape(IRavenIndexable geometry, SpatialRelation relation)
 {
     return(_query.RelatesToShape(SpatialField.NameFor(_propertySelector), _writer.Write(geometry.GetSpatial4nShape()), relation));
 }
Esempio n. 8
0
 public override IRavenQueryable <T> RelatesToShape(IRavenIndexable geometry, SpatialRelation relation)
 {
     return(_source.Customize(x => x.RelatesToShape(SpatialField.NameFor(_property), _writer.Write(geometry.GetSpatial4nShape()), relation)));
 }