Public Types | Signals | Public Member Functions | Protected Member Functions | Friends | List of all members
iview::CViewport Class Reference

#include <CViewport.h>

Inheritance diagram for iview::CViewport:
iview::CCalibratedViewBase iview::IViewEventObserver iview::CViewBase i2d::ICalibrationProvider iview::IVisualCalibrationInfo istd::IPolymorphic iview::IShapeView iview::IDraggable iview::IMouseActionObserver istd::IChangeable istd::IChangeable iview::IDisplay iview::ISelectable istd::IPolymorphic istd::IPolymorphic istd::IPolymorphic istd::IPolymorphic iview::IShapeObserver iview::ITouchable istd::IPolymorphic istd::IPolymorphic

Public Types

typedef CCalibratedViewBase BaseClass
 
typedef QWidget BaseClass2
 
- Public Types inherited from iview::CCalibratedViewBase
typedef CViewBase BaseClass
 
- Public Types inherited from iview::CViewBase
enum  ZoomMode {
  ZM_RESET, ZM_ZOOM_IN, ZM_ZOOM_OUT, ZM_FIT,
  ZM_FIT_COVER, ZM_FIT_UNPROP, ZM_FIT_H, ZM_FIT_V
}
 
- Public Types inherited from iview::IShapeView
typedef IShapeObserver BaseClass
 
- Public Types inherited from iview::IDisplay
enum  ChangeFlags {
  CF_TRANSFORM = 0x3f67360, CF_COLORS, CF_SIZE, CF_EDIT_MODE,
  CS_CONSOLE
}
 Define possible display change flags. More...
 
- Public Types inherited from iview::ISelectable
enum  MousePointerMode {
  MPM_NONE, MPM_DEFAULT, MPM_DESELECT, MPM_POINTER,
  MPM_WAIT, MPM_CROSS, MPM_HAND, MPM_DRAG,
  MPM_SCREEN_MOVE, MPM_LAST = MPM_SCREEN_MOVE
}
 Defines possible states of mouse pointer. More...
 
enum  EditMode { EM_NONE = 0, EM_MOVE = 1, EM_ADD = 2, EM_REMOVE = 3 }
 Describes standard edit modes. More...
 
typedef QSet< IInteractiveShape * > SelectedShapes
 
- Public Types inherited from iview::ITouchable
enum  TouchState {
  TS_NONE, TS_INACTIVE, TS_TICKER, TS_DRAGGABLE,
  TS_OTHER, TS_LAST = TS_OTHER
}
 Enumeration for possible shape touch states. More...
 
- Public Types inherited from istd::IChangeable
enum  ChangeFlags {
  CF_ACF_INTERNAL = 0, CF_ALL_DATA, CF_ANY, CF_DESTROYING,
  CF_DELEGATED, CF_NO_UNDO
}
 Data model change notification flags. More...
 
enum  SupportedOperations {
  SO_NONE = 0, SO_OBSERVE = 1 << 0, SO_COPY = 1 << 1, SO_CLONE = 1 << 2,
  SO_COMPARE = 1 << 3, SO_RESET = 1 << 4
}
 Flags for supported operations. More...
 
enum  CompatibilityMode { CM_STRICT, CM_WITHOUT_REFS, CM_WITH_REFS, CM_CONVERT }
 Control how relationship betweeen objects are interpreted. More...
 

Signals

void ShapesChanged ()
 Called when some shapes has been changed. More...
 

Public Member Functions

 CViewport (CConsoleBase *framePtr, QWidget *parent=NULL)
 
virtual ~CViewport ()
 
CConsoleBaseGetFramePtr () const
 
void UpdateFitTransform ()
 
virtual void SetEditMode (int mode)
 Set edit mode. More...
 
virtual void SetFitArea (const i2d::CRectangle &area)
 Set area will be used to fit in some zoom modes. More...
 
virtual i2d::CRect GetClientRect () const
 Get bounding box of client area. More...
 
virtual bool OnSelectChange (const iview::IShapeView &view, const istd::CIndex2d &position, const iview::IInteractiveShape &shape, bool state)
 Message handler for selection changes. More...
 
virtual bool OnViewMouseButton (const iview::IShapeView &view, const istd::CIndex2d &position, Qt::MouseButton buttonType, bool state, const iview::IInteractiveShape *shapePtr)
 Message handler for mouse button click. More...
 
