Salome HOME
refs #430: incorrect coordinates in dump polyline
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Tool.cxx
index 48bf198941b2d9b7610f211575bbc5b5376cb81e..51404eaed7eb174fdea98388e12def5033e3eca9 100644 (file)
@@ -438,16 +438,26 @@ Handle(HYDROData_Entity) HYDROGUI_Tool::FindObjectByName( HYDROGUI_Module* theMo
                                                           const QString&   theName,
                                                           const ObjectKind theObjectKind )
 {
+  Handle(HYDROData_Entity) aResObj;
+  
   Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( theModule->getStudyId() );
-  return HYDROData_Tool::FindObjectByName( aDocument, theName, theObjectKind );
+  if ( !aDocument.IsNull() )
+    aResObj = aDocument->FindObjectByName( theName, theObjectKind );
+  
+  return aResObj;
 }
 
 HYDROData_SequenceOfObjects HYDROGUI_Tool::FindObjectsByNames( HYDROGUI_Module*   theModule,
                                                                const QStringList& theNames,
                                                                const ObjectKind   theObjectKind )
 {
+  HYDROData_SequenceOfObjects aResSeq;
+
   Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( theModule->getStudyId() );
-  return HYDROData_Tool::FindObjectsByNames( aDocument, theNames, theObjectKind );
+  if ( !aDocument.IsNull() )
+    aResSeq = aDocument->FindObjectsByNames( theNames, theObjectKind );
+
+  return aResSeq;
 }
 
 QString HYDROGUI_Tool::GenerateObjectName( HYDROGUI_Module*   theModule,
@@ -662,8 +672,7 @@ QColor HYDROGUI_Tool::GenerateFillingColor( const Handle(HYDROData_Document)& th
   {
     const QString& aZoneName = aZoneNameIter.next();
     Handle(HYDROData_ImmersibleZone) aRefZone = 
-      Handle(HYDROData_ImmersibleZone)::DownCast(
-        HYDROData_Tool::FindObjectByName( theDoc, aZoneName, KIND_IMMERSIBLE_ZONE ) );
+      Handle(HYDROData_ImmersibleZone)::DownCast( theDoc->FindObjectByName( aZoneName, KIND_IMMERSIBLE_ZONE ) );
     if( !aRefZone.IsNull() )
     {
       QColor aRefColor = aRefZone->GetFillingColor();
@@ -698,7 +707,14 @@ QStringList HYDROGUI_Tool::FindExistingObjectsNames( const Handle(HYDROData_Docu
   return aNames;
 }
 
-QString HYDROGUI_Tool::GetCoordinateString( const double theNumber )
+QString HYDROGUI_Tool::GetCoordinateString( const double theNumber, bool isInLocale )
 {
-  return QString::number( theNumber, 'f', 2 );
-}
\ No newline at end of file
+  if( isInLocale )
+  {
+    static QLocale aLocale( QLocale::English, QLocale::France );
+    return aLocale.toString( theNumber, 'f', 2 );
+  }
+  else
+    return QString::number( theNumber, 'f', 2 );
+}
+