mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-27 09:50:34 +05:00
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:
parent
7c7eefda24
commit
fb044eba69
@ -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);
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -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 );
|
||||||
|
@ -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->GetStudy()->GetUseCaseBuilder()->HasChildren( obj );
|
return obj ? obj->GetStudy()->GetUseCaseBuilder()->HasChildren( obj ) : false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GEOMGUI_Selection::expandable( const _PTR(SObject)& obj )
|
bool GEOMGUI_Selection::expandable( const _PTR(SObject)& obj )
|
||||||
|
@ -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() );
|
||||||
@ -3046,11 +3046,10 @@ 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();
|
||||||
{
|
|
||||||
Handle(SALOME_InteractiveObject) anIO = aSelectedObjects.First();
|
|
||||||
if( !anIO.IsNull() )
|
if( !anIO.IsNull() )
|
||||||
{
|
{
|
||||||
SOCC_Prs* aPrs = dynamic_cast<SOCC_Prs*>( aViewModel->CreatePrs( anIO->getEntry() ) );
|
SOCC_Prs* aPrs = dynamic_cast<SOCC_Prs*>( aViewModel->CreatePrs( anIO->getEntry() ) );
|
||||||
@ -3087,7 +3086,6 @@ void GEOM_Displayer::UpdateColorScale( const bool theIsRedisplayFieldSteps, cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if( anIsDisplayColorScale )
|
if( anIsDisplayColorScale )
|
||||||
{
|
{
|
||||||
|
@ -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;
|
||||||
|
@ -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,
|
||||||
|
@ -90,25 +90,26 @@ 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();
|
||||||
@ -116,28 +117,34 @@ static bool inUse( _PTR(Study) study, const QString& component, const QMap<QStri
|
|||||||
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() );
|
{
|
||||||
|
_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 );
|
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
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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;
|
||||||
|
@ -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 )
|
||||||
|
{
|
||||||
|
if ( *p1 == *p2 )
|
||||||
|
{
|
||||||
|
if ( diff21 && !*p1 ) // both numbers ends
|
||||||
|
return diff21 > 0;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
return el1.count() < el2.count();
|
// 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;
|
||||||
}
|
}
|
||||||
|
@ -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 );
|
||||||
}
|
}
|
||||||
|
@ -346,7 +346,7 @@ 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 );
|
||||||
|
@ -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;
|
||||||
|
@ -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 )
|
||||||
|
@ -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;
|
||||||
|
@ -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() );
|
||||||
|
Loading…
Reference in New Issue
Block a user