IPAL54049: Operations on multiple study objects are very long

Most of time was spent in GEOM_Displayer::UpdateColorScale() {
myApp->selectionMgr()->selectedObjects( aSelectedObjects );
}
This commit is contained in:
eap 2017-03-22 17:02:15 +03:00
parent 7c7eefda24
commit fb044eba69
19 changed files with 315 additions and 287 deletions

View File

@ -322,8 +322,8 @@ void BuildGUI_FaceDlg::updateConstraintsTree()
return; return;
for ( int i = 0, n = aList->length(); i < n; i++ ) { for ( int i = 0, n = aList->length(); i < n; i++ ) {
TreeWidgetItem* item = new TreeWidgetItem( myTreeConstraints, /*TreeWidgetItem* item =*/
GEOM::GeomObjPtr( aList[i] ) ); new TreeWidgetItem( myTreeConstraints, GEOM::GeomObjPtr( aList[i] ) );
} }
myEditCurrentArgument->setEnabled(false); myEditCurrentArgument->setEnabled(false);

View File

@ -475,10 +475,10 @@ void DependencyTree_View::parseTree()
std::string objectEntry = i->first; std::string objectEntry = i->first;
addNode( objectEntry ); addNode( objectEntry );
parseTreeWard( i->second.first ); parseTreeWard( i->second.first );
if( i->second.first.size() > myMaxUpwardLevelsNumber ) if((int) i->second.first.size() > myMaxUpwardLevelsNumber )
myMaxUpwardLevelsNumber = i->second.first.size(); myMaxUpwardLevelsNumber = i->second.first.size();
parseTreeWard( i->second.second ); parseTreeWard( i->second.second );
if( i->second.second.size() > myMaxDownwardLevelsNumber ) if((int) i->second.second.size() > myMaxDownwardLevelsNumber )
myMaxDownwardLevelsNumber = i->second.second.size(); myMaxDownwardLevelsNumber = i->second.second.size();
} }
@ -518,13 +518,13 @@ void DependencyTree_View::parseTreeWard( const GEOMUtils::LevelsList& theWard )
//================================================================================= //=================================================================================
void DependencyTree_View::parseTreeWardArrow( const GEOMUtils::LevelsList& theWard) 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 Level = theWard.at(j);
GEOMUtils::LevelInfo::const_iterator node; GEOMUtils::LevelInfo::const_iterator node;
for( node = Level.begin(); node != Level.end(); node++ ) { for( node = Level.begin(); node != Level.end(); node++ ) {
DependencyTree_Object* object = myTreeMap[ node->first ]; DependencyTree_Object* object = myTreeMap[ node->first ];
std::vector<std::string> Links = node->second; 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 ] ]; DependencyTree_Object* LinkObject = myTreeMap[ Links[ link ] ];
if( object && LinkObject ) if( object && LinkObject )
addArrow( LinkObject, object ); addArrow( LinkObject, object );
@ -607,7 +607,7 @@ void DependencyTree_View::drawTree()
std::map< int, std::vector< std::string > >::const_iterator level; std::map< int, std::vector< std::string > >::const_iterator level;
for( level = levelObjects.begin(); level != levelObjects.end(); level++ ) { for( level = levelObjects.begin(); level != levelObjects.end(); level++ ) {
int step = -horDistance * ( int(level->second.size()) - 1 ) / 2; 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 ) ]; DependencyTree_Object* anObject = myTreeMap[ level->second.at( objIter ) ];
anObject->setPos( step, verDistance * level->first ); anObject->setPos( step, verDistance * level->first );
step += horDistance; step += horDistance;
@ -647,7 +647,7 @@ void DependencyTree_View::drawWard( const GEOMUtils::LevelsList& theWard,
std::map< int, std::vector< std::string > >& theLevelObjects, std::map< int, std::vector< std::string > >& theLevelObjects,
int theCurrentLevel, const int theLevelStep ) 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 ) if( level >= myLevelsNumber )
return; return;
theCurrentLevel += theLevelStep; theCurrentLevel += theLevelStep;
@ -671,7 +671,7 @@ void DependencyTree_View::drawWard( const GEOMUtils::LevelsList& theWard,
//================================================================================= //=================================================================================
void DependencyTree_View::drawWardArrows( const GEOMUtils::LevelsList& theWard ) 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 ) if( j >= myLevelsNumber )
break; break;
GEOMUtils::LevelInfo Level = theWard.at(j); GEOMUtils::LevelInfo Level = theWard.at(j);
@ -679,7 +679,7 @@ void DependencyTree_View::drawWardArrows( const GEOMUtils::LevelsList& theWard )
for( node = Level.begin(); node != Level.end(); node++ ) { for( node = Level.begin(); node != Level.end(); node++ ) {
DependencyTree_Object* object = myTreeMap[ node->first ]; DependencyTree_Object* object = myTreeMap[ node->first ];
GEOMUtils::NodeLinks Links = node->second; 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 ] ]; DependencyTree_Object* LinkObject = myTreeMap[ Links[ link ] ];
if( isItemAdded( object ) && isItemAdded( LinkObject ) ) { if( isItemAdded( object ) && isItemAdded( LinkObject ) ) {
DependencyTree_Arrow* arrow = myArrows[ std::pair<DependencyTree_Object*,DependencyTree_Object*>( LinkObject, object ) ]; DependencyTree_Arrow* arrow = myArrows[ std::pair<DependencyTree_Object*,DependencyTree_Object*>( LinkObject, object ) ];
@ -824,4 +824,5 @@ int DependencyTree_View::checkMaxLevelsNumber()
return myMaxUpwardLevelsNumber; return myMaxUpwardLevelsNumber;
else if( myDisplayDescendants->isChecked() ) else if( myDisplayDescendants->isChecked() )
return myMaxDownwardLevelsNumber; return myMaxDownwardLevelsNumber;
return 0;
} }

View File

