27 #include "../common/Translator.h"
28 #include "../dataaccess/query/DataSetName.h"
29 #include "../dataaccess/query/Field.h"
30 #include "../dataaccess/query/Fields.h"
31 #include "../dataaccess/query/From.h"
32 #include "../dataaccess/query/FromItem.h"
33 #include "../dataaccess/query/Select.h"
34 #include "../dataaccess/query/SpatialQueryProcessor.h"
35 #include "../dataaccess/query/Where.h"
36 #include "../dataaccess/utils/Utils.h"
42 #include <boost/format.hpp>
60 const std::string& title,
72 assert(!m_datasetName.empty());
76 return ds->getDataSetType(m_datasetName);
82 assert(!m_datasetName.empty());
86 return ds->getDataSet(m_datasetName, travType, accessPolicy);
95 assert(!m_datasetName.empty());
99 return ds->getDataSet(m_datasetName, propertyName, e, r, travType, accessPolicy);
108 assert(!m_datasetName.empty());
112 return ds->getDataSet(m_datasetName, propertyName, g, r, travType, accessPolicy);
120 assert(!m_datasetName.empty());
134 from->push_back(fromItem);
137 std::auto_ptr<te::da::Select> select(
new te::da::Select(all, from, filter));
140 return sqp.
getDataSet(ds, select.get(), travType);
151 return ds->getDataSet(m_datasetName, oids, travType, accessPolicy);
156 if(m_datasourceId.empty() || m_datasetName.empty())
169 if(ds.get() == 0 || !ds->isValid() || !ds->isOpened())
177 if(m_rendererType.empty())
178 throw Exception((boost::format(
TR_MAP(
"Could not draw the data set layer %1%. The renderer type is empty!")) % getTitle()).str());
182 if(renderer.get() == 0)
183 throw Exception((boost::format(
TR_MAP(
"Could not draw the data set layer %1%. The renderer %2% could not be created!")) % getTitle() % m_rendererType).str());
185 renderer->draw(
this, canvas, bbox, srid);
195 return m_datasetName;
200 m_datasetName = name;
205 return m_datasourceId;
215 return m_rendererType;
const std::string & getDataSetName() const
This class represents a set of unique ids created in the same context. i.e. from the same data set...
A class that models the name of a dataset used in a From clause.
TEDATAACCESSEXPORT DataSourcePtr GetDataSource(const std::string &datasourceId, const bool opened=true)
Search for a data source with the informed id in the DataSourceManager.
~DataSetLayer()
Destructor.
This is the base class for layers.
A layer with reference to a dataset.
A Select models a query to be used when retrieving data from a DataSource.
A canvas is an abstraction of a drawing area.
The Field class can be used to model an expression that takes part of the output items of a SELECT...
boost::ptr_vector< FromItem > From
It models the FROM clause for a query.
static const std::string sm_type
A static data member used in the implementation of getType method.
const std::string & getDataSourceId() const
SpatialRelation
Spatial relations between geometric objects.
static AbstractRenderer * make(const std::string &factoryKey)
It creates an object with the appropriated factory.
boost::ptr_vector< Field > Fields
Fields is just a boost::ptr_vector of Field pointers.
AccessPolicy
Supported data access policies (can be used as bitfield).
DataSetLayer(AbstractLayer *parent=0)
It initializes a new layer.
An abstract class that models a source of data in a query.
An exception class for the MapTools module.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
const std::string & getRendererType() const
boost::shared_ptr< DataSource > DataSourcePtr
A basic query processor for spatial restrictions.
void setRendererType(const std::string &t)
TraverseType
A dataset can be traversed in two ways:
#define TR_MAP(message)
It marks a string in order to get translated. This is a special mark used in the Map Rendering module...
An abstract factory for layer renderers.
bool isValid() const
It returns true if the layer can be used for instance to draw, otherwise, it returns false...
const std::string & getType() const
It returns the layer type: DATASET_LAYER.
This is an abstract class that models a query expression.
void setDataSourceId(const std::string &id)
void setDataSetName(const std::string &name)
std::auto_ptr< LayerSchema > getSchema() const
It returns the layer schema.
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.
void draw(Canvas *canvas, const te::gm::Envelope &bbox, int srid)
It draws the layer geographic objects in the given canvas using the informed SRS. ...
virtual std::auto_ptr< DataSet > getDataSet(const DataSourcePtr &ds, const Select &q, te::common::TraverseType travType=te::common::FORWARDONLY)
An Envelope defines a 2D rectangular region.
A class that can be used to model a filter expression that can be applied to a query.