Renderer.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/edit/qt/Renderer.h
22 
23 \brief This is a singleton for rendering geometries and features.
24 */
25 
26 #ifndef __TERRALIB_EDIT_QT_INTERNAL_RENDERER_H
27 #define __TERRALIB_EDIT_QT_INTERNAL_RENDERER_H
28 
29 // TerraLib
30 #include "../../common/Singleton.h"
31 #include "../../geometry/Enums.h"
32 #include "Config.h"
33 
34 // Qt
35 #include <QColor>
36 #include <QPaintDevice>
37 #include <QString>
38 
39 // STL
40 #include <string>
41 #include <vector>
42 
43 namespace te
44 {
45  namespace gm
46  {
47  class Envelope;
48  class Geometry;
49  class LineString;
50  }
51 
52  namespace qt
53  {
54  namespace widgets
55  {
56  class Canvas;
57  }
58  }
59 
60  namespace edit
61  {
62  /*!
63  \class Renderer
64 
65  \brief This is a singleton for rendering geometries and features.
66  */
68  {
70 
71  public:
72 
73  void begin(QPaintDevice* device, const te::gm::Envelope& e, int srid);
74 
75  void drawRepositories(const te::gm::Envelope& e, int srid);
76 
77  void drawRepository(const std::string& source, const te::gm::Envelope& e, int srid);
78 
79  void prepare(te::gm::GeomType type, const bool& removed = false);
80 
81  void draw(te::gm::Geometry* geom, bool showVertexes = false, const bool& removed = false);
82 
83  void drawVertexes(te::gm::Geometry* geom);
84 
85  void drawVertexes(const std::vector<te::gm::LineString*>& lines);
86 
87  void drawVertexes(te::gm::LineString* line);
88 
89  void end();
90 
91  void setPolygonStyle(const QColor& fillColor, const QColor& contourColor, const std::size_t& contourWidth);
92 
93  void setPointStyle(const QString& mark, const QColor& fillColor, const QColor& contourColor,
94  const std::size_t& contourWidth, const std::size_t& size);
95 
96  protected:
97 
98  /*! \brief It initializes the singleton instance of the renderer. */
99  Renderer();
100 
101  /*! \brief Singleton destructor. */
102  ~Renderer();
103 
104  private:
105 
106  void setupDefaultStyle();
107 
108  private:
109 
111  int m_srid;
112 
116 
117  QColor m_lineColor;
118  std::size_t m_lineWidth;
119 
120  QString m_pointMark;
123  std::size_t m_pointContourWidth;
124  std::size_t m_pointSize;
125 
128  };
129 
130  } // end namespace edit
131 } // end namespace te
132 
133 #endif // __TERRALIB_EDIT_QT_INTERNAL_RENDERER_H
te::gm::GeomType m_currentGeomType
Definition: Renderer.h:126
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Definition: Enums.h:41
#define TEEDITQTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:60
Configuration flags for the TerraLib Qt Edit module.
std::size_t m_lineWidth
Definition: Renderer.h:118
QString m_pointMark
Definition: Renderer.h:120
QColor m_lineColor
Definition: Renderer.h:117
std::size_t m_pointSize
Definition: Renderer.h:124
te::qt::widgets::Canvas * m_canvas
Definition: Renderer.h:110
std::size_t m_polygonContourWidth
Definition: Renderer.h:115
LineString is a curve with linear interpolation between points.
Definition: LineString.h:62
std::size_t m_pointContourWidth
Definition: Renderer.h:123
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
URI C++ Library.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:73
This is a singleton for rendering geometries and features.
Definition: Renderer.h:67
A canvas built on top of Qt.
Definition: Canvas.h:54
QColor m_pointFillColor
Definition: Renderer.h:121
QColor m_polygonContourColor
Definition: Renderer.h:114
QColor m_pointContourColor
Definition: Renderer.h:122
QColor m_polygonFillColor
Definition: Renderer.h:113
Template support for singleton pattern.
Definition: Singleton.h:100