@ -89,7 +89,7 @@ GEOM::GEOM_Gen_ptr GEOMBase_Helper::getGeomEngine()
// Purpose : // Purpose :
//================================================================ //================================================================
GEOMBase_Helper::GEOMBase_Helper( SUIT_Desktop* desktop ) 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 ), myIsApplyAndClose( false ), myIsOptimizedBrowsing( false ), myIsWaitCursorEnabled( true ),
myIsDisableBrowsing(false), myIsDisplayResult(true) myIsDisableBrowsing(false), myIsDisplayResult(true)
{ {

View File

@ -61,7 +61,7 @@ GEOMGUI_AnnotationMgr::GEOMGUI_AnnotationMgr( SalomeApp_Application* theApplicat
QString GEOMGUI_AnnotationMgr::GetEntrySeparator() QString GEOMGUI_AnnotationMgr::GetEntrySeparator()
{ {
return "_annotation:"; return "_annotation:";
} }
//================================================================ //================================================================
@ -113,7 +113,7 @@ SALOME_Prs* GEOMGUI_AnnotationMgr::CreatePresentation( const GEOMGUI_AnnotationA
setDisplayProperties( aPresentation, aView, getEntry( theObject ).c_str() ); setDisplayProperties( aPresentation, aView, getEntry( theObject ).c_str() );
// add Prs to preview // add Prs to preview
SUIT_ViewWindow* vw = getApplication()->desktop()->activeWindow(); //SUIT_ViewWindow* vw = getApplication()->desktop()->activeWindow();
SOCC_Prs* aPrs = SOCC_Prs* aPrs =
dynamic_cast<SOCC_Prs*>( ( aView )->CreatePrs( 0 ) ); dynamic_cast<SOCC_Prs*>( ( aView )->CreatePrs( 0 ) );
@ -424,7 +424,6 @@ void GEOMGUI_AnnotationMgr::UpdateVisibleAnnotations( const QString& theEntry, S
if ( !aShape.IsNull() ) { if ( !aShape.IsNull() ) {
gp_Ax3 aShapeLCS = gp_Ax3().Transformed( aShape.Location().Transformation() );
GEOMGUI_AnnotationAttrs::SetupPresentation( aPresentation, aProperty, aShapeLCS ); GEOMGUI_AnnotationAttrs::SetupPresentation( aPresentation, aProperty, aShapeLCS );
if ( aProperty.ShapeType == TopAbs_SHAPE ) { if ( aProperty.ShapeType == TopAbs_SHAPE ) {
aPresentation->SetHilightShape( aShape ); aPresentation->SetHilightShape( aShape );

View File

@ -538,10 +538,8 @@ bool GEOMGUI_Selection::isNameMode( const int index ) const
bool GEOMGUI_Selection::hasChildren( const _PTR(SObject)& obj ) bool GEOMGUI_Selection::hasChildren( const _PTR(SObject)& obj )
{ {
if ( obj ) { // as soon as Use Case browser data tree was added
// as soon as Use Case browser data tree was added return obj ? obj->GetStudy()->GetUseCaseBuilder()->HasChildren( obj ) : false;
return obj->GetStudy()->GetUseCaseBuilder()->HasChildren( obj );
}
} }
bool GEOMGUI_Selection::expandable( const _PTR(SObject)& obj ) bool GEOMGUI_Selection::expandable( const _PTR(SObject)& obj )

View File

@ -171,7 +171,7 @@ namespace
if ( aPixmap.IsNull() ) { if ( aPixmap.IsNull() ) {
QPixmap px(":images/default_texture.png"); QPixmap px(":images/default_texture.png");
if ( !px.isNull() ) if ( !px.isNull() )
aPixmap = OCCViewer_Utilities::imageToPixmap( px.toImage() ); aPixmap = OCCViewer_Utilities::imageToPixmap( px.toImage() );
} }
return aPixmap; return aPixmap;
} }
@ -464,7 +464,7 @@ static std::string getName( GEOM::GEOM_BaseObject_ptr object )
*/ */
//================================================================= //=================================================================
GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* st ) GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* st )
: myIsRedisplayed( false ) : myUpdateColorScale(true), myIsRedisplayed( false )
{ {
if( st ) if( st )
myApp = dynamic_cast<SalomeApp_Application*>( st->application() ); myApp = dynamic_cast<SalomeApp_Application*>( st->application() );
@ -738,7 +738,7 @@ void GEOM_Displayer::UpdateVisibility( SALOME_View* v, const SALOME_Prs* p, bool
QString entry = p->GetEntry(); QString entry = p->GetEntry();
if ( !entry.isEmpty() ) { if ( !entry.isEmpty() ) {
if ( vId != -1 ) 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 ); setVisibilityState( entry, on ? Qtx::ShownState : Qtx::HiddenState );
} }
} }
@ -1014,9 +1014,9 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap
if ( !aTexture.IsNull() ) { if ( !aTexture.IsNull() ) {
Handle(Prs3d_PointAspect) aTextureAspect = Handle(Prs3d_PointAspect) aTextureAspect =
new Prs3d_PointAspect( HasColor() ? new Prs3d_PointAspect( HasColor() ?
// predefined color, manually set to displayer via GEOM_Displayer::SetColor() function // predefined color, manually set to displayer via GEOM_Displayer::SetColor() function
(Quantity_NameOfColor)GetColor() : (Quantity_NameOfColor)GetColor() :
// color from properties // color from properties
SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::PointColor ) ).value<QColor>() ), SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::PointColor ) ).value<QColor>() ),
aWidth, aHeight, aWidth, aHeight,
aTexture ); aTexture );
@ -2606,7 +2606,7 @@ PropMap GEOM_Displayer::getDefaultPropertyMap()
// - transparency (opacity = 1-transparency) // - transparency (opacity = 1-transparency)
propMap.insert( GEOM::propertyName( GEOM::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) // - display mode (take default value from preferences)
propMap.insert( GEOM::propertyName( GEOM::DisplayMode ), propMap.insert( GEOM::propertyName( GEOM::DisplayMode ),
@ -3046,43 +3046,41 @@ void GEOM_Displayer::UpdateColorScale( const bool theIsRedisplayFieldSteps, cons
Standard_Real aColorScaleMin = 0, aColorScaleMax = 0; Standard_Real aColorScaleMin = 0, aColorScaleMax = 0;
Standard_Boolean anIsBoolean = Standard_False; Standard_Boolean anIsBoolean = Standard_False;
SALOME_ListIO aSelectedObjects; Handle(SALOME_InteractiveObject) anIO;
myApp->selectionMgr()->selectedObjects( aSelectedObjects ); if ( myUpdateColorScale )
if( aSelectedObjects.Extent() == 1 ) anIO = myApp->selectionMgr()->soleSelectedObject();
if( !anIO.IsNull() )
{ {
Handle(SALOME_InteractiveObject) anIO = aSelectedObjects.First(); SOCC_Prs* aPrs = dynamic_cast<SOCC_Prs*>( aViewModel->CreatePrs( anIO->getEntry() ) );
if( !anIO.IsNull() ) if( aPrs )
{ {
SOCC_Prs* aPrs = dynamic_cast<SOCC_Prs*>( aViewModel->CreatePrs( anIO->getEntry() ) ); AIS_ListOfInteractive aList;
if( aPrs ) aPrs->GetObjects( aList );
AIS_ListIteratorOfListOfInteractive anIter( aList );
for( ; anIter.More(); anIter.Next() )
{ {
AIS_ListOfInteractive aList; Handle(GEOM_AISShape) aShape = Handle(GEOM_AISShape)::DownCast( anIter.Value() );
aPrs->GetObjects( aList ); if( !aShape.IsNull() )
AIS_ListIteratorOfListOfInteractive anIter( aList );
for( ; anIter.More(); anIter.Next() )
{ {
Handle(GEOM_AISShape) aShape = Handle(GEOM_AISShape)::DownCast( anIter.Value() ); GEOM::field_data_type aFieldDataType;
if( !aShape.IsNull() ) 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; anIsDisplayColorScale = Standard_True;
int aFieldDimension; aColorScaleTitle = aFieldStepName;
QList<QVariant> aFieldStepData; aColorScaleMin = aFieldStepRangeMin;
TCollection_AsciiString aFieldStepName; aColorScaleMax = aFieldStepRangeMax;
double aFieldStepRangeMin, aFieldStepRangeMax; anIsBoolean = aFieldDataType == GEOM::FDT_Bool;
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;
}
} }
} }
} }

View File

@ -230,6 +230,7 @@ public:
/* Update visibility and parameters of the currently selected field step's color scale */ /* Update visibility and parameters of the currently selected field step's color scale */
void UpdateColorScale( const bool theIsRedisplayFieldSteps = false, const bool updateViewer = true ); void UpdateColorScale( const bool theIsRedisplayFieldSteps = false, const bool updateViewer = true );
void SetUpdateColorScale(bool toUpdate) { myUpdateColorScale = toUpdate; } // IPAL54049
protected: protected:
/* internal methods */ /* internal methods */
@ -304,6 +305,7 @@ protected:
#if OCC_VERSION_MAJOR >= 7 #if OCC_VERSION_MAJOR >= 7
Handle(AIS_ColorScale) myColorScale; Handle(AIS_ColorScale) myColorScale;
#endif #endif
int myUpdateColorScale; // IPAL54049
// Attributes // Attributes
Quantity_Color myShadingColor; Quantity_Color myShadingColor;

View File

@ -1189,7 +1189,7 @@ void GeometryGUI::initialize( CAM_Application* app )
// ---- create menus -------------------------- // ---- 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 ); int editId = createMenu( tr( "MEN_EDIT" ), -1, -1 );
createMenu( GEOMOp::OpDelete, editId, -1 ); createMenu( GEOMOp::OpDelete, editId, -1 );
@ -2246,7 +2246,7 @@ Handle(TColStd_HArray1OfByte) GeometryGUI::getTexture
aTexture = new TColStd_HArray1OfByte (1, aStream->length()); 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] ); aTexture->SetValue( i+1, (Standard_Byte)aStream[i] );
aTextureMap[ theId ] = aTexture; aTextureMap[ theId ] = aTexture;
} }
@ -2452,7 +2452,7 @@ void GeometryGUI::createPreferences()
resMgr->value("resources", "GEOM", aFontFile); resMgr->value("resources", "GEOM", aFontFile);
aFontFile = aFontFile + QDir::separator() + "Y14.5M-2009.ttf"; aFontFile = aFontFile + QDir::separator() + "Y14.5M-2009.ttf";
// add enginier font into combobox // add enginier font into combobox
int fontID = QFontDatabase::addApplicationFont( aFontFile ); /*int fontID =*/ QFontDatabase::addApplicationFont( aFontFile );
Handle(Font_SystemFont) sf = new Font_SystemFont( Handle(Font_SystemFont) sf = new Font_SystemFont(
new TCollection_HAsciiString("Y14.5M-2009"), new TCollection_HAsciiString("Y14.5M-2009"),
Font_FA_Regular, Font_FA_Regular,

View File

@ -90,54 +90,61 @@ static bool inUse( _PTR(Study) study, const QString& component, const QMap<QStri
QMap<QString, GEOM::GEOM_BaseObject_var> gobjects; QMap<QString, GEOM::GEOM_BaseObject_var> gobjects;
QMap<QString, QString>::ConstIterator oit; QMap<QString, QString>::ConstIterator oit;
std::list<_PTR(SObject)> aSelectedSO; 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() ); _PTR(SObject) so = study->FindObjectID( oit.key().toLatin1().data() );
if ( !so ) if ( !so )
continue; continue;
aSelectedSO.push_back(so); 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 ); GEOM::GEOM_BaseObject_var geomObj_rem = GEOM::GEOM_BaseObject::_narrow( corbaObj_rem );
if( CORBA::is_nil( geomObj_rem ) ) if ( ! CORBA::is_nil( geomObj_rem ))
continue; gobjects.insert( oit.key(), geomObj_rem );
gobjects.insert( oit.key(), geomObj_rem );
} }
// Search References with other Modules // Search References with other Modules
std::list< _PTR(SObject) >::iterator itSO = aSelectedSO.begin(); 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 ); std::vector<_PTR(SObject)> aReferences = study->FindDependances( *itSO );
int aRefLength = aReferences.size(); int aRefLength = aReferences.size();
if (aRefLength) { for ( int i = 0; i < aRefLength; i++ )
for (int i = 0; i < aRefLength; i++) { {
_PTR(SObject) firstSO( aReferences[i] ); _PTR(SObject) firstSO( aReferences[i] );
_PTR(SComponent) aComponent = firstSO->GetFatherComponent(); _PTR(SComponent) aComponent = firstSO->GetFatherComponent();
QString type = aComponent->ComponentDataType().c_str(); QString type = aComponent->ComponentDataType().c_str();
if ( type == "SMESH" ) if ( type == "SMESH" )
return true; 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 ) ); _PTR(ChildIterator) it ( study->NewChildIterator( comp ) );
for ( it->InitEx( true ); it->More(); it->Next() ) { for ( it->InitEx( true ); it->More(); it->Next() )
_PTR(SObject) child( it->Value() ); {
CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( child ); _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 ); GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj );
if( CORBA::is_nil( geomObj ) ) if ( CORBA::is_nil( geomObj ) )
continue; continue;
GEOM::ListOfGBO_var list = geomObj->GetDependency(); GEOM::ListOfGBO_var dep = geomObj->GetDependency(); // child depends on dep
if( list->length() == 0 ) for( CORBA::ULong i = 0; i < dep->length(); i++ )
continue; {
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; QMap<QString, GEOM::GEOM_BaseObject_var>::Iterator git;
for ( git = gobjects.begin(); git != gobjects.end() && ( !depends || !deleted ); ++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 ); depends = depends || dep[i]->_is_equivalent( *git );
deleted = deleted || git.key() == childID ;//geomObj->_is_equivalent( *git )
} }
if ( depends && !deleted ) if ( depends && !deleted )
return true; return true;
@ -182,7 +189,7 @@ static void getGeomChildrenAndFolders( _PTR(SObject) theSO,
// purpose : Constructor // purpose : Constructor
//======================================================================= //=======================================================================
GEOMToolsGUI::GEOMToolsGUI( GeometryGUI* parent ) GEOMToolsGUI::GEOMToolsGUI( GeometryGUI* parent )
: GEOMGUI( parent ) : GEOMGUI( parent )
{ {
} }
@ -444,6 +451,8 @@ void GEOMToolsGUI::OnEditDelete()
if ( !dlg.exec() ) if ( !dlg.exec() )
return; // operation is cancelled by user return; // operation is cancelled by user
SUIT_OverrideCursor wc;
// get currently opened views // get currently opened views
QList<SALOME_View*> views; QList<SALOME_View*> views;
SALOME_View* view; SALOME_View* view;
@ -457,7 +466,8 @@ void GEOMToolsGUI::OnEditDelete()
} }
_PTR(StudyBuilder) aStudyBuilder (aStudy->NewBuilder()); _PTR(StudyBuilder) aStudyBuilder (aStudy->NewBuilder());
GEOM_Displayer* disp = new GEOM_Displayer( appStudy ); GEOM_Displayer disp( appStudy );
disp.SetUpdateColorScale( false ); // IPAL54049
if ( isComponentSelected ) { if ( isComponentSelected ) {
// GEOM component is selected: delete all objects recursively // GEOM component is selected: delete all objects recursively
@ -469,7 +479,7 @@ void GEOMToolsGUI::OnEditDelete()
for ( it->InitEx( false ); it->More(); it->Next() ) { for ( it->InitEx( false ); it->More(); it->Next() ) {
_PTR(SObject) child( it->Value() ); _PTR(SObject) child( it->Value() );
// remove object from GEOM engine // remove object from GEOM engine
removeObjectWithChildren( child, aStudy, views, disp ); removeObjectWithChildren( child, aStudy, views, &disp );
// remove object from study // remove object from study
aStudyBuilder->RemoveObjectWithChildren( child ); aStudyBuilder->RemoveObjectWithChildren( child );
// remove object from use case tree // remove object from use case tree
@ -491,7 +501,7 @@ void GEOMToolsGUI::OnEditDelete()
for ( it = toBeDeleted.begin(); it != toBeDeleted.end(); ++it ) { for ( it = toBeDeleted.begin(); it != toBeDeleted.end(); ++it ) {
_PTR(SObject) obj ( aStudy->FindObjectID( it.key().toLatin1().data() ) ); _PTR(SObject) obj ( aStudy->FindObjectID( it.key().toLatin1().data() ) );
// remove object from GEOM engine // remove object from GEOM engine
removeObjectWithChildren( obj, aStudy, views, disp ); removeObjectWithChildren( obj, aStudy, views, &disp );
// remove objects from study // remove objects from study
aStudyBuilder->RemoveObjectWithChildren( obj ); aStudyBuilder->RemoveObjectWithChildren( obj );
// remove object from use case tree // remove object from use case tree
@ -501,7 +511,7 @@ void GEOMToolsGUI::OnEditDelete()
for ( it = toBeDelFolders.begin(); it != toBeDelFolders.end(); ++it ) { for ( it = toBeDelFolders.begin(); it != toBeDelFolders.end(); ++it ) {
_PTR(SObject) obj ( aStudy->FindObjectID( it.key().toLatin1().data() ) ); _PTR(SObject) obj ( aStudy->FindObjectID( it.key().toLatin1().data() ) );
// remove object from GEOM engine // remove object from GEOM engine
removeObjectWithChildren( obj, aStudy, views, disp ); removeObjectWithChildren( obj, aStudy, views, &disp );
// remove objects from study // remove objects from study
aStudyBuilder->RemoveObjectWithChildren( obj ); aStudyBuilder->RemoveObjectWithChildren( obj );
// remove object from use case tree // remove object from use case tree

View File

@ -530,6 +530,8 @@ void GEOMToolsGUI::OnDiscloseConcealChildren( bool show )
return; return;
} }
SUIT_OverrideCursor wc;
disp->SetUpdateColorScale( false ); // IPAL54049
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
Handle(SALOME_InteractiveObject) IObject = It.Value(); Handle(SALOME_InteractiveObject) IObject = It.Value();
@ -538,10 +540,12 @@ void GEOMToolsGUI::OnDiscloseConcealChildren( bool show )
if ( obj ) { if ( obj ) {
_PTR(AttributeExpandable) aExp = B->FindOrCreateAttribute( obj, "AttributeExpandable" ); _PTR(AttributeExpandable) aExp = B->FindOrCreateAttribute( obj, "AttributeExpandable" );
aExp->SetExpandable( show ); aExp->SetExpandable( show );
if(!show) if ( !show ) {
disp->EraseWithChildren(IObject,true); disp->EraseWithChildren(IObject,true);
}
} // if ( obj ) } // if ( obj )
} // iterator } // iterator
disp->SetUpdateColorScale( true );
} }
} }
app->updateObjectBrowser( false ); app->updateObjectBrowser( false );
@ -593,7 +597,8 @@ void GEOMToolsGUI::OnUnpublishObject() {
QObject::tr( "WRN_STUDY_LOCKED" ) ); QObject::tr( "WRN_STUDY_LOCKED" ) );
return; return;
} }
SUIT_OverrideCursor wc;
disp->SetUpdateColorScale( false ); // IPAL54049
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
Handle(SALOME_InteractiveObject) IObject = It.Value(); Handle(SALOME_InteractiveObject) IObject = It.Value();
@ -612,6 +617,7 @@ void GEOMToolsGUI::OnUnpublishObject() {
} }
} // if ( obj ) } // if ( obj )
} // iterator } // iterator
disp->SetUpdateColorScale( true ); // IPAL54049
aSelMgr->clearSelected(); aSelMgr->clearSelected();
} }
} }
@ -857,7 +863,7 @@ void GEOMToolsGUI::OnCreateFolder()
if ( !aFatherSO ) return; if ( !aFatherSO ) return;
GeometryGUI::GetGeomGen()->CreateFolder( tr("NEW_FOLDER_NAME").toLatin1().constData(), GeometryGUI::GetGeomGen()->CreateFolder( tr("NEW_FOLDER_NAME").toLatin1().constData(),
_CAST(SObject, aFatherSO)->GetSObject() ); _CAST(SObject, aFatherSO)->GetSObject() );
app->updateObjectBrowser( false ); app->updateObjectBrowser( false );
} }
@ -891,7 +897,7 @@ void GEOMToolsGUI::OnSortChildren()
#ifndef DISABLE_GRAPHICSVIEW #ifndef DISABLE_GRAPHICSVIEW
void GEOMToolsGUI::OnShowDependencyTree() 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() ); SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
if ( !app ) return; if ( !app ) return;

