Salome HOME
0022377: EDF 2752 GEOM: Add a preference in order to automatically unpublished parent...
[modules/geom.git] / src / EntityGUI / EntityGUI_PolylineDlg.h
1 // Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #ifndef ENTITYGUI_POLYLINEDLG_H
24 #define ENTITYGUI_POLYLINEDLG_H
25
26
27 #include <GEOMBase_Skeleton.h>
28
29 class CurveCreator_Curve;
30 class CurveCreator_Widget;
31 class QGroupBox;
32 class QComboBox;
33
34
35 //=================================================================================
36 // class    : EntityGUI_PolylineDlg
37 // purpose  :
38 //=================================================================================
39 class EntityGUI_PolylineDlg : public GEOMBase_Skeleton
40 {
41   Q_OBJECT
42
43 public:
44
45   EntityGUI_PolylineDlg (GeometryGUI*, QWidget* = 0,
46                          bool = false, Qt::WindowFlags = 0);
47
48   virtual ~EntityGUI_PolylineDlg();
49
50   void  deleteSelected();
51   bool  deleteEnabled();
52
53 protected:
54
55   // redefined from GEOMBase_Helper
56   virtual GEOM::GEOM_IOperations_ptr createOperation();
57   virtual bool                       isValid( QString& );
58   virtual bool                       execute( ObjectList& );
59   virtual QList<GEOM::GeomObjPtr>    getSourceObjects();
60
61 private:
62
63   void Init();
64   void Clear();
65   void enterEvent(QEvent *);
66
67   /**
68    * This method converts the curve into curve parameters required to
69    * construct an object using the interface
70    * GEOM_ICurvesOperations::MakePolyline2DOnPlane.
71    *
72    * \param theCurve a curve object, that contains data.
73    *  \param theCoordsList the list of coordinates list. theCoordsList[0]
74    *         is the coordinates list of the first section. theCoordsList[1]
75    *         is for the second section etc. Output parameter.
76    *  \param theNamesList the list of names. The order corresponds to
77    *         theCoordsList. Output parameter.
78    *  \param theTypesList the list of curve types. The order corresponds to
79    *         theCoordsList. Output parameter.
80    *  \param theClosedList the list of Closed flags. The order corresponds to
81    *         theCoordsList. Output parameter.
82    */
83   void GetCurveParams(GEOM::ListOfListOfDouble &theCoords,
84                       GEOM::string_array       &theNames,
85                       GEOM::short_array        &theTypes,
86                       GEOM::ListOfBool         &theCloseds);
87
88   /**
89    * This method returns the current local coordinate system.
90    *
91    * \return local coordinate system.
92    */
93   gp_Ax3 GetActiveLocalCS();
94
95   /**
96    * This method returns the current working plane. Can be null.
97    *
98    * \return the current working plane.
99    */
100   GEOM::GeomObjPtr GetActiveWPlane();
101
102   /**
103    * This method add a local coordinate system of the selected object.
104    *
105    * \param theSelectedObject the selected object. It can be a planar face
106    *        or an inported polyline.
107    * \param IsPlane true for planar face; false for imported polyline.
108    * \param theLCS the local coordinate system.
109    */
110   void AddLocalCS(GEOM::GeomObjPtr  theSelectedObject,
111                   const bool        IsPlane,
112                   const gp_Ax3      &theLCS);
113
114   /**
115    * This method converts the working plane object into
116    * the local coordinate system of the polyline.
117    *
118    * \param theGeomObj the working plane
119    * \return the local coordinate system
120    */
121   gp_Ax3 WPlaneToLCS(GEOM::GeomObjPtr theGeomObj);
122
123 protected slots:
124
125   void ClickOnOk();
126   bool ClickOnApply();
127   void ClickOnCancel();
128   void processStartedSubOperation( QWidget*, bool );
129   void processFinishedSubOperation( QWidget* );
130   void SetEditCurrentArgument();
131   void SelectionIntoArgument();
132   void ActivateThisDialog();
133   void onUpdatePreview();
134   void ActivateLocalCS();
135
136 private:
137
138   CurveCreator_Curve           *myCurve;
139   CurveCreator_Widget          *myEditorWidget;
140   QGroupBox                    *myAddElementBox;
141   QComboBox                    *myPlnComboBox;
142   QPushButton                  *myPlnButton;
143   QPushButton                  *myPlnSelButton;
144   QPushButton                  *myPolylineSelButton;
145   QLineEdit                    *myWPlaneLineEdit;
146   QLineEdit                    *myPolylineEdit;
147   QLineEdit                    *myEditCurrentArgument;   /* Current LineEdit */
148   QList<gp_Ax3>                 myLCSList;
149   QList<GEOM::GeomObjPtr>       myWPlaneList;
150
151 };
152
153 #endif // ENTITYGUI_POLYLINEDLG_H