All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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);
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 
104  \note This method consider that the given layer contains vetorial data.
105  */
106  void drawLayerGeometries(AbstractLayer* layer,
107  const std::string& geomPropertyName,
109  Canvas* canvas,
110  const te::gm::Envelope& bbox,
111  int srid);
112 
113  /*!
114  \brief It draws the grouping of the abstract layer in the given canvas using the SRS informed.
115 
116  The informed bounding box (bbox) is used to constraint the layer objects to be drawn.
117  Here, we assume that the given bbox was pre-processed. i.e. the bbox was clipped and contains the same projection of abstract layer.
118 
119  \param layer The abstract layer that will be drawn.
120  \param geomPropertyName The geometry property name that will be drawn.
121  \param canvas The canvas were the layer objects will be drawn.
122  \param bbox The interest area to render the map.
123  \param srid The SRS to be used to draw the layer objects.
124 
125  \note This method consider that the given layer contains vetorial data.
126  */
127  void drawLayerGrouping(AbstractLayer* layer,
128  const std::string& geomPropertyName,
129  Canvas* canvas,
130  const te::gm::Envelope& bbox,
131  int srid);
132 
133  /*!
134  \brief It draws the grouping of the abstract layer in the given canvas using the SRS informed.
135 
136  The informed bounding box (bbox) is used to constraint the layer objects to be drawn.
137  Here, we assume that the given bbox was pre-processed. i.e. the bbox was clipped and contains the same projection of abstract layer.
138 
139  \param layer The abstract layer that will be drawn.
140  \param geomPropertyName The geometry property name that will be drawn.
141  \param canvas The canvas were the layer objects will be drawn.
142  \param bbox The interest area to render the map.
143  \param srid The SRS to be used to draw the layer objects.
144 
145  \note This method consider that the given layer contains vetorial data.
146 
147  \note This method retrieves the layer data using only spatial extent restriction and performs the grouping in memory.
148  */
149  void drawLayerGroupingMem(AbstractLayer* layer,
150  const std::string& geomPropertyName,
151  Canvas* canvas,
152  const te::gm::Envelope& bbox,
153  int srid);
154 
155  /*!
156  \brief It draws the data set geometries in the given canvas using the informed SRS.
157 
158  \param dataset The data set that will be drawn.
159  \param gpos The geometry property position that will be drawn.
160  \param canvas The canvas were the data set geometries will be drawn.
161  \param fromSRID The SRID of data set geometries.
162  \param srid The SRID to be used to draw the data set geometries.
163  \param chart Chart informations that can be used.
164  \param task An optional task that can be used cancel the draw process.
165  */
166  void drawDatSetGeometries(te::da::DataSet* dataset, const std::size_t& gpos,
167  Canvas* canvas, int fromSRID, int toSRID, Chart* chart, te::common::TaskProgress* task = 0);
168 
169  void buildChart(Chart* chart, te::da::DataSet* dataset, te::gm::Geometry* geom);
170 
171  void reset();
172 
173  private:
174 
175  WorldDeviceTransformer m_transformer; // World Device Transformer.
176  te::sam::rtree::Index<std::size_t, 8> m_rtree; // r-Tree that can be used to avoid conflicts (charts, texts, etc.).
177  std::size_t m_index; // Unsigned int used as r-Tree index.
178  std::vector<te::color::RGBAColor**> m_chartImages; // The generated chart images.
179  std::vector<te::gm::Coord2D> m_chartCoordinates; // The generated chart coordinates.
180  };
181 
182  } // end namespace map
183 } // end namespace te
184 
185 #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...
#define TEMAPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
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:91
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.