Salome HOME
Merge branch 'BR_LAND_COVER_MAP' into BR_quadtree
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_RecognizeContoursOp.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_RecognizeContoursOp_H
20 #define HYDROGUI_RecognizeContoursOp_H
21
22 #include "HYDROGUI_Operation.h"
23
24 #include <HYDROData_Image.h>
25
26 #include <QMap>
27 #include <QStringList>
28
29 class QTemporaryFile;
30
31
32 class HYDROGUI_RecognizeContoursOp : public HYDROGUI_Operation
33 {
34   Q_OBJECT
35
36 public:
37   HYDROGUI_RecognizeContoursOp( HYDROGUI_Module* theModule );
38   virtual ~HYDROGUI_RecognizeContoursOp();
39
40 protected:
41   virtual void startOperation();
42   virtual void abortOperation();
43   virtual void commitOperation();
44
45   virtual HYDROGUI_InputPanel* createInputPanel() const;
46
47   virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg,
48                              QStringList& theBrowseObjectsEntries );
49
50 protected slots:
51   void onExternalOperationFinished( const QString&, const QString&, 
52                                     const QStringList& );
53
54   void onSelectionChanged( const QStringList& theSelectedNames );
55   void onViewerSelectionChanged();
56
57 private:
58   void closeExternalOperationDlg();
59
60   void updateRecognizedPolylines();
61
62   void erasePreview();
63
64   void cleanup();
65
66 private:
67   Handle(HYDROData_Image) myImage; ///< the image used for contours detection
68
69   QTemporaryFile* myTmpImageFile;  ///< the temporary graphics file
70
71   QStringList myTmpGeomObjects;    ///< the list of temporary GEOM objects entries
72   QString myGeomContourEntry;      ///< the GEOM contour object entry
73   QString myGEOMOpName;            ///< the name of the called GEOM module operation
74   
75   QMap<QString, HYDROGUI_Shape*> myPolylineShapes; ///< the detected polylines shapes map (key: name, value: shape)
76 };
77
78 #endif