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