CCalibratedViewBase.h
Go to the documentation of this file.
1 #ifndef iview_CCalibratedViewBase_included
2 #define iview_CCalibratedViewBase_included
3 
4 
5 // Qt includes
6 #include <QtGui/QPainter>
7 
8 // ACF includes
9 #include <istd/TOptDelPtr.h>
10 #include <i2d/CRect.h>
11 #include <i2d/ICalibration2d.h>
13 #include <iview/CViewBase.h>
14 #include <iview/CDrawBuffer.h>
15 #include <iview/CColorSchema.h>
16 
17 
18 namespace iview
19 {
20 
21 
28  public CViewBase,
29  virtual public i2d::ICalibrationProvider,
30  virtual public IVisualCalibrationInfo
31 {
32 public:
34 
36 
40  void SetDisplayCalibration(const i2d::ICalibration2d* calibrationPtr);
41 
45  virtual void SetGridVisible(bool state = true);
46 
50  virtual void ConnectCalibrationShape(iview::IShape* shapePtr);
51 
56  void SetMinGridDistance(double gridDistance);
57 
61  void SetGridInMm(bool state = true);
62 
64 
70  void SetDefaultColorSchema(const IColorSchema* colorSchemaPtr, bool releaseFlag = false);
71 
72  bool IsBackgroundBufferActive() const;
73  void SetBackgroundBufferActive(bool state = true);
74  bool IsDoubleBufferActive() const;
75  void SetDoubleBufferActive(bool state = true);
76 
79  const iview::CDrawBuffer& GetDoubleBuffer() const;
81 
85  virtual void OnResize();
86 
90  void CheckResize();
91 
92  // reimplemented (iview::CViewBase)
93  virtual const iview::IColorSchema& GetDefaultColorSchema() const;
94  virtual void UpdateAllShapes(const istd::IChangeable::ChangeSet& changeSet);
95  virtual void InsertDefaultLayers();
96 
97  // reimplemented (iview::IShapeView)
98  virtual int InsertLayer(iview::IViewLayer* layerPtr, int index = -1, int layerType = IViewLayer::LT_NONE);
99  virtual void RemoveLayer(int index);
100 
101  // reimplemented (iview::IVisualCalibrationInfo)
102  virtual bool IsGridVisible() const;
103  virtual double GetMinGridDistance() const;
104  virtual bool IsGridInMm() const;
105 
106  // reimplemented (i2d::ICalibrationProvider)
107  virtual const i2d::ICalibration2d* GetCalibration() const;
108 
110 
111 protected:
112  virtual void DrawBuffers(QPaintDevice& nativeContext, const i2d::CRect& clipRect);
113  virtual void DrawToContext(QPaintDevice& nativeContext, QPainter& context, const i2d::CRect& invalidatedBox);
114 
115 private:
116  mutable istd::TOptDelPtr<const IColorSchema> m_defaultColorSchemaPtr;
117 
118  iview::CDrawBuffer m_backgroundBuffer;
119  iview::CDrawBuffer m_doubleBuffer;
120 
121  bool m_isBackgroundBufferActive;
122  bool m_isDoubleBufferActive;
123 
124  i2d::CRect m_lastClientArea;
125 
126  const i2d::ICalibration2d* m_calibrationPtr;
127  bool m_isGridVisible;
128  bool m_isGridInMm;
129  double m_minGridDistance;
130 
131  int m_calibrationLayerIndex;
132 
133  // default layers
134  iview::CViewLayer m_calibrationLayer;
135 };
136 
137 
138 // inline methods
139 
140 inline void CCalibratedViewBase::SetGridVisible(bool state)
141 {
142  if (m_isGridVisible != state){
143  m_isGridVisible = state;
145  }
146 }
147 
148 
149 inline void CCalibratedViewBase::SetMinGridDistance(double gridDistance)
150 {
151  if (m_minGridDistance != gridDistance){
152  m_minGridDistance = gridDistance;
153  if (m_isGridVisible){
155  }
156  }
157 }
158 
159 
160 inline void CCalibratedViewBase::SetGridInMm(bool state)
161 {
162  if (m_isGridInMm != state){
163  m_isGridInMm = state;
165  }
166 }
167 
168 
170 {
171  return m_calibrationLayer;
172 }
173 
174 
176 {
177  return m_isGridVisible;
178 }
179 
180 
182 {
183  return m_minGridDistance;
184 }
185 
186 
188 {
189  return m_isGridInMm;
190 }
191 
192 
193 // reimplemented (i2d::ICalibrationProvider)
194 
196 {
197  return m_calibrationPtr;
198 }
199 
200 
201 
202 } // namespace iview
203 
204 
205 
206 #endif // !iview_CCalibratedViewBase_included
207 
208 
209 
210 
Interface for a logical layer in the console view.
Definition: IViewLayer.h:24
virtual void UpdateAllShapes(const istd::IChangeable::ChangeSet &changeSet)
Inform all shapes about changes.
void SetDoubleBufferActive(bool state=true)
Abstract base class for all calibrated view.
virtual const iview::IColorSchema & GetDefaultColorSchema() const
Common interface for an object, which delivers a 2D-calibration.
virtual void OnResize()
Called if found that display area was resized.
bool IsDoubleBufferActive() const
virtual int InsertLayer(iview::IViewLayer *layerPtr, int index=-1, int layerType=IViewLayer::LT_NONE)
Insert layer to view.
const iview::CDrawBuffer & GetBackgroundBuffer() const
Simple rectangle with integer bounds.
Definition: CRect.h:21
Pointer wrapper providing activatable deleting pointed object during destruction. ...
Definition: TOptDelPtr.h:20
virtual void DrawBuffers(QPaintDevice &nativeContext, const i2d::CRect &clipRect)
virtual void SetGridVisible(bool state=true)
Set grid visibility state.
void SetBackgroundBufferActive(bool state=true)
const iview::IViewLayer & GetCalibrationLayer() const
void SetGridInMm(bool state=true)
Set if grid should be shown in milimeter.
virtual bool IsGridVisible() const
Check if grid is visible.
void SetDisplayCalibration(const i2d::ICalibration2d *calibrationPtr)
Set calibration using to display logical coordinates.
virtual bool IsGridInMm() const
Check if grid should be shown in milimeter.
Common interface for all objects which allow access to calibration info.
virtual void DrawToContext(QPaintDevice &nativeContext, QPainter &context, const i2d::CRect &invalidatedBox)
void SetDefaultColorSchema(const IColorSchema *colorSchemaPtr, bool releaseFlag=false)
Set default color schema object.
Common interface for all display console shapes.
Definition: IShape.h:27
virtual const i2d::ICalibration2d * GetCalibration() const
Get access to transformation object, which transforms a local logical coordinate system to global one...
virtual void InsertDefaultLayers()
Insert default layers, when there is no one user layer.
virtual double GetMinGridDistance() const
Get minimal distance between grid lines.
virtual void RemoveLayer(int index)
Remove layer from view.
bool IsBackgroundBufferActive() const
virtual void InvalidateBackground()
Invalidate whole background buffer.
Set of change flags (its IDs).
Definition: IChangeable.h:30
Defines set of standard pens, brushes and simple management of unions.
Definition: IColorSchema.h:28
virtual void SetBackgroundBufferValid(bool state=true)
Set validate flag of background buffer.
Definition: CViewBase.h:518
void CheckResize()
Check if size size was changed and invalidation and OnResize() should be done.
void SetMinGridDistance(double gridDistance)
Set minimal grid size.
Standard implementation of view layer.
Definition: CViewLayer.h:21
const iview::CDrawBuffer & GetDoubleBuffer() const
Layer type is not set.
Definition: IViewLayer.h:34
virtual void ConnectCalibrationShape(iview::IShape *shapePtr)
Connect visualisation shape for calibration object.

© 2007-2017 Witold Gantzke and Kirill Lepskiy