virtual bool OnMouseMove (istd::CIndex2d position)
 It is called, when mouse is moved. More...
 
virtual void ConnectCalibrationShape (iview::IShape *shapePtr)
 Connect visualisation shape for calibration object. More...
 
- Public Member Functions inherited from iview::CCalibratedViewBase
 CCalibratedViewBase ()
 
void SetDisplayCalibration (const i2d::ICalibration2d *calibrationPtr)
 Set calibration using to display logical coordinates. More...
 
virtual void SetGridVisible (bool state=true)
 Set grid visibility state. More...
 
void SetMinGridDistance (double gridDistance)
 Set minimal grid size. More...
 
void SetGridInMm (bool state=true)
 Set if grid should be shown in milimeter. More...
 
const iview::IViewLayerGetCalibrationLayer () const
 
void SetDefaultColorSchema (const IColorSchema *colorSchemaPtr, bool releaseFlag=false)
 Set default color schema object. More...
 
bool IsBackgroundBufferActive () const
 
void SetBackgroundBufferActive (bool state=true)
 
bool IsDoubleBufferActive () const
 
void SetDoubleBufferActive (bool state=true)
 
const iview::CDrawBufferGetBackgroundBuffer () const
 
iview::CDrawBufferGetBackgroundBuffer ()
 
const iview::CDrawBufferGetDoubleBuffer () const
 
iview::CDrawBufferGetDoubleBuffer ()
 
void CheckResize ()
 Check if size size was changed and invalidation and OnResize() should be done. More...
 
virtual const iview::IColorSchemaGetDefaultColorSchema () const
 
virtual void UpdateAllShapes (const istd::IChangeable::ChangeSet &changeSet)
 Inform all shapes about changes. More...
 
virtual void InsertDefaultLayers ()
 Insert default layers, when there is no one user layer. More...
 
virtual int InsertLayer (iview::IViewLayer *layerPtr, int index=-1, int layerType=IViewLayer::LT_NONE)
 Insert layer to view. More...
 
virtual void RemoveLayer (int index)
 Remove layer from view. More...
 
virtual bool IsGridVisible () const
 Check if grid is visible. More...
 
virtual double GetMinGridDistance () const
 Get minimal distance between grid lines. More...
 
virtual bool IsGridInMm () const
 Check if grid should be shown in milimeter. More...
 
virtual const i2d::ICalibration2dGetCalibration () const
 Get access to transformation object, which transforms a local logical coordinate system to global one. More...
 
- Public Member Functions inherited from iview::CViewBase
 CViewBase ()
 
virtual ~CViewBase ()
 
virtual void SetZoom (ZoomMode zoom)
 Set zoom. More...
 
virtual void SetScreenPosition (const i2d::CVector2d &client, istd::CIndex2d screen)
 It sets position to become transformation of client point to specified screen position. More...
 
virtual const i2d::CRectangleGetFitArea () const
 Get area will be used to automatic fit the zoom to view size. More...
 
virtual void SetViewDraggable (bool state=true)
 Turn on/off possibility to move whole view transform. More...
 
virtual void SetMultiselectable (bool state=true)
 Turn on/off possibility to select more shapes using control keys. More...
 
virtual void SetDraggable (bool state=true)
 Turn on/off possibility to move more selected shapes, when one is moved. More...
 
virtual void AddViewEventObserver (iview::IViewEventObserver *listenerPtr)
 Adds handler to catch view events. More...
 
virtual void RemoveViewEventObserver (iview::IViewEventObserver *listenerPtr)
 Removes handler to catch view events. More...
 
int GetBackgroundLayerIndex () const
 Get index of default background layer. More...
 
int GetInactiveLayerIndex () const
 Get index of default inactive layer. More...
 
int GetActiveLayerIndex () const
 Get index of default active layer. More...
 
IInteractiveShapeGetMouseShapePtr () const
 Get shape under mouse pointer. More...
 
IInteractiveShapeGetFirstActiveShape () const
 
virtual void Update ()
 Updates all invalidates shapes. More...
 
virtual bool IsViewDraggable () const
 Check if is draggable mode. More...
 
virtual bool IsMultiselectable () const
 Check, if it is possible to select more than one shape. More...
 
