Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GLViewer_Viewer2d Class Reference

#include <GLViewer_Viewer2d.h>

Inheritance diagram for GLViewer_Viewer2d:
Inheritance graph

Public Types

enum  GLSketchingType {
  None, Polyline, Arc, Curve,
  Scribble, Oval, Rectangle
}
 Type of sketcher operation. More...
 
enum  VectorFileType { POST_SCRIPT, HPGL }
 Type of export vector file. More...
 
enum  PaperType {
  A1 =0, A2, A3, A4,
  A5
}
 Type of paper for export to vector format. More...
 
- Public Types inherited from GLViewer_Viewer
enum  SelectionMode { NoSelection, Single, Multiple }
 
enum  TransformType {
  NoTransform, Reset, FitAll, FitRect,
  FitSelect, Zoom, PanGlobal, Pan,
  Rotate, UserTransform = 100
}
 
enum  SketchingType { NoSketching, Rect, UserSketching = 100 }
 
- Public Types inherited from SUIT_ViewModel
enum  HotOperation { PAN, ZOOM, ROTATE, FIT_AREA }
 
enum  InteractionStyle { STANDARD, KEY_FREE }
 
typedef QMap< HotOperation,
Qt::KeyboardModifiers > 
StatesMap
 
typedef QMap< HotOperation,
Qt::MouseButtons > 
ButtonsMap
 
typedef QMap< InteractionStyle,
StatesMap
InteractionStyle2StatesMap
 
typedef QMap< InteractionStyle,
ButtonsMap
InteractionStyle2ButtonsMap
 

Public Slots

void onChangeBgColor ()
 Changes background color. More...
 
void onCreateGLMarkers (int number=1000, int size=5)
 Creates set of marker number. More...
 
void onCreateGLPolyline (int number=100, int angles=10, int size=100)
 Creates set of polyline number. More...
 
void onCreateGLText (QString text="Text", int number=1)
 Creates set of text number. More...
 

Signals

void wheelZoomChange (bool)
 Signal needs for optimum recompute of zoom depending objects Warning: use recompute without update viewer. More...
 
- Signals inherited from GLViewer_Viewer
void selectionChanged (SelectionChangeStatus)
 

Public Member Functions

 GLViewer_Viewer2d (const QString &title)
 A constructor. More...
 
 ~GLViewer_Viewer2d ()
 A destructor. More...
 
virtual SUIT_ViewWindowcreateView (SUIT_Desktop *)
 Redefined method. More...
 
void addPopupItems (QMenu *)
 Adds item for change background color. More...
 
const QList< GLViewer_Drawer * > & getDrawers () const
 Returns all drawers. More...
 
GLViewer_ContextgetGLContext () const
 Returns context. More...
 
void updateColors (QColor colorH, QColor colorS)
 Updates colors for all drawers (does not work) More...
 
void updateBorders (GLViewer_Rect *theRect)
 Updates rect of global scene by adding new rect. More...
 
void updateBorders ()
 Recomputes global scene rect. More...
 
void updateAll ()
 Redraws all active objects by updating all drawers in all views. More...
 
void updateDrawers (GLboolean onlyUpdate, GLfloat scX=0.0, GLfloat scY=0.0)
 Updates all drawers with new scale factor. More...
 
void activateDrawers (QList< GLViewer_Object * > &theObjects, bool onlyUpdate, GLboolean swap=GL_FALSE)
 Activates drawers for objects from list. More...
 
void activateDrawer (GLViewer_Object *theObject, bool onlyUpdate, GLboolean swap=GL_FALSE)
 Activates drawer for. More...
 
void activateAllDrawers (bool onlyUpdate, GLboolean swap=GL_FALSE)
 Updates all drawers with new scale factor. More...
 
void transPoint (GLfloat &x, GLfloat &y)
 Translates point (x,y) from global CS to curreent viewer CS. More...
 
QRect * getWinObjectRect (GLViewer_Object *theObject)
 Returns object rect in window CS. More...
 
GLViewer_Rect getGLVRect (const QRect &) const
 Translates rect in window CS to rect in global CS. More...
 
QRect getQRect (const GLViewer_Rect &) const
 Translates rect in global CS to rect in window CS. More...
 
virtual void insertHeader (VectorFileType aType, QFile &hFile)
 Inserts common text lines starting file of. More...
 
virtual void insertEnding (VectorFileType aType, QFile &hFile)
 Inserts common text lines ending file of. More...
 
virtual bool translateTo (VectorFileType aType, QString FileName, PaperType aPType, double mmLeft, double mmRight, double mmTop, double mmBottom)
 Translates current view content to vector file. More...
 
void repaintView (GLViewer_ViewFrame *theView=NULL, bool makeCurrent=false)
 Repaints view. More...
 
- Public Member Functions inherited from GLViewer_Viewer
 GLViewer_Viewer (const QString &title)
 
 ~GLViewer_Viewer ()
 
virtual void setViewManager (SUIT_ViewManager *theViewManager)
 
virtual QString getType () const
 
virtual void contextMenuPopup (QMenu *)
 
void setSelectionMode (SelectionMode)
 
SelectionMode getSelectionMode () const
 
