From d874b51419ba595a9b82e4776e2aaa05ccae9c20 Mon Sep 17 00:00:00 2001 From: DennisOSRM Date: Thu, 17 Nov 2011 15:41:49 +0100 Subject: [PATCH] Added some minor code formatting --- Algorithms/PolylineCompressor.h | 35 ++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/Algorithms/PolylineCompressor.h b/Algorithms/PolylineCompressor.h index 824b4dd0f..ca7793cae 100644 --- a/Algorithms/PolylineCompressor.h +++ b/Algorithms/PolylineCompressor.h @@ -24,7 +24,7 @@ or see http://www.gnu.org/licenses/agpl.txt. #include #include "../DataStructures/ExtractorStructs.h" - +#include "../DataStructures/SegmentInformation.h" #include "../Util/StringUtil.h" class PolylineCompressor { @@ -57,6 +57,21 @@ private: } public: + inline void printEncodedString(const vector& polyline, string &output) { + vector deltaNumbers(2*polyline.size()); + output += "\""; + if(!polyline.empty()) { + deltaNumbers[0] = polyline[0].location.lat; + deltaNumbers[1] = polyline[0].location.lon; + for(unsigned i = 1; i < polyline.size(); ++i) { + deltaNumbers[(2*i)] = (polyline[i].location.lat - polyline[i-1].location.lat); + deltaNumbers[(2*i)+1] = (polyline[i].location.lon - polyline[i-1].location.lon); + } + encodeVectorSignedNumber(deltaNumbers, output); + } + output += "\""; + } + inline void printEncodedString(const vector<_Coordinate>& polyline, string &output) { vector deltaNumbers(2*polyline.size()); output += "\""; @@ -89,6 +104,24 @@ public: } output += "]"; } + + inline void printUnencodedString(vector & polyline, string & output) { + output += "["; + string tmp; + for(unsigned i = 0; i < polyline.size(); i++) { + convertInternalLatLonToString(polyline[i].location.lat, tmp); + output += "["; + output += tmp; + convertInternalLatLonToString(polyline[i].location.lon, tmp); + output += ", "; + output += tmp; + output += "]"; + if( i < polyline.size()-1 ) { + output += ","; + } + } + output += "]"; + } }; #endif /* POLYLINECOMPRESSOR_H_ */