Skip to content

Commit

Permalink
refactor: move solution, osrmhelper and searchhelper into oasis/internal
Browse files Browse the repository at this point in the history
issue: #342
  • Loading branch information
CodeBear801 committed May 14, 2020
1 parent e783394 commit c3a04f8
Show file tree
Hide file tree
Showing 15 changed files with 11 additions and 55 deletions.
2 changes: 1 addition & 1 deletion integration/service/oasis/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net/http"

"github.com/Telenav/osrm-backend/integration/api/oasis"
"github.com/Telenav/osrm-backend/integration/service/oasis/osrmhelper"
"github.com/Telenav/osrm-backend/integration/service/oasis/internal/osrmhelper"
"github.com/Telenav/osrm-backend/integration/service/oasis/selectionstrategy"
"github.com/golang/glog"
)
Expand Down
29 changes: 0 additions & 29 deletions integration/service/oasis/haversine/distance.go

This file was deleted.

16 changes: 0 additions & 16 deletions integration/service/oasis/haversine/distance_test.go

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import (
"github.com/Telenav/osrm-backend/integration/api/oasis"
"github.com/Telenav/osrm-backend/integration/api/osrm/route"
"github.com/Telenav/osrm-backend/integration/service/oasis/chargingstrategy"
"github.com/Telenav/osrm-backend/integration/service/oasis/haversine"
"github.com/Telenav/osrm-backend/integration/service/oasis/osrmconnector"
"github.com/Telenav/osrm-backend/integration/service/oasis/spatialindexer/ranker"
"github.com/Telenav/osrm-backend/integration/service/oasis/stationconnquerier"
"github.com/Telenav/osrm-backend/integration/service/oasis/stationfinder"
"github.com/Telenav/osrm-backend/integration/service/oasis/stationfinder/stationfinderalg"
"github.com/Telenav/osrm-backend/integration/service/oasis/stationgraph"
"github.com/blevesearch/bleve/geo"
"github.com/golang/glog"

"github.com/twpayne/go-polyline"
Expand Down Expand Up @@ -119,7 +119,8 @@ func findChargeLocation4Route(route *route.Route, result []*nav.Location, currEn

tmp := 0.0
for i := 0; i < len(coords)-1; i++ {
tmp += haversine.GreatCircleDistance(coords[i][0], coords[i][1], coords[i+1][0], coords[i+1][1])
// geo.Haversin's unit is kilometer, convert to meter
tmp += geo.Haversin(coords[i][1], coords[i][0], coords[i+1][1], coords[i+1][0]) * 1000
if currEnergy-tmp < preferLevel {
currEnergy = maxRange
result = append(result, &nav.Location{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"github.com/Telenav/osrm-backend/integration/api/osrm"
"github.com/Telenav/osrm-backend/integration/api/osrm/table"
"github.com/Telenav/osrm-backend/integration/api/search/nearbychargestation"
"github.com/Telenav/osrm-backend/integration/service/oasis/internal/osrmhelper"
"github.com/Telenav/osrm-backend/integration/service/oasis/osrmconnector"
"github.com/Telenav/osrm-backend/integration/service/oasis/osrmhelper"
"github.com/Telenav/osrm-backend/integration/service/oasis/stationfinder/stationfinderalg"
"github.com/golang/glog"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package cloudfinder
import (
"github.com/Telenav/osrm-backend/integration/api/oasis"
"github.com/Telenav/osrm-backend/integration/api/search/searchcoordinate"
"github.com/Telenav/osrm-backend/integration/service/oasis/internal/searchhelper"
"github.com/Telenav/osrm-backend/integration/service/oasis/searchconnector"
"github.com/Telenav/osrm-backend/integration/service/oasis/searchhelper"
)

//@todo: This number need to be adjusted based on charge station profile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package cloudfinder
import (
"github.com/Telenav/osrm-backend/integration/api/nav"
"github.com/Telenav/osrm-backend/integration/api/search/searchcoordinate"
"github.com/Telenav/osrm-backend/integration/service/oasis/internal/searchhelper"
"github.com/Telenav/osrm-backend/integration/service/oasis/searchconnector"
"github.com/Telenav/osrm-backend/integration/service/oasis/searchhelper"
)

// LowEnergyLocationCandidateNumber indicates how much charge station to be searched for low energy point
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package cloudfinder
import (
"github.com/Telenav/osrm-backend/integration/api/oasis"
"github.com/Telenav/osrm-backend/integration/api/search/searchcoordinate"
"github.com/Telenav/osrm-backend/integration/service/oasis/internal/searchhelper"
"github.com/Telenav/osrm-backend/integration/service/oasis/searchconnector"
"github.com/Telenav/osrm-backend/integration/service/oasis/searchhelper"
)

//@todo: This number need to be adjusted based on charge station profile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (

"github.com/Telenav/osrm-backend/integration/api/nav"
"github.com/Telenav/osrm-backend/integration/api/osrm"
"github.com/Telenav/osrm-backend/integration/service/oasis/internal/osrmhelper"
"github.com/Telenav/osrm-backend/integration/service/oasis/osrmconnector"
"github.com/Telenav/osrm-backend/integration/service/oasis/osrmhelper"
"github.com/Telenav/osrm-backend/integration/service/oasis/stationfinder"
"github.com/Telenav/osrm-backend/integration/service/oasis/stationfinder/stationfindertype"
"github.com/golang/glog"
Expand Down
2 changes: 1 addition & 1 deletion integration/service/oasis/stationgraph/station_graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/Telenav/osrm-backend/integration/api/nav"
"github.com/Telenav/osrm-backend/integration/service/oasis/chargingstrategy"
"github.com/Telenav/osrm-backend/integration/service/oasis/connectivitymap"
"github.com/Telenav/osrm-backend/integration/service/oasis/solution"
"github.com/Telenav/osrm-backend/integration/service/oasis/internal/solution"
"github.com/Telenav/osrm-backend/integration/service/oasis/stationfinder/stationfindertype"
"github.com/golang/glog"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/Telenav/osrm-backend/integration/api/nav"
"github.com/Telenav/osrm-backend/integration/service/oasis/chargingstrategy"
"github.com/Telenav/osrm-backend/integration/service/oasis/connectivitymap"
"github.com/Telenav/osrm-backend/integration/service/oasis/solution"
"github.com/Telenav/osrm-backend/integration/service/oasis/internal/solution"
"github.com/Telenav/osrm-backend/integration/service/oasis/stationfinder/stationfindertype"
"github.com/Telenav/osrm-backend/integration/util"
"github.com/golang/glog"
Expand Down

0 comments on commit c3a04f8

Please sign in to comment.