Version: 9.12.0
CurveCreator_Widget Class Reference

#include <CurveCreator_Widget.h>

Inheritance diagram for CurveCreator_Widget:
Inheritance graph

Public Types

enum  ActionFlags {
  NoFlags = 0x00000000 , DisableDetectionMode = 0x00000001 , DisableNewSection = 0x00000002 , DisableClosedSection = 0x00000004 ,
  DisableSetColor = 0x00000008
}
 
enum  ActionMode { NoneMode , AdditionMode , ModificationMode , DetectionMode }
 

Public Slots

void onAdditionMode (bool checked)
 
void onModificationMode (bool checked)
 
void onDetectionMode (bool checked)
 
void onModeChanged (bool checked)
 
void onNewSection ()
 
void onSelectionChanged ()
 
void onAddNewSection ()
 
void onEditSection (int theSection)
 
void onModifySection ()
 
void onCancelSection ()
 
void onJoin ()
 
void onBringTogether ()
 Set the same coordinates on two section extremities. More...
 
void onRemove ()
 
void onSetColor ()
 
void onClearAll ()
 
void onJoinAll ()
 
void onSetSpline ()
 
void onSetPolyline ()
 
void onCloseSections ()
 
void onUncloseSections ()
 
void onUndo ()
 
void onRedo ()
 
void onUndoSettings ()
 
void onContextMenu (QPoint thePoint)
 
void onMousePress (SUIT_ViewWindow *, QMouseEvent *theEvent)
 Manage mouse press events. More...
 
void onMouseRelease (SUIT_ViewWindow *, QMouseEvent *theEvent)
 Manage mouse release events in Modification mode. More...
 
void onMouseMove (SUIT_ViewWindow *, QMouseEvent *theEvent)
 Manage mouse move events in Modification mode. More...
 
void onLastViewClosed (SUIT_ViewManager *theManager)
 Set zero viewer by the last view closed in. More...
 
void onMousePress (QMouseEvent *theEvent)
 
void onMouseRelease (QMouseEvent *theEvent)
 
void onMouseMove (QMouseEvent *theEvent)
 
void onCellChanged (int theRow, int theColumn)
 

Signals

void selectionChanged ()
 
void subOperationStarted (QWidget *, bool)
 
void subOperationFinished (QWidget *)
 

Public Member Functions

 CurveCreator_Widget (QWidget *parent, CurveCreator_ICurve *theCurve, const int theActionFlags=NoFlags, const QStringList &theCoordTitles=QStringList(), Qt::WindowFlags fl=0)
 
void setOCCViewer (OCCViewer_Viewer *theViewer)
 Set an OCC viewer. More...
 
 Handle (AIS_InteractiveContext) getAISContext()
 
OCCViewer_ViewPort3d * getViewPort ()
 Returns OCC viewer view port. More...
 
int changeInteractionStyle (int theStyle)
 Set interaction style in the OCC viewer. More...
 
void reset ()
 
void setCurve (CurveCreator_ICurve *theCurve)
 
QList< int > getSelectedSections ()
 
void setSelectedSections (const QList< int > &theSections)
 
void removeSelected ()
 According to the widget state, performs the remove action. More...
 
bool removeEnabled ()
 Checks whether there are some selection to be removed. More...
 
void setActionMode (const ActionMode &theMode)
 
ActionMode getActionMode () const
 
void SetViewer2DMode (const bool To2D)
 
void setSelectedPoints (const CurveCreator_ICurve::SectionToPointList &=CurveCreator_ICurve::SectionToPointList())
 
void updateLocalPointView ()
 
void setLocalPointContext (const bool theOpen, const bool isUpdateTable=false)
 
QAction * getAction (ActionId theId)
 
QAction * getAction (ActionMode theMode)
 

Protected Types

enum  ActionId {
  NONE_ID , UNDO_ID , REDO_ID , NEW_SECTION_ID ,
  ADDITION_MODE_ID , REMOVE_ID , REMOVE_ALL_ID , JOIN_ID ,
  JOIN_ALL_ID , CLOSE_SECTIONS_ID , UNCLOSE_SECTIONS_ID , SET_SECTIONS_POLYLINE_ID ,
  SET_SECTIONS_SPLINE_ID , CLEAR_ALL_ID , SEPARATOR_ID , MODIFICATION_MODE_ID ,
  DETECTION_MODE_ID , BRING_TOGETHER_ID , SETCOLOR_ID
}
 

Protected Member Functions

void addCoordsByClick (QMouseEvent *)
 

Protected Attributes

QPoint myStartPoint
 
QPoint myEndPoint
 

Private Member Functions

OCCViewer_Viewer * getOCCViewer ()
 Returns current OCC viewer. More...
 
QAction * createAction (ActionId theId, const QString &theName, const QPixmap &theImage, const QString &theToolTip, const QKeySequence &theShortcut)
 
