1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef ENTITYGUI_POLYLINEDLG_H
24 #define ENTITYGUI_POLYLINEDLG_H
26 #include <GEOMBase_Skeleton.h>
28 class CurveCreator_Curve;
29 class CurveCreator_Widget;
30 class OCCViewer_ViewManager;
34 //=================================================================================
35 // class : EntityGUI_PolylineDlg
37 //=================================================================================
38 class EntityGUI_PolylineDlg : public GEOMBase_Skeleton
44 EntityGUI_PolylineDlg (GeometryGUI*, QWidget* = 0,
45 bool = false, Qt::WindowFlags = 0);
47 virtual ~EntityGUI_PolylineDlg();
49 void deleteSelected();
52 void setPreviewZLayer( int theLayer );
53 int getPreviewZLayer() const;
57 // redefined from GEOMBase_Helper
58 virtual GEOM::GEOM_IOperations_ptr createOperation();
59 virtual bool isValid( QString& );
60 virtual bool execute( ObjectList& );
61 virtual QList<GEOM::GeomObjPtr> getSourceObjects();
64 * This method sets/gets the view manager to control the temporary
65 * displayed objects on Z layer.
66 * \param theManager the view manager.
68 void setPreviewManager( OCCViewer_ViewManager* theManager );
69 OCCViewer_ViewManager* getPreviewManager();
72 * This method defines a state of selection button.
73 * \return true if selection button is checked, otherwise false.
75 bool isCheckToSelect();
81 void enterEvent(QEvent *);
84 * This method converts the curve into curve parameters required to
85 * construct an object using the interface
86 * GEOM_ICurvesOperations::MakePolyline2DOnPlane.
88 * \param theCurve a curve object, that contains data.
89 * \param theCoordsList the list of coordinates list. theCoordsList[0]
90 * is the coordinates list of the first section. theCoordsList[1]
91 * is for the second section etc. Output parameter.
92 * \param theNamesList the list of names. The order corresponds to
93 * theCoordsList. Output parameter.
94 * \param theTypesList the list of curve types. The order corresponds to
95 * theCoordsList. Output parameter.
96 * \param theClosedList the list of Closed flags. The order corresponds to
97 * theCoordsList. Output parameter.
99 void GetCurveParams(GEOM::ListOfListOfDouble &theCoords,
100 GEOM::string_array &theNames,
101 GEOM::short_array &theTypes,
102 GEOM::ListOfBool &theCloseds);
105 * This method returns the current local coordinate system.
107 * \return local coordinate system.
109 gp_Ax3 GetActiveLocalCS();
112 * This method returns the current working plane. Can be null.
114 * \return the current working plane.
116 GEOM::GeomObjPtr GetActiveWPlane();
119 * This method add a local coordinate system of the selected object.
121 * \param theSelectedObject the selected object. It can be a planar face
122 * or an imported polyline.
123 * \param IsPlane true for planar face; false for imported polyline.
124 * \param theLCS the local coordinate system.
126 void AddLocalCS(GEOM::GeomObjPtr theSelectedObject,
128 const gp_Ax3 &theLCS);
131 * This method converts the working plane object into
132 * the local coordinate system of the polyline.
134 * \param theGeomObj the working plane
135 * \return the local coordinate system
137 gp_Ax3 WPlaneToLCS(GEOM::GeomObjPtr theGeomObj);
140 * This method displays the AIS_InteractiveObject(s) to preview
141 * on the Z layer and sets VIOLET color.
143 void displayPreview();
146 * This method erases AIS_InteractiveObject(s) from
147 * AIS_InteractiveContext and release memory.
155 void processStartedSubOperation( QWidget*, bool );
156 void processFinishedSubOperation( QWidget* );
157 void SetEditCurrentArgument( bool );
158 void SelectionIntoArgument( bool isForced = false );
159 void ActivateThisDialog();
160 void ActivateLocalCS();
164 CurveCreator_Curve *myCurve;
165 CurveCreator_Widget *myEditorWidget;
166 QGroupBox *myAddElementBox;
167 QComboBox *myPlnComboBox;
168 QPushButton *myPlnButton;
169 QPushButton *myPlnSelButton;
170 QPushButton *myPolylineSelButton;
171 QLineEdit *myWPlaneLineEdit;
172 QLineEdit *myPolylineEdit;
173 QLineEdit *myEditCurrentArgument; /* Current LineEdit */
174 QList<gp_Ax3> myLCSList;
175 QList<GEOM::GeomObjPtr> myWPlaneList;
176 OCCViewer_ViewManager* myPreviewManager;
181 #endif // ENTITYGUI_POLYLINEDLG_H