From ec08c4dfea2849c2a50ea7052e00aebae581d61a Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 6 Feb 2012 13:29:38 +0000 Subject: [PATCH] From Cory Riddell, "I've been using the dot plugin and found that our application which sets the global locale was generating bad dot files. Specifically, the node numbers had comma separators in them (like 1,234 rather than 1234). The attached file simply forces the stringstreams used to build up the dot file to use the "C" locale." --- src/osgPlugins/dot/BaseDotVisitor.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/osgPlugins/dot/BaseDotVisitor.cpp b/src/osgPlugins/dot/BaseDotVisitor.cpp index 58b5cc67f..d1279f6cb 100644 --- a/src/osgPlugins/dot/BaseDotVisitor.cpp +++ b/src/osgPlugins/dot/BaseDotVisitor.cpp @@ -27,6 +27,12 @@ namespace osgDot { BaseDotVisitor::BaseDotVisitor() { _rankdir = "rankdir = LR;"; + // Set the locale used by the _nodes and _edges streams to the + // classic or "C" locale. This is needed because most of the + // Graphviz tools are not locale sensitive and get confused + // by id numbers containing commas or periods. + _nodes.imbue(std::locale("C")); + _edges.imbue(std::locale("C")); } BaseDotVisitor::~BaseDotVisitor() {