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  }
62 
63  namespace map
64  {
65 // Forward declaration
66  class Chart;
67 
68  /*!
69  \class AbstractLayerRenderer
70 
71  \brief It renders the objects associated to an abstract layer. i.e. a generic renderer.
72 
73  \ingroup map
74 
75  \sa AbstractLayer, AbstractRenderer
76  */
78  {
79  public:
80 
81  /*! Constructor */
83 
84  /*! \brief Destructor. */
86 
87  void draw(AbstractLayer* layer, Canvas* canvas, const te::gm::Envelope& bbox, int srid, const double& scale);
88 
89  private:
90 
91  /*!
92  \brief It draws the abstract layer in the given canvas using the SRS informed.
93 
94  The informed bounding box (bbox) is used to constraint the layer objects to be drawn.
95  Here, we assume that the given bbox was pre-processed. i.e. the bbox was clipped and contains the same projection of abstract layer.
96 
97  \param layer The abstract layer that will be drawn.
98  \param geomPropertyName The geometry property name that will be drawn.
99  \param style The style that will be used.
100  \param canvas The canvas were the layer objects will be drawn.
101  \param bbox The interest area to render the map.
102  \param srid The SRS to be used to draw the layer objects.
103  \param scale The scale used to draw the layer.
104 
105  \note This method consider that the given layer contains vetorial data.
106  */
107  void drawLayerGeometries(AbstractLayer* layer,
108  const std::string& geomPropertyName,
110  Canvas* canvas,
111  const te::gm::Envelope& bbox,
112  int srid,
113  const double& scale);
114 
115  /*!
116  \brief It draws the grouping of the abstract layer in the given canvas using the SRS informed.
117 
118  The informed bounding box (bbox) is used to constraint the layer objects to be drawn.
119  Here, we assume that the given bbox was pre-processed. i.e. the bbox was clipped and contains the same projection of abstract layer.
120 
121  \param layer The abstract layer that will be drawn.
122  \param geomPropertyName The geometry property name that will be drawn.
123  \param canvas The canvas were the layer objects will be drawn.
124  \param bbox The interest area to render the map.
125  \param srid The SRS to be used to draw the layer objects.
126 
127  \note This method consider that the given layer contains vetorial data.
128  */
129  void drawLayerGrouping(AbstractLayer* layer,
130  const std::string& geomPropertyName,
131  Canvas* canvas,
132  const te::gm::Envelope& bbox,
133  int srid);
134 
135  /*!
136  \brief It draws the grouping of the abstract layer in the given canvas using the SRS informed.
137 
138  The informed bounding box (bbox) is used to constraint the layer objects to be drawn.
139  Here, we assume that the given bbox was pre-processed. i.e. the bbox was clipped and contains the same projection of abstract layer.
140 
141  \param layer The abstract layer that will be drawn.
142  \param geomPropertyName The geometry property name that will be drawn.
143  \param canvas The canvas were the layer objects will be drawn.
144  \param bbox The interest area to render the map.
145  \param srid The SRS to be used to draw the layer objects.
146  \param scale The scale used to draw the layer.
147 
148  \note This method consider that the given layer contains vetorial data.
149 
150  \note This method retrieves the layer data using only spatial extent restriction and performs the grouping in memory.
151  */
152  void drawLayerGroupingMem(AbstractLayer* layer,
153  const std::string& geomPropertyName,
154  Canvas* canvas,
155  const te::gm::Envelope& bbox,
156  int srid,
157  const double& scale);
158 
159  /*!
160  \brief It draws the data set geometries in the given canvas using the informed SRS.
161 
162  \param dataset The data set that will be drawn.
163  \param gpos The geometry property position that will be drawn.
164  \param canvas The canvas were the data set geometries will be drawn.
165  \param fromSRID The SRID of data set geometries.
166  \param srid The SRID to be used to draw the data set geometries.
167  \param chart Chart informations that can be used.
168  \param task An optional task that can be used cancel the draw process.
169  */
170  void drawDatSetGeometries(te::da::DataSet* dataset, const std::size_t& gpos,
171  Canvas* canvas, int fromSRID, int toSRID, Chart* chart, te::common::TaskProgress* task = 0);
172 
173  void buildChart(Chart* chart, te::da::DataSet* dataset, te::gm::Geometry* geom);
174 
175  void reset();
176 
177  private:
178 
179  WorldDeviceTransformer m_transformer; // World Device Transformer.
180  te::sam::rtree::Index<std::size_t, 8> m_rtree; // r-Tree that can be used to avoid conflicts (charts, texts, etc.).
181  std::size_t m_index; // Unsigned int used as r-Tree index.
182  std::vector<te::color::RGBAColor**> m_chartImages; // The generated chart images.
183  std::vector<te::gm::Coord2D> m_chartCoordinates; // The generated chart coordinates.
184  };
185 
186  } // end namespace map
187 } // end namespace te
188 
189 #endif // __TERRALIB_MAPTOOLS_INTERNAL_ABSTRACTLAYERRENDERER_H
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:73
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.