Salome HOME
Some corrections related to using UNICODE.
[modules/geom.git] / src / GEOMGUI / GEOMGUI_Selection.cxx
index 0644ff317015fe5f28cdcde47e4db086dde88495..017e7c2400f5f2984c04dc400568951847b48232 100644 (file)
@@ -269,7 +269,7 @@ bool GEOMGUI_Selection::isVisible( const int index ) const
   GEOM::GEOM_Object_var obj = getObject( index );
   SALOME_View* view = GEOM_Displayer::GetActiveView();
   if ( !CORBA::is_nil( obj ) && view ) {
-    Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( entry( index ).toLatin1().constData(), "GEOM", "TEMP_IO" );
+    Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( entry( index ).toUtf8().constData(), "GEOM", "TEMP_IO" );
     res = view->isVisible( io );
   }
 
@@ -342,7 +342,7 @@ QString GEOMGUI_Selection::displayMode( const int index ) const
 
   SALOME_View* view = GEOM_Displayer::GetActiveView();
   if ( view /*fix for 9320==>*/&& ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) {
-    SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
+    SALOME_Prs* prs = view->CreatePrs( entry( index ).toUtf8().constData() );
     if ( prs ) {
       if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
         SOCC_Prs* occPrs = (SOCC_Prs*) prs;
@@ -408,7 +408,7 @@ bool GEOMGUI_Selection::isVectorsMode( const int index ) const
   SALOME_View* view = GEOM_Displayer::GetActiveView();
   QString viewType = activeViewType();
   if ( view && ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) {
-    SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
+    SALOME_Prs* prs = view->CreatePrs( entry( index ).toUtf8().constData() );
     if ( prs ) {
       if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
         SOCC_Prs* occPrs = (SOCC_Prs*) prs;
@@ -455,7 +455,7 @@ bool GEOMGUI_Selection::isVerticesMode( const int index ) const
   SALOME_View* view = GEOM_Displayer::GetActiveView();
   QString viewType = activeViewType();
   if ( view && ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) {
-    SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
+    SALOME_Prs* prs = view->CreatePrs( entry( index ).toUtf8().constData() );
     if ( prs ) {
       if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
         SOCC_Prs* occPrs = (SOCC_Prs*) prs;
@@ -502,7 +502,7 @@ bool GEOMGUI_Selection::isNameMode( const int index ) const
   SALOME_View* view = GEOM_Displayer::GetActiveView();
   QString viewType = activeViewType();
   if ( view && ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) {
-    SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
+    SALOME_Prs* prs = view->CreatePrs( entry( index ).toUtf8().constData() );
     if ( prs ) {
       if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
         SOCC_Prs* occPrs = (SOCC_Prs*) prs;
@@ -539,7 +539,7 @@ bool GEOMGUI_Selection::isNameMode( const int index ) const
 bool GEOMGUI_Selection::hasChildren( const _PTR(SObject)& obj )
 {
   // as soon as Use Case browser data tree was added
-  return obj ? obj->GetStudy()->GetUseCaseBuilder()->HasChildren( obj ) : false;
+  return obj ? SalomeApp_Application::getStudy()->GetUseCaseBuilder()->HasChildren( obj ) : false;
 }
 
 bool GEOMGUI_Selection::expandable( const _PTR(SObject)& obj )
@@ -601,8 +601,8 @@ int GEOMGUI_Selection::nbChildren( const int index ) const
     _PTR(Study) study = appStudy->studyDS();
     if ( study && !anEntry.isEmpty() ) {
       _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
-      if ( aSO && aSO->GetStudy()->GetUseCaseBuilder()->IsUseCaseNode(aSO) ) {
-        _PTR(UseCaseIterator) it = aSO->GetStudy()->GetUseCaseBuilder()->GetUseCaseIterator( aSO ); 
+      if ( aSO && study->GetUseCaseBuilder()->IsUseCaseNode(aSO) ) {
+        _PTR(UseCaseIterator) it = study->GetUseCaseBuilder()->GetUseCaseIterator( aSO );
         for (it->Init(false); it->More(); it->Next()) nb++;
       }
     }
@@ -716,7 +716,7 @@ bool GEOMGUI_Selection::topLevel( const int index ) const
   SALOME_View* view = GEOM_Displayer::GetActiveView();
   QString viewType = activeViewType();
   if ( view && viewType == OCCViewer_Viewer::Type() ) {
-    SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
+    SALOME_Prs* prs = view->CreatePrs( entry( index ).toUtf8().constData() );
     if ( prs ) {
       if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
         SOCC_Prs* occPrs = (SOCC_Prs*) prs;
@@ -752,7 +752,7 @@ bool GEOMGUI_Selection::isPhysicalMaterial( const int idx ) const
   SALOME_View* view = GEOM_Displayer::GetActiveView();
   QString viewType = activeViewType();
   if ( view ) {
-    SALOME_Prs* prs = view->CreatePrs( entry( idx ).toLatin1().constData() );
+    SALOME_Prs* prs = view->CreatePrs( entry( idx ).toUtf8().constData() );
     if ( prs ) {
       if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
         SOCC_Prs* occPrs = (SOCC_Prs*) prs;
@@ -808,21 +808,13 @@ bool GEOMGUI_Selection::isFolder( const int index ) const
 
 bool GEOMGUI_Selection::hasDimensions( const int theIndex, bool& theHidden, bool& theVisible ) const
 {
-  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
-
-  if ( !appStudy )
-  {
-    return false;
-  }
-
   QString anEntry = entry( theIndex );
-  _PTR(Study) aStudy = appStudy->studyDS();
-  if ( !aStudy || anEntry.isNull() )
+  if ( anEntry.isNull() )
   {
     return false;
   }
 
-  GEOMGUI_DimensionProperty aDimensions( appStudy, anEntry.toStdString() );
+  GEOMGUI_DimensionProperty aDimensions( anEntry.toStdString() );
 
   theHidden  = false;
   theVisible = false;
@@ -878,13 +870,13 @@ bool GEOMGUI_Selection::hasAnnotations( const int theIndex, bool& theHidden, boo
   if ( !aStudy || anEntry.isNull() )
     return false;
 
-  _PTR(SObject) aSObj = appStudy->studyDS()->FindObjectID( anEntry.toStdString() );\r
+  _PTR(SObject) aSObj = appStudy->studyDS()->FindObjectID( anEntry.toStdString() );
 
-  const Handle(GEOMGUI_AnnotationAttrs)\r
-    aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );\r
+  const Handle(GEOMGUI_AnnotationAttrs)
+    aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
 
-  if ( aShapeAnnotations.IsNull() )\r
-    return false;\r
+  if ( aShapeAnnotations.IsNull() )
+    return false;
 
   theHidden  = false;
   theVisible = false;