From dc3aede73d0b7a4be38f0a09ee14c2ca10ff8fea Mon Sep 17 00:00:00 2001 From: mzn Date: Fri, 29 Nov 2013 14:49:27 +0000 Subject: [PATCH] Implement show/hide for profiles. --- src/HYDROGUI/HYDROGUI_Module.cxx | 15 +++++++++++---- src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx | 3 ++- src/HYDROGUI/HYDROGUI_Shape.cxx | 23 +++++++++++++++++++++++ src/HYDROGUI/HYDROGUI_Tool.cxx | 3 ++- 4 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index 36b56ec1..9357c85f 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -41,6 +41,7 @@ #include "HYDROGUI_PolylineOp.h" #include +#include #include #include @@ -229,6 +230,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, bool anIsMustBeUpdatedImage = false; bool anIsPolyline = false; bool anIsProfile = false; + bool anIsValidProfile = false; bool anAllAreProfiles = false; bool anIsBathymetry = false; bool anIsCalculation = false; @@ -291,6 +293,12 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, else if( anObject->GetKind() == KIND_PROFILE ) { anIsProfile = true; aNbOfSelectedProfiles++; + + Handle(HYDROData_Profile) aProfile = + Handle(HYDROData_Profile)::DownCast( anObject ); + if( !aProfile.IsNull() && aProfile->IsValid() ) { + anIsValidProfile = true; + } } else if( anObject->GetKind() == KIND_CALCULATION ) anIsCalculation = true; @@ -430,9 +438,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, theMenu->addAction( action( SetColorId ) ); theMenu->addSeparator(); } - } - - if ( anAllAreProfiles ) { + } else if ( anAllAreProfiles ) { theMenu->addAction( action( SelectedGeoreferencementId ) ); theMenu->addSeparator(); } @@ -440,7 +446,8 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, theMenu->addAction( action( DeleteId ) ); theMenu->addSeparator(); - if( anIsImage || anIsPolyline || anIsImmersibleZone || anIsZone || anIsRegion || anIsBathymetry || anIsObstacle ) + if( anIsImage || anIsPolyline || anIsImmersibleZone || anIsZone || + anIsRegion || anIsBathymetry || anIsObstacle || anIsValidProfile ) { if( anIsHiddenInSelection ) theMenu->addAction( action( ShowId ) ); diff --git a/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx b/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx index faf46892..51dfa2f3 100644 --- a/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx +++ b/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx @@ -105,7 +105,8 @@ HYDROGUI_Shape* HYDROGUI_OCCDisplayer::createShape( const int anObjectKind != KIND_IMMERSIBLE_ZONE && anObjectKind != KIND_REGION && anObjectKind != KIND_ZONE && - anObjectKind != KIND_OBSTACLE ) + anObjectKind != KIND_OBSTACLE && + anObjectKind != KIND_PROFILE ) return aResShape; aResShape = new HYDROGUI_Shape( theContext, theObject ); diff --git a/src/HYDROGUI/HYDROGUI_Shape.cxx b/src/HYDROGUI/HYDROGUI_Shape.cxx index 799c09f2..f37fe900 100644 --- a/src/HYDROGUI/HYDROGUI_Shape.cxx +++ b/src/HYDROGUI/HYDROGUI_Shape.cxx @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -285,6 +286,28 @@ void HYDROGUI_Shape::update( const bool theIsUpdateViewer ) updateShape( false, false ); //TODO END of the block of code to be reimplemented } + else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Profile) ) ) + { + Handle(HYDROData_Profile) aProfile = + Handle(HYDROData_Profile)::DownCast( myObject ); + + if ( aProfile->IsValid() ) { + TopoDS_Shape aProfileShape = aProfile->GetShape3D(); + + if ( !aProfileShape.IsNull() ) { + if ( aProfileShape.ShapeType() == TopAbs_WIRE ) { + TopoDS_Wire aProfileWire = TopoDS::Wire( aProfileShape ); + setWire( aProfileWire, false, false ); + } else { + myTopoShape = aProfileShape; + myDisplayMode = AIS_WireFrame; + + buildShape(); + updateShape( false, false ); + } + } + } + } } if ( myShape.IsNull() || !isVisible() ) diff --git a/src/HYDROGUI/HYDROGUI_Tool.cxx b/src/HYDROGUI/HYDROGUI_Tool.cxx index 0f2b7c2c..bb9da679 100644 --- a/src/HYDROGUI/HYDROGUI_Tool.cxx +++ b/src/HYDROGUI/HYDROGUI_Tool.cxx @@ -221,7 +221,8 @@ void HYDROGUI_Tool::GetPrsSubObjects( HYDROGUI_Module* theModule, ( anObject->GetKind() == KIND_REGION ) || ( anObject->GetKind() == KIND_BATHYMETRY ) || ( anObject->GetKind() == KIND_ZONE ) || - ( anObject->GetKind() == KIND_OBSTACLE ) ) ) + ( anObject->GetKind() == KIND_OBSTACLE ) || + ( anObject->GetKind() == KIND_PROFILE ) ) ) { theSeq.Append( anObject ); } -- 2.39.2