@@ -100,12 +100,7 @@ public abstract class CommonBikeFlagEncoder extends BikeCommonFlagEncoder {
100100 private static final boolean DEBUG_OUTPUT = false ;
101101 FileWriter logWriter ;
102102
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
107103 protected static final Logger LOGGER = Logger .getLogger (CommonBikeFlagEncoder .class .getName ());
108- // MARQ24 MOD END
109104
110105 // MARQ24 MOD START
111106 protected CommonBikeFlagEncoder (int speedBits , double speedFactor , int maxTurnCosts ) {
@@ -415,7 +410,7 @@ public IntsRef handleWayTags(IntsRef edgeFlags, ReaderWay way, EncodingManager.A
415410 if (!access .isFerry ()) {
416411 wayTypeSpeed = applyMaxSpeed (way , wayTypeSpeed );
417412 handleSpeed (edgeFlags , way , wayTypeSpeed );
418- handleBikeRelated (edgeFlags , way , priorityFromRelation > UNCHANGED . getValue ( ));
413+ handleBikeRelated (edgeFlags , way , isPartOfCycleRelation ( priorityFromRelation ));
419414 if (access .isConditional () && conditionalAccessEncoder != null )
420415 conditionalAccessEncoder .setBool (false , edgeFlags , true );
421416 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
440435 return edgeFlags ;
441436 }
442437
438+ protected boolean isPartOfCycleRelation (int priorityFromRelation ) {
439+ return priorityFromRelation > UNCHANGED .getValue ();
440+ }
441+
443442 int getSpeed (ReaderWay way ) {
444443 int speed = Integer .MIN_VALUE ;
445444 String highwayTag = way .getTag (KEY_HIGHWAY );
@@ -639,28 +638,7 @@ private PriorityCode convertClassValueToPriority(String tagvalue) {
639638 void collect (ReaderWay way , double wayTypeSpeed , TreeMap <Double , Integer > weightToPrioMap ) {
640639 String service = way .getTag (KEY_SERVICE );
641640 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 );
664642
665643 double maxSpeed = getMaxSpeed (way );
666644 if (preferHighwayTags .contains (highway ) || this .isValidSpeed (maxSpeed ) && maxSpeed <= 30 ) {
@@ -679,27 +657,7 @@ void collect(ReaderWay way, double wayTypeSpeed, TreeMap<Double, Integer> weight
679657
680658 if (pushingSectionsHighways .contains (highway )
681659 || "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 );
703661 }
704662
705663 if (way .hasTag (KEY_RAILWAY , "tram" )) {
@@ -724,6 +682,40 @@ void collect(ReaderWay way, double wayTypeSpeed, TreeMap<Double, Integer> weight
724682 }
725683 }
726684
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+
727719 /**
728720 * Handle surface and wayType encoding
729721 */
@@ -751,7 +743,7 @@ void handleBikeRelated(IntsRef edgeFlags, ReaderWay way, boolean partOfCycleRela
751743 wayType = WayType .PUSHING_SECTION ;
752744 } else {
753745 // boost "none identified" partOfCycleRelation
754- if (! isRoadBikeEncoder && partOfCycleRelation ) {
746+ if (partOfCycleRelation ) {
755747 wayType = WayType .CYCLEWAY ;
756748 }
757749
0 commit comments