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

#include <GLViewer_ViewPort2d.h>

Inheritance diagram for GLViewer_ViewPort2d:
Inheritance graph

Signals

void vpUpdateValues ()
 Emits after any transformation. More...
 
void objectMoved ()
 
- Signals inherited from GLViewer_ViewPort
void vpKeyEvent (QKeyEvent *)
 
void vpMouseEvent (QMouseEvent *)
 
void vpWheelEvent (QWheelEvent *)
 
void vpDrawExternal (QPainter *)
 
void contextMenuRequested (QContextMenuEvent *)
 

Public Member Functions

 GLViewer_ViewPort2d (QWidget *parent, GLViewer_ViewFrame *theViewFrame=NULL)
 
 ~GLViewer_ViewPort2d ()
 
void turnGrid (GLboolean on)
 On/off rectangular grid. More...
 
GLViewer_GridgetGrid () const
 Returns rectangular grid. More...
 
void setGridColor (const QColor gridColor, const QColor axisColor)
 Returns grid color. More...
 
GLViewer_ViewFramegetViewFrame () const
 Returns parent window. More...
 
GLViewer_WidgetgetGLWidget () const
 Returns painted widget. More...
 
virtual QPaintDevice * getPaintDevice ()
 
void setBackgroundColor (const QColor &color)
 Sets background color. More...
 
QColor backgroundColor () const
 Returns background color. More...
 
void setBorder (GLViewer_Rect *border)
 Sets borders of scene. More...
 
GLViewer_RectgetBorder () const
 Get current borders of scene. More...
 
void setMargin (GLfloat margin)
 Sets margin of borders. More...
 
GLfloat getMargin () const
 Returns margin of borders. More...
 
int getWidth () const
 Returns width of view. More...
 
int getHeight () const
 Returns height of view. More...
 
void getScale (GLfloat &xSc, GLfloat &ySc) const
 Returns scale factors. More...
 
void getPan (GLfloat &xPan, GLfloat &yPan) const
 returns offsets More...
 
void initResize (int width, int height)
 Resize view. More...
 
void startRotation (int, int)
 Begins rotation. More...
 
void rotate (int, int)
 Process rotation. More...
 
void endRotation ()
 Completes rotation. More...
 
bool isDragProcess ()
 Checks of dragging process state. More...
 
void turnCompass (GLboolean on)
 On/off compass. More...
 
void drawCompass ()
 Draws compass. More...
 
int getViewPortId ()
 Returns unique ID of ViewPort. More...
 
virtual BlockStatus currentBlock ()
 Redefined method. More...
 
void startSelectByRect (int x, int y)
 Initializes before selecting by rect. More...
 
void drawSelectByRect (int x, int y)
 Draw selecting rectandle. More...
 
void finishSelectByRect ()
 Pass rect into selector and update. More...
 
bool startPulling (GLViewer_Pnt)
 It is for ouv More...
 
void drawPulling (GLViewer_Pnt)
 It is for ouv More...
 
void finishPulling ()
 It is for ouv More...
 
bool isPulling () const
 It is for ouv More...
 
QRect selectionRect ()
 Returns selection by rect. More...
 
GLViewer_Rect win2GLV (const QRect &) const
 Transforms window rect to global rect. More...
 
QRect GLV2win (const GLViewer_Rect &) const
 Transforms global rect to window rect. More...
 
- Public Member Functions inherited from GLViewer_ViewPort
 GLViewer_ViewPort (QWidget *parent)
 
 ~GLViewer_ViewPort ()
 
void setSketchingEnabled (bool)
 Activates/deactivates sketching. More...
 
bool isSketchingEnabled () const
 Checks active status of sketcher. More...
 
void setTransformEnabled (bool)
 Activates/deactivates transformer. More...
 
bool isTransformEnabled () const
 Checks active status of transformer. More...
 
void redrawPainters ()
 Redraw external pa inters. More...
 
virtual void onUpdate ()
 Updates view. More...
 

Protected Slots

void onStartDragObject ()
 Initializes drag process. More...
 
void onPasteObject ()
 Pastes object from clipboard. More...
 
void onCutObject ()
 Cuts object to clipboard. More...
 
void onCopyObject ()
 Copies object to clipboard. More...
 
void onMaybeTip (QPoint thePoint, QString &text, QFont &font, QRect &theTextReg, QRect &theViewReg)
 Sets tool tip with. More...
 
- Protected Slots inherited from GLViewer_ViewPort
virtual void onChangeBgColor ()
 

Protected Member Functions

void onDragObject (QMouseEvent *)
 
virtual void mouseMoveEvent (QMouseEvent *)
 
virtual void mousePressEvent (QMouseEvent *)
 
virtual void mouseReleaseEvent (QMouseEvent *)
 
virtual void mouseDoubleClickEvent (QMouseEvent *)
 
