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(
TE_TR(
"Wrong type render type for this layer!"));
97 else if(dlayer->
getSRID() != srid)
99 throw Exception(
TE_TR(
"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(
TE_TR(
"Could not create a default feature type style to the layer %1%.")) % layer->
getTitle()).str());
147 throw Exception(
TE_TR(
"The layer style is not a Feature Type Style!"));
151 else if(dstype->hasRaster())
164 throw Exception((boost::format(
TE_TR(
"Could not create a default coverage style to the layer %1%.")) % layer->
getTitle()).str());
172 throw Exception(
TE_TR(
"The layer style is not a Coverage Style!"));
178 throw Exception(
TE_TR(
"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 =
TE_TR(
"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(
TE_TR(
"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();
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)
Utility functions for the data access module.
const std::string & getDataSetName() const
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...
bool intersects(const Envelope &rhs) const
It returns true if the envelopes "spatially intersects".
It models the inequality operator less than or equal to (<=).
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
Spatial intersects operator.
This is the base class for layers.
virtual const te::gm::Envelope & getExtent() const
It returns the Layer extent (or minimum bounding box).
A class that models the name of a dataset used in a From clause.
int getPropertyType() const
It gets the property type whose values will be grouped.
boost::shared_ptr< DataSource > DataSourcePtr
const std::string & getValue() const
It gets the value of the legend item.
virtual const std::string & getTitle() const
It returns the layer title.
A class that models the name of any property of an object.
A Symbolizer describes how a feature is to appear on a map.
The CoverageStyle defines the styling that is to be applied to a subset of Coverage data...
std::string getPropertyName() const
It gets the property name whose values will be grouped.
TESEEXPORT Style * CreateCoverageStyle(const std::vector< te::rst::BandProperty * > &properties)
Try creates an appropriate coverage style based on given band properties.
This class can be used to inform the progress of a task.
It models the inequality operator greater than or equal to (>=).
A layer with reference to a dataset.
#define TE_TR(message)
It marks a string in order to get translated.
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.
bool isActive() const
Verify if the task is active.
Boolean logic operator: AND.
This is an abstract class that models a query expression.
Expression * clone() const
It creates a new copy of this expression.
TESEEXPORT Style * CreateFeatureTypeStyle(const te::gm::GeomType &geomType)
Try creates an appropriate feature type style based on given geometry type.
This class contains the parameters needed for grouping the values of a Property.
An Envelope defines a 2D rectangular region.
A GroupingItem contains information about a grouping item associated to a layer.
const std::string & getDataSourceId() const
The FeatureTypeStyle defines the styling that is to be applied to a dataset that can be viewed as a f...
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
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. ...
virtual te::se::Style * getStyle() const
It returns the Style associated to the layer.
GeomType getGeometryType() const
It returns the geometry subtype allowed for the property.
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 pulse()
Calls setCurrentStep() function using getCurrentStep() + 1.
A class that models a literal for double values.
A Select models a query to be used when retrieving data from a DataSource.
boost::ptr_vector< FromItem > From
It models the FROM clause for a query.
A canvas is an abstraction of a drawing area.
bool isVisible() const
It gets the grouping visibility.
const std::vector< te::map::GroupingItem * > & getGroupingItems() const
It gets the vector of grouping items.
GroupingType
The grouping type associated to the layer.
const std::string & getUpperLimit() const
It gets the upper limit value of the legend item.
virtual te::map::Grouping * getGrouping() const
It returns the Grouping associated to the Layer.
~DataSetLayerRenderer()
Destructor.
It models the comparison operator.
It renders the objects associated to a dataset layer.
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 class that models a literal for Envelope values.
void drawGrouping(DataSetLayer *layer, te::da::DataSourcePtr ds, Canvas *canvas, const te::gm::Envelope &bbox, int srid)
virtual int getSRID() const
It returns the Spatial Reference System ID associated to the Layer.
A layer with reference to a dataset.
This class contains the parameters needed for grouping the values of a Property.
std::vector< te::rst::BandProperty * > & getBandProperties()
Returns a reference to the list of bands definitions.
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
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.
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
const std::vector< te::se::Symbolizer * > & getSymbolizers() const
It gets the symbolizer 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.
virtual void draw(const te::gm::Geometry *geom)=0
It draws the geometry on canvas.
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)
This class models a string Literal value.