From 2ce8fbdcf916b5f366860f43a8753441aad18577 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 1 Sep 2008 10:06:19 +0000 Subject: [PATCH] From Wojciech Lewandowski, "Most recent changes to CameraPathEventHandler change path writing method. Now control points are written on the fly. But default stream precision is not adjusted as it used to and remains set to 6 digits (at least with VS 2008) so larger coordinates like positions on Earth Ellipsoid loose lots of fidelity. This patch fixes this issue. " --- include/osgSim/ShapeAttribute | 8 +++++++- src/osgViewer/ViewerEventHandlers.cpp | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/osgSim/ShapeAttribute b/include/osgSim/ShapeAttribute index 231fcd2af..48bafcb55 100644 --- a/include/osgSim/ShapeAttribute +++ b/include/osgSim/ShapeAttribute @@ -52,12 +52,18 @@ class OSGSIM_EXPORT ShapeAttribute ShapeAttribute& operator = (const ShapeAttribute& sa); const std::string & getName() const { return _name; } + void setName(const std::string& name) { _name = name; } + const Type getType() const { return _type; } int getInt() const { return _integer; } double getDouble() const { return _double; } const char * getString() const { return _string; } - + + void setValue(int value) {_type = INTEGER; _integer = value; } + void setValue(double value) {_type = DOUBLE; _double = value; } + void setValue(const char * value) {_type = STRING; _string = (value ? strdup(value) : 0); } + /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ int compare(const osgSim::ShapeAttribute& sa) const; diff --git a/src/osgViewer/ViewerEventHandlers.cpp b/src/osgViewer/ViewerEventHandlers.cpp index 08e3e06d2..a3de7da79 100644 --- a/src/osgViewer/ViewerEventHandlers.cpp +++ b/src/osgViewer/ViewerEventHandlers.cpp @@ -463,6 +463,9 @@ bool RecordCameraPathHandler::handle(const osgGA::GUIEventAdapter &ea, osgGA::GU osg::notify(osg::NOTICE) << "Recording camera path to file " << ss.str() << std::endl; _fout.open( ss.str().c_str() ); + + // make sure doubles are not trucated by default stream precision = 6 + _fout.precision( 15 ); } else {