AbstractLayerRenderer.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/maptools/AbstractLayerRenderer.h
22 
23  \brief It renders the objects associated to an abstract layer. i.e. a generic renderer.
24 */
25 
26 #ifndef __TERRALIB_MAPTOOLS_INTERNAL_ABSTRACTLAYERRENDERER_H
27 #define __TERRALIB_MAPTOOLS_INTERNAL_ABSTRACTLAYERRENDERER_H
28 
29 // TerraLib
30 #include "../color/RGBAColor.h"
31 #include "../geometry/Coord2D.h"
32 #include "../sam/rtree/Index.h"
33 #include "AbstractRenderer.h"
34 #include "WorldDeviceTransformer.h"
35 
36 // STL
37 #include <string>
38 #include <vector>
39 
40 namespace te
41 {
42 // Forward declarations
43  namespace common
44  {
45  class TaskProgress;
46  }
47 
48  namespace da
49  {
50  class DataSet;
51  }
52 
53  namespace gm
54  {
55  class Geometry;
56  class LineString;
57  class Polygon;
58  }
59 
60  namespace se
61  {
62  class FeatureTypeStyle;
63  class Symbolizer;
64  class TextSymbolizer;
65  class LineSymbolizer;
66  class Graphic;
67  class GraphicStroke;
68  }
69 
70  namespace map
71  {
72 // Forward declaration
73  class Chart;
74 
75  /*!
76  \class AbstractLayerRenderer
77 
78  \brief It renders the objects associated to an abstract layer. i.e. a generic renderer.
79 
80  \ingroup map
81 
82  \sa AbstractLayer, AbstractRenderer
83  */
85  {
86  public:
87 
88  /*! Constructor */
90 
91  /*! \brief Destructor. */
93 
94  virtual void draw(AbstractLayer* layer, Canvas* canvas, const te::gm::Envelope& bbox, int srid, const double& scale, bool* cancel);
95 
96  protected:
97 
98  /*!
99  \brief It draws the abstract layer in the given canvas using the SRS informed.
100 
101  The informed bounding box (bbox) is used to constraint the layer objects to be drawn.
102  Here, we assume that the given bbox was pre-processed. i.e. the bbox was clipped and contains the same projection of abstract layer.
103 
104  \param layer The abstract layer that will be drawn.
105  \param geomPropertyName The geometry property name that will be drawn.
106  \param style The style that will be used.
107  \param canvas The canvas were the layer objects will be drawn.
108  \param bbox The interest area to render the map.
109  \param srid The SRS to be used to draw the layer objects.
110  \param scale The scale used to draw the layer.
111 
112  \note This method consider that the given layer contains vetorial data.
113  */
114  virtual void drawLayerGeometries(AbstractLayer* layer,
115  const std::string& geomPropertyName,
117  Canvas* canvas,
118  const te::gm::Envelope& bbox,
119  int srid,
120  const double& scale, bool* cancel);
121 
122  /*!
123  \brief It draws the grouping of the abstract layer in the given canvas using the SRS informed.
124 
125  The informed bounding box (bbox) is used to constraint the layer objects to be drawn.
126  Here, we assume that the given bbox was pre-processed. i.e. the bbox was clipped and contains the same projection of abstract layer.
127 
128  \param layer The abstract layer that will be drawn.
129  \param geomPropertyName The geometry property name that will be drawn.
130  \param canvas The canvas were the layer objects will be drawn.
131  \param bbox The interest area to render the map.
132  \param srid The SRS to be used to draw the layer objects.
133 
134  \note This method consider that the given layer contains vetorial data.
135  */
136  virtual void drawLayerGrouping(AbstractLayer* layer,
137  const std::string& geomPropertyName,
138  Canvas* canvas,
139  const te::gm::Envelope& bbox,
140  int srid, bool* cancel);
141 
142  /*!
143  \brief It draws the grouping of the abstract layer in the given canvas using the SRS informed.
144 
145  The informed bounding box (bbox) is used to constraint the layer objects to be drawn.
146  Here, we assume that the given bbox was pre-processed. i.e. the bbox was clipped and contains the same projection of abstract layer.
147 
148  \param layer The abstract layer that will be drawn.
149  \param geomPropertyName The geometry property name that will be drawn.
150  \param canvas The canvas were the layer objects will be drawn.
151  \param bbox The interest area to render the map.
152  \param srid The SRS to be used to draw the layer objects.
153  \param scale The scale used to draw the layer.
154 
155  \note This method consider that the given layer contains vetorial data.
156 
157  \note This method retrieves the layer data using only spatial extent restriction and performs the grouping in memory.
158  */
159  virtual void drawLayerGroupingMem(AbstractLayer* layer,
160  const std::string& geomPropertyName,
161  Canvas* canvas,
162  const te::gm::Envelope& bbox,
163  int srid,
164  const double& scale, bool* cancel);
165 
166  /*!
167  \brief It draws the data set geometries in the given canvas using the informed SRS.
168 
169  \param dataset The data set that will be drawn.
170  \param gpos The geometry property position that will be drawn.
171  \param canvas The canvas were the data set geometries will be drawn.
172  \param fromSRID The SRID of data set geometries.
173  \param srid The SRID to be used to draw the data set geometries.
174  \param chart Chart informations that can be used.
175  \param task An optional task that can be used cancel the draw process.
176  */
177  virtual void drawDatSetGeometries(te::se::Symbolizer* symbolizer, te::da::DataSet* dataset, const std::size_t& gpos,
178  Canvas* canvas, int fromSRID, int toSRID, Chart* chart, bool* cancel, te::common::TaskProgress* task = 0);
179 
180  virtual void drawDatSetTexts(te::da::DataSet* dataset, const std::size_t& gpos, Canvas* canvas, int fromSRID, int toSRID, te::se::TextSymbolizer* symb,
181  bool* cancel, te::common::TaskProgress* task = 0);
182 
183  virtual void buildChart(Chart* chart, te::da::DataSet* dataset, te::gm::Geometry* geom);
184 
185  virtual void reset();
186 
187  protected:
188 
189  WorldDeviceTransformer m_transformer; // World Device Transformer.
190  te::sam::rtree::Index<std::size_t, 8> m_rtree; // r-Tree that can be used to avoid conflicts (charts, texts, etc.).
191  std::size_t m_index; // Unsigned int used as r-Tree index.
192  std::vector<te::color::RGBAColor**> m_chartImages; // The generated chart images.
193  std::vector<te::gm::Coord2D> m_chartCoordinates; // The generated chart coordinates.
194  };
195 
196  } // end namespace map
197 } // end namespace te
198 
199 #endif // __TERRALIB_MAPTOOLS_INTERNAL_ABSTRACTLAYERRENDERER_H
te::gm::Envelope
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:52
te::map::AbstractLayerRenderer::~AbstractLayerRenderer
~AbstractLayerRenderer()
Destructor.
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::sam::rtree::Index< std::size_t, 8 >
te::map::AbstractLayerRenderer::drawDatSetGeometries
virtual void drawDatSetGeometries(te::se::Symbolizer *symbolizer, te::da::DataSet *dataset, const std::size_t &gpos, Canvas *canvas, int fromSRID, int toSRID, Chart *chart, bool *cancel, te::common::TaskProgress *task=0)
It draws the data set geometries in the given canvas using the informed SRS.
te::map::AbstractLayerRenderer::m_transformer
WorldDeviceTransformer m_transformer
Definition: AbstractLayerRenderer.h:189
te::map::AbstractLayerRenderer::reset
virtual void reset()
te::se::FeatureTypeStyle
The FeatureTypeStyle defines the styling that is to be applied to a dataset that can be viewed as a f...
Definition: FeatureTypeStyle.h:46
te::map::AbstractLayerRenderer::draw
virtual void draw(AbstractLayer *layer, 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 SRS informed.
te::map::AbstractLayerRenderer::drawLayerGeometries
virtual void drawLayerGeometries(AbstractLayer *layer, const std::string &geomPropertyName, te::se::FeatureTypeStyle *style, Canvas *canvas, const te::gm::Envelope &bbox, int srid, const double &scale, bool *cancel)
It draws the abstract layer in the given canvas using the SRS informed.
te::map::AbstractLayerRenderer::drawDatSetTexts
virtual void drawDatSetTexts(te::da::DataSet *dataset, const std::size_t &gpos, Canvas *canvas, int fromSRID, int toSRID, te::se::TextSymbolizer *symb, bool *cancel, te::common::TaskProgress *task=0)
AbstractRenderer.h
This is the base class for renderers.
te::map::AbstractRenderer
It renders the objects associated to a layer.
Definition: AbstractRenderer.h:62
te::map::Chart
This class represents the informations needed to build map charts.
Definition: Chart.h:52
te::map::AbstractLayerRenderer::m_chartCoordinates
std::vector< te::gm::Coord2D > m_chartCoordinates
Definition: AbstractLayerRenderer.h:193
te::se::TextSymbolizer
A TextSymbolizer is used to render text labels according to various graphical parameters.
Definition: TextSymbolizer.h:63
te::map::AbstractLayer
This is the base class for layers.
Definition: AbstractLayer.h:78
te::map::Canvas
A canvas is an abstraction of a drawing area.
Definition: Canvas.h:93
te::map::AbstractLayerRenderer::m_index
std::size_t m_index
Definition: AbstractLayerRenderer.h:191
Chart
A wdiget used to customize a chart's style parameters.
Definition: ChartStyleWidget.h:49
TEMAPEXPORT
#define TEMAPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:60
WorldDeviceTransformer.h
This class implements the logic for transforming from device coordinate to world coordinate and vice-...
te::map::AbstractLayerRenderer::AbstractLayerRenderer
AbstractLayerRenderer()
te::common::TaskProgress
This class can be used to inform the progress of a task.
Definition: TaskProgress.h:54
te::da::DataSet
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:114
te::map::AbstractLayerRenderer::buildChart
virtual void buildChart(Chart *chart, te::da::DataSet *dataset, te::gm::Geometry *geom)
te::map::WorldDeviceTransformer
This class implements the logic for transforming from device coordinate to world coordinate and vice-...
Definition: WorldDeviceTransformer.h:45
te::map::AbstractLayerRenderer
It renders the objects associated to an abstract layer. i.e. a generic renderer.
Definition: AbstractLayerRenderer.h:85
te::gm::Geometry
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
te::se::Symbolizer
A Symbolizer describes how a feature is to appear on a map.
Definition: Symbolizer.h:81
te::map::AbstractLayerRenderer::m_rtree
te::sam::rtree::Index< std::size_t, 8 > m_rtree
Definition: AbstractLayerRenderer.h:190
te::map::AbstractLayerRenderer::drawLayerGrouping
virtual void drawLayerGrouping(AbstractLayer *layer, const std::string &geomPropertyName, Canvas *canvas, const te::gm::Envelope &bbox, int srid, bool *cancel)
It draws the grouping of the abstract layer in the given canvas using the SRS informed.
te::map::AbstractLayerRenderer::drawLayerGroupingMem
virtual void drawLayerGroupingMem(AbstractLayer *layer, const std::string &geomPropertyName, Canvas *canvas, const te::gm::Envelope &bbox, int srid, const double &scale, bool *cancel)
It draws the grouping of the abstract layer in the given canvas using the SRS informed.
te::map::AbstractLayerRenderer::m_chartImages
std::vector< te::color::RGBAColor ** > m_chartImages
Definition: AbstractLayerRenderer.h:192