27 #include "../../../common/BoostUtils.h" 
   28 #include "../../../common/Translator.h" 
   29 #include "../../../color/RGBAColor.h" 
   30 #include "../../../dataaccess/dataset/AttributeConverterManager.h" 
   31 #include "../../../dataaccess/dataset/DataSetTypeConverter.h" 
   32 #include "../../../dataaccess/datasource/DataSourceManager.h" 
   33 #include "../../../dataaccess/serialization/xml/Serializer.h" 
   34 #include "../../../dataaccess/utils/Utils.h" 
   35 #include "../../../datatype/DateTimeProperty.h" 
   36 #include "../../../datatype/NumericProperty.h" 
   37 #include "../../../datatype/Property.h" 
   38 #include "../../../datatype/SimpleProperty.h" 
   39 #include "../../../datatype/StringProperty.h" 
   40 #include "../../../datatype/serialization/xml/Serializer.h" 
   41 #include "../../../geometry/Envelope.h" 
   42 #include "../../../geometry/GeometryProperty.h" 
   43 #include "../../../geometry/serialization/xml/Serializer.h" 
   44 #include "../../../se/CoverageStyle.h" 
   45 #include "../../../xml/Reader.h" 
   46 #include "../../../xml/Writer.h" 
   47 #include "../../../maptools/AbstractLayer.h" 
   48 #include "../../../maptools/Chart.h" 
   49 #include "../../../maptools/DataSetAdapterLayer.h" 
   50 #include "../../../maptools/DataSetLayer.h" 
   51 #include "../../../maptools/FolderLayer.h" 
   52 #include "../../../maptools/Grouping.h" 
   53 #include "../../../maptools/GroupingItem.h" 
   54 #include "../../../maptools/QueryLayer.h" 
   55 #include "../../../maptools/RasterLayer.h" 
   56 #include "../../../se/RasterSymbolizer.h" 
   57 #include "../../../se/serialization/xml/Style.h" 
   58 #include "../../../se/serialization/xml/Symbolizer.h" 
   59 #include "../../Exception.h" 
   67 #include <boost/algorithm/string/case_conv.hpp> 
   68 #include <boost/format.hpp> 
   69 #include <boost/lexical_cast.hpp> 
   98   if(type == 
"EQUAL_STEPS")
 
  101   if(type == 
"QUANTIL")
 
  104   if(type == 
"STD_DEVIATION")
 
  107   assert(type == 
"UNIQUE_VALUE");
 
  117       return "EQUAL_STEPS";
 
  123       return "STD_DEVIATION";
 
  128       return "UNIQUE_VALUE";
 
  186   return simpleProperty;
 
  233   item->setTitle(title);
 
  247     item->setLowerLimit(fromValue);
 
  260     item->setUpperLimit(toValue);
 
  274     item->setValue(value);
 
  280   std::vector<te::se::Symbolizer*> symbs;
 
  290   item->setSymbolizers(symbs);
 
  292   return item.release();
 
  341   g->setPropertyType(propertyType);
 
  353     g->setStdDeviation(stdDeviation);
 
  359   std::vector<te::map::GroupingItem*> items;
 
  369   g->setGroupingItems(items);
 
  377     return std::auto_ptr<te::map::Chart>();
 
  446   std::size_t barWidth = -1;
 
  498   std::vector<std::string> properties;
 
  499   std::vector<te::color::RGBAColor> colors;
 
  539     properties.push_back(propName);
 
  540     colors.push_back(hColor);
 
  547   std::auto_ptr<te::map::Chart> chart(
new te::map::Chart(type, properties, colors));
 
  548   chart->setContourColor(contourColor);
 
  549   chart->setContourWidth(contourWidth);
 
  550   chart->setHeight(height);
 
  551   chart->setVisibility(isVisible);
 
  553     chart->setBarWidth(barWidth);
 
  555     chart->setMaxValue(maxValue);
 
  582   std::vector<std::string> properties = chart->
getProperties();
 
  584   for(std::size_t i = 0; i < properties.size(); ++i)
 
  588     writer.
writeElement(
"te_map:PropertyName", properties[i]);
 
  614   for(std::size_t i = 0; i < items.size(); ++i)
 
  631     const std::vector<te::se::Symbolizer*>& symbs = item->
