X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_Shape.cxx;h=9a6c0ca700144bd562ff588259b0508e277063a9;hb=de7cf9bb0a7a41d6487013c87f4a54d0664cd303;hp=4b78aae4c5b7f3b550be93306509c71440716011;hpb=ca0e09c1e1bb19c9855e2f3839243da36097ee1c;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_Shape.cxx b/src/HYDROGUI/HYDROGUI_Shape.cxx index 4b78aae4..9a6c0ca7 100644 --- a/src/HYDROGUI/HYDROGUI_Shape.cxx +++ b/src/HYDROGUI/HYDROGUI_Shape.cxx @@ -36,10 +36,14 @@ #include #include -#include +#include #include +#include #include +#include +#include +#include #include #include @@ -53,7 +57,7 @@ #include HYDROGUI_Shape::HYDROGUI_Shape( const Handle(AIS_InteractiveContext)& theContext, - const Handle(HYDROData_Object)& theObject ) + const Handle(HYDROData_Entity)& theObject ) : myContext( theContext ), myObject( theObject ), myIsHighlight( false ), @@ -102,28 +106,72 @@ void HYDROGUI_Shape::update( const bool theIsUpdateViewer ) // Try to retrieve information from object if ( !myObject.IsNull() ) { - if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Domain) ) ) + Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myObject->Label() ); + + if ( myObject->IsKind( STANDARD_TYPE(HYDROData_ImmersibleZone) ) ) { - Handle(HYDROData_Domain) aDomainObj = - Handle(HYDROData_Domain)::DownCast( myObject ); + Handle(HYDROData_ImmersibleZone) aZoneObj = + Handle(HYDROData_ImmersibleZone)::DownCast( myObject ); - QColor aFillingColor = aDomainObj->GetFillingColor(); - QColor aBorderColor = aDomainObj->GetBorderColor(); - TopoDS_Face aDomainFace = aDomainObj->Face(); + QColor aFillingColor = aZoneObj->GetFillingColor(); + QColor aBorderColor = aZoneObj->GetBorderColor(); + TopoDS_Face aZoneFace = TopoDS::Face( aZoneObj->GetTopShape() ); setFillingColor( aFillingColor, false, false ); setBorderColor( aBorderColor, false, false ); - setFace( aDomainFace, false, false ); + setFace( aZoneFace, false, false ); } else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Polyline) ) ) { Handle(HYDROData_Polyline) aPolyline = Handle(HYDROData_Polyline)::DownCast( myObject ); - TopoDS_Wire aPolylineWire = aPolyline->Wire(); + TopoDS_Wire aPolylineWire = TopoDS::Wire( aPolyline->GetTopShape() ); setWire( aPolylineWire, false, false ); } + 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 = @@ -140,7 +188,8 @@ void HYDROGUI_Shape::update( const bool theIsUpdateViewer ) int aWidth = anImage.width(); int aHeight = anImage.height(); - anImage = anImage.transformed( aTrsf, Qt::SmoothTransformation ); + 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 ); @@ -440,7 +489,7 @@ void HYDROGUI_Shape::colorShapeBorder( const QColor& theColor ) } } -QString HYDROGUI_Shape::generateTextureFileName( const Handle(HYDROData_Object)& theImageObj ) +QString HYDROGUI_Shape::generateTextureFileName( const Handle(HYDROData_Entity)& theImageObj ) { QString aResult; if( !theImageObj.IsNull() )