@@ -100,12 +100,7 @@ public abstract class CommonBikeFlagEncoder extends BikeCommonFlagEncoder {
100
100
private static final boolean DEBUG_OUTPUT = false ;
101
101
FileWriter logWriter ;
102
102
103
- // MARQ24 MOD START
104
- // MARQ24 ADDON in the case of the RoadBike Encoder we want to skip some
105
- // conditions...
106
- private final boolean isRoadBikeEncoder = this instanceof RoadBikeFlagEncoder ; // TODO: design: parent class should not need to know of child
107
103
protected static final Logger LOGGER = Logger .getLogger (CommonBikeFlagEncoder .class .getName ());
108
- // MARQ24 MOD END
109
104
110
105
// MARQ24 MOD START
111
106
protected CommonBikeFlagEncoder (int speedBits , double speedFactor , int maxTurnCosts ) {
@@ -415,7 +410,7 @@ public IntsRef handleWayTags(IntsRef edgeFlags, ReaderWay way, EncodingManager.A
415
410
if (!access .isFerry ()) {
416
411
wayTypeSpeed = applyMaxSpeed (way , wayTypeSpeed );
417
412
handleSpeed (edgeFlags , way , wayTypeSpeed );
418
- handleBikeRelated (edgeFlags , way , priorityFromRelation > UNCHANGED . getValue ( ));
413
+ handleBikeRelated (edgeFlags , way , isPartOfCycleRelation ( priorityFromRelation ));
419
414
if (access .isConditional () && conditionalAccessEncoder != null )
420
415
conditionalAccessEncoder .setBool (false , edgeFlags , true );
421
416
boolean isRoundabout = way .hasTag (KEY_JUNCTION , "roundabout" ) || way .hasTag (KEY_JUNCTION , "circular" );
@@ -440,6 +435,10 @@ public IntsRef handleWayTags(IntsRef edgeFlags, ReaderWay way, EncodingManager.A
440
435
return edgeFlags ;
441
436
}
442
437
438
+ protected boolean isPartOfCycleRelation (int priorityFromRelation ) {
439
+ return priorityFromRelation > UNCHANGED .getValue ();
440
+ }
441
+
443
442
int getSpeed (ReaderWay way ) {
444
443
int speed = Integer .MIN_VALUE ;
445
444
String highwayTag = way .getTag (KEY_HIGHWAY );
@@ -639,28 +638,7 @@ private PriorityCode convertClassValueToPriority(String tagvalue) {
639
638
void collect (ReaderWay way , double wayTypeSpeed , TreeMap <Double , Integer > weightToPrioMap ) {
640
639
String service = way .getTag (KEY_SERVICE );
641
640
String highway = way .getTag (KEY_HIGHWAY );
642
- // MARQ24 MOD START
643
- if (!isRoadBikeEncoder ) {
644
- // MARQ24 MOD END
645
- // MARQ24 MOD START
646
- if (way .hasTag (KEY_BICYCLE , KEY_DESIGNATED ) || way .hasTag (KEY_BICYCLE , KEY_OFFICIAL ) || way .hasTag (KEY_BICYCLE_ROAD , "yes" )) {
647
- // MARQ24 MOD END
648
- if ("path" .equals (highway )) {
649
- weightToPrioMap .put (100d , VERY_NICE .getValue ());
650
- } else {
651
- weightToPrioMap .put (100d , PREFER .getValue ());
652
- }
653
- }
654
- if (KEY_CYCLEWAY .equals (highway )) {
655
- if (way .hasTag ("foot" , intendedValues ) && !way .hasTag (KEY_SEGREGATED , "yes" )) {
656
- weightToPrioMap .put (100d , PREFER .getValue ());
657
- } else {
658
- weightToPrioMap .put (100d , VERY_NICE .getValue ());
659
- }
660
- }
661
- // MARQ24 MOD START
662
- }
663
- // MARQ24 MOD END
641
+ handleDesignatedCyclingPriority (way , weightToPrioMap , highway );
664
642
665
643
double maxSpeed = getMaxSpeed (way );
666
644
if (preferHighwayTags .contains (highway ) || this .isValidSpeed (maxSpeed ) && maxSpeed <= 30 ) {
@@ -679,27 +657,7 @@ void collect(ReaderWay way, double wayTypeSpeed, TreeMap<Double, Integer> weight
679
657
680
658
if (pushingSectionsHighways .contains (highway )
681
659
|| "parking_aisle" .equals (service )) {
682
- int pushingSectionPrio = AVOID_IF_POSSIBLE .getValue ();
683
- // MARQ24 MOD START
684
- if (!isRoadBikeEncoder ) {
685
- // MARQ24 MOD END
686
- if (way .hasTag (KEY_BICYCLE , "use_sidepath" ) || way .hasTag (KEY_BICYCLE , "yes" ) || way .hasTag (KEY_BICYCLE , "permissive" )) {
687
- pushingSectionPrio = PREFER .getValue ();
688
- }
689
- if (way .hasTag (KEY_BICYCLE , KEY_DESIGNATED ) || way .hasTag (KEY_BICYCLE , KEY_OFFICIAL )) {
690
- pushingSectionPrio = VERY_NICE .getValue ();
691
- }
692
- // MARQ24 MOD START
693
- }
694
- // MARQ24 MOD END
695
-
696
- if (way .hasTag ("foot" , "yes" )) {
697
- pushingSectionPrio = Math .max (pushingSectionPrio - 1 , WORST .getValue ());
698
- if (!isRoadBikeEncoder && way .hasTag (KEY_SEGREGATED , "yes" )) {
699
- pushingSectionPrio = Math .min (pushingSectionPrio + 1 , BEST .getValue ());
700
- }
701
- }
702
- weightToPrioMap .put (100d , pushingSectionPrio );
660
+ handlePushingSectionPriority (way , weightToPrioMap );
703
661
}
704
662
705
663
if (way .hasTag (KEY_RAILWAY , "tram" )) {
@@ -724,6 +682,40 @@ void collect(ReaderWay way, double wayTypeSpeed, TreeMap<Double, Integer> weight
724
682
}
725
683
}
726
684
685
+ protected void handlePushingSectionPriority (ReaderWay way , TreeMap <Double , Integer > weightToPrioMap ) {
686
+ int pushingSectionPrio = AVOID_IF_POSSIBLE .getValue ();
687
+ if (way .hasTag (KEY_BICYCLE , "use_sidepath" ) || way .hasTag (KEY_BICYCLE , "yes" ) || way .hasTag (KEY_BICYCLE , "permissive" )) {
688
+ pushingSectionPrio = PREFER .getValue ();
689
+ }
690
+ if (way .hasTag (KEY_BICYCLE , KEY_DESIGNATED ) || way .hasTag (KEY_BICYCLE , KEY_OFFICIAL )) {
691
+ pushingSectionPrio = VERY_NICE .getValue ();
692
+ }
693
+ if (way .hasTag ("foot" , "yes" )) {
694
+ pushingSectionPrio = Math .max (pushingSectionPrio - 1 , WORST .getValue ());
695
+ if (way .hasTag (KEY_SEGREGATED , "yes" )) {
696
+ pushingSectionPrio = Math .min (pushingSectionPrio + 1 , BEST .getValue ());
697
+ }
698
+ }
699
+ weightToPrioMap .put (100d , pushingSectionPrio );
700
+ }
701
+
702
+ protected void handleDesignatedCyclingPriority (ReaderWay way , TreeMap <Double , Integer > weightToPrioMap , String highway ) {
703
+ if (way .hasTag (KEY_BICYCLE , KEY_DESIGNATED ) || way .hasTag (KEY_BICYCLE , KEY_OFFICIAL ) || way .hasTag (KEY_BICYCLE_ROAD , "yes" )) {
704
+ if ("path" .equals (highway )) {
705
+ weightToPrioMap .put (100d , VERY_NICE .getValue ());
706
+ } else {
707
+ weightToPrioMap .put (100d , PREFER .getValue ());
708
+ }
709
+ }
710
+ if (KEY_CYCLEWAY .equals (highway )) {
711
+ if (way .hasTag ("foot" , intendedValues ) && !way .hasTag (KEY_SEGREGATED , "yes" )) {
712
+ weightToPrioMap .put (100d , PREFER .getValue ());
713
+ } else {
714
+ weightToPrioMap .put (100d , VERY_NICE .getValue ());
715
+ }
716
+ }
717
+ }
718
+
727
719
/**
728
720
* Handle surface and wayType encoding
729
721
*/
@@ -751,7 +743,7 @@ void handleBikeRelated(IntsRef edgeFlags, ReaderWay way, boolean partOfCycleRela
751
743
wayType = WayType .PUSHING_SECTION ;
752
744
} else {
753
745
// boost "none identified" partOfCycleRelation
754
- if (! isRoadBikeEncoder && partOfCycleRelation ) {
746
+ if (partOfCycleRelation ) {
755
747
wayType = WayType .CYCLEWAY ;
756
748
}
757
749
0 commit comments