-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
59 additions
and
51 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
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,11 +1,13 @@ | ||
// this file is generated, please do not modify | ||
|
||
import { NetworkType } from '@api/custom'; | ||
import { RouteMap } from './route-map'; | ||
import { RoutePath } from './route-path'; | ||
import { RouteSegment } from './route-segment'; | ||
|
||
export interface RouteMapInfo { | ||
readonly routeId: number; | ||
readonly routeName: string; | ||
readonly networkType: NetworkType; | ||
readonly map: RouteMap; | ||
readonly segments: RouteSegment[]; | ||
readonly paths: RoutePath[]; | ||
} |
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,8 +1,10 @@ | ||
// this file is generated, please do not modify | ||
|
||
import { Bounds } from '@api/common'; | ||
import { RouteMapInfo } from './route-map-info'; | ||
|
||
export interface RouteMapPage { | ||
readonly routeMapInfo: RouteMapInfo; | ||
readonly bounds: Bounds; | ||
readonly changeCount: number; | ||
} |
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
3 changes: 3 additions & 0 deletions
3
server/src/main/scala/kpn/api/common/route/RouteMapPage.scala
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,6 +1,9 @@ | ||
package kpn.api.common.route | ||
|
||
import kpn.api.common.Bounds | ||
|
||
case class RouteMapPage( | ||
routeMapInfo: RouteMapInfo, | ||
bounds: Bounds, | ||
changeCount: Long | ||
) |
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
19 changes: 16 additions & 3 deletions
19
server/src/main/scala/kpn/server/api/analysis/pages/route/RouteMapPageBuilder.scala
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,9 +1,22 @@ | ||
package kpn.server.api.analysis.pages.route | ||
|
||
import kpn.api.common.route.RouteMapPage | ||
import kpn.core.util.Util | ||
import kpn.server.repository.ChangeSetRepository | ||
import kpn.server.repository.RouteRepository | ||
import org.springframework.stereotype.Component | ||
|
||
trait RouteMapPageBuilder { | ||
|
||
def build(routeId: Long): Option[RouteMapPage] | ||
@Component | ||
class RouteMapPageBuilder( | ||
routeRepository: RouteRepository, | ||
changeSetRepository: ChangeSetRepository | ||
) { | ||
|
||
def build(routeId: Long): Option[RouteMapPage] = { | ||
routeRepository.mapInfo(routeId).map { routeMapInfo => | ||
val changeCount = changeSetRepository.routeChangesCount(routeId) | ||
val bounds = Util.mergeBounds(routeMapInfo.segments.map(_.bounds)) | ||
RouteMapPage(routeMapInfo, bounds, changeCount) | ||
} | ||
} | ||
} |
20 changes: 0 additions & 20 deletions
20
server/src/main/scala/kpn/server/api/analysis/pages/route/RouteMapPageBuilderImpl.scala
This file was deleted.
Oops, something went wrong.