getSymbolizers();
 
  633     for(std::size_t j = 0; j < symbs.size(); ++j)
 
  685   LayerFnctIdxType::const_iterator it = m_fncts.find(layerType);
 
  687   if(it == m_fncts.end())
 
  688     throw Exception((boost::format(
TE_TR(
"Could not find a reader for the following layer type: %1%.")) % layerType).str());
 
  690   assert(it->second.second);
 
  692   return it->second.first(reader);
 
  699   LayerFnctIdxType::const_iterator it = m_fncts.find(alayer->
getType());
 
  701   if(it == m_fncts.end())
 
  702     throw Exception((boost::format(
TE_TR(
"Could not find a writer for the following layer type: %1%.")) % alayer->
getType()).str());
 
  704   assert(it->second.second);
 
  706   return it->second.second(alayer, writer);
 
  724   std::string 
id = reader.
getAttr(0);
 
  789   std::auto_ptr<te::se::Style> style;
 
  811   layer->setSRID(srid);
 
  812   layer->setExtent(*mbr.get());
 
  814   layer->setDataSetName(dataset);
 
  815   layer->setDataSourceId(datasourceId);
 
  816   layer->setRendererType(rendererId);
 
  817   layer->setStyle(style.release());
 
  820     layer->setGrouping(grouping);
 
  823     layer->setChart(chart.release());
 
  825   return layer.release();
 
  830   std::string 
id = reader.
getAttr(0);
 
  886   std::auto_ptr<te::se::Style> style;
 
  908   layer->setSRID(srid);
 
  909   layer->setExtent(*mbr.get());
 
  911   layer->setQuery(query);
 
  912   layer->setDataSourceId(datasourceId);
 
  913   layer->setRendererType(rendererId);
 
  914   layer->setStyle(style.release());
 
  917     layer->setGrouping(grouping);
 
  919   return layer.release();
 
  924   std::string 
id = reader.
getAttr(0);
 
  963   return flayer.release();
 
  968   std::string 
