#include <SalomeApp_Application.h>
#include <SalomeApp_Study.h>
#include <LightApp_SelectionMgr.h>
+#include <LightApp_DataOwner.h>
#include <SalomeApp_Tools.h>
#include <SalomeApp_DataModel.h>
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;
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 );
}
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 );
displayPreview( aPrs, append, update );
getDisplayer()->UnsetName();
+ getDisplayer()->UnsetColor();
+ getDisplayer()->SetDisplayMode( aPrevDispMode );
// Enable activation of displayed objects
getDisplayer()->SetToActivate( true );
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;
+}
+
+
+
+
+
+
\ No newline at end of file
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.
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 );
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