27 #include "../../common/Translator.h"
28 #include "../../xml/Reader.h"
29 #include "../../xml/Writer.h"
30 #include "../../se/CoverageStyle.h"
31 #include "../../se/FeatureTypeStyle.h"
32 #include "../Exception.h"
42 #include <boost/format.hpp>
59 StyleFnctIdxType::const_iterator it = m_fncts.find(styleType);
61 if(it == m_fncts.end())
62 throw Exception((boost::format(
TR_SERIALIZATION(
"Could not find a reader for the following style type: %1%.")) % styleType).str());
64 assert(it->second.second);
66 return it->second.first(reader);
73 StyleFnctIdxType::const_iterator it = m_fncts.find(style->
getType());
75 if(it == m_fncts.end())
76 throw Exception((boost::format(
TR_SERIALIZATION(
"Could not find a writer for the following style type: %1%.")) % style->
getType()).str());
78 assert(it->second.second);
80 return it->second.second(style, writer);
100 std::string version = reader.
getAttr(0);
101 fts->setVersion(version);
159 return fts.release();
169 std::string version = reader.
getAttr(0);
170 cs->setVersion(version);
257 for(std::size_t i = 0; i < semantics->size(); ++i)
258 writer.
writeElement(
"se:SemanticTypeIdentifier", semantics->at(i));
262 std::size_t nRules = fts->
getRules().size();
266 for(std::size_t i = 0; i != nRules; ++i)
305 for(std::size_t i = 0; i < semantics->size(); ++i)
306 writer.
writeElement(
"se:SemanticTypeIdentifier", semantics->at(i));
310 std::size_t nRules = cs->
getRules().size();
314 for(std::size_t i = 0; i != nRules; ++i)
const std::vector< Rule * > & getRules() const
const std::string * getName() const
void reg(const std::string &styleType, const StyleFnctSerializeType &fncts)
The FeatureTypeStyle defines the styling that is to be applied to a dataset that can be viewed as a f...
Rule * getRule(std::size_t i) const
Utility methods for Symbology serialization.
void CoverageStyleWriter(const te::se::Style *layer, te::xml::Writer &writer)
void FeatureTypeStyleWriter(const te::se::Style *style, te::xml::Writer &writer)
This class models a XML reader object.
const te::xl::SimpleLink * getOnlineResource(std::size_t i) const
void write(const te::se::Style *style, te::xml::Writer &writer) const
virtual bool next()=0
It gets the next event to be read.
TESERIALIZATIONEXPORT te::se::Description * ReadDescription(te::xml::Reader &reader)
#define TR_SERIALIZATION(message)
It marks a string in order to get translated. This is a special mark used in the XML module of TerraL...
The CoverageStyle defines the styling that is to be applied to a subset of Coverage data...
const std::string * getFeatureTypeName() const
const std::vector< std::string > * getSemanticTypeIdentifiers() const
virtual std::size_t getNumberOfAttrs() const =0
It returns the number of attributes in the case of an element node.
virtual void writeStartElement(const std::string &qName)
void WriteOnlineResourceHelper(const te::xl::SimpleLink *link, te::xml::Writer &writer)
virtual void writeAttribute(const std::string &attName, const std::string &value)
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)
TESERIALIZATIONEXPORT void Save(const te::fe::Filter *filter, te::xml::Writer &writer)
const Description * getDescription() const
const std::string * getCoverageName() const
Support for Description serialization.
te::se::Style * CoverageStyleReader(te::xml::Reader &reader)
virtual void writeElement(const std::string &qName, const std::string &value)
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
void WriteStringPtrHelper(const std::string &elementName, const std::string *s, te::xml::Writer &writer)
boost::function< te::se::Style *(te::xml::Reader &)> StyleReadFnctType
virtual const std::string & getType() const =0
It returns the style type.
boost::function< void(const te::se::Style *, te::xml::Writer &)> StyleWriteFnctType
Support for Rule serialization.
std::pair< StyleReadFnctType, StyleWriteFnctType > StyleFnctSerializeType
te::se::Style * read(te::xml::Reader &reader) const
virtual NodeType getNodeType() const =0
It return the type of node read.
te::se::Style * FeatureTypeStyleReader(te::xml::Reader &reader)
virtual std::string getElementLocalName() const =0
It returns the local part of the element name in the case of an element node.
Auxiliary classes and functions to serialize style informations from a XML document.
const std::vector< te::xl::SimpleLink * > & getOnlineResources() const
TESERIALIZATIONEXPORT te::se::Rule * ReadRule(te::xml::Reader &reader)
const std::string & getVersion() const
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.
This class models a XML writer object.