27 #include "../../../core/translator/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);
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());
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);
99 std::string version = reader.
getAttr(
"version");
100 fts->setVersion(version);
158 return fts.release();
168 std::string version = reader.
getAttr(
"version");
169 cs->setVersion(version);
254 if(semantics !=
nullptr)
256 for(std::size_t i = 0; i < semantics->size(); ++i)
257 writer.
writeElement(
"se:SemanticTypeIdentifier", semantics->at(i));
261 std::size_t nRules = fts->
getRules().size();
265 for(std::size_t i = 0; i != nRules; ++i)
302 if(semantics !=
nullptr)
304 for(std::size_t i = 0; i < semantics->size(); ++i)
305 writer.
writeElement(
"se:SemanticTypeIdentifier", semantics->at(i));
309 std::size_t nRules = cs->
getRules().size();
313 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
Base exception class for plugin module.
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
virtual std::string getElementLocalName() const =0
It returns the local part of the element name in the case of an element node.
void CoverageStyleWriter(const te::se::Style *layer, te::xml::AbstractWriter &writer)
Utility methods for the Symbology serialization.
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)
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 void writeElement(const std::string &qName, const std::string &value)=0
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.
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
void reg(const std::string &styleType, const StyleFnctSerializeType &fncts)
virtual const std::string & getType() const =0
It returns the style type.
void WriteOnlineResourceHelper(const te::xl::SimpleLink *link, te::xml::AbstractWriter &writer)
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
const te::xl::SimpleLink * getOnlineResource(std::size_t i) const
virtual std::size_t getNumberOfAttrs() const =0
It returns the number of attributes in the case of an element node.
virtual void writeEndElement(const std::string &qName)=0
virtual std::string getElementValue() const =0
It returns the element data value in the case of VALUE node.
virtual NodeType getNodeType() const =0
It return the type of node read.
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