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  {
72  friend class te::common::Singleton<Renderer>;
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 
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 
91 
92  void drawVertexes(const std::vector<te::gm::LineString*>& lines);
93 
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. */
113 
114  /*! \brief Singleton destructor. */
116 
117  private:
118 
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::edit::Renderer::drawRepositories
void drawRepositories(const te::gm::Envelope &e, int srid)
te::gm::Envelope
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:52
te::edit::Renderer::begin
void begin(QPaintDevice *device, const te::gm::Envelope &e, int srid)
te::edit::Renderer::prepare
void prepare(te::gm::GeomType type)
te::edit::Renderer::Renderer
Renderer()
It initializes the singleton instance of the renderer.
te::edit::Renderer::drawText
void drawText(const std::string &text, te::gm::Point *p)
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::edit::Renderer::setTextStyle
void setTextStyle(const QColor &textColor, const std::size_t &textPointSize)
te::edit::Renderer::drawVertexes
void drawVertexes(te::gm::LineString *line)
TEEDITQTEXPORT
#define TEEDITQTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:60
te::edit::Renderer::m_polygonFillColor
QColor m_polygonFillColor
Definition: Renderer.h:126
te::qt::widgets::Canvas
A canvas built on top of Qt.
Definition: Canvas.h:55
te::edit::Renderer::end
void end()
te::edit::Renderer::m_textPointSize
std::size_t m_textPointSize
Definition: Renderer.h:140
te::edit::Renderer::m_polygonContourColor
QColor m_polygonContourColor
Definition: Renderer.h:127
te::edit::Renderer::m_currentGeomType
te::gm::GeomType m_currentGeomType
Definition: Renderer.h:142
te::edit::Renderer::draw
void draw(te::gm::Geometry *geom, bool showVertexes=false)
te::edit::Renderer::m_pointFillColor
QColor m_pointFillColor
Definition: Renderer.h:134
te::edit::Renderer::m_polygonContourWidth
std::size_t m_polygonContourWidth
Definition: Renderer.h:128
te::edit::Renderer::setPolygonStyle
void setPolygonStyle(const QColor &fillColor, const QColor &contourColor, const std::size_t &contourWidth)
te::edit::Renderer::m_lineDashStyle
te::map::LineDashStyle m_lineDashStyle
Definition: Renderer.h:145
te::edit::Renderer::drawRepository
void drawRepository(const std::string &source, const te::gm::Envelope &e, int srid)
te::edit::Renderer
This is a singleton for rendering geometries and features.
Definition: Renderer.h:71
te::edit::Renderer::setPointStyle
void setPointStyle(const QString &mark, const QColor &fillColor, const QColor &contourColor, const std::size_t &contourWidth, const std::size_t &size)
te::edit::Renderer::m_lineWidth
std::size_t m_lineWidth
Definition: Renderer.h:131
te::map::LineDashStyle
LineDashStyle
This enum encodes enumerated values telling how lines should be drawn. e.g. as a plain line or dash l...
Definition: Enums.h:57
te::common::Singleton
Template support for singleton pattern.
Definition: Singleton.h:101
te::edit::Renderer::drawVertexes
void drawVertexes(te::gm::Geometry *geom)
te::edit::Renderer::m_textFillColor
QColor m_textFillColor
Definition: Renderer.h:139
te::edit::Renderer::prepare
void prepare(te::edit::Feature *feature)
te::gm::LineString
LineString is a curve with linear interpolation between points.
Definition: LineString.h:65
te::edit::Renderer::m_pointMark
QString m_pointMark
Definition: Renderer.h:133
te::edit::Renderer::m_pointSize
std::size_t m_pointSize
Definition: Renderer.h:137
te::edit::Renderer::drawVertexes
void drawVertexes(const std::vector< te::gm::LineString * > &lines)
te::edit::Renderer::m_pointContourColor
QColor m_pointContourColor
Definition: Renderer.h:135
te::edit::Feature
Definition: Feature.h:58
te::edit::Renderer::m_srid
int m_srid
Definition: Renderer.h:124
te::edit::Renderer::setupDefaultStyle
void setupDefaultStyle()
te::edit::Renderer::m_canvas
te::qt::widgets::Canvas * m_canvas
Definition: Renderer.h:123
te::edit::Renderer::~Renderer
~Renderer()
Singleton destructor.
te::edit::Renderer::draw
void draw(te::edit::Feature *feature, bool showVertexes=false)
te::edit::Renderer::m_styleChanged
bool m_styleChanged
Definition: Renderer.h:143
Config.h
Proxy configuration file for TerraView (see terraview_config.h).
te::edit::Renderer::m_lineColor
QColor m_lineColor
Definition: Renderer.h:130
te::gm::Geometry
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
te::gm::GeomType
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Definition: Enums.h:42
te::edit::Renderer::m_pointContourWidth
std::size_t m_pointContourWidth
Definition: Renderer.h:136
te::gm::Point
A point with x and y coordinate values.
Definition: Point.h:51
te::edit::Renderer::setLineStyle
void setLineStyle(const QColor &lineColor, const std::size_t &lineWidth)