Example #1
0
        private ICriteria CreateCriteriaWithSpatial(IGeometry filterGeom)
        {
            ICriteria cr = CurrentSession.CreateCriteria <TEntity>();

            cr.Add(SpatialRestrictions.Filter(ExpressionHelper.GetPropertyName <IAbschnittGISBase, IGeometry>(e => e.Shape), filterGeom));
            return(cr);
        }
Example #2
0
        public IQueryOver <TEntity, TEntity> FilterForBoundingBox(IQueryOver <TEntity, TEntity> queryOver, TReportParameter parameter)
        {
            var filterGeom = GISService.GetGeometryFromBoundingBox(parameter.BoundingBox);

            queryOver.UnderlyingCriteria.Add(SpatialRestrictions.Filter(ExpressionHelper.GetPropertyName <StrassenabschnittGIS, IGeometry>(e => e.Shape), filterGeom));
            return(queryOver);
        }
Example #3
0
        private IList <ZustandsabschnittGIS> GetCurrentZustandsAbschnitteBySpatialFilter(IGeometry filter, ErfassungsPeriod erfassungsperiod)

        {
            var cr = transactionScopeProvider.CurrentTransactionScope.Session.CreateCriteria <ZustandsabschnittGIS>();

            cr.CreateAlias(typeof(StrassenabschnittGIS).Name, "strassenabschnittgis", JoinType.InnerJoin);
            cr.Add(SpatialRestrictions.Filter(ExpressionHelper.GetPropertyName <ZustandsabschnittGIS, IGeometry>(za => za.Shape), filter));
            //var test = cr.List();
            cr.Add(Restrictions.Eq("strassenabschnittgis." + ExpressionHelper.GetPropertyName <StrassenabschnittGIS, ErfassungsPeriod>(sa => sa.ErfassungsPeriod), erfassungsperiod));
            //test = cr.List();
            return(cr.List <ZustandsabschnittGIS>().Where(z => z.Shape.Intersects(filter)).ToList());
        }
Example #4
0
        private void UpdateMapGrid(VeloObject entity, Envelope envelope, ISession session)
        {
            var q = session.CreateCriteria <MapGrid>("mg")
                    .Add(Restrictions.Eq("mg.Map.ID", entity.FeatureObject.Layer.Map.ID))
                    .Add(SpatialRestrictions.Filter("mg.Bounds", envelope, 4326));
            var mapGridList = q.List <MapGrid>();

            foreach (var mapGrid in mapGridList)
            {
                session.Lock(mapGrid, LockMode.Force);
            }
        }
Example #5
0
        public void LineStringFiltering()
        {
            IList results = Session.CreateCriteria(typeof(LineStringEntity))
                            .Add(SpatialRestrictions.Filter("Geometry", _filter))
                            .List();

            long count;

            using (var command = Session.Connection.CreateCommand())
            {
                command.CommandText = SqlLineStringFilter(FilterString);
                count = (long)command.ExecuteScalar();
            }

            Assert.AreEqual(count, results.Count);
        }
        public void PolygonFiltering()
        {
            IList results = session.CreateCriteria(typeof(PolygonEntity))
                            .Add(SpatialRestrictions.Filter("Geometry", this.filter))
                            .List();

            long count;

            using (IDbCommand command = session.Connection.CreateCommand())
            {
                command.CommandText = this.SqlPolygonFilter(FilterString);
                count = (long)command.ExecuteScalar();
            }

            Assert.AreEqual(count, results.Count);
        }
Example #7
0
 public override void Delete(VeloObject entity)
 {
     using (var session = NHibernateSession)
     {
         using (var t = session.BeginTransaction())
         {
             session.Delete(entity);
             var envelope = entity.FeatureObject.Geometry.EnvelopeInternal;
             var q        = session.CreateCriteria <MapGrid>("mg")
                            .Add(Restrictions.Eq("mg.Map.ID", entity.FeatureObject.Layer.Map.ID))
                            .Add(SpatialRestrictions.Filter("mg.Bounds", envelope, 4326));
             var mapGridList = q.List <MapGrid>();
             foreach (var mapGrid in mapGridList)
             {
                 session.Lock(mapGrid, LockMode.Force);
             }
             t.Commit();
         }
     }
 }
Example #8
0
 /// <summary>
 /// Apply a "filter" constraint to the named property
 /// </summary>
 public AbstractCriterion Filter(IEnvelope value, int srid)
 {
     return(this.Process(SpatialRestrictions.Filter(this.propertyName, value, srid)));
 }
Example #9
0
 /// <summary>
 /// Apply a "filter" constraint to the named property
 /// </summary>
 public AbstractCriterion Filter(IGeometry value)
 {
     return(this.Process(SpatialRestrictions.Filter(this.propertyName, value)));
 }
 /// <summary>
 /// Apply a "filter" constraint to the named property
 /// </summary>
 public TReturn Filter(Envelope value, int srid)
 {
     return(this.Add(SpatialRestrictions.Filter(this.propertyName, value, srid)));
 }
 /// <summary>
 /// Apply a "filter" constraint to the named property
 /// </summary>
 public TReturn Filter(IGeometry value)
 {
     return(this.Add(SpatialRestrictions.Filter(this.propertyName, value)));
 }