View File

@ -30,40 +30,54 @@
#include <QGridLayout> #include <QGridLayout>
#include <SUIT_MessageBox.h> #include <SUIT_MessageBox.h>
static bool isEntryLess( const QString& e1, const QString& e2 ) #include <iostream>
namespace
{ {
QStringList el1 = e1.split(":"); struct NaturalCompare
QStringList el2 = e2.split(":"); {
int e1c = el1.count(), e2c = el2.count(); bool operator () (const std::string& s1, const std::string& s2) const
for ( int i = 0; i < e1c && i < e2c; i++ ) { {
int id1 = el1[i].toInt(); // hope the entries are never empty and never equal
int id2 = el2[i].toInt(); int diff21 = 0;
if ( id1 < id2 ) return true; const char* p1 = s1.c_str();
else if ( id2 < id1 ) return false; const char* p2 = s2.c_str();
} for ( ; ; ++p1, ++p2 )
return el1.count() < el2.count(); {
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 ) static QStringList objectsToNames( const QMap<QString, QString>& objects )
{ {
QStringList entries; typedef std::map< std::string, QString, NaturalCompare > TSortMap;
for ( QMap<QString, QString>::ConstIterator it = objects.begin(); it != objects.end(); ++it ) { TSortMap sortedByEntry;
QString entry = it.key(); for ( QMap<QString, QString>::ConstIterator it = objects.begin(); it != objects.end(); ++it )
QStringList::Iterator iter; sortedByEntry.insert( sortedByEntry.end(), std::make_pair( it.key().toStdString(), it.value() ));
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 );
}
QStringList names; QStringList names;
for ( int i = 0; i < entries.count(); i++ ) { for ( TSortMap::iterator it = sortedByEntry.begin(); it != sortedByEntry.end(); ++it )
int level = entries[i].count(":")-3; {
names.append( QString( level*2, ' ' ) + objects[ entries[i] ] ); const std::string& entry = it->first;
int level = std::count( entry.begin(), entry.end(), ':' ) - 3;
names.append( QString( level * 2, ' ' ) + it->second );
} }
return names; return names;
} }

View File

@ -778,7 +778,7 @@ void GEOMToolsGUI_MaterialPropertiesDlg::SelectionIntoArgument()
if ( study ) { if ( study ) {
SALOME_ListIO aSelList; SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList); aSelMgr->selectedObjects(aSelList);
int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true); /*int nbSel = */GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true);
} }
myLineEditCurArg->setText( aString ); myLineEditCurArg->setText( aString );
} }