virtual void paintEvent (QPaintEvent *)
 
virtual void resizeEvent (QResizeEvent *)
 
virtual void reset ()
 Returns view to begin state. More...
 
virtual void pan (int dx, int dy)
 Sets offset to view. More...
 
virtual void setCenter (int x, int y)
 Sets view center in global coords. More...
 
virtual void zoom (int x0, int y0, int x1, int y1)
 Process zoming transformation with mouse tracking from ( x0, y0 ) to ( x1, y1 ) More...
 
virtual void fitRect (const QRect &)
 Transforms view by rectangle. More...
 
virtual void fitSelect ()
 Transforms view by selection. More...
 
virtual void fitAll (bool keepScale=false, bool withZ=true)
 Transform view by view borders ( if. More...
 
- Protected Member Functions inherited from GLViewer_ViewPort
void selectVisualId (ViewType)
 
virtual void contextMenuEvent (QContextMenuEvent *e)
 
virtual void keyPressEvent (QKeyEvent *)
 
virtual void keyReleaseEvent (QKeyEvent *)
 
virtual void wheelEvent (QWheelEvent *)
 

Protected Attributes

GLViewer_ViewFramemyViewFrame
 
GLViewer_WidgetmyGLWidget
 
GLViewer_RectmyBorder
 
QColor myBackgroundColor
 
GLfloat myMargin
 
int myHeight
 
int myWidth
 
GLfloat myXScale
 
GLfloat myYScale
 
GLfloat myXOldScale
 
GLfloat myYOldScale
 
GLfloat myXPan
 
GLfloat myYPan
 
GLViewer_GridmyGrid
 
GLViewer_CompassmyCompass
 
int myIsDragProcess
 
float * myCurDragPosX
 
float * myCurDragPosY
 
QPoint * mypFirstPoint
 
QPoint * mypLastPoint
 
bool myIsPulling
 
GLViewer_ObjectmyPullingObject
 
int myViewPortId
 
QtxToolTipmyObjectTip
 
bool myIsMouseReleaseBlock
 flag to block mouse release event just after mouse double-click More...
 
QRubberBand * myRectBand
 selection rectangle rubber band More...
 
- Protected Attributes inherited from GLViewer_ViewPort
bool myEnableSketching
 
bool myEnableTransform
 
bool myPaintersRedrawing
 

Private Types

enum  vpDragState { noDrag, initDrag, inDrag }
 Dragging states. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from GLViewer_ViewPort
static QCursor * getDefaultCursor ()
 
static void setDefaultCursor (const QCursor &newCursor)
 
static QCursor * getRotCursor ()
 
static void setRotCursor (const QCursor &newCursor)
 
static QCursor * getSketchCursor ()
 
static void setSketchCursor (const QCursor &newCursor)
 
- Protected Types inherited from GLViewer_ViewPort
enum  ViewType { Type2D, Type3D }
 
- Static Protected Member Functions inherited from GLViewer_ViewPort
static void createCursors ()
 STATICS. More...
 
static void destroyCursors ()
 
static QCursor * getHandCursor ()
 
static void setHandCursor (const QCursor &newCursor)
 
static QCursor * getPanCursor ()
 
static void setPanCursor (const QCursor &newCursor)
 
static QCursor * getPanglCursor ()
 
static void setPanglCursor (const QCursor &newCursor)
 
static QCursor * getZoomCursor ()
 
static void setZoomCursor (const QCursor &newCursor)
 

Detailed Description

Class GLViewer_ViewPort 2D visualisation canvas of GLViewer

Member Enumeration Documentation

Enumerator
noDrag 
initDrag 
inDrag 

Constructor & Destructor Documentation

GLViewer_ViewPort2d::GLViewer_ViewPort2d ( QWidget parent,
GLViewer_ViewFrame theViewFrame = NULL 
)
GLViewer_ViewPort2d::~GLViewer_ViewPort2d ( )

Destructor

References myBorder, myCompass, myGLWidget, myGrid, and myRectBand.

Member Function Documentation

QColor GLViewer_ViewPort2d::backgroundColor ( ) const
virtual
Returns
background color

Reimplemented from GLViewer_ViewPort.

References GLViewer_ViewPort::backgroundColor().

BlockStatus GLViewer_ViewPort2d::currentBlock ( )
virtual
Returns
blocking status for current started operations

Reimplemented from GLViewer_ViewPort.

References BS_Highlighting, BS_NoBlock, BS_Selection, inDrag, myCurDragPosX, myCurDragPosY, myIsDragProcess, mypFirstPoint, and mypLastPoint.

void GLViewer_ViewPort2d::drawSelectByRect ( int  x,
int  y 
)

Draws rectangle selection

Parameters
x,y- current point

References mypFirstPoint, mypLastPoint, myRectBand, and selectionRect().

void GLViewer_ViewPort2d::endRotation ( )
void GLViewer_ViewPort2d::finishPulling ( )
void GLViewer_ViewPort2d::finishSelectByRect ( )

Finishes rectangle selection

References mypFirstPoint, mypLastPoint, and myRectBand.

void GLViewer_ViewPort2d::fitAll ( bool  keepScale = false,
bool  withZ = true 
)
protectedvirtual
void GLViewer_ViewPort2d::fitRect ( const QRect &  rect)
protectedvirtual
GLViewer_Rect* GLViewer_ViewPort2d::getBorder ( ) const
inline

References myBorder.

GLViewer_Widget* GLViewer_ViewPort2d::getGLWidget ( ) const
inline

References myGLWidget.

GLViewer_Grid* GLViewer_ViewPort2d::getGrid ( ) const
inline

References myGrid.

int GLViewer_ViewPort2d::getHeight ( ) const
inline

References myHeight.

GLfloat GLViewer_ViewPort2d::getMargin ( ) const
inline

References myMargin.

virtual QPaintDevice* GLViewer_ViewPort2d::getPaintDevice ( )
inlinevirtual

Reimplemented from GLViewer_ViewPort.

References myGLWidget.

void GLViewer_ViewPort2d::getPan ( GLfloat &  xPan,
GLfloat &  yPan 
) const
inline

References myXPan, and myYPan.

void GLViewer_ViewPort2d::getScale ( GLfloat &  xSc,
GLfloat &  ySc 
) const
inline

References myXScale, and myYScale.

GLViewer_ViewFrame* GLViewer_ViewPort2d::getViewFrame ( ) const
inline

References myViewFrame.

int GLViewer_ViewPort2d::getViewPortId ( )
inline

References myViewPortId.

int GLViewer_ViewPort2d::getWidth ( ) const
inline

References myWidth.

QRect GLViewer_ViewPort2d::GLV2win ( const GLViewer_Rect theRect) const

Convert rectangle in GL co-ordinates to window co-ordinates

Returns
converted rectangle

References GLViewer_Rect::bottom(), GLViewer_Rect::left(), modelMatrix, GLViewer_Rect::right(), and GLViewer_Rect::top().

bool GLViewer_ViewPort2d::isDragProcess ( )
inline

References myIsDragProcess.

bool GLViewer_ViewPort2d::isPulling ( ) const
inline

References myIsPulling.

void GLViewer_ViewPort2d::mouseDoubleClickEvent ( QMouseEvent *  e)
protectedvirtual

Custom mouse double click event handler

Reimplemented from GLViewer_ViewPort.

References GLViewer_ViewPort::mouseDoubleClickEvent(), and myIsMouseReleaseBlock.

void GLViewer_ViewPort2d::mouseMoveEvent ( QMouseEvent *  e)
protectedvirtual

Emits 'mouseEvent' signal. [ virtual protected ]

Reimplemented from GLViewer_ViewPort.

References inDrag, myIsDragProcess, onDragObject(), and GLViewer_ViewPort::vpMouseEvent().

void GLViewer_ViewPort2d::mousePressEvent ( QMouseEvent *  e)
protectedvirtual
void GLViewer_ViewPort2d::objectMoved ( )
signal
void GLViewer_ViewPort2d::onMaybeTip ( QPoint  thePoint,
QString &  theText,
QFont &  theFont,
QRect &  theTextReg,
QRect &  theRegion 
)
protectedslot
Parameters
textto
theTextRegand on
theViewRegwhan mouse is on
thePoint

SLOT: called when tooltip should be shown

References GLViewer_Context::getCurrentObject(), GLViewer_Object::getName(), GLViewer_Object::getToolTipText(), GLViewer_ViewFrame::getViewer(), getViewFrame(), and GLViewer_Object::isTooTipHTML().

void GLViewer_ViewPort2d::onPasteObject ( )
protectedslot

SLOT: pastes object from clipboard

void GLViewer_ViewPort2d::onStartDragObject ( )
protectedslot

SLOT: initializes drag process

References initDrag, myCurDragPosX, myCurDragPosY, myIsDragProcess, and noDrag.

void GLViewer_ViewPort2d::paintEvent ( QPaintEvent *  e)
protectedvirtual

Custom paint event handler

Reimplemented from GLViewer_ViewPort.

References myGLWidget, and GLViewer_ViewPort::paintEvent().

void GLViewer_ViewPort2d::pan ( int  dx,
int  dy 
)
protectedvirtual
void GLViewer_ViewPort2d::resizeEvent ( QResizeEvent *  e)
protectedvirtual

Custom resize event handler

void GLViewer_ViewPort2d::rotate ( int  intX,
int  intY 
)
QRect GLViewer_ViewPort2d::selectionRect ( )
Returns
rectangle selection

References mypFirstPoint, and mypLastPoint.

void GLViewer_ViewPort2d::setBackgroundColor ( const QColor &  color)
virtual

Changes background color

Parameters
color- new background color

Reimplemented from GLViewer_ViewPort.

References myGLWidget, and GLViewer_ViewPort::setBackgroundColor().

void GLViewer_ViewPort2d::setBorder ( GLViewer_Rect border)
inline

References myBorder.

void GLViewer_ViewPort2d::setCenter ( int  x,
int  y 
)
protectedvirtual

Sets view center in global coords

Parameters
x,y- global co-ordinates of center

Implements GLViewer_ViewPort.

References myGLWidget, myGrid, myXOldScale, myXPan, myXScale, myYOldScale, myYPan, myYScale, GLViewer_Widget::setPan(), GLViewer_Grid::setPan(), GLViewer_Widget::setScale(), and GLViewer_Grid::setZoom().

void GLViewer_ViewPort2d::setGridColor ( const QColor  gridColor,
const QColor  axisColor 
)

Changes grid color

Parameters
gridColor- new grid color
axisColor- new axis color

References myGrid, GLViewer_Grid::setAxisColor(), and GLViewer_Grid::setGridColor().

void GLViewer_ViewPort2d::setMargin ( GLfloat  margin)
inline

References myMargin.

void GLViewer_ViewPort2d::startRotation ( int  x,
int  y 
)

Begins rotation

Parameters
x,y- start point

References myGLWidget, and GLViewer_Widget::setRotationStart().

void GLViewer_ViewPort2d::startSelectByRect ( int  x,
int  y 
)

Initializes rectangle selection

Parameters
x,y- start point

References mypFirstPoint, mypLastPoint, myRectBand, and Plot2d::Rectangle.

void GLViewer_ViewPort2d::turnCompass ( GLboolean  on)

Creates or deletes compass

Parameters
on- if it is true, then to create

References myCompass, and GLViewer_Compass::TopRight.

void GLViewer_ViewPort2d::turnGrid ( GLboolean  on)

Creates or deletes grid

Parameters
on- if it is true, then to create

References GRID_XSIZE, GRID_YSIZE, HEIGHT, myGrid, myXPan, myXScale, myYPan, myYScale, and WIDTH.

void GLViewer_ViewPort2d::vpUpdateValues ( )
signal
GLViewer_Rect GLViewer_ViewPort2d::win2GLV ( const QRect &  theRect) const

Convert rectangle in window co-ordinates to GL co-ordinates

Returns
converted rectangle

References modelMatrix, GLViewer_Rect::setBottom(), GLViewer_Rect::setLeft(), GLViewer_Rect::setRight(), and GLViewer_Rect::setTop().

void GLViewer_ViewPort2d::zoom ( int  x0,
int  y0,
int  x,
int  y 
)
protectedvirtual

Member Data Documentation

QColor GLViewer_ViewPort2d::myBackgroundColor
protected
GLViewer_Rect* GLViewer_ViewPort2d::myBorder
protected
GLViewer_Compass* GLViewer_ViewPort2d::myCompass
protected
float* GLViewer_ViewPort2d::myCurDragPosX
protected
float* GLViewer_ViewPort2d::myCurDragPosY
protected
GLViewer_Widget* GLViewer_ViewPort2d::myGLWidget
protected
GLViewer_Grid* GLViewer_ViewPort2d::myGrid
protected
int GLViewer_ViewPort2d::myHeight
protected
int GLViewer_ViewPort2d::myIsDragProcess
protected
bool GLViewer_ViewPort2d::myIsMouseReleaseBlock
protected
bool GLViewer_ViewPort2d::myIsPulling
protected
GLfloat GLViewer_ViewPort2d::myMargin
protected
QtxToolTip* GLViewer_ViewPort2d::myObjectTip
protected
QPoint* GLViewer_ViewPort2d::mypFirstPoint
protected
QPoint* GLViewer_ViewPort2d::mypLastPoint
protected
GLViewer_Object* GLViewer_ViewPort2d::myPullingObject
protected
QRubberBand* GLViewer_ViewPort2d::myRectBand
protected
GLViewer_ViewFrame* GLViewer_ViewPort2d::myViewFrame
protected
int GLViewer_ViewPort2d::myViewPortId
protected
int GLViewer_ViewPort2d::myWidth
protected
GLfloat GLViewer_ViewPort2d::myXOldScale
protected
GLfloat GLViewer_ViewPort2d::myXPan
protected
GLfloat GLViewer_ViewPort2d::myXScale
protected
GLfloat GLViewer_ViewPort2d::myYOldScale
protected
GLfloat GLViewer_ViewPort2d::myYPan
protected
GLfloat GLViewer_ViewPort2d::myYScale
protected

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