QueryLayerRenderer.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/QueryLayerRenderer.h
22 
23  \brief It renders the objects associated to a query layer.
24 */
25 
26 #ifndef __TERRALIB_MAPTOOLS_INTERNAL_QUERYLAYERRENDERER_H
27 #define __TERRALIB_MAPTOOLS_INTERNAL_QUERYLAYERRENDERER_H
28 
29 // TerraLib
30 #include "../color/RGBAColor.h"
31 #include "../geometry/Coord2D.h"
32 #include "../dataaccess/dataset/PrimaryKey.h"
33 #include "../sam/rtree/Index.h"
34 #include "AbstractRenderer.h"
35 #include "WorldDeviceTransformer.h"
36 
37 // STL
38 #include <string>
39 #include <vector>
40 
41 namespace te
42 {
43 // Forward declarations
44  namespace common
45  {
46  class TaskProgress;
47  }
48 
49  namespace da
50  {
51  class DataSet;
52  }
53 
54  namespace gm
55  {
56  class Geometry;
57  }
58 
59  namespace se
60  {
61  class FeatureTypeStyle;
62  }
63 
64  namespace map
65  {
66 // Forward declaration
67  class Chart;
68 
69  /*!
70  \class QueryLayerRenderer
71 
72  \brief It renders the objects associated to a query layer.
73 
74  \sa AbstractLayer, AbstractRenderer, DataSetLayerRenderer, Canvas, te::se::Style, QueryLayer
75  */
77  {
78  public:
79 
80  /*! Constructor */
82 
83  /*! \brief Destructor. */
85 
86  void draw(AbstractLayer* layer, Canvas* canvas, const te::gm::Envelope& bbox, int srid, const double& scale);
87 
88  private:
89 
90  /*!
91  \brief It draws the abstract layer in the given canvas using the SRS informed.
92 
93  The informed bounding box (bbox) is used to constraint the layer objects to be drawn.
94  Here, we assume that the given bbox was pre-processed. i.e. the bbox was clipped and contains the same projection of abstract layer.
95 
96  \param layer The abstract layer that will be drawn.
97  \param geomPropertyName The geometry property name that will be drawn.
98  \param style The style that will be used.
99  \param canvas The canvas were the layer objects will be drawn.
100  \param bbox The interest area to render the map.
101  \param srid The SRS to be used to draw the layer objects.
102 
103  \note This method consider that the given layer contains vetorial data.
104  */
105  void drawLayerGeometries(AbstractLayer* layer,
106  const std::string& geomPropertyName,
108  Canvas* canvas,
109  const te::gm::Envelope& bbox,
110  int srid);
111 
112  /*!
113  \brief It draws the grouping of the abstract layer in the given canvas using the SRS informed.
114 
115  The informed bounding box (bbox) is used to constraint the layer objects to be drawn.
116  Here, we assume that the given bbox was pre-processed. i.e. the bbox was clipped and contains the same projection of abstract layer.
117 
118  \param layer The abstract layer that will be drawn.
119  \param geomPropertyName The geometry property name that will be drawn.
120  \param canvas The canvas were the layer objects will be drawn.
121  \param bbox The interest area to render the map.
122  \param srid The SRS to be used to draw the layer objects.
123 
124  \note This method consider that the given layer contains vetorial data.
125  */
126  void drawLayerGrouping(AbstractLayer* layer,
127  const std::string& geomPropertyName,
128  Canvas* canvas,
129  const te::gm::Envelope& bbox,
130  int srid);
131 
132  /*!
133  \brief It draws the grouping of the abstract layer in the given canvas using the SRS informed.
134 
135  The informed bounding box (bbox) is used to constraint the layer objects to be drawn.
136  Here, we assume that the given bbox was pre-processed. i.e. the bbox was clipped and contains the same projection of abstract layer.
137 
138  \param layer The abstract layer that will be drawn.
139  \param geomPropertyName The geometry property name that will be drawn.
140  \param canvas The canvas were the layer objects will be drawn.
141  \param bbox The interest area to render the map.
142  \param srid The SRS to be used to draw the layer objects.
143 
144  \note This method consider that the given layer contains vetorial data.
145 
146  \note This method retrieves the layer data using only spatial extent restriction and performs the grouping in memory.
147  */
148  void drawLayerGroupingMem(AbstractLayer* layer,
149  const std::string& geomPropertyName,
150  Canvas* canvas,
151  const te::gm::Envelope& bbox,
152  int srid);
153 
154  void drawLayerLinkedGroupingMem(AbstractLayer* layer,
155  const std::string& geomPropertyName,
156  Canvas* canvas,
157  const te::gm::Envelope& bbox,
158  int srid);
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  void drawDatSetGeometries(te::da::DataSet* dataset, const std::size_t& gpos,
172  Canvas* canvas, int fromSRID, int toSRID, Chart* chart, te::common::TaskProgress* task = 0);
173 
174  void buildChart(const Chart* chart, te::da::DataSet* dataset, te::gm::Geometry* geom);
175 
176  void buildChart(const Chart* chart, const std::map<std::string, double>& chartValue, te::gm::Geometry* geom);
177 
178  void reset();
179 
180  private:
181 
182  WorldDeviceTransformer m_transformer; // World Device Transformer.
183  te::sam::rtree::Index<std::size_t, 8> m_rtree; // r-Tree that can be used to avoid conflicts (charts, texts, etc.).
184  std::size_t m_index; // Unsigned int used as r-Tree index.
185  std::vector<te::color::RGBAColor**> m_chartImages; // The generated chart images.
186  std::vector<te::gm::Coord2D> m_chartCoordinates; // The generated chart coordinates.
187  std::vector<std::string> m_oid; // It has the name of the fields that form the primary key of the base table. It is empty when there is no link table.
188  };
189 
190  } // end namespace map
191 } // end namespace te
192 
193 #endif // __TERRALIB_MAPTOOLS_INTERNAL_QUERYLAYERRENDERER_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
std::vector< std::string > m_oid
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
std::vector< te::color::RGBAColor ** > m_chartImages
It renders the objects associated to a query layer.
This class implements the logic for transforming from device coordinate to world coordinate and vice-...
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.
te::sam::rtree::Index< std::size_t, 8 > m_rtree
#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
WorldDeviceTransformer m_transformer
std::vector< te::gm::Coord2D > m_chartCoordinates
This is the base class for renderers.
It renders the objects associated to a layer.