-
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
18 changed files
with
336 additions
and
360 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// this file is generated, please do not modify | ||
|
||
export interface RelationIdMember { | ||
readonly relationId: number; | ||
readonly role: string; | ||
} |
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
149 changes: 75 additions & 74 deletions
149
.../structure/reference/WayInfoAnalyzer.java → ...ture/reference/ReferenceLinkAnalyzer.java
Large diffs are not rendered by default.
Oops, something went wrong.
6 changes: 3 additions & 3 deletions
6
...er/src/main/java/kpn/server/analyzer/engine/analysis/route/structure/reference/Utils.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
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,75 +1,74 @@ | ||
package kpn.core.analysis | ||
|
||
import kpn.core.analysis.LinkType.BACKWARD | ||
import kpn.core.analysis.LinkType.FORWARD | ||
import kpn.core.analysis.LinkType.NONE | ||
import kpn.core.analysis.LinkType.ROUNDABOUT | ||
|
||
import scala.collection.mutable | ||
|
||
case class Link( | ||
linkType: LinkType.Value, | ||
linkType: LinkType, | ||
hasPrev: Boolean, | ||
hasNext: Boolean, | ||
isLoop: Boolean, | ||
isOnewayLoopForwardPart: Boolean, | ||
isOnewayLoopBackwardPart: Boolean, | ||
isOnewayHead: Boolean, | ||
isOnewayTail: Boolean, | ||
invalid: Boolean | ||
) { | ||
|
||
def isValid: Boolean = !invalid | ||
|
||
def name: String = { | ||
if (!isValid) { | ||
"n" | ||
val linkTypeLetter = linkType match { | ||
case LinkType.Forward => "f" | ||
case LinkType.Backward => "b" | ||
case LinkType.RoundaboutLeft => "r" | ||
case LinkType.RoundaboutRight => "r" | ||
case LinkType.Unknown => "n" | ||
} | ||
else { | ||
|
||
val linkTypeLetter = linkType match { | ||
case FORWARD => "f" | ||
case BACKWARD => "b" | ||
case ROUNDABOUT => "r" | ||
case NONE => "n" | ||
} | ||
|
||
val code = (if (hasPrev) 1 else 0) + | ||
(if (hasNext) 2 else 0) + | ||
(if (isLoop) 4 else 0) + | ||
(if (isOnewayLoopForwardPart) 8 else 0) + | ||
(if (isOnewayLoopBackwardPart) 16 else 0) + | ||
(if (isOnewayHead) 32 else 0) + | ||
(if (isOnewayTail) 64 else 0) | ||
val code = (if (hasPrev) 1 else 0) + | ||
(if (hasNext) 2 else 0) + | ||
(if (isLoop) 4 else 0) + | ||
(if (isOnewayLoopForwardPart) 8 else 0) + | ||
(if (isOnewayLoopBackwardPart) 16 else 0) + | ||
(if (isOnewayHead) 32 else 0) + | ||
(if (isOnewayTail) 64 else 0) | ||
|
||
"w%s%03d".format(linkTypeLetter, code) | ||
} | ||
"w%s%03d".format(linkTypeLetter, code) | ||
} | ||
|
||
def description: String = { | ||
if (!isValid) { | ||
"I" | ||
} | ||
else { | ||
val sb = new mutable.StringBuilder | ||
val sb = new mutable.StringBuilder | ||
|
||
if (!hasPrev) { | ||
sb.append("*") | ||
} | ||
if (!hasPrev) { | ||
sb.append("*") | ||
} | ||
|
||
val elements = (if (isLoop) Seq("loop") else Seq.empty) ++ | ||
(if (isOnewayLoopForwardPart) Seq("fp") else Seq.empty) ++ | ||
(if (isOnewayLoopBackwardPart) Seq("bp") else Seq.empty) ++ | ||
(if (isOnewayHead) Seq("head") else Seq.empty) ++ | ||
(if (isOnewayTail) Seq("tail") else Seq.empty) ++ | ||
Seq(linkType.toString.toLowerCase) | ||
val elements = (if (isLoop) Seq("loop") else Seq.empty) ++ | ||
(if (isOnewayLoopForwardPart) Seq("fp") else Seq.empty) ++ | ||
(if (isOnewayLoopBackwardPart) Seq("bp") else Seq.empty) ++ | ||
(if (isOnewayHead) Seq("head") else Seq.empty) ++ | ||
(if (isOnewayTail) Seq("tail") else Seq.empty) ++ | ||
Seq(linkType.toString.toLowerCase) | ||
|
||
sb.append(elements.mkString("-")) | ||
sb.append(elements.mkString("-")) | ||
|
||
if (!hasNext) { | ||
sb.append("*") | ||
} | ||
sb.toString() | ||
if (!hasNext) { | ||
sb.append("*") | ||
} | ||
sb.toString() | ||
} | ||
|
||
def reportString: String = { | ||
val sb = new StringBuilder | ||
sb.append("p " + bool(hasPrev)) | ||
sb.append(" n " + bool(hasNext)) | ||
sb.append(" loop " + bool(isLoop)) | ||
sb.append(" fp " + bool(isOnewayLoopForwardPart)) | ||
sb.append(" bp " + bool(isOnewayLoopBackwardPart)) | ||
sb.append(" head " + bool(isOnewayHead)) | ||
sb.append(" tail " + bool(isOnewayTail)) | ||
sb.append(String.format(" d %s", linkType.entryName.toLowerCase)) | ||
sb.toString | ||
} | ||
|
||
private def bool(value: Boolean): String = { | ||
if (value) "■" else " " | ||
} | ||
} |
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,5 +1,21 @@ | ||
package kpn.core.analysis | ||
|
||
object LinkType extends Enumeration { | ||
val FORWARD, BACKWARD, ROUNDABOUT, NONE = Value | ||
import enumeratum.Enum | ||
import enumeratum.EnumEntry | ||
|
||
sealed trait LinkType extends EnumEntry | ||
|
||
object LinkType extends Enum[LinkType] { | ||
|
||
val values: IndexedSeq[LinkType] = findValues | ||
|
||
case object Forward extends LinkType // the first node of this way is connected to the previous way and/or the last node of this way is connected to the next way | ||
|
||
case object Backward extends LinkType | ||
|
||
case object RoundaboutLeft extends LinkType // tagged as roundabout and connected to the previous/next member | ||
|
||
case object RoundaboutRight extends LinkType | ||
|
||
case object Unknown extends LinkType | ||
} |
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
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
Oops, something went wrong.