27 #include "../common/progress/TaskProgress.h"
28 #include "../common/Translator.h"
29 #include "../dataaccess/dataset/DataSet.h"
30 #include "../dataaccess/dataset/DataSetType.h"
31 #include "../dataaccess/datasource/DataSource.h"
32 #include "../dataaccess/query/And.h"
33 #include "../dataaccess/query/DataSetName.h"
34 #include "../dataaccess/query/EqualTo.h"
35 #include "../dataaccess/query/Field.h"
36 #include "../dataaccess/query/GreaterThanOrEqualTo.h"
37 #include "../dataaccess/query/LessThanOrEqualTo.h"
38 #include "../dataaccess/query/LiteralDouble.h"
39 #include "../dataaccess/query/LiteralEnvelope.h"
40 #include "../dataaccess/query/LiteralString.h"
41 #include "../dataaccess/query/PropertyName.h"
42 #include "../dataaccess/query/Select.h"
43 #include "../dataaccess/query/ST_Intersects.h"
44 #include "../dataaccess/query/Where.h"
45 #include "../dataaccess/utils/Utils.h"
46 #include "../geometry/Envelope.h"
47 #include "../geometry/Geometry.h"
48 #include "../geometry/GeometryProperty.h"
49 #include "../raster/RasterProperty.h"
50 #include "../se/CoverageStyle.h"
51 #include "../se/FeatureTypeStyle.h"
52 #include "../se/Utils.h"
53 #include "../srs/Config.h"
64 #include <boost/format.hpp>
65 #include <boost/lexical_cast.hpp>
88 throw Exception(
TR_MAP(
"Wrong type render type for this layer!"));
97 else if(dlayer->
getSRID() != srid)
99 throw Exception(
TR_MAP(
"The layer or map don't have a valid SRID!"));
112 assert(!dsname.empty());
114 std::auto_ptr<te::da::DataSetType> dstype(ds->getDataSetType(dsname));
116 if(dstype->hasGeom())
124 drawGrouping(dlayer, ds, canvas, ibbox, srid);
139 throw Exception((boost::format(
TR_MAP(
"Could not create a default feature type style to the layer %1%.")) % layer->
getTitle()).str());
147 throw Exception(
TR_MAP(
"The layer style is not a Feature Type Style!"));
151 else if(dstype->hasRaster())
164 throw Exception((boost::format(
TR_MAP(
"Could not create a default coverage style to the layer %1%.")) % layer->
getTitle()).str());
172 throw Exception(
TR_MAP(
"The layer style is not a Coverage Style!"));
178 throw Exception(
TR_MAP(
"The layer don't have a geometry or raster property!"));
187 bool needRemap =
false;
192 std::auto_ptr<te::da::DataSetType> dataSetType(ds->getDataSetType(dsname));
193 assert(dataSetType.get());
196 assert(dataSetType->hasGeom());
207 assert(!propertyName.empty());
218 std::size_t nGroupItems = items.size();
221 std::string message =
TR_MAP(
"Drawing the grouping of layer");
222 message +=
" " + layer->
getTitle() +
".";
227 for(std::size_t i = 0; i < nGroupItems; ++i)
292 std::auto_ptr<te::da::DataSet> dataset(0);
295 dataset = ds->query(select);
297 catch(std::exception& )
302 if(dataset.get() == 0)
303 throw Exception((boost::format(
TR_MAP(
"Could not retrieve the data set %1% referenced by the layer %2%.")) % dsname % layer->
getTitle()).str());
305 if(dataset->moveNext() ==
false)
309 const std::vector<te::se::Symbolizer*>& symbolizers = item->
getSymbolizers();
311 std::size_t nSymbolizers = symbolizers.size();
313 for(std::size_t j = 0; j < nSymbolizers; ++j)
333 std::auto_ptr<te::gm::Geometry> geom = dataset->getGeometry(gpos);
340 geom->setSRID(layer->
getSRID());
341 geom->transform(srid);
344 canvas->
draw(geom.get());
346 }
while(dataset->moveNext());
349 dataset->moveFirst();
GroupingType
The grouping type associated to the layer.
std::vector< te::rst::BandProperty * > & getBandProperties()
Returns a reference to the list of bands definitions.
bool isActive() const
Verify if the task is active.
A layer with reference to a dataset.
const std::string & getDataSetName() const
This class contains the parameters needed for grouping the values of a Property.
The FeatureTypeStyle defines the styling that is to be applied to a dataset that can be viewed as a f...
A class that models the name of a dataset used in a From clause.
TEDATAACCESSEXPORT te::rst::RasterProperty * GetFirstRasterProperty(const DataSetType *dt)
TEMAPEXPORT void DrawGeometries(te::da::DataSetType *type, te::da::DataSourcePtr ds, Canvas *canvas, const te::gm::Envelope &bbox, int bboxSRID, int srid, te::se::FeatureTypeStyle *style)
It draws the data set geometries in the given canvas using the informed SRID and style.
TEDATAACCESSEXPORT DataSourcePtr GetDataSource(const std::string &datasourceId, const bool opened=true)
Search for a data source with the informed id in the DataSourceManager.
Expression * clone() const
It creates a new copy of this expression.
It renders the objects associated to a dataset layer.
virtual const std::string & getTitle() const
It returns the layer title.
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
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.
A Symbolizer describes how a feature is to appear on a map.
Spatial intersects operator.
The Field class can be used to model an expression that takes part of the output items of a SELECT...
It models the inequality operator greater than or equal to (>=).
This class models a string Literal value.
boost::ptr_vector< FromItem > From
It models the FROM clause for a query.
The CoverageStyle defines the styling that is to be applied to a subset of Coverage data...
A class that models the name of any property of an object.
const std::string & getDataSourceId() const
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
const std::string & getValue() const
It gets the value of the legend item.
virtual te::map::Grouping * getGrouping() const
It returns the Grouping associated to the Layer.
int getPropertyType() const
It gets the property type whose values will be grouped.
boost::ptr_vector< Field > Fields
Fields is just a boost::ptr_vector of Field pointers.
bool isVisible() const
It gets the grouping visibility.
Boolean logic operator: AND.
void drawGrouping(DataSetLayer *layer, te::da::DataSourcePtr ds, Canvas *canvas, const te::gm::Envelope &bbox, int srid)
TESEEXPORT Style * CreateFeatureTypeStyle(const te::gm::GeomType &geomType)
Try creates an appropriate feature type style based on given geometry type.
GeomType getGeometryType() const
It returns the geometry subtype allowed for the property.
An abstract class that models a source of data in a query.
A Symbology Enconding visitor that configures a given canvas based on symbolizers elements...
Utility functions for the data access module.
An exception class for the MapTools module.
void pulse()
Calls setCurrentStep() function using getCurrentStep() + 1.
It models the inequality operator less than or equal to (<=).
TESEEXPORT Style * CreateCoverageStyle(const std::vector< te::rst::BandProperty * > &properties)
Try creates an appropriate coverage style based on given band properties.
std::string getPropertyName() const
It gets the property name whose values will be grouped.
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
A class that models a literal for Envelope values.
boost::shared_ptr< DataSource > DataSourcePtr
A Symbology Enconding visitor that configures a given canvas based on symbolizers elements...
virtual te::se::Style * getStyle() const
It returns the Style associated to the layer.
virtual const te::gm::Envelope & getExtent() const
It returns the Layer extent (or minimum bounding box).
Envelope intersection(const Envelope &rhs) const
It returns an envelope that represents the point set intersection with another envelope.
const std::string & getLowerLimit() const
It gets the lower limit value of the legend item.
void transform(int oldsrid, int newsrid)
It will transform the coordinates of the Envelope from the old SRS to the new one.
#define TR_MAP(message)
It marks a string in order to get translated. This is a special mark used in the Map Rendering module...
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
~DataSetLayerRenderer()
Destructor.
This class contains the parameters needed for grouping the values of a Property.
bool intersects(const Envelope &rhs) const
It returns true if the envelopes "spatially intersects".
virtual void draw(const te::gm::Geometry *geom)=0
It draws the geometry on canvas.
const std::vector< te::se::Symbolizer * > & getSymbolizers() const
It gets the symbolizer of the legend item.
This is an abstract class that models a query expression.
This class can be used to inform the progress of a task.
It models the comparison operator.
void draw(AbstractLayer *layer, Canvas *canvas, const te::gm::Envelope &bbox, int srid)
It draws the layer geographic objects in the given canvas using the SRS informed. ...
TEMAPEXPORT void DrawRaster(te::da::DataSetType *type, te::da::DataSourcePtr ds, Canvas *canvas, const te::gm::Envelope &bbox, int bboxSRID, const te::gm::Envelope &visibleArea, int srid, te::se::CoverageStyle *style)
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.
virtual int getSRID() const
It returns the Spatial Reference System ID associated to the Layer.
A class that models a literal for double values.
const std::string & getUpperLimit() const
It gets the upper limit value of the legend item.
const std::vector< te::map::GroupingItem * > & getGroupingItems() const
It gets the vector of grouping items.
virtual void setStyle(te::se::Style *style)
It sets the Style associated to the layer.
const GroupingType getType() const
It gets the grouping type.
A GroupingItem contains information about a grouping item associated to a layer.