All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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 "Frame.h"
32 
33 // Qt
34 #include <QRect>
35 #include <QRectF>
36 #include <QPixmap>
37 #include <QWidget>
38 
39 class QMenu;
40 class QAction;
41 
42 namespace te
43 {
44  namespace qt
45  {
46  namespace widgets
47  {
48  class LayoutEditor;
49  class DataFrame;
50  /*!
51  \class ScaleFrame
52 
53  \brief A ScaleFrame ....
54 
55  */
57  {
58  public:
59  GraphicScaleFrame(te::qt::widgets::DataFrame* df, Qt::WindowFlags f = Qt::Widget);
60 
62 
63  virtual ~GraphicScaleFrame();
64 
65  GraphicScaleFrame& operator=(const GraphicScaleFrame& rhs);
66 
67  void paintEvent(QPaintEvent* event);
68 
69  void setDataFrame(te::qt::widgets::DataFrame* df);
70 
71  te::qt::widgets::DataFrame* getDataFrame();
72 
73  QPixmap* getPixmap();
74 
75  void draw();
76 
77  void adjust();
78 
79  void calculateSelectionPoints();
80 
81  QFont getFont();
82  void setFont(const QFont&);
83  void setPointSize(int);
84  void getLabels();
85  void labelLengthCalculation();
86  void drawLabels();
87  void drawBar1();
88  void drawBar2();
89  void drawBar3();
90  void drawBar4();
91  void mousePressEvent(QMouseEvent*);
92  void mouseMoveEvent(QMouseEvent*);
93  void mouseReleaseEvent(QMouseEvent*);
94  void enterEvent(QEvent*);
95  void leaveEvent(QEvent*);
96  QColor getLabelColor();
97  void setLabelColor(const QColor&);
98  QColor getBarColor();
99  void setBarColor(const QColor&);
100  QRectF getBarRect();
101  void setBarRect(const QRectF&);
102  void setType(int t);
103  int getType();
104  bool isLabelAbove();
105  void setLabelAbove(bool);
106  bool isUnitAbove();
107  void setUnitAbove(bool);
108  double getSubTickSize();
109  void setSubTickSize(double);
110  bool isTickCentralized();
111  void setTickCentralized(bool);
112  double getStep();
113  void findNiceStep(double newStep = 0);
114  void setStep(double);
115  int getDivisions();
116  void setDivisions(int);
117  int getSubDivisions();
118  void setSubDivisions(int);
119  double getSpace();
120  void setSpace(double);
121  QString getUnit();
122  void setUnit(const QString&);
123  void rubberBand();
124  void showSelectionPoints();
125  void hideSelectionPoints();
126  void getSelectionPoint(const QPoint& p);
127  QPoint getCenterSelected();
128  void setCursor();
129  void toolTip(const QPoint&, const QString&);
130  void createMenu();
131  void setTypeAction();
132  void setFamilyAction();
133  void setLabelColorAction();
134  void setBarColorAction();
135  void setBarHeightAction();
136  void setOffsetOriginAction();
137  void setLabelAboveAction();
138  void setUnitAboveAction();
139  void setUnitAction();
140  void setDivisionsAction();
141  void setSubDivisionsAction();
142  void setStepAction();
143  void setShowTooTipAction();
144 
145 
146  private:
147  te::qt::widgets::DataFrame* m_dataFrame; // pointer to data frame
148  int m_type; // 1 = line, 2 = steped, 3 = hollow bar, 4 = alternating bar
149  QFont m_font; // font for label and unit
150  int m_pointSize; // point size for label and unit
151  QColor m_labelColor; // label and uinit color
152  QColor m_barColor; // bar color
153  double m_step; // step
154  int m_divisions; // number of divisions
155  int m_subDivisions; // number of subdivisions. Used for first division
156  bool m_labelAbove; // true = label above the bar
157  double m_subTickSize; // subdivision tick size (mm). Used for only type = 1
158  bool m_tickCentralized; // true = centralized ticks, false = follow the label position. Used for only type = 1
159  double m_space; // space (mm) for labels and unit
160  QString m_unit; // Meters, Kilometers, Miles, Leagues, Inches, Feet, Hand, Fingers, Nautic Miles, Nautic Fathom, Decimal Degrees, Yards, Fourlongs, Chains, Marathons, Unknow
161  bool m_unitAbove; // true = unit above the bar
162  bool m_offsetOrigin; // true = offset origin
163 
164  bool m_undo;
165  QPixmap m_pixmap; // widget pixmap
166  std::vector<QString> m_labels; // numeric labels
167  QString m_subDivisionString; // subDivision string
168  std::vector<double> m_labelLengths; // length (mm)
169  double m_labelHeight; // label height
170  QRectF m_barRect; // bar rect (mm). If type = 1: use this width for tick size
171  int m_precision; // label decimal precision
172  double m_subDivisionLabelLength; // subdivision label length
173  double m_toKm; // projection data unit to kilometer
174  double m_kmToUnit; // convert km to Unit
175  double m_stepmm; // step in milimeters
176 
177  QMenu *m_menu;
178  QAction *m_setTypeAction;
186  QAction *m_setUnitAction;
189  QAction *m_setStepAction;
191  };
192  } // end namespace widgets
193  } // end namespace qt
194 } // end namespace te
195 
196 #endif // __TERRALIB_QT_WIDGETS_INTERNAL_GRAPHIC_SCALE_FRAME_H
A DataFrame ....
Definition: DataFrame.h:59
A connector of the te::qt::widgets::MultiThreadMapDisplay used in te::qt::widgets::DataFrame class to...
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:66
te::qt::widgets::DataFrame * m_dataFrame