make geometry precision configurable for build
This commit is contained in:
parent
486a8136fd
commit
8446db5c4b
25 changed files with 222 additions and 208 deletions
|
|
@ -10,15 +10,15 @@
|
|||
|
||||
using pfaedle::trgraph::EdgePL;
|
||||
using pfaedle::trgraph::TransitEdgeLine;
|
||||
using util::geo::DLine;
|
||||
|
||||
std::map<DLine*, size_t> EdgePL::_flines;
|
||||
|
||||
std::map<LINE*, 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 DLine();
|
||||
_l = new LINE();
|
||||
_flines[_l] = 1;
|
||||
}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ EdgePL::EdgePL(const EdgePL& pl, bool geoflat)
|
|||
if (geoflat) {
|
||||
_l = pl._l;
|
||||
} else {
|
||||
_l = new DLine(*pl._l);
|
||||
_l = new LINE(*pl._l);
|
||||
}
|
||||
_flines[_l]++;
|
||||
|
||||
|
|
@ -101,13 +101,13 @@ const std::set<const TransitEdgeLine*>& EdgePL::getLines() const {
|
|||
}
|
||||
|
||||
// _____________________________________________________________________________
|
||||
void EdgePL::addPoint(const util::geo::DPoint& p) { _l->push_back(p); }
|
||||
void EdgePL::addPoint(const POINT& p) { _l->push_back(p); }
|
||||
|
||||
// _____________________________________________________________________________
|
||||
const DLine* EdgePL::getGeom() const { return _l; }
|
||||
const LINE* EdgePL::getGeom() const { return _l; }
|
||||
|
||||
// _____________________________________________________________________________
|
||||
DLine* EdgePL::getGeom() { return _l; }
|
||||
LINE* EdgePL::getGeom() { return _l; }
|
||||
|
||||
// _____________________________________________________________________________
|
||||
util::json::Dict EdgePL::getAttrs() const {
|
||||
|
|
@ -162,7 +162,7 @@ void EdgePL::setRev() { _rev = true; }
|
|||
bool EdgePL::isRev() const { return _rev; }
|
||||
|
||||
// _____________________________________________________________________________
|
||||
const util::geo::DPoint& EdgePL::backHop() const {
|
||||
const POINT& EdgePL::backHop() const {
|
||||
if (isRev()) {
|
||||
return *(++(getGeom()->cbegin()));
|
||||
}
|
||||
|
|
@ -170,7 +170,7 @@ const util::geo::DPoint& EdgePL::backHop() const {
|
|||
}
|
||||
|
||||
// _____________________________________________________________________________
|
||||
const util::geo::DPoint& EdgePL::frontHop() const {
|
||||
const POINT& EdgePL::frontHop() const {
|
||||
if (isRev()) {
|
||||
return *(++(getGeom()->crbegin()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,12 +9,14 @@
|
|||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "pfaedle/Def.h"
|
||||
#include "pfaedle/router/Comp.h"
|
||||
#include "util/geo/Geo.h"
|
||||
#include "util/geo/GeoGraph.h"
|
||||
|
||||
using util::geograph::GeoEdgePL;
|
||||
using util::geo::DLine;
|
||||
using util::geo::DPoint;
|
||||
|
||||
|
||||
|
||||
namespace pfaedle {
|
||||
namespace trgraph {
|
||||
|
|
@ -43,7 +45,7 @@ inline bool operator<(const TransitEdgeLine& a, const TransitEdgeLine& b) {
|
|||
/*
|
||||
* An edge payload class for the transit graph.
|
||||
*/
|
||||
class EdgePL : public GeoEdgePL<double> {
|
||||
class EdgePL : public GeoEdgePL<PFAEDLE_PRECISION> {
|
||||
public:
|
||||
EdgePL();
|
||||
~EdgePL();
|
||||
|
|
@ -51,11 +53,11 @@ class EdgePL : public GeoEdgePL<double> {
|
|||
EdgePL(const EdgePL& pl, bool geoFlat);
|
||||
|
||||
// Return the geometry of this edge.
|
||||
const DLine* getGeom() const;
|
||||
DLine* getGeom();
|
||||
const LINE* getGeom() const;
|
||||
LINE* getGeom();
|
||||
|
||||
// Extends this edge payload's geometry by Point p
|
||||
void addPoint(const DPoint& p);
|
||||
void addPoint(const POINT& p);
|
||||
|
||||
// Fill obj with k/v pairs describing the parameters of this payload.
|
||||
util::json::Dict getAttrs() const;
|
||||
|
|
@ -103,11 +105,11 @@ class EdgePL : public GeoEdgePL<double> {
|
|||
|
||||
// Returns the last hop of the payload - this is the (n-2)th point in
|
||||
// the payload geometry of length n > 1
|
||||
const DPoint& backHop() const;
|
||||
const POINT& backHop() const;
|
||||
|
||||
// Returns the first hop of the payload - this is the 2nd point in
|
||||
// the payload geometry of length n > 1
|
||||
const DPoint& frontHop() const;
|
||||
const POINT& frontHop() const;
|
||||
|
||||
// Obtain an exact copy of this edge, but in reverse.
|
||||
EdgePL revCopy() const;
|
||||
|
|
@ -119,13 +121,13 @@ class EdgePL : public GeoEdgePL<double> {
|
|||
bool _rev : 1;
|
||||
uint8_t _lvl : 3;
|
||||
|
||||
DLine* _l;
|
||||
LINE* _l;
|
||||
|
||||
std::set<const TransitEdgeLine*> _lines;
|
||||
|
||||
static void unRefTLine(const TransitEdgeLine* l);
|
||||
|
||||
static std::map<DLine*, size_t> _flines;
|
||||
static std::map<LINE*, size_t> _flines;
|
||||
static std::map<const TransitEdgeLine*, size_t> _tlines;
|
||||
};
|
||||
} // namespace trgraph
|
||||
|
|
|
|||
|
|
@ -24,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, double> NodeGrid;
|
||||
typedef Grid<Edge*, Line, double> EdgeGrid;
|
||||
typedef Grid<Node*, Point, PFAEDLE_PRECISION> NodeGrid;
|
||||
typedef Grid<Edge*, Line, PFAEDLE_PRECISION> EdgeGrid;
|
||||
|
||||
} // namespace trgraph
|
||||
} // namespace pfaedle
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ NodePL::NodePL(const NodePL& pl)
|
|||
}
|
||||
|
||||
// _____________________________________________________________________________
|
||||
NodePL::NodePL(const DPoint& geom)
|
||||
NodePL::NodePL(const POINT& geom)
|
||||
: _geom(geom),
|
||||
_si(0),
|
||||
_component(0)
|
||||
|
|
@ -58,7 +58,7 @@ NodePL::NodePL(const DPoint& geom)
|
|||
}
|
||||
|
||||
// _____________________________________________________________________________
|
||||
NodePL::NodePL(const DPoint& geom, const StatInfo& si)
|
||||
NodePL::NodePL(const POINT& geom, const StatInfo& si)
|
||||
: _geom(geom),
|
||||
_si(0),
|
||||
_component(0)
|
||||
|
|
@ -108,10 +108,10 @@ void NodePL::setComp(const Component* c) {
|
|||
}
|
||||
|
||||
// _____________________________________________________________________________
|
||||
const DPoint* NodePL::getGeom() const { return &_geom; }
|
||||
const POINT* NodePL::getGeom() const { return &_geom; }
|
||||
|
||||
// _____________________________________________________________________________
|
||||
void NodePL::setGeom(const DPoint& geom) { _geom = geom; }
|
||||
void NodePL::setGeom(const POINT& geom) { _geom = geom; }
|
||||
|
||||
// _____________________________________________________________________________
|
||||
util::json::Dict NodePL::getAttrs() const {
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@
|
|||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include "ad/cppgtfs/gtfs/Feed.h"
|
||||
#include "pfaedle/Def.h"
|
||||
#include "pfaedle/trgraph/StatInfo.h"
|
||||
#include "util/geo/GeoGraph.h"
|
||||
#include "util/geo/Geo.h"
|
||||
#include "util/geo/GeoGraph.h"
|
||||
|
||||
using util::geograph::GeoNodePL;
|
||||
using util::geo::DPoint;
|
||||
|
||||
namespace pfaedle {
|
||||
namespace trgraph {
|
||||
|
|
@ -26,17 +26,17 @@ struct Component {
|
|||
/*
|
||||
* A node payload class for the transit graph.
|
||||
*/
|
||||
class NodePL : public GeoNodePL<double> {
|
||||
class NodePL : public GeoNodePL<PFAEDLE_PRECISION> {
|
||||
public:
|
||||
NodePL();
|
||||
NodePL(const NodePL& pl); // NOLINT
|
||||
NodePL(const DPoint& geom); // NOLINT
|
||||
NodePL(const DPoint& geom, const StatInfo& si);
|
||||
NodePL(const NodePL& pl); // NOLINT
|
||||
NodePL(const POINT& geom); // NOLINT
|
||||
NodePL(const POINT& geom, const StatInfo& si);
|
||||
~NodePL();
|
||||
|
||||
// Return the geometry of this node.
|
||||
const DPoint* getGeom() const;
|
||||
void setGeom(const DPoint& geom);
|
||||
const POINT* getGeom() const;
|
||||
void setGeom(const POINT& geom);
|
||||
|
||||
// Fill obj with k/v pairs describing the parameters of this payload.
|
||||
util::json::Dict getAttrs() const;
|
||||
|
|
@ -68,7 +68,7 @@ class NodePL : public GeoNodePL<double> {
|
|||
void setVisited() const;
|
||||
|
||||
private:
|
||||
DPoint _geom;
|
||||
POINT _geom;
|
||||
StatInfo* _si;
|
||||
const Component* _component;
|
||||
|
||||
|
|
|
|||
|
|
@ -43,9 +43,7 @@ const NodeCandGroup& StatGroup::getNodeCands(const Stop* s) const {
|
|||
}
|
||||
|
||||
// _____________________________________________________________________________
|
||||
const std::set<Node*>& StatGroup::getNodes() const {
|
||||
return _nodes;
|
||||
}
|
||||
const std::set<Node*>& StatGroup::getNodes() const { return _nodes; }
|
||||
|
||||
// _____________________________________________________________________________
|
||||
void StatGroup::remNode(trgraph::Node* n) {
|
||||
|
|
@ -61,10 +59,11 @@ const std::set<const Stop*>& StatGroup::getStops() const { return _stops; }
|
|||
|
||||
// _____________________________________________________________________________
|
||||
double StatGroup::getPen(const Stop* s, trgraph::Node* n,
|
||||
const trgraph::Normalizer& platformNorm,
|
||||
double trackPen, double distPenFac,
|
||||
double nonOsmPen) const {
|
||||
DPoint p = util::geo::latLngToWebMerc<double>(s->getLat(), s->getLng());
|
||||
const trgraph::Normalizer& platformNorm,
|
||||
double trackPen, double distPenFac,
|
||||
double nonOsmPen) const {
|
||||
POINT p =
|
||||
util::geo::latLngToWebMerc<PFAEDLE_PRECISION>(s->getLat(), s->getLng());
|
||||
|
||||
double distPen = util::geo::webMercMeterDist(p, *n->pl().getGeom());
|
||||
distPen *= distPenFac;
|
||||
|
|
@ -83,8 +82,8 @@ double StatGroup::getPen(const Stop* s, trgraph::Node* n,
|
|||
|
||||
// _____________________________________________________________________________
|
||||
void StatGroup::writePens(const trgraph::Normalizer& platformNorm,
|
||||
double trackPen, double distPenFac,
|
||||
double nonOsmPen) {
|
||||
double trackPen, double distPenFac,
|
||||
double nonOsmPen) {
|
||||
if (_stopNodePens.size()) return; // already written
|
||||
for (auto* s : _stops) {
|
||||
for (auto* n : _nodes) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue