27 #include "../../../color/RGBAColor.h"
28 #include "../../../maptools/Utils.h"
29 #include "../../../se/serialization/xml/Symbolizer.h"
30 #include "../../../se/Stroke.h"
31 #include "../../../se/SvgParameter.h"
32 #include "../../../se/Utils.h"
33 #include "../../../xml/Reader.h"
34 #include "../../../xml/ReaderFactory.h"
35 #include "../Exception.h"
42 #include <boost/format.hpp>
45 #include <QtCore/QVector>
56 pen.setColor(Qt::transparent);
78 Qt::PenCapStyle capStyle = Qt::FlatCap;
81 pen.setCapStyle(capStyle);
93 pen.setJoinStyle(joinStyle);
102 std::vector<double> pattern;
105 pen.setDashPattern(QVector<qreal>::fromStdVector(pattern));
115 brush.setColor(Qt::transparent);
123 brush.setColor(qrgba);
134 throw Exception((boost::format(
TE_TR(
"Could not read symbol library information in file: %1%.")) % path).str());
137 throw Exception((boost::format(
TE_TR(
"Error reading the document %1%, the start element wasn't found.")) % path).str());
139 if(reader->getElementLocalName() !=
"SymbolLibrary")
140 throw Exception((boost::format(
TE_TR(
"The first tag in the document %1% is not 'SymbolLibrary'.")) % path).str());
142 std::string name = reader->getAttr(
"name");
144 std::auto_ptr<SymbolLibrary> library(
new SymbolLibrary(name));
149 (reader->getElementLocalName() ==
"Symbol"))
152 library->insert(symbol);
155 SymbolLibraryManager::getInstance().insert(library.release());
222 symbol->setInfo(info);
237 return symbol.release();
void getRgba(int *r, int *g, int *b, int *a=0) const
It gets the color value.
const SvgParameter * getLineCap() const
TESEEXPORT void GetColor(const te::se::Stroke *stroke, te::color::RGBAColor &color)
It gets the RGBA color from the Stroke element.
This class models a XML reader object.
This class represents a symbol.
const SvgParameter * getLineJoin() const
static te::xml::Reader * make()
It creates a new XML reader using the dafault implementation.
#define TE_TR(message)
It marks a string in order to get translated.
virtual std::string getElementLocalName() const =0
It returns the local part of the element name in the case of an element node.
TEMAPEXPORT void GetDashStyle(const std::string &dasharray, std::vector< double > &style)
Converts a dasharray pattern coded by a string to a vector of double.
The SymbolLibraryManager is a singleton that can be used to manage all loaded symbol libraries in Ter...
static T & getInstance()
It returns a reference to the singleton instance.
#define TE_SE_DEFAULT_STROKE_BASIC_COLOR
It specifies the default color used by stroke basic (solid colors).
#define TE_OPAQUE
For an RGBA color this is the value of the alpha-channel for totally opaque.
#define TE_SE_ROUND_JOIN
It specifies the value "round" for stroke-linejoin parameter.
This class represents a library of symbols.
int getAlpha() const
It returns the alpha component color value (a value from 0 to 255).
#define TE_SE_ROUND_CAP
It specifies the value "round" for stroke-linecap parameter.
A Fill specifies the pattern for filling an area geometry.
#define TE_SE_DEFAULT_FILL_BASIC_COLOR
It specifies the default color used by basic fill (solid colors).
const SvgParameter * getDashArray() const
A Stroke specifies the appearance of a linear geometry.
virtual NodeType getNodeType() const =0
It return the type of node read.
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
TESEEXPORT int GetInt(const te::se::ParameterValue *param)
It gets the parameter value as an integer.
virtual std::string getElementValue() const =0
It returns the element data value in the case of VALUE node.
A SvgParameter refers to an SVG/CSS graphical-formatting parameter.
virtual bool next()=0
It gets the next event to be read.
TESEEXPORT std::string GetString(const te::se::ParameterValue *param)
It gets the parameter value as a string.
const SvgParameter * getWidth() const