27 #include "../../../se/serialization/xml/Symbolizer.h" 28 #include "../../../srs/Config.h" 29 #include "../../../srs/Exception.h" 30 #include "../../../srs/SpatialReferenceSystemManager.h" 31 #include "../../../xml/AbstractWriter.h" 32 #include "../../../xml/Reader.h" 33 #include "../../AbstractLayer.h" 34 #include "../../Chart.h" 35 #include "../../Enums.h" 36 #include "../../Grouping.h" 37 #include "../../RasterContrast.h" 41 #include <boost/lexical_cast.hpp> 62 if(type ==
"EQUAL_STEPS")
68 if(type ==
"STD_DEVIATION")
71 assert(type ==
"UNIQUE_VALUE");
87 return "STD_DEVIATION";
92 return "UNIQUE_VALUE";
112 std::string encoding;
147 std::string datasourceId;
221 g->setPropertyType(propertyType);
233 g->setSummary(summary);
246 g->setStdDeviation(stdDeviation);
293 std::unique_ptr<te::map::RasterContrast> rc(
new te::map::RasterContrast(static_cast<te::map::RasterTransform::ContrastType>(type), static_cast<unsigned long>(nBands)));
298 for (
int i = 0; i < nBands; ++i)
357 rc->setValues(gain, offset1, offset2, min, max, static_cast<unsigned long>(i));
369 return std::unique_ptr<te::map::Chart>();
438 std::size_t barWidth = std::string::npos;
490 std::string summary =
"NONE";
507 std::vector<std::string> properties;
508 std::vector<te::color::RGBAColor> colors;
548 properties.push_back(propName);
549 colors.push_back(hColor);
556 std::unique_ptr<te::map::Chart> chart(
new te::map::Chart(type, properties, colors));
557 chart->setContourColor(contourColor);
558 chart->setContourWidth(contourWidth);
559 chart->setHeight(height);
560 chart->setVisibility(isVisible);
561 chart->setSummary(summary);
562 if(barWidth != std::string::npos)
563 chart->setBarWidth(barWidth);
565 chart->setMaxValue(maxValue);
609 srid =
static_cast<int>(sridInfo.second);
611 catch (te::srs::Exception&)
614 srid = boost::lexical_cast<
int>(strNewSRID);
615 std::string newName =
"USER:" + strNewSRID;
649 std::vector<std::string> properties = chart->
getProperties();
651 for(std::size_t i = 0; i < properties.size(); ++i)
655 writer.
writeElement(
"te_map:PropertyName", properties[i]);
692 std::vector<double> gain, offset1, offset2, min, max;
694 rc->
getValues(gain, offset1, offset2, min, max);
696 for (std::size_t t = 0; t < nBands; ++t)
701 writer.
writeElement(
"te_map:Offset1Contrast", offset1[t]);
702 writer.
writeElement(
"te_map:Offset2Contrast", offset2[t]);
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.
ChartType getType() const
const std::vector< std::string > & getProperties() const
TEMAPEXPORT te::map::RasterContrast * ReadLayerRasterContrast(te::xml::Reader &reader)
TEMAPEXPORT std::string ReadLayerEncoding(te::xml::Reader &reader)
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.
TEMAPEXPORT std::string ReadDataSourceId(te::xml::Reader &reader)
virtual const std::string & getTitle() const
It returns the layer title.
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 WriteLayerRasterContrast(te::map::RasterContrast *rc, 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.
TEMAPEXPORT void WriteLayerGrouping(te::map::Grouping *g, te::xml::AbstractWriter &writer)
virtual Visibility getVisibility() const
It returns the layer visibility.
const te::map::RasterTransform::ContrastType getType() const
It gets the contrast type.
This class models a XML writer object.
TEMAPEXPORT std::string ReadDataSetName(te::xml::Reader &reader)
TEMAPEXPORT te::map::Grouping * ReadLayerGrouping(te::xml::Reader &reader)
virtual te::map::Chart * getChart() const
It returns the Chart associated to the Layer.
TEMAPEXPORT int ReadSRIDValue(te::xml::Reader &reader)
te::core::EncodingType getEncoding() const
It returns the encoding type.
double getMaxValue() const
TEMAPEXPORT void WriteSRIDValue(const int &srid, te::xml::AbstractWriter &writer)
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
static std::string getEncodingName(EncodingType et)
Retrive a string from a given character encoding type enum.
This class represents the informations needed to build map charts.
static SpatialReferenceSystemManager & 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.
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)
virtual te::map::RasterContrast * getRasterContrast() const
It returns the raster contrast associated to the Layer.
This class contains the parameters needed to apply dynamic contrast over a raster.
TEMAPEXPORT std::unique_ptr< te::map::Chart > ReadLayerChart(te::xml::Reader &reader)
virtual void writeAttribute(const std::string &attName, const std::string &value)=0
GroupingType
The grouping type associated to the layer.
std::size_t getContourWidth() const
const te::color::RGBAColor & getContourColor() const
virtual te::map::Grouping * getGrouping() const
It returns the Grouping associated to the Layer.
std::size_t getNBands()
It gets the contrast number of bands.
#define TE_SRS_USER_DEFINED_START_ID
std::string getSummary() const
It gets the grouping summary. It is used only in case 1 to n.
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
const GroupingType getType() const
It gets the grouping type.
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.
te::qt::widgets::VISIBLE GetVisibility(const te::qt::widgets::TreeItem *item)
void getValues(std::vector< double > &gain, std::vector< double > &offset1, std::vector< double > &offset2, std::vector< double > &min, std::vector< double > &max)
It get the contrast transformation values.
Visibility
Each layer can have three states of visibility.
virtual bool next()=0
It gets the next event to be read.
TEMAPEXPORT void WriteLayerChart(te::map::Chart *chart, te::xml::AbstractWriter &writer)
std::string getColor(const NameFormat format=HexRgb) const
It gets the color encoded using two hexadecimal digits per primary-color component, in the order Red, Green, Blue, if HexRgb format, or Alpha, Red, Green, Blue, if HexArgb format, prefixed with a hash (#) sign.
te::map::GroupingType GetGroupingType(TeGroupingMode mode)