+ 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();
+
+ Changed( Geom_2d );
+}
+
+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::SetGlobalPointsFromFile( const QString& theFileName )
+{
+ bool aRes = false;
+
+ // Try to open the file
+ QFile aFile( theFileName );
+ if ( !aFile.exists() || !aFile.open( QIODevice::ReadOnly ) ) {
+ return aRes;
+ }
+
+ QPointF aPointA, aPointB;
+ double aXmin, anYmin, aXmax, anYmax;
+ aXmin = anYmin = aXmax = anYmax = -1;
+
+ while ( !aFile.atEnd() &&
+ ( aXmin < 0 || anYmin < 0 || aXmax < 0 || anYmax < 0 ) ) {
+ // Read line
+ QString aLine = aFile.readLine().simplified();
+ aLine.replace( " ", "" );
+ if ( aLine.isEmpty() ) {
+ continue;
+ }
+
+ // Try to read double value after ":"
+ bool isDoubleOk = false;
+ double aDoubleValue = -1;
+ QStringList aValues = aLine.split( ":", QString::SkipEmptyParts );
+ if ( aValues.count() == 2 ) {
+ aDoubleValue = aValues.last().toDouble( &isDoubleOk );
+ }
+
+ // Check the result
+ if ( !isDoubleOk ||
+ boost::math::isnan( aDoubleValue ) ||
+ boost::math::isinf( aDoubleValue ) ) {
+ continue;
+ }
+
+ // Set the value
+ if ( aLine.startsWith( "Xminimum" ) ) {
+ aXmin = aDoubleValue;
+ }
+ else if ( aLine.startsWith( "Yminimum" ) ) {
+ anYmin = aDoubleValue;
+ }
+ else if ( aLine.startsWith( "Xmaximum" ) ) {
+ aXmax = aDoubleValue;
+ }
+ else if ( aLine.startsWith( "Ymaximum" ) ) {
+ anYmax = aDoubleValue;
+ }
+ }
+
+ // Close the file
+ aFile.close();
+
+ if ( aXmin >= 0 && anYmin >= 0 ) {
+ aPointA.setX( aXmin );
+ aPointA.setY( anYmin );
+ }
+
+ if ( aXmax >= 0 && anYmax >= 0 ) {
+ aPointB.setX( aXmax );
+ aPointB.setY( anYmax );
+ }
+
+ if ( !aPointA.isNull() && !aPointB.isNull() ) {
+ SetGlobalPoints( ManualCartesian, aPointA, aPointB );
+ aRes = true;