virtual int GetLayerIndex (const IViewLayer &layer) const
 Get index of layer. More...
 
virtual int GetLayerIndex (int layerType) const
 Get index of layer by type. More...
 
virtual int GetLayersCount () const
 Get count of layer in this view. More...
 
virtual IViewLayerGetLayer (int index) const
 Get layer with the given index. More...
 
virtual bool ConnectShape (IShape *shapePtr)
 Connect shape object to view. More...
 
virtual ISelectableLayerGetFocusedLayerPtr () const
 Get focused layer. More...
 
virtual void OnLayerShapeFocused (IInteractiveShape *shapePtr, ISelectableLayer *layerPtr)
 Called when shape in layer get focus. More...
 
virtual void OnLayerShapeDefocused (IInteractiveShape *shapePtr, ISelectableLayer *layerPtr)
 Called when shape in layer loose focus. More...
 
virtual void OnLayerInvalidated (const IViewLayer &layer, const i2d::CRect &prevArea, const i2d::CRect &newArea)
 Inform that layer was invalidated. More...
 
virtual int GetSelectedShapesCount () const
 Get count of selected shapes. More...
 
virtual void InsertSelectedShapes (SelectedShapes &result) const
 Get set of selected shapes. More...
 
virtual void DeselectAllShapes ()
 Set all shapes to be deselected. More...
 
virtual int GetKeysState () const
 Get state of system keys. More...
 
virtual int GetEditMode () const
 Get actual edit mode. More...
 
virtual void OnShapeFocused (IInteractiveShape *)
 Called when shape get focus. More...
 
virtual void OnShapeDefocused (IInteractiveShape *)
 Called when shape loose focus. More...
 
virtual TouchState IsTouched (istd::CIndex2d position) const
 Check, if any shape is touched. More...
 
virtual QString GetShapeDescriptionAt (istd::CIndex2d position) const
 Get description to shape at specified position. More...
 
virtual void SetTransform (const i2d::CAffine2d &transform)
 Set a screen transformation. More...
 
virtual void UpdateMousePointer ()
 Update mouse pointer. More...
 
virtual bool OnMouseButton (istd::CIndex2d position, Qt::MouseButton buttonType, bool downFlag)
 It is called, when mouse button is pushed down or up on this object. More...
 
virtual IDisplayGetParentDisplayPtr () const
 Get parent object of this display. More...
 
virtual const
iview::CScreenTransform
GetTransform () const
 Return a screen transformation. More...
 
virtual i2d::CRect GetBoundingBox () const
 Get bounding box of all object in this display. More...
 
virtual const IColorSchemaGetColorSchema () const
 Get color schema. More...
 
virtual void OnChangeShape (IShape *shapePtr)
 Invalidate a shape. More...
 
virtual bool DisconnectShape (IShape *shapePtr)
 Disconnect shape object from view. More...
 
virtual void OnShapeSelected (IInteractiveShape &shape, bool state=true)
 It is called after change shape selection state. More...
 
virtual bool IsDraggable () const
 Check if drag is enabled. More...
 
virtual void BeginDrag (const istd::CIndex2d &reference)
 Called before dragging is begin. More...
 
virtual void SetDragPosition (const istd::CIndex2d &position)
 Set new drag position. More...
 
virtual void EndDrag ()
 Called after dragging. More...
 
- Public Member Functions inherited from istd::IPolymorphic
virtual ~IPolymorphic ()
 
- Public Member Functions inherited from istd::IChangeable
virtual int GetSupportedOperations () const
 Get set of flags for supported operations. More...
 
virtual bool CopyFrom (const IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS)
 Copy this object from another one. More...
 
virtual bool IsEqual (const IChangeable &object) const
 Compare this object with another object. More...
 
virtual IChangeableCloneMe (CompatibilityMode mode=CM_WITHOUT_REFS) const
 Make a copy of this object. More...
 
virtual bool ResetData (CompatibilityMode mode=CM_WITHOUT_REFS)
 Reset data to its default state. More...
 
virtual void BeginChanges (const ChangeSet &changeSet)
 Starts the change transaction. More...
 
virtual void EndChanges (const ChangeSet &changeSet)
 Ends the change transaction. More...
 
virtual void BeginChangeGroup (const ChangeSet &changeSet)
 Starts group of changes. More...
 
