X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_ImmersibleZoneOp.cxx;h=d59e7d102cbc9e29ab4cf17f422638fefe028469;hb=a1431f03eac1d1aed4203d0568d987c41ce939b3;hp=276d51afcd1a229eac14016021f9e590caf7038c;hpb=2d99821157e770385d7af917b2d22d6aa3cacb7e;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.cxx b/src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.cxx index 276d51af..d59e7d10 100644 --- a/src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.cxx @@ -85,9 +85,9 @@ void HYDROGUI_ImmersibleZoneOp::startOperation() if ( !aRefPolyline.IsNull() ) aSelectedPolyline = aRefPolyline->GetName(); - Handle(HYDROData_Bathymetry) aRefBathymetry = myEditedObject->GetBathymetry(); - if ( !aRefBathymetry.IsNull() ) - aSelectedBathymetry = aRefBathymetry->GetName(); + Handle(HYDROData_IAltitudeObject) aRefAltitude = myEditedObject->GetAltitudeObject(); + if ( !aRefAltitude.IsNull() ) + aSelectedBathymetry = aRefAltitude->GetName(); } } @@ -99,7 +99,7 @@ void HYDROGUI_ImmersibleZoneOp::startOperation() { Handle(HYDROData_PolylineXY) aPolylineObj = Handle(HYDROData_PolylineXY)::DownCast( anIter.Current() ); - if ( aPolylineObj.IsNull() || !aPolylineObj->IsClosed() ) + if ( aPolylineObj.IsNull() )//TODO: || !aPolylineObj->IsClosed() ) continue; QString aPolylineName = aPolylineObj->GetName(); @@ -185,11 +185,6 @@ bool HYDROGUI_ImmersibleZoneOp::processApply( int& theUpdateFlags, } } - Handle(HYDROData_ImmersibleZone) aZoneObj = myIsEdit ? myEditedObject : - Handle(HYDROData_ImmersibleZone)::DownCast( doc()->CreateObject( KIND_IMMERSIBLE_ZONE ) ); - if ( aZoneObj.IsNull() ) - return false; - Handle(HYDROData_PolylineXY) aZonePolyline; Handle(HYDROData_Bathymetry) aZoneBathymetry; @@ -207,6 +202,16 @@ bool HYDROGUI_ImmersibleZoneOp::processApply( int& theUpdateFlags, HYDROGUI_Tool::FindObjectByName( module(), aBathymetryName, KIND_BATHYMETRY ) ); } + + if ( HYDROData_ImmersibleZone::generateTopShape( aZonePolyline ).IsNull() ) + { + theErrorMsg = tr( "ZONE_OBJECT_CANNOT_BE_CREATED" ); + return false; + } + + Handle(HYDROData_ImmersibleZone) aZoneObj = myIsEdit ? myEditedObject : + Handle(HYDROData_ImmersibleZone)::DownCast( doc()->CreateObject( KIND_IMMERSIBLE_ZONE ) ); + aZoneObj->SetName( anObjectName ); if ( !myIsEdit ) @@ -216,7 +221,7 @@ bool HYDROGUI_ImmersibleZoneOp::processApply( int& theUpdateFlags, } aZoneObj->SetPolyline( aZonePolyline ); - aZoneObj->SetBathymetry( aZoneBathymetry ); + aZoneObj->SetAltitudeObject( aZoneBathymetry ); aZoneObj->Update(); closePreview(); @@ -224,7 +229,9 @@ bool HYDROGUI_ImmersibleZoneOp::processApply( int& theUpdateFlags, if( !myIsEdit ) module()->setObjectVisible( HYDROGUI_Tool::GetActiveOCCViewId( module() ), aZoneObj, true ); - theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced; + module()->setIsToUpdate( aZoneObj ); + + theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer; return true; } @@ -235,17 +242,13 @@ void HYDROGUI_ImmersibleZoneOp::onCreatePreview( const QString& thePolylineName if ( !aPanel ) return; - TopoDS_Wire aWire; - TopoDS_Shape aShape; + TopoDS_Shape aZoneShape; Handle(HYDROData_PolylineXY) aPolyline = Handle(HYDROData_PolylineXY)::DownCast( HYDROGUI_Tool::FindObjectByName( module(), thePolylineName, KIND_POLYLINEXY ) ); if ( !aPolyline.IsNull() ) { - aShape = aPolyline->GetShape(); - if ( aShape.ShapeType() == TopAbs_WIRE ) { - aWire = TopoDS::Wire( aShape ); - } + aZoneShape = HYDROData_ImmersibleZone::generateTopShape( aPolyline ); } LightApp_Application* anApp = module()->getApp(); @@ -275,14 +278,10 @@ void HYDROGUI_ImmersibleZoneOp::onCreatePreview( const QString& thePolylineName myPreviewPrs->setFillingColor( aFillingColor, false, false ); myPreviewPrs->setBorderColor( aBorderColor, false, false ); - if ( !aWire.IsNull() ) { - myPreviewPrs->setFace( aWire ); - } else if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_COMPOUND ) { - TopoDS_Compound aCompound = TopoDS::Compound( aShape ); - if ( !aCompound.IsNull() ) { - myPreviewPrs->setFaces( aCompound ); - } - } + TopoDS_Face aFace; + if( !aZoneShape.IsNull() ) + aFace = TopoDS::Face( aZoneShape ); + myPreviewPrs->setFace( aFace ); } void HYDROGUI_ImmersibleZoneOp::closePreview()