+ Handle(TDataStd_RealArray) anArray;
+ if ( !myLab.FindChild( DataTag_TrsfPoints ).FindAttribute( TDataStd_RealArray::GetID(), anArray ) )
+ anArray = TDataStd_RealArray::Set( myLab.FindChild( DataTag_TrsfPoints ), 1, 12 );
+
+ anArray->SetValue( 1, thePointA.x() );
+ anArray->SetValue( 2, thePointA.y() );
+ anArray->SetValue( 3, thePointB.x() );
+ anArray->SetValue( 4, thePointB.y() );
+ anArray->SetValue( 5, thePointC.x() );
+ anArray->SetValue( 6, thePointC.y() );
+
+ TDataStd_UAttribute::Set( myLab.FindChild( DataTag_TrsfPoints ), GUID_HAS_LOCAL_POINTS );
+
+ if ( theIsUpdate )
+ UpdateTrsf();
+}
+
+bool HYDROData_Image::GetLocalPoints( QPoint& thePointA,
+ QPoint& thePointB,
+ QPoint& thePointC ) const
+{
+ if ( !HasLocalPoints() )
+ return false;
+
+ Handle(TDataStd_RealArray) anArray;
+ myLab.FindChild( DataTag_TrsfPoints ).FindAttribute( TDataStd_RealArray::GetID(), anArray );
+
+ thePointA = QPointF( anArray->Value( 1 ), anArray->Value( 2 ) ).toPoint();
+ thePointB = QPointF( anArray->Value( 3 ), anArray->Value( 4 ) ).toPoint();
+ thePointC = QPointF( anArray->Value( 5 ), anArray->Value( 6 ) ).toPoint();
+
+ return true;
+}
+
+bool HYDROData_Image::HasLocalPoints() const
+{
+ TDF_Label aLabel = myLab.FindChild( DataTag_TrsfPoints, false );
+ if ( aLabel.IsNull() || !aLabel.IsAttribute( GUID_HAS_LOCAL_POINTS ) )
+ return false;
+
+ Handle(TDataStd_RealArray) anArray;
+ return aLabel.FindAttribute( TDataStd_RealArray::GetID(), anArray );
+}
+
+
+void HYDROData_Image::SetGlobalPoints( const TransformationMode& theMode,
+ const QPointF& thePointA,
+ const QPointF& thePointB,
+ const QPointF& thePointC,
+ const bool theIsUpdate )
+{
+ Handle(TDataStd_RealArray) anArray;
+ if ( !myLab.FindChild( DataTag_TrsfPoints ).FindAttribute( TDataStd_RealArray::GetID(), anArray ) )
+ anArray = TDataStd_RealArray::Set( myLab.FindChild( DataTag_TrsfPoints ), 1, 12 );
+
+ anArray->SetValue( 7, thePointA.x() );
+ anArray->SetValue( 8, thePointA.y() );
+ anArray->SetValue( 9, thePointB.x() );
+ anArray->SetValue( 10, thePointB.y() );
+ anArray->SetValue( 11, thePointC.x() );
+ anArray->SetValue( 12, thePointC.y() );
+
+ SetTrsfMode( theMode );
+
+ TDataStd_UAttribute::Set( myLab.FindChild( DataTag_TrsfPoints ), GUID_HAS_GLOBAL_POINTS );
+
+ if ( theIsUpdate )
+ UpdateTrsf();
+
+ /*
+ if( anIsRefImage )
+ {
+ aCPointA = QPointF( aTransform.map( aPointA ) );
+ aCPointB = QPointF( aTransform.map( aPointB ) );
+ aCPointC = QPointF( aTransform.map( aPointC ) );
+
+ // compute Lambert93 points
+ xca = aCPointA.x();
+ yca = aCPointA.y();
+ xcb = aCPointB.x();
+ ycb = aCPointB.y();
+ xcc = aCPointC.x();
+ ycc = aCPointC.y();
+
+ double xla = 0, yla = 0, xlb = 0, ylb = 0, xlc = 0, ylc = 0;
+ HYDROData_Lambert93::toGeo( xca, yca, yla, xla );
+ HYDROData_Lambert93::toGeo( xcb, ycb, ylb, xlb );
+ HYDROData_Lambert93::toGeo( xcc, ycc, ylc, xlc );
+
+ aLPointA = QPointF( xla * 3600.0, yla * 3600.0 ); // convert degrees to seconds
+ aLPointB = QPointF( xlb * 3600.0, ylb * 3600.0 ); // convert degrees to seconds
+ aLPointC = QPointF( xlc * 3600.0, ylc * 3600.0 ); // convert degrees to seconds
+ }
+ */
+}
+
+bool HYDROData_Image::GetGlobalPoints( TransformationMode& theMode,
+ QPointF& thePointA,
+ QPointF& thePointB,
+ QPointF& thePointC ) const
+{
+ if ( !HasGlobalPoints() )
+ return false;
+
+ theMode = GetTrsfMode();
+
+ Handle(TDataStd_RealArray) anArray;
+ myLab.FindChild( DataTag_TrsfPoints ).FindAttribute( TDataStd_RealArray::GetID(), anArray );
+
+ thePointA = QPointF( anArray->Value( 7 ), anArray->Value( 8 ) );
+ thePointB = QPointF( anArray->Value( 9 ), anArray->Value( 10 ) );
+ thePointC = QPointF( anArray->Value( 11 ), anArray->Value( 12 ) );
+
+ return true;
+}
+
+bool HYDROData_Image::HasGlobalPoints() const
+{
+ TDF_Label aLabel = myLab.FindChild( DataTag_TrsfPoints, false );
+ if ( aLabel.IsNull() || !aLabel.IsAttribute( GUID_HAS_GLOBAL_POINTS ) )
+ return false;
+
+ Handle(TDataStd_RealArray) anArray;
+ return aLabel.FindAttribute( TDataStd_RealArray::GetID(), anArray );
+}
+
+void HYDROData_Image::SetReferencePoints( const Handle(HYDROData_Image)& theRefImage,
+ const QPointF& thePointA,
+ const QPointF& thePointB,
+ const QPointF& thePointC,
+ const bool theIsUpdate )
+{
+ SetTrsfReferenceImage( theRefImage );
+ SetGlobalPoints( ReferenceImage, thePointA, thePointB, thePointC, theIsUpdate );
+}
+
+bool HYDROData_Image::GetReferencePoints( Handle(HYDROData_Image)& theRefImage,
+ QPointF& thePointA,
+ QPointF& thePointB,
+ QPointF& thePointC ) const
+{
+ if ( !HasReferencePoints() )
+ return false;
+
+ theRefImage = GetTrsfReferenceImage();
+
+ TransformationMode aMode;
+ GetGlobalPoints( aMode, thePointA, thePointB, thePointC );
+
+ return true;
+}
+
+bool HYDROData_Image::HasReferencePoints() const
+{
+ if ( !HasGlobalPoints() )
+ return false;
+
+ Handle(HYDROData_Image) aRefImage = GetTrsfReferenceImage();
+ if ( aRefImage.IsNull() )
+ return false;
+
+ TransformationMode aTrsfMode = GetTrsfMode();
+ if ( aTrsfMode != ReferenceImage )
+ return false;
+
+ return true;
+}
+
+void HYDROData_Image::SetTrsfMode( const TransformationMode& theMode )
+{
+ TDataStd_Integer::Set( myLab.FindChild( DataTag_TrsfMode ), (int)theMode );
+}
+
+HYDROData_Image::TransformationMode HYDROData_Image::GetTrsfMode() const
+{
+ TransformationMode aResMode = ManualLambert;
+
+ TDF_Label aLabel = myLab.FindChild( DataTag_TrsfPoints, false );
+ if ( !aLabel.IsNull() )
+ {
+ Handle(TDataStd_Integer) aMode;
+ if ( myLab.FindChild( DataTag_TrsfMode ).FindAttribute( TDataStd_Integer::GetID(), aMode ) )
+ aResMode = (TransformationMode)aMode->Get();