virtual void EndChangeGroup (const ChangeSet &changeSet)
 Ends group of changes. More...
 

Protected Member Functions

virtual void SetBackgroundBufferValid (bool state=true)
 Set validate flag of background buffer. More...
 
virtual void OnResize ()
 Called if found that display area was resized. More...
 
virtual bool CanBeMoved () const
 This method is internal used to check, if drag mode is allowed. More...
 
virtual void paintEvent (QPaintEvent *event)
 
virtual void resizeEvent (QResizeEvent *event)
 
virtual void mousePressEvent (QMouseEvent *event)
 
virtual void mouseReleaseEvent (QMouseEvent *event)
 
virtual void mouseMoveEvent (QMouseEvent *event)
 
virtual void SetMousePointer (MousePointerMode mode)
 Set mouse pointer. More...
 
void UpdateRectArea (const i2d::CRect &rect)
 Start updating specified rectangle area. More...
 
virtual void OnBoundingBoxChanged ()
 Called when bounding box has been changed. More...
 
virtual void OnAreaInvalidated (const i2d::CRect &beforeBox, const i2d::CRect &afterBox)
 Invalidate display area. More...
 
int GetMouseKeysState (const QMouseEvent &event)
 
- Protected Member Functions inherited from iview::CCalibratedViewBase
virtual void DrawBuffers (QPaintDevice &nativeContext, const i2d::CRect &clipRect)
 
virtual void DrawToContext (QPaintDevice &nativeContext, QPainter &context, const i2d::CRect &invalidatedBox)
 
- Protected Member Functions inherited from iview::CViewBase
virtual void DrawLayers (QPainter &drawContext, int firstLayer, int lastLayer)
 Draw Background layer. More...
 
int GetLastBackgroundLayerIndex ()
 Get last background layer index. More...
 
void SetLastBackgroundLayerIndex (int index)
 
void DisconnectAllShapes ()
 Disconnect all shapes from this view. More...
 
virtual void InvalidateBackground ()
 Invalidate whole background buffer. More...
 
virtual void InvalidateBoundingBox ()
 Invalidate bounding box. More...
 
bool EnsureBoundingBoxValid ()
 Calculate bounding box if it was invalid. More...
 
virtual i2d::CRect CalcBoundingBox () const
 Calculate bounding box of all shapes. More...
 
virtual MousePointerMode CalcMousePointer (istd::CIndex2d position) const
 
virtual void InvalidateMouseShape ()
 Invalidate stored shape under mouse pointer. More...
 
virtual void CalcMouseShape () const
 Calc shape under mouse pointer. More...
 
virtual bool IsBackgroundBufferValid () const
 Check if background buffer is valid. More...
 
const i2d::CRectGetInvalidatedBox () const
 Get bounding box of all invalidated rectangles. More...
 
void InvalidateBox (const i2d::CRect &rect)
 Invalidate rectangle screen area. More...
 
void ResetInvalidatedBox ()
 Reset invalidated box. More...
 
void SetKeysState (int state)
 Set state of keys. More...
 
const LayersGetLayers () const
 
LayersGetLayers ()
 
- Protected Member Functions inherited from istd::IChangeable
virtual void OnBeginChanges ()
 Callback function for begin change event. More...
 
virtual void OnEndChanges (const ChangeSet &changeSet)
 Callback function for end change event. More...
 

Friends

class CConsoleBase
 

Additional Inherited Members

- Static Public Member Functions inherited from istd::IChangeable
static const ChangeSetGetNoChanges ()
 Get empty set of changes. More...
 
static const ChangeSetGetAnyChange ()
 Get anonymous change set. More...
 
static const ChangeSetGetAllChanges ()
 Get anonymous change set. More...
 
static const ChangeSetGetDelegatedChanges ()
 Get delegated change set. More...
 
- Protected Types inherited from iview::CViewBase
typedef QVector< IViewLayer * > Layers
 

Detailed Description

Definition at line 30 of file CViewport.h.

Member Typedef Documentation

Definition at line 38 of file CViewport.h.

Definition at line 39 of file CViewport.h.

Constructor & Destructor Documentation

iview::CViewport::CViewport ( CConsoleBase framePtr,
QWidget *  parent = NULL 
)
virtual iview::CViewport::~CViewport ( )
virtual

