-
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.
#368 make Node, Way and Relation classes independent of their raw cou…
…nterparts
- Loading branch information
Showing
57 changed files
with
397 additions
and
518 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
10 changes: 10 additions & 0 deletions
10
server/src/main/scala/kpn/api/common/data/NodeMember.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,5 +1,15 @@ | ||
package kpn.api.common.data | ||
|
||
import kpn.api.common.data.raw.RawMember | ||
|
||
case class NodeMember(node: Node, role: Option[String]) extends Member { | ||
override def isNode: Boolean = true | ||
|
||
def toRaw: RawMember = { | ||
RawMember( | ||
"node", | ||
node.id, | ||
role | ||
) | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
server/src/main/scala/kpn/api/common/data/RelationMember.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,7 +1,16 @@ | ||
package kpn.api.common.data | ||
|
||
import kpn.api.common.data.raw.RawMember | ||
import kpn.api.custom.Relation | ||
|
||
case class RelationMember(relation: Relation, role: Option[String]) extends Member { | ||
override def isRelation: Boolean = true | ||
|
||
def toRaw: RawMember = { | ||
RawMember( | ||
"relation", | ||
relation.id, | ||
role | ||
) | ||
} | ||
} |
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,5 +1,15 @@ | ||
package kpn.api.common.data | ||
|
||
import kpn.api.common.data.raw.RawMember | ||
|
||
case class WayMember(way: Way, role: Option[String]) extends Member { | ||
override def isWay: Boolean = true | ||
|
||
def toRaw: RawMember = { | ||
RawMember( | ||
"way", | ||
way.id, | ||
role | ||
) | ||
} | ||
} |
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,17 +1,16 @@ | ||
package kpn.api.common.diff | ||
|
||
import kpn.api.common.data.raw.RawNode | ||
import kpn.api.common.data.Node | ||
import kpn.api.common.diff.node.NodeMoved | ||
|
||
case class NodeUpdate( | ||
before: RawNode, | ||
after: RawNode, | ||
before: Node, | ||
after: Node, | ||
tagDiffs: Option[TagDiffs] = None, | ||
nodeMoved: Option[NodeMoved] = None | ||
) { | ||
|
||
def id: Long = before.id | ||
|
||
def nonEmpty: Boolean = tagDiffs.isDefined || nodeMoved.isDefined | ||
|
||
} |
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,19 +1,15 @@ | ||
package kpn.api.common.diff | ||
|
||
import kpn.api.common.data.MetaData | ||
import kpn.api.common.data.raw.RawNode | ||
import kpn.api.common.data.Node | ||
|
||
case class WayUpdate( | ||
id: Long, | ||
before: MetaData, | ||
after: MetaData, | ||
removedNodes: Seq[RawNode] = Seq.empty, | ||
addedNodes: Seq[RawNode] = Seq.empty, | ||
removedNodes: Seq[Node] = Seq.empty, | ||
addedNodes: Seq[Node] = Seq.empty, | ||
updatedNodes: Seq[NodeUpdate] = Seq.empty, | ||
directionReversed: Boolean = false, | ||
tagDiffs: Option[TagDiffs] = None | ||
) { | ||
|
||
def isNewVersion: Boolean = before.version != after.version | ||
|
||
} | ||
) |
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.