27 #include "../../../common/Translator.h"
28 #include "../../../xml/AbstractWriter.h"
29 #include "../../../xml/Reader.h"
30 #include "../../../se/CoverageStyle.h"
31 #include "../../../se/FeatureTypeStyle.h"
32 #include "../../Exception.h"
43 #include <boost/format.hpp>
60 StyleFnctIdxType::const_iterator it = m_fncts.find(styleType);
62 if(it == m_fncts.end())
63 throw Exception((boost::format(
TE_TR(
"Could not find a reader for the following style type: %1%.")) % styleType).str());
65 assert(it->second.second);
67 return it->second.first(reader);
74 StyleFnctIdxType::const_iterator it = m_fncts.find(style->
getType());
76 if(it == m_fncts.end())
77 throw Exception((boost::format(
TE_TR(
"Could not find a writer for the following style type: %1%.")) % style->
getType()).str());
79 assert(it->second.second);
81 return it->second.second(style, writer);
101 std::string version = reader.
getAttr(
"version");
102 fts->setVersion(version);
160 return fts.release();
170 std::string version = reader.
getAttr(
"version");
171 cs->setVersion(version);
258 for(std::size_t i = 0; i < semantics->size(); ++i)
259 writer.
writeElement(
"se:SemanticTypeIdentifier", semantics->at(i));
263 std::size_t nRules = fts->
getRules().size();
267 for(std::size_t i = 0; i != nRules; ++i)
306 for(std::size_t i = 0; i < semantics->size(); ++i)
307 writer.
writeElement(
"se:SemanticTypeIdentifier", semantics->at(i));
311 std::size_t nRules = cs->
getRules().size();
315 for(std::size_t i = 0; i != nRules; ++i)
const std::string * getFeatureTypeName() const
std::pair< StyleReadFnctType, StyleWriteFnctType > StyleFnctSerializeType
Auxiliary classes and functions to serialize style informations from a XML document.
boost::function< void(const te::se::Style *, te::xml::AbstractWriter &)> StyleWriteFnctType
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
This class models a XML reader object.
virtual void writeStartElement(const std::string &qName)=0
The CoverageStyle defines the styling that is to be applied to a subset of Coverage data...
void write(const te::se::Style *style, te::xml::AbstractWriter &writer) const
const std::string * getCoverageName() const
void CoverageStyleWriter(const te::se::Style *layer, te::xml::AbstractWriter &writer)
This class models a XML writer object.
#define TE_TR(message)
It marks a string in order to get translated.
te::se::Style * FeatureTypeStyleReader(te::xml::Reader &reader)
void WriteStringPtrHelper(const std::string &elementName, const std::string *s, te::xml::AbstractWriter &writer)
virtual std::string getElementLocalName() const =0
It returns the local part of the element name in the case of an element node.
void FeatureTypeStyleWriter(const te::se::Style *style, te::xml::AbstractWriter &writer)
Rule * getRule(std::size_t i) const
const std::vector< Rule * > & getRules() const
virtual const std::string & getType() const =0
It returns the style type.
virtual void writeElement(const std::string &qName, const std::string &value)=0
boost::function< te::se::Style *(te::xml::Reader &)> StyleReadFnctType
The FeatureTypeStyle defines the styling that is to be applied to a dataset that can be viewed as a f...
const std::vector< te::xl::SimpleLink * > & getOnlineResources() const
virtual std::size_t getNumberOfAttrs() const =0
It returns the number of attributes in the case of an element node.
void reg(const std::string &styleType, const StyleFnctSerializeType &fncts)
Utility methods for the Symbology serialization.
void WriteOnlineResourceHelper(const te::xl::SimpleLink *link, te::xml::AbstractWriter &writer)
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.
TESEEXPORT void Save(const te::se::AnchorPoint *ap, te::xml::AbstractWriter &writer)
te::se::Style * read(te::xml::Reader &reader) const
Data serialization for the Symbology Encoder module.
virtual void writeAttribute(const std::string &attName, const std::string &value)=0
const std::string * getName() const
virtual NodeType getNodeType() const =0
It return the type of node read.
const te::xl::SimpleLink * getOnlineResource(std::size_t i) const
virtual std::string getElementValue() const =0
It returns the element data value in the case of VALUE node.
virtual void writeEndElement(const std::string &qName)=0
TESEEXPORT te::se::Rule * ReadRule(te::xml::Reader &reader)
const std::vector< std::string > * getSemanticTypeIdentifiers() const
TESEEXPORT te::se::Description * ReadDescription(te::xml::Reader &reader)
virtual bool next()=0
It gets the next event to be read.
const Description * getDescription() const
te::se::Style * CoverageStyleReader(te::xml::Reader &reader)
const std::string & getVersion() const