#include <GLViewer_ViewPort2d.h>
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_Grid * | getGrid () const |
Returns rectangular grid. More... | |
void | setGridColor (const QColor gridColor, const QColor axisColor) |
Returns grid color. More... | |
GLViewer_ViewFrame * | getViewFrame () const |
Returns parent window. More... | |
GLViewer_Widget * | getGLWidget () 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_Rect * | getBorder () 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_ViewFrame * | myViewFrame |
GLViewer_Widget * | myGLWidget |
GLViewer_Rect * | myBorder |
QColor | myBackgroundColor |
GLfloat | myMargin |
int | myHeight |
int | myWidth |
GLfloat | myXScale |
GLfloat | myYScale |
GLfloat | myXOldScale |
GLfloat | myYOldScale |
GLfloat | myXPan |
GLfloat | myYPan |
GLViewer_Grid * | myGrid |
GLViewer_Compass * | myCompass |
int | myIsDragProcess |
float * | myCurDragPosX |
float * | myCurDragPosY |
QPoint * | mypFirstPoint |
QPoint * | mypLastPoint |
bool | myIsPulling |
GLViewer_Object * | myPullingObject |
int | myViewPortId |
QtxToolTip * | myObjectTip |
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) |
Class GLViewer_ViewPort 2D visualisation canvas of GLViewer
|
private |
GLViewer_ViewPort2d::GLViewer_ViewPort2d | ( | QWidget * | parent, |
GLViewer_ViewFrame * | theViewFrame = NULL |
||
) |
Constructor
References aLastViewPostId, myBorder, myCompass, myCurDragPosX, myCurDragPosY, myGLWidget, myGrid, myIsDragProcess, myIsPulling, mypFirstPoint, mypLastPoint, myViewFrame, myViewPortId, and noDrag.
GLViewer_ViewPort2d::~GLViewer_ViewPort2d | ( | ) |
Destructor
References myBorder, myCompass, myGLWidget, myGrid, and myRectBand.
|
virtual |
Reimplemented from GLViewer_ViewPort.
References GLViewer_ViewPort::backgroundColor().
|
virtual |
Reimplemented from GLViewer_ViewPort.
References BS_Highlighting, BS_NoBlock, BS_Selection, inDrag, myCurDragPosX, myCurDragPosY, myIsDragProcess, mypFirstPoint, and mypLastPoint.
void GLViewer_ViewPort2d::drawCompass | ( | ) |
Draws compass
References GLViewer_Compass::BottomLeft, GLViewer_Compass::BottomRight, GLViewer_TexFont::drawString(), GLViewer_Compass::getArrowHeightBottom(), GLViewer_Compass::getArrowHeightTop(), GLViewer_Compass::getArrowWidthBottom(), GLViewer_Compass::getArrowWidthTop(), GLViewer_Compass::getColor(), GLViewer_Compass::getFont(), getHeight(), getPan(), GLViewer_Compass::getPos(), GLViewer_Widget::getRotation(), getScale(), GLViewer_Compass::getSize(), GLViewer_TexFont::getStringHeight(), GLViewer_TexFont::getStringWidth(), GLViewer_Compass::getVisible(), getWidth(), modelMatrix, myCompass, myGLWidget, PI, rotate_point(), rx, ry, SEGMENTS, STEP, and GLViewer_Compass::TopLeft.
void GLViewer_ViewPort2d::drawPulling | ( | GLViewer_Pnt | point | ) |
void GLViewer_ViewPort2d::drawSelectByRect | ( | int | x, |
int | y | ||
) |
Draws rectangle selection
x,y | - current point |
References mypFirstPoint, mypLastPoint, myRectBand, and selectionRect().
void GLViewer_ViewPort2d::endRotation | ( | ) |
Finishes rotation
References GLViewer_Widget::getRotation(), myGLWidget, rx, ry, and GLViewer_Widget::setRotationAngle().
void GLViewer_ViewPort2d::finishPulling | ( | ) |
void GLViewer_ViewPort2d::finishSelectByRect | ( | ) |
Finishes rectangle selection
References mypFirstPoint, mypLastPoint, and myRectBand.
|
protectedvirtual |
keepScale | = true, zoom does not change ) |
Transform view by view borders
keepScale | - if it is true, zoom does not change |
Implements GLViewer_ViewPort.
References GLViewer_Rect::bottom(), GLViewer_Widget::getRotation(), GLViewer_Rect::height(), GLViewer_Rect::left(), myBorder, myGLWidget, myGrid, myMargin, myXOldScale, myXPan, myXScale, myYOldScale, myYPan, myYScale, PI, GLViewer_Rect::right(), rotate_point(), rx, ry, GLViewer_Widget::setPan(), GLViewer_Grid::setPan(), GLViewer_Widget::setScale(), GLViewer_Grid::setZoom(), GLViewer_Rect::top(), vpUpdateValues(), and GLViewer_Rect::width().
|
protectedvirtual |
Transforms view by rectangle
rect | - rectangle |
Implements GLViewer_ViewPort.
References GLViewer_Widget::getRotation(), myGLWidget, myGrid, myXPan, myXScale, myYPan, myYScale, PI, rx, ry, GLViewer_Widget::setPan(), GLViewer_Grid::setPan(), GLViewer_Widget::setScale(), and GLViewer_Grid::setZoom().
|
protectedvirtual |
Transforms view by selection
Implements GLViewer_ViewPort.
References fitRect(), GLViewer_Viewer2d::getGLContext(), GLViewer_ViewFrame::getViewer(), getViewFrame(), GLViewer_Viewer2d::getWinObjectRect(), GLViewer_Context::InitSelected(), GLViewer_Context::MoreSelected(), GLViewer_Context::NextSelected(), GLViewer_Context::SelectedObject(), and SELECTION_RECT_GAP.
|
inline |
References myBorder.
|
inline |
References myGLWidget.
|
inline |
References myGrid.
|
inline |
References myHeight.
|
inline |
References myMargin.
|
inlinevirtual |
Reimplemented from GLViewer_ViewPort.
References myGLWidget.
|
inline |
|
inline |
|
inline |
References myViewFrame.
|
inline |
References myViewPortId.
|
inline |
References myWidth.
QRect GLViewer_ViewPort2d::GLV2win | ( | const GLViewer_Rect & | theRect | ) | const |
Convert rectangle in GL co-ordinates to window co-ordinates
References GLViewer_Rect::bottom(), GLViewer_Rect::left(), modelMatrix, GLViewer_Rect::right(), and GLViewer_Rect::top().
void GLViewer_ViewPort2d::initResize | ( | int | x, |
int | y | ||
) |
Resize view
References GLViewer_Rect::bottom(), GLViewer_Rect::left(), myBorder, myGLWidget, myGrid, myHeight, myMargin, myWidth, myXPan, myXScale, myYPan, myYScale, GLViewer_Rect::right(), GLViewer_Grid::setResize(), GLViewer_Widget::setScale(), GLViewer_Rect::top(), and zoom().
|
inline |
References myIsDragProcess.
|
inline |
References myIsPulling.
|
protectedvirtual |
Custom mouse double click event handler
Reimplemented from GLViewer_ViewPort.
References GLViewer_ViewPort::mouseDoubleClickEvent(), and myIsMouseReleaseBlock.
|
protectedvirtual |
Emits 'mouseEvent' signal. [ virtual protected ]
Reimplemented from GLViewer_ViewPort.
References inDrag, myIsDragProcess, onDragObject(), and GLViewer_ViewPort::vpMouseEvent().
|
protectedvirtual |
Emits 'mouseEvent' signal. [ virtual protected ]
Reimplemented from GLViewer_ViewPort.
References GLViewer_ViewTransformer::accelKey(), GLViewer_Context::getCurrentObject(), GLViewer_Viewer2d::getGLContext(), GLViewer_ViewFrame::getViewer(), getViewFrame(), inDrag, myIsDragProcess, GLViewer_Context::NbSelected(), and GLViewer_ViewPort::vpMouseEvent().
|
protectedvirtual |
Emits 'mouseEvent' signal. [ virtual protected ]
Reimplemented from GLViewer_ViewPort.
References GLViewer_Object::finishMove(), GLViewer_Context::getCurrentObject(), GLViewer_Viewer2d::getGLContext(), GLViewer_ViewFrame::getViewer(), getViewFrame(), inDrag, GLViewer_Context::InitSelected(), GLViewer_Context::MoreSelected(), myCurDragPosX, myCurDragPosY, myIsDragProcess, myIsMouseReleaseBlock, GLViewer_Context::NextSelected(), noDrag, objectMoved(), GLViewer_Context::SelectedObject(), GLViewer_Viewer2d::updateBorders(), and GLViewer_ViewPort::vpMouseEvent().
|
signal |
|
protectedslot |
SLOT: copies object to clipboard
References GLViewer_ViewFrame::getViewer(), getViewFrame(), GLViewer_Context::InitSelected(), GLViewer_Context::MoreSelected(), GLViewer_Context::NbSelected(), GLViewer_Context::NextSelected(), and GLViewer_Context::SelectedObject().
|
protectedslot |
SLOT: cuts object to clipboard
References GLViewer_Context::deleteObject(), GLViewer_ViewFrame::getViewer(), getViewFrame(), GLViewer_Context::InitSelected(), GLViewer_Context::MoreSelected(), GLViewer_Context::NbSelected(), GLViewer_Context::NextSelected(), and GLViewer_Context::SelectedObject().
|
protected |
SLOT: called when object is being dragged
References GLViewer_Context::getCurrentObject(), GLViewer_Viewer2d::getGLContext(), GLViewer_ViewFrame::getViewer(), getViewFrame(), GLViewer_Context::InitSelected(), GLViewer_Context::isSelected(), GLViewer_Context::MoreSelected(), GLViewer_Object::moveObject(), myCurDragPosX, myCurDragPosY, myGLWidget, GLViewer_Context::NbSelected(), GLViewer_Context::NextSelected(), GLViewer_Context::SelectedObject(), and GLViewer_Viewer2d::transPoint().
|
protectedslot |
text | to |
theTextReg | and on |
theViewReg | whan 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().
|
protectedslot |
SLOT: pastes object from clipboard
|
protectedslot |
SLOT: initializes drag process
References initDrag, myCurDragPosX, myCurDragPosY, myIsDragProcess, and noDrag.
|
protectedvirtual |
Custom paint event handler
Reimplemented from GLViewer_ViewPort.
References myGLWidget, and GLViewer_ViewPort::paintEvent().
|
protectedvirtual |
Sets offset to view
dx | - X offset |
dy | - Y offset |
Implements GLViewer_ViewPort.
References GLViewer_Widget::getRotation(), myGLWidget, myGrid, myXPan, myXScale, myYPan, myYScale, PI, rx, ry, GLViewer_Widget::setPan(), GLViewer_Grid::setPan(), and GLViewer_Widget::setScale().
|
protectedvirtual |
Resets view to start state
Implements GLViewer_ViewPort.
References GLViewer_Widget::getHeight(), GLViewer_Widget::getWidth(), myGLWidget, myGrid, myXPan, myXScale, myYPan, myYScale, GLViewer_Widget::setPan(), GLViewer_Grid::setPan(), GLViewer_Widget::setRotation(), GLViewer_Widget::setRotationAngle(), GLViewer_Widget::setScale(), GLViewer_Grid::setZoom(), and zoom().
|
protectedvirtual |
Custom resize event handler
void GLViewer_ViewPort2d::rotate | ( | int | intX, |
int | intY | ||
) |
Performs rotation
intX,intY | - current point |
References GLViewer_Widget::getRotation(), GLViewer_Widget::getRotationAngle(), GLViewer_Widget::getRotationStart(), myGLWidget, PI, rx, ry, and GLViewer_Widget::setRotation().
QRect GLViewer_ViewPort2d::selectionRect | ( | ) |
References mypFirstPoint, and mypLastPoint.
|
virtual |
Changes background color
color | - new background color |
Reimplemented from GLViewer_ViewPort.
References myGLWidget, and GLViewer_ViewPort::setBackgroundColor().
|
inline |
References myBorder.
|
protectedvirtual |
Sets view center in global coords
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().
Changes grid color
gridColor | - new grid color |
axisColor | - new axis color |
References myGrid, GLViewer_Grid::setAxisColor(), and GLViewer_Grid::setGridColor().
|
inline |
References myMargin.
bool GLViewer_ViewPort2d::startPulling | ( | GLViewer_Pnt | point | ) |
void GLViewer_ViewPort2d::startRotation | ( | int | x, |
int | y | ||
) |
Begins rotation
x,y | - start point |
References myGLWidget, and GLViewer_Widget::setRotationStart().
void GLViewer_ViewPort2d::startSelectByRect | ( | int | x, |
int | y | ||
) |
Initializes rectangle selection
x,y | - start point |
References mypFirstPoint, mypLastPoint, myRectBand, and Plot2d::Rectangle.
void GLViewer_ViewPort2d::turnCompass | ( | GLboolean | on | ) |
Creates or deletes compass
on | - if it is true, then to create |
References myCompass, and GLViewer_Compass::TopRight.
void GLViewer_ViewPort2d::turnGrid | ( | GLboolean | on | ) |
Creates or deletes grid
on | - if it is true, then to create |
References GRID_XSIZE, GRID_YSIZE, HEIGHT, myGrid, myXPan, myXScale, myYPan, myYScale, and WIDTH.
|
signal |
GLViewer_Rect GLViewer_ViewPort2d::win2GLV | ( | const QRect & | theRect | ) | const |
Convert rectangle in window co-ordinates to GL co-ordinates
References modelMatrix, GLViewer_Rect::setBottom(), GLViewer_Rect::setLeft(), GLViewer_Rect::setRight(), and GLViewer_Rect::setTop().
|
protectedvirtual |
Implements GLViewer_ViewPort.
References myGLWidget, myGrid, myXPan, myXScale, myYPan, myYScale, GLViewer_Widget::setPan(), GLViewer_Widget::setScale(), and GLViewer_Grid::setZoom().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |