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 "AbstractLayerRenderer.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, bool* cancel);
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  */
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  */
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  */
149  const std::string& geomPropertyName,
150  Canvas* canvas,
151  const te::gm::Envelope& bbox,
152  int srid);
153 
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 symbolizer The geometry style that will be drawn.
164  \param dataset The data set that will be drawn.
165  \param gpos The geometry property position that will be drawn.
166  \param canvas The canvas were the data set geometries will be drawn.
167  \param fromSRID The SRID of data set geometries.
168  \param srid The SRID to be used to draw the data set geometries.
169  \param chart Chart informations that can be used.
170  \param task An optional task that can be used cancel the draw process.
171  */
172  void drawDatSetGeometries(te::se::Symbolizer* symbolizer, te::da::DataSet* dataset, const std::size_t& gpos,
173  Canvas* canvas, int fromSRID, int toSRID, Chart* chart, te::common::TaskProgress* task = 0);
174 
175  void buildChart(const Chart* chart, te::da::DataSet* dataset, te::gm::Geometry* geom);
176 
177  void buildChart(const Chart* chart, const std::map<std::string, double>& chartValue, te::gm::Geometry* geom);
178 
179  void reset();
180 
181  private:
182 
183  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.
184  };
185 
186  } // end namespace map
187 } // end namespace te
188 
189 #endif // __TERRALIB_MAPTOOLS_INTERNAL_QUERYLAYERRENDERER_H
It renders the objects associated to an abstract layer. i.e. a generic renderer.
This class implements the logic for transforming from device coordinate to world coordinate and vice-...
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:54
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:114
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:52
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
It renders the objects associated to an abstract layer. i.e. a generic renderer.
This is the base class for layers.
Definition: AbstractLayer.h:78
A canvas is an abstraction of a drawing area.
Definition: Canvas.h:93
This class represents the informations needed to build map charts.
Definition: Chart.h:52
It renders the objects associated to a query layer.
void buildChart(const Chart *chart, te::da::DataSet *dataset, te::gm::Geometry *geom)
void drawLayerLinkedGroupingMem(AbstractLayer *layer, const std::string &geomPropertyName, Canvas *canvas, const te::gm::Envelope &bbox, int srid)
void drawLayerGeometries(AbstractLayer *layer, const std::string &geomPropertyName, te::se::FeatureTypeStyle *style, Canvas *canvas, const te::gm::Envelope &bbox, int srid)
It draws the abstract layer in the given canvas using the SRS informed.
void buildChart(const Chart *chart, const std::map< std::string, double > &chartValue, te::gm::Geometry *geom)
void drawLayerGroupingMem(AbstractLayer *layer, const std::string &geomPropertyName, Canvas *canvas, const te::gm::Envelope &bbox, int srid)
It draws the grouping of the abstract layer in the given canvas using the SRS informed.
std::vector< std::string > m_oid
void drawDatSetGeometries(te::se::Symbolizer *symbolizer, te::da::DataSet *dataset, const std::size_t &gpos, Canvas *canvas, int fromSRID, int toSRID, Chart *chart, te::common::TaskProgress *task=0)
It draws the data set geometries in the given canvas using the informed SRS.
~QueryLayerRenderer()
Destructor.
void drawLayerGrouping(AbstractLayer *layer, const std::string &geomPropertyName, Canvas *canvas, const te::gm::Envelope &bbox, int srid)
It draws the grouping of the abstract layer in the given canvas using the SRS informed.
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.
The FeatureTypeStyle defines the styling that is to be applied to a dataset that can be viewed as a f...
A Symbolizer describes how a feature is to appear on a map.
Definition: Symbolizer.h:81
TerraLib.
#define TEMAPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:60