View File

@ -141,22 +141,22 @@ GEOMToolsGUI_PublishDlg::~GEOMToolsGUI_PublishDlg()
if ( appStudy ) { if ( appStudy ) {
_PTR(Study) aStudy = appStudy->studyDS(); _PTR(Study) aStudy = appStudy->studyDS();
if ( aStudy ) { if ( aStudy ) {
GEOM_Displayer displayer ( appStudy ); GEOM_Displayer displayer ( appStudy );
QTreeWidgetItemIterator it( myTreeWidget ); QTreeWidgetItemIterator it( myTreeWidget );
while ( *it ) { while ( *it ) {
QString entry = myEntryToItem.key( *it ); QString entry = myEntryToItem.key( *it );
_PTR(SObject) SO ( aStudy->FindObjectID( qPrintable( entry ) ) ); _PTR(SObject) SO ( aStudy->FindObjectID( qPrintable( entry ) ) );
if ( SO ) { if ( SO ) {
GEOM::GEOM_Object_var aGeomObject = GEOM::GEOM_Object::_narrow( GeometryGUI::ClientSObjectToObject( SO ) ); GEOM::GEOM_Object_var aGeomObject = GEOM::GEOM_Object::_narrow( GeometryGUI::ClientSObjectToObject( SO ) );
if ( CORBA::is_nil( aGeomObject ) ) continue; if ( CORBA::is_nil( aGeomObject ) ) continue;
if ( displayer.IsDisplayed( aGeomObject->GetStudyEntry() ) ) { if ( displayer.IsDisplayed( aGeomObject->GetStudyEntry() ) ) {
Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( aGeomObject->GetStudyEntry(), "GEOM", "" ); Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( aGeomObject->GetStudyEntry(), "GEOM", "" );
displayer.Erase( io ); displayer.Erase( io );
} }
} }
++it; ++it;
} }
displayer.UpdateViewer(); displayer.UpdateViewer();
} }
} }
} }
@ -346,10 +346,10 @@ void GEOMToolsGUI_PublishDlg::clickOnApply() {
} }
// show references if any // show references if any
std::vector< _PTR(SObject) > vso = aStudy->FindDependances(SO); std::vector< _PTR(SObject) > vso = aStudy->FindDependances(SO);
for ( int i = 0; i < vso.size(); i++ ) { for ( size_t i = 0; i < vso.size(); i++ ) {
_PTR(SObject) refObj = vso[i]; _PTR(SObject) refObj = vso[i];
aDrw = aBuilder->FindOrCreateAttribute( refObj, "AttributeDrawable" ); aDrw = aBuilder->FindOrCreateAttribute( refObj, "AttributeDrawable" );
aDrw->SetDrawable( true ); aDrw->SetDrawable( true );
} }
} }
} }