void updateActionsStates ()
 
void updateUndoRedo ()
 
void removeSection ()
 Removes a selected section from the curve. More...
 
void removePoint ()
 Removes a selected points from the curve. More...
 
void addNewPoint (const CurveCreator::Coordinates &theCoords)
 
void insertPointToSelectedSegment (const int theXPosition, const int theYPosition)
 
void moveSelectedPoints (const int theXPosition, const int theYPosition)
 
void setDragStarted (const bool theState, const QPoint &thePoint=QPoint())
 Set drag operation started. More...
 
void getSelectedPoints (CurveCreator_ICurve::SectionToPointList &thePoints)
 
void stopActionMode ()
 
void startCurveModification (CurveCreator_ICurve::SectionToPointList &thePoints, const bool theFillPoints=true)
 Get viewer information before perform the curve modification. More...
 
void finishCurveModification (const CurveCreator_ICurve::SectionToPointList &thePoints=CurveCreator_ICurve::SectionToPointList())
 Restore the viewer state after the curve modification is done. More...
 
int findLocalPointIndex (int theSectionId, double theX, double theY)
 Returns a point index in the model curve by the point coordinates in the viewer. More...
 
void findSectionsToPoints (const double theX, const double theY, CurveCreator_ICurve::SectionToPointList &thePoints)
 
void convert (const CurveCreator_ICurve::SectionToPointList &thePoints, QMap< int, QList< int > > &theConvPoints)
 
bool contains (const CurveCreator_ICurve::SectionToPointList &theList, const CurveCreator_ICurve::SectionToPoint &theValue) const
 Returns whether the container has the value. More...
 

Private Attributes

QMap< ActionId, QAction * > myActionMap
 
CurveCreator_ICurvemyCurve
 
CurveCreator_TreeViewmySectionView
 
CurveCreator_TableViewmyLocalPointView
 
CurveCreator_ICurve::SectionToPointList myLocalPoints
 
CurveCreator_NewSectionDlgmyNewSectionEditor
 
OCCViewer_Viewer * myOCCViewer
 
int myLocalPointRowLimit
 
int mySection
 
int myPointNum
 
bool myDragStarted
 
QPoint myDragStartPosition
 
int myDragInteractionStyle
 
CurveCreator_ICurve::SectionToPointList myDragPoints
 
QMap< CurveCreator_ICurve::SectionToPoint, CurveCreator::CoordinatesmyInitialDragPointsCoords
 
bool myDragged
 
QByteArray myGuiState
 
OCCViewer_ViewWindow::Mode2dType myOld2DMode
 

Member Enumeration Documentation

◆ ActionFlags

Enumerator
NoFlags 
DisableDetectionMode 
DisableNewSection 
DisableClosedSection 
DisableSetColor 

◆ ActionId

Enumerator
NONE_ID 
UNDO_ID 
REDO_ID 
NEW_SECTION_ID 
ADDITION_MODE_ID 
REMOVE_ID 
REMOVE_ALL_ID 
JOIN_ID 
JOIN_ALL_ID 
CLOSE_SECTIONS_ID 
UNCLOSE_SECTIONS_ID 
SET_SECTIONS_POLYLINE_ID 
SET_SECTIONS_SPLINE_ID 
CLEAR_ALL_ID 
SEPARATOR_ID 
MODIFICATION_MODE_ID 
DETECTION_MODE_ID 
BRING_TOGETHER_ID 
SETCOLOR_ID 

◆ ActionMode

Enumerator
NoneMode 
AdditionMode 
ModificationMode 
DetectionMode 

Constructor & Destructor Documentation

◆ CurveCreator_Widget()

Member Function Documentation

◆ addCoordsByClick()

void CurveCreator_Widget::addCoordsByClick ( QMouseEvent *  pe)
protected

◆ addNewPoint()

◆ changeInteractionStyle()

int CurveCreator_Widget::changeInteractionStyle ( int  theStyle)
Parameters
theStylea new style
Returns
the previous style

References getOCCViewer().

◆ contains()

bool CurveCreator_Widget::contains ( const CurveCreator_ICurve::SectionToPointList theList,
const CurveCreator_ICurve::SectionToPoint theValue 
) const
private
Parameters
theLista container of values
theValuea value

References CurveCreator_UtilsICurve::contains().

◆ convert()

void CurveCreator_Widget::convert ( const CurveCreator_ICurve::SectionToPointList thePoints,
QMap< int, QList< int > > &  theConvPoints 
)
private

◆ createAction()

QAction * CurveCreator_Widget::createAction ( ActionId  theId,
const QString &  theName,
const QPixmap &  theImage,
const QString &  theToolTip,
const QKeySequence &  theShortcut 
)
private

References myActionMap.

◆ findLocalPointIndex()

