1 // Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef CURVECREATOR_WIDGET_H
21 #define CURVECREATOR_WIDGET_H
23 //#include "CurveCreator_ICurve.hxx"
24 #include "CurveCreator.hxx"
25 #include "CurveCreator_Macro.hxx"
30 #include <SUIT_ViewWindow.h>
32 class OCCViewer_Viewer;
37 class CurveCreator_ICurve;
38 class CurveCreator_TreeView;
39 class CurveCreator_NewPointDlg;
40 class CurveCreator_NewSectionDlg;
42 class CURVECREATOR_EXPORT CurveCreator_Widget : public QWidget
46 explicit CurveCreator_Widget( QWidget* parent,
47 CurveCreator_ICurve *theCurve,
48 Qt::WindowFlags fl=0 );
50 OCCViewer_Viewer* getOCCViewer();
52 //virtual bool eventFilter( QObject* theWatched, QEvent* theEvent );
54 //! Return unique section name
55 std::string getUniqSectionName(CurveCreator_ICurve* theCurve) const;
57 void setCurve( CurveCreator_ICurve* theCurve );
59 QList<int> getSelectedSections();
60 QList< QPair< int, int > > getSelectedPoints();
63 void selectionChanged();
64 void subOperationStarted( QWidget* );
65 void subOperationFinished( QWidget* );
70 void onAdditionMode(bool checked);
71 void onModificationMode(bool checked);
72 void onDetectionMode(bool checked);
73 void onModeChanged(bool checked);
75 void onSelectionChanged();
76 void onAddNewPoint(const CurveCreator::Coordinates& theCoords);
77 void onAddNewSection();
78 void onEditSection( int theSection );
79 void onModifySection();
80 void onCancelSection();
87 void onCloseSections();
88 void onUncloseSections();
91 void onUndoSettings();
92 void onContextMenu(QPoint thePoint);
93 void onGetCoordsByClick( SUIT_ViewWindow*, QMouseEvent* );
94 void onPointSelect( SUIT_ViewWindow*, QMouseEvent* );
95 void onPointDrag( SUIT_ViewWindow*, QMouseEvent* );
96 void onLocalPointChanged( int theRow, int theColumn );
98 enum ActionId{ UNDO_ID,
108 SET_SECTIONS_POLYLINE_ID,
109 SET_SECTIONS_SPLINE_ID,
112 MODIFICATION_MODE_ID,
116 QAction* createAction( ActionId theId, const QString& theName, const QPixmap& theImage,
117 const QString& theToolTip, const QKeySequence& theShortcut );
118 QAction* getAction(ActionId theId);
119 void updateUndoRedo();
120 int findLocalPointIndex( int theSectionId, float theX, float theY );
121 void updateLocalPointView();
122 void setLocalPointContext( const bool theOpen );
123 void addLocalPointToTable( const double theX, const double theY );
125 void getSelectedPonts( const int theSectionId, QList<int>& thePoints );
126 void setSelectedPonts( const int theSectionId, const QList<int>& thePoints );
129 QMap<ActionId, QAction*> myActionMap;
130 CurveCreator_ICurve* myCurve;
131 CurveCreator_TreeView* mySectionView;
132 QTableWidget* myLocalPointView;
133 CurveCreator_NewSectionDlg* myNewSectionEditor;
136 QPoint myDragStartPosition;
137 QByteArray myGuiState;
140 #endif // CURVECREATOR_WIDGET_H