View File

@ -165,8 +165,8 @@ void GEOMToolsGUI_ReduceStudyDlg::init( const std::set<std::string>& theObjectEn
GEOM::string_array_var otherObjects = new GEOM::string_array(); GEOM::string_array_var otherObjects = new GEOM::string_array();
GeometryGUI::GetGeomGen()->GetEntriesToReduceStudy( GeometryGUI::ClientStudyToStudy( myStudy ), GeometryGUI::GetGeomGen()->GetEntriesToReduceStudy( GeometryGUI::ClientStudyToStudy( myStudy ),
keptObjects, parentsObjects, keptObjects, parentsObjects,
subObjects, otherObjects ); subObjects, otherObjects );
for ( int i = 0; i < keptObjects->length(); i++ ) for ( int i = 0; i < keptObjects->length(); i++ )
myKeptObjects.insert( keptObjects[i].in() ); myKeptObjects.insert( keptObjects[i].in() );
@ -349,7 +349,7 @@ void GEOMToolsGUI_ReduceStudyDlg::checkVisibleIcon( QTreeWidget* theWidget )
QTreeWidgetItemIterator it( theWidget ); QTreeWidgetItemIterator it( theWidget );
while(*it) { while(*it) {
GEOMToolsGUI_TreeWidgetItem* item = dynamic_cast<GEOMToolsGUI_TreeWidgetItem*>(*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->flags() & Qt::ItemIsSelectable )
if( !item->isVisible() ) if( !item->isVisible() )
isInvisible = true; isInvisible = true;
@ -658,11 +658,11 @@ void GEOMToolsGUI_ReduceStudyDlg::clickOnOk()
} }
if( myGroupIntermediates->checkedId() == 2 ) { // remove if( myGroupIntermediates->checkedId() == 2 ) { // remove
if( !myCBSoftRemoval->isChecked() && if( !myCBSoftRemoval->isChecked() &&
SUIT_MessageBox::question( this, SUIT_MessageBox::question( this,
tr( "GEOM_WRN_WARNING" ), tr( "GEOM_WRN_WARNING" ),
tr( "GEOM_REDUCE_STUDY_WARNING_DELETE" ), tr( "GEOM_REDUCE_STUDY_WARNING_DELETE" ),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes | QMessageBox::No,
QMessageBox::Yes ) == QMessageBox::No ) { QMessageBox::Yes ) == QMessageBox::No ) {
return; return;
} }
for( iter = myListParents.begin(); iter != myListParents.end(); ++iter ) for( iter = myListParents.begin(); iter != myListParents.end(); ++iter )

View File

@ -116,9 +116,9 @@ bool IGESPlugin_GUI::importIGES( SUIT_Desktop* parent )
if ( igesOp.isNull() ) return false; if ( igesOp.isNull() ) return false;
QStringList fileNames = app->getOpenFileNames( SUIT_FileDlg::getLastVisitedPath().isEmpty() ? QDir::currentPath() : QString(""), QStringList fileNames = app->getOpenFileNames( SUIT_FileDlg::getLastVisitedPath().isEmpty() ? QDir::currentPath() : QString(""),
tr( "IGES_FILES" ), tr( "IGES_FILES" ),
tr( "IMPORT_TITLE" ), tr( "IMPORT_TITLE" ),
parent ); parent );
if ( fileNames.count() > 0 ) if ( fileNames.count() > 0 )
{ {
QStringList entryList; QStringList entryList;
@ -134,68 +134,68 @@ bool IGESPlugin_GUI::importIGES( SUIT_Desktop* parent )
try try
{ {
app->putInfo( tr( "GEOM_PRP_LOADING" ).arg( SUIT_Tools::file( fileName, true ) ) ); app->putInfo( tr( "GEOM_PRP_LOADING" ).arg( SUIT_Tools::file( fileName, true ) ) );
transaction.start(); transaction.start();
CORBA::String_var units = igesOp->ReadValue( fileName.toUtf8().constData(), "LEN_UNITS" ); CORBA::String_var units = igesOp->ReadValue( fileName.toUtf8().constData(), "LEN_UNITS" );
QString unitsStr( units.in() ); QString unitsStr( units.in() );
bool unitsOK = unitsStr.isEmpty() || unitsStr == "M" || unitsStr.toLower() == "metre"; bool unitsOK = unitsStr.isEmpty() || unitsStr == "M" || unitsStr.toLower() == "metre";
if ( !unitsOK ) if ( !unitsOK )
{ {
if( igesAnswer == SUIT_MessageBox::NoToAll ) if( igesAnswer == SUIT_MessageBox::NoToAll )
{ {
ignoreUnits = true; ignoreUnits = true;
} }
else if( igesAnswer != SUIT_MessageBox::YesToAll ) else if( igesAnswer != SUIT_MessageBox::YesToAll )
{ {
SUIT_MessageBox::StandardButtons btns = SUIT_MessageBox::Yes | SUIT_MessageBox::No | SUIT_MessageBox::Cancel; 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; if ( i < fileNames.count()-1 ) btns = btns | SUIT_MessageBox::YesToAll | SUIT_MessageBox::NoToAll;
igesAnswer = SUIT_MessageBox::question( parent, igesAnswer = SUIT_MessageBox::question( parent,
tr( "WRN_WARNING" ), tr( "WRN_WARNING" ),
tr( "SCALE_DIMENSIONS" ).arg( unitsStr ), tr( "SCALE_DIMENSIONS" ).arg( unitsStr ),
btns, btns,
SUIT_MessageBox::No ); SUIT_MessageBox::No );
switch ( igesAnswer ) switch ( igesAnswer )
{ {
case SUIT_MessageBox::Cancel: case SUIT_MessageBox::Cancel:
return true; // cancel (break) import operation return true; // cancel (break) import operation
case SUIT_MessageBox::Yes: case SUIT_MessageBox::Yes:
case SUIT_MessageBox::YesToAll: case SUIT_MessageBox::YesToAll:
break; // scaling is confirmed break; // scaling is confirmed
case SUIT_MessageBox::No: case SUIT_MessageBox::No:
case SUIT_MessageBox::NoAll: case SUIT_MessageBox::NoAll:
ignoreUnits = true; // scaling is rejected ignoreUnits = true; // scaling is rejected
default: default:
break; break;
} }
} }
} }
GEOM::ListOfGO_var result = igesOp->ImportIGES( fileName.toUtf8().constData(), ignoreUnits ); GEOM::ListOfGO_var result = igesOp->ImportIGES( fileName.toUtf8().constData(), ignoreUnits );
if ( result->length() > 0 && igesOp->IsDone() ) if ( result->length() > 0 && igesOp->IsDone() )
{ {
GEOM::GEOM_Object_var main = result[0]; GEOM::GEOM_Object_var main = result[0];
QString publishName = GEOMBase::GetDefaultName( SUIT_Tools::file( fileName, true ) ); QString publishName = GEOMBase::GetDefaultName( SUIT_Tools::file( fileName, true ) );
SALOMEDS::SObject_var so = GeometryGUI::GetGeomGen()->PublishInStudy( dsStudy, SALOMEDS::SObject_var so = GeometryGUI::GetGeomGen()->PublishInStudy( dsStudy,
SALOMEDS::SObject::_nil(), SALOMEDS::SObject::_nil(),
main.in(), main.in(),
publishName.toUtf8().constData() ); publishName.toUtf8().constData() );
entryList.append( so->GetID() ); entryList.append( so->GetID() );
transaction.commit(); transaction.commit();
GEOM_Displayer( study ).Display( main.in() ); GEOM_Displayer( study ).Display( main.in() );
main->UnRegister(); main->UnRegister();
} }
else else
{ {
transaction.abort(); transaction.abort();
errors.append( QString( "%1 : %2" ).arg( fileName ).arg( igesOp->GetErrorCode() ) ); errors.append( QString( "%1 : %2" ).arg( fileName ).arg( igesOp->GetErrorCode() ) );
} }
} }
catch( const SALOME::SALOME_Exception& e ) catch( const SALOME::SALOME_Exception& e )
{ {
transaction.abort(); transaction.abort();
} }
} }
@ -205,8 +205,8 @@ bool IGESPlugin_GUI::importIGES( SUIT_Desktop* parent )
if ( errors.count() > 0 ) if ( errors.count() > 0 )
{ {
SUIT_MessageBox::critical( parent, SUIT_MessageBox::critical( parent,
tr( "GEOM_ERROR" ), tr( "GEOM_ERROR" ),
tr( "GEOM_IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) ); tr( "GEOM_IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
} }
} }
return fileNames.count() > 0; return fileNames.count() > 0;
@ -245,10 +245,10 @@ bool IGESPlugin_GUI::exportIGES( SUIT_Desktop* parent )
QString version; QString version;
QString fileName = IGESPlugin_ExportDlg::getFileName( QString( io->getName() ), QString fileName = IGESPlugin_ExportDlg::getFileName( QString( io->getName() ),
tr( "IGES_FILES" ), tr( "IGES_FILES" ),
tr( "EXPORT_TITLE" ), tr( "EXPORT_TITLE" ),
parent, parent,
version ); version );
if ( fileName.isEmpty() ) if ( fileName.isEmpty() )
return false; return false;
@ -266,15 +266,15 @@ bool IGESPlugin_GUI::exportIGES( SUIT_Desktop* parent )
if ( igesOp->IsDone() ) if ( igesOp->IsDone() )
{ {
transaction.commit(); transaction.commit();
} }
else else
{ {
transaction.abort(); transaction.abort();
SUIT_MessageBox::critical( parent, SUIT_MessageBox::critical( parent,
tr( "GEOM_ERROR" ), tr( "GEOM_ERROR" ),
tr( "GEOM_PRP_ABORT" ) + "\n" + tr( igesOp->GetErrorCode() ) ); tr( "GEOM_PRP_ABORT" ) + "\n" + tr( igesOp->GetErrorCode() ) );
return false; return false;
} }
} }
catch ( const SALOME::SALOME_Exception& e ) catch ( const SALOME::SALOME_Exception& e )
@ -288,8 +288,8 @@ bool IGESPlugin_GUI::exportIGES( SUIT_Desktop* parent )
if ( !ok ) if ( !ok )
{ {
SUIT_MessageBox::warning( parent, SUIT_MessageBox::warning( parent,
tr( "WRN_WARNING" ), tr( "WRN_WARNING" ),
tr( "GEOM_WRN_NO_APPROPRIATE_SELECTION" ) ); tr( "GEOM_WRN_NO_APPROPRIATE_SELECTION" ) );
} }
return ok; return ok;
} }

