27 #include "../../../common/Translator.h"
28 #include "../../../fe/BBOXOp.h"
29 #include "../../../fe/BinaryComparisonOp.h"
30 #include "../../../fe/BinaryLogicOp.h"
31 #include "../../../fe/BinarySpatialOp.h"
32 #include "../../../fe/DistanceBuffer.h"
33 #include "../../../fe/Globals.h"
34 #include "../../../fe/Literal.h"
35 #include "../../../fe/PropertyIsBetween.h"
36 #include "../../../fe/PropertyIsLike.h"
37 #include "../../../fe/PropertyIsNull.h"
38 #include "../../../fe/PropertyName.h"
39 #include "../../../fe/UnaryLogicOp.h"
40 #include "../../../xml/AbstractWriter.h"
41 #include "../../../xml/Reader.h"
42 #include "../../Exception.h"
50 #include <boost/format.hpp>
91 std::string name =
"ogc:";
105 AbstractOpFnctIdxType::const_iterator it = m_fncts.find(opName);
107 if(it == m_fncts.end())
108 throw Exception((boost::format(
TE_TR(
"Could not find a reader for the following operator type: %1%.")) % opName).str());
110 assert(it->second.second);
112 return it->second.first(m_names.find(opName)->second, reader);
119 AbstractOpFnctIdxType::const_iterator it = m_fncts.find(op->
getName());
121 if(it == m_fncts.end())
122 throw Exception((boost::format(
TE_TR(
"Could not find a writer for the following operator type: %1%.")) % op->
getName()).str());
124 assert(it->second.second);
126 return it->second.second(op, writer);
250 std::string wildCard = reader.
getAttr(
"wildCard");
251 assert(!wildCard.empty());
252 op->setWildCard(wildCard);
254 std::string singleChar = reader.
getAttr(
"singleChar");
255 assert(!singleChar.empty());
256 op->setSingleChar(singleChar);
258 std::string escapeChar = reader.
getAttr(
"escapeChar");
259 assert(!escapeChar.empty());
260 op->setEscapeChar(escapeChar);
456 assert(!wildCard.empty());
459 assert(!singleChar.empty());
462 assert(!escapeChar.empty());
493 if(binaryLogicOp == 0)
498 assert(binaryLogicOp->
size() >= 2);
500 for(std::size_t i = 0; i < binaryLogicOp->
size(); ++i)
510 if(unaryLogicOp == 0)
524 if(binarySpatialOp == 0)
void BinaryLogicOpWriter(const te::fe::AbstractOp *op, te::xml::AbstractWriter &writer)
static const char * sm_propertyIsLessThan
static const char * sm_touches
void UnaryLogicOpWriter(const te::fe::AbstractOp *op, te::xml::AbstractWriter &writer)
const char * getName() const
It returns the operator name.
te::fe::AbstractOp * DistanceBufferReader(const char *opName, te::xml::Reader &reader)
te::gm::Geometry * getGeometry() const
It returns the geometry.
te::common::Distance * getDistance() const
It returns the distance.
static const char * sm_dWithin
PropertyName * getPropertyName() const
It returns the property name.
Distance buffer operator.
static const char * sm_contains
This class models a XML reader object.
void write(const te::fe::AbstractOp *op, te::xml::AbstractWriter &writer) const
boost::function< te::fe::AbstractOp *(const char *opName, te::xml::Reader &)> AbstractOpReadFnctType
te::fe::AbstractOp * BinaryLogicOpReader(const char *opName, te::xml::Reader &reader)
virtual void writeStartElement(const std::string &qName)=0
static const char * sm_propertyIsGreaterThanOrEqualTo
static const char * sm_propertyIsGreaterThan
static const char * sm_crosses
static const char * sm_or
boost::function< void(const te::fe::AbstractOp *, te::xml::AbstractWriter &)> AbstractOpWriteFnctType
A convenient and more compact way of encoding the very common bounding box constraint based on an env...
PropertyName * getPropertyName() const
It returns the property name.
const std::string & getWildCard() const
It returns the wild character.
static const char * sm_intersects
A class for binary spatial operators.
te::fe::AbstractOp * BetweenReader(const char *opName, te::xml::Reader &reader)
static const char * sm_disjoint
The PropertyIsBetween element is defined as a compact way of encoding a range check.
static const char * sm_within
This class models a XML writer object.
#define TE_TR(message)
It marks a string in order to get translated.
PropertyName * getProperty() const
It returns the property name.
std::size_t size() const
It returns the number of operands.
static const char * sm_propertyIsEqualTo
A logical operator that can be used to combine one conditional expressions.
The PropertyIsNull class encodes an operator that checks to see if the value of its content is NULL...
AbstractOpFnctIdxType m_fncts
virtual std::string getElementLocalName() const =0
It returns the local part of the element name in the case of an element node.
te::gml::Envelope * getEnvelope() const
It returns the envelope.
Literal * getLiteral() const
It returns the literal value.
static const char * sm_propertyIsLike
const std::string & getSingleChar() const
It returns the single wild character.
te::fe::AbstractOp * UnaryLogicOpReader(const char *opName, te::xml::Reader &reader)
void BinarySpatialOpWriter(const te::fe::AbstractOp *op, te::xml::AbstractWriter &writer)
Expression * getUpperBoundary() const
It returns the upper boundary expression.
static const char * sm_propertyIsNotEqualTo
It is intended to encode a character string comparison operator with pattern matching.
static T & getInstance()
It returns a reference to the singleton instance.
PropertyName * getProperty() const
It returns the property name.
static const char * sm_beyond
AbstractOp * getOp(std::size_t i) const
It returns a specified operand.
void BetweenWriter(const te::fe::AbstractOp *op, te::xml::AbstractWriter &writer)
Expression * getSecond() const
It returns the second operand.
const std::string & getEscapeChar() const
It returns the escape character.
te::fe::AbstractOp * NullReader(const char *opName, te::xml::Reader &reader)
std::string GetQualifiedName(const te::fe::AbstractOp *op)
AbstractOp * getOp() const
It returns the operand.
virtual std::string getAttr(const std::string &name) const =0
It returns the attribute value in the case of an element node with valid attributes.
void BBOXWriter(const te::fe::AbstractOp *op, te::xml::AbstractWriter &writer)
Envelope defines an extent using a pair of positions defining opposite corners in arbitrary dimension...
std::pair< AbstractOpReadFnctType, AbstractOpWriteFnctType > AbstractOpFnctSerializeType
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
static const char * sm_propertyIsNull
An abstract interface for operators.
Auxiliary classes and functions to serialize filter operations from a XML document.
PropertyName * getProperty() const
It returns the property name.
A class for binary comparison operators.
static const char * sm_and
te::fe::AbstractOp * BinaryComparsionOpReader(const char *opName, te::xml::Reader &reader)
virtual void writeAttribute(const std::string &attName, const std::string &value)=0
virtual NodeType getNodeType() const =0
It return the type of node read.
te::fe::AbstractOp * LikeReader(const char *opName, te::xml::Reader &reader)
static const char * sm_equals
virtual void writeEndElement(const std::string &qName)=0
A logical operator can be used to combine two or more conditional expressions.
void LikeWriter(const te::fe::AbstractOp *op, te::xml::AbstractWriter &writer)
void BinaryComparsionOpWriter(const te::fe::AbstractOp *op, te::xml::AbstractWriter &writer)
void reg(const std::string &opName, const AbstractOpFnctSerializeType &fncts)
static const char * sm_overlaps
Auxiliary classes and functions to serialize filter expressions from a XML document.
static const char * sm_not
Expression * getFirst() const
It returns the first operand.
te::fe::AbstractOp * BinarySpatialOpReader(const char *opName, te::xml::Reader &reader)
virtual bool hasAttrs() const =0
It tells if the element has attributes in the case of an element node.
void NullWriter(const te::fe::AbstractOp *op, te::xml::AbstractWriter &writer)
static const char * sm_propertyIsBetween
static const char * sm_bbox
virtual bool next()=0
It gets the next event to be read.
Expression * getLowerBoundary() const
It returns the lower boundary expression.
void DistanceBufferOpWriter(const te::fe::AbstractOp *op, te::xml::AbstractWriter &writer)
static const char * sm_propertyIsLessThanOrEqualTo
te::fe::AbstractOp * read(te::xml::Reader &reader) const
Expression * getExpression() const
It returns the between expression.
A given distance has a measurement and a unit-of-measure.
te::fe::AbstractOp * BBOXReader(const char *opName, te::xml::Reader &reader)