GLViewer_SelectorgetSelector () const
 
virtual void update (int=0)
 
void activateTransform (int)
 
void activateSketching (int)
 
GLViewer_ViewFramegetActiveView () const
 
- Public Member Functions inherited from SUIT_ViewModel
 SUIT_ViewModel ()
 
virtual ~SUIT_ViewModel ()
 
SUIT_ViewManagergetViewManager () const
 

Protected Slots

void onMouseEvent (SUIT_ViewWindow *, QMouseEvent *)
 
- Protected Slots inherited from GLViewer_Viewer
virtual void onKeyEvent (SUIT_ViewWindow *, QKeyEvent *)
 
virtual void onMouseEvent (SUIT_ViewWindow *, QMouseEvent *)
 
virtual void onWheelEvent (SUIT_ViewWindow *, QWheelEvent *)
 
virtual void onSelectionCancel ()
 
virtual void onSelectionDone (bool add, SelectionChangeStatus status)
 
virtual void onChangeBgColor ()
 

Protected Member Functions

GLViewer_SelectorcreateSelector ()
 Returns new selector. More...
 
GLViewer_ViewTransformercreateTransformer (int type)
 Returns new Transformer with type. More...
 
void transformCoordsToPS (double &x, double &y)
 Transforms point (x,y) in Viewer CS to Post Script CS. More...
 
void transformCoordsToHPGL (double &x, double &y)
 Transforms point (x,y) in Viewer CS to HPGL CS. More...
 
virtual void startOperations (QMouseEvent *)
 Starts any operations on mouse event. More...
 
virtual bool updateOperations (QMouseEvent *)
 Updates started operations on mouse event. More...
 
virtual void finishOperations (QMouseEvent *)
 Completes started operations on mouse event. More...
 
virtual void startOperations (QWheelEvent *)
 Starts any operations on mouse wheel event. More...
 
- Protected Member Functions inherited from GLViewer_Viewer
virtual void onSketchingStarted ()
 
virtual void onSketchingFinished ()
 
virtual void onTransformationStarted ()
 
virtual void onTransformationFinished ()
 
virtual void onSelectionModeChanged ()
 
virtual void unhilightDetected ()
 
virtual bool eventFilter (QObject *, QEvent *)
 
virtual GLViewer_ViewSketchercreateSketcher (int)
 

Protected Attributes

GLViewer_ContextmyGLContext
 Current context. More...
 
QList< GLViewer_Drawer * > myDrawers
 Map of active drawers. More...
 
- Protected Attributes inherited from GLViewer_Viewer
GLViewer_SelectormySelector
 
SelectionMode mySelMode
 
GLViewer_ViewSketchermySketcher
 
GLViewer_ViewTransformermyTransformer
 
- Protected Attributes inherited from SUIT_ViewModel
SUIT_ViewManagermyViewManager
 

Private Member Functions

bool testRotation (QMouseEvent *)
 Rotation transformation. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from GLViewer_Viewer
static QString Type ()
 
- Static Public Attributes inherited from SUIT_ViewModel
static InteractionStyle2StatesMap myStateMap
 
static InteractionStyle2ButtonsMap myButtonMap
 

Detailed Description

OpenGL Viewer 2D

Member Enumeration Documentation

Enumerator
None 
Polyline 
Arc 
Curve 
Scribble 
Oval 
Rectangle 
Enumerator
A1 
A2 
A3 
A4 
A5 
Enumerator
POST_SCRIPT 
HPGL 

Constructor & Destructor Documentation

GLViewer_Viewer2d::GLViewer_Viewer2d ( const QString &  title)

Constructor

Parameters
title- viewer title

References createSelector(), GLViewer_Viewer::Multiple, myDrawers, myGLContext, and GLViewer_Viewer::mySelMode.

GLViewer_Viewer2d::~GLViewer_Viewer2d ( )

Destructor

References GLViewer_TexFont::clearTextBases().

Member Function Documentation

void GLViewer_Viewer2d::activateAllDrawers ( bool  onlyUpdate,
GLboolean  swap = GL_FALSE 
)
void GLViewer_Viewer2d::activateDrawer ( GLViewer_Object theObject,
bool  onlyUpdate,
GLboolean  swap = GL_FALSE 
)
Parameters
theObject

Activates drawer for

Parameters
theObject

References activateDrawers().

void GLViewer_Viewer2d::activateDrawers ( QList< GLViewer_Object * > &  theObjects,
bool  onlyUpdate,
GLboolean  swap = GL_FALSE 
)
void GLViewer_Viewer2d::addPopupItems ( QMenu thePopup)

Adds item for change background color

Parameters
thePopup- menu

References GLViewer_Viewer::getSelector(), and onChangeBgColor().

GLViewer_Selector * GLViewer_Viewer2d::createSelector ( )
protectedvirtual
Returns
new selector

Reimplemented from GLViewer_Viewer.

References getGLContext().

GLViewer_ViewTransformer * GLViewer_Viewer2d::createTransformer ( int  type)
protectedvirtual
Parameters
type
Returns
new Transformer
Parameters
type- type of new transformer

Reimplemented from GLViewer_Viewer.

