Skip to content

Commit 65c4bd1

Browse files
committed
feat: store WheelchairAttributes in EncodedValues
WheelchairAttributes are stored in EncodedValues instead of GraphStorage: - implement parsers for all attributes - read WheelchairValues from EncodedValues
1 parent b4d8651 commit 65c4bd1

26 files changed

Lines changed: 956 additions & 26 deletions
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.graphhopper.routing.ev;
2+
3+
/**
4+
* EncodedValue for wheelchair incline attribute.
5+
* Stores incline percentage as a signed integer value (range: -50 to +50).
6+
*/
7+
public class WheelchairIncline {
8+
public static final String KEY = "wheelchair_incline";
9+
10+
private WheelchairIncline() {
11+
// Private constructor to prevent instantiation
12+
}
13+
14+
public static IntEncodedValue create() {
15+
// 6 bits signed to store 0% to +50% incline
16+
return new UnsignedIntEncodedValue(KEY, 6, false) {
17+
};
18+
}
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.graphhopper.routing.ev;
2+
3+
/**
4+
* EncodedValue for wheelchair kerb/curb height attribute.
5+
* Stores kerb height in centimeters as an unsigned integer value (range: 0-30cm).
6+
*/
7+
public class WheelchairKerb {
8+
public static final String KEY = "wheelchair_kerb";
9+
10+
private WheelchairKerb() {
11+
// Private constructor to prevent instantiation
12+
}
13+
14+
public static IntEncodedValue create() {
15+
// 6 bits unsigned to store 0-30cm kerb height
16+
return new UnsignedIntEncodedValue(KEY, 6, false);
17+
}
18+
}
19+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.graphhopper.routing.ev;
2+
3+
import org.heigit.ors.routing.graphhopper.extensions.WheelchairAttributes;
4+
5+
// Side of the sidewalk, if attached.
6+
public class WheelchairSide {
7+
public static final String KEY = "wheelchair_side";
8+
9+
public static EnumEncodedValue<WheelchairAttributes.Side> create() {
10+
return new EnumEncodedValue<>(KEY, WheelchairAttributes.Side.class);
11+
}
12+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.graphhopper.routing.ev;
2+
3+
public class WheelchairSmoothness {
4+
public static final String KEY = "wheelchair_smoothness";
5+
6+
public static IntEncodedValue create() {
7+
return new UnsignedIntEncodedValue(KEY, 4, false);
8+
}
9+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.graphhopper.routing.ev;
2+
3+
/**
4+
* EncodedValue for wheelchair suitable attribute.
5+
*/
6+
public class WheelchairSuitable {
7+
public static final String KEY = "wheelchair_suitable";
8+
9+
private WheelchairSuitable() {
10+
// Private constructor to prevent instantiation
11+
}
12+
13+
public static SimpleBooleanEncodedValue create() {
14+
return new SimpleBooleanEncodedValue(KEY);
15+
}
16+
}
17+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.graphhopper.routing.ev;
2+
3+
public class WheelchairSurface {
4+
public static final String KEY = "wheelchair_surface";
5+
6+
public static IntEncodedValue create() {
7+
return new UnsignedIntEncodedValue(KEY, 5, false);
8+
}
9+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.graphhopper.routing.ev;
2+
3+
public class WheelchairSurfaceQualityKnown {
4+
public static final String KEY = "wheelchair_surface_quality_known";
5+
6+
private WheelchairSurfaceQualityKnown() {
7+
// Private constructor to prevent instantiation
8+
}
9+
10+
public static SimpleBooleanEncodedValue create() {
11+
return new SimpleBooleanEncodedValue(KEY, false);
12+
}
13+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.graphhopper.routing.ev;
2+
3+
public class WheelchairTrackType {
4+
public static final String KEY = "wheelchair_track_type";
5+
6+
public static IntEncodedValue create() {
7+
return new UnsignedIntEncodedValue(KEY, 3, false);
8+
}
9+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.graphhopper.routing.ev;
2+
3+
/**
4+
* EncodedValue for wheelchair width attribute.
5+
* Stores width in centimeters as an unsigned integer value (range: 0-500cm).
6+
*/
7+
public class WheelchairWidth {
8+
public static final String KEY = "wheelchair_width";
9+
10+
private WheelchairWidth() {
11+
// Private constructor to prevent instantiation
12+
}
13+
14+
public static IntEncodedValue create() {
15+
// 9 bits unsigned to store 0-500cm (0-5 meters)
16+
return new UnsignedIntEncodedValue(KEY, 9, false);
17+
}
18+
}
19+

ors-engine/src/main/java/org/heigit/ors/config/profile/BuildProperties.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ public void initExtStorages() {
111111
case TOLLWAYS -> handleTollways();
112112
case HILL_INDEX -> handleHillIndex();
113113
case TRAIL_DIFFICULTY -> handleTrailDifficulty();
114+
case WHEELCHAIR -> handleWheelchair();
114115
default -> {
115116
storage.initialize(extendedStorageName);
116117
this.extStorages.put(key, storage);
@@ -226,6 +227,36 @@ private void handleTrailDifficulty() {
226227
}
227228
}
228229

230+
private void handleWheelchair() {
231+
if (encodedValues.getWheelchairSurface() == null) {
232+
encodedValues.setWheelchairSurface(true);
233+
}
234+
if (encodedValues.getWheelchairSmoothness() == null) {
235+
encodedValues.setWheelchairSmoothness(true);
236+
}
237+
if (encodedValues.getWheelchairTrackType() == null) {
238+
encodedValues.setWheelchairTrackType(true);
239+
}
240+
if (encodedValues.getWheelchairIncline() == null) {
241+
encodedValues.setWheelchairIncline(true);
242+
}
243+
if (encodedValues.getWheelchairWidth() == null) {
244+
encodedValues.setWheelchairWidth(true);
245+
}
246+
if (encodedValues.getWheelchairKerb() == null) {
247+
encodedValues.setWheelchairKerb(true);
248+
}
249+
if(encodedValues.getWheelchairSuitable() == null) {
250+
encodedValues.setWheelchairSuitable(true);
251+
}
252+
if (encodedValues.getWheelchairSide() == null) {
253+
encodedValues.setWheelchairSide(true);
254+
}
255+
if(encodedValues.getWheelchairSurfaceQualityKnown() == null) {
256+
encodedValues.setWheelchairSurfaceQualityKnown(true);
257+
}
258+
}
259+
229260
@JsonIgnore
230261
public String getEncoderOptionsString() {
231262
if (encoderOptions == null) return "";

0 commit comments

Comments
 (0)