Class SpatialRestrictions


  • public class SpatialRestrictions
    extends java.lang.Object
    A factory for spatial criteria.

    The criterion types created by this class implement the spatial query expressions of the OpenGIS Simple Features Specification for SQL, Revision 1.1. In addition, it provides for a simple spatial filter that works mostly using the spatial index. This corresponds to the Oracle Spatial's "SDO_FILTER" function, or the "&&" operator of PostGIS.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static SpatialRelateExpression contains​(java.lang.String propertyName, com.vividsolutions.jts.geom.Geometry value)
      Apply a "spatially contains" constraint to the named property
      static SpatialRelateExpression crosses​(java.lang.String propertyName, com.vividsolutions.jts.geom.Geometry value)
      Apply a "spatially crosses" constraint to the named property
      static SpatialRelateExpression disjoint​(java.lang.String propertyName, com.vividsolutions.jts.geom.Geometry value)
      Apply a "spatially disjoint" constraint to the named property
      static org.hibernate.criterion.Criterion distanceWithin​(java.lang.String propertyName, com.vividsolutions.jts.geom.Geometry geometry, double distance)
      Apply a "distance within" constraint to the named property
      static SpatialRelateExpression eq​(java.lang.String propertyName, com.vividsolutions.jts.geom.Geometry value)
      Apply a "spatially equal" constraint to the named property
      static SpatialFilter filter​(java.lang.String propertyName, com.vividsolutions.jts.geom.Envelope envelope, int srid)
      Apply a bounding box overlap constraint to the named property
      static SpatialFilter filter​(java.lang.String propertyName, com.vividsolutions.jts.geom.Geometry value)
      Apply a bounding box overlap constraint to the named property
      static org.hibernate.criterion.Criterion havingSRID​(java.lang.String propertyName, int srid)
      Apply a "having srid" constraint to the named property
      static SpatialRelateExpression intersects​(java.lang.String propertyName, com.vividsolutions.jts.geom.Geometry value)
      Apply a "spatially intersects" constraint to the named property
      static org.hibernate.criterion.Criterion isEmpty​(java.lang.String propertyName)
      Apply an "is empty" constraint to the named property
      static org.hibernate.criterion.Criterion isNotEmpty​(java.lang.String propertyName)
      Apply an "is not empty" constraint to the named property
      static SpatialRelateExpression overlaps​(java.lang.String propertyName, com.vividsolutions.jts.geom.Geometry value)
      Apply a "spatially overlaps" constraint to the named property
      static org.hibernate.criterion.Criterion spatialRestriction​(int relation, java.lang.String propertyName, com.vividsolutions.jts.geom.Geometry value)
      Apply the specified spatial relation constraint to the named property.
      static SpatialRelateExpression touches​(java.lang.String propertyName, com.vividsolutions.jts.geom.Geometry value)
      Apply a "spatially touches" constraint to the named property
      static SpatialRelateExpression within​(java.lang.String propertyName, com.vividsolutions.jts.geom.Geometry value)
      Apply a "spatially within" constraint to the named property
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • eq

        public static SpatialRelateExpression eq​(java.lang.String propertyName,
                                                 com.vividsolutions.jts.geom.Geometry value)
        Apply a "spatially equal" constraint to the named property
        Parameters:
        propertyName - The name of the property
        value - The geometry value to use in comparison
        Returns:
        SpatialRelateExpression
        See Also:
        SpatialRelateExpression
      • within

        public static SpatialRelateExpression within​(java.lang.String propertyName,
                                                     com.vividsolutions.jts.geom.Geometry value)
        Apply a "spatially within" constraint to the named property
        Parameters:
        propertyName - The name of the property
        value - The geometry value to use in comparison
        Returns:
        SpatialRelateExpression
        See Also:
        SpatialRelateExpression
      • contains

        public static SpatialRelateExpression contains​(java.lang.String propertyName,
                                                       com.vividsolutions.jts.geom.Geometry value)
        Apply a "spatially contains" constraint to the named property
        Parameters:
        propertyName - The name of the property
        value - The geometry value to use in comparison
        Returns:
        SpatialRelateExpression
        See Also:
        SpatialRelateExpression
      • crosses

        public static SpatialRelateExpression crosses​(java.lang.String propertyName,
                                                      com.vividsolutions.jts.geom.Geometry value)
        Apply a "spatially crosses" constraint to the named property
        Parameters:
        propertyName - The name of the property
        value - The geometry value to use in comparison
        Returns:
        SpatialRelateExpression
        See Also:
        SpatialRelateExpression
      • disjoint

        public static SpatialRelateExpression disjoint​(java.lang.String propertyName,
                                                       com.vividsolutions.jts.geom.Geometry value)
        Apply a "spatially disjoint" constraint to the named property
        Parameters:
        propertyName - The name of the property
        value - The geometry value to use in comparison
        Returns:
        SpatialRelateExpression
        See Also:
        SpatialRelateExpression
      • intersects

        public static SpatialRelateExpression intersects​(java.lang.String propertyName,
                                                         com.vividsolutions.jts.geom.Geometry value)
        Apply a "spatially intersects" constraint to the named property
        Parameters:
        propertyName - The name of the property
        value - The geometry value to use in comparison
        Returns:
        SpatialRelateExpression
        See Also:
        SpatialRelateExpression
      • overlaps

        public static SpatialRelateExpression overlaps​(java.lang.String propertyName,
                                                       com.vividsolutions.jts.geom.Geometry value)
        Apply a "spatially overlaps" constraint to the named property
        Parameters:
        propertyName - The name of the property
        value - The geometry value to use in comparison
        Returns:
        SpatialRelateExpression
        See Also:
        SpatialRelateExpression
      • touches

        public static SpatialRelateExpression touches​(java.lang.String propertyName,
                                                      com.vividsolutions.jts.geom.Geometry value)
        Apply a "spatially touches" constraint to the named property
        Parameters:
        propertyName - The name of the property
        value - The geometry value to use in comparison
        Returns:
        SpatialRelateExpression
        See Also:
        SpatialRelateExpression
      • filter

        public static SpatialFilter filter​(java.lang.String propertyName,
                                           com.vividsolutions.jts.geom.Geometry value)
        Apply a bounding box overlap constraint to the named property
        Parameters:
        propertyName - The name of the property
        value - The geometry value whose bounding box to use in the comparison
        Returns:
        SpatialFilter
        See Also:
        SpatialFilter
      • filter

        public static SpatialFilter filter​(java.lang.String propertyName,
                                           com.vividsolutions.jts.geom.Envelope envelope,
                                           int srid)
        Apply a bounding box overlap constraint to the named property
        Parameters:
        propertyName - The name of the property
        envelope - The envelope or bounding box to use in the comparison
        srid - the SRID of the bounding box
        Returns:
        SpatialFilter
        See Also:
        SpatialFilter
      • distanceWithin

        public static org.hibernate.criterion.Criterion distanceWithin​(java.lang.String propertyName,
                                                                       com.vividsolutions.jts.geom.Geometry geometry,
                                                                       double distance)
        Apply a "distance within" constraint to the named property
        Parameters:
        propertyName - The name of the property
        geometry - The geometry value to use in the comparison
        distance - The distance
        Returns:
        DWithinExpression
        See Also:
        DWithinExpression
      • havingSRID

        public static org.hibernate.criterion.Criterion havingSRID​(java.lang.String propertyName,
                                                                   int srid)
        Apply a "having srid" constraint to the named property
        Parameters:
        propertyName - The name of the property
        srid - The SRID value to use in the comparison
        Returns:
        A HavingSridExpression
        See Also:
        HavingSridExpression
      • isEmpty

        public static org.hibernate.criterion.Criterion isEmpty​(java.lang.String propertyName)
        Apply an "is empty" constraint to the named property
        Parameters:
        propertyName - The name of the property
        Returns:
        A IsEmptyExpression
        See Also:
        IsEmptyExpression
      • isNotEmpty

        public static org.hibernate.criterion.Criterion isNotEmpty​(java.lang.String propertyName)
        Apply an "is not empty" constraint to the named property
        Parameters:
        propertyName - The name of the property
        Returns:
        A IsEmptyExpression
        See Also:
        IsEmptyExpression
      • spatialRestriction

        public static org.hibernate.criterion.Criterion spatialRestriction​(int relation,
                                                                           java.lang.String propertyName,
                                                                           com.vividsolutions.jts.geom.Geometry value)
        Apply the specified spatial relation constraint to the named property.
        Parameters:
        relation - The spatial relation to apply
        propertyName - The name of the property
        value - The geometry value to use in the comparison
        Returns:
        SpatialFilter
        See Also:
        SpatialFilter