27 #include "../core/translator/Translator.h" 28 #include "../dataaccess/dataset/DataSetAdapter.h" 29 #include "../dataaccess/dataset/DataSetTypeConverter.h" 30 #include "../dataaccess/dataset/FilteredDataSet.h" 31 #include "../dataaccess/query/DataSetName.h" 32 #include "../dataaccess/query/Field.h" 33 #include "../dataaccess/query/Fields.h" 34 #include "../dataaccess/query/From.h" 35 #include "../dataaccess/query/FromItem.h" 36 #include "../dataaccess/query/Select.h" 37 #include "../dataaccess/query/Where.h" 38 #include "../dataaccess/utils/Utils.h" 44 #include <boost/format.hpp> 62 const std::string& title,
75 std::unique_ptr<te::da::DataSetType> type;
76 type.reset(dynamic_cast<te::da::DataSetType*>(
m_converter->getResult()->clone()));
84 std::unique_ptr<te::da::DataSet> inputData, outputDataSet;
88 inputData = ds->getDataSet(
m_datasetName, travType, accessPolicy);
103 std::unique_ptr<te::da::DataSetType> dsType = ds->getDataSetType(
m_datasetName);
106 std::unique_ptr<te::da::DataSet> inputData = ds->getDataSet(
m_datasetName, travType, accessPolicy);
109 std::unique_ptr<te::da::DataSet> adaptedDataSet;
112 std::vector<std::size_t> positions;
116 adaptedDataSet->moveBeforeFirst();
118 std::unique_ptr<te::da::DataSet> result(
new te::da::FilteredDataSet(adaptedDataSet.release(), positions,
true));
130 std::unique_ptr<te::da::DataSet> inputData, outputDataSet;
134 inputData = ds->getDataSet(
m_datasetName, propertyName, g, r, travType, accessPolicy);
137 return outputDataSet;
145 std::unique_ptr<te::da::DataSet> inputData, outputDataSet;
159 from->push_back(fromItem);
164 inputData = ds->query(select.get(), travType, accessPolicy);
167 return outputDataSet;
175 std::unique_ptr<te::da::DataSet> inputData, outputDataSet;
179 inputData = ds->getDataSet(
m_datasetName, oids, travType, accessPolicy);
182 return outputDataSet;
203 if(ds.get() ==
nullptr || !ds->isValid() || !ds->isOpened())
212 throw Exception((boost::format(
TE_TR(
"Could not draw the data set layer %1%. The renderer type is empty!")) %
getTitle()).str());
214 std::unique_ptr<te::da::DataSetType> dsType =
getSchema();
216 if(!dsType->hasGeom())
221 if(renderer.get() ==
nullptr)
224 renderer->draw(
this, canvas, bbox, srid, scale, cancel);
238 std::unique_ptr<te::da::DataSetType> dsType = ds->getDataSetType(
m_datasetName);
245 std::unique_ptr<te::da::DataSet> inputData = ds->getDataSet(
m_datasetName);
248 std::unique_ptr<te::da::DataSet> adaptedDataSet;
255 while(adaptedDataSet->moveNext())
257 std::unique_ptr<te::gm::Geometry> geom(adaptedDataSet->getGeometry(geomPropPos));
TEDATAACCESSEXPORT DataSourcePtr GetDataSource(const std::string &datasourceId, const bool opened=true)
Search for a data source with the informed id in the DataSourceManager.
bool isValid() const
It returns true if the layer can be used for instance to draw, otherwise, it returns false...
DataSetAdapterLayer(AbstractLayer *parent=0)
It initializes a new layer.
std::string m_datasetName
The dataset name where we will retrieve the layer objects.
An abstract class that models a source of data in a query.
The Field class can be used to model an expression that takes part of the output items of a SELECT...
std::unique_ptr< te::da::DataSetTypeConverter > m_converter
The DataSetConverter that will be cused to configure the layer.
void draw(Canvas *canvas, const te::gm::Envelope &bbox, int srid, const double &scale, bool *cancel)
It draws the layer geographic objects in the given canvas using the informed SRS. ...
This is the base class for layers.
A class that models the name of a dataset used in a From clause.
boost::shared_ptr< DataSource > DataSourcePtr
virtual const std::string & getTitle() const
It returns the layer title.
void setConverter(std::unique_ptr< te::da::DataSetTypeConverter > converter)
It sets the converter that will be used by the layer.
Base exception class for plugin module.
An abstract factory for layer renderers.
te::da::DataSetTypeConverter * getConverter() const
It returns the DataSetTypeConverter.
SpatialRelation
Spatial relations between geometric objects.
te::sam::rtree::Index< std::size_t, 4 > m_rtree
static const std::string sm_type
A static data member used in the implementation of getType method.
static te::dt::Date ds(2010, 01, 01)
std::unique_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.
#define TE_TR(message)
It marks a string in order to get translated.
~DataSetAdapterLayer()
Destructor.
This is an abstract class that models a query expression.
An converter for DataSetType.
const std::string & getRendererType() const
AccessPolicy
Supported data access policies (can be used as bitfield).
TraverseType
A dataset can be traversed in two ways:
TEDATAACCESSEXPORT std::size_t GetFirstSpatialPropertyPos(const te::da::DataSet *dataset)
It returns the first dataset spatial property or NULL if none is found.
An Envelope defines a 2D rectangular region.
This class represents a set of unique ids created in the same context. i.e. from the same data set...
const std::string & getType() const
It returns the layer type: DATASET_LAYER.
boost::ptr_vector< Field > Fields
Fields is just a boost::ptr_vector of Field pointers.
A class that can be used to model a filter expression that can be applied to a query.
void setRendererType(const std::string &t)
int search(const te::gm::Envelope &mbr, std::vector< DATATYPE > &report) const
Range search query.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
static AbstractRenderer * make(const std::string &factoryKey)
It creates an object with the appropriated factory.
A Select models a query to be used when retrieving data from a DataSource.
A layer with reference to a DataSetTypeConverter.
This class represents a filtered data set.
boost::ptr_vector< FromItem > From
It models the FROM clause for a query.
virtual void select(te::da::ObjectIdSet *oids)
It adds the given oids to the selected group of this Layer.
std::string m_rendererType
A pointer to the internal renderer used to paint this layer.
A canvas is an abstraction of a drawing area.
void insert(const te::gm::Envelope &mbr, const DATATYPE &data)
It inserts an item into the tree.
std::string m_datasourceId
DataSource id.
TEDATAACCESSEXPORT DataSetAdapter * CreateAdapter(DataSet *ds, DataSetTypeConverter *converter, bool isOwner=false)
std::unique_ptr< LayerSchema > getSchema() const
It returns the layer schema.