Salome HOME
HYDRO Feature 1: Import images (T 1.3)
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ImportImageDlg.cxx
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #include "HYDROGUI_ImportImageDlg.h"
24
25 #include "HYDROGUI_PrsImage.h"
26 #include "HYDROGUI_Tool.h"
27
28 #include <SUIT_FileDlg.h>
29 #include <SUIT_ResourceMgr.h>
30 #include <SUIT_Session.h>
31
32 #include <QtxDoubleSpinBox.h>
33 #include <QtxIntSpinBox.h>
34
35 #include <QButtonGroup>
36 #include <QComboBox>
37 #include <QGroupBox>
38 #include <QLabel>
39 #include <QLayout>
40 #include <QLineEdit>
41 #include <QPainter>
42 #include <QPicture>
43 #include <QPushButton>
44 #include <QRadioButton>
45 #include <QToolButton>
46
47 HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, const QString& theTitle )
48 : HYDROGUI_InputPanel( theModule, theTitle )
49 {
50   SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
51
52   // Import image from file
53   myFileNameGroup = new QGroupBox( tr( "IMPORT_IMAGE_FROM_FILE" ) );
54
55   QLabel* aFileNameLabel = new QLabel( tr( "FILE_NAME" ), myFileNameGroup );
56
57   myFileName = new QLineEdit( myFileNameGroup );
58   myFileName->setReadOnly( true );
59
60   QToolButton* aBrowseBtn = new QToolButton( myFileNameGroup );
61   aBrowseBtn->setIcon( aResMgr->loadPixmap( "HYDRO", tr( "BROWSE_ICO" ) ) );
62
63   QBoxLayout* aFileNameLayout = new QHBoxLayout( myFileNameGroup );
64   aFileNameLayout->setMargin( 5 );
65   aFileNameLayout->setSpacing( 5 );
66   aFileNameLayout->addWidget( aFileNameLabel );
67   aFileNameLayout->addWidget( myFileName );
68   aFileNameLayout->addWidget( aBrowseBtn );
69
70   // Image name
71   myImageNameGroup = new QGroupBox( tr( "IMAGE_NAME" ) );
72
73   QLabel* anImageNameLabel = new QLabel( tr( "NAME" ), myImageNameGroup );
74   myImageName = new QLineEdit( myImageNameGroup );
75
76   QBoxLayout* anImageNameLayout = new QHBoxLayout( myImageNameGroup );
77   anImageNameLayout->setMargin( 5 );
78   anImageNameLayout->setSpacing( 5 );
79   anImageNameLayout->addWidget( anImageNameLabel );
80   anImageNameLayout->addWidget( myImageName );
81
82   // Transform image
83   myTransformGroup = new QGroupBox( tr( "TRANSFORM_IMAGE" ) );
84
85   // Make a pixmap for arrow
86   QPixmap anArrowPixmap = aResMgr->loadPixmap( "HYDRO", tr( "ARROW_RIGHT_ICO" ) );
87
88   QPicture anArrowPicture;
89   anArrowPicture.setBoundingRect( QRect( QPoint( 0, 0 ), anArrowPixmap.size() ) );
90
91   QPainter aPainter;
92   aPainter.begin( &anArrowPicture );
93   aPainter.drawPixmap( 0, 0, anArrowPixmap );
94   aPainter.end();
95
96   QRadioButton* aManualBtn = new QRadioButton( tr( "MANUALLY" ), myTransformGroup );
97   QRadioButton* aRefImageBtn = new QRadioButton( tr( "BY_REFERENCE_IMAGE" ), myTransformGroup );
98
99   myModeGroup = new QButtonGroup( myTransformGroup );
100   myModeGroup->addButton( aManualBtn, Manual );
101   myModeGroup->addButton( aRefImageBtn, RefImage );
102
103   QBoxLayout* aModeLayout = new QHBoxLayout();
104   aModeLayout->setMargin( 0 );
105   aModeLayout->setSpacing( 5 );
106   aModeLayout->addWidget( aManualBtn );
107   aModeLayout->addWidget( aRefImageBtn );
108
109   myRefImageWg = new QWidget( myTransformGroup );
110   QLabel* aRefImageLabel = new QLabel( tr( "REFERENCE_IMAGE" ), myRefImageWg );
111   myRefImage = new QComboBox( myRefImageWg );
112
113   QBoxLayout* aRefImageLayout = new QHBoxLayout( myRefImageWg );
114   aRefImageLayout->setMargin( 0 );
115   aRefImageLayout->setSpacing( 5 );
116   aRefImageLayout->addWidget( aRefImageLabel );
117   aRefImageLayout->addWidget( myRefImage );
118   aRefImageLayout->setStretch( 1, 1 );
119
120   QGridLayout* aTransformLayout = new QGridLayout( myTransformGroup );
121   aTransformLayout->setMargin( 5 );
122   aTransformLayout->setSpacing( 5 );
123   aTransformLayout->addLayout( aModeLayout, 0, 0, 1, 9 );
124   aTransformLayout->addWidget( myRefImageWg, 1, 0, 1, 9 );
125
126   for( int aPointType = HYDROGUI_PrsImage::PointA;
127        aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ )
128   {
129     QString aPointStr;
130     switch( aPointType )
131     {
132       case HYDROGUI_PrsImage::PointA: aPointStr = tr( "ACTIVATE_POINT_A_SELECTION" ); break;
133       case HYDROGUI_PrsImage::PointB: aPointStr = tr( "ACTIVATE_POINT_B_SELECTION" ); break;
134       case HYDROGUI_PrsImage::PointC: aPointStr = tr( "ACTIVATE_POINT_C_SELECTION" ); break;
135     }
136     QPushButton* aPointBtn = new QPushButton( aPointStr, myTransformGroup );
137     aPointBtn->setCheckable( true );
138
139     QLabel* aPointXLabel = new QLabel( "X", myTransformGroup );
140     QLabel* aPointYLabel = new QLabel( "Y", myTransformGroup );
141
142     QtxIntSpinBox* aPointX = new QtxIntSpinBox( 0, 0, 1, myTransformGroup ); // max is updated later
143     QtxIntSpinBox* aPointY = new QtxIntSpinBox( 0, 0, 1, myTransformGroup ); // max is updated later
144
145     QLabel* aPointArrowLabel = new QLabel( myTransformGroup );
146     aPointArrowLabel->setPicture( anArrowPicture );
147
148     QLabel* aPointXDegLabel = new QLabel( QChar( 0x00B0 ), myTransformGroup );
149     QLabel* aPointYDegLabel = new QLabel( QChar( 0x00B0 ), myTransformGroup );
150     QLabel* aPointXMinLabel = new QLabel( "'", myTransformGroup );
151     QLabel* aPointYMinLabel = new QLabel( "'", myTransformGroup );
152     QLabel* aPointXSecLabel = new QLabel( "\"", myTransformGroup );
153     QLabel* aPointYSecLabel = new QLabel( "\"", myTransformGroup );
154     myLambertLabels << aPointXDegLabel << aPointYDegLabel
155                     << aPointXMinLabel << aPointYMinLabel
156                     << aPointXSecLabel << aPointYSecLabel;
157
158     QtxIntSpinBox* aPointXDeg = new QtxIntSpinBox( -180, 180, 1, myTransformGroup );
159     QtxIntSpinBox* aPointYDeg = new QtxIntSpinBox( -90, 90, 1, myTransformGroup );
160     QtxIntSpinBox* aPointXMin = new QtxIntSpinBox( 0, 59, 1, myTransformGroup );
161     QtxIntSpinBox* aPointYMin = new QtxIntSpinBox( 0, 59, 1, myTransformGroup );
162     QtxDoubleSpinBox* aPointXSec = new QtxDoubleSpinBox( 0, 59.9999, 1, 4, 4, myTransformGroup );
163     QtxDoubleSpinBox* aPointYSec = new QtxDoubleSpinBox( 0, 59.9999, 1, 4, 4, myTransformGroup );
164
165     QtxIntSpinBox* aRefPointX = new QtxIntSpinBox( 0, 0, 1, myTransformGroup ); // max is updated later
166     QtxIntSpinBox* aRefPointY = new QtxIntSpinBox( 0, 0, 1, myTransformGroup ); // max is updated later
167
168     int aRow = 4 * aPointType + 2;
169     aTransformLayout->addWidget( aPointBtn,        aRow,     0, 1, 9 );
170
171     aTransformLayout->addWidget( aPointXLabel,     aRow + 1, 0 );
172     aTransformLayout->addWidget( aPointX,          aRow + 1, 1 );
173     aTransformLayout->addWidget( aPointArrowLabel, aRow + 1, 2, 2, 1 );
174     aTransformLayout->addWidget( aPointXDeg,       aRow + 1, 3 );
175     aTransformLayout->addWidget( aPointXDegLabel,  aRow + 1, 4 );
176     aTransformLayout->addWidget( aPointXMin,       aRow + 1, 5 );
177     aTransformLayout->addWidget( aPointXMinLabel,  aRow + 1, 6 );
178     aTransformLayout->addWidget( aPointXSec,       aRow + 1, 7 );
179     aTransformLayout->addWidget( aPointXSecLabel,  aRow + 1, 8 );
180
181     aTransformLayout->addWidget( aRefPointX,       aRow + 1, 3, 1, 6 );
182
183     aTransformLayout->addWidget( aPointYLabel,     aRow + 2, 0 );
184     aTransformLayout->addWidget( aPointY,          aRow + 2, 1 );
185     aTransformLayout->addWidget( aPointYDeg,       aRow + 2, 3 );
186     aTransformLayout->addWidget( aPointYDegLabel,  aRow + 2, 4 );
187     aTransformLayout->addWidget( aPointYMin,       aRow + 2, 5 );
188     aTransformLayout->addWidget( aPointYMinLabel,  aRow + 2, 6 );
189     aTransformLayout->addWidget( aPointYSec,       aRow + 2, 7 );
190     aTransformLayout->addWidget( aPointYSecLabel,  aRow + 2, 8 );
191
192     aTransformLayout->addWidget( aRefPointY,       aRow + 2, 3, 1, 6 );
193
194     if( aPointType != HYDROGUI_PrsImage::PointC )
195     {
196       QFrame* aLine = new QFrame( myTransformGroup );
197       aLine->setFrameShape( QFrame::HLine );
198       aLine->setFrameShadow( QFrame::Sunken );
199       aTransformLayout->addWidget( aLine, aRow + 3, 0, 1, 9 );
200     }
201
202     myPointBtnMap[ aPointType ] = aPointBtn;
203     myPointXMap[ aPointType ] = aPointX;
204     myPointYMap[ aPointType ] = aPointY;
205     myPointXDegMap[ aPointType ] = aPointXDeg;
206     myPointYDegMap[ aPointType ] = aPointYDeg;
207     myPointXMinMap[ aPointType ] = aPointXMin;
208     myPointYMinMap[ aPointType ] = aPointYMin;
209     myPointXSecMap[ aPointType ] = aPointXSec;
210     myPointYSecMap[ aPointType ] = aPointYSec;
211
212     myRefPointXMap[ aPointType ] = aRefPointX;
213     myRefPointYMap[ aPointType ] = aRefPointY;
214
215     connect( aPointBtn, SIGNAL( toggled( bool ) ), this, SLOT( onPointBtnToggled( bool ) ) );
216
217     connect( aPointX, SIGNAL( valueChanged( int ) ), this, SLOT( onPointCoordChanged( int ) ) );
218     connect( aPointY, SIGNAL( valueChanged( int ) ), this, SLOT( onPointCoordChanged( int ) ) );
219     connect( aRefPointX, SIGNAL( valueChanged( int ) ), this, SLOT( onPointCoordChanged( int ) ) );
220     connect( aRefPointY, SIGNAL( valueChanged( int ) ), this, SLOT( onPointCoordChanged( int ) ) );
221   }
222   aTransformLayout->setColumnStretch( 1, 1 ); // double
223   aTransformLayout->setColumnStretch( 3, 1 ); // degrees
224   aTransformLayout->setColumnStretch( 5, 1 ); // minutes
225   aTransformLayout->setColumnStretch( 7, 2 ); // seconds (double with 4 digits)
226
227   // Common
228   addWidget( myFileNameGroup );
229   addWidget( myImageNameGroup );
230   addWidget( myTransformGroup );
231   addStretch();
232
233   connect( aBrowseBtn, SIGNAL( clicked() ), this, SLOT( onBrowse() ) );
234
235   connect( myModeGroup, SIGNAL( buttonClicked( int ) ),
236            this, SLOT( onModeActivated( int ) ) );
237
238   connect( myRefImage, SIGNAL( activated( const QString& ) ),
239            this, SLOT( onRefImageActivated( const QString& ) ) );
240
241   onModeActivated( Manual );
242
243   setMinimumWidth( 350 );
244 }
245
246 HYDROGUI_ImportImageDlg::~HYDROGUI_ImportImageDlg()
247 {
248 }
249
250 void HYDROGUI_ImportImageDlg::setIsEdit( const bool theIsEdit )
251 {
252   myFileNameGroup->setVisible( !theIsEdit );
253   myImageNameGroup->setEnabled( theIsEdit );
254   myTransformGroup->setEnabled( theIsEdit );
255 }
256
257 void HYDROGUI_ImportImageDlg::reset()
258 {
259   myFileName->clear();
260   myImageName->clear();
261   myImageNameGroup->setEnabled( false );
262   for( int aPointType = HYDROGUI_PrsImage::PointA;
263        aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ )
264   {
265     QPushButton* aBtn = myPointBtnMap[ aPointType ];
266     bool anIsBlocked = aBtn->blockSignals( true );
267     aBtn->setChecked( false );
268     aBtn->blockSignals( anIsBlocked );
269
270     myPointXMap[ aPointType ]->clear();
271     myPointYMap[ aPointType ]->clear();
272     myPointXDegMap[ aPointType ]->clear();
273     myPointYDegMap[ aPointType ]->clear();
274     myPointXMinMap[ aPointType ]->clear();
275     myPointYMinMap[ aPointType ]->clear();
276     myPointXSecMap[ aPointType ]->clear();
277     myPointYSecMap[ aPointType ]->clear();
278
279     myRefPointXMap[ aPointType ]->clear();
280     myRefPointYMap[ aPointType ]->clear();
281   }
282   myTransformGroup->setEnabled( false );
283   myModeGroup->button( Manual )->setChecked( true );
284   myRefImage->clear();
285
286   onModeActivated( Manual );
287
288   myPrsPointDataList.clear();
289 }
290
291 void HYDROGUI_ImportImageDlg::setImageName( const QString& theName )
292 {
293   myImageName->setText( theName );
294 }
295
296 QString HYDROGUI_ImportImageDlg::getImageName() const
297 {
298   return myImageName->text();
299 }
300
301 void HYDROGUI_ImportImageDlg::setImageSize( const QSize& theSize,
302                                             const bool theIsRefImage )
303 {
304   int aWidth = theSize.width();
305   int aHeight = theSize.height();
306   for( int aPointType = HYDROGUI_PrsImage::PointA;
307        aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ )
308   {
309     if( theIsRefImage )
310     {
311       myRefPointXMap[ aPointType ]->setRange( 0, aWidth );
312       myRefPointYMap[ aPointType ]->setRange( 0, aHeight );
313     }
314     else
315     {
316       myPointXMap[ aPointType ]->setRange( 0, aWidth );
317       myPointYMap[ aPointType ]->setRange( 0, aHeight );
318     }
319   }
320 }
321
322 int HYDROGUI_ImportImageDlg::getTransformationMode() const
323 {
324   return myModeGroup->button( Manual )->isChecked() ? Manual : RefImage;
325 }
326
327 void HYDROGUI_ImportImageDlg::setTransformationDataMap( const TransformationDataMap& theMap,
328                                                         const bool theIsOnlyInput,
329                                                         const bool theIsRefImage )
330 {
331   for( int aPointType = HYDROGUI_PrsImage::PointA;
332        aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ )
333   {
334     if( theMap.contains( aPointType ) )
335     {
336       const TransformationData& aData = theMap[ aPointType ];
337
338       QtxIntSpinBox* aPointX = theIsRefImage ? myRefPointXMap[ aPointType ] : myPointXMap[ aPointType ];
339       QtxIntSpinBox* aPointY = theIsRefImage ? myRefPointYMap[ aPointType ] : myPointYMap[ aPointType ];
340       aPointX->setValue( aData.first.x() );
341       aPointY->setValue( aData.first.y() );
342
343       if( !theIsOnlyInput && !theIsRefImage )
344       {
345         QPointF aPoint = aData.second;
346         int aXDeg = 0, aYDeg = 0;
347         int aXMin = 0, aYMin = 0;
348         double aXSec = 0, aYSec = 0;
349         HYDROGUI_Tool::DoubleToLambert( aPoint.x(), aXDeg, aXMin, aXSec );
350         HYDROGUI_Tool::DoubleToLambert( aPoint.y(), aYDeg, aYMin, aYSec );
351
352         myPointXDegMap[ aPointType ]->setValue( aXDeg );
353         myPointYDegMap[ aPointType ]->setValue( aYDeg );
354         myPointXMinMap[ aPointType ]->setValue( aXMin );
355         myPointYMinMap[ aPointType ]->setValue( aYMin );
356         myPointXSecMap[ aPointType ]->setValue( aXSec );
357         myPointYSecMap[ aPointType ]->setValue( aYSec );
358       }
359     }
360   }
361 }
362
363 bool HYDROGUI_ImportImageDlg::getTransformationDataMap( TransformationDataMap& theMap,
364                                                         const bool theIsRefImage ) const
365 {
366   theMap.clear();
367   for( int aPointType = HYDROGUI_PrsImage::PointA;
368        aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ )
369   {
370     bool anIsOk[8];
371     for( int i = 0; i < 8; i++ )
372       anIsOk[ i ] = true;
373
374     QtxIntSpinBox* aPointX = theIsRefImage ? myRefPointXMap[ aPointType ] : myPointXMap[ aPointType ];
375     QtxIntSpinBox* aPointY = theIsRefImage ? myRefPointYMap[ aPointType ] : myPointYMap[ aPointType ];
376     int aX1 = aPointX->text().toInt( &anIsOk[0] );
377     int aY1 = aPointY->text().toInt( &anIsOk[1] );
378
379     int aXDeg = 0, aYDeg = 0;
380     int aXMin = 0, aYMin = 0;
381     double aXSec = 0, aYSec = 0;
382     if( !theIsRefImage )
383     {
384       aXDeg = myPointXDegMap[ aPointType ]->text().toInt( &anIsOk[2] );
385       aYDeg = myPointYDegMap[ aPointType ]->text().toInt( &anIsOk[3] );
386       aXMin = myPointXMinMap[ aPointType ]->text().toInt( &anIsOk[4] );
387       aYMin = myPointYMinMap[ aPointType ]->text().toInt( &anIsOk[5] );
388       aXSec = myPointXSecMap[ aPointType ]->text().toDouble( &anIsOk[6] );
389       aYSec = myPointYSecMap[ aPointType ]->text().toDouble( &anIsOk[7] );
390     }
391
392     for( int i = 0; i < 8; i++ )
393       if( !anIsOk[ i ] )
394         return false;
395
396     double aX2 = 0, aY2 = 0;
397     HYDROGUI_Tool::LambertToDouble( aXDeg, aXMin, aXSec, aX2 );
398     HYDROGUI_Tool::LambertToDouble( aYDeg, aYMin, aYSec, aY2 );
399
400     TransformationData aData( QPoint( aX1, aY1 ), QPointF( aX2, aY2 ) );
401     theMap[ aPointType ] = aData;
402   }
403   return true;
404 }
405
406 void HYDROGUI_ImportImageDlg::setPrsPointDataList( const PrsPointDataList& theList )
407 {
408   myPrsPointDataList = theList;
409
410   if( !myPrsPointDataList.isEmpty() )
411   {
412     myModeGroup->button( RefImage )->setEnabled( true );
413
414     myRefImage->clear();
415     myRefImage->addItem( "" ); // first empty item
416
417     PrsPointDataListIterator anIter( myPrsPointDataList );
418     while( anIter.hasNext() )
419       myRefImage->addItem( anIter.next().first );
420   }
421   else
422     myModeGroup->button( RefImage )->setEnabled( false );
423 }
424
425 void HYDROGUI_ImportImageDlg::initializePointSelection()
426 {
427   myPointBtnMap[ HYDROGUI_PrsImage::PointA ]->setChecked( true );
428
429   // ouv: tmp
430   myPointXDegMap[ HYDROGUI_PrsImage::PointA ]->setValue( 50 );
431   myPointXMinMap[ HYDROGUI_PrsImage::PointA ]->setValue( 0 );
432   myPointXSecMap[ HYDROGUI_PrsImage::PointA ]->setValue( 0 );
433   myPointYDegMap[ HYDROGUI_PrsImage::PointA ]->setValue( 50 );
434   myPointYMinMap[ HYDROGUI_PrsImage::PointA ]->setValue( 0 );
435   myPointYSecMap[ HYDROGUI_PrsImage::PointA ]->setValue( 0 );
436
437   myPointXDegMap[ HYDROGUI_PrsImage::PointB ]->setValue( 50 );
438   myPointXMinMap[ HYDROGUI_PrsImage::PointB ]->setValue( 1 );
439   myPointXSecMap[ HYDROGUI_PrsImage::PointB ]->setValue( 0 );
440   myPointYDegMap[ HYDROGUI_PrsImage::PointB ]->setValue( 50 );
441   myPointYMinMap[ HYDROGUI_PrsImage::PointB ]->setValue( 0 );
442   myPointYSecMap[ HYDROGUI_PrsImage::PointB ]->setValue( 0 );
443
444   myPointXDegMap[ HYDROGUI_PrsImage::PointC ]->setValue( 50 );
445   myPointXMinMap[ HYDROGUI_PrsImage::PointC ]->setValue( 0 );
446   myPointXSecMap[ HYDROGUI_PrsImage::PointC ]->setValue( 0 );
447   myPointYDegMap[ HYDROGUI_PrsImage::PointC ]->setValue( 50 );
448   myPointYMinMap[ HYDROGUI_PrsImage::PointC ]->setValue( 1 );
449   myPointYSecMap[ HYDROGUI_PrsImage::PointC ]->setValue( 0 );
450 }
451
452 void HYDROGUI_ImportImageDlg::onBrowse()
453 {
454   QString aFilter( tr( "IMAGE_FILTER" ) );
455   QString aFileName = SUIT_FileDlg::getFileName( this, "", aFilter, tr( "IMPORT_IMAGE_FROM_FILE" ), true );
456   //QString aFileName = "W:/Work/HYDRO/doc/samples/1.bmp";
457   if( !aFileName.isEmpty() )
458   {
459     QImage anImage( aFileName );
460     if( !anImage.isNull() )
461     {
462       myFileName->setText( aFileName );
463       emit createPreview( anImage );
464       myImageNameGroup->setEnabled( true );
465       myTransformGroup->setEnabled( true );
466     }
467   }
468 }
469
470 void HYDROGUI_ImportImageDlg::onModeActivated( int theMode )
471 {
472   bool anIsManual = theMode == Manual;
473   for( int aPointType = HYDROGUI_PrsImage::PointA;
474        aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ )
475   {
476     myRefImageWg->setVisible( !anIsManual );
477
478     myPointXDegMap[ aPointType ]->setVisible( anIsManual );
479     myPointYDegMap[ aPointType ]->setVisible( anIsManual );
480     myPointXMinMap[ aPointType ]->setVisible( anIsManual );
481     myPointYMinMap[ aPointType ]->setVisible( anIsManual );
482     myPointXSecMap[ aPointType ]->setVisible( anIsManual );
483     myPointYSecMap[ aPointType ]->setVisible( anIsManual );
484
485     myRefPointXMap[ aPointType ]->setVisible( !anIsManual );
486     myRefPointYMap[ aPointType ]->setVisible( !anIsManual );
487   }
488
489   QListIterator<QLabel*> anIter( myLambertLabels );
490   while( anIter.hasNext() )
491     anIter.next()->setVisible( anIsManual );
492 }
493
494 void HYDROGUI_ImportImageDlg::onRefImageActivated( const QString& theName )
495 {
496   emit refImageActivated( theName );
497 }
498
499 void HYDROGUI_ImportImageDlg::onPointBtnToggled( bool theState )
500 {
501   int aPointType = HYDROGUI_PrsImage::None;
502   if( theState )
503   {
504     QMapIterator<int, QPushButton*> anIter( myPointBtnMap );
505     while( anIter.hasNext() )
506     {
507       int aBtnPointType = anIter.next().key();
508       QPushButton* aBtn = anIter.value();
509       if( aBtn == sender() )
510         aPointType = aBtnPointType;
511       else
512       {
513         bool anIsBlocked = aBtn->blockSignals( true );
514         aBtn->setChecked( false );
515         aBtn->blockSignals( anIsBlocked );
516       }
517     }
518   }
519   emit activatePointSelection( aPointType );
520 }
521
522 void HYDROGUI_ImportImageDlg::onPointCoordChanged( int theValue )
523 {
524   QObject* aSender = sender();
525   if( !aSender )
526     return;
527
528   for( int aPointType = HYDROGUI_PrsImage::PointA;
529        aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ )
530   {
531     if( aSender == myPointXMap[ aPointType ] ||
532         aSender == myPointYMap[ aPointType ] )
533     {
534       bool anIsY = aSender == myPointYMap[ aPointType ];
535       emit pointCoordChanged( false, aPointType, anIsY, theValue );
536     }
537     else if( aSender == myRefPointXMap[ aPointType ] ||
538              aSender == myRefPointYMap[ aPointType ] )
539     {
540       bool anIsY = aSender == myRefPointYMap[ aPointType ];
541       emit pointCoordChanged( true, aPointType, anIsY, theValue );
542     }
543   }
544 }