CConsoleBase.h
Go to the documentation of this file.
1 #ifndef iview_CConsoleBase_included
2 #define iview_CConsoleBase_included
3 
4 
5 // Qt includes
6 #include <QtCore/QString>
7 #if QT_VERSION >= 0x050000
8 #include <QtWidgets/QWidget>
9 #else
10 #include <QtGui/QWidget>
11 #endif
12 
13 
14 // ACF includes
15 #include <i2d/CRectangle.h>
16 
18 #include <iview/CScreenTransform.h>
19 
20 
21 namespace iview
22 {
23 
24 
25 class CViewport;
26 
27 
28 class CConsoleBase: public QWidget
29 {
30 public:
34  enum FitMode
35  {
40 
45 
50 
55 
60 
65  };
66 
67  explicit CConsoleBase(QWidget* parent);
68 
69  // console visibility
70  bool IsZoomToFit() const;
71  void SetZoomToFit(bool state = true);
72  FitMode GetFitMode() const;
73  void SetFitMode(FitMode mode);
74  bool IsGridVisible() const;
75  void SetGridVisible(bool state = true);
76  bool IsRulerVisible() const;
77  void SetRulerVisible(bool state = true);
78  bool IsGridInMm() const;
79  void SetGridInMm(bool state = true);
80 
81  // GUI visibility
82  bool IsButtonsPanelVisible() const;
83  void SetButtonsPanelVisible(bool state = true);
84  bool IsButtonsPanelVertical() const;
85  void SetButtonsPanelVertical(bool state = true);
86  bool AreScrollbarsVisible() const;
87  void SetScrollbarsVisible(bool state = true);
88 
89  // buttons visibility
90  bool AreZoomsVisible() const;
91  void SetZoomsVisible(bool state = true);
92  bool IsZoomToFitVisible() const;
93  void SetZoomToFitVisible(bool state = true);
94  bool ArePolylineButtonsVisible() const;
95  void SetPolylineButtonsVisible(bool state = true);
96  bool AreUserModeButtonsVisible() const;
97  void SetUserModeButtonsVisible(bool state = true);
98  bool IsScrollbarsButtonVisible() const;
99  void SetScrollbarsButtonVisible(bool state = true);
100  bool IsGridButtonVisible() const;
101  void SetGridButtonVisible(bool state = true);
102  bool IsRulerButtonVisible() const;
103  void SetRulerButtonVisible(bool state = true);
104  bool IsMmButtonVisible() const;
105  void SetMmButtonVisible(bool state = true);
106 
107  // fullscreen
108  bool IsFullScreenAllowed() const;
109  void SetFullScreenAllowed(bool allow = true);
110 
114  bool IsBackgroundActive() const;
115 
116  void UpdateView();
117 
118  // abstract methods
119 
123  virtual const CViewport& GetView() const = 0;
124 
128  virtual CViewport& GetViewRef() = 0;
129 
136  virtual void UpdateEditModeButtons() = 0;
137 
141  virtual void UpdateButtonsState() = 0;
142 
146  virtual void UpdateComponentsPosition() = 0;
147 
151  virtual void UpdateCommands() = 0;
152 
153  // abstract methods
154  virtual void UpdateCursorInfo(const QString& infoText) = 0;
155 
156 protected:
157  // events
158  virtual bool OnSelectChange(const iview::IShapeView& view, const istd::CIndex2d& position, const iview::IInteractiveShape& shape, bool state) = 0;
159  virtual bool OnViewMouseButton(const iview::IShapeView& view, const istd::CIndex2d& position, Qt::MouseButton buttonType, bool state, const iview::IInteractiveShape* shapePtr) = 0;
160  virtual void OnBoundingBoxChanged() = 0;
161 
162 private:
163  void Init();
164 
165  FitMode m_fitMode;
166  bool m_isRulerVisible;
167 
168  bool m_areScollbarsVisible;
169  bool m_isButtonsPanelVisible;
170  bool m_isButtonsPanelVertical;
171 
172  bool m_areZoomsVisible;
173  bool m_isZoomToFitVisible;
174  bool m_arePolylineButtonsVisible;
175  bool m_areUserModeButtonsVisible;
176  bool m_isScrollbarsButtonVisible;
177  bool m_isGridButtonVisible;
178  bool m_isRulerButtonVisible;
179  bool m_isMmButtonVisible;
180 
181  iview::CScreenTransform m_storedFitTransform;
182 
183  bool m_isZoomToFit;
184  bool m_isBkActive;
185  bool m_isFullScreenAllowed;
186 
187  friend class CViewport;
188 };
189 
190 
191 } // namespace iview
192 
193 
194 #endif // !iview_CConsoleBase_included
195 
void SetRulerButtonVisible(bool state=true)
bool IsScrollbarsButtonVisible() const
bool IsMmButtonVisible() const
bool IsGridInMm() const
bool IsButtonsPanelVisible() const
void SetGridButtonVisible(bool state=true)
void SetButtonsPanelVertical(bool state=true)
bool IsRulerButtonVisible() const
bool ArePolylineButtonsVisible() const
virtual void UpdateEditModeButtons()=0
Update state of edit mode buttons.
No fitting, frame use always identity transformation.
Definition: CConsoleBase.h:39
CConsoleBase(QWidget *parent)
bool IsZoomToFit() const
Index implementation for addressing elements in 2D-space.
Definition: CIndex2d.h:20
Common interface for a general shape view implementations.
Definition: IShapeView.h:24
void SetFullScreenAllowed(bool allow=true)
bool IsButtonsPanelVertical() const
bool AreUserModeButtonsVisible() const
virtual void UpdateButtonsState()=0
Recalculates enabling flags for buttons.
Only vertical size of AOI will be consider.
Definition: CConsoleBase.h:54
Common interface for all display console shapes which can interacts with user.
virtual const CViewport & GetView() const =0
Get access to internal view implementation.
void SetFitMode(FitMode mode)
bool IsBackgroundActive() const
Check if background object is present and active.
void SetZoomToFit(bool state=true)
void SetRulerVisible(bool state=true)
bool IsRulerVisible() const
virtual CViewport & GetViewRef()=0
Get access to internal view implementation.
void SetScrollbarsVisible(bool state=true)
bool AreScrollbarsVisible() const
bool AreZoomsVisible() const
virtual void UpdateComponentsPosition()=0
Recalculates position of all components.
FitMode GetFitMode() const
virtual void UpdateCursorInfo(const QString &infoText)=0
FitMode
Control fitting mode, to fit area of interest (AOI) to display.
Definition: CConsoleBase.h:34
bool IsFullScreenAllowed() const
bool IsGridButtonVisible() const
void SetGridInMm(bool state=true)
void SetZoomToFitVisible(bool state=true)
void SetZoomsVisible(bool state=true)
void SetUserModeButtonsVisible(bool state=true)
virtual bool OnSelectChange(const iview::IShapeView &view, const istd::CIndex2d &position, const iview::IInteractiveShape &shape, bool state)=0
Only horizontal size of AOI will be consider.
Definition: CConsoleBase.h:49
Scale both axes proportional to display biggest, but full visible AOI.
Definition: CConsoleBase.h:44
void SetPolylineButtonsVisible(bool state=true)
virtual void OnBoundingBoxChanged()=0
virtual bool OnViewMouseButton(const iview::IShapeView &view, const istd::CIndex2d &position, Qt::MouseButton buttonType, bool state, const iview::IInteractiveShape *shapePtr)=0
void SetGridVisible(bool state=true)
bool IsGridVisible() const
void SetScrollbarsButtonVisible(bool state=true)
Scale both axes proportional to display smallest AOI, which fully covers display. ...
Definition: CConsoleBase.h:64
void SetMmButtonVisible(bool state=true)
Both axes will be scaled separately.
Definition: CConsoleBase.h:59
virtual void UpdateCommands()=0
Recalculate menu commands.
void SetButtonsPanelVisible(bool state=true)
bool IsZoomToFitVisible() const

© 2007-2017 Witold Gantzke and Kirill Lepskiy