id = reader.
getAttr(0);
 
  983   std::map<std::string, std::string> conninfo;
 
  985   while(reader.
next() &&
 
 1009     conninfo[paramName] = paramValue;
 
 1045   std::auto_ptr<te::se::Style> style;
 
 1067   layer->setSRID(srid);
 
 1068   layer->setExtent(*mbr.get());
 
 1069   layer->setRasterInfo(conninfo);
 
 1071   layer->setRendererType(rendererId);
 
 1072   layer->setStyle(dynamic_cast<te::se::CoverageStyle*>(style.release()));
 
 1074   return layer.release();
 
 1079   std::string 
id = reader.
getAttr(0);
 
 1137   std::auto_ptr<te::se::Style> style;
 
 1171   std::vector<std::pair<std::string, std::vector<std::size_t> > > props;
 
 1245     std::pair<std::string, std::vector<std::size_t> > prop;
 
 1247     std::vector<std::size_t> typeVec;
 
 1248     typeVec.push_back(type);
 
 1249     typeVec.push_back(geomType);
 
 1250     typeVec.push_back(srid);
 
 1251     prop.second = typeVec;
 
 1252     props.push_back(prop);
 
 1255   std::vector<std::vector<std::size_t> > propertyIndexes;
 
 1266     std::vector<std::size_t> inIdxs;
 
 1286     propertyIndexes.push_back(inIdxs);
 
 1291   std::vector<std::string> functionsNames;
 
 1330   std::auto_ptr<te::da::DataSetType> dst = ds->getDataSetType(dataSetName);
 
 1334   for(std::size_t i = 0; i < propertyIndexes.size(); ++i)
 
 1336     converter->add(propertyIndexes[i], 
GetProperty(props[i].first, props[i].second[0], props[i].second[1], props[i].second[2]), functionsNames[i]);
 
 1339   std::vector<te::dt::Property*> convertedProps = converter->getResult()->getProperties();
 
 1346     std::vector<te::dt::Property*> pkProps = pkIn->
getProperties();
 
 1347     for(std::size_t i = 0; i < convertedProps.size(); ++i)
 
 1349       for(std::size_t t = 0; t < pkProps.size(); ++t)
 
 1351         if(convertedProps[i]->getName() == pkProps[t]->getName())
 
 1352           pk->
add(convertedProps[i]);
 
 1362   std::auto_ptr<te::da::DataSet> dataset = result->
getData();
 
 1368     while(dataset->moveNext())
 
 1453   for(
size_t i=0; i<count; i++)
 
 1473   std::map<std::string, std::string> info = layer->
getRasterInfo();
 
 1474   std::map<std::string, std::string>::iterator conIt;
 
 1476   for(conIt=info.begin(); conIt!=info.end(); ++conIt)
 
 1540   std::vector<te::dt::Property*> outProps = resultDt->
getProperties();
 
 1542   for(std::size_t i = 0; i < outProps.size(); ++i)
 
 1546     writer.
writeElement(
"te_map:type", outProps[i]->getType());
 
 1547     writer.
writeElement(
"te_map:name", outProps[i]->getName());
 
 1569   for(std::size_t i = 0; i < propertyIndexes.size(); ++i)
 
 1575     std::vector<std::size_t> inputPropertiesIdx = propertyIndexes[i];
 
 1577     for(std::size_t j = 0; j < inputPropertiesIdx.size(); ++j)
 
 1578       writer.
writeElement(
"te_map:InIdx", (
int)inputPropertiesIdx[j]);
 
 1583   std::vector<te::da::AttributeConverter> converters = converter->
getConverters();
 
 1584   for(std::size_t i = 0; i < converters.size(); ++i)
 
TEDATAACCESSEXPORT DataSourcePtr GetDataSource(const std::string &datasourceId, const bool opened=true)
Search for a data source with the informed id in the DataSourceManager. 
 
TECOMMONEXPORT std::string ConvertLatin1UTFString(const std::string &data, const bool &toUtf=true)
Converts a string from latin1 to utf8 and vice-versa. 
 
virtual const std::string & getType() const =0
It returns the layer type. 
 
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 
 
const double getStdDeviation() const 
It gets the standard deviation used in the Standard Deviation grouping. 
 
void add(te::dt::Property *p)
It adds a property to the list of properties of the primary key. 
 
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code. 
 
const std::string & getDataSetName() const 
 
virtual boost::int32_t getElementValueAsInt32() const 
It returns the element data value in the case of VALUE node. 
 
std::size_t getBarWidth() const 
 
const std::vector< std::vector< std::size_t > > & getConvertedPropertyIndexes() const 
 
const TreeItemPtr & getChild(std::size_t i) const 
It returns the n-th child. 
 
virtual void writeStartElement(const std::string &qName)
 
void write(const te::map::AbstractLayer *alayer, te::xml::Writer &writer) const 
 
std::size_t getChildrenCount() const 
It returns the number of children of this node. 
 
An atomic property like an integer or double. 
 
This class models a XML reader object. 
 
This is the base class for layers. 
 
virtual const te::gm::Envelope & getExtent() const 
It returns the Layer extent (or minimum bounding box). 
 
int getPropertyType() const 
It gets the property type whose values will be grouped. 
 
boost::shared_ptr< DataSource > DataSourcePtr
 
const std::string & getValue() const 
It gets the value of the legend item. 
 
virtual const std::string & getTitle() const 
It returns the layer title. 
 
A class that models the description of a dataset. 
 
const size_t getPrecision() const 
It gets the precision used for the property values. 
 
This class models a XML writer object. 
 
std::string getPropertyName() const 
It gets the property name whose values will be grouped. 
 
DataSetType * getResult() const 
 
virtual void writeAttribute(const std::string &attName, const std::string &value)
 
te::da::DataSetTypeConverter * getConverter() const 
It returns the DataSetTypeConverter. 
 
A layer resulting from a query. 
 
virtual Visibility getVisibility() const 
It returns the layer visibility. 
 
std::map< std::string, std::string > getRasterInfo() const 
 
A layer that can be used as a container for other kind of layers. 
 
#define TE_TR(message)
It marks a string in order to get translated. 
 
virtual void setTitle(const std::string &title)
It sets the layer title. 
 
std::string getConverterName(std::size_t propertyPos)
This method tells which Attribute Converter was used in the porperty position. 
 
void setDataSourceId(const std::string &id)
 
void Union(const Envelope &rhs)
It updates the envelop with coordinates of another envelope. 
 
virtual std::string getElementLocalName() const =0
It returns the local part of the element name in the case of an element node. 
 
DataSetType * getConvertee()
This method returns the pointer to the DataSetType that is handled by the converter. 
 
const std::vector< te::dt::Property * > & getProperties() const 
It returns the properties that take part of the primary key. 
 
virtual te::map::Chart * getChart() const 
It returns the Chart associated to the Layer. 
 
virtual boost::int32_t getAttrAsInt32(const std::string &name) const 
It returns the attribute value in the case of an element node with valid attributes. 
 
void setConverter(std::auto_ptr< te::da::DataSetTypeConverter > converter)
It sets the converter that will be used by the layer. 
 
An converter for DataSetType. 
 
double getMaxValue() const 
 
const std::vector< AttributeConverter > & getConverters() const 
 
const std::string & getRendererType() const 
 
This class contains the parameters needed for grouping the values of a Property. 
 
The type for arbitrary precison numbers, like numeric(p, q). 
 
A layer with reference to a DataSetTypeConverter. 
 
const te::color::RGBAColor & getColor(std::size_t i) const 
 
std::auto_ptr< te::da::DataSet > getData(te::common::TraverseType travType=te::common::FORWARDONLY, const te::common::AccessPolicy accessPolicy=te::common::RAccess) const 
It gets the dataset identified by the layer name. 
 
std::pair< LayerReadFnctType, LayerWriteFnctType > LayerFnctSerializeType
 
A layer with reference to a raster. 
 
const std::vector< Property * > & getProperties() const 
It returns the list of properties describing the CompositeProperty. 
 
te::map::AbstractLayer * read(te::xml::Reader &reader) const 
 
virtual void writeValue(const std::string &value)
 
This class represents the informations needed to build map charts. 
 
int getSRID() const 
It returns the spatial reference system identifier associated to this property. 
 
static Symbolizer & 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. 
 
virtual void writeElement(const std::string &qName, const std::string &value)
 
An Envelope defines a 2D rectangular region. 
 
A GroupingItem contains information about a grouping item associated to a layer. 
 
const std::string & getDataSourceId() const 
 
virtual te::se::Style * getStyle() const 
It returns the Style associated to the layer. 
 
std::size_t getHeight() const 
 
bool isVisible() const 
It gets the chart visibility. 
 
const std::string & getDataSourceId() const 
 
TEGEOMEXPORT std::auto_ptr< te::gm::Envelope > ReadExtent(te::xml::Reader &reader)
 
GeomType getGeometryType() const 
It returns the geometry subtype allowed for the property. 
 
TEDATAACCESSEXPORT void Save(const std::string &fileName)
 
virtual void setVisibility(Visibility v)
It sets the layer visibility. 
 
boost::function< void(const te::map::AbstractLayer *, te::xml::Writer &)> LayerWriteFnctType
 
const std::string & getDataSourceId() const 
 
void setRendererType(const std::string &t)
 
virtual void setExtent(const te::gm::Envelope &mbr)
It sets the Layer extent (or minimum bounding box). 
 
void setDataSetName(const std::string &name)
 
te::da::Select * getQuery() const 
 
The type for string types: FIXED_STRING, VAR_STRING or STRING. 
 
boost::function< te::map::AbstractLayer *(te::xml::Reader &)> LayerReadFnctType
 
const std::string & getDataSetName() const 
 
virtual void writeEndElement(const std::string &qName)
 
virtual std::string getAttr(const std::string &name) const =0
It returns the attribute value in the case of an element node with valid attributes. 
 
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards. 
 
A Select models a query to be used when retrieving data from a DataSource. 
 
virtual bool getElementValueAsBoolean() const 
It returns the element data value in the case of VALUE node. 
 
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. 
 
TEDATAACCESSEXPORT te::da::Select * ReadSelect(te::xml::Reader &reader)
 
virtual te::map::Grouping * getGrouping() const 
It returns the Grouping associated to the Layer. 
 
It describes a primary key (pk) constraint. 
 
The type for date and time types: date, date period, date duration, time duration, time instant, time period, time instant with time zone or time period with time zone. 
 
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. 
 
virtual void setStyle(te::se::Style *style)
It sets the Style associated to the layer. 
 
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. 
 
const std::string & getRendererType() const 
 
virtual int getSRID() const 
It returns the Spatial Reference System ID associated to the Layer. 
 
A layer with reference to a dataset. 
 
void reg(const std::string &layerType, const LayerFnctSerializeType &fncts)
 
Visibility
Each layer can have three states of visibility. 
 
std::string getTitle()
It gets the title of the legend item. 
 
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
 
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. 
 
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
 
virtual bool next()=0
It gets the next event to be read. 
 
const std::string & getRendererType() const 
 
const Envelope * getMBR() const 
It returns the minimum bounding rectangle for the geometry in an internal representation. 
 
TEGEOMEXPORT void SaveExtent(const te::gm::Envelope &e, te::xml::Writer &writer)
 
const std::string & getRendererType() const 
 
const std::string & getName() const 
It returns the property name.