27 #include "../common/Translator.h"
28 #include "../common/progress/TaskProgress.h"
29 #include "../dataaccess/datasource/DataSource.h"
30 #include "../dataaccess/datasource/DataSourceTransactor.h"
31 #include "../dataaccess/dataset/DataSet.h"
32 #include "../dataaccess/dataset/DataSetType.h"
33 #include "../dataaccess/query/And.h"
34 #include "../dataaccess/query/DataSetName.h"
35 #include "../dataaccess/query/Field.h"
36 #include "../dataaccess/query/LiteralEnvelope.h"
37 #include "../dataaccess/query/PropertyName.h"
38 #include "../dataaccess/query/Select.h"
39 #include "../dataaccess/query/ST_Intersects.h"
40 #include "../dataaccess/query/Where.h"
41 #include "../dataaccess/utils/Utils.h"
42 #include "../geometry/Envelope.h"
43 #include "../geometry/Geometry.h"
44 #include "../geometry/GeometryProperty.h"
45 #include "../geometry/Utils.h"
46 #include "../se/CoverageStyle.h"
47 #include "../se/FeatureTypeStyle.h"
48 #include "../se/ImageOutline.h"
49 #include "../se/RasterSymbolizer.h"
50 #include "../se/Rule.h"
51 #include "../se/Utils.h"
52 #include "../srs/Config.h"
53 #include "../srs/Converter.h"
62 #include <boost/format.hpp>
63 #include <boost/lexical_cast.hpp>
85 throw Exception(
TE_TR(
"Wrong type render type for this layer!"));
94 else if(qlayer->
getSRID() != srid)
96 throw Exception(
TE_TR(
"The layer or map don't have a valid SRID!"));
105 std::auto_ptr<LayerSchema> schema(qlayer->
getSchema());
106 assert(schema.get());
108 if(schema->hasGeom())
110 drawGeometries(qlayer, canvas, ibbox, srid);
112 else if(schema->hasRaster())
114 drawRaster(qlayer, canvas, ibbox, bbox, srid);
118 throw Exception(
TE_TR(
"The layer don't have a geometry or raster property!"));
127 std::auto_ptr<const te::map::LayerSchema> schema(layer->
getSchema());
128 assert(schema.get());
131 bool needRemap =
false;
136 assert(schema->hasGeom());
147 throw Exception((boost::format(
TE_TR(
"Could not create a default feature type style to the layer %1%.")) % layer->
getTitle()).str());
155 throw Exception(
TE_TR(
"The layer style is not a Feature Type Style!"));
161 std::size_t nRules = fts->
getRules().size();
163 for(std::size_t i = 0; i < nRules; ++i)
175 std::auto_ptr<te::da::DataSet> dataset(0);
184 throw Exception(
TE_TR(
"No implemented yet!"));
187 if(dataset.get() == 0)
188 throw Exception((boost::format(
TE_TR(
"Could not retrieve the data set %1% referenced by the layer %2%.")) % schema->getName() % layer->
getTitle()).str());
190 if(dataset->moveNext() ==
false)
194 const std::vector<te::se::Symbolizer*>& symbolizers = rule->
getSymbolizers();
195 std::size_t nSymbolizers = symbolizers.size();
198 std::string message =
TE_TR(
"Drawing the layer");
199 message +=
" " + layer->
getTitle() +
". ";
200 message +=
TE_TR(
"Rule");
201 message +=
" " + boost::lexical_cast<std::string>(i + 1) +
" " +
TE_TR(
"of") +
" ";
202 message += boost::lexical_cast<std::string>(nRules) +
".";
208 for(std::size_t j = 0; j < nSymbolizers; ++j)
228 std::auto_ptr<te::gm::Geometry> geom = dataset->getGeometry(gpos);
235 geom->setSRID(layer->
getSRID());
236 geom->transform(srid);
239 canvas->
draw(geom.get());
241 }
while(dataset->moveNext());
244 dataset->moveFirst();
bool intersects(const Envelope &rhs) const
It returns true if the envelopes "spatially intersects".
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
This is the base class for layers.
virtual const te::gm::Envelope & getExtent() const
It returns the Layer extent (or minimum bounding box).
virtual const std::string & getTitle() const
It returns the layer title.
A Symbolizer describes how a feature is to appear on a map.
std::auto_ptr< LayerSchema > getSchema() const
It returns the layer schema.
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. ...
A visitor that converts a OGC Filter Expression to TerraLib Expression.
This class can be used to inform the progress of a task.
void drawRaster(QueryLayer *layer, Canvas *canvas, const te::gm::Envelope &bbox, const te::gm::Envelope &visibleArea, int srid)
A layer resulting from a query.
const te::fe::Filter * getFilter() const
#define TE_TR(message)
It marks a string in order to get translated.
It renders the objects associated to a query layer.
TESEEXPORT Style * CreateFeatureTypeStyle(const te::gm::GeomType &geomType)
Try creates an appropriate feature type style based on given geometry type.
Rule * getRule(std::size_t i) const
const std::vector< Rule * > & getRules() const
~QueryLayerRenderer()
Destructor.
An Envelope defines a 2D rectangular region.
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 drawGeometries(QueryLayer *layer, Canvas *canvas, const te::gm::Envelope &bbox, int srid)
virtual te::se::Style * getStyle() const
It returns the Style associated to the layer.
A filter is any valid predicate expression.
const std::vector< Symbolizer * > & getSymbolizers() const
A canvas is an abstraction of a drawing area.
A Rule is used to attach property/scale conditions to and group the individual symbols used for rende...
virtual void setStyle(te::se::Style *style)
It sets the Style associated to the layer.
A layer resulting from a query.
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.
virtual int getSRID() const
It returns the Spatial Reference System ID associated to the Layer.
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.
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
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.