use double precision
This commit is contained in:
parent
967963e180
commit
486a8136fd
24 changed files with 186 additions and 177 deletions
|
|
@ -6,17 +6,19 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
#include "pfaedle/trgraph/EdgePL.h"
|
||||
#include "util/geo/Geo.h"
|
||||
|
||||
using pfaedle::trgraph::EdgePL;
|
||||
using pfaedle::trgraph::TransitEdgeLine;
|
||||
using util::geo::DLine;
|
||||
|
||||
std::map<util::geo::FLine*, size_t> EdgePL::_flines;
|
||||
std::map<DLine*, size_t> EdgePL::_flines;
|
||||
std::map<const TransitEdgeLine*, size_t> EdgePL::_tlines;
|
||||
|
||||
// _____________________________________________________________________________
|
||||
EdgePL::EdgePL()
|
||||
: _length(0), _oneWay(0), _hasRestr(false), _rev(false), _lvl(0) {
|
||||
_l = new util::geo::FLine();
|
||||
_l = new DLine();
|
||||
_flines[_l] = 1;
|
||||
}
|
||||
|
||||
|
|
@ -33,7 +35,7 @@ EdgePL::EdgePL(const EdgePL& pl, bool geoflat)
|
|||
if (geoflat) {
|
||||
_l = pl._l;
|
||||
} else {
|
||||
_l = new util::geo::FLine(*pl._l);
|
||||
_l = new DLine(*pl._l);
|
||||
}
|
||||
_flines[_l]++;
|
||||
|
||||
|
|
@ -99,13 +101,13 @@ const std::set<const TransitEdgeLine*>& EdgePL::getLines() const {
|
|||
}
|
||||
|
||||
// _____________________________________________________________________________
|
||||
void EdgePL::addPoint(const util::geo::FPoint& p) { _l->push_back(p); }
|
||||
void EdgePL::addPoint(const util::geo::DPoint& p) { _l->push_back(p); }
|
||||
|
||||
// _____________________________________________________________________________
|
||||
const util::geo::FLine* EdgePL::getGeom() const { return _l; }
|
||||
const DLine* EdgePL::getGeom() const { return _l; }
|
||||
|
||||
// _____________________________________________________________________________
|
||||
util::geo::FLine* EdgePL::getGeom() { return _l; }
|
||||
DLine* EdgePL::getGeom() { return _l; }
|
||||
|
||||
// _____________________________________________________________________________
|
||||
util::json::Dict EdgePL::getAttrs() const {
|
||||
|
|
@ -160,7 +162,7 @@ void EdgePL::setRev() { _rev = true; }
|
|||
bool EdgePL::isRev() const { return _rev; }
|
||||
|
||||
// _____________________________________________________________________________
|
||||
const util::geo::FPoint& EdgePL::backHop() const {
|
||||
const util::geo::DPoint& EdgePL::backHop() const {
|
||||
if (isRev()) {
|
||||
return *(++(getGeom()->cbegin()));
|
||||
}
|
||||
|
|
@ -168,7 +170,7 @@ const util::geo::FPoint& EdgePL::backHop() const {
|
|||
}
|
||||
|
||||
// _____________________________________________________________________________
|
||||
const util::geo::FPoint& EdgePL::frontHop() const {
|
||||
const util::geo::DPoint& EdgePL::frontHop() const {
|
||||
if (isRev()) {
|
||||
return *(++(getGeom()->crbegin()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,11 +13,12 @@
|
|||
#include "util/geo/GeoGraph.h"
|
||||
|
||||
using util::geograph::GeoEdgePL;
|
||||
using util::geo::DLine;
|
||||
using util::geo::DPoint;
|
||||
|
||||
namespace pfaedle {
|
||||
namespace trgraph {
|
||||
|
||||
|
||||
/*
|
||||
* A line occuring on an edge
|
||||
*/
|
||||
|
|
@ -42,7 +43,7 @@ inline bool operator<(const TransitEdgeLine& a, const TransitEdgeLine& b) {
|
|||
/*
|
||||
* An edge payload class for the transit graph.
|
||||
*/
|
||||
class EdgePL : public GeoEdgePL<float> {
|
||||
class EdgePL : public GeoEdgePL<double> {
|
||||
public:
|
||||
EdgePL();
|
||||
~EdgePL();
|
||||
|
|
@ -50,11 +51,11 @@ class EdgePL : public GeoEdgePL<float> {
|
|||
EdgePL(const EdgePL& pl, bool geoFlat);
|
||||
|
||||
// Return the geometry of this edge.
|
||||
const util::geo::FLine* getGeom() const;
|
||||
util::geo::FLine* getGeom();
|
||||
const DLine* getGeom() const;
|
||||
DLine* getGeom();
|
||||
|
||||
// Extends this edge payload's geometry by Point p
|
||||
void addPoint(const util::geo::FPoint& p);
|
||||
void addPoint(const DPoint& p);
|
||||
|
||||
// Fill obj with k/v pairs describing the parameters of this payload.
|
||||
util::json::Dict getAttrs() const;
|
||||
|
|
@ -102,11 +103,11 @@ class EdgePL : public GeoEdgePL<float> {
|
|||
|
||||
// Returns the last hop of the payload - this is the (n-2)th point in
|
||||
// the payload geometry of length n > 1
|
||||
const util::geo::FPoint& backHop() const;
|
||||
const DPoint& backHop() const;
|
||||
|
||||
// Returns the first hop of the payload - this is the 2nd point in
|
||||
// the payload geometry of length n > 1
|
||||
const util::geo::FPoint& frontHop() const;
|
||||
const DPoint& frontHop() const;
|
||||
|
||||
// Obtain an exact copy of this edge, but in reverse.
|
||||
EdgePL revCopy() const;
|
||||
|
|
@ -118,13 +119,13 @@ class EdgePL : public GeoEdgePL<float> {
|
|||
bool _rev : 1;
|
||||
uint8_t _lvl : 3;
|
||||
|
||||
util::geo::FLine* _l;
|
||||
DLine* _l;
|
||||
|
||||
std::set<const TransitEdgeLine*> _lines;
|
||||
|
||||
static void unRefTLine(const TransitEdgeLine* l);
|
||||
|
||||
static std::map<util::geo::FLine*, size_t> _flines;
|
||||
static std::map<DLine*, size_t> _flines;
|
||||
static std::map<const TransitEdgeLine*, size_t> _tlines;
|
||||
};
|
||||
} // namespace trgraph
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@
|
|||
using util::geo::Grid;
|
||||
using util::geo::Point;
|
||||
using util::geo::Line;
|
||||
using util::geo::FPoint;
|
||||
using util::geo::FLine;
|
||||
|
||||
namespace pfaedle {
|
||||
namespace trgraph {
|
||||
|
|
@ -26,8 +24,8 @@ namespace trgraph {
|
|||
typedef util::graph::Edge<NodePL, EdgePL> Edge;
|
||||
typedef util::graph::Node<NodePL, EdgePL> Node;
|
||||
typedef util::graph::DirGraph<NodePL, EdgePL> Graph;
|
||||
typedef Grid<Node*, Point, float> NodeGrid;
|
||||
typedef Grid<Edge*, Line, float> EdgeGrid;
|
||||
typedef Grid<Node*, Point, double> NodeGrid;
|
||||
typedef Grid<Edge*, Line, double> EdgeGrid;
|
||||
|
||||
} // namespace trgraph
|
||||
} // namespace pfaedle
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ NodePL::NodePL(const NodePL& pl)
|
|||
}
|
||||
|
||||
// _____________________________________________________________________________
|
||||
NodePL::NodePL(const util::geo::FPoint& geom)
|
||||
NodePL::NodePL(const DPoint& geom)
|
||||
: _geom(geom),
|
||||
_si(0),
|
||||
_component(0)
|
||||
|
|
@ -58,7 +58,7 @@ NodePL::NodePL(const util::geo::FPoint& geom)
|
|||
}
|
||||
|
||||
// _____________________________________________________________________________
|
||||
NodePL::NodePL(const util::geo::FPoint& geom, const StatInfo& si)
|
||||
NodePL::NodePL(const DPoint& geom, const StatInfo& si)
|
||||
: _geom(geom),
|
||||
_si(0),
|
||||
_component(0)
|
||||
|
|
@ -108,10 +108,10 @@ void NodePL::setComp(const Component* c) {
|
|||
}
|
||||
|
||||
// _____________________________________________________________________________
|
||||
const util::geo::FPoint* NodePL::getGeom() const { return &_geom; }
|
||||
const DPoint* NodePL::getGeom() const { return &_geom; }
|
||||
|
||||
// _____________________________________________________________________________
|
||||
void NodePL::setGeom(const util::geo::FPoint& geom) { _geom = geom; }
|
||||
void NodePL::setGeom(const DPoint& geom) { _geom = geom; }
|
||||
|
||||
// _____________________________________________________________________________
|
||||
util::json::Dict NodePL::getAttrs() const {
|
||||
|
|
|
|||
|
|
@ -11,8 +11,10 @@
|
|||
#include "ad/cppgtfs/gtfs/Feed.h"
|
||||
#include "pfaedle/trgraph/StatInfo.h"
|
||||
#include "util/geo/GeoGraph.h"
|
||||
#include "util/geo/Geo.h"
|
||||
|
||||
using util::geograph::GeoNodePL;
|
||||
using util::geo::DPoint;
|
||||
|
||||
namespace pfaedle {
|
||||
namespace trgraph {
|
||||
|
|
@ -24,17 +26,17 @@ struct Component {
|
|||
/*
|
||||
* A node payload class for the transit graph.
|
||||
*/
|
||||
class NodePL : public GeoNodePL<float> {
|
||||
class NodePL : public GeoNodePL<double> {
|
||||
public:
|
||||
NodePL();
|
||||
NodePL(const NodePL& pl); // NOLINT
|
||||
NodePL(const util::geo::FPoint& geom); // NOLINT
|
||||
NodePL(const util::geo::FPoint& geom, const StatInfo& si);
|
||||
NodePL(const DPoint& geom); // NOLINT
|
||||
NodePL(const DPoint& geom, const StatInfo& si);
|
||||
~NodePL();
|
||||
|
||||
// Return the geometry of this node.
|
||||
const util::geo::FPoint* getGeom() const;
|
||||
void setGeom(const util::geo::FPoint& geom);
|
||||
const DPoint* getGeom() const;
|
||||
void setGeom(const DPoint& geom);
|
||||
|
||||
// Fill obj with k/v pairs describing the parameters of this payload.
|
||||
util::json::Dict getAttrs() const;
|
||||
|
|
@ -66,8 +68,7 @@ class NodePL : public GeoNodePL<float> {
|
|||
void setVisited() const;
|
||||
|
||||
private:
|
||||
// 32bit floats are enough here
|
||||
util::geo::FPoint _geom;
|
||||
DPoint _geom;
|
||||
StatInfo* _si;
|
||||
const Component* _component;
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ double StatGroup::getPen(const Stop* s, trgraph::Node* n,
|
|||
const trgraph::Normalizer& platformNorm,
|
||||
double trackPen, double distPenFac,
|
||||
double nonOsmPen) const {
|
||||
FPoint p = util::geo::latLngToWebMerc<float>(s->getLat(), s->getLng());
|
||||
DPoint p = util::geo::latLngToWebMerc<double>(s->getLat(), s->getLng());
|
||||
|
||||
double distPen = util::geo::webMercMeterDist(p, *n->pl().getGeom());
|
||||
distPen *= distPenFac;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue