Salome HOME
Merge branch 'fbt/add_header_for_mpi_compilation'
[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         
60 private:
61
62   void Init();
63   void Clear();
64   void enterEvent(QEvent *);
65
66   /**
67    * This method converts the curve into curve parameters required to
68    * construct an object using the interface
69    * GEOM_ICurvesOperations::MakePolyline2DOnPlane.
70    *
71    * \param theCurve a curve object, that contains data.
72    *  \param theCoordsList the list of coordinates list. theCoordsList[0]
73    *         is the coordinates list of the first section. theCoordsList[1]
74    *         is for the second section etc. Output parameter.
75    *  \param theNamesList the list of names. The order corresponds to
76    *         theCoordsList. Output parameter.
77    *  \param theTypesList the list of curve types. The order corresponds to
78    *         theCoordsList. Output parameter.
79    *  \param theClosedList the list of Closed flags. The order corresponds to
80    *         theCoordsList. Output parameter.
81    */
82   void GetCurveParams(GEOM::ListOfListOfDouble &theCoords,
83                       GEOM::string_array       &theNames,
84                       GEOM::short_array        &theTypes,
85                       GEOM::ListOfBool         &theCloseds);
86
87   /**
88    * This method returns the current local coordinate system.
89    *
90    * \return local coordinate system.
91    */
92   gp_Ax3 GetActiveLocalCS();
93
94   /**
95    * This method returns the current working plane. Can be null.
96    *
97    * \return the current working plane.
98    */
99   GEOM::GeomObjPtr GetActiveWPlane();
100
101   /**
102    * This method add a local coordinate system of the selected object.
103    *
104    * \param theSelectedObject the selected object. It can be a planar face
105    *        or an inported polyline.
106    * \param IsPlane true for planar face; false for imported polyline.
107    * \param theLCS the local coordinate system.
108    */
109   void AddLocalCS(GEOM::GeomObjPtr  theSelectedObject,
110                   const bool        IsPlane,
111                   const gp_Ax3      &theLCS);
112
113   /**
114    * This method converts the working plane object into
115    * the local coordinate system of the polyline.
116    *
117    * \param theGeomObj the working plane
118    * \return the local coordinate system
119    */
120   gp_Ax3 WPlaneToLCS(GEOM::GeomObjPtr theGeomObj);
121
122 protected slots:
123
124   void ClickOnOk();
125   bool ClickOnApply();
126   void ClickOnCancel();
127   void processStartedSubOperation( QWidget*, bool );
128   void processFinishedSubOperation( QWidget* );
129   void SetEditCurrentArgument();
130   void SelectionIntoArgument();
131   void ActivateThisDialog();
132   void onUpdatePreview();
133   void ActivateLocalCS();
134
135 private:
136
137   CurveCreator_Curve           *myCurve;
138   CurveCreator_Widget          *myEditorWidget;
139   QGroupBox                    *myAddElementBox;
140   QComboBox                    *myPlnComboBox;
141   QPushButton                  *myPlnButton;
142   QPushButton                  *myPlnSelButton;
143   QPushButton                  *myPolylineSelButton;
144   QLineEdit                    *myWPlaneLineEdit;
145   QLineEdit                    *myPolylineEdit;
146   QLineEdit                    *myEditCurrentArgument;   /* Current LineEdit */
147   QList<gp_Ax3>                 myLCSList;
148   QList<GEOM::GeomObjPtr>       myWPlaneList;
149
150 };
151
152 #endif // ENTITYGUI_POLYLINEDLG_H