{
// Unset color of shape ( this color may be set during preview displaying )
// Default color will be used
-// getDisplayer()->UnsetColor();
+ // getDisplayer()->UnsetColor();
getDisplayer()->UnsetWidth();
-
- MESSAGE("GEOMBase_Helper::display myTexture = "<<getDisplayer()->GetTexture())
+
+ MESSAGE("GEOMBase_Helper::display myTexture = "<<getDisplayer()->GetTexture());
// Enable activisation of selection
getDisplayer()->SetToActivate( true );
{
if ( !object->_is_nil() ) {
QString entry = getEntry( object );
- getDisplayer()->Erase( new SALOME_InteractiveObject(
- entry.toLatin1().constData(),
- "GEOM", strdup( GEOMBase::GetName( object ).toLatin1().constData() ) ), true, updateView );
+ QString name = GEOMBase::GetName( object );
+ getDisplayer()->Erase ( new SALOME_InteractiveObject(entry.toLatin1().constData(),
+ "GEOM",
+ name.toLatin1().constData() ),
+ true, updateView );
}
}
getDisplayer()->SetToActivate( true );
QString entry = getEntry( object );
- getDisplayer()->Redisplay(new SALOME_InteractiveObject
- (entry.toLatin1().constData(), "GEOM", strdup(GEOMBase::GetName(object).toLatin1().constData())), false);
+ QString name = GEOMBase::GetName( object );
+ getDisplayer()->Redisplay
+ (new SALOME_InteractiveObject (entry.toLatin1().constData(),
+ "GEOM",
+ name.toLatin1().constData()),
+ false);
}
if ( withChildren ) {
if ( !CORBA::is_nil( aChild ) ) {
if ( !aChild->_is_nil() ) {
QString entry = getEntry( aChild );
- getDisplayer()->Redisplay( new SALOME_InteractiveObject(
- entry.toLatin1().constData(), "GEOM", strdup( GEOMBase::GetName( aChild ).toLatin1().constData() ) ), false );
+ QString name = GEOMBase::GetName( aChild );
+ getDisplayer()->Redisplay
+ ( new SALOME_InteractiveObject( entry.toLatin1().constData(),
+ "GEOM",
+ name.toLatin1().constData() ),
+ false );
}
}
}
erasePreview( update );
return;
}
-
+
isPreview = true;
QString msg;
if ( !isValid( msg ) )
try {
SUIT_OverrideCursor wc;
ObjectList objects;
-
+
if ( !isWaitCursorEnabled() )
wc.suspend();
-
+
if ( !execute( objects ) || !getOperation()->IsDone() ) {
wc.suspend();
}
else {
for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it )
{
- GEOM::GEOM_Object_var obj=*it;
+ GEOM::GEOM_Object_var obj = *it;
displayPreview( obj, true, activate, false, lineWidth, displayMode, color );
if ( toRemoveFromEngine )
- obj->UnRegister();
+ obj->UnRegister();
}
}
}
const int displayMode,
const int color )
{
- SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
// Set color for preview shape
getDisplayer()->SetColor( color == -1 ? Quantity_NOC_VIOLET : color );
SALOME_Prs* aPrs = getDisplayer()->BuildPrs( object );
if ( aPrs == 0 || aPrs->IsNull() )
return;
-
+
// Make preview not clippable
aPrs->SetClippable (false);
if ( myViewWindow == 0 )
return;
-
+
// Display prs
SUIT_ViewManager* aViewManager = myViewWindow->getViewManager();
if ( aViewManager->getType() == OCCViewer_Viewer::Type() ||
aViewManager->getType() == SVTK_Viewer::Type() )
- {
- SUIT_ViewModel* aViewModel = aViewManager->getViewModel();
- SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
- if (aView)
- aView->Display( getDisplayer(), prs );
- }
+ {
+ SUIT_ViewModel* aViewModel = aViewManager->getViewModel();
+ SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
+ if (aView)
+ aView->Display( getDisplayer(), prs );
+ }
// Add prs to the preview list
myPreview.push_back( (SALOME_Prs*)prs );
continue;
QString anEntry = getEntry( anObj );
if ( anEntry != "" )
- aListOfIO.Append( new SALOME_InteractiveObject(
- anEntry.toLatin1().constData(), "GEOM", strdup( GEOMBase::GetName( anObj ).toLatin1().constData() ) ) );
+ {
+ QString aName = GEOMBase::GetName( anObj );
+ aListOfIO.Append( new SALOME_InteractiveObject( anEntry.toLatin1().constData(),
+ "GEOM", aName.toLatin1().constData() ));
+ }
}
getDisplayer()->LocalSelection( aListOfIO, modes );
SUIT_Application* anApp = 0;
QListIterator<SUIT_Application*> it( anAppList );
while ( it.hasNext() )
- {
- anApp = it.next();
- if ( anApp && anApp->desktop() == aDesktop )
- break;
- }
+ {
+ anApp = it.next();
+ if ( anApp && anApp->desktop() == aDesktop )
+ break;
+ }
return dynamic_cast<SalomeApp_Study*>(anApp->activeStudy());
}
if ( !getStudy() || hasCommand() )
{
MESSAGE("Getting out from openCommand()")
- return res;
+ return res;
}
GEOM::GEOM_IOperations_var anOp = GEOM::GEOM_IOperations::_narrow( getOperation() );
else
{
MESSAGE("anOp->_is_nil() = true")
- }
+ }
return res;
}
QList<SUIT_ViewWindow*> aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows();
QListIterator<SUIT_ViewWindow*> it( aViewWindowsList );
while ( it.hasNext() )
- {
- if ( myViewWindow == it.next() )
- return true;
- }
+ {
+ if ( myViewWindow == it.next() )
+ return true;
+ }
}
myViewWindow = 0;
return false;
bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction, bool erasePreviewFlag )
{
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
- if ( !appStudy )
+ if ( !appStudy )
{
MESSAGE("appStudy is empty")
- return false;
+ return false;
}
_PTR(Study) aStudy = appStudy->studyDS();
showError( msg );
return false;
}
-
+
if(erasePreviewFlag)
erasePreview( false );
QString aName = getObjectName(obj);
if (aName.isEmpty()) {
aName = getNewObjectName(currObj);
- if ( nbObjs > 1 ) {
- if (aName.isEmpty())
- aName = getPrefix(obj);
- if (nbObjs <= 30) {
- // Try to find a unique name
- aName = GEOMBase::GetDefaultName(aName, extractPrefix());
- } else {
- // Don't check name uniqueness in case of numerous objects
- aName = aName + "_" + QString::number(aNumber++);
- }
- } else {
- // PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName()
- if ( aName.isEmpty() )
- aName = GEOMBase::GetDefaultName( getPrefix( obj ) );
- }
+ if ( nbObjs > 1 ) {
+ if (aName.isEmpty())
+ aName = getPrefix(obj);
+ if (nbObjs <= 30) {
+ // Try to find a unique name
+ aName = GEOMBase::GetDefaultName(aName, extractPrefix());
+ } else {
+ // Don't check name uniqueness in case of numerous objects
+ aName = aName + "_" + QString::number(aNumber++);
+ }
+ } else {
+ // PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName()
+ if ( aName.isEmpty() )
+ aName = GEOMBase::GetDefaultName( getPrefix( obj ) );
+ }
}
anEntryList << addInStudy( obj, aName.toLatin1().constData() );
// updateView=false
SalomeApp_Tools::QtCatchCorbaException( e );
abortCommand();
MESSAGE("Exception caught")
- }
+ }
updateViewer();
MESSAGE("result ="<<result)
- return result;
+ return result;
}
//================================================================
// Function : showError
-// Purpose : Shows a message box with infromation about an error taken from getOperation()->GetErrorCode()
+// Purpose : Shows a message box with information about an error taken from getOperation()->GetErrorCode()
//================================================================
void GEOMBase_Helper::showError()
{
switch ( aType )
{
- case GEOM::VERTEX : return QObject::tr( "GEOM_VERTEX" );
- case GEOM::EDGE : return QObject::tr( "GEOM_EDGE" );
- case GEOM::WIRE : return QObject::tr( "GEOM_WIRE" );
- case GEOM::FACE : return QObject::tr( "GEOM_FACE" );
- case GEOM::SHELL : return QObject::tr( "GEOM_SHELL" );
- case GEOM::SOLID : return QObject::tr( "GEOM_SOLID" );
- case GEOM::COMPSOLID: return QObject::tr( "GEOM_COMPOUNDSOLID" );
- case GEOM::COMPOUND : return QObject::tr( "GEOM_COMPOUND" );
- default : return "";
+ case GEOM::VERTEX : return QObject::tr( "GEOM_VERTEX" );
+ case GEOM::EDGE : return QObject::tr( "GEOM_EDGE" );
+ case GEOM::WIRE : return QObject::tr( "GEOM_WIRE" );
+ case GEOM::FACE : return QObject::tr( "GEOM_FACE" );
+ case GEOM::SHELL : return QObject::tr( "GEOM_SHELL" );
+ case GEOM::SOLID : return QObject::tr( "GEOM_SOLID" );
+ case GEOM::COMPSOLID: return QObject::tr( "GEOM_COMPOUNDSOLID" );
+ case GEOM::COMPOUND : return QObject::tr( "GEOM_COMPOUND" );
+ default : return "";
}
}
}
if (inStudy)
return aReturnObject._retn();
-
+
return GEOM::GEOM_Object::_nil();
}
int theIndex )
{
GEOM::GEOM_Object_var object;
-
+
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
if ( study ) {
_PTR(Study) studyDS = study->studyDS();
}
}
}
-
+
return object._retn();
}
// Returns valid object if only one object of the specified type is selected
// (no matter global or local selection is activated). If \a type is TopAbs_SHAPE,
// geometrical object of any valid type is expected.
-//
+//
// \param type type of the object to be obtained from selection
// \return selected geometrical object or nil object if selection is not satisfactory
//================================================================
// (no matter global or local selection is activated). The list of allowed
// shape types is passed via \a types. If \a types includes TopAbs_SHAPE,
// geometrical object of any valid type is expected.
-//
+//
// \param types list of allowed shape types for the objects to be obtained from selection
// \return selected geometrical object or nil object if selection is not satisfactory
//================================================================
//
// The \a type parameter specifies allowed type of the object(s) being selected.
// The \a count parameter specifies exact number of the objects to be retrieved from selection.
-// The \a strict parameter specifies policy being applied to the selection.
+// The \a strict parameter specifies policy being applied to the selection.
// If \a count < 0, then any number of the selected objects is valid (including 0).
// In this case, if \a strict is \c true (default), all selected objects should satisfy
// the specified \a type.
// In this case, if \a strict is \c true (default), function returns empty list if total number of selected
// objects does not correspond to the \a count parameter. Otherwise (if \a strict is \c false),
// function returns valid list of objects if at least \a count objects satisfy specified \a type.
-//
+//
// \param type type of the object(s) to be obtained from selection
// \param count number of items to be retrieved from selection
// \param strict selection policy
//
// The \a types parameter specifies allowed types of the object(s) being selected.
// The \a count parameter specifies exact number of the objects to be retrieved from selection.
-// The \a strict parameter specifies policy being applied to the selection.
+// The \a strict parameter specifies policy being applied to the selection.
// If \a count < 0, then any number of the selected objects is valid (including 0).
// In this case, if \a strict is \c true (default), all selected objects should satisfy
// the specified \a type.
// In this case, if \a strict is \c true (default), function returns empty list if total number of selected
// objects does not correspond to the \a count parameter. Otherwise (if \a strict is \c false),
// function returns valid list of objects if at least \a count objects satisfy specified \a type.
-//
+//
// \param types list of allowed shape types for the objects to be obtained from selection
// \param count number of items to be retrieved from selection
// \param strict selection policy