#include <GLViewer_Viewer2d.h>
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_ViewWindow * | createView (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_Context * | getGLContext () 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_Selector * | getSelector () const |
virtual void | update (int=0) |
void | activateTransform (int) |
void | activateSketching (int) |
GLViewer_ViewFrame * | getActiveView () const |
Public Member Functions inherited from SUIT_ViewModel | |
SUIT_ViewModel () | |
virtual | ~SUIT_ViewModel () |
SUIT_ViewManager * | getViewManager () 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_Selector * | createSelector () |
Returns new selector. More... | |
GLViewer_ViewTransformer * | createTransformer (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_ViewSketcher * | createSketcher (int) |
Protected Attributes | |
GLViewer_Context * | myGLContext |
Current context. More... | |
QList< GLViewer_Drawer * > | myDrawers |
Map of active drawers. More... | |
Protected Attributes inherited from GLViewer_Viewer | |
GLViewer_Selector * | mySelector |
SelectionMode | mySelMode |
GLViewer_ViewSketcher * | mySketcher |
GLViewer_ViewTransformer * | myTransformer |
Protected Attributes inherited from SUIT_ViewModel | |
SUIT_ViewManager * | myViewManager |
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 |
OpenGL Viewer 2D
GLViewer_Viewer2d::GLViewer_Viewer2d | ( | const QString & | title | ) |
Constructor
title | - viewer title |
References createSelector(), GLViewer_Viewer::Multiple, myDrawers, myGLContext, and GLViewer_Viewer::mySelMode.
GLViewer_Viewer2d::~GLViewer_Viewer2d | ( | ) |
Destructor
References GLViewer_TexFont::clearTextBases().
void GLViewer_Viewer2d::activateAllDrawers | ( | bool | onlyUpdate, |
GLboolean | swap = GL_FALSE |
||
) |
onlyUpdate | is passed to drawers |
References activateDrawers(), GLViewer_Viewer::getActiveView(), GLViewer_Context::getObjects(), GLViewer_Object::getVisible(), myGLContext, and obj.
void GLViewer_Viewer2d::activateDrawer | ( | GLViewer_Object * | theObject, |
bool | onlyUpdate, | ||
GLboolean | swap = GL_FALSE |
||
) |
void GLViewer_Viewer2d::activateDrawers | ( | QList< GLViewer_Object * > & | theObjects, |
bool | onlyUpdate, | ||
GLboolean | swap = GL_FALSE |
||
) |
theObjects | only |
Activates drawers for objects from list
theObjects | only |
References GLViewer_Drawer::addObject(), GLViewer_Drawer::create(), GLViewer_Viewer::getActiveView(), GLViewer_ViewPort2d::getGLWidget(), GLViewer_Drawer::getPriority(), GLViewer_ViewPort2d::getScale(), SUIT_ViewModel::getViewManager(), GLViewer_ViewFrame::getViewPort(), SUIT_ViewManager::getViews(), and myDrawers.
void GLViewer_Viewer2d::addPopupItems | ( | QMenu * | thePopup | ) |
Adds item for change background color
thePopup | - menu |
References GLViewer_Viewer::getSelector(), and onChangeBgColor().
|
protectedvirtual |
|
protectedvirtual |
type |
type | - type of new transformer |
Reimplemented from GLViewer_Viewer.
|
virtual |
Create new instance of view window on desktop theDesktop.
SUIT_ViewWindow* | - created view window pointer. |
Reimplemented from SUIT_ViewModel.
|
protectedvirtual |
Completes started operation on mouse event
Reimplemented from GLViewer_Viewer.
References GLViewer_Selector::appendKey(), GLViewer_ViewPort2d::finishPulling(), GLViewer_ViewPort2d::finishSelectByRect(), GLViewer_Viewer::getActiveView(), GLViewer_Context::getCurrentObject(), GLViewer_Viewer::getSelector(), GLViewer_ViewPort2d::isPulling(), myGLContext, GLViewer_Selector::select(), GLViewer_ViewPort2d::selectionRect(), and updateAll().
|
inline |
|
inline |
GLViewer_Rect GLViewer_Viewer2d::getGLVRect | ( | const QRect & | theRect | ) | const |
Translates rect in window CS to rect in global CS
theRect | - rectangle to be translated |
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
theRect | - rectangle to be translated |
References GLViewer_Viewer::getActiveView(), GLViewer_ViewFrame::getViewPort(), and GLViewer_ViewPort2d::GLV2win().
QRect * GLViewer_Viewer2d::getWinObjectRect | ( | GLViewer_Object * | theObject | ) |
theObject | - object |
References GLViewer_Viewer::getActiveView(), GLViewer_ViewPort2d::getGLWidget(), GLViewer_ViewPort2d::getHeight(), GLViewer_ViewPort2d::getPan(), GLViewer_Object::getRect(), GLViewer_Widget::getRotationAngle(), GLViewer_ViewPort2d::getScale(), GLViewer_ViewFrame::getViewPort(), GLViewer_ViewPort2d::getWidth(), PI, and GLViewer_Rect::toQRect().
|
virtual |
aType |
Inserts text lines as ending for file
aType | - file type |
hFile | - file instance |
References HPGL, and POST_SCRIPT.
|
virtual |
aType |
Inserts text lines as header for file
aType | - file type |
hFile | - file instance |
References HPGL, and POST_SCRIPT.
|
slot |
Changes background color
References GLViewer_ViewPort2d::backgroundColor(), GLViewer_Viewer::getActiveView(), GLViewer_ViewFrame::getViewPort(), and GLViewer_ViewPort2d::setBackgroundColor().
|
slot |
number | and radius = |
size |
Creates set of marker
theMarkersNum | - number of markers |
theMarkersRad | - radius of markers |
References activateAllDrawers(), GLViewer_Viewer::activateTransform(), GLViewer_MarkerSet::compute(), GLViewer_Viewer::FitAll, GLViewer_Viewer::getActiveView(), getGLContext(), GLViewer_ViewPort2d::getHeight(), GLViewer_Object::getRect(), GLViewer_ViewFrame::getViewPort(), GLViewer_ViewPort2d::getWidth(), GLViewer_Context::insertObject(), PI, GLViewer_MarkerSet::setXCoord(), GLViewer_MarkerSet::setYCoord(), and updateBorders().
|
slot |
number,number | of angles = |
angles | and diameter = |
size |
Creates GL polyline
theAnglesNum | - number of angles |
theRadius | - radius |
thePolylineNumber | - number |
References activateAllDrawers(), GLViewer_Viewer::activateTransform(), GLViewer_Polyline::compute(), GLViewer_Viewer::FitAll, GLViewer_Viewer::getActiveView(), getGLContext(), GLViewer_ViewPort2d::getHeight(), GLViewer_Object::getRect(), GLViewer_ViewFrame::getViewPort(), GLViewer_ViewPort2d::getWidth(), GLViewer_Context::insertObject(), PI, GLViewer_Polyline::setClosed(), GLViewer_Polyline::setHighSelAll(), GLViewer_Polyline::setXCoord(), GLViewer_Polyline::setYCoord(), and updateBorders().
|
slot |
number | and with text = |
text |
Creates text
theStr | - text string |
theTextNumber | - number |
References activateAllDrawers(), GLViewer_TextObject::compute(), GLViewer_Viewer::getActiveView(), getGLContext(), GLViewer_ViewPort2d::getHeight(), GLViewer_Object::getRect(), GLViewer_ViewFrame::getViewPort(), GLViewer_ViewPort2d::getWidth(), GLViewer_Context::insertObject(), PI, and updateBorders().
|
protectedslot |
Custom mouse event handler
References GLViewer_Viewer::getActiveView(), and GLViewer_Viewer::onMouseEvent().
void GLViewer_Viewer2d::repaintView | ( | GLViewer_ViewFrame * | theView = NULL , |
bool | makeCurrent = false |
||
) |
theView. | If |
theView | = NULL repaints all views. |
Repaints view
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.
|
protectedvirtual |
Starts some operation on mouse event
Reimplemented from GLViewer_Viewer.
References BS_Selection, GLViewer_ViewPort2d::currentBlock(), GLViewer_Viewer::getActiveView(), GLViewer_Context::getCurrentObject(), myGLContext, GLViewer_ViewPort2d::startPulling(), GLViewer_ViewPort2d::startSelectByRect(), and transPoint().
|
protectedvirtual |
Starts some operation on mouse wheel event
Reimplemented from GLViewer_Viewer.
References GLViewer_Context::InitSelected(), GLViewer_Context::MoreSelected(), myGLContext, GLViewer_Context::NextSelected(), GLViewer_Context::SelectedObject(), GLViewer_Viewer::update(), updateAll(), GLViewer_Object::updateZoom(), and wheelZoomChange().
|
private |
Rotation transformation
References GLViewer_ViewTransformer::accelKey(), GLViewer_Viewer::activateTransform(), GLViewer_Viewer::Rotate, and GLViewer_View2dTransformer::rotateButton().
|
protected |
|
protected |
|
virtual |
Translates current view content to vector file
aType | - type of file |
FileName | - name of file, |
aPType | - paper size type |
mmLeft,mmRight,mmTop,mmBottom | - margins |
References GLViewer_CoordSystem::Cartesian, GLViewer_Viewer::getActiveView(), GLViewer_ViewPort2d::getGLWidget(), GLViewer_ViewPort2d::getHeight(), GLViewer_ViewPort2d::getPan(), GLViewer_Widget::getRotationAngle(), GLViewer_ViewPort2d::getScale(), GLViewer_ViewFrame::getViewPort(), GLViewer_ViewPort2d::getWidth(), HPGL, insertEnding(), insertHeader(), mm2custom(), myDrawers, POST_SCRIPT, Sizes, and GLViewer_Widget::translateBackgroundToPS().
void GLViewer_Viewer2d::transPoint | ( | GLfloat & | x, |
GLfloat & | y | ||
) |
Translates point from global CS to curreent viewer CS
x,y | - co-ordinates to be translated |
References GLViewer_Viewer::getActiveView(), GLViewer_ViewPort2d::getGLWidget(), GLViewer_ViewPort2d::getHeight(), GLViewer_ViewPort2d::getPan(), GLViewer_Widget::getRotationAngle(), GLViewer_ViewPort2d::getScale(), GLViewer_ViewFrame::getViewPort(), GLViewer_ViewPort2d::getWidth(), and PI.
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 | ) |
Updates rect of global scene by adding new rectangle
theRect | - rectangle |
References GLViewer_Rect::bottom(), SUIT_ViewModel::getViewManager(), SUIT_ViewManager::getViews(), GLViewer_Rect::left(), GLViewer_Rect::right(), GLViewer_Rect::setBottom(), GLViewer_Rect::setLeft(), GLViewer_Rect::setRight(), GLViewer_Rect::setTop(), and GLViewer_Rect::top().
void GLViewer_Viewer2d::updateBorders | ( | ) |
Recomputes global scene rect
References GLViewer_Rect::bottom(), GLViewer_Context::getObjects(), GLViewer_Object::getRect(), SUIT_ViewModel::getViewManager(), SUIT_ViewManager::getViews(), GLViewer_Object::getVisible(), GLViewer_Rect::isEmpty(), GLViewer_Object::isSelectable(), GLViewer_Rect::left(), myGLContext, GLViewer_Rect::right(), GLViewer_Rect::setBottom(), GLViewer_Rect::setCoords(), GLViewer_Rect::setIsEmpty(), GLViewer_Rect::setLeft(), GLViewer_Rect::setRight(), GLViewer_Rect::setTop(), and GLViewer_Rect::top().
void GLViewer_Viewer2d::updateColors | ( | QColor | colorH, |
QColor | colorS | ||
) |
References activateAllDrawers().
void GLViewer_Viewer2d::updateDrawers | ( | GLboolean | update, |
GLfloat | scX = 0.0 , |
||
GLfloat | scY = 0.0 |
||
) |
onlyUpdate | is passed to method activateAllDrawers drawers |
References activateAllDrawers().
|
protectedvirtual |
Updates started operation on mouse event
Reimplemented from GLViewer_Viewer.
References GLViewer_ViewPort2d::drawPulling(), GLViewer_ViewPort2d::drawSelectByRect(), GLViewer_Viewer::getActiveView(), GLViewer_Context::getCurrentObject(), GLViewer_ViewPort2d::isPulling(), myGLContext, transPoint(), and updateAll().
|
signal |
|
protected |
|
protected |