@@ -37,21 +37,16 @@ public class BikeGenericFlagEncoder extends AbstractFlagEncoder
37
37
{
38
38
39
39
private final DistanceCalc distCalc = Helper .DIST_EARTH ;
40
- /**
41
- * Reports wether this edge is unpaved.
42
- */
43
40
public static final int PUSHING_SECTION_SPEED = 4 ;
41
+
44
42
// Pushing section highways are parts where you need to get off your bike and push it (German: Schiebestrecke)
45
43
protected final HashSet <String > pushingSections = new HashSet <String >();
46
44
protected final HashSet <String > oppositeLanes = new HashSet <String >();
47
45
protected final Set <String > acceptedHighwayTags = new HashSet <String >();
48
- protected final Set <String > preferHighwayTags = new HashSet <String >();
49
- protected final Set <String > avoidHighwayTags = new HashSet <String >();
50
46
51
47
protected final Set <String > pavedSurfaceTags = new HashSet <String >();
52
48
protected final Set <String > unpavedSurfaceTags = new HashSet <String >();
53
49
54
- //private final Map<String, Integer> trackTypeSpeeds = new HashMap<String, Integer>();
55
50
private final Map <String , Float > surfaceSpeedFactors = new HashMap <String , Float >();
56
51
private final Map <Integer , Integer > wayTypeSpeeds = new HashMap <Integer , Integer >();
57
52
// convert network tag of bicycle routes into a way route code
@@ -217,15 +212,6 @@ protected BikeGenericFlagEncoder(int speedBits, double speedFactor, int maxTurnC
217
212
addPushingSection ("pedestrian" );
218
213
addPushingSection ("steps" );
219
214
220
-
221
- /*setCyclingNetworkPreference("icn", 1);
222
- setCyclingNetworkPreference("ncn", 2);
223
- setCyclingNetworkPreference("rcn", 3);
224
- setCyclingNetworkPreference("lcn", 4);
225
- setCyclingNetworkPreference("mtb", PriorityCode.UNCHANGED.getValue());
226
-
227
- setCyclingNetworkPreference("deprecated", PriorityCode.AVOID_AT_ALL_COSTS.getValue());*/
228
-
229
215
setAvoidSpeedLimit (81 );
230
216
}
231
217
@@ -248,10 +234,6 @@ public int defineWayBits( int index, int shift )
248
234
wayTypeEncoder = new EncodedValue ("WayType" , shift , 4 , 1 , 0 , 15 , true );
249
235
shift += wayTypeEncoder .getBits ();
250
236
251
- // 3 bits to store preference on specific ways
252
- //priorityWayEncoder = new EncodedValue("PreferWay", shift, 3, 1, 0, 7);
253
- //shift += priorityWayEncoder.getBits();
254
-
255
237
// 6 bits to store incline
256
238
inclineSlopeEncoder = new EncodedDoubleValue ("InclineSlope" , shift , 6 , 1 , 0 , 40 , true );
257
239
shift += inclineSlopeEncoder .getBits ();
@@ -494,117 +476,6 @@ String getWayName(int wayType, Translation tr )
494
476
return wayTypeName ;
495
477
}
496
478
497
- /**
498
- * In this method we prefer cycleways or roads with designated bike access and avoid big roads
499
- * or roads with trams or pedestrian.
500
- * <p>
501
- * @return new priority based on priorityFromRelation and on the tags in OSMWay.
502
- */
503
- protected int handlePriority ( OSMWay way , int priorityFromRelation )
504
- {
505
- TreeMap <Double , Integer > weightToPrioMap = new TreeMap <Double , Integer >();
506
- if (priorityFromRelation == 0 )
507
- weightToPrioMap .put (0d , UNCHANGED .getValue ());
508
- else
509
- weightToPrioMap .put (110d , priorityFromRelation );
510
-
511
- collect (way , weightToPrioMap );
512
-
513
- // pick priority with biggest order value
514
- return weightToPrioMap .lastEntry ().getValue ();
515
- }
516
-
517
- // Conversion of class value to priority. See http://wiki.openstreetmap.org/wiki/Class:bicycle
518
- private PriorityCode convertCallValueToPriority ( String tagvalue )
519
- {
520
- int classvalue ;
521
- try
522
- {
523
- classvalue = Integer .parseInt (tagvalue );
524
- } catch (NumberFormatException e )
525
- {
526
- return PriorityCode .UNCHANGED ;
527
- }
528
-
529
- switch (classvalue )
530
- {
531
- case 3 :
532
- return PriorityCode .BEST ;
533
- case 2 :
534
- return PriorityCode .VERY_NICE ;
535
- case 1 :
536
- return PriorityCode .PREFER ;
537
- case 0 :
538
- return PriorityCode .UNCHANGED ;
539
- case -1 :
540
- return PriorityCode .AVOID_IF_POSSIBLE ;
541
- case -2 :
542
- return PriorityCode .REACH_DEST ;
543
- case -3 :
544
- return PriorityCode .AVOID_AT_ALL_COSTS ;
545
- default :
546
- return PriorityCode .UNCHANGED ;
547
- }
548
- }
549
-
550
- /**
551
- * @param weightToPrioMap associate a weight with every priority. This sorted map allows
552
- * subclasses to 'insert' more important priorities as well as overwrite determined priorities.
553
- */
554
- void collect ( OSMWay way , TreeMap <Double , Integer > weightToPrioMap )
555
- {
556
- String service = way .getTag ("service" );
557
- String highway = way .getTag ("highway" );
558
- if (way .hasTag ("bicycle" , "designated" ))
559
- weightToPrioMap .put (100d , PREFER .getValue ());
560
- if ("cycleway" .equals (highway ))
561
- weightToPrioMap .put (100d , VERY_NICE .getValue ());
562
-
563
- double maxSpeed = getMaxSpeed (way );
564
- if (preferHighwayTags .contains (highway ) || maxSpeed > 0 && maxSpeed <= 30 )
565
- {
566
- if (maxSpeed < avoidSpeedLimit )
567
- {
568
- weightToPrioMap .put (40d , PREFER .getValue ());
569
- if (way .hasTag ("tunnel" , intendedValues ))
570
- weightToPrioMap .put (40d , UNCHANGED .getValue ());
571
- }
572
- } else
573
- {
574
- if (avoidHighwayTags .contains (highway )
575
- || maxSpeed >= avoidSpeedLimit && !"track" .equals (highway ))
576
- {
577
- weightToPrioMap .put (50d , REACH_DEST .getValue ());
578
- if (way .hasTag ("tunnel" , intendedValues ))
579
- weightToPrioMap .put (50d , AVOID_AT_ALL_COSTS .getValue ());
580
- }
581
- }
582
-
583
- if (pushingSections .contains (highway )
584
- || way .hasTag ("bicycle" , "use_sidepath" )
585
- || "parking_aisle" .equals (service ))
586
- {
587
- if (way .hasTag ("bicycle" , "yes" ))
588
- weightToPrioMap .put (100d , UNCHANGED .getValue ());
589
- else
590
- weightToPrioMap .put (50d , AVOID_IF_POSSIBLE .getValue ());
591
- }
592
-
593
- if (way .hasTag ("railway" , "tram" ))
594
- weightToPrioMap .put (50d , AVOID_AT_ALL_COSTS .getValue ());
595
-
596
- String classBicycleSpecific = way .getTag (specificBicycleClass );
597
- if (classBicycleSpecific != null )
598
- {
599
- // We assume that humans are better in classifying preferences compared to our algorithm above -> weight = 100
600
- weightToPrioMap .put (100d , convertCallValueToPriority (classBicycleSpecific ).getValue ());
601
- } else
602
- {
603
- String classBicycle = way .getTag ("class:bicycle" );
604
- if (classBicycle != null )
605
- weightToPrioMap .put (100d , convertCallValueToPriority (classBicycle ).getValue ());
606
- }
607
- }
608
479
609
480
/**
610
481
* Handle surface and wayType encoding
0 commit comments