1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include "HYDROGUI_ImportImageOp.h"
25 #include "HYDROGUI_DataModel.h"
26 #include "HYDROGUI_ImportImageDlg.h"
27 #include "HYDROGUI_Module.h"
28 #include "HYDROGUI_PrsImage.h"
29 #include "HYDROGUI_Tool.h"
30 #include "HYDROGUI_UpdateFlags.h"
32 #include <HYDROData_Iterator.h>
33 #include <HYDROData_Tool.h>
35 #include <GraphicsView_ViewManager.h>
36 #include <GraphicsView_ViewPort.h>
37 #include <GraphicsView_Viewer.h>
39 #include <LightApp_Application.h>
40 #include <LightApp_UpdateFlags.h>
42 #include <STD_TabDesktop.h>
43 #include <SUIT_Desktop.h>
44 #include <QtxWorkstack.h>
45 #include <QApplication>
47 HYDROGUI_ImportImageOp::HYDROGUI_ImportImageOp( HYDROGUI_Module* theModule,
48 const bool theIsEdit )
49 : HYDROGUI_Operation( theModule ),
50 myIsEdit( theIsEdit ),
52 myActiveViewManager( 0 ),
53 myPreviewViewManager( 0 ),
54 myRefViewManager( 0 ),
57 myPointType( HYDROGUI_PrsImage::None )
59 setName( theIsEdit ? tr( "EDIT_IMPORTED_IMAGE" ) : tr( "IMPORT_IMAGE" ) );
62 HYDROGUI_ImportImageOp::~HYDROGUI_ImportImageOp()
66 void HYDROGUI_ImportImageOp::startOperation()
68 HYDROGUI_Operation::startOperation();
70 HYDROGUI_ImportImageDlg* aPanel = (HYDROGUI_ImportImageDlg*)inputPanel();
72 aPanel->setIsEdit( myIsEdit );
74 QString aRefImageName;
78 myEditedObject = Handle(HYDROData_Image)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
79 if( !myEditedObject.IsNull() )
81 QImage anImage = myEditedObject->Image();
82 bool anIsByTwoPoints = myEditedObject->IsByTwoPoints();
84 QPoint aLocalPointA, aLocalPointB, aLocalPointC;
85 myEditedObject->GetLocalPoints( aLocalPointA, aLocalPointB, aLocalPointC );
87 onCreatePreview( anImage );
91 HYDROGUI_PrsImage::TransformationPointMap aPointMap =
92 myPreviewPrs->getTransformationPointMap();
93 if( !aPointMap.isEmpty() )
95 aPointMap[ HYDROGUI_PrsImage::PointA ].Point = aLocalPointA;
96 aPointMap[ HYDROGUI_PrsImage::PointB ].Point = aLocalPointB;
97 if ( !anIsByTwoPoints )
98 aPointMap[ HYDROGUI_PrsImage::PointC ].Point = aLocalPointC;
100 myPreviewPrs->setTransformationPointMap( aPointMap );
104 HYDROData_Image::TransformationMode aTrsfMode;
105 QPointF aTrsfPointA, aTrsfPointB, aTrsfPointC;
106 myEditedObject->GetGlobalPoints( aTrsfMode,
107 aTrsfPointA, aTrsfPointB, aTrsfPointC );
109 HYDROGUI_ImportImageDlg::TransformationDataMap aDataMap;
110 aDataMap[ HYDROGUI_PrsImage::PointA ] =
111 HYDROGUI_ImportImageDlg::ComputeTrsfData( aTrsfMode, aLocalPointA, aTrsfPointA );
112 aDataMap[ HYDROGUI_PrsImage::PointB ] =
113 HYDROGUI_ImportImageDlg::ComputeTrsfData( aTrsfMode, aLocalPointB, aTrsfPointB );
114 if ( !anIsByTwoPoints )
115 aDataMap[ HYDROGUI_PrsImage::PointC ] =
116 HYDROGUI_ImportImageDlg::ComputeTrsfData( aTrsfMode, aLocalPointC, aTrsfPointC );
118 aPanel->setTransformationMode( aTrsfMode );
119 aPanel->setTransformationDataMap( aDataMap );
120 aPanel->setByTwoPoints( anIsByTwoPoints );
122 // Set points on reference image
123 if ( aTrsfMode = HYDROData_Image::ReferenceImage )
125 Handle(HYDROData_Image) aRefImage = myEditedObject->GetTrsfReferenceImage();
126 if ( !aRefImage.IsNull() )
128 aRefImageName = aRefImage->GetName();
130 onRefImageActivated( aRefImageName );
131 if( myRefPreviewPrs )
133 HYDROGUI_PrsImage::TransformationPointMap aRefPointMap =
134 myRefPreviewPrs->getTransformationPointMap();
135 if( !aRefPointMap.isEmpty() )
137 aRefPointMap[ HYDROGUI_PrsImage::PointA ].Point = aTrsfPointA.toPoint();
138 aRefPointMap[ HYDROGUI_PrsImage::PointB ].Point = aTrsfPointB.toPoint();
139 if ( !anIsByTwoPoints )
140 aRefPointMap[ HYDROGUI_PrsImage::PointC ].Point = aTrsfPointC.toPoint();
142 myRefPreviewPrs->setTransformationPointMap( aRefPointMap );
146 HYDROGUI_ImportImageDlg::TransformationDataMap aRefDataMap;
147 aRefDataMap[ HYDROGUI_PrsImage::PointA ] = HYDROGUI_ImportImageDlg::TransformationData( aTrsfPointA.toPoint() );
148 aRefDataMap[ HYDROGUI_PrsImage::PointB ] = HYDROGUI_ImportImageDlg::TransformationData( aTrsfPointB.toPoint() );
149 if ( !anIsByTwoPoints )
150 aRefDataMap[ HYDROGUI_PrsImage::PointC ] = HYDROGUI_ImportImageDlg::TransformationData( aTrsfPointC.toPoint() );
152 aPanel->setTransformationDataMap( aRefDataMap, true, true );
158 // collect information about existing images
159 HYDROGUI_ImportImageDlg::PrsPointDataList aPrsPointDataList;
160 HYDROData_Iterator anIterator( doc(), KIND_IMAGE );
161 for( ; anIterator.More(); anIterator.Next() )
163 Handle(HYDROData_Image) anImageObj = Handle(HYDROData_Image)::DownCast( anIterator.Current() );
164 if( !anImageObj.IsNull() )
166 if( myIsEdit && IsEqual( anImageObj, myEditedObject ) )
169 QPoint aLocalPointA, aLocalPointB, aLocalPointC;
170 anImageObj->GetLocalPoints( aLocalPointA, aLocalPointB, aLocalPointC );
172 HYDROData_Image::TransformationMode aImgTrsfMode;
173 QPointF aTrsfPointA, aTrsfPointB, aTrsfPointC;
174 anImageObj->GetGlobalPoints( aImgTrsfMode,
175 aTrsfPointA, aTrsfPointB, aTrsfPointC );
177 HYDROGUI_ImportImageDlg::TransformationDataMap aDataMap;
178 aDataMap[ HYDROGUI_PrsImage::PointA ] =
179 HYDROGUI_ImportImageDlg::ComputeTrsfData( aImgTrsfMode, aLocalPointA, aTrsfPointA );
180 aDataMap[ HYDROGUI_PrsImage::PointB ] =
181 HYDROGUI_ImportImageDlg::ComputeTrsfData( aImgTrsfMode, aLocalPointB, aTrsfPointB );
182 aDataMap[ HYDROGUI_PrsImage::PointC ] =
183 HYDROGUI_ImportImageDlg::ComputeTrsfData( aImgTrsfMode, aLocalPointC, aTrsfPointC );
185 HYDROGUI_ImportImageDlg::PrsPointData aPrsPointData( anImageObj->GetName(), aDataMap );
186 aPrsPointDataList.append( aPrsPointData );
190 aPanel->setPrsPointDataList( aPrsPointDataList );
191 aPanel->setRefImageName( aRefImageName );
194 void HYDROGUI_ImportImageOp::abortOperation()
198 HYDROGUI_Operation::abortOperation();
201 void HYDROGUI_ImportImageOp::commitOperation()
205 HYDROGUI_Operation::commitOperation();
208 HYDROGUI_InputPanel* HYDROGUI_ImportImageOp::createInputPanel() const
210 HYDROGUI_InputPanel* aPanel = new HYDROGUI_ImportImageDlg( module(), getName() );
211 connect( aPanel, SIGNAL( createPreview( QImage ) ),
212 this, SLOT( onCreatePreview( QImage ) ) );
213 connect( aPanel, SIGNAL( activatePointSelection( int ) ),
214 this, SLOT( onActivatePointSelection( int ) ) );
215 connect( aPanel, SIGNAL( pointCoordChanged( bool, int, bool, int ) ),
216 this, SLOT( onPointCoordChanged( bool, int, bool, int ) ) );
217 connect( aPanel, SIGNAL( modeActivated( int ) ),
218 this, SLOT( onModeActivated( int ) ) );
219 connect( aPanel, SIGNAL( refImageActivated( const QString& ) ),
220 this, SLOT( onRefImageActivated( const QString& ) ) );
224 bool HYDROGUI_ImportImageOp::checkPoints( const QPointF& thePointA,
225 const QPointF& thePointB,
226 const QPointF& thePointC,
227 const bool theIsByTwoPoints,
228 const QString& theLineErrMsg,
229 const QString& thePoinErrMsg,
230 QString& theErrorMsg,
231 const bool theIsToCheckInvertibles ) const
233 double xa = thePointA.x();
234 double ya = thePointA.y();
235 double xb = thePointB.x();
236 double yb = thePointB.y();
237 double xc = thePointC.x();
238 double yc = thePointC.y();
240 if ( !theIsByTwoPoints )
242 // check that three input points don't belong to a single line
243 if ( ValuesEquals( ( yb - ya ) * ( xc - xa ), ( yc - ya ) * ( xb - xa ) ) )
245 theErrorMsg = theLineErrMsg;
251 // check that two points are not identical
252 if ( ValuesEquals( xa, ya ) && ValuesEquals( xb, yb ) )
254 theErrorMsg = thePoinErrMsg;
259 if ( theIsToCheckInvertibles )
261 QTransform aTransform1( xa, ya, 1, xb, yb, 1, xc, yc, 1 );
263 bool anIsInvertible = false;
264 QTransform aTransform1Inverted = aTransform1.inverted( &anIsInvertible );
265 if( !anIsInvertible )
267 theErrorMsg = tr( "TRANSFORMATION_MATRIX_CANNOT_BE_COMPUTED" );
275 bool HYDROGUI_ImportImageOp::processApply( int& theUpdateFlags,
276 QString& theErrorMsg )
278 HYDROGUI_ImportImageDlg* aPanel = (HYDROGUI_ImportImageDlg*)inputPanel();
280 QString anImageName = aPanel->getImageName();
281 if( anImageName.isEmpty() )
284 if( !myIsEdit || ( !myEditedObject.IsNull() && myEditedObject->GetName() != anImageName ) )
286 // check that there are no other objects with the same name in the document
287 Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::FindObjectByName( module(), anImageName );
288 if( !anObject.IsNull() )
290 theErrorMsg = tr( "OBJECT_EXISTS_IN_DOCUMENT" ).arg( anImageName );
295 HYDROGUI_ImportImageDlg::TransformationDataMap aMap;
296 if( !aPanel->getTransformationDataMap( aMap ) )
299 bool anIsByTwoPoints = aPanel->isByTwoPoints();
301 QPoint aPointA = aMap[ HYDROGUI_PrsImage::PointA ].ImagePoint;
302 QPoint aPointB = aMap[ HYDROGUI_PrsImage::PointB ].ImagePoint;
303 QPoint aPointC = anIsByTwoPoints ? QPoint( INT_MIN, INT_MIN ) :
304 aMap[ HYDROGUI_PrsImage::PointC ].ImagePoint;
306 // first, we check correctness of image points
307 if ( !checkPoints( aPointA, aPointB, aPointC, anIsByTwoPoints,
308 tr( "POINTS_A_B_C_BELONG_TO_SINGLE_LINE" ),
309 tr( "POINTS_A_B_ARE_IDENTICAL" ),
310 theErrorMsg, true ) )
313 Handle(HYDROData_Image) aRefImageObj;
314 QPointF aTrsfPointA, aTrsfPointB, aTrsfPointC( INT_MIN, INT_MIN );
316 HYDROData_Image::TransformationMode aTransformationMode =
317 (HYDROData_Image::TransformationMode)aPanel->getTransformationMode();
318 if ( aTransformationMode == HYDROData_Image::ReferenceImage )
320 QString aRefImageName = aPanel->getRefImageName();
321 if( aRefImageName.isEmpty() )
323 theErrorMsg = tr( "REFERENCE_IMAGE_IS_NOT_SELECTED" );
327 HYDROGUI_ImportImageDlg::TransformationDataMap aRefMap;
328 if( !aPanel->getTransformationDataMap( aRefMap, true ) )
331 aRefImageObj = Handle(HYDROData_Image)::DownCast(
332 HYDROGUI_Tool::FindObjectByName( module(), aRefImageName, KIND_IMAGE ) );
333 if( aRefImageObj.IsNull() )
336 aTrsfPointA = aRefMap[ HYDROGUI_PrsImage::PointA ].ImagePoint;
337 aTrsfPointB = aRefMap[ HYDROGUI_PrsImage::PointB ].ImagePoint;
338 if ( !anIsByTwoPoints )
339 aTrsfPointC = aRefMap[ HYDROGUI_PrsImage::PointC ].ImagePoint;
341 // the same check of correctness for the reference points
342 if ( !checkPoints( aTrsfPointA, aTrsfPointB, aTrsfPointC, anIsByTwoPoints,
343 tr( "REFERENCE_POINTS_A_B_C_BELONG_TO_SINGLE_LINE" ),
344 tr( "REFERENCE_POINTS_A_B_ARE_IDENTICAL" ),
345 theErrorMsg, false ) )
350 if ( aTransformationMode == HYDROData_Image::ManualGeodesic )
352 aTrsfPointA = aMap[ HYDROGUI_PrsImage::PointA ].GeodesicPoint;
353 aTrsfPointB = aMap[ HYDROGUI_PrsImage::PointB ].GeodesicPoint;
354 if ( !anIsByTwoPoints )
355 aTrsfPointC = aMap[ HYDROGUI_PrsImage::PointC ].GeodesicPoint;
359 aTrsfPointA = aMap[ HYDROGUI_PrsImage::PointA ].CartesianPoint;
360 aTrsfPointB = aMap[ HYDROGUI_PrsImage::PointB ].CartesianPoint;
361 if ( !anIsByTwoPoints )
362 aTrsfPointC = aMap[ HYDROGUI_PrsImage::PointC ].CartesianPoint;
366 Handle(HYDROData_Image) anImageObj;
368 anImageObj = myEditedObject;
370 anImageObj = Handle(HYDROData_Image)::DownCast( doc()->CreateObject( KIND_IMAGE ) );
372 if( anImageObj.IsNull() )
375 anImageObj->SetName( anImageName );
376 anImageObj->SetImage( myImage );
377 anImageObj->SetLocalPoints( aPointA, aPointB, aPointC, false );
379 if ( aTransformationMode == HYDROData_Image::ReferenceImage )
381 anImageObj->SetReferencePoints( aRefImageObj,
382 aTrsfPointA, aTrsfPointB, aTrsfPointC );
386 anImageObj->SetGlobalPoints( aTransformationMode,
387 aTrsfPointA, aTrsfPointB, aTrsfPointC );
392 // Set imported file name for image
393 QString aFilePath = aPanel->getFileName();
394 anImageObj->SetFilePath( aFilePath );
397 // must be done after all checks and before calling SetVisible() method below
401 module()->setObjectVisible( HYDROGUI_Tool::GetActiveGraphicsViewId( module() ), anImageObj, true );
404 anImageObj->Update();
406 theUpdateFlags = UF_Model | UF_Viewer | UF_GV_Forced | UF_OCCViewer | UF_OCC_Forced;
410 void HYDROGUI_ImportImageOp::onCreatePreview( QImage theImage )
412 HYDROGUI_ImportImageDlg* aPanel = (HYDROGUI_ImportImageDlg*)inputPanel();
416 if( myPreviewPrs ) // if the image is changed by choosing another file
418 myPreviewPrs->setImage( myImage );
419 myPreviewPrs->compute();
421 if( myPreviewViewManager )
423 if( GraphicsView_Viewer* aViewer = myPreviewViewManager->getViewer() )
425 if( GraphicsView_ViewPort* aViewPort = aViewer->getActiveViewPort() )
427 aViewPort->onBoundingRectChanged();
435 LightApp_Application* anApp = module()->getApp();
437 myActiveViewManager = anApp->activeViewManager();
439 myPreviewPrs = new HYDROGUI_PrsImage( myIsEdit ? myEditedObject : 0 );
440 myPreviewPrs->setImage( myImage );
441 myPreviewPrs->compute();
443 myPreviewViewManager =
444 dynamic_cast<GraphicsView_ViewManager*>( anApp->createViewManager( GraphicsView_Viewer::Type() ) );
445 if( myPreviewViewManager )
447 connect( myPreviewViewManager, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
448 this, SLOT( onLastViewClosed( SUIT_ViewManager* ) ) );
450 module()->setViewManagerRole( myPreviewViewManager, HYDROGUI_Module::VMR_TransformImage );
451 myPreviewViewManager->setTitle( tr( "TRANSFORM_IMAGE" ) );
452 if( GraphicsView_Viewer* aViewer = myPreviewViewManager->getViewer() )
454 if( GraphicsView_ViewPort* aViewPort = aViewer->getActiveViewPort() )
456 //aViewPort->setMousePositionEnabled( true ); //ouv: temporarily commented
458 aViewPort->addItem( myPreviewPrs );
461 myPreviewPrs->setIsTransformationPointPreview( true );
463 connect( aViewer, SIGNAL( selectionChanged( GV_SelectionChangeStatus ) ),
464 this, SLOT( onPointSelected() ) );
471 if( !myEditedObject.IsNull() )
472 anImageName = myEditedObject->GetName();
475 anImageName = HYDROGUI_Tool::GenerateObjectName( module(), "Image" );
476 aPanel->setImageName( anImageName );
479 aPanel->setImageSize( myImage.size() );
481 aPanel->initializePointSelection();
482 onPointSelected( false );
485 void HYDROGUI_ImportImageOp::onActivatePointSelection( int thePointType )
487 myPointType = thePointType;
489 myPreviewPrs->setTransformationPointType( thePointType );
490 if( myRefPreviewPrs )
491 myRefPreviewPrs->setTransformationPointType( thePointType );
494 void HYDROGUI_ImportImageOp::onPointCoordChanged( bool theIsRef,
499 if( !theIsRef && myPreviewPrs )
500 myPreviewPrs->updateTransformationPoint( thePointType, theIsY, theValue );
501 else if( theIsRef && myRefPreviewPrs )
502 myRefPreviewPrs->updateTransformationPoint( thePointType, theIsY, theValue );
505 void HYDROGUI_ImportImageOp::onModeActivated( int theMode )
507 HYDROGUI_ImportImageDlg* aPanel = (HYDROGUI_ImportImageDlg*)inputPanel();
509 QString aRefImageName;
510 if( theMode == HYDROData_Image::ReferenceImage )
512 aRefImageName = aPanel->getRefImageName();
513 if( aRefImageName.isEmpty() )
514 return; // do nothing in this case to avoid visual moving of preview prs
515 onRefImageActivated( aRefImageName );
519 if( myRefViewManager )
521 closeView( myRefViewManager );
526 void HYDROGUI_ImportImageOp::onRefImageActivated( const QString& theName )
528 GraphicsView_ViewPort* aViewPort = 0;
530 LightApp_Application* anApp = module()->getApp();
531 ///// Get a view port for the reference image preview
532 if( myRefViewManager )
534 if( GraphicsView_Viewer* aViewer = myRefViewManager->getViewer() )
536 aViewPort = aViewer->getActiveViewPort();
541 anApp = module()->getApp();
542 // Init reference image preview
544 dynamic_cast<GraphicsView_ViewManager*>( anApp->createViewManager( GraphicsView_Viewer::Type() ) );
545 if( myRefViewManager )
547 connect( myRefViewManager, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
548 this, SLOT( onLastViewClosed( SUIT_ViewManager* ) ) );
550 module()->setViewManagerRole( myRefViewManager, HYDROGUI_Module::VMR_ReferenceImage );
551 myRefViewManager->setTitle( tr( "REFERENCE_IMAGE" ) );
552 if( GraphicsView_Viewer* aViewer = myRefViewManager->getViewer() )
554 aViewPort = aViewer->getActiveViewPort();
555 connect( aViewer, SIGNAL( selectionChanged( GV_SelectionChangeStatus ) ),
556 this, SLOT( onRefPointSelected() ) );
564 // Remove the old presentation of the reference image if any
565 if( myRefPreviewPrs )
567 myRefPreviewPrs->setCaption( QString() );
568 aViewPort->removeItem( myRefPreviewPrs );
570 delete myRefPreviewPrs;
574 // Create a new reference image presentation
576 Handle(HYDROData_Image) anImageObj = Handle(HYDROData_Image)::DownCast(
577 HYDROGUI_Tool::FindObjectByName( module(), theName, KIND_IMAGE ) );
578 if( !anImageObj.IsNull() )
580 anImage = anImageObj->Image();
582 myRefPreviewPrs = new HYDROGUI_PrsImage( anImageObj );
583 myRefPreviewPrs->setImage( anImage );
584 myRefPreviewPrs->compute();
586 myRefPreviewPrs->setIsTransformationPointPreview( true );
587 myRefPreviewPrs->setTransformationPointType( myPointType );
589 // Add the new reference image presentation to the appropriate view
590 aViewPort->addItem( myRefPreviewPrs );
595 // Split views horizontally
596 if( anApp->desktop()->inherits( "STD_TabDesktop" ) )
598 qApp->processEvents();
599 QtxWorkstack* aWorkstack = ( (STD_TabDesktop*)anApp->desktop() )->workstack();
600 aViewPort->activateWindow();
602 aViewPort->setFocus(Qt::ActiveWindowFocusReason);
603 aWorkstack->splitHorizontal();
606 // Initialize the dialog
607 HYDROGUI_ImportImageDlg* aPanel = (HYDROGUI_ImportImageDlg*)inputPanel();
608 aPanel->setImageSize( anImage.size(), true );
609 aPanel->initializePointSelection();
610 onPointSelected( true );
613 void HYDROGUI_ImportImageOp::onLastViewClosed( SUIT_ViewManager* theViewManager )
618 void HYDROGUI_ImportImageOp::onPointSelected()
620 onPointSelected( myRefPreviewPrs && myRefPreviewPrs->isSelected() );
623 void HYDROGUI_ImportImageOp::onRefPointSelected()
625 onPointSelected( true );
628 void HYDROGUI_ImportImageOp::onPointSelected( bool theIsRefImage )
630 HYDROGUI_PrsImage* aPrs = theIsRefImage ? myRefPreviewPrs : myPreviewPrs;
634 HYDROGUI_ImportImageDlg::TransformationDataMap aDataMap;
636 const HYDROGUI_PrsImage::TransformationPointMap& aPointMap =
637 aPrs->getTransformationPointMap();
638 HYDROGUI_PrsImage::TransformationPointMapIterator anIter( aPointMap );
639 while( anIter.hasNext() )
641 int aPointType = anIter.next().key();
642 const HYDROGUI_PrsImage::TransformationPoint& aTransformationPoint = anIter.value();
643 const QPoint& aPoint = aTransformationPoint.Point;
645 HYDROGUI_ImportImageDlg::TransformationData aData( aPoint, QPointF(), QPointF() );
646 aDataMap[ aPointType ] = aData;
649 ( (HYDROGUI_ImportImageDlg*)inputPanel() )->setTransformationDataMap( aDataMap, true, theIsRefImage );
652 void HYDROGUI_ImportImageOp::closePreview()
654 closeView( myPreviewViewManager );
655 closeView( myRefViewManager );
657 if( myActiveViewManager )
658 HYDROGUI_Tool::SetActiveViewManager( module(), myActiveViewManager );
661 void HYDROGUI_ImportImageOp::closeView( GraphicsView_ViewManager* &aViewMgr )
665 GraphicsView_ViewPort* aViewPort = 0;
666 if( GraphicsView_Viewer* aViewer = aViewMgr->getViewer() )
668 aViewPort = aViewer->getActiveViewPort();
670 disconnect( aViewMgr, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
671 this, SLOT( onLastViewClosed( SUIT_ViewManager* ) ) );
673 // Nullify appropriate presentation pointer
674 HYDROGUI_PrsImage* aPrs = 0;
675 switch ( module()->getViewManagerRole( aViewMgr ) )
677 case HYDROGUI_Module::VMR_ReferenceImage:
678 aPrs = myRefPreviewPrs;
681 case HYDROGUI_Module::VMR_TransformImage:
686 // Remove the appropriate presentation from the view
687 if( aPrs && aViewPort )
689 aViewPort->removeItem( aPrs );
694 module()->getApp()->removeViewManager( aViewMgr ); // aViewMgr is deleted here