Skip to content

Commit

Permalink
refactor: change edgeIDAndData to edge and replace location defin… (
Browse files Browse the repository at this point in the history
#307)

* refactor: change `edgeIDAndData` to `edge` and replace location definition with nav.Location
issue: #282
  • Loading branch information
CodeBear801 authored Apr 29, 2020
1 parent b24b537 commit 6faeacc
Show file tree
Hide file tree
Showing 12 changed files with 457 additions and 438 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG-FORK.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Changes from v10.2.0
- Feature:
- ADDED **HTTP API** `annotation/ways` in OSRM route response after `osrm-ranking` process(retrieve `annotation/ways` from `annotation/nodes`) [#296](https://github.com/Telenav/osrm-backend/pull/296)
- CHANGED for internal refactoring, moved `unidbpatch` and `mapsource` packages into `integration/util` folder [#300](https://github.com/Telenav/osrm-backend/pull/300)
- CHANGED for internal refactoring, refactor stationgraph to isolate algorithm, data structure and topological [#302](https://github.com/Telenav/osrm-backend/pull/302)
- CHANGED for internal refactoring, change `edgeIDAndData` to `edge` and replace internal location definition with nav.Location [#307](https://github.com/Telenav/osrm-backend/pull/307)
- CHANGED live traffic cache from edge indexed to way indexed in `osrm-ranking` [#303](https://github.com/Telenav/osrm-backend/pull/303)
- REMOVED edge indexed live traffic cache in `osrm-ranking` [#308](https://github.com/Telenav/osrm-backend/pull/308)
- Bugfix:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func FindOverlapBetweenStations(iterF stationfindertype.NearbyStationsIterator,

// CalcWeightBetweenChargeStationsPair accepts two iterators and calculates weights between each pair of iterators
func CalcWeightBetweenChargeStationsPair(from stationfindertype.NearbyStationsIterator, to stationfindertype.NearbyStationsIterator, table osrmconnector.TableRequster) ([]stationfindertype.NeighborInfo, error) {
// collect (lat,lon)&ID for current location's nearby charge stations
// collect (Lat,Lon)&ID for current location's nearby charge stations
var startPoints coordinate.Coordinates
var startIDs []string
for v := range from.IterateNearbyStations() {
Expand All @@ -48,7 +48,7 @@ func CalcWeightBetweenChargeStationsPair(from stationfindertype.NearbyStationsIt
return nil, err
}

// collect (lat,lon)&ID for target location's nearby charge stations
// collect (Lat,Lon)&ID for target location's nearby charge stations
var targetPoints coordinate.Coordinates
var targetIDs []string
for v := range to.IterateNearbyStations() {
Expand Down
8 changes: 4 additions & 4 deletions integration/service/oasis/stationgraph/edge.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ type edgeID struct {
toNodeID nodeID
}

type edge struct {
type edgeMetric struct {
distance float64
duration float64
}

type edgeIDAndData struct {
edgeId edgeID
edgeData *edge
type edge struct {
edgeId edgeID
edgeMetric *edgeMetric
}
13 changes: 8 additions & 5 deletions integration/service/oasis/stationgraph/graph_interface.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package stationgraph

import "github.com/Telenav/osrm-backend/integration/service/oasis/chargingstrategy"
import (
"github.com/Telenav/osrm-backend/integration/pkg/api/nav"
"github.com/Telenav/osrm-backend/integration/service/oasis/chargingstrategy"
)

// Graph defines interface used for Graph
type Graph interface {

// Node returns node object by its nodeID
Node(id nodeID) *node

Expand All @@ -13,13 +16,13 @@ type Graph interface {
AdjacentNodes(id nodeID) []nodeID

// Edge returns edge information between given two nodes
Edge(from, to nodeID) *edge
Edge(from, to nodeID) *edgeMetric

// SetStart generates start node for the graph
SetStart(stationID string, targetState chargingstrategy.State, location locationInfo) Graph
SetStart(stationID string, targetState chargingstrategy.State, location nav.Location) Graph

// SetEnd generates end node for the graph
SetEnd(stationID string, targetState chargingstrategy.State, location locationInfo) Graph
SetEnd(stationID string, targetState chargingstrategy.State, location nav.Location) Graph

// StartNodeID returns start node's ID for given graph
StartNodeID() nodeID
Expand Down
Loading

0 comments on commit 6faeacc

Please sign in to comment.