3 #include "../../../../dataaccess/datasource/DataSource.h" 4 #include "../../../../dataaccess/dataset/DataSetType.h" 5 #include "../../../../dataaccess/utils/Utils.h" 6 #include "../../../../maptools/AbstractRenderer.h" 7 #include "../../../../maptools/RendererFactory.h" 8 #include "../../../../maptools/Utils.h" 9 #include "../../../../raster/RasterProperty.h" 10 #include "../../../../raster/BandProperty.h" 11 #include "../../../../raster/Band.h" 12 #include "../../../../raster/Grid.h" 13 #include "../../../../raster/RasterFactory.h" 14 #include "../../../../memory/DataSet.h" 15 #include "../../../../memory/DataSetItem.h" 16 #include "../../../core/Exception.h" 21 #include <boost/format.hpp> 29 :
te::map::AbstractLayer(parent),
30 m_rendererType(
"OGC_WMS_LAYER_RENDERER"),
121 m_schema = std::unique_ptr<te::da::DataSetType>(dataSetType);
170 std::unique_ptr<te::map::LayerSchema> dataSetType =
getSchema();
172 std::map<std::string, std::string> rinfo;
178 dataSetItem->setRaster(0, raster);
180 dataSet->
add(dataSetItem);
182 return std::unique_ptr<te::da::DataSet>(dataSet);
191 return getData(travType, accessPolicy);
200 return getData(travType, accessPolicy);
207 return getData(travType, accessPolicy);
214 return getData(travType, accessPolicy);
235 if(ds.get() ==
nullptr || !ds->isValid() || !ds->isOpened())
243 const double &scale,
bool *cancel)
251 if(renderer.get() ==
nullptr)
256 renderer->draw(
this, canvas, bbox, srid, scale, cancel);
307 if(ds.get() ==
nullptr || !ds->isValid() || !ds->isOpened())
312 if(wmsDataSource ==
nullptr)
329 return std::string(
"");
332 if(ds.get() ==
nullptr || !ds->isValid() || !ds->isOpened())
333 return std::string(
"");
337 if(wmsDataSource ==
nullptr)
339 return std::string(
"");
357 if(ds.get() ==
nullptr || !ds->isValid() || !ds->isOpened())
362 if(wmsDataSource ==
nullptr)
TEDATAACCESSEXPORT DataSourcePtr GetDataSource(const std::string &datasourceId, const bool opened=true)
Search for a data source with the informed id in the DataSourceManager.
TEDATAACCESSEXPORT te::rst::RasterProperty * GetFirstRasterProperty(const DataSetType *dt)
void setDataSourceId(const std::string &datadourceId)
void set(te::rst::Grid *grid)
Sets the definition of the raster grid support.
WMSLayer(te::map::AbstractLayer *parent=0)
It initializes a new layer.
const std::string & getDataSourceId() const
std::string m_datasetName
The dataset name where we will retrieve the layer objects.
int m_currentSRID
SRID used when the layer is drawn.
std::vector< std::string > m_layers
TEMAPEXPORT void CopyAbstractLayerInfo(const te::map::AbstractLayer *refLayer, te::map::AbstractLayer *layer)
Make a copy of refLayer abstract attributes to layer. Creating new id.
This is the base class for layers.
virtual const te::gm::Envelope & getExtent() const
It returns the Layer extent (or minimum bounding box).
te::ws::ogc::wms::WMSGetMapRequest m_getMapRequest
boost::shared_ptr< DataSource > DataSourcePtr
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
virtual const std::string & getTitle() const
It returns the layer title.
A raster band description.
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
This XML Schema Document named xlinks xsd has been stored here based on the change request
A class that models the description of a dataset.
TEOGCWMSDATAACCESSEXPORT te::rst::Raster * GetLayerMapRaster(const WMSLayer *wmsLayer)
te::gm::Envelope m_currentExtent
Layer extent in current SRID.
const std::string saveGetMap(const te::ws::ogc::wms::WMSGetMapRequest &request, const std::string &filename)
It execute a WMS GetMap and save the result image on disk. The request will be based on WMSGetMapRequ...
SpatialRelation
Spatial relations between geometric objects.
static te::dt::Date ds(2010, 01, 01)
virtual std::unique_ptr< te::map::LayerSchema > getSchema() const
It returns the layer schema.
const te::ws::ogc::wms::WMSGetFeatureInfoResponse getFeatureInfo(const te::ws::ogc::wms::WMSGetFeatureInfoRequest &request)
#define TE_TR(message)
It marks a string in order to get translated.
std::string m_datasourceId
The DataSource associated to this layer.
boost::error_info< struct tag_error_description, std::string > ErrorDescription
The base type for error report messages.
This is an abstract class that models a query expression.
void add(DataSetItem *item)
It adds a new item to the dataset and takes its ownership.
int m_srid
The identifier of the layer spatial reference system.
void draw(te::map::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. ...
AccessPolicy
Supported data access policies (can be used as bitfield).
TraverseType
A dataset can be traversed in two ways:
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
void add(te::rst::BandProperty *b)
It adds a new band information to the property.
const std::string & getRendererType() const
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...
An abstract class for raster data strucutures.
std::string m_rendererType
A pointer to the internal renderer used to paint this layer.
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster.
BandProperty * getProperty()
Returns the band property.
The WMSGetFeatureInfoRequest WMS 1.3.0 struct.
AbstractLayer * clone()
It returns a clone of the object.
std::unique_ptr< te::map::LayerSchema > m_schema
The WMS layer schema.
The WMSGetMapResponse WMS 1.3.0 struct.
The WMSGetMapResponse WMS 1.3.0 struct.
bool isValid() const
It returns true if the layer can be used for instance to draw, otherwise, it returns false...
void setGetMapRequest(const te::ws::ogc::wms::WMSGetMapRequest &getMapRequest)
A layer with reference to a WMS Layer.
virtual const Band * getBand(std::size_t i) const =0
Returns the raster i-th band.
Grid * getGrid()
It returns the raster grid.
Utility functions for the data access module.
te::ws::ogc::wms::WMSGetMapRequest getRequest() const
void setRendererType(const std::string &rendererType)
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.
Base exception class for WS Core Runtime Library.
virtual const te::gm::Envelope & getExtent() const
It returns the Layer extent (or minimum bounding box).
Implementation of the data source for the WMS driver.
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver...
A canvas is an abstraction of a drawing area.
const std::string saveGetMap(const std::string &filename) const
It execute a WMS GetMap and save the result image on disk. The request will be based on WMSGetMapRequ...
const std::string & getType() const
It returns the layer type.
te::ws::ogc::wms::WMSGetMapResponse getMap(const te::ws::ogc::wms::WMSGetMapRequest &request)
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.
virtual int getSRID() const
It returns the Spatial Reference System ID associated to the Layer.
virtual int getSRID() const
It returns the Spatial Reference System ID associated to the Layer.
std::vector< te::rst::BandProperty * > & getBandProperties()
Returns a reference to the list of bands definitions.
AbstractLayer(AbstractLayer *parent=0)
It initializes a new layer.
A rectified grid is the spatial support for raster data.
void transform(int oldsrid, int newsrid)
It will transform the coordinates of the Envelope from the old SRS to the new one.
static const std::string sm_type
A static data member used in the implementation of getType method.
const te::ws::ogc::wms::WMSGetFeatureInfoResponse getFeatureInfo(const te::ws::ogc::wms::WMSGetFeatureInfoRequest &request)
The WMSGetMapRequest WMS 1.3.0 struct.
const te::ws::ogc::wms::WMSGetMapResponse getMap() const
It gets a WMS GetMap response with the image on a buffer. The request will be based on WMSGetMapReque...
void setCurrentSRID(const int &srid)