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 "../Utils.h"
33 #include "Config.h"
34 
35 // Qt
36 #include <QColor>
37 #include <QPaintDevice>
38 #include <QString>
39 
40 // STL
41 #include <string>
42 #include <vector>
43 
44 namespace te
45 {
46  namespace gm
47  {
48  class Envelope;
49  class Geometry;
50  class LineString;
51  }
52 
53  namespace qt
54  {
55  namespace widgets
56  {
57  class Canvas;
58  }
59  }
60 
61  namespace edit
62  {
63  /*!
64  \class Renderer
65 
66  \brief This is a singleton for rendering geometries and features.
67  */
69  {
71 
72  public:
73 
74  void begin(QPaintDevice* device, const te::gm::Envelope& e, int srid);
75 
76  void drawRepositories(const te::gm::Envelope& e, int srid);
77 
78  void drawRepository(const std::string& source, const te::gm::Envelope& e, int srid);
79 
80  void prepare(te::gm::GeomType type);
81 
82  void prepare(te::edit::Feature* feature);
83 
84  void draw(te::gm::Geometry* geom, bool showVertexes = false);
85 
86  void draw(te::edit::Feature* feature, bool showVertexes = false);
87 
88  void drawVertexes(te::gm::Geometry* geom);
89 
90  void drawVertexes(const std::vector<te::gm::LineString*>& lines);
91 
92  void drawVertexes(te::gm::LineString* line);
93 
94  void end();
95 
96  void setPolygonStyle(const QColor& fillColor, const QColor& contourColor, const std::size_t& contourWidth);
97 
98  void setPointStyle(const QString& mark, const QColor& fillColor, const QColor& contourColor,
99  const std::size_t& contourWidth, const std::size_t& size);
100 
101  void setLineStyle(const QColor& lineColor, const std::size_t& lineWidth);
102 
103  protected:
104 
105  /*! \brief It initializes the singleton instance of the renderer. */
106  Renderer();
107 
108  /*! \brief Singleton destructor. */
109  ~Renderer();
110 
111  private:
112 
113  void setupDefaultStyle();
114 
115  private:
116 
118  int m_srid;
119 
123 
124  QColor m_lineColor;
125  std::size_t m_lineWidth;
126 
127  QString m_pointMark;
130  std::size_t m_pointContourWidth;
131  std::size_t m_pointSize;
132 
135 
136  };
137 
138  } // end namespace edit
139 } // end namespace te
140 
141 #endif // __TERRALIB_EDIT_QT_INTERNAL_RENDERER_H
te::gm::GeomType m_currentGeomType
Definition: Renderer.h:133
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:125
QString m_pointMark
Definition: Renderer.h:127
QColor m_lineColor
Definition: Renderer.h:124
std::size_t m_pointSize
Definition: Renderer.h:131
te::qt::widgets::Canvas * m_canvas
Definition: Renderer.h:117
std::size_t m_polygonContourWidth
Definition: Renderer.h:122
LineString is a curve with linear interpolation between points.
Definition: LineString.h:62
std::size_t m_pointContourWidth
Definition: Renderer.h:130
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:74
This is a singleton for rendering geometries and features.
Definition: Renderer.h:68
A canvas built on top of Qt.
Definition: Canvas.h:54
QColor m_pointFillColor
Definition: Renderer.h:128
QColor m_polygonContourColor
Definition: Renderer.h:121
QColor m_pointContourColor
Definition: Renderer.h:129
QColor m_polygonFillColor
Definition: Renderer.h:120
Template support for singleton pattern.
Definition: Singleton.h:100