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/AbstractWriter.h" 
   46 #include "../../../xml/Reader.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" 
   68 #include <boost/algorithm/string/case_conv.hpp> 
   69 #include <boost/format.hpp> 
   70 #include <boost/lexical_cast.hpp> 
  136   return simpleProperty;
 
  148   LayerFnctIdxType::const_iterator it = m_fncts.find(layerType);
 
  150   if(it == m_fncts.end())
 
  151     throw Exception((boost::format(
TE_TR(
"Could not find a reader for the following layer type: %1%.")) % layerType).str());
 
  153   assert(it->second.second);
 
  155   return it->second.first(reader);
 
  162   LayerFnctIdxType::const_iterator it = m_fncts.find(alayer->
getType());
 
  164   if(it == m_fncts.end())
 
  165     throw Exception((boost::format(
TE_TR(
"Could not find a writer for the following layer type: %1%.")) % alayer->
getType()).str());
 
  167   assert(it->second.second);
 
  169   return it->second.second(alayer, writer);
 
  187   std::string 
id = reader.
getAttr(
"id");
 
  263   std::auto_ptr<te::se::Style> style;
 
  285   layer->setSRID(srid);
 
  286   layer->setExtent(*mbr.get());
 
  288   layer->setDataSetName(dataset);
 
  289   layer->setDataSourceId(datasourceId);
 
  290   layer->setRendererType(rendererId);
 
  292   layer->setStyle(style.release());
 
  295     layer->setGrouping(grouping);
 
  298     layer->setChart(chart.release());
 
  300   return layer.release();
 
  305   std::string 
id = reader.
getAttr(
"id");
 
  375   std::auto_ptr<te::se::Style> style;
 
  397   layer->setSRID(srid);
 
  398   layer->setExtent(*mbr.get());
 
  400   layer->setQuery(query);
 
  401   layer->setDataSourceId(datasourceId);
 
  402   layer->setRendererType(rendererId);
 
  404   layer->setStyle(style.release());
 
  407     layer->setGrouping(grouping);
 
  410     layer->setChart(chart.release());
 
  412   return layer.release();
 
  417   std::string 
id = reader.
getAttr(
"id");
 
  456   return flayer.release();
 
  461   std::string 
id = reader.
getAttr(
"id");
 
  476   std::map<std::string, std::string> conninfo;
 
  478   while(reader.
next() &&
 
  502     conninfo[paramName] = paramValue;
 
  549   std::auto_ptr<te::se::Style> style;
 
  571   layer->setSRID(srid);
 
  572   layer->setExtent(*mbr.get());
 
  573   layer->setRasterInfo(conninfo);
 
  575   layer->setRendererType(rendererId);
 
  577   layer->setStyle(dynamic_cast<te::se::CoverageStyle*>(style.release()));
 
  579   return layer.release();
 
  584   std::string 
id = reader.
getAttr(
"id");
 
  653   std::auto_ptr<te::se::Style> style;
 
  687   std::vector<std::pair<std::string, std::vector<std::size_t> > > props;
 
  761     std::pair<std::string, std::vector<std::size_t> > prop;
 
  763     std::vector<std::size_t> typeVec;
 
  764     typeVec.push_back(type);
 
  765     typeVec.push_back(geomType);
 
  766     typeVec.push_back(srid);
 
  767     prop.second = typeVec;
 
  768     props.push_back(prop);
 
  771   std::vector<std::vector<std::size_t> > propertyIndexes;
 
  782     std::vector<std::size_t> inIdxs;
 
  802     propertyIndexes.push_back(inIdxs);
 
  807   std::vector<std::string> functionsNames;
 
  847   std::auto_ptr<te::da::DataSetType> dst = ds->getDataSetType(dataSetName);
 
  851   for(std::size_t i = 0; i < propertyIndexes.size(); ++i)
 
  853     converter->add(propertyIndexes[i], 
GetProperty(props[i].first, props[i].second[0], props[i].second[1], props[i].second[2]), functionsNames[i]);
 
  856   std::vector<te::dt::Property*> convertedProps = converter->getResult()->getProperties();
 
  863     std::vector<te::dt::Property*> pkProps = pkIn->
getProperties();
 
  864     for(std::size_t i = 0; i < convertedProps.size(); ++i)
 
  866       for(std::size_t t = 0; t < pkProps.size(); ++t)
 
  868         if(convertedProps[i]->getName() == pkProps[t]->getName())
 
  869           pk->
add(convertedProps[i]);
 
  879   std::auto_ptr<te::da::DataSet> dataset = result->
getData();
 
  885     while(dataset->moveNext())
 
  972   for(
size_t i=0; i<count; i++)
 
  992   std::map<std::string, std::string> info = layer->
getRasterInfo();
 
  993   std::map<std::string, std::string>::iterator conIt;
 
  995   for(conIt=info.begin(); conIt!=info.end(); ++conIt)
 
 1061   std::vector<te::dt::Property*> outProps = resultDt->
getProperties();
 
 1063   for(std::size_t i = 0; i < outProps.size(); ++i)
 
 1067     writer.
writeElement(
"te_map:type", outProps[i]->getType());
 
 1068     writer.
writeElement(
"te_map:name", outProps[i]->getName());
 
 1090   for(std::size_t i = 0; i < propertyIndexes.size(); ++i)
 
 1096     std::vector<std::size_t> inputPropertiesIdx = propertyIndexes[i];
 
 1098     for(std::size_t j = 0; j < inputPropertiesIdx.size(); ++j)
 
 1099       writer.
writeElement(
"te_map:InIdx", (
int)inputPropertiesIdx[j]);
 
 1104   std::vector<te::da::AttributeConverter> converters = converter->
getConverters();
 
 1105   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. 
 
virtual const std::string & getType() const =0
It returns the layer type. 
 
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. 
 
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. 
 
Utility functions for the data access module. 
 
const std::string & getDataSetName() const 
 
virtual boost::int32_t getElementValueAsInt32() const 
It returns the element data value in the case of VALUE node. 
 
const std::vector< std::vector< std::size_t > > & getConvertedPropertyIndexes() const 
 
const TreeItemPtr & getChild(std::size_t i) const 
It returns the n-th child. 
 
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). 
 
