27 #include "../../../se/serialization/xml/Symbolizer.h"
28 #include "../../../xml/AbstractWriter.h"
29 #include "../../../xml/Reader.h"
30 #include "../../AbstractLayer.h"
31 #include "../../Chart.h"
32 #include "../../Grouping.h"
33 #include "../../GroupingItem.h"
37 #include <boost/lexical_cast.hpp>
58 if(type ==
"EQUAL_STEPS")
64 if(type ==
"STD_DEVIATION")
67 assert(type ==
"UNIQUE_VALUE");
83 return "STD_DEVIATION";
88 return "UNIQUE_VALUE";
165 g->setPropertyType(propertyType);
177 g->setSummary(summary);
190 g->setStdDeviation(stdDeviation);
196 std::vector<te::map::GroupingItem*> items;
206 g->setGroupingItems(items);
228 item->setTitle(title);
242 item->setLowerLimit(fromValue);
255 item->setUpperLimit(toValue);
269 item->setValue(value);
275 std::vector<te::se::Symbolizer*> symbs;
285 item->setSymbolizers(symbs);
287 return item.release();
293 return std::auto_ptr<te::map::Chart>();
362 std::size_t barWidth = -1;
414 std::string summary =
"NONE";
431 std::vector<std::string> properties;
432 std::vector<te::color::RGBAColor> colors;
472 properties.push_back(propName);
473 colors.push_back(hColor);
480 std::auto_ptr<te::map::Chart> chart(
new te::map::Chart(type, properties, colors));
481 chart->setContourColor(contourColor);
482 chart->setContourWidth(contourWidth);
483 chart->setHeight(height);
484 chart->setVisibility(isVisible);
485 chart->setSummary(summary);
487 chart->setBarWidth(barWidth);
489 chart->setMaxValue(maxValue);
519 std::vector<std::string> properties = chart->
getProperties();
521 for(std::size_t i = 0; i < properties.size(); ++i)
525 writer.
writeElement(
"te_map:PropertyName", properties[i]);
554 for(std::size_t i = 0; i < items.size(); ++i)
571 const std::vector<te::se::Symbolizer*>& symbs = item->
getSymbolizers();
573 for(std::size_t j = 0; j < symbs.size(); ++j)
TEMAPEXPORT std::string ReadLayerVisibility(te::xml::Reader &reader)
TEMAPEXPORT void WriteAbstractLayer(const te::map::AbstractLayer *layer, te::xml::AbstractWriter &writer)
virtual const std::string & getId() const
It returns the layer id.
ChartType
The chart types.
TEMAPEXPORT te::map::GroupingItem * ReadGroupingItem(te::xml::Reader &reader)
ChartType getType() const
const std::vector< std::string > & getProperties() const
const double getStdDeviation() const
It gets the standard deviation used in the Standard Deviation grouping.
virtual boost::int32_t getElementValueAsInt32() const
It returns the element data value in the case of VALUE node.
std::size_t getBarWidth() const
This class models a XML reader object.
This is the base class for layers.
std::string getSummary() const
It gets the grouping summary. It is used only in case 1 to n.
int getPropertyType() const
It gets the property type whose values will be grouped.
const std::string & getValue() const
It gets the value of the legend item.
virtual const std::string & getTitle() const
It returns the layer title.
TEMAPEXPORT std::auto_ptr< te::map::Chart > ReadLayerChart(te::xml::Reader &reader)
virtual void writeStartElement(const std::string &qName)=0
const size_t getPrecision() const
It gets the precision used for the property values.
TEMAPEXPORT std::string ReadLayerTitle(te::xml::Reader &reader)
std::string getPropertyName() const
It gets the property name whose values will be grouped.
TEMAPEXPORT void WriteLayerGrouping(te::map::Grouping *g, te::xml::AbstractWriter &writer)
virtual Visibility getVisibility() const
It returns the layer visibility.
This class models a XML writer object.
virtual std::string getElementLocalName() const =0
It returns the local part of the element name in the case of an element node.
TEMAPEXPORT te::map::Grouping * ReadLayerGrouping(te::xml::Reader &reader)
virtual te::map::Chart * getChart() const
It returns the Chart associated to the Layer.
double getMaxValue() const
This class contains the parameters needed for grouping the values of a Property.
const te::color::RGBAColor & getColor(std::size_t i) const
virtual void writeElement(const std::string &qName, const std::string &value)=0
This class represents the informations needed to build map charts.
static T & getInstance()
It returns a reference to the singleton instance.
virtual double getElementValueAsDouble() const
It returns the element data value in the case of VALUE node.
A GroupingItem contains information about a grouping item associated to a layer.
std::size_t getHeight() const
bool isVisible() const
It gets the chart visibility.
TEMAPEXPORT te::map::GroupingType GetGroupingType(const std::string &type)
virtual bool getElementValueAsBoolean() const
It returns the element data value in the case of VALUE node.
TEMAPEXPORT te::map::Visibility GetVisibility(const std::string &visible)
te::map::GroupingType GetGroupingType(TeGroupingMode mode)
virtual void writeAttribute(const std::string &attName, const std::string &value)=0
const std::vector< te::map::GroupingItem * > & getGroupingItems() const
It gets the vector of grouping items.
GroupingType
The grouping type associated to the layer.
std::size_t getContourWidth() const
const te::color::RGBAColor & getContourColor() const
const std::string & getUpperLimit() const
It gets the upper limit value of the legend item.
virtual te::map::Grouping * getGrouping() const
It returns the Grouping associated to the Layer.
std::string getSummary() const
It gets the grouping summary. It is used only in case 1 to n.
virtual NodeType getNodeType() const =0
It return the type of node read.
std::string getColor() const
It gets the color encoded using two hexadecimal digits per primary-color component, in the order Red, Green, Blue, prefixed with a hash (#) sign.
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
const GroupingType getType() const
It gets the grouping type.
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
Visibility
Each layer can have three states of visibility.
std::string getTitle()
It gets the title of the legend item.
const std::string & getLowerLimit() const
It gets the lower limit value of the legend item.
const std::vector< te::se::Symbolizer * > & getSymbolizers() const
It gets the symbolizer of the legend item.
virtual bool next()=0
It gets the next event to be read.
TEMAPEXPORT void WriteLayerChart(te::map::Chart *chart, te::xml::AbstractWriter &writer)