#include <CurveCreator_Widget.h>
Public Types | |
enum | ActionFlags { NoFlags = 0x00000000, DisableDetectionMode = 0x00000001, DisableNewSection = 0x00000002, DisableClosedSection = 0x00000004 } |
enum | ActionMode { NoneMode, AdditionMode, ModificationMode, DetectionMode } |
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, int theLocalPointRowLimit=20) | |
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) |
Protected 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 | 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) |
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) |
QAction * | getAction (ActionId theId) |
QAction * | getAction (ActionMode theMode) |
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 | updateLocalPointView () |
void | setLocalPointContext (const bool theOpen, const bool isUpdateTable=false) |
void | setDragStarted (const bool theState, const QPoint &thePoint=QPoint()) |
Set drag operation started. More... | |
void | getSelectedPoints (CurveCreator_ICurve::SectionToPointList &thePoints) |
void | setSelectedPoints (const CurveCreator_ICurve::SectionToPointList &=CurveCreator_ICurve::SectionToPointList()) |
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 whethe the container has the value. More... | |
Private Attributes | |
QMap< ActionId, QAction * > | myActionMap |
CurveCreator_ICurve * | myCurve |
CurveCreator_TreeView * | mySectionView |
CurveCreator_TableView * | myLocalPointView |
CurveCreator_ICurve::SectionToPointList | myLocalPoints |
CurveCreator_NewSectionDlg * | myNewSectionEditor |
OCCViewer_Viewer * | myOCCViewer |
int | myLocalPointRowLimit |
int | mySection |
int | myPointNum |
bool | myDragStarted |
QPoint | myDragStartPosition |
int | myDragInteractionStyle |
CurveCreator_ICurve::SectionToPointList | myDragPoints |
QMap < CurveCreator_ICurve::SectionToPoint, CurveCreator::Coordinates > | myInitialDragPointsCoords |
bool | myDragged |
QByteArray | myGuiState |
OCCViewer_ViewWindow::Mode2dType | myOld2DMode |
|
protected |
|
explicit |
References ADDITION_MODE_ID, BRING_TOGETHER_ID, CLEAR_ALL_ID, CLOSE_SECTIONS_ID, createAction(), DETECTION_MODE_ID, DisableClosedSection, DisableNewSection, JOIN_ALL_ID, JOIN_ID, MODIFICATION_MODE_ID, myCurve, myLocalPointView, myNewSectionEditor, mySectionView, NEW_SECTION_ID, onAdditionMode(), onAddNewSection(), onBringTogether(), onCancelSection(), onCellChanged(), onClearAll(), onCloseSections(), onContextMenu(), onDetectionMode(), onEditSection(), onJoin(), onJoinAll(), onModeChanged(), onModificationMode(), onModifySection(), onNewSection(), onRedo(), onRemove(), onSelectionChanged(), onSetPolyline(), onSetSpline(), onUncloseSections(), onUndo(), REDO_ID, REMOVE_ID, selectionChanged(), SET_SECTIONS_POLYLINE_ID, SET_SECTIONS_SPLINE_ID, UNCLOSE_SECTIONS_ID, UNDO_ID, updateActionsStates(), and updateUndoRedo().
|
protected |
|
private |
int CurveCreator_Widget::changeInteractionStyle | ( | int | theStyle | ) |
|
private |
theList | a container of values |
theValue | a value |
References CurveCreator_UtilsICurve::contains().
|
private |
References CurveCreator_UtilsICurve::convert().
|
private |
References myActionMap.
|
private |
theX | the X coordinate of the point |
theY | the Y coordinate of the point |
References CurveCreator_UtilsICurve::findLocalPointIndex(), and myCurve.
|
private |
References CurveCreator_UtilsICurve::findSectionsToPoints(), and myCurve.
|
private |
Open local context and select given points inside it.
thePoints | a list of curve selected points |
References getActionMode(), ModificationMode, setLocalPointContext(), setSelectedPoints(), and updateUndoRedo().
|
private |
References myActionMap, and NULL.
|
private |
References ADDITION_MODE_ID, AdditionMode, DETECTION_MODE_ID, DetectionMode, MODIFICATION_MODE_ID, ModificationMode, myActionMap, and NONE_ID.
CurveCreator_Widget::ActionMode CurveCreator_Widget::getActionMode | ( | ) | const |
References ADDITION_MODE_ID, AdditionMode, DETECTION_MODE_ID, DetectionMode, MODIFICATION_MODE_ID, ModificationMode, myActionMap, and NoneMode.
|
private |
References myOCCViewer.
|
private |
References myLocalPoints.
QList< int > CurveCreator_Widget::getSelectedSections | ( | ) |
References CurveCreator_TreeView::getSelectedSections(), and mySectionView.
OCCViewer_ViewPort3d * CurveCreator_Widget::getViewPort | ( | ) |
References getOCCViewer().
CurveCreator_Widget::Handle | ( | AIS_InteractiveContext | ) |
|
private |
References CurveCreator_ICurve::addPoints(), aView, findSectionsToPoints(), finishCurveModification(), CurveCreator_ICurve::getNbPoints(), getViewPort(), Handle(), myCurve, mySectionView, CurveCreator_Utils::pointOnObject(), CurveCreator_TreeView::pointsAdded(), setSelectedPoints(), and startCurveModification().
|
private |
|
protectedslot |
References CurveCreator_TreeView::getSelectedSections(), Handle(), myCurve, myPointNum, mySection, and mySectionView.
|
protectedslot |
References CurveCreator_ICurve::addSection(), CurveCreator_NewSectionDlg::getName(), CurveCreator_NewSectionDlg::getSectionType(), CurveCreator_UtilsICurve::getUniqSectionName(), CurveCreator_NewSectionDlg::isClosed(), myCurve, myNewSectionEditor, mySectionView, onCancelSection(), CurveCreator_TreeView::sectionAdded(), CurveCreator_NewSectionDlg::setSectionName(), updateActionsStates(), and updateUndoRedo().
|
protectedslot |
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().
|
protectedslot |
References myNewSectionEditor, and subOperationFinished().
|
protectedslot |
|
protectedslot |
|
protectedslot |
|
protectedslot |
|
protectedslot |
|
protectedslot |
References CurveCreator_ICurve::getSectionName(), CurveCreator_ICurve::getSectionType(), CurveCreator_ICurve::isClosed(), myCurve, myNewSectionEditor, mySection, CurveCreator_NewSectionDlg::setEditMode(), CurveCreator_NewSectionDlg::setSectionParameters(), stopActionMode(), and subOperationStarted().
|
protectedslot |
|
protectedslot |
|
protectedslot |
theManager | a viewer manager |
References myOCCViewer.
|
protectedslot |
|
protectedslot |
References myLocalPointView.
|
protectedslot |
References CurveCreator_NewSectionDlg::getName(), CurveCreator_ICurve::getSectionName(), CurveCreator_NewSectionDlg::getSectionType(), CurveCreator_ICurve::getSectionType(), CurveCreator_NewSectionDlg::isClosed(), CurveCreator_ICurve::isClosed(), myCurve, myNewSectionEditor, mySection, mySectionView, onCancelSection(), CurveCreator_TreeView::sectionChanged(), CurveCreator_ICurve::setClosed(), CurveCreator_ICurve::setSectionName(), CurveCreator_ICurve::setSectionType(), and updateUndoRedo().
|
protectedslot |
theWindow | an owner of the signal |
theEvent | a mouse event |
References END_MEASURE_TIME, getActionMode(), ModificationMode, moveSelectedPoints(), myDragStarted, myDragStartPosition, and START_MEASURE_TIME.
|
protectedslot |
References onMouseMove().
|
protectedslot |
theWindow | an owner of the signal |
theEvent | a mouse event |
References addCoordsByClick(), AdditionMode, getActionMode(), ModificationMode, myStartPoint, and setDragStarted().
|
protectedslot |
References onMousePress().
|
protectedslot |
theWindow | an owner of the signal |
theEvent | a mouse event |
References AdditionMode, aView, CurveCreator_ICurve::canPointsBeSorted(), END_MEASURE_TIME, finishCurveModification(), getActionMode(), CurveCreator_ICurve::getNbPoints(), CurveCreator_ICurve::getNbSections(), getOCCViewer(), CurveCreator_ICurve::getPoint(), Handle(), insertPointToSelectedSegment(), ModificationMode, myCurve, myDragged, myDragPoints, myDragStarted, myEndPoint, myInitialDragPointsCoords, myStartPoint, CurveCreator_ICurve::saveCoordDiff(), setDragStarted(), setSelectedPoints(), CurveCreator_ICurve::setSeveralPoints(), CurveCreator_ICurve::setSkipSorting(), START_MEASURE_TIME, startCurveModification(), updateLocalPointView(), and updateUndoRedo().
|
protectedslot |
References onMouseRelease().
|
protectedslot |
|
protectedslot |
|
protectedslot |
References getActionMode(), ModificationMode, myCurve, NoneMode, removePoint(), and removeSection().
|
protectedslot |
References selectionChanged(), updateActionsStates(), and updateUndoRedo().
|
protectedslot |
|
protectedslot |
|
protectedslot |
|
protectedslot |
|
protectedslot |
bool CurveCreator_Widget::removeEnabled | ( | ) |
|
private |
Updates undo/redo status
References finishCurveModification(), getSelectedPoints(), myCurve, mySectionView, CurveCreator_ICurve::removeSeveralPoints(), CurveCreator_TreeView::reset(), and startCurveModification().
|
private |
Updates undo/redo status
References CurveCreator_TreeView::getSelectedSections(), myCurve, mySectionView, CurveCreator_ICurve::removeSection(), CurveCreator_TreeView::sectionsRemoved(), stopActionMode(), and updateUndoRedo().
void CurveCreator_Widget::removeSelected | ( | ) |
References onRemove().
void CurveCreator_Widget::reset | ( | ) |
References stopActionMode().
|
signal |
void CurveCreator_Widget::setActionMode | ( | const ActionMode & | theMode | ) |
References AdditionMode, DetectionMode, getAction(), getActionMode(), ModificationMode, NoneMode, onAdditionMode(), onModeChanged(), and onModificationMode().
void CurveCreator_Widget::setCurve | ( | CurveCreator_ICurve * | theCurve | ) |
|
private |
Save the position and a list of dragged points
theState | the drag operation state: started/finished |
thePoint | the start drag position |
References changeInteractionStyle(), getSelectedPoints(), myCurve, myDragged, myDragInteractionStyle, myDragPoints, myDragStarted, myDragStartPosition, myInitialDragPointsCoords, and CurveCreator_ICurve::setSkipSorting().
|
private |
References myCurve, CurveCreator_Utils::setLocalPointContext(), and updateLocalPointView().
void CurveCreator_Widget::setOCCViewer | ( | OCCViewer_Viewer * | theViewer | ) |
References myOCCViewer, onLastViewClosed(), onMouseMove(), onMousePress(), onMouseRelease(), setLocalPointContext(), and SetViewer2DMode().
|
private |
References Handle(), myCurve, myDragStarted, CurveCreator_Utils::setSelectedPoints(), and updateLocalPointView().
void CurveCreator_Widget::setSelectedSections | ( | const QList< int > & | theSections | ) |
void CurveCreator_Widget::SetViewer2DMode | ( | const bool | To2D | ) |
References myOCCViewer, and myOld2DMode.
|
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.
thePoints | an output list of curve selected points |
theFillPoints | a flag whether the selection list should be filled |
References getSelectedPoints(), and setLocalPointContext().
|
private |
References NoneMode, and setActionMode().
|
signal |
|
signal |
|
private |
References ADDITION_MODE_ID, AdditionMode, BRING_TOGETHER_ID, CLEAR_ALL_ID, CLOSE_SECTIONS_ID, DETECTION_MODE_ID, DetectionMode, getActionMode(), CurveCreator_ICurve::getNbPoints(), CurveCreator_ICurve::getNbSections(), CurveCreator_TreeView::getSelectedSections(), CurveCreator_TreeView::getSelectionType(), CurveCreator_NewSectionDlg::isEnableClosed(), JOIN_ALL_ID, JOIN_ID, MODIFICATION_MODE_ID, ModificationMode, myActionMap, myCurve, myNewSectionEditor, myPointNum, mySection, mySectionView, NEW_SECTION_ID, NoneMode, REMOVE_ID, removeEnabled(), SET_SECTIONS_POLYLINE_ID, SET_SECTIONS_SPLINE_ID, CurveCreator_TreeView::ST_NOSEL, CurveCreator_TreeView::ST_SECTIONS, and UNCLOSE_SECTIONS_ID.
|
private |
|
private |
References CurveCreator_ICurve::getNbRedo(), CurveCreator_ICurve::getNbUndo(), myActionMap, myCurve, REDO_ID, and UNDO_ID.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
protected |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
protected |