Member Function Documentation

virtual bool iview::CViewport::CanBeMoved ( ) const
protectedvirtual

This method is internal used to check, if drag mode is allowed.

Normally it return IsViewDraggable(), but in derived class you can change its implementation to avoid dragging.

Reimplemented from iview::CViewBase.

virtual void iview::CViewport::ConnectCalibrationShape ( iview::IShape shapePtr)
virtual

Connect visualisation shape for calibration object.

Reimplemented from iview::CCalibratedViewBase.

virtual i2d::CRect iview::CViewport::GetClientRect ( ) const
virtual

Get bounding box of client area.

Implements iview::IDisplay.

CConsoleBase* iview::CViewport::GetFramePtr ( ) const
int iview::CViewport::GetMouseKeysState ( const QMouseEvent &  event)
protected
virtual void iview::CViewport::mouseMoveEvent ( QMouseEvent *  event)
protectedvirtual
virtual void iview::CViewport::mousePressEvent ( QMouseEvent *  event)
protectedvirtual
virtual void iview::CViewport::mouseReleaseEvent ( QMouseEvent *  event)
protectedvirtual
virtual void iview::CViewport::OnAreaInvalidated ( const i2d::CRect prevArea,
const i2d::CRect newArea 
)
protectedvirtual

Invalidate display area.

Parameters
prevAreaprevious area used to display object.
newAreanew area used to display object.

Reimplemented from iview::CViewBase.

virtual void iview::CViewport::OnBoundingBoxChanged ( )
protectedvirtual

Called when bounding box has been changed.

Reimplemented from iview::CViewBase.

virtual bool iview::CViewport::OnMouseMove ( istd::CIndex2d  position)
virtual

It is called, when mouse is moved.

Only objects with focus receive this event.

Parameters
position- position of mouse pointer on client area (picture coords).
Returns
true if this shape should hold focus to catch longer all mouse movements.

Reimplemented from iview::CViewBase.

virtual void iview::CViewport::OnResize ( )
protectedvirtual

Called if found that display area was resized.

Reimplemented from iview::CCalibratedViewBase.

virtual bool iview::CViewport::OnSelectChange ( const iview::IShapeView view,
const istd::CIndex2d position,
const iview::IInteractiveShape shape,
bool  state 
)
virtual

Message handler for selection changes.

Returns
true, if this event was consumed by this listener and should not be further processed.

Implements iview::IViewEventObserver.

virtual bool iview::CViewport::OnViewMouseButton ( const iview::IShapeView view,
const istd::CIndex2d position,
Qt::MouseButton  buttonType,
bool  state,
const iview::IInteractiveShape shapePtr 
)
virtual

Message handler for mouse button click.

Returns
true, if this event was consumed by this listener and should not be further processed.

Implements iview::IViewEventObserver.

virtual void iview::CViewport::paintEvent ( QPaintEvent *  event)
protectedvirtual
virtual void iview::CViewport::resizeEvent ( QResizeEvent *  event)
protectedvirtual
virtual void iview::CViewport::SetBackgroundBufferValid ( bool  state = true)
protectedvirtual

Set validate flag of background buffer.

Reimplemented from iview::CViewBase.

virtual void iview::CViewport::SetEditMode ( int  mode)
virtual

Set edit mode.

Reimplemented from iview::CViewBase.

virtual void iview::CViewport::SetFitArea ( const i2d::CRectangle area)
virtual

Set area will be used to fit in some zoom modes.

See Also
SetZoom(ZoomMode)

Reimplemented from iview::CViewBase.

virtual void iview::CViewport::SetMousePointer ( MousePointerMode  mode)
protectedvirtual

Set mouse pointer.

You have to implement it in your iview::CViewBase implementations.

Implements iview::CViewBase.

void iview::CViewport::ShapesChanged ( )
signal

Called when some shapes has been changed.

void iview::CViewport::UpdateFitTransform ( )
void iview::CViewport::UpdateRectArea ( const i2d::CRect rect)
protectedvirtual

Start updating specified rectangle area.

Implements iview::CViewBase.

Friends And Related Function Documentation

friend class CConsoleBase
friend

Definition at line 109 of file CViewport.h.


The documentation for this class was generated from the following file:

© 2007-2017 Witold Gantzke and Kirill Lepskiy