return;
for ( int i = 0, n = aList->length(); i < n; i++ ) {
- TreeWidgetItem* item = new TreeWidgetItem( myTreeConstraints,
- GEOM::GeomObjPtr( aList[i] ) );
+ /*TreeWidgetItem* item =*/
+ new TreeWidgetItem( myTreeConstraints, GEOM::GeomObjPtr( aList[i] ) );
}
myEditCurrentArgument->setEnabled(false);
std::string objectEntry = i->first;
addNode( objectEntry );
parseTreeWard( i->second.first );
- if( i->second.first.size() > myMaxUpwardLevelsNumber )
+ if((int) i->second.first.size() > myMaxUpwardLevelsNumber )
myMaxUpwardLevelsNumber = i->second.first.size();
parseTreeWard( i->second.second );
- if( i->second.second.size() > myMaxDownwardLevelsNumber )
+ if((int) i->second.second.size() > myMaxDownwardLevelsNumber )
myMaxDownwardLevelsNumber = i->second.second.size();
}
//=================================================================================
void DependencyTree_View::parseTreeWardArrow( const GEOMUtils::LevelsList& theWard)
{
- for( int j = 0; j < theWard.size(); j++ ) {
+ for( size_t j = 0; j < theWard.size(); j++ ) {
GEOMUtils::LevelInfo Level = theWard.at(j);
GEOMUtils::LevelInfo::const_iterator node;
for( node = Level.begin(); node != Level.end(); node++ ) {
DependencyTree_Object* object = myTreeMap[ node->first ];
std::vector<std::string> Links = node->second;
- for( int link = 0; link < Links.size(); link++ ) {
+ for( size_t link = 0; link < Links.size(); link++ ) {
DependencyTree_Object* LinkObject = myTreeMap[ Links[ link ] ];
if( object && LinkObject )
addArrow( LinkObject, object );
std::map< int, std::vector< std::string > >::const_iterator level;
for( level = levelObjects.begin(); level != levelObjects.end(); level++ ) {
int step = -horDistance * ( int(level->second.size()) - 1 ) / 2;
- for( int objIter = 0; objIter < level->second.size(); objIter++ ) {
+ for( size_t objIter = 0; objIter < level->second.size(); objIter++ ) {
DependencyTree_Object* anObject = myTreeMap[ level->second.at( objIter ) ];
anObject->setPos( step, verDistance * level->first );
step += horDistance;
std::map< int, std::vector< std::string > >& theLevelObjects,
int theCurrentLevel, const int theLevelStep )
{
- for( int level = 0; level < theWard.size(); level++ ) {
+ for( int level = 0, size = theWard.size(); level < size; level++ ) {
if( level >= myLevelsNumber )
return;
theCurrentLevel += theLevelStep;
//=================================================================================
void DependencyTree_View::drawWardArrows( const GEOMUtils::LevelsList& theWard )
{
- for( int j = 0; j < theWard.size(); j++ ) {
+ for( int j = 0, size = theWard.size(); j < size; j++ ) {
if( j >= myLevelsNumber )
break;
GEOMUtils::LevelInfo Level = theWard.at(j);
for( node = Level.begin(); node != Level.end(); node++ ) {
DependencyTree_Object* object = myTreeMap[ node->first ];
GEOMUtils::NodeLinks Links = node->second;
- for( int link = 0; link < Links.size(); link++ ) {
+ for( size_t link = 0; link < Links.size(); link++ ) {
DependencyTree_Object* LinkObject = myTreeMap[ Links[ link ] ];
if( isItemAdded( object ) && isItemAdded( LinkObject ) ) {
DependencyTree_Arrow* arrow = myArrows[ std::pair<DependencyTree_Object*,DependencyTree_Object*>( LinkObject, object ) ];
return myMaxUpwardLevelsNumber;
else if( myDisplayDescendants->isChecked() )
return myMaxDownwardLevelsNumber;
+ return 0;
}
// Purpose :
//================================================================
GEOMBase_Helper::GEOMBase_Helper( SUIT_Desktop* desktop )
- : myDesktop( desktop ), myViewWindow( 0 ), myDisplayer( 0 ), myCommand( 0 ), isPreview( false ),
+ : myDisplayer( 0 ), myCommand( 0 ), myViewWindow( 0 ), isPreview( false ), myDesktop( desktop ),
myIsApplyAndClose( false ), myIsOptimizedBrowsing( false ), myIsWaitCursorEnabled( true ),
myIsDisableBrowsing(false), myIsDisplayResult(true)
{
QString GEOMGUI_AnnotationMgr::GetEntrySeparator()
{
- return "_annotation:";
+ return "_annotation:";
}
//================================================================
setDisplayProperties( aPresentation, aView, getEntry( theObject ).c_str() );
// add Prs to preview
- SUIT_ViewWindow* vw = getApplication()->desktop()->activeWindow();
+ //SUIT_ViewWindow* vw = getApplication()->desktop()->activeWindow();
SOCC_Prs* aPrs =
dynamic_cast<SOCC_Prs*>( ( aView )->CreatePrs( 0 ) );
if ( !aShape.IsNull() ) {
- gp_Ax3 aShapeLCS = gp_Ax3().Transformed( aShape.Location().Transformation() );
GEOMGUI_AnnotationAttrs::SetupPresentation( aPresentation, aProperty, aShapeLCS );
if ( aProperty.ShapeType == TopAbs_SHAPE ) {
aPresentation->SetHilightShape( aShape );
bool GEOMGUI_Selection::hasChildren( const _PTR(SObject)& obj )
{
- if ( obj ) {
- // as soon as Use Case browser data tree was added
- return obj->GetStudy()->GetUseCaseBuilder()->HasChildren( obj );
- }
+ // as soon as Use Case browser data tree was added
+ return obj ? obj->GetStudy()->GetUseCaseBuilder()->HasChildren( obj ) : false;
}
bool GEOMGUI_Selection::expandable( const _PTR(SObject)& obj )
if ( aPixmap.IsNull() ) {
QPixmap px(":images/default_texture.png");
if ( !px.isNull() )
- aPixmap = OCCViewer_Utilities::imageToPixmap( px.toImage() );
+ aPixmap = OCCViewer_Utilities::imageToPixmap( px.toImage() );
}
return aPixmap;
}
*/
//=================================================================
GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* st )
-: myIsRedisplayed( false )
+ : myUpdateColorScale(true), myIsRedisplayed( false )
{
if( st )
myApp = dynamic_cast<SalomeApp_Application*>( st->application() );
QString entry = p->GetEntry();
if ( !entry.isEmpty() ) {
if ( vId != -1 )
- aStudy->setObjectProperty( vId, entry, GEOM::propertyName( GEOM::Visibility ), on );
+ aStudy->setObjectProperty( vId, entry, GEOM::propertyName( GEOM::Visibility ), on );
setVisibilityState( entry, on ? Qtx::ShownState : Qtx::HiddenState );
}
}
if ( !aTexture.IsNull() ) {
Handle(Prs3d_PointAspect) aTextureAspect =
new Prs3d_PointAspect( HasColor() ?
- // predefined color, manually set to displayer via GEOM_Displayer::SetColor() function
- (Quantity_NameOfColor)GetColor() :
- // color from properties
+ // predefined color, manually set to displayer via GEOM_Displayer::SetColor() function
+ (Quantity_NameOfColor)GetColor() :
+ // color from properties
SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::PointColor ) ).value<QColor>() ),
aWidth, aHeight,
aTexture );
// - transparency (opacity = 1-transparency)
propMap.insert( GEOM::propertyName( GEOM::Transparency ),
- resMgr->integerValue( "Geometry", "transparency", 0 ) / 100. );
+ resMgr->integerValue( "Geometry", "transparency", 0 ) / 100. );
// - display mode (take default value from preferences)
propMap.insert( GEOM::propertyName( GEOM::DisplayMode ),
Standard_Real aColorScaleMin = 0, aColorScaleMax = 0;
Standard_Boolean anIsBoolean = Standard_False;
- SALOME_ListIO aSelectedObjects;
- myApp->selectionMgr()->selectedObjects( aSelectedObjects );
- if( aSelectedObjects.Extent() == 1 )
+ Handle(SALOME_InteractiveObject) anIO;
+ if ( myUpdateColorScale )
+ anIO = myApp->selectionMgr()->soleSelectedObject();
+
+ if( !anIO.IsNull() )
{
- Handle(SALOME_InteractiveObject) anIO = aSelectedObjects.First();
- if( !anIO.IsNull() )
+ SOCC_Prs* aPrs = dynamic_cast<SOCC_Prs*>( aViewModel->CreatePrs( anIO->getEntry() ) );
+ if( aPrs )
{
- SOCC_Prs* aPrs = dynamic_cast<SOCC_Prs*>( aViewModel->CreatePrs( anIO->getEntry() ) );
- if( aPrs )
+ AIS_ListOfInteractive aList;
+ aPrs->GetObjects( aList );
+ AIS_ListIteratorOfListOfInteractive anIter( aList );
+ for( ; anIter.More(); anIter.Next() )
{
- AIS_ListOfInteractive aList;
- aPrs->GetObjects( aList );
- AIS_ListIteratorOfListOfInteractive anIter( aList );
- for( ; anIter.More(); anIter.Next() )
+ Handle(GEOM_AISShape) aShape = Handle(GEOM_AISShape)::DownCast( anIter.Value() );
+ if( !aShape.IsNull() )
{
- Handle(GEOM_AISShape) aShape = Handle(GEOM_AISShape)::DownCast( anIter.Value() );
- if( !aShape.IsNull() )
+ GEOM::field_data_type aFieldDataType;
+ int aFieldDimension;
+ QList<QVariant> aFieldStepData;
+ TCollection_AsciiString aFieldStepName;
+ double aFieldStepRangeMin, aFieldStepRangeMax;
+ aShape->getFieldStepInfo( aFieldDataType,
+ aFieldDimension,
+ aFieldStepData,
+ aFieldStepName,
+ aFieldStepRangeMin,
+ aFieldStepRangeMax );
+ if( !aFieldStepData.isEmpty() && aFieldDataType != GEOM::FDT_String )
{
- GEOM::field_data_type aFieldDataType;
- int aFieldDimension;
- QList<QVariant> aFieldStepData;
- TCollection_AsciiString aFieldStepName;
- double aFieldStepRangeMin, aFieldStepRangeMax;
- aShape->getFieldStepInfo( aFieldDataType,
- aFieldDimension,
- aFieldStepData,
- aFieldStepName,
- aFieldStepRangeMin,
- aFieldStepRangeMax );
- if( !aFieldStepData.isEmpty() && aFieldDataType != GEOM::FDT_String )
- {
- anIsDisplayColorScale = Standard_True;
- aColorScaleTitle = aFieldStepName;
- aColorScaleMin = aFieldStepRangeMin;
- aColorScaleMax = aFieldStepRangeMax;
- anIsBoolean = aFieldDataType == GEOM::FDT_Bool;
- }
+ anIsDisplayColorScale = Standard_True;
+ aColorScaleTitle = aFieldStepName;
+ aColorScaleMin = aFieldStepRangeMin;
+ aColorScaleMax = aFieldStepRangeMax;
+ anIsBoolean = aFieldDataType == GEOM::FDT_Bool;
}
}
}
/* Update visibility and parameters of the currently selected field step's color scale */
void UpdateColorScale( const bool theIsRedisplayFieldSteps = false, const bool updateViewer = true );
+ void SetUpdateColorScale(bool toUpdate) { myUpdateColorScale = toUpdate; } // IPAL54049
protected:
/* internal methods */
#if OCC_VERSION_MAJOR >= 7
Handle(AIS_ColorScale) myColorScale;
#endif
+ int myUpdateColorScale; // IPAL54049
// Attributes
Quantity_Color myShadingColor;
// ---- create menus --------------------------
- int fileId = createMenu( tr( "MEN_FILE" ), -1, -1 );
+ /*int fileId =*/ createMenu( tr( "MEN_FILE" ), -1, -1 );
int editId = createMenu( tr( "MEN_EDIT" ), -1, -1 );
createMenu( GEOMOp::OpDelete, editId, -1 );
aTexture = new TColStd_HArray1OfByte (1, aStream->length());
- for (int i = 0; i < aStream->length(); i++)
+ for ( CORBA::ULong i = 0; i < aStream->length(); i++)
aTexture->SetValue( i+1, (Standard_Byte)aStream[i] );
aTextureMap[ theId ] = aTexture;
}
resMgr->value("resources", "GEOM", aFontFile);
aFontFile = aFontFile + QDir::separator() + "Y14.5M-2009.ttf";
// add enginier font into combobox
- int fontID = QFontDatabase::addApplicationFont( aFontFile );
+ /*int fontID =*/ QFontDatabase::addApplicationFont( aFontFile );
Handle(Font_SystemFont) sf = new Font_SystemFont(
new TCollection_HAsciiString("Y14.5M-2009"),
Font_FA_Regular,
QMap<QString, GEOM::GEOM_BaseObject_var> gobjects;
QMap<QString, QString>::ConstIterator oit;
std::list<_PTR(SObject)> aSelectedSO;
- for ( oit = objects.begin(); oit != objects.end(); ++oit ) {
+ for ( oit = objects.begin(); oit != objects.end(); ++oit )
+ {
_PTR(SObject) so = study->FindObjectID( oit.key().toLatin1().data() );
if ( !so )
continue;
aSelectedSO.push_back(so);
- CORBA::Object_var corbaObj_rem = GeometryGUI::ClientSObjectToObject( so );
+ CORBA::Object_var corbaObj_rem = GeometryGUI::ClientSObjectToObject( so );
GEOM::GEOM_BaseObject_var geomObj_rem = GEOM::GEOM_BaseObject::_narrow( corbaObj_rem );
- if( CORBA::is_nil( geomObj_rem ) )
- continue;
- gobjects.insert( oit.key(), geomObj_rem );
+ if ( ! CORBA::is_nil( geomObj_rem ))
+ gobjects.insert( oit.key(), geomObj_rem );
}
// Search References with other Modules
std::list< _PTR(SObject) >::iterator itSO = aSelectedSO.begin();
- for ( ; itSO != aSelectedSO.end(); ++itSO ) {
+ for ( ; itSO != aSelectedSO.end(); ++itSO )
+ {
std::vector<_PTR(SObject)> aReferences = study->FindDependances( *itSO );
int aRefLength = aReferences.size();
- if (aRefLength) {
- for (int i = 0; i < aRefLength; i++) {
- _PTR(SObject) firstSO( aReferences[i] );
- _PTR(SComponent) aComponent = firstSO->GetFatherComponent();
- QString type = aComponent->ComponentDataType().c_str();
- if ( type == "SMESH" )
- return true;
- }
+ for ( int i = 0; i < aRefLength; i++ )
+ {
+ _PTR(SObject) firstSO( aReferences[i] );
+ _PTR(SComponent) aComponent = firstSO->GetFatherComponent();
+ QString type = aComponent->ComponentDataType().c_str();
+ if ( type == "SMESH" )
+ return true;
}
}
- // browse through all GEOM data tree
+ // browse through all GEOM data tree to find an object with is not deleted and depends
+ // on a deleted object
_PTR(ChildIterator) it ( study->NewChildIterator( comp ) );
- for ( it->InitEx( true ); it->More(); it->Next() ) {
- _PTR(SObject) child( it->Value() );
- CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( child );
+ for ( it->InitEx( true ); it->More(); it->Next() )
+ {
+ _PTR(SObject) child = it->Value();
+ QString childID = child->GetID().c_str();
+ bool deleted = objects.contains( childID );
+ if ( deleted )
+ continue; // deleted object
+
+ CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( child );
GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj );
- if( CORBA::is_nil( geomObj ) )
+ if ( CORBA::is_nil( geomObj ) )
continue;
- GEOM::ListOfGBO_var list = geomObj->GetDependency();
- if( list->length() == 0 )
- continue;
+ GEOM::ListOfGBO_var dep = geomObj->GetDependency(); // child depends on dep
+ for( CORBA::ULong i = 0; i < dep->length(); i++ )
+ {
+ CORBA::String_var id = dep[i]->GetStudyEntry();
+ bool depends = objects.contains( id.in() ); // depends on deleted
- for( int i = 0; i < list->length(); i++ ) {
- bool depends = false;
- bool deleted = false;
QMap<QString, GEOM::GEOM_BaseObject_var>::Iterator git;
- for ( git = gobjects.begin(); git != gobjects.end() && ( !depends || !deleted ); ++git ) {
- depends = depends || list[i]->_is_equivalent( *git );
- deleted = deleted || git.key() == child->GetID().c_str() ;//geomObj->_is_equivalent( *git );
+ for ( git = gobjects.begin(); git != gobjects.end() && ( !depends || !deleted ); ++git )
+ {
+ depends = depends || dep[i]->_is_equivalent( *git );
+ deleted = deleted || git.key() == childID ;//geomObj->_is_equivalent( *git )
}
if ( depends && !deleted )
return true;
// function : getGeomChildrenAndFolders
// purpose : Get direct (1-level) GEOM objects under each folder, sub-folder, etc. and these folders itself
//=======================================================================
-static void getGeomChildrenAndFolders( _PTR(SObject) theSO,
- QMap<QString,QString>& geomObjList,
+static void getGeomChildrenAndFolders( _PTR(SObject) theSO,
+ QMap<QString,QString>& geomObjList,
QMap<QString,QString>& folderList ) {
if ( !theSO ) return;
_PTR(Study) aStudy = theSO->GetStudy();
// purpose : Constructor
//=======================================================================
GEOMToolsGUI::GEOMToolsGUI( GeometryGUI* parent )
-: GEOMGUI( parent )
+ : GEOMGUI( parent )
{
}
if ( !dlg.exec() )
return; // operation is cancelled by user
+ SUIT_OverrideCursor wc;
+
// get currently opened views
QList<SALOME_View*> views;
SALOME_View* view;
}
_PTR(StudyBuilder) aStudyBuilder (aStudy->NewBuilder());
- GEOM_Displayer* disp = new GEOM_Displayer( appStudy );
+ GEOM_Displayer disp( appStudy );
+ disp.SetUpdateColorScale( false ); // IPAL54049
if ( isComponentSelected ) {
// GEOM component is selected: delete all objects recursively
for ( it->InitEx( false ); it->More(); it->Next() ) {
_PTR(SObject) child( it->Value() );
// remove object from GEOM engine
- removeObjectWithChildren( child, aStudy, views, disp );
+ removeObjectWithChildren( child, aStudy, views, &disp );
// remove object from study
aStudyBuilder->RemoveObjectWithChildren( child );
// remove object from use case tree
for ( it = toBeDeleted.begin(); it != toBeDeleted.end(); ++it ) {
_PTR(SObject) obj ( aStudy->FindObjectID( it.key().toLatin1().data() ) );
// remove object from GEOM engine
- removeObjectWithChildren( obj, aStudy, views, disp );
+ removeObjectWithChildren( obj, aStudy, views, &disp );
// remove objects from study
aStudyBuilder->RemoveObjectWithChildren( obj );
// remove object from use case tree
for ( it = toBeDelFolders.begin(); it != toBeDelFolders.end(); ++it ) {
_PTR(SObject) obj ( aStudy->FindObjectID( it.key().toLatin1().data() ) );
// remove object from GEOM engine
- removeObjectWithChildren( obj, aStudy, views, disp );
+ removeObjectWithChildren( obj, aStudy, views, &disp );
// remove objects from study
aStudyBuilder->RemoveObjectWithChildren( obj );
// remove object from use case tree
return;
}
+ SUIT_OverrideCursor wc;
+ disp->SetUpdateColorScale( false ); // IPAL54049
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
Handle(SALOME_InteractiveObject) IObject = It.Value();
if ( obj ) {
_PTR(AttributeExpandable) aExp = B->FindOrCreateAttribute( obj, "AttributeExpandable" );
aExp->SetExpandable( show );
- if(!show)
+ if ( !show ) {
disp->EraseWithChildren(IObject,true);
+ }
} // if ( obj )
} // iterator
+ disp->SetUpdateColorScale( true );
}
}
app->updateObjectBrowser( false );
QObject::tr( "WRN_STUDY_LOCKED" ) );
return;
}
-
+ SUIT_OverrideCursor wc;
+ disp->SetUpdateColorScale( false ); // IPAL54049
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
Handle(SALOME_InteractiveObject) IObject = It.Value();
}
} // if ( obj )
} // iterator
+ disp->SetUpdateColorScale( true ); // IPAL54049
aSelMgr->clearSelected();
}
}
if ( !aFatherSO ) return;
GeometryGUI::GetGeomGen()->CreateFolder( tr("NEW_FOLDER_NAME").toLatin1().constData(),
- _CAST(SObject, aFatherSO)->GetSObject() );
+ _CAST(SObject, aFatherSO)->GetSObject() );
app->updateObjectBrowser( false );
}
#ifndef DISABLE_GRAPHICSVIEW
void GEOMToolsGUI::OnShowDependencyTree()
{
- SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+ //SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
if ( !app ) return;
#include <QGridLayout>
#include <SUIT_MessageBox.h>
-static bool isEntryLess( const QString& e1, const QString& e2 )
+#include <iostream>
+
+namespace
{
- QStringList el1 = e1.split(":");
- QStringList el2 = e2.split(":");
- int e1c = el1.count(), e2c = el2.count();
- for ( int i = 0; i < e1c && i < e2c; i++ ) {
- int id1 = el1[i].toInt();
- int id2 = el2[i].toInt();
- if ( id1 < id2 ) return true;
- else if ( id2 < id1 ) return false;
- }
- return el1.count() < el2.count();
+ struct NaturalCompare
+ {
+ bool operator () (const std::string& s1, const std::string& s2) const
+ {
+ // hope the entries are never empty and never equal
+ int diff21 = 0;
+ const char* p1 = s1.c_str();
+ const char* p2 = s2.c_str();
+ for ( ; ; ++p1, ++p2 )
+ {
+ if ( *p1 == *p2 )
+ {
+ if ( diff21 && !*p1 ) // both numbers ends
+ return diff21 > 0;
+ continue;
+ }
+ // different chars
+ bool d1 = isdigit( *p1 );
+ bool d2 = isdigit( *p2 );
+ if ( d1 != d2 ) // one number is shorter then another
+ return d2; // is s1 shorter?
+ if ( !d1 && diff21 ) // both numbers ends
+ return diff21 > 0;
+ if ( !diff21 ) // remember the first difference
+ diff21 = *p2 - *p1;
+ }
+ return diff21 > 0;
+ }
+ };
}
static QStringList objectsToNames( const QMap<QString, QString>& objects )
{
- QStringList entries;
- for ( QMap<QString, QString>::ConstIterator it = objects.begin(); it != objects.end(); ++it ) {
- QString entry = it.key();
- QStringList::Iterator iter;
- bool added = false;
- for ( iter = entries.begin(); iter != entries.end() && !added; ++iter ) {
- if ( isEntryLess( entry, *iter ) ) {
- entries.insert( iter, entry );
- added = true;
- }
- }
- if ( !added )
- entries.append( entry );
- }
+ typedef std::map< std::string, QString, NaturalCompare > TSortMap;
+ TSortMap sortedByEntry;
+ for ( QMap<QString, QString>::ConstIterator it = objects.begin(); it != objects.end(); ++it )
+ sortedByEntry.insert( sortedByEntry.end(), std::make_pair( it.key().toStdString(), it.value() ));
+
QStringList names;
- for ( int i = 0; i < entries.count(); i++ ) {
- int level = entries[i].count(":")-3;
- names.append( QString( level*2, ' ' ) + objects[ entries[i] ] );
+ for ( TSortMap::iterator it = sortedByEntry.begin(); it != sortedByEntry.end(); ++it )
+ {
+ const std::string& entry = it->first;
+ int level = std::count( entry.begin(), entry.end(), ':' ) - 3;
+ names.append( QString( level * 2, ' ' ) + it->second );
}
return names;
}
if ( study ) {
SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList);
- int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true);
- }
+ /*int nbSel = */GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true);
+ }
myLineEditCurArg->setText( aString );
}
if ( appStudy ) {
_PTR(Study) aStudy = appStudy->studyDS();
if ( aStudy ) {
- GEOM_Displayer displayer ( appStudy );
- QTreeWidgetItemIterator it( myTreeWidget );
- while ( *it ) {
- QString entry = myEntryToItem.key( *it );
- _PTR(SObject) SO ( aStudy->FindObjectID( qPrintable( entry ) ) );
- if ( SO ) {
- GEOM::GEOM_Object_var aGeomObject = GEOM::GEOM_Object::_narrow( GeometryGUI::ClientSObjectToObject( SO ) );
- if ( CORBA::is_nil( aGeomObject ) ) continue;
- if ( displayer.IsDisplayed( aGeomObject->GetStudyEntry() ) ) {
- Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( aGeomObject->GetStudyEntry(), "GEOM", "" );
- displayer.Erase( io );
- }
- }
- ++it;
- }
- displayer.UpdateViewer();
+ GEOM_Displayer displayer ( appStudy );
+ QTreeWidgetItemIterator it( myTreeWidget );
+ while ( *it ) {
+ QString entry = myEntryToItem.key( *it );
+ _PTR(SObject) SO ( aStudy->FindObjectID( qPrintable( entry ) ) );
+ if ( SO ) {
+ GEOM::GEOM_Object_var aGeomObject = GEOM::GEOM_Object::_narrow( GeometryGUI::ClientSObjectToObject( SO ) );
+ if ( CORBA::is_nil( aGeomObject ) ) continue;
+ if ( displayer.IsDisplayed( aGeomObject->GetStudyEntry() ) ) {
+ Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( aGeomObject->GetStudyEntry(), "GEOM", "" );
+ displayer.Erase( io );
+ }
+ }
+ ++it;
+ }
+ displayer.UpdateViewer();
}
}
}
}
// show references if any
std::vector< _PTR(SObject) > vso = aStudy->FindDependances(SO);
- for ( int i = 0; i < vso.size(); i++ ) {
- _PTR(SObject) refObj = vso[i];
- aDrw = aBuilder->FindOrCreateAttribute( refObj, "AttributeDrawable" );
- aDrw->SetDrawable( true );
+ for ( size_t i = 0; i < vso.size(); i++ ) {
+ _PTR(SObject) refObj = vso[i];
+ aDrw = aBuilder->FindOrCreateAttribute( refObj, "AttributeDrawable" );
+ aDrw->SetDrawable( true );
}
}
}
GEOM::string_array_var otherObjects = new GEOM::string_array();
GeometryGUI::GetGeomGen()->GetEntriesToReduceStudy( GeometryGUI::ClientStudyToStudy( myStudy ),
- keptObjects, parentsObjects,
- subObjects, otherObjects );
+ keptObjects, parentsObjects,
+ subObjects, otherObjects );
for ( int i = 0; i < keptObjects->length(); i++ )
myKeptObjects.insert( keptObjects[i].in() );
QTreeWidgetItemIterator it( theWidget );
while(*it) {
GEOMToolsGUI_TreeWidgetItem* item = dynamic_cast<GEOMToolsGUI_TreeWidgetItem*>(*it);
- const char* entry = item->getStudyEntry();
+ //const char* entry = item->getStudyEntry();
if( item->flags() & Qt::ItemIsSelectable )
if( !item->isVisible() )
isInvisible = true;
}
if( myGroupIntermediates->checkedId() == 2 ) { // remove
if( !myCBSoftRemoval->isChecked() &&
- SUIT_MessageBox::question( this,
- tr( "GEOM_WRN_WARNING" ),
- tr( "GEOM_REDUCE_STUDY_WARNING_DELETE" ),
- QMessageBox::Yes | QMessageBox::No,
- QMessageBox::Yes ) == QMessageBox::No ) {
+ SUIT_MessageBox::question( this,
+ tr( "GEOM_WRN_WARNING" ),
+ tr( "GEOM_REDUCE_STUDY_WARNING_DELETE" ),
+ QMessageBox::Yes | QMessageBox::No,
+ QMessageBox::Yes ) == QMessageBox::No ) {
return;
}
for( iter = myListParents.begin(); iter != myListParents.end(); ++iter )
if ( igesOp.isNull() ) return false;
QStringList fileNames = app->getOpenFileNames( SUIT_FileDlg::getLastVisitedPath().isEmpty() ? QDir::currentPath() : QString(""),
- tr( "IGES_FILES" ),
- tr( "IMPORT_TITLE" ),
- parent );
+ tr( "IGES_FILES" ),
+ tr( "IMPORT_TITLE" ),
+ parent );
if ( fileNames.count() > 0 )
{
QStringList entryList;
QStringList errors;
SUIT_MessageBox::StandardButton igesAnswer = SUIT_MessageBox::NoButton;
-
+
for ( int i = 0; i < fileNames.count(); i++ )
{
QString fileName = fileNames.at( i );
SUIT_OverrideCursor wc;
GEOM_Operation transaction( app, igesOp.get() );
bool ignoreUnits = false;
-
+
try
{
- app->putInfo( tr( "GEOM_PRP_LOADING" ).arg( SUIT_Tools::file( fileName, true ) ) );
- transaction.start();
-
- CORBA::String_var units = igesOp->ReadValue( fileName.toUtf8().constData(), "LEN_UNITS" );
- QString unitsStr( units.in() );
- bool unitsOK = unitsStr.isEmpty() || unitsStr == "M" || unitsStr.toLower() == "metre";
-
- if ( !unitsOK )
- {
- if( igesAnswer == SUIT_MessageBox::NoToAll )
- {
- ignoreUnits = true;
- }
- else if( igesAnswer != SUIT_MessageBox::YesToAll )
- {
- SUIT_MessageBox::StandardButtons btns = SUIT_MessageBox::Yes | SUIT_MessageBox::No | SUIT_MessageBox::Cancel;
- if ( i < fileNames.count()-1 ) btns = btns | SUIT_MessageBox::YesToAll | SUIT_MessageBox::NoToAll;
- igesAnswer = SUIT_MessageBox::question( parent,
- tr( "WRN_WARNING" ),
- tr( "SCALE_DIMENSIONS" ).arg( unitsStr ),
- btns,
- SUIT_MessageBox::No );
- switch ( igesAnswer )
- {
- case SUIT_MessageBox::Cancel:
- return true; // cancel (break) import operation
- case SUIT_MessageBox::Yes:
- case SUIT_MessageBox::YesToAll:
- break; // scaling is confirmed
- case SUIT_MessageBox::No:
- case SUIT_MessageBox::NoAll:
- ignoreUnits = true; // scaling is rejected
- default:
- break;
- }
- }
- }
-
- GEOM::ListOfGO_var result = igesOp->ImportIGES( fileName.toUtf8().constData(), ignoreUnits );
- if ( result->length() > 0 && igesOp->IsDone() )
- {
- GEOM::GEOM_Object_var main = result[0];
- QString publishName = GEOMBase::GetDefaultName( SUIT_Tools::file( fileName, true ) );
- SALOMEDS::SObject_var so = GeometryGUI::GetGeomGen()->PublishInStudy( dsStudy,
- SALOMEDS::SObject::_nil(),
- main.in(),
- publishName.toUtf8().constData() );
-
- entryList.append( so->GetID() );
- transaction.commit();
- GEOM_Displayer( study ).Display( main.in() );
+ app->putInfo( tr( "GEOM_PRP_LOADING" ).arg( SUIT_Tools::file( fileName, true ) ) );
+ transaction.start();
+
+ CORBA::String_var units = igesOp->ReadValue( fileName.toUtf8().constData(), "LEN_UNITS" );
+ QString unitsStr( units.in() );
+ bool unitsOK = unitsStr.isEmpty() || unitsStr == "M" || unitsStr.toLower() == "metre";
+
+ if ( !unitsOK )
+ {
+ if( igesAnswer == SUIT_MessageBox::NoToAll )
+ {
+ ignoreUnits = true;
+ }
+ else if( igesAnswer != SUIT_MessageBox::YesToAll )
+ {
+ SUIT_MessageBox::StandardButtons btns = SUIT_MessageBox::Yes | SUIT_MessageBox::No | SUIT_MessageBox::Cancel;
+ if ( i < fileNames.count()-1 ) btns = btns | SUIT_MessageBox::YesToAll | SUIT_MessageBox::NoToAll;
+ igesAnswer = SUIT_MessageBox::question( parent,
+ tr( "WRN_WARNING" ),
+ tr( "SCALE_DIMENSIONS" ).arg( unitsStr ),
+ btns,
+ SUIT_MessageBox::No );
+ switch ( igesAnswer )
+ {
+ case SUIT_MessageBox::Cancel:
+ return true; // cancel (break) import operation
+ case SUIT_MessageBox::Yes:
+ case SUIT_MessageBox::YesToAll:
+ break; // scaling is confirmed
+ case SUIT_MessageBox::No:
+ case SUIT_MessageBox::NoAll:
+ ignoreUnits = true; // scaling is rejected
+ default:
+ break;
+ }
+ }
+ }
+
+ GEOM::ListOfGO_var result = igesOp->ImportIGES( fileName.toUtf8().constData(), ignoreUnits );
+ if ( result->length() > 0 && igesOp->IsDone() )
+ {
+ GEOM::GEOM_Object_var main = result[0];
+ QString publishName = GEOMBase::GetDefaultName( SUIT_Tools::file( fileName, true ) );
+ SALOMEDS::SObject_var so = GeometryGUI::GetGeomGen()->PublishInStudy( dsStudy,
+ SALOMEDS::SObject::_nil(),
+ main.in(),
+ publishName.toUtf8().constData() );
+
+ entryList.append( so->GetID() );
+ transaction.commit();
+ GEOM_Displayer( study ).Display( main.in() );
main->UnRegister();
- }
- else
- {
- transaction.abort();
- errors.append( QString( "%1 : %2" ).arg( fileName ).arg( igesOp->GetErrorCode() ) );
- }
+ }
+ else
+ {
+ transaction.abort();
+ errors.append( QString( "%1 : %2" ).arg( fileName ).arg( igesOp->GetErrorCode() ) );
+ }
}
catch( const SALOME::SALOME_Exception& e )
{
- transaction.abort();
+ transaction.abort();
}
}
getGeometryGUI()->updateObjBrowser( true );
app->browseObjects( entryList );
-
+
if ( errors.count() > 0 )
{
SUIT_MessageBox::critical( parent,
- tr( "GEOM_ERROR" ),
- tr( "GEOM_IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
+ tr( "GEOM_ERROR" ),
+ tr( "GEOM_IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
}
}
return fileNames.count() > 0;
QString version;
QString fileName = IGESPlugin_ExportDlg::getFileName( QString( io->getName() ),
- tr( "IGES_FILES" ),
- tr( "EXPORT_TITLE" ),
- parent,
- version );
+ tr( "IGES_FILES" ),
+ tr( "EXPORT_TITLE" ),
+ parent,
+ version );
if ( fileName.isEmpty() )
return false;
if ( igesOp->IsDone() )
{
- transaction.commit();
+ transaction.commit();
}
else
{
- transaction.abort();
- SUIT_MessageBox::critical( parent,
- tr( "GEOM_ERROR" ),
- tr( "GEOM_PRP_ABORT" ) + "\n" + tr( igesOp->GetErrorCode() ) );
- return false;
+ transaction.abort();
+ SUIT_MessageBox::critical( parent,
+ tr( "GEOM_ERROR" ),
+ tr( "GEOM_PRP_ABORT" ) + "\n" + tr( igesOp->GetErrorCode() ) );
+ return false;
}
}
catch ( const SALOME::SALOME_Exception& e )
if ( !ok )
{
SUIT_MessageBox::warning( parent,
- tr( "WRN_WARNING" ),
- tr( "GEOM_WRN_NO_APPROPRIATE_SELECTION" ) );
+ tr( "WRN_WARNING" ),
+ tr( "GEOM_WRN_NO_APPROPRIATE_SELECTION" ) );
}
return ok;
}
myIsScreenFixed->setChecked( myAnnotationProperties.IsScreenFixed );
int aSubShapeTypeIndex = -1;
- int aTypesCount = aTypesCount = mySubShapeTypeCombo->count();
+ int aTypesCount = mySubShapeTypeCombo->count();
for ( int i = 0; i < aTypesCount && aSubShapeTypeIndex < 0; i++ ) {
int aType = mySubShapeTypeCombo->itemData( i ).toInt();
if ( aType == myAnnotationProperties.ShapeType )
myIsScreenFixed->setChecked( myAnnotationProperties.IsScreenFixed );
int aSubShapeTypeIndex = -1;
- int aTypesCount = aTypesCount = mySubShapeTypeCombo->count();
+ int aTypesCount = mySubShapeTypeCombo->count();
for ( int i = 0; i < aTypesCount && aSubShapeTypeIndex < 0; i++ ) {
int aType = mySubShapeTypeCombo->itemData( i ).toInt();
if ( aType == myAnnotationProperties.ShapeType )
myListBox2->clear();
- if (aCurItem < aErrs.length()) {
+ if (aCurItem < (int)aErrs.length()) {
GEOM::GEOM_IBlocksOperations::BCError aErr = aErrs[aCurItem];
GEOM::ListOfLong aObjLst = aErr.incriminated;
QStringList aSubShapeList;
GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "STLPluginEngine" );
STLOpPtr stlOp = GEOM::ISTLOperations::_narrow( op );
if ( stlOp.isNull() ) return false;
-
+
QStringList fileNames = app->getOpenFileNames( SUIT_FileDlg::getLastVisitedPath().isEmpty() ? QDir::currentPath() : QString(""),
- tr( "STL_FILES" ),
- tr( "IMPORT_TITLE" ),
- parent );
+ tr( "STL_FILES" ),
+ tr( "IMPORT_TITLE" ),
+ parent );
if ( fileNames.count() > 0 )
{
QStringList entryList;
QStringList errors;
-
+
foreach( QString fileName, fileNames )
{
SUIT_OverrideCursor wc;
GEOM_Operation transaction( app, stlOp.get() );
-
+
try
{
- app->putInfo( tr( "GEOM_PRP_LOADING" ).arg( fileName ) );
- transaction.start();
- GEOM::ListOfGO_var result = stlOp->ImportSTL( fileName.toUtf8().constData() );
- if ( result->length() > 0 && stlOp->IsDone() )
- {
- GEOM::GEOM_Object_var main = result[0];
- QString publishName = GEOMBase::GetDefaultName( SUIT_Tools::file( fileName, true ) );
- SALOMEDS::SObject_var so = GeometryGUI::GetGeomGen()->PublishInStudy( dsStudy,
- SALOMEDS::SObject::_nil(),
- main.in(),
- publishName.toUtf8().constData() );
-
- entryList.append( so->GetID() );
- transaction.commit();
- GEOM_Displayer( study ).Display( main.in() );
+ app->putInfo( tr( "GEOM_PRP_LOADING" ).arg( fileName ) );
+ transaction.start();
+ GEOM::ListOfGO_var result = stlOp->ImportSTL( fileName.toUtf8().constData() );
+ if ( result->length() > 0 && stlOp->IsDone() )
+ {
+ GEOM::GEOM_Object_var main = result[0];
+ QString publishName = GEOMBase::GetDefaultName( SUIT_Tools::file( fileName, true ) );
+ SALOMEDS::SObject_var so = GeometryGUI::GetGeomGen()->PublishInStudy( dsStudy,
+ SALOMEDS::SObject::_nil(),
+ main.in(),
+ publishName.toUtf8().constData() );
+
+ entryList.append( so->GetID() );
+ transaction.commit();
+ GEOM_Displayer( study ).Display( main.in() );
main->UnRegister();
- }
- else
- {
- transaction.abort();
- errors.append( QString( "%1 : %2" ).arg( fileName ).arg( stlOp->GetErrorCode() ) );
- }
+ }
+ else
+ {
+ transaction.abort();
+ errors.append( QString( "%1 : %2" ).arg( fileName ).arg( stlOp->GetErrorCode() ) );
+ }
}
catch( const SALOME::SALOME_Exception& e )
{
- transaction.abort();
+ transaction.abort();
}
}
getGeometryGUI()->updateObjBrowser( true );
app->browseObjects( entryList );
-
+
if ( errors.count() > 0 )
{
SUIT_MessageBox::critical( parent,
- tr( "GEOM_ERROR" ),
- tr( "GEOM_IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
+ tr( "GEOM_ERROR" ),
+ tr( "GEOM_IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
}
}
return fileNames.count() > 0;
double deflection = 0.;
bool isRelative = false;
QString fileName = STLPlugin_ExportDlg::getFileName( io,
- tr( "STL_FILES" ),
- tr( "EXPORT_TITLE" ),
- parent,
- isASCII,
- deflection,
- isRelative );
+ tr( "STL_FILES" ),
+ tr( "EXPORT_TITLE" ),
+ parent,
+ isASCII,
+ deflection,
+ isRelative );
if ( fileName.isEmpty() )
return false;
if ( stlOp->IsDone() )
{
- transaction.commit();
+ transaction.commit();
}
else
{
- transaction.abort();
- SUIT_MessageBox::critical( parent,
- tr( "GEOM_ERROR" ),
- tr( "GEOM_PRP_ABORT" ) + "\n" + tr( stlOp->GetErrorCode() ) );
- return false;
+ transaction.abort();
+ SUIT_MessageBox::critical( parent,
+ tr( "GEOM_ERROR" ),
+ tr( "GEOM_PRP_ABORT" ) + "\n" + tr( stlOp->GetErrorCode() ) );
+ return false;
}
}
catch ( const SALOME::SALOME_Exception& e )
if ( !ok )
{
SUIT_MessageBox::warning( parent,
- tr( "WRN_WARNING" ),
- tr( "GEOM_WRN_NO_APPROPRIATE_SELECTION" ) );
+ tr( "WRN_WARNING" ),
+ tr( "GEOM_WRN_NO_APPROPRIATE_SELECTION" ) );
}
return ok;
}
QStringList anEntryList;
anEntryList << addInStudy(m_mainShape, m_mainShape->GetName());
m_mainShape->UnRegister();
- for (int i = 0; i < subShapes->length(); i++)
+ for (CORBA::ULong i = 0; i < subShapes->length(); i++)
{
addInStudy(subShapes[i].in(), subShapes[i]->GetName());
subShapes[i]->UnRegister();
}
- for (int i = 0; i < groups->length(); i++)
+ for (CORBA::ULong i = 0; i < groups->length(); i++)
{
addInStudy(groups[i].in(), groups[i]->GetName());
groups[i]->UnRegister();
}
- for (int i = 0; i < fields->length(); i++)
+ for (CORBA::ULong i = 0; i < fields->length(); i++)
{
addFieldInStudy(fields[i].in(), m_mainShape);
}
// add steps
GEOM::ListOfLong_var steps = theField->GetSteps();
- for (int i = 0; i < steps->length(); ++i)
+ for (CORBA::ULong i = 0; i < steps->length(); ++i)
{
GEOM::GEOM_FieldStep_ptr step = theField->GetStep(steps[i]);
QString stepName = (tr("XAOPLUGIN_STEP") + " %1 %2").arg( step->GetID() ).arg( step->GetStamp() );