Salome HOME
Use tempfile.mkdtemp to create temporary directory
[modules/yacs.git] / src / genericgui / SceneBlocItem.cxx
index 329bd38e8b3ca4cd503a6f2fcdd62a96e477cc72..14b9f482e19154baf198a94869ce8eb88e5874c3 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2006-2015  CEA/DEN, EDF R&D
+// Copyright (C) 2006-2022  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -33,6 +33,8 @@
 
 #include <gvc.h>
 
+#include <Qtx.h> // for Localizer
+
 #include "Resource.hxx"
 
 //#define _DEVDEBUG_
@@ -70,7 +72,6 @@ void SceneBlocItem::arrangeChildNodes()
   clock_t start_t, end_t;
   start_t = clock();
 #endif //_DEVDEBUG_
-  GVC_t* aGvc = 0;
 
 
   SubjectComposedNode *scnode = dynamic_cast<SubjectComposedNode*>(getSubject());
@@ -80,14 +81,11 @@ void SceneBlocItem::arrangeChildNodes()
 
   // ---- Create a graphviz context
 
-  if(!aGvc)
-    {
-      DEBTRACE(setlocale(LC_ALL,NULL));
-      //Graphviz is sensitive to locale : set the mimimal one ("C")for numeric
-      setlocale(LC_NUMERIC, "C");
-      //aginit();
-      aGvc = gvContext();
-    }
+  // Graphviz is sensitive to locale : set the mimimal one ("C")for numeric
+  Qtx::Localizer loc;
+
+  //aginit();
+  GVC_t* aGvc = gvContext();
 
   // ---- Create a graph
 
@@ -203,15 +201,15 @@ void  SceneBlocItem::getNodesInfo(YACS::ENGINE::ComposedNode *cnode)
       width  = QString(_format.c_str()).arg(lw, 0, 'g', 3);
 
       DEBTRACE(agnameof(aNode) << " (" << nh << "," << nw << ") = (" << height.toStdString()  << " ; " << width.toStdString() <<")");
-      agset(aNode, const_cast<char*>("height"),    height.toAscii().data());
-      agset(aNode, const_cast<char*>("width"),     width.toAscii().data());
+      agset(aNode, const_cast<char*>("height"),    height.toLatin1().data());
+      agset(aNode, const_cast<char*>("width"),     width.toLatin1().data());
       agset(aNode, const_cast<char*>("shape"),     const_cast<char*>("box") );
       agset(aNode, const_cast<char*>("fixedsize"), const_cast<char*>("true") );
     }
 
   // --- Create edges (i.e. links)
 
-  Agnode_t* aNode;
+  Agnode_t* aNode = NULL;
   for (aNode = agfstnode(_graph); aNode; aNode = agnxtnode(_graph, aNode))
   {
     string aNodeName = agnameof(aNode);