Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 }
 
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 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
}
 

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_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::Coordinates
myInitialDragPointsCoords
 
bool myDragged
 
QByteArray myGuiState
 
OCCViewer_ViewWindow::Mode2dType myOld2DMode
 

Member Enumeration Documentation

Enumerator
NoFlags 
DisableDetectionMode 
DisableNewSection 
DisableClosedSection 
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 
Enumerator
NoneMode 
AdditionMode 
ModificationMode 
DetectionMode 

Constructor & Destructor Documentation

Member Function Documentation

void CurveCreator_Widget::addCoordsByClick ( QMouseEvent *  pe)
protected
int CurveCreator_Widget::changeInteractionStyle ( int  theStyle)
Parameters
theStylea new style
Returns
the previous style

References getOCCViewer().

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().

void CurveCreator_Widget::convert ( const CurveCreator_ICurve::SectionToPointList thePoints,
QMap< int, QList< int > > &  theConvPoints 
)
private
QAction * CurveCreator_Widget::createAction ( ActionId  theId,
const QString &  theName,
const QPixmap &  theImage,
const QString &  theToolTip,
const QKeySequence &  theShortcut 
)
private

References myActionMap.

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.

void CurveCreator_Widget::findSectionsToPoints ( const double  theX,
const double  theY,
CurveCreator_ICurve::SectionToPointList thePoints 
)
private
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().

QAction * CurveCreator_Widget::getAction ( ActionId  theId)
private

References myActionMap, and NULL.

QAction * CurveCreator_Widget::getAction ( ActionMode  theMode)
private
OCCViewer_Viewer * CurveCreator_Widget::getOCCViewer ( )
private

References myOCCViewer.

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

References myLocalPoints.

QList< int > CurveCreator_Widget::getSelectedSections ( )
OCCViewer_ViewPort3d * CurveCreator_Widget::getViewPort ( )

References getOCCViewer().

CurveCreator_Widget::Handle ( AIS_InteractiveContext  )
void CurveCreator_Widget::onAdditionMode ( bool  checked)
protectedslot
void CurveCreator_Widget::onBringTogether ( )
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().

void CurveCreator_Widget::onCancelSection ( )
protectedslot
void CurveCreator_Widget::onCellChanged ( int  theRow,
int  theColumn 
)
protectedslot
void CurveCreator_Widget::onContextMenu ( QPoint  thePoint)
protectedslot
void CurveCreator_Widget::onDetectionMode ( bool  checked)
protectedslot
void CurveCreator_Widget::onLastViewClosed ( SUIT_ViewManager *  theManager)
protectedslot
Parameters
theManagera viewer manager

References myOCCViewer.

void CurveCreator_Widget::onModificationMode ( bool  checked)
protectedslot

References myLocalPointView.

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

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

void CurveCreator_Widget::onMouseMove ( QMouseEvent *  theEvent)
protectedslot

References onMouseMove().

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

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

void CurveCreator_Widget::onMousePress ( QMouseEvent *  theEvent)
protectedslot

References onMousePress().

void CurveCreator_Widget::onMouseRelease ( QMouseEvent *  theEvent)
protectedslot

References onMouseRelease().

void CurveCreator_Widget::onRemove ( )
protectedslot
void CurveCreator_Widget::onSelectionChanged ( )
protectedslot
void CurveCreator_Widget::onUndoSettings ( )
protectedslot
void CurveCreator_Widget::removeSelected ( )

References onRemove().

void CurveCreator_Widget::reset ( )

References stopActionMode().

void CurveCreator_Widget::selectionChanged ( )
signal
void CurveCreator_Widget::setActionMode ( const ActionMode theMode)
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().

void CurveCreator_Widget::setLocalPointContext ( const bool  theOpen,
const bool  isUpdateTable = false 
)
private
void CurveCreator_Widget::setOCCViewer ( OCCViewer_Viewer *  theViewer)
void CurveCreator_Widget::setSelectedSections ( const QList< int > &  theSections)
void CurveCreator_Widget::SetViewer2DMode ( const bool  To2D)

References myOCCViewer, and myOld2DMode.

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().

void CurveCreator_Widget::stopActionMode ( )
private

References NoneMode, and setActionMode().

void CurveCreator_Widget::subOperationFinished ( QWidget )
signal
void CurveCreator_Widget::subOperationStarted ( QWidget ,
bool   
)
signal
void CurveCreator_Widget::updateUndoRedo ( )
private

Member Data Documentation

QMap<ActionId, QAction*> CurveCreator_Widget::myActionMap
private
CurveCreator_ICurve* CurveCreator_Widget::myCurve
private
bool CurveCreator_Widget::myDragged
private
int CurveCreator_Widget::myDragInteractionStyle
private
CurveCreator_ICurve::SectionToPointList CurveCreator_Widget::myDragPoints
private
bool CurveCreator_Widget::myDragStarted
private
QPoint CurveCreator_Widget::myDragStartPosition
private
QPoint CurveCreator_Widget::myEndPoint
protected
QByteArray CurveCreator_Widget::myGuiState
private
QMap<CurveCreator_ICurve::SectionToPoint, CurveCreator::Coordinates> CurveCreator_Widget::myInitialDragPointsCoords
private
int CurveCreator_Widget::myLocalPointRowLimit
private
CurveCreator_ICurve::SectionToPointList CurveCreator_Widget::myLocalPoints
private
CurveCreator_TableView* CurveCreator_Widget::myLocalPointView
private
CurveCreator_NewSectionDlg* CurveCreator_Widget::myNewSectionEditor
private
OCCViewer_Viewer* CurveCreator_Widget::myOCCViewer
private
OCCViewer_ViewWindow::Mode2dType CurveCreator_Widget::myOld2DMode
private
int CurveCreator_Widget::myPointNum
private
int CurveCreator_Widget::mySection
private
CurveCreator_TreeView* CurveCreator_Widget::mySectionView
private
QPoint CurveCreator_Widget::myStartPoint
protected

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