Set of parameters of displayPreview methods is increased, display mode and color are added(PAL131191: EDF160 GEOM: in Glue Faces, visualize faces existing twice)

This commit is contained in:
sln 2007-04-11 12:15:57 +00:00
parent 6318afdea1
commit 3e52968abb
2 changed files with 58 additions and 6 deletions

View File

@ -44,6 +44,7 @@
#include <SalomeApp_Application.h> #include <SalomeApp_Application.h>
#include <SalomeApp_Study.h> #include <SalomeApp_Study.h>
#include <LightApp_SelectionMgr.h> #include <LightApp_SelectionMgr.h>
#include <LightApp_DataOwner.h>
#include <SalomeApp_Tools.h> #include <SalomeApp_Tools.h>
#include <SalomeApp_DataModel.h> #include <SalomeApp_DataModel.h>
@ -247,7 +248,9 @@ void GEOMBase_Helper::redisplay( GEOM::GEOM_Object_ptr object,
void GEOMBase_Helper::displayPreview( const bool activate, void GEOMBase_Helper::displayPreview( const bool activate,
const bool update, const bool update,
const bool toRemoveFromEngine, const bool toRemoveFromEngine,
const double lineWidth ) const double lineWidth,
const int displayMode,
const int color )
{ {
isPreview = true; isPreview = true;
QString msg; QString msg;
@ -269,7 +272,7 @@ void GEOMBase_Helper::displayPreview( const bool activate,
else { else {
for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) 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 ) if ( toRemoveFromEngine )
getGeomEngine()->RemoveObject( *it ); getGeomEngine()->RemoveObject( *it );
} }
@ -293,13 +296,18 @@ void GEOMBase_Helper::displayPreview( GEOM::GEOM_Object_ptr object,
const bool append, const bool append,
const bool activate, const bool activate,
const bool update, const bool update,
const double lineWidth ) const double lineWidth,
const int displayMode,
const int color )
{ {
// Set color for preview shape // Set color for preview shape
getDisplayer()->SetColor( Quantity_NOC_VIOLET ); getDisplayer()->SetColor( color == -1 ? Quantity_NOC_VIOLET : color );
// set width of displayed shape // set width of displayed shape
getDisplayer()->SetWidth( lineWidth ); getDisplayer()->SetWidth( lineWidth );
// set display mode of displayed shape
int aPrevDispMode = getDisplayer()->SetDisplayMode( displayMode );
// Disable activation of selection // Disable activation of selection
getDisplayer()->SetToActivate( activate ); getDisplayer()->SetToActivate( activate );
@ -316,6 +324,8 @@ void GEOMBase_Helper::displayPreview( GEOM::GEOM_Object_ptr object,
displayPreview( aPrs, append, update ); displayPreview( aPrs, append, update );
getDisplayer()->UnsetName(); getDisplayer()->UnsetName();
getDisplayer()->UnsetColor();
getDisplayer()->SetDisplayMode( aPrevDispMode );
// Enable activation of displayed objects // Enable activation of displayed objects
getDisplayer()->SetToActivate( true ); getDisplayer()->SetToActivate( true );
@ -985,3 +995,38 @@ SUIT_Desktop* GEOMBase_Helper::getDesktop() const
return myDesktop; 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<SalomeApp_Application*>( session->activeApplication() );
if ( !app )
return false;
LightApp_SelectionMgr* aMgr = app->selectionMgr();
if ( !aMgr )
return false;
aMgr->setSelected( aList, false );
return true;
}

View File

@ -83,7 +83,9 @@ protected:
virtual void displayPreview ( const bool activate = false, virtual void displayPreview ( const bool activate = false,
const bool update = true, const bool update = true,
const bool toRemoveFromEngine = 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. // This is the easiest way to show preview. It is based on execute() method.
// It removes temporary GEOM::GEOM_Objects automatically. // It removes temporary GEOM::GEOM_Objects automatically.
@ -91,7 +93,9 @@ protected:
const bool append = false, const bool append = false,
const bool activate = false, const bool activate = false,
const bool update = true, 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, void displayPreview ( const SALOME_Prs* prs,
const bool append = false, const bool append = false,
const bool = true ); const bool = true );
@ -151,6 +155,9 @@ protected:
Handle(SALOME_InteractiveObject) lastIObject() ; Handle(SALOME_InteractiveObject) lastIObject() ;
// Function returns the last selected object in the list // Function returns the last selected object in the list
// of selected objects // of selected objects
bool selectObjects( ObjectList& objects );
// Selects list of objects
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// Virtual methods, to be redefined in dialog classes // Virtual methods, to be redefined in dialog classes