From 4b4dd94b5d2a0d164d96bded78a28533ea93d313 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 5 Mar 2010 11:21:36 +0000 Subject: [PATCH] Added an "-a" speed averager option and a "-o filename" output option. --- examples/osggpx/osggpx.cpp | 134 ++++++++++++++++++++++++++++++++++++- 1 file changed, 133 insertions(+), 1 deletion(-) diff --git a/examples/osggpx/osggpx.cpp b/examples/osggpx/osggpx.cpp index ab263a776..4cde32493 100644 --- a/examples/osggpx/osggpx.cpp +++ b/examples/osggpx/osggpx.cpp @@ -98,7 +98,7 @@ protected: double convertTime(const std::string& timestr) { - //osg::notify(osg::NOTICE)<<" time = "<addChild(createTrackModel(track, osg::Vec4(1.0,1.0,1.0,1.0))); + // smooth the track + if (average) + { + for(Track::TrackSegments::iterator itr = track->getTrackSegments().begin(); + itr != track->getTrackSegments().end(); + ++itr) + { + *itr = computeAveragedSpeedTrackSegment(itr->get()); + } + } + // smooth the track if (smooth) { @@ -401,6 +494,45 @@ int main(int argv, char **argc) } + if (!outputFilename.empty()) + { + std::ofstream fout(outputFilename.c_str()); + + fout<<""<get(); + + fout<<""<The track description"<getTrackSegments().begin(); + itr != track->getTrackSegments().end(); + ++itr) + { + TrackSegment* ts = itr->get(); + fout<<""<getTrackPoints().begin(); + pitr != ts->getTrackPoints().end(); + ++pitr) + { + fout<<"latitude<<"\" lon=\""<longitude<<"\">"<"<elevation<<""<"<time<<""<"<"<"<"<