pulling in changes to add up distances in doubles
This commit is contained in:
commit
c5ebef3499
@ -26,14 +26,14 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
struct SegmentInformation {
|
struct SegmentInformation {
|
||||||
_Coordinate location;
|
_Coordinate location;
|
||||||
NodeID nameID;
|
NodeID nameID;
|
||||||
unsigned length;
|
double length;
|
||||||
unsigned duration;
|
unsigned duration;
|
||||||
double bearing;
|
double bearing;
|
||||||
short turnInstruction;
|
short turnInstruction;
|
||||||
bool necessary;
|
bool necessary;
|
||||||
SegmentInformation(const _Coordinate & loc, const NodeID nam, const unsigned len, const unsigned dur, const short tInstr, const bool nec) :
|
SegmentInformation(const _Coordinate & loc, const NodeID nam, const double len, const unsigned dur, const short tInstr, const bool nec) :
|
||||||
location(loc), nameID(nam), length(len), duration(dur), bearing(0.), turnInstruction(tInstr), necessary(nec) {}
|
location(loc), nameID(nam), length(len), duration(dur), bearing(0.), turnInstruction(tInstr), necessary(nec) {}
|
||||||
SegmentInformation(const _Coordinate & loc, const NodeID nam, const unsigned len, const unsigned dur, const short tInstr) :
|
SegmentInformation(const _Coordinate & loc, const NodeID nam, const double len, const unsigned dur, const short tInstr) :
|
||||||
location(loc), nameID(nam), length(len), duration(dur), bearing(0.), turnInstruction(tInstr), necessary(tInstr != 0) {}
|
location(loc), nameID(nam), length(len), duration(dur), bearing(0.), turnInstruction(tInstr), necessary(tInstr != 0) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ void DescriptionFactory::Run(const SearchEngineT &sEngine, const unsigned zoomLe
|
|||||||
pathDescription[i].length = ApproximateDistance(pathDescription[i-1].location, pathDescription[i].location);
|
pathDescription[i].length = ApproximateDistance(pathDescription[i-1].location, pathDescription[i].location);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned lengthOfSegment = 0;
|
double lengthOfSegment = 0;
|
||||||
unsigned durationOfSegment = 0;
|
unsigned durationOfSegment = 0;
|
||||||
unsigned indexOfSegmentBegin = 0;
|
unsigned indexOfSegmentBegin = 0;
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ void DescriptionFactory::Run(const SearchEngineT &sEngine, const unsigned zoomLe
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DescriptionFactory::BuildRouteSummary(const unsigned distance, const unsigned time) {
|
void DescriptionFactory::BuildRouteSummary(const double distance, const unsigned time) {
|
||||||
summary.startName = startPhantom.nodeBasedEdgeNameID;
|
summary.startName = startPhantom.nodeBasedEdgeNameID;
|
||||||
summary.destName = targetPhantom.nodeBasedEdgeNameID;
|
summary.destName = targetPhantom.nodeBasedEdgeNameID;
|
||||||
summary.BuildDurationAndLengthStrings(distance, time);
|
summary.BuildDurationAndLengthStrings(distance, time);
|
||||||
|
@ -51,10 +51,10 @@ public:
|
|||||||
unsigned startName;
|
unsigned startName;
|
||||||
unsigned destName;
|
unsigned destName;
|
||||||
_RouteSummary() : lengthString("0"), durationString("0"), startName(0), destName(0) {}
|
_RouteSummary() : lengthString("0"), durationString("0"), startName(0), destName(0) {}
|
||||||
void BuildDurationAndLengthStrings(unsigned distance, unsigned time) {
|
void BuildDurationAndLengthStrings(double distance, unsigned time) {
|
||||||
//compute distance/duration for route summary
|
//compute distance/duration for route summary
|
||||||
std::ostringstream s;
|
std::ostringstream s;
|
||||||
s << distance; //10*(round(distance/10.));
|
s << round(distance);
|
||||||
lengthString = s.str();
|
lengthString = s.str();
|
||||||
int travelTime = time/10 + 1;
|
int travelTime = time/10 + 1;
|
||||||
s.str("");
|
s.str("");
|
||||||
@ -63,7 +63,7 @@ public:
|
|||||||
}
|
}
|
||||||
} summary;
|
} summary;
|
||||||
|
|
||||||
unsigned entireLength;
|
double entireLength;
|
||||||
|
|
||||||
//I know, declaring this public is considered bad. I'm lazy
|
//I know, declaring this public is considered bad. I'm lazy
|
||||||
std::vector <SegmentInformation> pathDescription;
|
std::vector <SegmentInformation> pathDescription;
|
||||||
@ -73,7 +73,7 @@ public:
|
|||||||
void AppendEncodedPolylineString(std::string &output);
|
void AppendEncodedPolylineString(std::string &output);
|
||||||
void AppendUnencodedPolylineString(std::string &output);
|
void AppendUnencodedPolylineString(std::string &output);
|
||||||
void AppendSegment(const _Coordinate & coordinate, const _PathData & data);
|
void AppendSegment(const _Coordinate & coordinate, const _PathData & data);
|
||||||
void BuildRouteSummary(const unsigned distance, const unsigned time);
|
void BuildRouteSummary(const double distance, const unsigned time);
|
||||||
void SetStartSegment(const PhantomNode & startPhantom);
|
void SetStartSegment(const PhantomNode & startPhantom);
|
||||||
void SetEndSegment(const PhantomNode & startPhantom);
|
void SetEndSegment(const PhantomNode & startPhantom);
|
||||||
void AppendEncodedPolylineString(std::string & output, bool isEncoded);
|
void AppendEncodedPolylineString(std::string & output, bool isEncoded);
|
||||||
|
Loading…
Reference in New Issue
Block a user