Salome HOME
Merge branch 'BR_H2018_2' of https://codev-tuleap.cea.fr/plugins/git/salome/hydro...
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ImportGeomObjectOp.h
1 // Copyright (C) 2014-2015  EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
6 //
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10 // Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 #ifndef HYDROGUI_IMPORTGEOMOBJECTOP_H
20 #define HYDROGUI_IMPORTGEOMOBJECTOP_H
21
22 #include "HYDROGUI_Operation.h"
23
24 #include <QStringList>
25
26 // IDL includes
27 #include <SALOMEconfig.h>
28 #include CORBA_SERVER_HEADER(GEOM_Gen)
29
30 class HYDROGUI_InputPanel;
31
32 class HYDROGUI_ImportGeomObjectOp : public HYDROGUI_Operation
33 {
34   Q_OBJECT
35
36 public:
37   enum OperationType { ImportCreatedAsObstacle, 
38                        ImportSelectedAsObstacle,
39                        ImportSelectedAsPolyline };
40
41 public:
42   HYDROGUI_ImportGeomObjectOp( HYDROGUI_Module* theModule,
43                                const int theOpType,
44                                const int theGEOMOp = -1 );
45   virtual ~HYDROGUI_ImportGeomObjectOp();
46
47   static QList<GEOM::shape_type> getObstacleTypes();
48   static QList<GEOM::shape_type> getPolylineTypes();
49
50 protected:
51   virtual void               startOperation();
52   virtual void               abortOperation();
53   virtual void               commitOperation();
54
55   virtual HYDROGUI_InputPanel* createInputPanel() const;
56
57   virtual bool               processApply( int& theUpdateFlags, QString& theErrorMsg,
58                                            QStringList& theBrowseObjectsEntries );
59
60 protected slots:
61   void                       onExternalOperationFinished( const QString&, const QString&, 
62                                                           const QStringList& );
63
64 private:
65   void updateDefaultName();
66   void closeExternalOperationDlg();
67
68 private:
69   QStringList myGeomObjects; ///< the list of GEOM object entries
70   bool myIsToShowPanel; ///< indicates if obstacle panel to be shown
71   int  myOpType; ///< operation type (to import selected GEOM objects or the objects just created by GEOM )
72   int  myGEOMOp; ///< GEOM module operation to be called to create GEOM object for import
73   QString myGEOMOpName; ///< the name of the called GEOM module operation
74 };
75
76 #endif