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  }
57 
58  namespace se
59  {
60  class FeatureTypeStyle;
61  class TextSymbolizer;
62  }
63 
64  namespace map
65  {
66 // Forward declaration
67  class Chart;
68 
69  /*!
70  \class AbstractLayerRenderer
71 
72  \brief It renders the objects associated to an abstract layer. i.e. a generic renderer.
73 
74  \ingroup map
75 
76  \sa AbstractLayer, AbstractRenderer
77  */
79  {
80  public:
81 
82  /*! Constructor */
84 
85  /*! \brief Destructor. */
87 
88  virtual void draw(AbstractLayer* layer, Canvas* canvas, const te::gm::Envelope& bbox, int srid, const double& scale, bool* cancel);
89 
90  protected:
91 
92  /*!
93  \brief It draws the abstract layer in the given canvas using the SRS informed.
94 
95  The informed bounding box (bbox) is used to constraint the layer objects to be drawn.
96  Here, we assume that the given bbox was pre-processed. i.e. the bbox was clipped and contains the same projection of abstract layer.
97 
98  \param layer The abstract layer that will be drawn.
99  \param geomPropertyName The geometry property name that will be drawn.
100  \param style The style that will be used.
101  \param canvas The canvas were the layer objects will be drawn.
102  \param bbox The interest area to render the map.
103  \param srid The SRS to be used to draw the layer objects.
104  \param scale The scale used to draw the layer.
105 
106  \note This method consider that the given layer contains vetorial data.
107  */
108  virtual void drawLayerGeometries(AbstractLayer* layer,
109  const std::string& geomPropertyName,
111  Canvas* canvas,
112  const te::gm::Envelope& bbox,
113  int srid,
114  const double& scale, bool* cancel);
115 
116  /*!
117  \brief It draws the grouping of the abstract layer in the given canvas using the SRS informed.
118 
119  The informed bounding box (bbox) is used to constraint the layer objects to be drawn.
120  Here, we assume that the given bbox was pre-processed. i.e. the bbox was clipped and contains the same projection of abstract layer.
121 
122  \param layer The abstract layer that will be drawn.
123  \param geomPropertyName The geometry property name that will be drawn.
124  \param canvas The canvas were the layer objects will be drawn.
125  \param bbox The interest area to render the map.
126  \param srid The SRS to be used to draw the layer objects.
127 
128  \note This method consider that the given layer contains vetorial data.
129  */
130  virtual void drawLayerGrouping(AbstractLayer* layer,
131  const std::string& geomPropertyName,
132  Canvas* canvas,
133  const te::gm::Envelope& bbox,
134  int srid, bool* cancel);
135 
136  /*!
137  \brief It draws the grouping of the abstract layer in the given canvas using the SRS informed.
138 
139  The informed bounding box (bbox) is used to constraint the layer objects to be drawn.
140  Here, we assume that the given bbox was pre-processed. i.e. the bbox was clipped and contains the same projection of abstract layer.
141 
142  \param layer The abstract layer that will be drawn.
143  \param geomPropertyName The geometry property name that will be drawn.
144  \param canvas The canvas were the layer objects will be drawn.
145  \param bbox The interest area to render the map.
146  \param srid The SRS to be used to draw the layer objects.
147  \param scale The scale used to draw the layer.
148 
149  \note This method consider that the given layer contains vetorial data.
150 
151  \note This method retrieves the layer data using only spatial extent restriction and performs the grouping in memory.
152  */
153  virtual void drawLayerGroupingMem(AbstractLayer* layer,
154  const std::string& geomPropertyName,
155  Canvas* canvas,
156  const te::gm::Envelope& bbox,
157  int srid,
158  const double& scale, bool* cancel);
159 
160  /*!
161  \brief It draws the data set geometries in the given canvas using the informed SRS.
162 
163  \param dataset The data set that will be drawn.
164  \param gpos The geometry property position that will be drawn.
165  \param canvas The canvas were the data set geometries will be drawn.
166  \param fromSRID The SRID of data set geometries.
167  \param srid The SRID to be used to draw the data set geometries.
168  \param chart Chart informations that can be used.
169  \param task An optional task that can be used cancel the draw process.
170  */
171  virtual void drawDatSetGeometries(te::da::DataSet* dataset, const std::size_t& gpos,
172  Canvas* canvas, int fromSRID, int toSRID, Chart* chart, bool* cancel, te::common::TaskProgress* task = 0);
173 
174  virtual void drawDatSetTexts(te::da::DataSet* dataset, const std::size_t& gpos, Canvas* canvas, int fromSRID, int toSRID, te::se::TextSymbolizer* symb,
175  bool* cancel, te::common::TaskProgress* task = 0);
176 
177 
178  virtual void buildChart(Chart* chart, te::da::DataSet* dataset, te::gm::Geometry* geom);
179 
180  virtual void reset();
181 
182  protected:
183 
184  WorldDeviceTransformer m_transformer; // World Device Transformer.
185  te::sam::rtree::Index<std::size_t, 8> m_rtree; // r-Tree that can be used to avoid conflicts (charts, texts, etc.).
186  std::size_t m_index; // Unsigned int used as r-Tree index.
187  std::vector<te::color::RGBAColor**> m_chartImages; // The generated chart images.
188  std::vector<te::gm::Coord2D> m_chartCoordinates; // The generated chart coordinates.
189  };
190 
191  } // end namespace map
192 } // end namespace te
193 
194 #endif // __TERRALIB_MAPTOOLS_INTERNAL_ABSTRACTLAYERRENDERER_H
A TextSymbolizer is used to render text labels according to various graphical parameters.
This class implements the logic for transforming from device coordinate to world coordinate and vice-...
This is the base class for layers.
Definition: AbstractLayer.h:76
te::sam::rtree::Index< std::size_t, 8 > m_rtree
A wdiget used to customize a chart's style parameters.
This class can be used to inform the progress of a task.
Definition: TaskProgress.h:53
This class implements the logic for transforming from device coordinate to world coordinate and vice-...
std::vector< te::color::RGBAColor ** > m_chartImages
This class represents the informations needed to build map charts.
Definition: Chart.h:51
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
The FeatureTypeStyle defines the styling that is to be applied to a dataset that can be viewed as a f...
URI C++ Library.
#define TEMAPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:60
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:74
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:112
A canvas is an abstraction of a drawing area.
Definition: Canvas.h:92
It renders the objects associated to an abstract layer. i.e. a generic renderer.
std::vector< te::gm::Coord2D > m_chartCoordinates
WorldDeviceTransformer m_transformer
This is the base class for renderers.
It renders the objects associated to a layer.