int CurveCreator_Widget::findLocalPointIndex ( int  theSectionId,
double  theX,
double  theY 
)
private
Parameters
theXthe X coordinate of the point
theYthe Y coordinate of the point

References CurveCreator_UtilsICurve::findLocalPointIndex(), and myCurve.

◆ findSectionsToPoints()

void CurveCreator_Widget::findSectionsToPoints ( const double  theX,
const double  theY,
CurveCreator_ICurve::SectionToPointList thePoints 
)
private

◆ finishCurveModification()

void CurveCreator_Widget::finishCurveModification ( const CurveCreator_ICurve::SectionToPointList thePoints = CurveCreator_ICurve::SectionToPointList())
private

Open local context and select given points inside it.

Parameters
thePointsa list of curve selected points

References getActionMode(), ModificationMode, setLocalPointContext(), setSelectedPoints(), and updateUndoRedo().

◆ getAction() [1/2]

QAction * CurveCreator_Widget::getAction ( ActionId  theId)

References myActionMap.

◆ getAction() [2/2]

QAction * CurveCreator_Widget::getAction ( ActionMode  theMode)

◆ getActionMode()

◆ getOCCViewer()

OCCViewer_Viewer * CurveCreator_Widget::getOCCViewer ( )
private

References myOCCViewer.

◆ getSelectedPoints()

void CurveCreator_Widget::getSelectedPoints ( CurveCreator_ICurve::SectionToPointList thePoints)
private

References myLocalPoints.

◆ getSelectedSections()

QList< int > CurveCreator_Widget::getSelectedSections ( )

◆ getViewPort()

OCCViewer_ViewPort3d * CurveCreator_Widget::getViewPort ( )

References getOCCViewer().

◆ Handle()

CurveCreator_Widget::Handle ( AIS_InteractiveContext  )

◆ insertPointToSelectedSegment()

◆ moveSelectedPoints()

◆ onAdditionMode

void CurveCreator_Widget::onAdditionMode ( bool  checked)
slot

◆ onAddNewSection

◆ onBringTogether

void CurveCreator_Widget::onBringTogether ( )
slot

Usage: build a closed contour with several sections. Works with two points selected, at the extremities of different sections. The second point gets the coordinates of the first.

References finishCurveModification(), getActionMode(), CurveCreator_ICurve::getNbPoints(), CurveCreator_UtilsICurve::getPoint(), ModificationMode, myCurve, myLocalPoints, CurveCreator_ICurve::setPoint(), and startCurveModification().

◆ onCancelSection

void CurveCreator_Widget::onCancelSection ( )
slot

◆ onCellChanged

◆ onClearAll

◆ onCloseSections

◆ onContextMenu

void CurveCreator_Widget::onContextMenu ( QPoint  thePoint)
slot

◆ onDetectionMode

void CurveCreator_Widget::onDetectionMode ( bool  checked)
slot

◆ onEditSection

◆ onJoin

◆ onJoinAll

◆ onLastViewClosed

void CurveCreator_Widget::onLastViewClosed ( SUIT_ViewManager *  theManager)
slot
Parameters
theManagera viewer manager

References myOCCViewer.

◆ onModeChanged

◆ onModificationMode

void CurveCreator_Widget::onModificationMode ( bool  checked)
slot

References myLocalPointView.

◆ onModifySection

◆ onMouseMove [1/2]

void CurveCreator_Widget::onMouseMove ( QMouseEvent *  theEvent)
slot

References onMouseMove().

◆ onMouseMove [2/2]

void CurveCreator_Widget::onMouseMove ( SUIT_ViewWindow *  ,
QMouseEvent *  theEvent 
)
slot
Parameters
theWindowan owner of the signal
theEventa mouse event

References END_MEASURE_TIME, getActionMode(), ModificationMode, moveSelectedPoints(), myDragStarted, myDragStartPosition, and START_MEASURE_TIME.

◆ onMousePress [1/2]

void CurveCreator_Widget::onMousePress ( QMouseEvent *  theEvent)
slot

References onMousePress().

◆ onMousePress [2/2]

void CurveCreator_Widget::onMousePress ( SUIT_ViewWindow *  ,
QMouseEvent *  theEvent 
)
slot
Parameters
theWindowan owner of the signal
theEventa mouse event

References addCoordsByClick(), AdditionMode, getActionMode(), ModificationMode, myStartPoint, and setDragStarted().

◆ onMouseRelease [1/2]

void CurveCreator_Widget::onMouseRelease ( QMouseEvent *  theEvent)
slot

References onMouseRelease().

◆ onMouseRelease [2/2]

◆ onNewSection

◆ onRedo

◆ onRemove

void CurveCreator_Widget::onRemove ( )
slot

◆ onSelectionChanged

◆ onSetColor

◆ onSetPolyline

◆ onSetSpline

◆ onUncloseSections

