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.
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.
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
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #ifndef HYDROGUI_IMPORTIMAGEOP_H
20 #define HYDROGUI_IMPORTIMAGEOP_H
22 #include "HYDROGUI_Operation.h"
23 #include "HYDROGUI_ImportImageDlg.h"
25 #include <HYDROData_Image.h>
29 class GraphicsView_ViewManager;
30 class SUIT_ViewManager;
31 class HYDROGUI_PrsImage;
33 class HYDROGUI_ImportImageOp : public HYDROGUI_Operation
38 HYDROGUI_ImportImageOp( HYDROGUI_Module* theModule, const bool theIsEdit );
39 virtual ~HYDROGUI_ImportImageOp();
42 virtual void startOperation();
43 virtual void abortOperation();
44 virtual void commitOperation();
46 virtual HYDROGUI_InputPanel* createInputPanel() const;
48 virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg,
49 QStringList& theBrowseObjectsEntries );
50 bool isReferenceCorrect() const;
53 virtual void onApply();
55 void onCreatePreview( QImage );
56 void onActivatePointSelection( int );
57 void onPointCoordChanged( bool, int, bool, int );
58 void onModeActivated( int );
59 void onRefImageActivated( const QString& );
60 void onSetCIsUsed( bool theCIsUsed );
62 void onLastViewClosed( SUIT_ViewManager* );
64 void onPointSelected();
65 void onRefPointSelected();
66 void onPointSelected( bool theIsRefImage );
67 void onFilesSelected( const QStringList& );
71 void closeView( GraphicsView_ViewManager* &aViewMgr );
73 bool checkPoints( const QPointF& thePointA,
74 const QPointF& thePointB,
75 const QPointF& thePointC,
76 const bool theIsByTwoPoints,
77 const QString& theLineErrMsg,
78 const QString& thePoinErrMsg,
80 const bool theIsToCheckInvertibles ) const;
83 * Build the local-global points mapping.
85 void computeTrsfData( HYDROData_Image::TransformationMode theTrsfMode,
86 bool theIsByTwoPoints,
87 const QPoint& theLocalPointA,
88 const QPoint& theLocalPointB,
89 const QPoint& theLocalPointC,
90 const QPointF& theGlobalPointA,
91 const QPointF& theGlobalPointB,
92 const QPointF& theGlobalPointC,
93 HYDROGUI_ImportImageDlg::TransformationDataMap& theDataMap ) const;
96 * Set transformation points A,B,C to the image presentation.
98 void setPresentationTrsfPoints( HYDROGUI_PrsImage* thePrs,
99 bool theIsByTwoPoints,
100 const QPoint theLocalPointA,
101 const QPoint theLocalPointB,
102 const QPoint theLocalPointC );
105 * Initialize the combobox in the dialog with the list of available reference images
107 void getReferenceDataList(
108 HYDROGUI_ImportImageDlg::PrsPointDataList& theList ) const;
114 Handle(HYDROData_Image) myEditedObject;
116 SUIT_ViewManager* myActiveViewManager; //!< The previous view to come back to after the operation
118 GraphicsView_ViewManager* myPreviewViewManager; //!< The operation preview window
119 GraphicsView_ViewManager* myRefViewManager; //!< The reference image view window
120 HYDROGUI_PrsImage* myPreviewPrs; //!< The loaded image preview presentation
121 HYDROGUI_PrsImage* myRefPreviewPrs; //!< The reference image presentation
123 QImage myImage; //!< The loaded image to import