class DummyDatabase(MapDatabase): _Nodes = (Node(id='flrp1', distance=0, coords=Coords(186664.62018550665, lat=5197088.916676804)), Node(id='llrp1', distance=0, coords=Coords(186641.00575546117, lat=5197077.25019193)), Node(id='flrp2', distance=0, coords=Coords(256366.05465574207, lat=4327314.792105144)), Node(id='llrp2', distance=0, coords=Coords(256106.2959252422, lat=4327202.566624085)), ) _Lines = (Line(id='Line1', bear=21, frc=3, fow=3, projected_len=None, len=0, start='flrp1', end='llrp1', bearin=4, bearout=21), Line(id='Line2', bear=5, frc=3, fow=3, projected_len=None, len=0, start='llrp1', end='flrp1', bearin=21, bearout=4), Line(id='Line3', bear=5, frc=3, fow=3, projected_len=None, len=0, start='llrp1', end='flrp1', bearin=4, bearout=21), ) def connected_lines(self, node, frc_max, beardir): if beardir == AGAINST_LINE_DIRECTION: # Search for inwards arcs lines = (l for l in self._Lines if l.end == node.id and frc_max >= l.frc) else: lines = (l for l in self._Lines if l.start == node.id and frc_max >= l.frc) for l in lines: if beardir == AGAINST_LINE_DIRECTION: # we need to replace bearing yield l._replace(bear=l.bearin) else: yield l._replace(bear=l.bearout) def find_closeby_nodes(self, coords, max_node_dist): coords = gall_proj(*coords) for n in self._Nodes: dist = distance(coords, n.coords) if dist <= max_node_dist: yield n._replace(distance=dist) def find_closeby_lines(self, coords, max_node_dist, frc_max, beardir): return () def calculate_route(self, l1, l2, maxdist, lfrc, islastrp): pass
''' LineLocation( version=3, type=LocationType.POINT_ALONG_LINE, flrp=LocationReferencePoint( Coords(lon=2.371405363071578 , lat=51.03174090361103), bear=21, orient=0, frc=3, fow=3, lfrcnp=3, dnp=29.0) ), llrp=LocationReferencePoint( Coords(lon=2.3711053630715777, lat=51.03164090361103), bear=5 , orient=0, frc=3, fow=3, lfrcnp=None, dnp=None), points=[], poffs=0, noffs=0) PointAlongLineLocation(version=3, type=LocationType.POINT_ALONG_LINE, flrp=LocationReferencePoint( Coords(lon=-2.0216238498591346, lat=48.61843943572703), bear=6, orient=0, frc=2, fow=2, lfrcnp=2, dnp=1436.0), llrp=LocationReferencePoint( Coords(lon=-2.0084338498591348, lat=48.61675943572703), bear=19, orient=0, frc=2, fow=2, lfrcnp=None, dnp=None), poffs=13.8671875) ''' LOCATIONS = ( ( 'CwGvtCRKDBt1AP/i//YbBQ==', LineLocation(version=3, type=LocationType.LINE_LOCATION, flrp=LocationReferencePoint(coords=Coords(lon=2.371405363071578, lat=51.03174090361103), bear=21, orient=0, frc=3, fow=3, lfrcnp=3, dnp=29.), llrp=LocationReferencePoint(coords=Coords(lon=2.3711053630715777, lat=51.03164090361103), bear=5, orient=0, frc=3, fow=3, lfrcnp=None, dnp=None), points=[], poffs=0, noffs=0)), ( 'CwJQ5x7TcyKVBf62/5oiBw==', LineLocation(version=3, type=LocationType.LINE_LOCATION, flrp=LocationReferencePoint(coords=Coords(lon=3.2568991184079317, lat=43.34901452043844), bear=21, orient=0, frc=4, fow=2, lfrcnp=4, dnp=322.0), llrp=LocationReferencePoint(coords=Coords(lon=3.253599118407932, lat=43.34799452043844), bear=7, orient=0, frc=4, fow=2, lfrcnp=None, dnp=None), points=[], poffs=0, noffs=0)), ( 'CwFEhiML1xNPAwA6/zoTHg==', LineLocation(version=3, type=LocationType.LINE_LOCATION, flrp=LocationReferencePoint(coords=Coords(lon=1.782649755469405, lat=49.28377747512205), bear=15, orient=0, frc=2, fow=3, lfrcnp=2, dnp=205.0), llrp=LocationReferencePoint(coords=Coords(lon=1.783229755469405, lat=49.28179747512205), bear=30, orient=0, frc=2, fow=3, lfrcnp=None, dnp=None), points=[], poffs=0, noffs=0)), ( 'C/+jYSG75BRWB/3E/4sSBg==', LineLocation(version=3, type=LocationType.LINE_LOCATION, flrp=LocationReferencePoint(coords=Coords(lon=-0.5087721347784577, lat=47.4383532998684), bear=22, orient=0, frc=2, fow=4, lfrcnp=2, dnp=440.0), llrp=LocationReferencePoint(coords=Coords(lon=-0.5144921347784577, lat=47.4371832998684), bear=6, orient=0, frc=2, fow=2, lfrcnp=None, dnp=None), points=[], poffs=0, noffs=0)), ( 'CwOyQCDbSxJPBwAA/osSXxM=', LineLocation(version=3, type=LocationType.LINE_LOCATION, flrp=LocationReferencePoint(coords=Coords(lon=5.19789576527978, lat=46.20460152604006), bear=15, orient=0, frc=2, fow=2, lfrcnp=2, dnp=440.0), llrp=LocationReferencePoint(coords=Coords(lon=5.19789576527978, lat=46.20087152604006), bear=31, orient=0, frc=2, fow=2, lfrcnp=None, dnp=None), points=[], poffs=7.6171875, noffs=0)), ( 'CwB67CGukRxiCACyAbwaMXU=', LineLocation(version=3, type=LocationType.LINE_LOCATION, flrp=LocationReferencePoint(coords=Coords(lon=0.675219297405838, lat=47.36516118027036), bear=2, orient=0, frc=3, fow=4, lfrcnp=3, dnp=498.0), llrp=LocationReferencePoint(coords=Coords(lon=0.676999297405838, lat=47.369601180270365), bear=17, orient=0, frc=3, fow=2, lfrcnp=None, dnp=None), points=[], poffs=0, noffs=45.8984375)), ( 'CwSwrSIvJAo8+NUXIEMKPx3/uwXUCj7g218kAwo9Cv6RAfAKPQD/6wAdCj3B4usdywo9Lvf8B9gKPRL7XQI4CjoJ/UQAhgo4bvAuEN0KP48D3hvZCj4L/tACVgo+lOtlGdkKDQ==', LineLocation(version=3, type=LocationType.LINE_LOCATION, flrp=LocationReferencePoint(coords=Coords(lon=6.595498323409102, lat=48.07144045806851), bear=28, orient=0, frc=1, fow=2, lfrcnp=1, dnp=14562.0), llrp=LocationReferencePoint(coords=Coords(lon=6.187078323409104, lat=48.55637045806851), bear=13, orient=0, frc=1, fow=2, lfrcnp=None, dnp=None), points=[ LocationReferencePoint(coords=Coords(lon=6.4856483234091025, lat=48.15403045806851), bear=31, orient=0, frc=1, fow=2, lfrcnp=1, dnp=1729.0), LocationReferencePoint(coords=Coords(lon=6.484958323409103, lat=48.16895045806851), bear=30, orient=0, frc=1, fow=2, lfrcnp=1, dnp=13156.0), LocationReferencePoint(coords=Coords(lon=6.391188323409103, lat=48.26114045806851), bear=29, orient=0, frc=1, fow=2, lfrcnp=1, dnp=615.0), LocationReferencePoint(coords=Coords(lon=6.387518323409103, lat=48.26610045806851), bear=29, orient=0, frc=1, fow=2, lfrcnp=1, dnp=29.0), LocationReferencePoint(coords=Coords(lon=6.387308323409103, lat=48.26639045806851), bear=29, orient=0, frc=1, fow=2, lfrcnp=1, dnp=11339.0),
def find_closeby_nodes(self, coords, max_node_dist): coords = gall_proj(*coords) for n in self._Nodes: dist = distance(coords, n.coords) if dist <= max_node_dist: yield n._replace(distance=dist) def find_closeby_lines(self, coords, max_node_dist, frc_max, beardir): return () def calculate_route(self, l1, l2, maxdist, lfrc, islastrp): pass LRP1 = LocationReferencePoint(coords=Coords(lon=2.371405363071578, lat=51.03174090361103), bear=21, orient=0, frc=3, fow=3, lfrcnp=3, dnp=29.) LRP2 = LocationReferencePoint(coords=Coords(lon=2.3711053630715777, lat=51.03164090361103), bear=5, orient=0, frc=3, fow=3, lfrcnp=None, dnp=None)
llrp=LocationReferencePoint( Coords(lon=2.3711053630715777, lat=51.03164090361103), bear=5 , orient=0, frc=3, fow=3, lfrcnp=None, dnp=None), points=[], poffs=0, noffs=0) PointAlongLineLocation(version=3, type=LocationType.POINT_ALONG_LINE, flrp=LocationReferencePoint( Coords(lon=-2.0216238498591346, lat=48.61843943572703), bear=6, orient=0, frc=2, fow=2, lfrcnp=2, dnp=1436.0), llrp=LocationReferencePoint( Coords(lon=-2.0084338498591348, lat=48.61675943572703), bear=19, orient=0, frc=2, fow=2, lfrcnp=None, dnp=None), poffs=13.8671875) ''' LOCATIONS = ( (b'CwGvtCRKDBt1AP/i//YbBQ==', LineLocation( version=3, type=LocationType.LINE_LOCATION, flrp=LocationReferencePoint(coords=Coords(lon=2.371405363071578, lat=51.03174090361103), bear=21, orient=0, frc=3, fow=3, lfrcnp=3, dnp=29.), llrp=LocationReferencePoint(coords=Coords(lon=2.3711053630715777, lat=51.03164090361103), bear=5, orient=0, frc=3, fow=3, lfrcnp=None, dnp=None), points=[],