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(
TE_TR(
"The spatial function not have a literal geometry or literal envelope!"));
228 std::string pname = getPropertyName(f);
230 throw Exception(
TE_TR(
"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);
Expression * getArg(std::size_t i) const
It returns the i-th function argument.
te::gm::SpatialRelation m_type
The spatial restriction type.
const std::string & getName() const
It returns the property name.
A visitor that retrieves spatial restrictions from a Query hierarchy.
bool isSpatialRestrictionFunction(const Function &f) const
A class that models a Function expression.
static const std::string sm_ST_Equals
std::size_t m_index
Internal index of the spatial restriction.
const std::vector< te::da::SpatialRestriction * > & getSpatialRestrictions() const
static const std::string sm_ST_Overlaps
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_Touches
static const std::string sm_ST_Intersects
SpatialRestrictionVisitor()
Default constructor.
SpatialRestriction()
Default constructor.
SpatialRelation
Spatial relations between geometric objects.
bool hasSpatialRestrictions() const
#define TE_TR(message)
It marks a string in order to get translated.
static const std::string sm_ST_Contains
This is an abstract class that models a query expression.
void addSpatialRestriction(const Function &f)
A class that models a literal for Envelope values.
bool isFromEnvelope(const Function &f) const
static const std::string sm_ST_Crosses
te::gm::Geometry * getGeometryRestriction(const Function &f) const
const Function * m_function
The function that represents the spatial restriction.
An Envelope defines a 2D rectangular region.
A struct that represents a spatial restriction.
bool m_isFromEnvelope
A flag that indicates if the spatial restriction uses an envelope.
A class that can be used to model a filter expression that can be applied to a query.
This is an abstract class that models a query expression.
virtual ~SpatialRestrictionVisitor()
Virtual destructor.
A base class for values that can be retrieved from the data access module.
Expression * getExp() const
A class that models a Function expression.
A Select models a query to be used when retrieving data from a data source.
const std::string & getName() const
It returns the function name.
std::string m_pname
The property name of the spatial restriction.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
A Select models a query to be used when retrieving data from a DataSource.
int getSRID() const
It returns the envelope SRS id.
A class that can be used to model a filter expression that can be applied to a query.
Where * getWhere() const
It returns the filter condition.
static const std::string sm_ST_Disjoint
te::gm::Geometry * m_geometry
The geometry of the spatial restriction.
virtual void visit(const Expression &visited)
virtual void initialize()
virtual ReturnType accept(VisitorType &guest) const =0
It call the visit method from the guest object.
static const std::string sm_ST_Within
A class that models a literal for Envelope values.
A static class with global function name definitions.
std::string getPropertyName(const Function &f) const
~SpatialRestriction()
Destructor.
A class that models a literal for Geometry values.
virtual AbstractData * clone() const =0
It returns a clone of this object.
te::gm::SpatialRelation getSpatialRelation(const Function &f) const
te::dt::AbstractData * getValue() const
It returns the value associated to the literal.
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...
std::size_t getNumArgs() const
It returns the number of arguments informed to the function.
te::gm::Envelope * getValue() const
It returns the associated envelope value.
TEGEOMEXPORT Geometry * GetGeomFromEnvelope(const Envelope *const e, int srid)
It creates a Geometry (a polygon) from the given envelope.
A class that models a literal for Geometry values.