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(
TR_MAP(
"Wrong type render type for this layer!"));
94 else if(qlayer->
getSRID() != srid)
96 throw Exception(
TR_MAP(
"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(
TR_MAP(
"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(
TR_MAP(
"Could not create a default feature type style to the layer %1%.")) % layer->
getTitle()).str());
155 throw Exception(
TR_MAP(
"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(
TR_MAP(
"No implemented yet!"));
187 if(dataset.get() == 0)
188 throw Exception((boost::format(
TR_MAP(
"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 =
TR_MAP(
"Drawing the layer");
199 message +=
" " + layer->
getTitle() +
". ";
200 message +=
TR_MAP(
"Rule");
201 message +=
" " + boost::lexical_cast<std::string>(i + 1) +
" " +
TR_MAP(
"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();
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. ...
const std::vector< Rule * > & getRules() const
The FeatureTypeStyle defines the styling that is to be applied to a dataset that can be viewed as a f...
Rule * getRule(std::size_t i) const
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.
std::auto_ptr< LayerSchema > getSchema() const
It returns the layer schema.
A canvas is an abstraction of a drawing area.
A Symbolizer describes how a feature is to appear on a map.
void config(const te::se::Symbolizer *symbolizer)
It configs the canvas based on given symbolizer.
const std::vector< Symbolizer * > & getSymbolizers() const
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
It renders the objects associated to a query layer.
A layer resulting from a query.
A filter is any valid predicate expression.
A Rule is used to attach property/scale conditions to and group the individual symbols used for rende...
TESEEXPORT Style * CreateFeatureTypeStyle(const te::gm::GeomType &geomType)
Try creates an appropriate feature type style based on given geometry type.
A Symbology Enconding visitor that configures a given canvas based on symbolizers elements...
An exception class for the MapTools module.
A visitor that converts a OGC Filter Expression to TerraLib Expression.
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
A Symbology Enconding visitor that configures a given canvas based on symbolizers elements...
A layer resulting from a query.
virtual te::se::Style * getStyle() const
It returns the Style associated to the layer.
void drawRaster(QueryLayer *layer, Canvas *canvas, const te::gm::Envelope &bbox, const te::gm::Envelope &visibleArea, int srid)
virtual const te::gm::Envelope & getExtent() const
It returns the Layer extent (or minimum bounding box).
~QueryLayerRenderer()
Destructor.
void drawGeometries(QueryLayer *layer, Canvas *canvas, const te::gm::Envelope &bbox, int srid)
Envelope intersection(const Envelope &rhs) const
It returns an envelope that represents the point set intersection with another envelope.
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...
const te::fe::Filter * getFilter() const
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
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.
This class can be used to inform the progress of a task.
An Envelope defines a 2D rectangular region.
virtual int getSRID() const
It returns the Spatial Reference System ID associated to the Layer.
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 void setStyle(te::se::Style *style)
It sets the Style associated to the layer.