Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: change edgeIDAndData to edge and replace location defin… #307

Merged
merged 3 commits into from
Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG-FORK.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ 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 staiongraph to isolate algorithm, data structure and topological [#302]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you please append the link so that the #302 can be clickable? Meanwhile, this entry is only for the last PR, could you please also add one for this PR? Or maybe append also this PR's ID, i.e. one entry for both PR since this PR is the only supplement for the former one.
Furthermore, staiongraph -> stationgraph?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy that :)

- Bugfix:
- CHANGED `osrm-ranking` parsing of OSRM route response to compatible with `string` array `annotation/nodes` [#296](https://github.com/Telenav/osrm-backend/pull/296)
- Performance:
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
6 changes: 3 additions & 3 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 {
type edge struct {
edgeId edgeID
edgeData *edge
edgeData *edgeMetric

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

edgeMetric *edgeMetric, or just simply *edgeMetric

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy that

}
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