+ else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Region) ) )
+ {
+ Handle(HYDROData_Region) aRegion =
+ Handle(HYDROData_Region)::DownCast( myObject );
+ }
+ else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Zone) ) )
+ {
+ Handle(HYDROData_Zone) aZone =
+ Handle(HYDROData_Zone)::DownCast( myObject );
+
+ TopoDS_Face aZoneFace = TopoDS::Face( aZone->GetShape() );
+
+ // 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 );
+ }
+
+ setFace( aZoneFace, false, false );
+ if (aZone->IsMergingNeed() && aZone->GetMergeType() == HYDROData_Zone::Merge_UNKNOWN )
+ {
+ // Red color for a zone with bathymetry conflict
+ setFillingColor( Qt::red );
+ }
+ else
+ {
+ 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();
+
+ QTransform anInversion = QTransform::fromScale( -1, -1 );
+ anImage = anImage.transformed( anInversion * aTrsf, Qt::SmoothTransformation );
+
+ // temporary optimization, to reduce the saved image size (and the texture quality)
+ QImage anImageToSave = reduceTexture( anImage, 500 );
+ anImageToSave.save( aTextureFileName );
+
+ QPointF aPoint1( 0, 0 );
+ QPointF aPoint2( aWidth, 0 );
+ QPointF aPoint3( aWidth, aHeight );
+ QPointF aPoint4( 0, aHeight );
+
+ aPoint1 = aTrsf.map( aPoint1 );
+ aPoint2 = aTrsf.map( aPoint2 );
+ aPoint3 = aTrsf.map( aPoint3 );
+ aPoint4 = aTrsf.map( aPoint4 );
+
+ QPolygonF aPolygon = QPolygonF() << aPoint1 << aPoint2 << aPoint3 << aPoint4;
+ QRectF aRect = aPolygon.boundingRect();
+
+ gp_Pnt aPnt1( aRect.topLeft().x(), aRect.topLeft().y(), 0 );
+ gp_Pnt aPnt2( aRect.topRight().x(), aRect.topRight().y(), 0 );
+ gp_Pnt aPnt3( aRect.bottomRight().x(), aRect.bottomRight().y(), 0 );
+ gp_Pnt aPnt4( aRect.bottomLeft().x(), aRect.bottomLeft().y(), 0 );
+
+ TopoDS_Edge anEdge1 = BRepBuilderAPI_MakeEdge( aPnt1, aPnt2 ).Edge();
+ TopoDS_Edge anEdge2 = BRepBuilderAPI_MakeEdge( aPnt2, aPnt3 ).Edge();
+ TopoDS_Edge anEdge3 = BRepBuilderAPI_MakeEdge( aPnt3, aPnt4 ).Edge();
+ TopoDS_Edge anEdge4 = BRepBuilderAPI_MakeEdge( aPnt4, aPnt1 ).Edge();
+
+ TopoDS_Wire aWire = BRepBuilderAPI_MakeWire( anEdge1, anEdge2, anEdge3, anEdge4 ).Wire();
+
+ setTextureFileName( aTextureFileName, false, false );
+ setFace( aWire, false, false );
+ }