From 3e52968abb949cec610b7bfe6bd02ded80868453 Mon Sep 17 00:00:00 2001 From: sln Date: Wed, 11 Apr 2007 12:15:57 +0000 Subject: [PATCH] Set of parameters of displayPreview methods is increased, display mode and color are added(PAL131191: EDF160 GEOM: in Glue Faces, visualize faces existing twice) --- src/GEOMBase/GEOMBase_Helper.cxx | 53 +++++++++++++++++++++++++++++--- src/GEOMBase/GEOMBase_Helper.h | 11 +++++-- 2 files changed, 58 insertions(+), 6 deletions(-) diff --git a/src/GEOMBase/GEOMBase_Helper.cxx b/src/GEOMBase/GEOMBase_Helper.cxx index 460b77b52..7fdc7a14c 100755 --- a/src/GEOMBase/GEOMBase_Helper.cxx +++ b/src/GEOMBase/GEOMBase_Helper.cxx @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -247,7 +248,9 @@ void GEOMBase_Helper::redisplay( GEOM::GEOM_Object_ptr object, void GEOMBase_Helper::displayPreview( const bool activate, const bool update, const bool toRemoveFromEngine, - const double lineWidth ) + const double lineWidth, + const int displayMode, + const int color ) { isPreview = true; QString msg; @@ -269,7 +272,7 @@ void GEOMBase_Helper::displayPreview( const bool activate, else { for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) { - displayPreview( *it, true, activate, false, lineWidth ); + displayPreview( *it, true, activate, false, lineWidth, displayMode, color ); if ( toRemoveFromEngine ) getGeomEngine()->RemoveObject( *it ); } @@ -293,13 +296,18 @@ void GEOMBase_Helper::displayPreview( GEOM::GEOM_Object_ptr object, const bool append, const bool activate, const bool update, - const double lineWidth ) + const double lineWidth, + const int displayMode, + const int color ) { // Set color for preview shape - getDisplayer()->SetColor( Quantity_NOC_VIOLET ); + getDisplayer()->SetColor( color == -1 ? Quantity_NOC_VIOLET : color ); // set width of displayed shape getDisplayer()->SetWidth( lineWidth ); + + // set display mode of displayed shape + int aPrevDispMode = getDisplayer()->SetDisplayMode( displayMode ); // Disable activation of selection getDisplayer()->SetToActivate( activate ); @@ -316,6 +324,8 @@ void GEOMBase_Helper::displayPreview( GEOM::GEOM_Object_ptr object, displayPreview( aPrs, append, update ); getDisplayer()->UnsetName(); + getDisplayer()->UnsetColor(); + getDisplayer()->SetDisplayMode( aPrevDispMode ); // Enable activation of displayed objects getDisplayer()->SetToActivate( true ); @@ -985,3 +995,38 @@ SUIT_Desktop* GEOMBase_Helper::getDesktop() const return myDesktop; } +//================================================================ +// Function : selectObjects +// Purpose : Selects list of objects +//================================================================ +bool GEOMBase_Helper::selectObjects( ObjectList& objects ) +{ + SUIT_DataOwnerPtrList aList; + ObjectList::iterator anIter; + for ( anIter = objects.begin(); anIter != objects.end(); ++anIter ) + { + string entry = getEntry( *anIter ); + QString aEntry( entry.c_str() ); + LightApp_DataOwner* anOwher = new LightApp_DataOwner( aEntry ); + aList.append( anOwher ); + } + + SUIT_Session* session = SUIT_Session::session(); + SalomeApp_Application* app = dynamic_cast( session->activeApplication() ); + if ( !app ) + return false; + + LightApp_SelectionMgr* aMgr = app->selectionMgr(); + if ( !aMgr ) + return false; + + aMgr->setSelected( aList, false ); + + return true; +} + + + + + + \ No newline at end of file diff --git a/src/GEOMBase/GEOMBase_Helper.h b/src/GEOMBase/GEOMBase_Helper.h index a0cb49d9e..f55088e97 100755 --- a/src/GEOMBase/GEOMBase_Helper.h +++ b/src/GEOMBase/GEOMBase_Helper.h @@ -83,7 +83,9 @@ protected: virtual void displayPreview ( const bool activate = false, const bool update = true, const bool toRemoveFromEngine = true, - const double lineWidth = -1 ); + const double lineWidth = -1, + const int displayMode = -1, + const int color = -1 ); // This is the easiest way to show preview. It is based on execute() method. // It removes temporary GEOM::GEOM_Objects automatically. @@ -91,7 +93,9 @@ protected: const bool append = false, const bool activate = false, const bool update = true, - const double lineWidth = -1 ); + const double lineWidth = -1, + const int displayMode = -1, + const int color = -1 ); void displayPreview ( const SALOME_Prs* prs, const bool append = false, const bool = true ); @@ -151,6 +155,9 @@ protected: Handle(SALOME_InteractiveObject) lastIObject() ; // Function returns the last selected object in the list // of selected objects + + bool selectObjects( ObjectList& objects ); + // Selects list of objects //////////////////////////////////////////////////////////////////////////// // Virtual methods, to be redefined in dialog classes -- 2.39.2