From c7706b7c1fdb483c847c06a22e46a74c1e41b2f3 Mon Sep 17 00:00:00 2001 From: dmv Date: Fri, 28 Nov 2008 13:35:25 +0000 Subject: [PATCH] IPAL20128 Popup menus are different for imported table and table included in stored study --- src/VISUGUI/VisuGUI_Selection.cxx | 75 ++++++++++++++++++++++++------- src/VISUGUI/VisuGUI_Selection.h | 6 +-- 2 files changed, 62 insertions(+), 19 deletions(-) diff --git a/src/VISUGUI/VisuGUI_Selection.cxx b/src/VISUGUI/VisuGUI_Selection.cxx index b04bbecc..7f00ffc4 100644 --- a/src/VISUGUI/VisuGUI_Selection.cxx +++ b/src/VISUGUI/VisuGUI_Selection.cxx @@ -122,6 +122,7 @@ QString VisuGUI_Selection::type( const int ind ) const ENUM2STRING( aResStr, VISU::TSTREAMLINES ); ENUM2STRING( aResStr, VISU::TPLOT3D ); ENUM2STRING( aResStr, VISU::TANIMATION ); + ENUM2STRING( aResStr, VISU::TPOINTMAP3D ); } } @@ -386,11 +387,21 @@ struct TViewFunctor { VISU_Actor* anActor = NULL; VISU::Prs3d_i* aPrs3d = NULL; + VISU_ActorBase* anActorBase = NULL; + VISU::PointMap3d_i* aPointMap3d = NULL; SVTK_ViewWindow* aViewWindow = NULL; - if(!GetPrs3dSelectionInfo(theModule, theEntry, aPrs3d, aViewWindow, anActor)) - return QString(); - - return get(aPrs3d, aViewWindow, anActor); + if(GetPrs3dSelectionInfo(theModule, theEntry, aPrs3d, aViewWindow, anActor)) + return get(aPrs3d, aViewWindow, anActor); + else { + aViewWindow = GetActiveViewWindow(theModule); + VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule); + if ( aSelectionInfo.empty() ) + return QString(); + VISU::TSelectionItem aSelectionItem = aSelectionInfo.front(); + aPointMap3d = dynamic_cast(aSelectionItem.myObjectInfo.myBase); + anActorBase = VISU::FindActorBase(aViewWindow, aPointMap3d); + return getPointMap(aPointMap3d, aViewWindow, anActorBase); + } } QString @@ -401,6 +412,15 @@ struct TViewFunctor { return QString(); } + + QString + virtual + getPointMap(VISU::PointMap3d_i* thePrs3d, + SVTK_ViewWindow* theViewWindow, + VISU_ActorBase* theActor) + { + return QString(); + } }; @@ -421,7 +441,23 @@ struct TGetRepesentationFunctor: TViewFunctor ENUM2STRING( aResStr, VISU::INSIDEFRAME ); ENUM2STRING( aResStr, VISU::SURFACEFRAME ); ENUM2STRING( aResStr, VISU::FEATURE_EDGES ); - } + } + return aResStr; + } + + QString + virtual + getPointMap(VISU::PointMap3d_i* thePrs3d, + SVTK_ViewWindow* theViewWindow, + VISU_ActorBase* theActorBase) + { + QString aResStr = ""; + if (theActorBase) { + switch (theActorBase->GetRepresentation()) { + ENUM2STRING( aResStr, VISU::WIREFRAME ); // = 1 + ENUM2STRING( aResStr, VISU::SHADED ); // = 2 + } + } return aResStr; } }; @@ -461,19 +497,15 @@ int VisuGUI_Selection::nbChild( const int ind, const bool named ) const } //---------------------------------------------------------------------------- -QString VisuGUI_Selection::nbChildren( const int ind ) const +int VisuGUI_Selection::nbChildren( const int ind ) const { - QString aResStr; - aResStr.setNum( nbChild( ind, false ) ); - return aResStr; + return nbChild( ind, false ); } //---------------------------------------------------------------------------- -QString VisuGUI_Selection::nbNamedChildren( const int ind ) const +int VisuGUI_Selection::nbNamedChildren( const int ind ) const { - QString aResStr; - aResStr.setNum( nbChild( ind, true ) ); - return aResStr; + return nbChild( ind, true ); } @@ -507,6 +539,17 @@ struct TIsShrunkFunctor: TViewFunctor { return theActor->IsShrunk() ? "1" : "0"; } + + QString + virtual + getPointMap(VISU::PointMap3d_i* thePointMap, + SVTK_ViewWindow* theViewWindow, + VISU_ActorBase* theActorBase) + { + if (theActorBase) + return theActorBase->IsShrunk() ? "1" : "0"; + else return "0"; + } }; QString VisuGUI_Selection::isShrunk( const int ind ) const @@ -516,9 +559,9 @@ QString VisuGUI_Selection::isShrunk( const int ind ) const //---------------------------------------------------------------------------- -QString VisuGUI_Selection::hasActor( const int ind ) const +bool VisuGUI_Selection::hasActor( const int ind ) const { - return representation( ind ).isEmpty() ? "0" : "1"; + return !representation( ind ).isEmpty(); } @@ -636,7 +679,7 @@ bool VisuGUI_Selection::hasCurves( const int ind ) const CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(refSO); if(!CORBA::is_nil(aCORBAObject)){ PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject); - if(VISU::Curve_i* aCurve = dynamic_cast(aServant.in())) + if(dynamic_cast(aServant.in())) return true; } } diff --git a/src/VISUGUI/VisuGUI_Selection.h b/src/VISUGUI/VisuGUI_Selection.h index 2f0a7af4..fde8147e 100644 --- a/src/VISUGUI/VisuGUI_Selection.h +++ b/src/VISUGUI/VisuGUI_Selection.h @@ -53,11 +53,11 @@ private: QString medSource( const int ) const; QString nbTimeStamps( const int ) const; QString representation( const int ) const; - QString nbChildren( const int ) const; - QString nbNamedChildren( const int ) const; + int nbChildren( const int ) const; + int nbNamedChildren( const int ) const; QString isVisible( const int ) const; QString isShrunk( const int ) const; - QString hasActor( const int ) const; + bool hasActor( const int ) const; QString isShading( const int ) const; QString isScalarMapAct( const int ) const; bool isVisuComponent( const int ) const; -- 2.39.2