Exemplo n.º 1
0
 public override IDocumentQuery <T> RelatesToShape(IRavenIndexable geometry, SpatialRelation relation)
 {
     return(_query.RelatesToShape(SpatialField.NameFor(_propertySelector), _writer.Write(geometry.GetSpatial4nShape()), relation));
 }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
0
 public override IRavenQueryable <T> RelatesToShape(IRavenIndexable geometry, SpatialRelation relation)
 {
     return(_source.Customize(x => x.RelatesToShape(SpatialField.NameFor(_property), _writer.Write(geometry.GetSpatial4nShape()), relation)));
 }