View File

@ -236,7 +236,7 @@ void MeasureGUI_AnnotationDlg::Init()
myIsScreenFixed->setChecked( myAnnotationProperties.IsScreenFixed ); myIsScreenFixed->setChecked( myAnnotationProperties.IsScreenFixed );
int aSubShapeTypeIndex = -1; int aSubShapeTypeIndex = -1;
int aTypesCount = aTypesCount = mySubShapeTypeCombo->count(); int aTypesCount = mySubShapeTypeCombo->count();
for ( int i = 0; i < aTypesCount && aSubShapeTypeIndex < 0; i++ ) { for ( int i = 0; i < aTypesCount && aSubShapeTypeIndex < 0; i++ ) {
int aType = mySubShapeTypeCombo->itemData( i ).toInt(); int aType = mySubShapeTypeCombo->itemData( i ).toInt();
if ( aType == myAnnotationProperties.ShapeType ) if ( aType == myAnnotationProperties.ShapeType )
@ -290,7 +290,7 @@ void MeasureGUI_AnnotationDlg::Init()
myIsScreenFixed->setChecked( myAnnotationProperties.IsScreenFixed ); myIsScreenFixed->setChecked( myAnnotationProperties.IsScreenFixed );
int aSubShapeTypeIndex = -1; int aSubShapeTypeIndex = -1;
int aTypesCount = aTypesCount = mySubShapeTypeCombo->count(); int aTypesCount = mySubShapeTypeCombo->count();
for ( int i = 0; i < aTypesCount && aSubShapeTypeIndex < 0; i++ ) { for ( int i = 0; i < aTypesCount && aSubShapeTypeIndex < 0; i++ ) {
int aType = mySubShapeTypeCombo->itemData( i ).toInt(); int aType = mySubShapeTypeCombo->itemData( i ).toInt();
if ( aType == myAnnotationProperties.ShapeType ) if ( aType == myAnnotationProperties.ShapeType )

View File

@ -418,7 +418,7 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::onErrorsListSelectionChanged()
myListBox2->clear(); myListBox2->clear();
if (aCurItem < aErrs.length()) { if (aCurItem < (int)aErrs.length()) {
GEOM::GEOM_IBlocksOperations::BCError aErr = aErrs[aCurItem]; GEOM::GEOM_IBlocksOperations::BCError aErr = aErrs[aCurItem];
GEOM::ListOfLong aObjLst = aErr.incriminated; GEOM::ListOfLong aObjLst = aErr.incriminated;
QStringList aSubShapeList; QStringList aSubShapeList;

View File

@ -116,9 +116,9 @@ bool STLPlugin_GUI::importSTL( SUIT_Desktop* parent )
if ( stlOp.isNull() ) return false; if ( stlOp.isNull() ) return false;
QStringList fileNames = app->getOpenFileNames( SUIT_FileDlg::getLastVisitedPath().isEmpty() ? QDir::currentPath() : QString(""), QStringList fileNames = app->getOpenFileNames( SUIT_FileDlg::getLastVisitedPath().isEmpty() ? QDir::currentPath() : QString(""),
tr( "STL_FILES" ), tr( "STL_FILES" ),
tr( "IMPORT_TITLE" ), tr( "IMPORT_TITLE" ),
parent ); parent );
if ( fileNames.count() > 0 ) if ( fileNames.count() > 0 )
{ {
QStringList entryList; QStringList entryList;
@ -131,32 +131,32 @@ bool STLPlugin_GUI::importSTL( SUIT_Desktop* parent )
try try
{ {
app->putInfo( tr( "GEOM_PRP_LOADING" ).arg( fileName ) ); app->putInfo( tr( "GEOM_PRP_LOADING" ).arg( fileName ) );
transaction.start(); transaction.start();
GEOM::ListOfGO_var result = stlOp->ImportSTL( fileName.toUtf8().constData() ); GEOM::ListOfGO_var result = stlOp->ImportSTL( fileName.toUtf8().constData() );
if ( result->length() > 0 && stlOp->IsDone() ) if ( result->length() > 0 && stlOp->IsDone() )
{ {
GEOM::GEOM_Object_var main = result[0]; GEOM::GEOM_Object_var main = result[0];
QString publishName = GEOMBase::GetDefaultName( SUIT_Tools::file( fileName, true ) ); QString publishName = GEOMBase::GetDefaultName( SUIT_Tools::file( fileName, true ) );
SALOMEDS::SObject_var so = GeometryGUI::GetGeomGen()->PublishInStudy( dsStudy, SALOMEDS::SObject_var so = GeometryGUI::GetGeomGen()->PublishInStudy( dsStudy,
SALOMEDS::SObject::_nil(), SALOMEDS::SObject::_nil(),
main.in(), main.in(),
publishName.toUtf8().constData() ); publishName.toUtf8().constData() );
entryList.append( so->GetID() ); entryList.append( so->GetID() );
transaction.commit(); transaction.commit();
GEOM_Displayer( study ).Display( main.in() ); GEOM_Displayer( study ).Display( main.in() );
main->UnRegister(); main->UnRegister();
} }
else else
{ {
transaction.abort(); transaction.abort();
errors.append( QString( "%1 : %2" ).arg( fileName ).arg( stlOp->GetErrorCode() ) ); errors.append( QString( "%1 : %2" ).arg( fileName ).arg( stlOp->GetErrorCode() ) );
} }
} }
catch( const SALOME::SALOME_Exception& e ) catch( const SALOME::SALOME_Exception& e )
{ {
transaction.abort(); transaction.abort();
} }
} }
getGeometryGUI()->updateObjBrowser( true ); getGeometryGUI()->updateObjBrowser( true );
@ -165,8 +165,8 @@ bool STLPlugin_GUI::importSTL( SUIT_Desktop* parent )
if ( errors.count() > 0 ) if ( errors.count() > 0 )
{ {
SUIT_MessageBox::critical( parent, SUIT_MessageBox::critical( parent,
tr( "GEOM_ERROR" ), tr( "GEOM_ERROR" ),
tr( "GEOM_IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) ); tr( "GEOM_IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
} }
} }
return fileNames.count() > 0; return fileNames.count() > 0;
@ -207,12 +207,12 @@ bool STLPlugin_GUI::exportSTL( SUIT_Desktop* parent )
double deflection = 0.; double deflection = 0.;
bool isRelative = false; bool isRelative = false;
QString fileName = STLPlugin_ExportDlg::getFileName( io, QString fileName = STLPlugin_ExportDlg::getFileName( io,
tr( "STL_FILES" ), tr( "STL_FILES" ),
tr( "EXPORT_TITLE" ), tr( "EXPORT_TITLE" ),
parent, parent,
isASCII, isASCII,
deflection, deflection,
isRelative ); isRelative );
if ( fileName.isEmpty() ) if ( fileName.isEmpty() )
return false; return false;
@ -230,15 +230,15 @@ bool STLPlugin_GUI::exportSTL( SUIT_Desktop* parent )
if ( stlOp->IsDone() ) if ( stlOp->IsDone() )
{ {
transaction.commit(); transaction.commit();
} }
else else
{ {
transaction.abort(); transaction.abort();
SUIT_MessageBox::critical( parent, SUIT_MessageBox::critical( parent,
tr( "GEOM_ERROR" ), tr( "GEOM_ERROR" ),
tr( "GEOM_PRP_ABORT" ) + "\n" + tr( stlOp->GetErrorCode() ) ); tr( "GEOM_PRP_ABORT" ) + "\n" + tr( stlOp->GetErrorCode() ) );
return false; return false;
} }
} }
catch ( const SALOME::SALOME_Exception& e ) catch ( const SALOME::SALOME_Exception& e )
@ -252,8 +252,8 @@ bool STLPlugin_GUI::exportSTL( SUIT_Desktop* parent )
if ( !ok ) if ( !ok )
{ {
SUIT_MessageBox::warning( parent, SUIT_MessageBox::warning( parent,
tr( "WRN_WARNING" ), tr( "WRN_WARNING" ),
tr( "GEOM_WRN_NO_APPROPRIATE_SELECTION" ) ); tr( "GEOM_WRN_NO_APPROPRIATE_SELECTION" ) );
} }
return ok; return ok;
} }

View File

@ -281,17 +281,17 @@ bool XAOPlugin_ImportDlg::execute()
QStringList anEntryList; QStringList anEntryList;
anEntryList << addInStudy(m_mainShape, m_mainShape->GetName()); anEntryList << addInStudy(m_mainShape, m_mainShape->GetName());
m_mainShape->UnRegister(); 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()); addInStudy(subShapes[i].in(), subShapes[i]->GetName());
subShapes[i]->UnRegister(); 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()); addInStudy(groups[i].in(), groups[i]->GetName());
groups[i]->UnRegister(); 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); addFieldInStudy(fields[i].in(), m_mainShape);
} }
@ -329,7 +329,7 @@ QString XAOPlugin_ImportDlg::addFieldInStudy( GEOM::GEOM_Field_ptr theField, GEO
// add steps // add steps
GEOM::ListOfLong_var steps = theField->GetSteps(); 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]); GEOM::GEOM_FieldStep_ptr step = theField->GetStep(steps[i]);
QString stepName = (tr("XAOPLUGIN_STEP") + " %1 %2").arg( step->GetID() ).arg( step->GetStamp() ); QString stepName = (tr("XAOPLUGIN_STEP") + " %1 %2").arg( step->GetID() ).arg( step->GetStamp() );