Debian Codegraph @

src/uk/me/parabola/imgfmt/app/net/GeneralRouteRestriction.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2014
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 */
14 package uk.me.parabola.imgfmt.app.net;
15
16 import java.util.ArrayList;
17 import java.util.List;
18
19 import uk.me.parabola.imgfmt.app.CoordNode;
20
21 /**
22 * A class to collect the data related to routing restrictions
23 * like only-left-turn or no-right-turn
24 * @author GerdP
25 *
26 */
27 public class GeneralRouteRestriction {
28 public enum RestrType {TYPE_ONLY ,
29 TYPE_NOT,
30 TYPE_NO_TROUGH // for elements like barriers, gates, etc.
31 }
32
33 private final byte exceptionMask;
34 private final RestrType type;
35 private final String sourceDesc;
36
37 private long fromWayId, toWayId;
38 private CoordNode fromNode, toNode;
39 private List<Long> viaWayIds = new ArrayList<>();
40 private List<CoordNode> viaNodes = new ArrayList<>();
41 private char dirIndicator; // s(traight),l(eft),r(ight),u, ? for unknown
42
43 public GeneralRouteRestriction(String type, byte exceptionMask, String sourceDesc) {
44 if ("not".equals(type))
45 this.type = RestrType.TYPE_NOT;
46 else if ("only".equals(type))
47 this.type = RestrType.TYPE_ONLY;
48 else if ("no_through".equals(type))
49 this.type = RestrType.TYPE_NO_TROUGH;
50 else
51 throw new IllegalArgumentException("invalid type " + type);
52 this.exceptionMask = exceptionMask;
53 this.sourceDesc = sourceDesc;
54 this.setDirIndicator('?');
55 }
56
57 public long getFromWayId() {
58 return fromWayId;
59 }
60 public void setFromWayId(long fromWayId) {
61 this.fromWayId = fromWayId;
62 }
63 public long getToWayId() {
64 return toWayId;
65 }
66 public void setToWayId(long toWayId) {
67 this.toWayId = toWayId;
68 }
69 public byte getExceptionMask() {
70 return exceptionMask;
71 }
72 public RestrType getType() {
73 return type;
74 }
75 public CoordNode getFromNode() {
76 return fromNode;
77 }
78 public void setFromNode(CoordNode fromNode) {
79 this.fromNode = fromNode;
80 }
81 public CoordNode getToNode() {
82 return toNode;
83 }
84 public void setToNode(CoordNode toNode) {
85 this.toNode = toNode;
86 }
87
88 public List<Long> getViaWayIds() {
89 return viaWayIds;
90 }
91
92 public void setViaWayIds(List<Long> viaWayIds) {
93 this.viaWayIds = new ArrayList<>(viaWayIds);
94 }
95 public List<CoordNode> getViaNodes() {
96 return viaNodes;
97 }
98 public void setViaNodes(List<CoordNode> viaNodes){
99 this.viaNodes = new ArrayList<>(viaNodes);
100 }
101 public String getSourceDesc(){
102 return sourceDesc;
103 }
104
105 public char getDirIndicator() {
106 return dirIndicator;
107 }
108
109 public void setDirIndicator(char dirIndicator) {
110 this.dirIndicator = dirIndicator;
111 }
112 }