Fix problems with displaying Dependency tree on Windows platform.

This commit is contained in:
akl 2014-07-07 18:51:33 +04:00
parent b5261a9818
commit 80531775fd
3 changed files with 17 additions and 14 deletions

View File

@ -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<SalomeApp_Study*>(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;
}

View File

@ -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<DependencyTree_Object*>( 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 ) );
}

View File

@ -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 );