27 #include "../../../../color/RGBAColor.h" 28 #include "../../../../common/StringUtils.h" 29 #include "../../../../fe/utils.h" 30 #include "../../../../geometry/GeometryProperty.h" 31 #include "../../../../maptools/Enums.h" 32 #include "../../../../maptools/Grouping.h" 33 #include "../../../../se/Categorize.h" 34 #include "../../../../se/ChannelSelection.h" 35 #include "../../../../se/ColorMap.h" 36 #include "../../../../se/ContrastEnhancement.h" 37 #include "../../../../se/CoverageStyle.h" 38 #include "../../../../se/Description.h" 39 #include "../../../../se/FeatureTypeStyle.h" 40 #include "../../../../se/Fill.h" 41 #include "../../../../se/LineSymbolizer.h" 42 #include "../../../../se/ParameterValue.h" 43 #include "../../../../se/PolygonSymbolizer.h" 44 #include "../../../../se/PointSymbolizer.h" 45 #include "../../../../se/RasterSymbolizer.h" 46 #include "../../../../se/Rule.h" 47 #include "../../../../se/SelectedChannel.h" 48 #include "../../../../se/Style.h" 49 #include "../../../../se/Stroke.h" 50 #include "../../../../se/Utils.h" 51 #include "../../../../terralib4/Utils.h" 55 #include <terralib4/kernel/TeAbstractTheme.h> 56 #include <terralib4/kernel/TeDataTypes.h> 57 #include <terralib4/kernel/TeLegendEntry.h> 58 #include <terralib4/kernel/TeRaster.h> 59 #include <terralib4/kernel/TeRasterTransform.h> 60 #include <terralib4/kernel/TeTheme.h> 61 #include <terralib4/kernel/TeVisual.h> 64 #include <boost/lexical_cast.hpp> 67 #include <QtGui/QColor> 107 case TeLnTypeDashDot:
109 case TeLnTypeDashDotDot:
110 return "4 2 1 2 1 2";
113 case TeLnTypeContinuous:
128 case TePtTypeHollowCircle:
133 case TePtTypeHollowBox:
135 case TePtTypeDiamond:
136 case TePtTypeHollowDiamond:
147 case TePtTypeHollowCircle:
149 case TePtTypeHollowBox:
151 case TePtTypeHollowDiamond:
164 TeRasterVisual* vis = 0;
165 vis = theme->rasterVisual();
168 TeRaster* raster = theme->layer()->raster();
169 theme->createRasterVisual(raster);
170 vis = theme->rasterVisual();
178 TeLegendEntry legend = theme->defaultLegend();
180 TeGeomRepVisualMap visualMap = legend.getVisualMap();
182 TeVisual* visual = 0;
189 visual = visualMap[TePOLYGONS];
197 visual = visualMap[TeLINES];
205 visual = visualMap[TePOINTS];
253 TeColor tl4Color = visual->color();
257 std::string width = boost::lexical_cast<std::string>(visual->contourWidth());
261 std::string style =
GetLineStyle(visual->contourStyle());
268 stroke->setDashArray(style);
273 double numericOpacity = (100-visual->transparency())/100.0;
274 std::string opacity = boost::lexical_cast<std::string>(numericOpacity);
284 std::string width = boost::lexical_cast<std::string>(visual->width());
295 stroke->setDashArray(style);
314 std::string size = boost::lexical_cast<std::string>(visual->size());
323 TeLegendEntryVector leg = theme->legend();
324 TeGrouping group = theme->grouping();
326 TeAttributeRep attr = group.groupAttribute_;
328 std::vector<std::string> tokens;
330 propertyName = tokens[1];
332 TeGroupingMode mode = group.groupMode_;
334 std::size_t precision =
static_cast<std::size_t
>(group.groupPrecision_);
335 int slices = group.groupNumSlices_;
336 double stdDeviation = group.groupStdDev_;
342 std::vector<te::se::Rule*> rules;
344 for(
int i = 0; i < slices; ++i)
348 TeLegendEntry le = leg[i];
350 std::string* ruleNamePtr =
new std::string(le.label());
352 ruleItem->
setName(ruleNamePtr);
354 std::string fromValue = le.from();
355 std::string toValue = le.to();
357 if(mode == TeUniqueValue)
366 std::vector<te::se::Symbolizer*> symbs;
368 TeGeomRepVisualMap map = le.getVisualMap();
370 TeGeomRep geomRep = map.begin()->first;
371 TeVisual* visual = map.begin()->second;
377 rules.push_back(ruleItem);
381 std::string prefixName =
"Grouping Style: ";
382 std::string* styleName =
new std::string(prefixName + propertyName);
386 QString descInfo = QObject::tr(
"Grouping Information") +
":\n";
388 descInfo += QObject::tr(
"\tProperty: ") + QString(propertyName.c_str()) +
"\n";
389 descInfo += QObject::tr(
"\tNum Slices: ") + QString::number(slices) +
"\n";
390 descInfo += QObject::tr(
"\tPrecision: ") + QString::number(precision) +
"\n";
391 descInfo += QObject::tr(
"\tStd Deviation: ") + QString::number(stdDeviation) +
"\n";
394 descStyle->
setTitle(descInfo.toUtf8().data());
399 for (std::size_t t = 0; t < rules.size(); ++t)
404 std::string descStr = std::string(
"Rule Item");
417 TeLegendEntryVector leg = theme->legend();
418 TeGrouping group = theme->grouping();
420 int slices = group.groupNumSlices_;
427 QColor cWhite(Qt::white);
428 std::string colorWhiteStr = cWhite.name().toUtf8().data();
433 for(
int i = 0; i < slices; ++i)
435 TeLegendEntry le = leg[i];
439 TeGeomRepVisualMap map = le.getVisualMap();
441 TeVisual* visual = map.begin()->second;
443 QColor color(visual->color().red_, visual->color().green_, visual->color().blue_, 0);
446 std::string colorStr = color.name().toUtf8().data();
473 double opacity = ((visual->getTransparency()*100.0)/255)/100.0;
475 double gain = visual->getGain();
481 TeRasterTransform::TeRasterTransfFunctions func = visual->getTransfFunction();
490 if (func == TeRasterTransform::TeBand2Band)
504 else if (func == TeRasterTransform::TeExtractBand)
507 short db = visual->getDestBand();
509 if (db == TeRasterTransform::TeREDCHANNEL)
518 else if (db == TeRasterTransform::TeGREENCHANNEL)
527 else if (db == TeRasterTransform::TeBLUECHANNEL)
537 else if (func == TeRasterTransform::TeMono2Three)
546 else if (func == TeRasterTransform::TeExtractRGB)
548 std::map<TeRasterTransform::TeRGBChannels,short>& RGBmap = visual->getRGBMap();
551 scRed->
setSourceChannelName(boost::lexical_cast<std::string>(RGBmap[TeRasterTransform::TeREDCHANNEL]));
554 scGreen->
setSourceChannelName(boost::lexical_cast<std::string>(RGBmap[TeRasterTransform::TeGREENCHANNEL]));
557 scBlue->
setSourceChannelName(boost::lexical_cast<std::string>(RGBmap[TeRasterTransform::TeBLUECHANNEL]));
562 else if (func == TeRasterTransform::TeThreeBand2RGB)
576 else if (func == TeRasterTransform::TeExtractBands)
579 std::map<TeRasterTransform::TeRGBChannels,short>& RGBmap = visual->getRGBMap();
581 if (RGBmap[TeRasterTransform::TeREDCHANNEL] != -1)
582 scRed->
setSourceChannelName(boost::lexical_cast<std::string>(RGBmap[TeRasterTransform::TeREDCHANNEL]));
583 if (RGBmap[TeRasterTransform::TeGREENCHANNEL] != -1)
584 scGreen->
setSourceChannelName(boost::lexical_cast<std::string>(RGBmap[TeRasterTransform::TeGREENCHANNEL]));
585 if (RGBmap[TeRasterTransform::TeBLUECHANNEL] != -1)
586 scBlue->
setSourceChannelName(boost::lexical_cast<std::string>(RGBmap[TeRasterTransform::TeBLUECHANNEL]));
te::map::Grouping * GetGrouping(TeTheme *theme, te::se::Style *style)
te::se::Symbolizer * GetSymbolizer(int geometryType, TeVisual *visual)
void setRedChannel(SelectedChannel *c)
A selected channel to be display.
A Description gives human-readable descriptive information for the object it is included within...
te::color::RGBAColor Convert2TerraLib5(TeColor color)
The transformation of continuous values to distinct values (Categorize function). ...
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
A Mark specifies a geometric shape and applies coloring to it.
TETERRALIB4EXPORT std::string Convert2Utf8(const std::string &str)
A PolygonSymbolizer is used to draw a polygon (or other area-type geometries), including filling its ...
te::se::PointSymbolizer * GetPointSymbolizer(TeVisual *visual)
A Symbolizer describes how a feature is to appear on a map.
void setDescription(Description *d)
The CoverageStyle defines the styling that is to be applied to a subset of Coverage data...
ParameterValue * getOffset() const
void setName(std::string *name)
void setGain(ParameterValue *p)
void setDescription(Description *d)
void setLookupValue(ParameterValue *v)
A PointSymbolizer specifies the rendering of a graphic Symbolizer at a point.
void setCategorize(Categorize *c)
void push_back(const std::string &semanticTypeIdentifier)
void setGrayChannel(SelectedChannel *c)
void setStdDeviation(double stdDeviation)
It sets the standard deviation for the Standard Deviation grouping.
void setFilter(te::fe::Filter *f)
TESEEXPORT LineSymbolizer * CreateLineSymbolizer(Stroke *stroke)
Creates a line symbolizer.
A Graphic is a graphic symbol with an inherent shape, color(s), and possibly size.
TESEEXPORT PolygonSymbolizer * CreatePolygonSymbolizer(Stroke *stroke, Fill *fill)
Creates a polygon symbolizer.
void push_back(Symbolizer *s)
The "ParameterValueType" uses WFS-Filter expressions to give values for SE graphic parameters...
std::unique_ptr< te::dt::Property > Convert2T5(const TeAttributeRep &attRep)
It creates a valid TerraLib 5 property given a valid TerraLib 4.x attribute representation.
This class contains the parameters needed for grouping the values of a Property.
void Tokenize(const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=" ")
It tokenizes a given string with a delimiter of your own choice.
TEFEEXPORT te::fe::Filter * CreateFilterByStep(const std::string &attrName, const std::string &minValue, const std::string &maxValue)
TEFEEXPORT te::fe::Filter * CreateFilterByUniqueValue(const std::string &attrName, const std::string &value)
te::gm::GeomType Convert2T5GeomType(TeAttrDataType type)
The FeatureTypeStyle defines the styling that is to be applied to a dataset that can be viewed as a f...
void setColorCompositionType(ColorCompositionType cct)
void setChannelSelection(ChannelSelection *c)
void setTitle(const std::string &title)
te::se::PolygonSymbolizer * GetPolygonSymbolizer(TeVisual *visual)
void setPropertyType(const int &type)
It sets the property type whose values will be grouped.
TESEEXPORT Graphic * CreateGraphic(Mark *mark, const std::string &size, const std::string &rotation, const std::string &opacity)
Creates a graphic.
The RasterSymbolizer describes how to render raster/matrix-coverage data (e.g., satellite photos...
A Fill specifies the pattern for filling an area geometry.
void setOpacity(ParameterValue *p)
void setSymbolizers(const std::vector< Symbolizer * > &symbs)
TESEEXPORT Mark * CreateMark(const std::string &wellKnownName, Stroke *stroke, Fill *fill)
Creates a mark.
struct TeRaster_t TeRaster
TESEEXPORT Stroke * CreateStroke(const std::string &color, const std::string &width)
Creates a stroke.
te::se::RasterSymbolizer * GetRasterSymbolizer(TeRasterTransform *visual)
GroupingType
The grouping type associated to the layer.
void setName(std::string *name)
A Rule is used to attach property/scale conditions to and group the individual symbols used for rende...
void setOffset(ParameterValue *p)
A Stroke specifies the appearance of a linear geometry.
te::se::LineSymbolizer * GetLineSymbolizer(TeVisual *visual)
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
void setSourceChannelName(const std::string &name)
std::string GetLineStyle(int type)
A LineSymbolizer is used to style a stroke along a linear geometry type, such as a string of line seg...
te::se::ColorMap * GetRasterGrouping(TeTheme *theme)
void setBlueChannel(SelectedChannel *c)
std::string GetPointStyle(int type)
void setThresholdsBelongTo(ThresholdsBelongToType t)
void addThreshold(ParameterValue *v)
A ColorMap defines either the colors of a pallette-type raster source or the mapping of numeric pixel...
void addValue(ParameterValue *v)
void setFallbackValue(const std::string &v)
TESEEXPORT PointSymbolizer * CreatePointSymbolizer(Graphic *graphic)
Creates a point symbolizer.
TESEEXPORT Fill * CreateFill(const std::string &color, const std::string &opacity)
Creates a fill.
void setGreenChannel(SelectedChannel *c)
te::map::GroupingType GetGroupingType(TeGroupingMode mode)
ChannelSelection specifies the false-color channel selection for a multi-spectral raster source (such...