-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generify OsrmService into RoutingService
- Loading branch information
1 parent
1c23716
commit 2464dc9
Showing
7 changed files
with
75 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/java/no/entur/uttu/routing/DefaultRoutingService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package no.entur.uttu.routing; | ||
|
||
import java.math.BigDecimal; | ||
import java.util.ArrayList; | ||
import org.springframework.stereotype.Component; | ||
|
||
/** | ||
* Fallback implementation in case routing profile not specified | ||
*/ | ||
@Component | ||
public class DefaultRoutingService implements RoutingService { | ||
|
||
public RouteGeometry getRouteGeometry( | ||
BigDecimal longitudeFrom, | ||
BigDecimal latitudeFrom, | ||
BigDecimal longitudeTo, | ||
BigDecimal latitudeTo | ||
) { | ||
return new RouteGeometry(new ArrayList<>(), BigDecimal.ZERO); | ||
} | ||
|
||
public boolean isEnabled() { | ||
return false; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ava/no/entur/uttu/osrm/RouteGeometry.java → .../no/entur/uttu/routing/RouteGeometry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package no.entur.uttu.osrm; | ||
package no.entur.uttu.routing; | ||
|
||
import java.math.BigDecimal; | ||
import java.util.List; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package no.entur.uttu.routing; | ||
|
||
import java.math.BigDecimal; | ||
|
||
/** | ||
* For getting the road geometry - resulting in service links and links in sequence in a journey pattern | ||
*/ | ||
public interface RoutingService { | ||
RouteGeometry getRouteGeometry( | ||
BigDecimal longitudeFrom, | ||
BigDecimal latitudeFrom, | ||
BigDecimal longitudeTo, | ||
BigDecimal latitudeTo | ||
); | ||
boolean isEnabled(); | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/no/entur/uttu/routing/osrm/OsrmConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package no.entur.uttu.routing.osrm; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Profile; | ||
|
||
@Configuration | ||
@Profile("routing") | ||
public class OsrmConfiguration { | ||
|
||
@Bean | ||
OsrmService osrmService(@Value("${uttu.routing.osrm-api}") String osrmApi) { | ||
return new OsrmService(osrmApi); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters