- // Generate the filling color for zone
- QStringList aGeomObjectsNames;
-
- HYDROData_SequenceOfObjects aRefObjects = aZone->GetGeometryObjects();
- HYDROData_SequenceOfObjects::Iterator anIter( aRefObjects );
- for ( ; anIter.More(); anIter.Next() )
- {
- Handle(HYDROData_Object) aRefbject =
- Handle(HYDROData_Object)::DownCast( anIter.Value() );
- if ( aRefbject.IsNull() )
- continue;
-
- QString aRefObjectName = aRefbject->GetName();
- if ( aRefObjectName.isEmpty() )
- continue;
-
- aGeomObjectsNames.append( aRefObjectName );
- }
-
- setFillingColor( HYDROGUI_Tool::GenerateFillingColor( aDocument, aGeomObjectsNames ) );
- }
- }
- else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Image) ) )
- {
- Handle(HYDROData_Image) anImageObj =
- Handle(HYDROData_Image)::DownCast( myObject );
-
- removeTextureFile();
-
- QString aTextureFileName = generateTextureFileName( anImageObj );
-
- QImage anImage = anImageObj->Image();
- QString aFilePath = anImageObj->GetFilePath();
- QTransform aTrsf = anImageObj->Trsf();
-
- int aWidth = anImage.width();
- int aHeight = anImage.height();
-
- QString anImageError = "";
-
- QTransform anInversion = QTransform::fromScale( -1, -1 );
- anImage = anImage.transformed( anInversion * aTrsf, Qt::SmoothTransformation );
-
- if ( anImage.isNull() )
- anImageError = QObject::tr( "IMAGE_TRANSFORMATION_CAN_NOT_BE_APPLYED" );
- else
- {
- // Workaround: Scale the texture image to the nearest width multiple 4 due to the CASCADE bug 23813
- int aTrsfWidth = anImage.width();
- int aDelta = aTrsfWidth % 4;
- if ( aDelta > 0 )
- {
- aTrsfWidth += ( 4 - aDelta );
- }
- anImage = anImage.scaledToWidth( aTrsfWidth );
-
- // temporary optimization, to reduce the saved image size (and the texture quality)
- QImage anImageToSave = anImage; //RKV:reduceTexture( anImage, 500 );
-
- bool isSaved = anImageToSave.save( aTextureFileName );
- if ( !isSaved )
- anImageError = QObject::tr( "FILE_CAN_NOT_BE_CREATED" ).arg( aTextureFileName );
- else
- QFile::setPermissions( aTextureFileName, (QFile::Permissions)0x4FFFF );
- }
-
- if ( !anImageError.isEmpty() )
- {
- SUIT_MessageBox::warning( 0, QObject::tr( "SHAPE_IMAGE_ERROR" ),
- QObject::tr( "IMAGE_CAN_NOT_BE_CREATED" ) + anImageError );