27 #include "../../color/ColorBar.h" 28 #include "../../color/ColorScheme.h" 29 #include "../../color/ColorSchemeCatalog.h" 30 #include "../../color/ColorSchemeCatalogManager.h" 31 #include "../../color/ColorSchemeGroup.h" 32 #include "../../color/RGBAColor.h" 33 #include "../../common/Globals.h" 34 #include "../../common/StringUtils.h" 35 #include "../../dataaccess/datasource/DataSource.h" 36 #include "../../dataaccess/datasource/DataSourceInfo.h" 37 #include "../../dataaccess/datasource/DataSourceInfoManager.h" 38 #include "../../dataaccess/datasource/DataSourceManager.h" 39 #include "../../maptools/Grouping.h" 40 #include "../../maptools/GroupingAlgorithms.h" 41 #include "../../maptools/Utils.h" 42 #include "../../raster/RasterSummary.h" 43 #include "../../raster/RasterSummaryManager.h" 44 #include "../../se/ColorMap.h" 45 #include "../../se/Enums.h" 46 #include "../../se/Interpolate.h" 47 #include "../../se/InterpolationPoint.h" 48 #include "../../se/ParameterValue.h" 49 #include "../../se/RasterSymbolizer.h" 50 #include "../../se/Style.h" 51 #include "../../se/Utils.h" 52 #include "../../qt/widgets/layer/utils/DataSet2Layer.h" 56 #include <boost/filesystem.hpp> 57 #include <boost/uuid/random_generator.hpp> 58 #include <boost/uuid/uuid_io.hpp> 66 boost::filesystem::path uri(repository);
68 std::string dsInfo(
"file://" + uri.string());
70 boost::uuids::basic_random_generator<boost::mt19937> gen;
71 boost::uuids::uuid u = gen();
72 std::string id_ds = boost::uuids::to_string(u);
75 dsInfoPtr->setConnInfo(dsInfo);
76 dsInfoPtr->setTitle(uri.stem().string());
77 dsInfoPtr->setAccessDriver(
"OGR");
78 dsInfoPtr->setType(
"OGR");
79 dsInfoPtr->setDescription(uri.string());
80 dsInfoPtr->setId(id_ds);
89 std::string name = path +
"/" + dataSetName +
".shp";
96 std::string name = path +
"/" + dataSetName +
".tif";
99 boost::filesystem::path uri(name);
101 std::string dsInfo(
"file://" + uri.string());
103 boost::uuids::basic_random_generator<boost::mt19937> gen;
104 boost::uuids::uuid u = gen();
105 std::string id_ds = boost::uuids::to_string(u);
108 dsInfoPtr->setConnInfo(dsInfo);
109 dsInfoPtr->setTitle(uri.stem().string());
110 dsInfoPtr->setAccessDriver(
"GDAL");
111 dsInfoPtr->setType(
"GDAL");
112 dsInfoPtr->setDescription(uri.string());
113 dsInfoPtr->setId(id_ds);
126 return converter(
dt);
136 std::vector<double> vec;
139 std::unique_ptr<te::da::DataSet>
ds(layer->getData());
140 ds->moveBeforeFirst();
142 while(
ds->moveNext())
144 if(
ds->isNull(bayesAttr))
150 vec.push_back(
ds->getDouble(bayesAttr));
154 std::vector<te::se::Rule*> legend;
158 std::unique_ptr<te::color::ColorBar> cb(
GetColorBar(
"Default",
"Basic",
"Red"));
160 int legendSize =
static_cast<int>(legend.size());
162 std::vector<te::color::RGBAColor> colorVec;
164 colorVec = cb->getSlices(legendSize);
169 for(
size_t t = 0; t < colorVec.size(); ++t)
171 std::vector<te::se::Symbolizer*> symbVec;
175 symbVec.push_back(s);
177 legend[t]->setSymbolizers(symbVec);
183 std::string attrName = bayesAttr;
185 std::string* ruleName =
new std::string(
"No Value");
191 std::vector<te::se::Symbolizer*> symbVec;
193 symbVec.push_back(s);
196 legend.push_back(rule);
211 for (std::size_t t = 0; t < legend.size(); ++t)
214 layer->setGrouping(group);
223 std::vector<double> vec;
226 std::unique_ptr<te::da::DataSet>
ds(layer->getData());
227 ds->moveBeforeFirst();
229 while(
ds->moveNext())
231 if(
ds->isNull(kernelAttr))
237 vec.push_back(
ds->getDouble(kernelAttr));
241 std::vector<te::se::Rule*> legend;
245 std::unique_ptr<te::color::ColorBar> cb(
GetColorBar(
"Default",
"Classification",
"Kernel"));
247 int legendSize =
static_cast<int>(legend.size());
249 std::vector<te::color::RGBAColor> colorVec;
251 colorVec = cb->getSlices(legendSize);
256 for(
size_t t = 0; t < colorVec.size(); ++t)
258 std::vector<te::se::Symbolizer*> symbVec;
262 symbVec.push_back(s);
264 legend[t]->setSymbolizers(symbVec);
270 std::string attrName = kernelAttr;
272 std::string* ruleName =
new std::string(
"No Value");
278 std::vector<te::se::Symbolizer*> symbVec;
280 symbVec.push_back(s);
283 legend.push_back(rule);
298 for (std::size_t t = 0; t < legend.size(); ++t)
301 layer->setGrouping(group);
317 const std::complex<double>* cmin = rsMin->at(0).m_minVal;
318 const std::complex<double>* cmax = rsMax->at(0).m_maxVal;
319 double min = cmin->real();
320 double max = cmax->real();
325 std::unique_ptr<te::color::ColorBar> cb(
GetColorBar(
"Default",
"Classification",
"Kernel"));
327 std::vector<te::color::RGBAColor> colorVec = cb->getSlices(slices + 1);
329 std::vector<te::se::Rule*> legVec;
331 std::vector<double> vec;
340 interpolate->setFallbackValue(
"#000000");
344 for(std::size_t i = 0; i < colorVec.size(); ++i)
346 QColor color(colorVec[i].getRed(), colorVec[i].getGreen(), colorVec[i].getBlue(), colorVec[i].getAlpha());
348 if(i == colorVec.size() - 1)
350 std::string valueMin;
351 std::string valueMax;
355 QString rangeStr = valueMax.c_str();
356 std::string colorStr = color.name().toUtf8().data();
360 ip->
setData(rangeStr.toDouble());
363 interpolate->add(ip);
367 std::string valueMin;
368 std::string valueMax;
372 QString rangeStr = valueMin.c_str();
373 std::string colorStr = color.name().toUtf8().data();
377 ip->
setData(rangeStr.toDouble());
380 interpolate->add(ip);
398 std::vector<te::se::Rule*> legend;
402 std::unique_ptr<te::color::ColorBar> cb(
GetColorBar(
"Default",
"Classification",
"Circular"));
404 int legendSize =
static_cast<int>(legend.size());
406 std::vector<te::color::RGBAColor> colorVec;
408 colorVec = cb->getSlices(legendSize);
413 for(
size_t t = 0; t < colorVec.size(); ++t)
415 std::vector<te::se::Symbolizer*> symbVec;
419 symbVec.push_back(s);
421 legend[t]->setSymbolizers(symbVec);
435 for (std::size_t t = 0; t < legend.size(); ++t)
438 layer->setGrouping(group);
448 std::vector<te::se::Rule*> legend;
450 std::vector<std::string> strVec;
452 for(
int i = 0; i < nClasses; ++i)
462 for(
size_t t = 0; t < legend.size(); ++t)
464 std::vector<te::se::Symbolizer*> symbVec;
468 symbVec.push_back(s);
470 legend[t]->setSymbolizers(symbVec);
485 for (std::size_t t = 0; t < legend.size(); ++t)
488 layer->setGrouping(group);
501 for(std::size_t t = 0; t < csgVec.size(); ++t)
509 for(std::size_t
p = 0;
p < csVec.size(); ++
p)
515 std::vector<te::color::RGBAColor>* colors = cs->
getColors()[0];
517 std::vector<te::color::RGBAColor>::iterator it = colors->begin();
525 while(it != colors->end())
527 if(count != 0 && count != static_cast<int>(colors->size()) - 1)
529 double pos = (1. / (colors->size() - 1)) * count;
void setPrecision(size_t precision)
It sets the precision to be used for the property values.
#define TE_SA_SKATER_ATTR_CLASS_NAME
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
TESAEXPORT void CreateKernelColorMaping(te::map::AbstractLayerPtr layer)
boost::shared_ptr< DataSetType > DataSetTypePtr
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
TESEEXPORT Symbolizer * CreateSymbolizer(const te::gm::GeomType &geomType)
Try creates an appropriate symbolizer based on given geometry type.
boost::shared_ptr< DataSource > DataSourcePtr
const std::vector< ColorScheme * > & getColorSchemes() const
It returns a reference to the list of color schemes belonging to this group.
TESAEXPORT te::da::DataSourcePtr CreateOGRDataSource(std::string repository)
const std::vector< ColorSchemeGroup * > & getColorSchemeGroups() const
It returns the list of color scheme groups in the catalog.
void setData(const double &d)
TESAEXPORT void CreateSampleGeneratorStratifiedGrouping(te::map::AbstractLayerPtr layer, std::vector< std::string > strVec)
A Symbolizer describes how a feature is to appear on a map.
const std::string & getName() const
It returns the group name.
TESEEXPORT RasterSymbolizer * GetRasterSymbolizer(Style *s)
Try to get raster symbolizer from a style.
TEMAPEXPORT void GroupingByUniqueValues(std::string attrName, std::vector< std::string > &inputValues, int dataType, std::vector< te::se::Rule * > &rules, int precision)
It groups the values using the unique value algorithm.
It models the concept of color scheme.
void setName(std::string *name)
TEMAPEXPORT te::gm::GeomType GetGeomType(const te::map::AbstractLayerPtr &layer)
It gets the geometry type of the given layer.
const std::vector< std::vector< RGBAColor > * > & getColors() const
It returns all color lists.
void push_back(const std::string &semanticTypeIdentifier)
TESAEXPORT te::da::DataSourcePtr CreateGDALDataSource(std::string path, std::string dataSetName)
void setStdDeviation(double stdDeviation)
It sets the standard deviation for the Standard Deviation grouping.
static te::dt::Date ds(2010, 01, 01)
void GroupingByEqualSteps(std::string attrName, iterator begin, iterator end, int nSteps, std::vector< te::se::Rule * > &rules, int precision=0)
It groups the values defined by a range of iterators using the equal steps algorithm.
void setFilter(te::fe::Filter *f)
The transformation of continuous values to a number of values (Interpolate function).
The "ParameterValueType" uses WFS-Filter expressions to give values for SE graphic parameters...
void setValue(ParameterValue *v)
This class contains the parameters needed for grouping the values of a Property.
TEFEEXPORT void GetFilterStepValues(const te::fe::Filter *filter, std::string &valueMin, std::string &valueMax)
TEFEEXPORT te::fe::Filter * CreateFilterByStep(const std::string &attrName, const std::string &minValue, const std::string &maxValue)
#define TE_SA_BAYES_ATTR_NAME
void setNumSlices(size_t numSlices)
It sets the number of slices for the EqualSteps and Quantil groupings.
static DataSourceInfoManager & getInstance()
It returns a reference to the singleton instance.
TESAEXPORT void CreateBayesGrouping(te::map::AbstractLayerPtr layer)
An abstract class for raster data strucutures.
static te::dt::TimeDuration dt(20, 30, 50, 11)
void setPropertyType(const int &type)
It sets the property type whose values will be grouped.
boost::ptr_vector< BandSummary > RasterSummary
RasterSummary is just a typedef of a boost::ptr_vector.
The RasterSymbolizer describes how to render raster/matrix-coverage data (e.g., satellite photos...
const std::string & getName() const
It returns the color schema name.
A filter is any valid predicate expression.
void setSymbolizers(const std::vector< Symbolizer * > &symbs)
TEMAPEXPORT te::rst::Raster * GetRaster(AbstractLayer *layer)
It gets the raster referenced by the given data set layer.
void addColor(const RGBAColor &color, const double &pos)
It adds a color in the color bar.
A Rule is used to attach property/scale conditions to and group the individual symbols used for rende...
This class represents a group of color schemes.
They are used to define a graph of points.
A catalog for color schemes.
TESAEXPORT te::map::AbstractLayerPtr CreateLayer(te::da::DataSourcePtr ds, std::string dataSetName)
void setColorMap(ColorMap *c)
TESAEXPORT te::color::ColorBar * GetColorBar(std::string catalog, std::string group, std::string schema)
It models the concept of color bar.
A class that represents a data source component.
#define TE_SA_SPG_ATTR_CLASS_NAME
TESEEXPORT std::string GenerateRandomColor()
Creates a random RGB color encoded using two hexadecimal digits per primary-color component prefixed ...
A layer with reference to a dataset.
TESAEXPORT void CreateKernelGrouping(te::map::AbstractLayerPtr layer, std::string kernelAttr)
std::string Convert2String(boost::int16_t value)
It converts a short integer value to a string.
TESAEXPORT void CreateSkaterGrouping(te::map::AbstractLayerPtr layer, int nClasses)
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
void setInterpolate(Interpolate *i)
A ColorMap defines either the colors of a pallette-type raster source or the mapping of numeric pixel...
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr
static const std::string sm_nanStr
Not a number string value.