27 #include "../../common/STLUtils.h"
28 #include "../../common/Translator.h"
29 #include "../../geometry/Envelope.h"
30 #include "../../geometry/Geometry.h"
31 #include "../../geometry/Utils.h"
32 #include "../Exception.h"
51 m_isFromEnvelope(false),
74 if(isSpatialRestrictionFunction(visited))
76 addSpatialRestriction(visited);
81 for(std::size_t i = 0; i < size; ++i)
102 return !m_spatialRestrictions.empty();
107 return m_spatialRestrictions;
127 return m_spatialFunctions.find(f.
getName()) != m_spatialFunctions.end();
132 assert(isSpatialRestrictionFunction(f));
134 return m_spatialFunctions.find(f.
getName())->second;
158 assert(isSpatialRestrictionFunction(f));
163 bool hasEnvelope =
true;
225 throw Exception(
TR_DATAACCESS(
"The spatial function not have a literal geometry or literal envelope!"));
228 std::string pname = getPropertyName(f);
230 throw Exception(
TR_DATAACCESS(
"The spatial function not have a property name!"));
234 restriction->
m_index = m_index++;
237 restriction->
m_type = getSpatialRelation(f);
242 m_spatialRestrictions.push_back(restriction);
static const std::string sm_ST_Contains
static const std::string sm_ST_Intersects
static const std::string sm_ST_Disjoint
TEGEOMEXPORT Geometry * GetGeomFromEnvelope(const Envelope *const e, int srid)
It creates a Geometry (a polygon) from the given envelope.
virtual AbstractData * clone() const =0
It returns a clone of this object.
static const std::string sm_ST_Crosses
~SpatialRestriction()
Destructor.
static const std::string sm_ST_Equals
bool isSpatialRestrictionFunction(const Function &f) const
bool isFromEnvelope(const Function &f) const
A Select models a query to be used when retrieving data from a data source.
A Select models a query to be used when retrieving data from a DataSource.
void FreeContents(boost::unordered_map< K, V * > &m)
This function can be applied to a map of pointers. It will delete each pointer in the map...
virtual void initialize()
void addSpatialRestriction(const Function &f)
A class that models a literal for Envelope values.
const std::string & getName() const
It returns the property name.
const Function * m_function
The function that represents the spatial restriction.
virtual ~SpatialRestrictionVisitor()
Virtual destructor.
A class that models the name of any property of an object.
A class that models the name of any property of an object.
static const std::string sm_ST_Overlaps
te::gm::Geometry * m_geometry
The geometry of the spatial restriction.
te::gm::SpatialRelation getSpatialRelation(const Function &f) const
SpatialRelation
Spatial relations between geometric objects.
virtual void visit(const Expression &visited)
A class that models a literal for Geometry values.
A struct that represents a spatial restriction.
te::gm::Geometry * getGeometryRestriction(const Function &f) const
bool hasSpatialRestrictions() const
te::gm::SpatialRelation m_type
The spatial restriction type.
A static class with global function name definitions.
std::size_t getNumArgs() const
It returns the number of arguments informed to the function.
Expression * getArg(std::size_t i) const
It returns the i-th function argument.
SpatialRestriction()
Default constructor.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
A class that can be used to model a filter expression that can be applied to a query.
A class that models a literal for Envelope values.
static const std::string sm_ST_Touches
A class that models a Function expression.
std::size_t m_index
Internal index of the spatial restriction.
A class that models a literal for Geometry values.
#define TR_DATAACCESS(message)
It marks a string in order to get translated. This is a special mark used in the DataAccess module of...
int getSRID() const
It returns the envelope SRS id.
A base class for values that can be retrieved from the data access module.
const std::string & getName() const
It returns the function name.
std::string m_pname
The property name of the spatial restriction.
Expression * getExp() const
This is an abstract class that models a query expression.
This is an abstract class that models a query expression.
std::string getPropertyName(const Function &f) const
virtual ReturnType accept(VisitorType &guest) const =0
It call the visit method from the guest object.
const std::vector< te::da::SpatialRestriction * > & getSpatialRestrictions() const
Where * getWhere() const
It returns the filter condition.
bool m_isFromEnvelope
A flag that indicates if the spatial restriction uses an envelope.
A visitor that retrieves spatial restrictions from a Query hierarchy.
A class that models a Function expression.
An Envelope defines a 2D rectangular region.
A class that can be used to model a filter expression that can be applied to a query.
te::gm::Envelope * getValue() const
It returns the associated envelope value.
static const std::string sm_ST_Within
te::dt::AbstractData * getValue() const
It returns the value associated to the literal.
SpatialRestrictionVisitor()
Default constructor.