boost::shared_ptr< DataSource > DataSourcePtr
 
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
 
A class that models the description of a dataset. 
 
virtual void writeValue(const std::string &value)=0
 
TEMAPEXPORT std::string ReadLayerTitle(te::xml::Reader &reader)
 
void setCompositionMode(te::map::CompositionMode mode)
It sets the composition mode. 
 
DataSetType * getResult() const 
 
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. 
 
This class models a XML writer object. 
 
#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. 
 
TEMAPEXPORT te::map::Grouping * ReadLayerGrouping(te::xml::Reader &reader)
 
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 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. 
 
te::map::CompositionMode getCompositionMode() const 
It returns the composition mode. 
 
CompositionMode
The composition mode used to render the canvas. 
 
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. 
 
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
 
virtual void writeElement(const std::string &qName, const std::string &value)=0
 
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 
 
int getSRID() const 
It returns the spatial reference system identifier associated to this property. 
 
static Style & getInstance()
It returns a reference to the singleton instance. 
 
An Envelope defines a 2D rectangular region. 
 
const std::string & getDataSourceId() const 
 
virtual te::se::Style * getStyle() const 
It returns the Style associated to the layer. 
 
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. 
 
const std::string & getDataSourceId() const 
 
TEGEOMEXPORT void SaveExtent(const te::gm::Envelope &e, te::xml::AbstractWriter &writer)
 
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 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. 
 
TEMAPEXPORT te::map::Visibility GetVisibility(const std::string &visible)
 
virtual void writeAttribute(const std::string &attName, const std::string &value)=0
 
TEDATAACCESSEXPORT te::da::Select * ReadSelect(te::xml::Reader &reader)
 
It describes a primary key (pk) constraint. 
 
void write(const te::map::AbstractLayer *alayer, te::xml::AbstractWriter &writer) const 
 
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. 
 
virtual void setStyle(te::se::Style *style)
It sets the Style associated to the layer. 
 
virtual std::string getElementValue() const =0
It returns the element data value in the case of VALUE node. 
 
const std::string & getRendererType() const 
 
virtual void writeEndElement(const std::string &qName)=0
 
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)
 
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
 
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
 
virtual bool next()=0
It gets the next event to be read. 
 
const std::string & getRendererType() const 
 
boost::function< void(const te::map::AbstractLayer *, te::xml::AbstractWriter &)> LayerWriteFnctType
 
const Envelope * getMBR() const 
It returns the minimum bounding rectangle for the geometry in an internal representation. 
 
const std::string & getRendererType() const 
 
const std::string & getName() const 
It returns the property name.