From 80531775fdb7e0394dab5b10c41e582d4dfdbe97 Mon Sep 17 00:00:00 2001 From: akl Date: Mon, 7 Jul 2014 18:51:33 +0400 Subject: [PATCH] Fix problems with displaying Dependency tree on Windows platform. --- src/DependencyTree/DependencyTree_Object.cxx | 15 ++++++++------- src/DependencyTree/DependencyTree_Selector.cxx | 14 ++++++++------ src/DependencyTree/DependencyTree_View.cxx | 2 +- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/DependencyTree/DependencyTree_Object.cxx b/src/DependencyTree/DependencyTree_Object.cxx index a25f4caa3..25203629e 100644 --- a/src/DependencyTree/DependencyTree_Object.cxx +++ b/src/DependencyTree/DependencyTree_Object.cxx @@ -63,7 +63,8 @@ myIsMainObject( false ) SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); if ( !app ) return; SalomeApp_Study* study = dynamic_cast(app->activeStudy()); - int studyId = GeometryGUI::ClientStudyToStudy( study->studyDS())->StudyId(); + SALOMEDS::Study_var aStudyDS = GeometryGUI::ClientStudyToStudy( study->studyDS() ); + int studyId = aStudyDS->StudyId(); myGeomObject = GeometryGUI::GetGeomGen()->GetObject( studyId, myEntry.c_str() ); updateName(); @@ -167,9 +168,9 @@ void DependencyTree_Object::updateName() { QString name = myGeomObject->GetName(); - QString studyEntry = myGeomObject->GetStudyEntry(); + CORBA::String_var studyEntryVar = myGeomObject->GetStudyEntry(); - if( studyEntry.isEmpty() ) { + if( QString( studyEntryVar.in() ).isEmpty() ) { if( name.isEmpty() ) name = "unpublished"; myColor = myUnpublishObjectColor; @@ -203,8 +204,8 @@ void DependencyTree_Object::updateName() //================================================================================= void DependencyTree_Object::setColor( const QColor& theColor ) { - QString studyEntry = myGeomObject->GetStudyEntry(); - if( studyEntry.isEmpty() ) + CORBA::String_var studyEntryVar = myGeomObject->GetStudyEntry(); + if( QString( studyEntryVar.in() ).isEmpty() ) myColor = myUnpublishObjectColor; else myColor = theColor; @@ -236,8 +237,8 @@ void DependencyTree_Object::setMainObjectColor( const QColor& theColor ) void DependencyTree_Object::setUnpublishObjectColor( const QColor& theColor ) { myUnpublishObjectColor = theColor; - QString studyEntry = myGeomObject->GetStudyEntry(); - if( studyEntry.isEmpty() ) + CORBA::String_var studyEntryVar = myGeomObject->GetStudyEntry(); + if( QString( studyEntryVar.in() ).isEmpty() ) myColor = myUnpublishObjectColor; } diff --git a/src/DependencyTree/DependencyTree_Selector.cxx b/src/DependencyTree/DependencyTree_Selector.cxx index 370e4511c..98f0cc030 100644 --- a/src/DependencyTree/DependencyTree_Selector.cxx +++ b/src/DependencyTree/DependencyTree_Selector.cxx @@ -48,23 +48,25 @@ void DependencyTree_Selector::getSelection( SUIT_DataOwnerPtrList& theList ) con { for( myView->initSelected(); myView->moreSelected(); myView->nextSelected() ) if( DependencyTree_Object* treeObject = dynamic_cast( myView->selectedObject() ) ) { - const char* entry; - const char* name; + QString studyEntry; + QString name; GEOM::GEOM_BaseObject_var anObj = GeometryGUI::GetGeomGen()->GetObject( myView->getStudyId(), treeObject->getEntry().c_str() ); if( anObj->_is_nil() ) continue; - QString studyEntry = anObj->GetStudyEntry(); + CORBA::String_var studyEntryVar = anObj->GetStudyEntry(); + studyEntry = studyEntryVar.in(); if( studyEntry.isEmpty() ) { - entry = treeObject->getEntry().c_str(); + studyEntry = treeObject->getEntry().c_str(); name = "TEMP_IO_UNPUBLISHED"; } else { - entry = studyEntry.toStdString().c_str(); name = "TEMP_IO"; } Handle(SALOME_InteractiveObject) tmpIO = - new SALOME_InteractiveObject( entry, "GEOM", name); + new SALOME_InteractiveObject( studyEntry.toStdString().c_str(), + "GEOM", + name.toStdString().c_str()); theList.append( new LightApp_DataOwner( tmpIO ) ); } diff --git a/src/DependencyTree/DependencyTree_View.cxx b/src/DependencyTree/DependencyTree_View.cxx index 884446e6e..68dcf7669 100644 --- a/src/DependencyTree/DependencyTree_View.cxx +++ b/src/DependencyTree/DependencyTree_View.cxx @@ -594,7 +594,7 @@ void DependencyTree_View::drawTree() std::map< int, std::vector< std::string > >::const_iterator level; for( level = levelObjects.begin(); level != levelObjects.end(); level++ ) { - int step = -horDistance * ( level->second.size() - 1 ) / 2; + int step = -horDistance * ( int(level->second.size()) - 1 ) / 2; for( int objIter = 0; objIter < level->second.size(); objIter++ ) { DependencyTree_Object* anObject = myTreeMap[ level->second.at( objIter ) ]; anObject->setPos( step, verDistance * level->first );