Loading...
Searching...
No Matches
Grid.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 canvas/Grid.h
22
*
23
* \brief Contains an implementation of a grid.
24
*/
25
26
#ifndef __TERRALIB_QT_WIDGETS_INTERNAL_GRID_H
27
#define __TERRALIB_QT_WIDGETS_INTERNAL_GRID_H
28
29
//TerraLib
30
#include "../Config.h"
31
32
// Qt
33
#include <QFrame>
34
35
// STL
36
#include <vector>
37
38
// Forward Declarations
39
class
QPixmap;
40
41
namespace
te
42
{
43
namespace
gm
44
{
45
// Forward Declarations
46
class
LineString;
47
}
48
49
namespace
qt
50
{
51
namespace
widgets
52
{
53
// Forward declaration
54
class
MapDisplay;
55
56
/*!
57
* \enum GridTypes
58
*
59
* \brief Defines the types of grid that can be used.
60
*/
61
enum
GridTypes
62
{
63
PLANAR
,
//!< Planar grid.
64
GEOGRAPHIC
//!< Geographic grid.
65
};
66
67
/*!
68
* \class Grid
69
*
70
* \brief This class implements the grid, planar or geographic, to be used with the MapDisplay
71
*
72
* \ingroup widgets
73
*/
74
class
TEQTWIDGETSEXPORT
Grid
:
public
QFrame
75
{
76
Q_OBJECT
77
78
public
:
79
80
/** @name Constructor and destructor methods.
81
* Methods related to instantiation and destruction.
82
*/
83
//@{
84
85
/*!
86
* \brief Constructor.
87
*
88
* \param parent The display over what the scale will reflect.
89
*/
90
Grid
(
MapDisplay
* parent);
91
92
/*!
93
* \brief Destuctor.
94
*/
95
~Grid
();
96
//@}
97
98
/** @name Public methods
99
* Methods to access the internal attributes of the class.
100
*/
101
//@{
102
103
/*!
104
* \brief Returns the current color being used.
105
*
106
* \return The current color of the grid and texts.
107
*/
108
QColor
getColor
()
const
;
109
110
/*!
111
* \brief Returns the current font being used.
112
*
113
* \return The current font of the texts.
114
*/
115
QFont
getFont
()
const
;
116
117
/*!
118
* \brief Returns the current type of grid being used.
119
*
120
* \return The current type of grid being used.
121
*
122
* \sa GridTypes
123
*/
124
int
getType
()
const
;
125
//@}
126
127
public
slots
:
128
129
/** @name Public slots.
130
* Methods to update the internal attributes of the class, using the signal-slot mechanism of QT.
131
*/
132
//@{
133
134
/*!
135
* \brief Updates the color of the lines and texts.
136
*
137
* \param color The new color to be used.
138
*/
139
void
setColor
(
const
QColor& color);
140
141
/*!
142
* \brief Updates the font of the texts.
143
*
144
* \param font New font to be used.
145
*/
146
void
setFont
(
const
QFont& font);
147
148
/*!
149
* \brief Updates the type of grid: planar or geographic.
150
* \param type The new type.
151
*/
152
void
setGridType
(
const
int
& type);
153
154
/*!
155
* \brief Refresh the grid image. This method MUST BE called when the area of visualization changes in MapDisplay.
156
*/
157
void
redraw
();
158
//@}
159
160
signals:
161
162
/** @name Signals
163
* Signals emmited by the widget.
164
*/
165
//@{
166
167
/*!
168
* Signal emmited when the widget is about to be closed.
169
*/
170
void
aboutToBeclosed
();
171
//@}
172
173
/** @name Protected methods
174
* Methods used internally by the object.
175
*/
176
//@{
177
178
protected
:
179
/*!
180
* \brief Initializes the object.
181
*/
182
void
initialize
();
183
184
/*!
185
* \brief Builds the planar grid.
186
*/
187
void
makePlanarGrid
();
188
189
/*!
190
* \brief Builds the geographic grid.
191
*/
192
void
makeGeographicGrid
();
193
194
/*!
195
* \brief Reimplementation of the QFrame method.
196
*
197
* \param event The event generated.
198
*/
199
void
paintEvent
(QPaintEvent* event);
200
201
/*!
202
* \brief Reimplementation of the QFrame method.
203
*
204
* \param event The event generated.
205
*/
206
void
closeEvent
(QCloseEvent *event);
207
//@}
208
209
MapDisplay
*
m_display
;
//!< Pointer to a MapDisplay.
210
int
m_maxGap
;
//!< Maximum number of lines to be presented on the grid.
211
double
m_verticalGap
;
//!< Distance between lines in y-axis.
212
double
m_horizontalGap
;
//!< Distance between lines in x-axis.
213
double
m_initialX
;
//!< Initial coordinate in x-axis.
214
double
m_initialY
;
//!< Initial coordinate in y-axis.
215
QPixmap*
m_backGround
;
//!< Pixmap with the grid image.
216
std::vector<te::gm::LineString>
m_hlines
;
//!< Grid lines.
217
std::vector<te::gm::LineString>
m_vlines
;
//!< Grid lines.
218
int
m_srid
;
//!< SRID being used to reproject the world box to a planar coordinate system.
219
int
m_geoSrid
;
//!< Geographic SRID being used to reproject the world box to a geographic coordinate system.
220
QColor
m_color
;
//!< Color to be used.
221
QFont
m_font
;
//!< Font to be used.
222
GridTypes
m_type
;
//!< Type of the grid (planar or geographic).
223
};
224
}
225
}
226
}
227
228
#endif
//__TERRALIB_QT_WIDGETS_INTERNAL_GRID_H
te::qt::widgets::Grid
This class implements the grid, planar or geographic, to be used with the MapDisplay.
Definition:
Grid.h:75
te::qt::widgets::Grid::m_backGround
QPixmap * m_backGround
Pixmap with the grid image.
Definition:
Grid.h:215
te::qt::widgets::Grid::m_initialX
double m_initialX
Initial coordinate in x-axis.
Definition:
Grid.h:213
te::qt::widgets::Grid::aboutToBeclosed
void aboutToBeclosed()
te::qt::widgets::Grid::paintEvent
void paintEvent(QPaintEvent *event)
Reimplementation of the QFrame method.
te::qt::widgets::Grid::m_horizontalGap
double m_horizontalGap
Distance between lines in x-axis.
Definition:
Grid.h:212
te::qt::widgets::Grid::getColor
QColor getColor() const
Returns the current color being used.
te::qt::widgets::Grid::m_initialY
double m_initialY
Initial coordinate in y-axis.
Definition:
Grid.h:214
te::qt::widgets::Grid::m_verticalGap
double m_verticalGap
Distance between lines in y-axis.
Definition:
Grid.h:211
te::qt::widgets::Grid::Grid
Grid(MapDisplay *parent)
Constructor.
te::qt::widgets::Grid::redraw
void redraw()
Refresh the grid image. This method MUST BE called when the area of visualization changes in MapDispl...
te::qt::widgets::Grid::m_geoSrid
int m_geoSrid
Geographic SRID being used to reproject the world box to a geographic coordinate system.
Definition:
Grid.h:219
te::qt::widgets::Grid::getType
int getType() const
Returns the current type of grid being used.
te::qt::widgets::Grid::m_maxGap
int m_maxGap
Maximum number of lines to be presented on the grid.
Definition:
Grid.h:210
te::qt::widgets::Grid::setGridType
void setGridType(const int &type)
Updates the type of grid: planar or geographic.
te::qt::widgets::Grid::makePlanarGrid
void makePlanarGrid()
Builds the planar grid.
te::qt::widgets::Grid::m_type
GridTypes m_type
Type of the grid (planar or geographic).
Definition:
Grid.h:222
te::qt::widgets::Grid::m_vlines
std::vector< te::gm::LineString > m_vlines
Grid lines.
Definition:
Grid.h:217
te::qt::widgets::Grid::m_color
QColor m_color
Color to be used.
Definition:
Grid.h:220
te::qt::widgets::Grid::makeGeographicGrid
void makeGeographicGrid()
Builds the geographic grid.
te::qt::widgets::Grid::m_display
MapDisplay * m_display
Pointer to a MapDisplay.
Definition:
Grid.h:209
te::qt::widgets::Grid::m_hlines
std::vector< te::gm::LineString > m_hlines
Grid lines.
Definition:
Grid.h:216
te::qt::widgets::Grid::setFont
void setFont(const QFont &font)
Updates the font of the texts.
te::qt::widgets::Grid::initialize
void initialize()
Initializes the object.
te::qt::widgets::Grid::~Grid
~Grid()
Destuctor.
te::qt::widgets::Grid::closeEvent
void closeEvent(QCloseEvent *event)
Reimplementation of the QFrame method.
te::qt::widgets::Grid::m_srid
int m_srid
SRID being used to reproject the world box to a planar coordinate system.
Definition:
Grid.h:218
te::qt::widgets::Grid::setColor
void setColor(const QColor &color)
Updates the color of the lines and texts.
te::qt::widgets::Grid::m_font
QFont m_font
Font to be used.
Definition:
Grid.h:221
te::qt::widgets::Grid::getFont
QFont getFont() const
Returns the current font being used.
te::qt::widgets::MapDisplay
A widget to control the display of a set of layers.
Definition:
MapDisplay.h:72
te::qt::widgets::GridTypes
GridTypes
Defines the types of grid that can be used.
Definition:
Grid.h:62
te::qt::widgets::PLANAR
@ PLANAR
Planar grid.
Definition:
Grid.h:63
te::qt::widgets::GEOGRAPHIC
@ GEOGRAPHIC
Geographic grid.
Definition:
Grid.h:64
te
TerraLib.
Definition:
AddressGeocodingOp.h:52
slots
#define slots
Definition:
VirtualMachine.h:48
TEQTWIDGETSEXPORT
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition:
Config.h:63
git_release
src
terralib
qt
widgets
canvas
Grid.h
Generated on Mon Apr 1 2024 12:42:42 for TerraLib by
1.9.5