SUIT_ViewWindow * GLViewer_Viewer2d::createView ( SUIT_Desktop theDesktop)
virtual

Create new instance of view window on desktop theDesktop.

Return values
SUIT_ViewWindow*- created view window pointer.

Reimplemented from SUIT_ViewModel.

const QList<GLViewer_Drawer*>& GLViewer_Viewer2d::getDrawers ( ) const
inline
GLViewer_Context* GLViewer_Viewer2d::getGLContext ( ) const
inline
GLViewer_Rect GLViewer_Viewer2d::getGLVRect ( const QRect &  theRect) const

Translates rect in window CS to rect in global CS

Parameters
theRect- rectangle to be translated
Returns
transformed rect

References GLViewer_Viewer::getActiveView(), GLViewer_ViewFrame::getViewPort(), and GLViewer_ViewPort2d::win2GLV().

QRect GLViewer_Viewer2d::getQRect ( const GLViewer_Rect theRect) const

Translates rect in global CS to rect in window CS

Parameters
theRect- rectangle to be translated
Returns
transformed rect

References GLViewer_Viewer::getActiveView(), GLViewer_ViewFrame::getViewPort(), and GLViewer_ViewPort2d::GLV2win().

void GLViewer_Viewer2d::insertEnding ( VectorFileType  aType,
QFile hFile 
)
virtual
Parameters
aType

Inserts text lines as ending for file

Parameters
aType- file type
hFile- file instance

References HPGL, and POST_SCRIPT.

void GLViewer_Viewer2d::insertHeader ( VectorFileType  aType,
QFile hFile 
)
virtual
Parameters
aType

Inserts text lines as header for file

Parameters
aType- file type
hFile- file instance

References HPGL, and POST_SCRIPT.

void GLViewer_Viewer2d::onChangeBgColor ( )
slot
void GLViewer_Viewer2d::onCreateGLMarkers ( int  theMarkersNum = 1000,
int  theMarkersRad = 5 
)
slot
void GLViewer_Viewer2d::onCreateGLPolyline ( int  theAnglesNum = 100,
int  theRadius = 10,
int  thePolylineNumber = 100 
)
slot
void GLViewer_Viewer2d::onCreateGLText ( QString  theStr = "Text",
int  theTextNumber = 1 
)
slot
void GLViewer_Viewer2d::onMouseEvent ( SUIT_ViewWindow ,
QMouseEvent *  e 
)
protectedslot

Custom mouse event handler

References GLViewer_Viewer::getActiveView(), and GLViewer_Viewer::onMouseEvent().

void GLViewer_Viewer2d::repaintView ( GLViewer_ViewFrame theView = NULL,
bool  makeCurrent = false 
)
Parameters
theView.If
theView= NULL repaints all views.

Repaints view

Parameters
theView- view to be repainted. If it is NULL then all views will be repainted

References GLViewer_Drawer::addObject(), GLViewer_Viewer::getActiveView(), GLViewer_ViewPort2d::getGLWidget(), GLViewer_Context::getObjects(), GLViewer_ViewPort2d::getScale(), GLViewer_ViewFrame::getViewPort(), GLViewer_Object::getVisible(), myDrawers, myGLContext, and obj.

void GLViewer_Viewer2d::startOperations ( QMouseEvent *  e)
protectedvirtual
void GLViewer_Viewer2d::startOperations ( QWheelEvent *  e)
protectedvirtual
bool GLViewer_Viewer2d::testRotation ( QMouseEvent *  e)
private
void GLViewer_Viewer2d::transformCoordsToHPGL ( double &  x,
double &  y 
)
protected
void GLViewer_Viewer2d::transformCoordsToPS ( double &  x,
double &  y 
)
protected
bool GLViewer_Viewer2d::translateTo ( VectorFileType  aType,
QString  FileName,
PaperType  aPType,
double  mmLeft,
double  mmRight,
double  mmTop,
double  mmBottom 
)
virtual
void GLViewer_Viewer2d::transPoint ( GLfloat &  x,
GLfloat &  y 
)
void GLViewer_Viewer2d::updateAll ( )

Redraws all active objects by updating all drawers in all views

References GLViewer_Viewer::getActiveView(), SUIT_ViewModel::getViewManager(), and SUIT_ViewManager::getViews().

void GLViewer_Viewer2d::updateBorders ( GLViewer_Rect theRect)
void GLViewer_Viewer2d::updateColors ( QColor  colorH,
QColor  colorS 
)

References activateAllDrawers().

void GLViewer_Viewer2d::updateDrawers ( GLboolean  update,
GLfloat  scX = 0.0,
GLfloat  scY = 0.0 
)
Parameters
onlyUpdateis passed to method activateAllDrawers drawers

References activateAllDrawers().

bool GLViewer_Viewer2d::updateOperations ( QMouseEvent *  e)
protectedvirtual
void GLViewer_Viewer2d::wheelZoomChange ( bool  )
signal

Member Data Documentation

QList<GLViewer_Drawer*> GLViewer_Viewer2d::myDrawers
protected
GLViewer_Context* GLViewer_Viewer2d::myGLContext
protected

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