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 * Apply changes done by this operation.
58 void onCreatePreview( QImage, HYDROData_Image::ECW_FileInfo* );
59 void onActivatePointSelection( int );
60 void onPointCoordChanged( bool, int, bool, int );
61 void onModeActivated( int );
62 void onRefImageActivated( const QString& );
63 void onSetCIsUsed( bool theCIsUsed );
65 void onLastViewClosed( SUIT_ViewManager* );
67 void onPointSelected();
68 void onRefPointSelected();
69 void onPointSelected( bool theIsRefImage );
70 void onFilesSelected( const QStringList& );
74 void closeView( GraphicsView_ViewManager* &aViewMgr );
76 bool checkPoints( const QPointF& thePointA,
77 const QPointF& thePointB,
78 const QPointF& thePointC,
79 const bool theIsByTwoPoints,
80 const QString& theLineErrMsg,
81 const QString& thePoinErrMsg,
83 const bool theIsToCheckInvertibles ) const;
86 * Build the local-global points mapping.
88 void computeTrsfData( HYDROData_Image::TransformationMode theTrsfMode,
89 bool theIsByTwoPoints,
90 const QPoint& theLocalPointA,
91 const QPoint& theLocalPointB,
92 const QPoint& theLocalPointC,
93 const QPointF& theGlobalPointA,
94 const QPointF& theGlobalPointB,
95 const QPointF& theGlobalPointC,
96 HYDROGUI_ImportImageDlg::TransformationDataMap& theDataMap ) const;
99 * Set transformation points A,B,C to the image presentation.
101 void setPresentationTrsfPoints( HYDROGUI_PrsImage* thePrs,
102 bool theIsByTwoPoints,
103 const QPoint theLocalPointA,
104 const QPoint theLocalPointB,
105 const QPoint theLocalPointC );
108 * Initialize the combobox in the dialog with the list of available reference images
110 void getReferenceDataList(
111 HYDROGUI_ImportImageDlg::PrsPointDataList& theList ) const;
117 Handle(HYDROData_Image) myEditedObject;
119 SUIT_ViewManager* myActiveViewManager; //!< The previous view to come back to after the operation
121 GraphicsView_ViewManager* myPreviewViewManager; //!< The operation preview window
122 GraphicsView_ViewManager* myRefViewManager; //!< The reference image view window
123 HYDROGUI_PrsImage* myPreviewPrs; //!< The loaded image preview presentation
124 HYDROGUI_PrsImage* myRefPreviewPrs; //!< The reference image presentation
126 QImage myImage; //!< The loaded image to import