]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Fix problems with displaying Dependency tree on Windows platform.
authorakl <alexander.kovalev@opencascade.com>
Mon, 7 Jul 2014 14:51:33 +0000 (18:51 +0400)
committerakl <alexander.kovalev@opencascade.com>
Mon, 7 Jul 2014 14:51:33 +0000 (18:51 +0400)
src/DependencyTree/DependencyTree_Object.cxx
src/DependencyTree/DependencyTree_Selector.cxx
src/DependencyTree/DependencyTree_View.cxx

index a25f4caa3d6d050a28751ff5445c2e9b94279af6..25203629ee1a9b116ac33095c217c826aeb01331 100644 (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;
 }
 
index 370e4511cabea1abb607b7d053064bce6d094cdf..98f0cc0304603a7976b70a3a3ae0d30fd0ade91a 100644 (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 ) );
     }
index 884446e6e181f373cc05d0c33c1c17f37d35ab64..68dcf76698e911a1b798557902b2bc4fd5c723b2 100644 (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 );