All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GraphicScaleFrame.h
Go to the documentation of this file.
1 /* Copyright (C) 2011-2012 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of TerraView - A Free and Open Source GIS Application.
4 
5  TerraView is free software: you can redistribute it and/or modify
6  it under the terms of the GNU 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  TerraView 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 General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with TerraLib Code Editor. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@dpi.inpe.br>.
18  */
19 
20 /*!
21  \file terralib/qt/widgets/canvas/FrameData.h
22 
23  \brief The main class of FrameData.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_INTERNAL_GRAPHIC_SCALE_FRAME_H
27 #define __TERRALIB_QT_WIDGETS_INTERNAL_GRAPHIC_SCALE_FRAME_H
28 
29 // TerraLib
30 #include "../Config.h"
31 #include "MultiThreadMapDisplay.h"
32 #include "Frame.h"
33 
34 // Qt
35 #include <QtCore/QRect>
36 #include <QtCore/QRectF>
37 #include <QtGui/QPixmap>
38 #include <QtGui/QWidget>
39 
40 class QMenu;
41 class QAction;
42 
43 namespace te
44 {
45  namespace qt
46  {
47  namespace widgets
48  {
49  class LayoutEditor;
50  class DataFrame;
51  /*!
52  \class ScaleFrame
53 
54  \brief A ScaleFrame ....
55 
56  */
58  {
59  public:
60  GraphicScaleFrame(te::qt::widgets::DataFrame* df, Qt::WindowFlags f = Qt::Widget);
61 
63 
64  virtual ~GraphicScaleFrame();
65 
66  GraphicScaleFrame& operator=(const GraphicScaleFrame& rhs);
67 
68  void paintEvent(QPaintEvent* event);
69 
70  void setDataFrame(te::qt::widgets::DataFrame* df);
71 
72  te::qt::widgets::DataFrame* getDataFrame();
73 
74  QPixmap* getPixmap();
75 
76  void draw();
77 
78  void adjust();
79 
80  void calculateSelectionPoints();
81 
82  QFont getFont();
83  void setFont(const QFont&);
84  void setPointSize(int);
85  void getLabels();
86  void labelLengthCalculation();
87  void drawLabels();
88  void drawBar1();
89  void drawBar2();
90  void drawBar3();
91  void drawBar4();
92  void mousePressEvent(QMouseEvent*);
93  void mouseMoveEvent(QMouseEvent*);
94  void mouseReleaseEvent(QMouseEvent*);
95  void enterEvent(QEvent*);
96  void leaveEvent(QEvent*);
97  QColor getLabelColor();
98  void setLabelColor(const QColor&);
99  QColor getBarColor();
100  void setBarColor(const QColor&);
101  QRectF getBarRect();
102  void setBarRect(const QRectF&);
103  void setType(int t);
104  int getType();
105  bool isLabelAbove();
106  void setLabelAbove(bool);
107  bool isUnitAbove();
108  void setUnitAbove(bool);
109  double getSubTickSize();
110  void setSubTickSize(double);
111  bool isTickCentralized();
112  void setTickCentralized(bool);
113  double getStep();
114  void findNiceStep(double newStep = 0);
115  void setStep(double);
116  int getDivisions();
117  void setDivisions(int);
118  int getSubDivisions();
119  void setSubDivisions(int);
120  double getSpace();
121  void setSpace(double);
122  QString getUnit();
123  void setUnit(const QString&);
124  void rubberBand();
125  void showSelectionPoints();
126  void hideSelectionPoints();
127  void getSelectionPoint(const QPoint& p);
128  QPoint getCenterSelected();
129  void setCursor();
130  void toolTip(const QPoint&, const QString&);
131  void createMenu();
132  void setTypeAction();
133  void setFamilyAction();
134  void setLabelColorAction();
135  void setBarColorAction();
136  void setBarHeightAction();
137  void setOffsetOriginAction();
138  void setLabelAboveAction();
139  void setUnitAboveAction();
140  void setUnitAction();
141  void setDivisionsAction();
142  void setSubDivisionsAction();
143  void setStepAction();
144  void setShowTooTipAction();
145 
146 
147  private:
148  te::qt::widgets::DataFrame* m_dataFrame; // pointer to data frame
149  int m_type; // 1 = line, 2 = steped, 3 = hollow bar, 4 = alternating bar
150  QFont m_font; // font for label and unit
151  int m_pointSize; // point size for label and unit
152  QColor m_labelColor; // label and uinit color
153  QColor m_barColor; // bar color
154  double m_step; // step
155  int m_divisions; // number of divisions
156  int m_subDivisions; // number of subdivisions. Used for first division
157  bool m_labelAbove; // true = label above the bar
158  double m_subTickSize; // subdivision tick size (mm). Used for only type = 1
159  bool m_tickCentralized; // true = centralized ticks, false = follow the label position. Used for only type = 1
160  double m_space; // space (mm) for labels and unit
161  QString m_unit; // Meters, Kilometers, Miles, Leagues, Inches, Feet, Hand, Fingers, Nautic Miles, Nautic Fathom, Decimal Degrees, Yards, Fourlongs, Chains, Marathons, Unknow
162  bool m_unitAbove; // true = unit above the bar
163  bool m_offsetOrigin; // true = offset origin
164 
165  bool m_undo;
166  QPixmap m_pixmap; // widget pixmap
167  std::vector<QString> m_labels; // numeric labels
168  QString m_subDivisionString; // subDivision string
169  std::vector<double> m_labelLengths; // length (mm)
170  double m_labelHeight; // label height
171  QRectF m_barRect; // bar rect (mm). If type = 1: use this width for tick size
172  int m_precision; // label decimal precision
173  double m_subDivisionLabelLength; // subdivision label length
174  double m_toKm; // projection data unit to kilometer
175  double m_kmToUnit; // convert km to Unit
176  double m_stepmm; // step in milimeters
177 
178  QMenu *m_menu;
179  QAction *m_setTypeAction;
187  QAction *m_setUnitAction;
190  QAction *m_setStepAction;
192  };
193  } // end namespace widgets
194  } // end namespace qt
195 } // end namespace te
196 
197 #endif // __TERRALIB_QT_WIDGETS_INTERNAL_GRAPHIC_SCALE_FRAME_H
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:101
A DataFrame ....
Definition: DataFrame.h:59
te::qt::widgets::DataFrame * m_dataFrame
A multi thread Qt4 widget to control the display of a set of layers.
A connector of the te::qt::widgets::MultiThreadMapDisplay used in te::qt::widgets::DataFrame class to...