◆ onUndo

◆ onUndoSettings

void CurveCreator_Widget::onUndoSettings ( )
slot

◆ removeEnabled()

◆ removePoint()

◆ removeSection()

◆ removeSelected()

void CurveCreator_Widget::removeSelected ( )

References onRemove().

◆ reset()

void CurveCreator_Widget::reset ( )

References stopActionMode().

◆ selectionChanged

void CurveCreator_Widget::selectionChanged ( )
signal

◆ setActionMode()

void CurveCreator_Widget::setActionMode ( const ActionMode theMode)

◆ setCurve()

◆ setDragStarted()

void CurveCreator_Widget::setDragStarted ( const bool  theState,
const QPoint &  thePoint = QPoint() 
)
private

Save the position and a list of dragged points

Parameters
theStatethe drag operation state: started/finished
thePointthe start drag position

References changeInteractionStyle(), getSelectedPoints(), myCurve, myDragged, myDragInteractionStyle, myDragPoints, myDragStarted, myDragStartPosition, myInitialDragPointsCoords, and CurveCreator_ICurve::setSkipSorting().

◆ setLocalPointContext()

void CurveCreator_Widget::setLocalPointContext ( const bool  theOpen,
const bool  isUpdateTable = false 
)

◆ setOCCViewer()

void CurveCreator_Widget::setOCCViewer ( OCCViewer_Viewer *  theViewer)

◆ setSelectedPoints()

◆ setSelectedSections()

void CurveCreator_Widget::setSelectedSections ( const QList< int > &  theSections)

◆ SetViewer2DMode()

void CurveCreator_Widget::SetViewer2DMode ( const bool  To2D)

References myOCCViewer, and myOld2DMode.

◆ startCurveModification()

void CurveCreator_Widget::startCurveModification ( CurveCreator_ICurve::SectionToPointList thePoints,
const bool  theFillPoints = true 
)
private

Take a list of selected cuve points an close local context. The context should be closed because the curve presentation is redisplayed and if it is not closed, when we close the local context later, the presentation shown in the local context is disappeared.

Parameters
thePointsan output list of curve selected points
theFillPointsa flag whether the selection list should be filled

References getSelectedPoints(), and setLocalPointContext().

◆ stopActionMode()

void CurveCreator_Widget::stopActionMode ( )
private

References NoneMode, and setActionMode().

◆ subOperationFinished

void CurveCreator_Widget::subOperationFinished ( QWidget )
signal

◆ subOperationStarted

void CurveCreator_Widget::subOperationStarted ( QWidget ,
bool   
)
signal

◆ updateActionsStates()

◆ updateLocalPointView()

◆ updateUndoRedo()

void CurveCreator_Widget::updateUndoRedo ( )
private

Member Data Documentation

◆ myActionMap

QMap<ActionId, QAction*> CurveCreator_Widget::myActionMap
private

◆ myCurve

CurveCreator_ICurve* CurveCreator_Widget::myCurve
private

◆ myDragged

bool CurveCreator_Widget::myDragged
private

◆ myDragInteractionStyle

int CurveCreator_Widget::myDragInteractionStyle
private

◆ myDragPoints

CurveCreator_ICurve::SectionToPointList CurveCreator_Widget::myDragPoints
private

◆ myDragStarted

bool CurveCreator_Widget::myDragStarted
private

◆ myDragStartPosition

QPoint CurveCreator_Widget::myDragStartPosition
private

◆ myEndPoint

QPoint CurveCreator_Widget::myEndPoint
protected

◆ myGuiState

QByteArray CurveCreator_Widget::myGuiState
private

◆ myInitialDragPointsCoords

QMap<CurveCreator_ICurve::SectionToPoint, CurveCreator::Coordinates> CurveCreator_Widget::myInitialDragPointsCoords
private

◆ myLocalPointRowLimit

int CurveCreator_Widget::myLocalPointRowLimit
private

◆ myLocalPoints

CurveCreator_ICurve::SectionToPointList CurveCreator_Widget::myLocalPoints
private

◆ myLocalPointView

CurveCreator_TableView* CurveCreator_Widget::myLocalPointView
private

◆ myNewSectionEditor

CurveCreator_NewSectionDlg* CurveCreator_Widget::myNewSectionEditor
private

◆ myOCCViewer

OCCViewer_Viewer* CurveCreator_Widget::myOCCViewer
private

◆ myOld2DMode

OCCViewer_ViewWindow::Mode2dType CurveCreator_Widget::myOld2DMode
private

◆ myPointNum

int CurveCreator_Widget::myPointNum
private

◆ mySection

int CurveCreator_Widget::mySection
private

◆ mySectionView

CurveCreator_TreeView* CurveCreator_Widget::mySectionView
private

◆ myStartPoint

QPoint CurveCreator_Widget::myStartPoint
protected

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