Skip to content

Commit

Permalink
Remove DataFlagEncoder (#1826)
Browse files Browse the repository at this point in the history
* minor tweak

* remove dataflagencoder
  • Loading branch information
karussell committed Dec 19, 2019
1 parent e214148 commit 58cdbdf
Show file tree
Hide file tree
Showing 15 changed files with 19 additions and 956 deletions.
1 change: 1 addition & 0 deletions core/files/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
1.0
removed GenericWeighting and DataFlagEncoder as a normal CarFlagEncoder does the job too
add required EncodedValues like road_class to EncodingManager if not added from user
removed PathNative,PathBidirRef,Path4CH,EdgeBasedPathCH and moved path extraction code out of Path class, added PathExtractor,BidirPathExtractor(+subclasses for CH) instead, #1730
conditional turn restrictions now supported, #1683
Expand Down
4 changes: 1 addition & 3 deletions core/src/main/java/com/graphhopper/GraphHopper.java
Original file line number Diff line number Diff line change
Expand Up @@ -940,9 +940,7 @@ public Weighting createWeighting(HintsMap hintsMap, FlagEncoder encoder, Graph g
String weightingStr = toLowerCase(hintsMap.getWeighting());
Weighting weighting = null;

if (encoder.supports(GenericWeighting.class)) {
weighting = new GenericWeighting((DataFlagEncoder) encoder, hintsMap);
} else if ("shortest".equalsIgnoreCase(weightingStr)) {
if ("shortest".equalsIgnoreCase(weightingStr)) {
weighting = new ShortestWeighting(encoder);
} else if ("fastest".equalsIgnoreCase(weightingStr) || weightingStr.isEmpty()) {
if (encoder.supports(PriorityWeighting.class))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,15 @@ public static InstructionList calcInstructions(Path path, Graph graph, Weighting

@Override
public void next(EdgeIteratorState edge, int index, int prevEdgeId) {
if (prevNode == -1) {
prevLat = this.nodeAccess.getLatitude(edge.getBaseNode());
prevLon = this.nodeAccess.getLongitude(edge.getBaseNode());
}

// baseNode is the current node and adjNode is the next
int adjNode = edge.getAdjNode();
int baseNode = edge.getBaseNode();

if (prevNode == -1) {
prevLat = this.nodeAccess.getLatitude(baseNode);
prevLon = this.nodeAccess.getLongitude(baseNode);
}

IntsRef flags = edge.getFlags();
double adjLat = nodeAccess.getLatitude(adjNode);
double adjLon = nodeAccess.getLongitude(adjNode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.graphhopper.routing.profiles.BooleanEncodedValue;
import com.graphhopper.routing.profiles.DecimalEncodedValue;
import com.graphhopper.routing.profiles.MaxSpeed;
import com.graphhopper.routing.util.DataFlagEncoder;
import com.graphhopper.routing.util.FlagEncoder;
import com.graphhopper.storage.IntsRef;
import com.graphhopper.storage.NodeAccess;
Expand Down Expand Up @@ -77,7 +76,7 @@ public InstructionsOutgoingEdges(EdgeIteratorState prevEdge,
this.prevEdge = prevEdge;
this.currentEdge = currentEdge;
BooleanEncodedValue accessEnc = encoder.getAccessEnc();
this.speedEnc = (encoder instanceof DataFlagEncoder) ? encoder.getDecimalEncodedValue(MaxSpeed.KEY) : encoder.getAverageSpeedEnc();
this.speedEnc = encoder.getAverageSpeedEnc();
this.nodeAccess = nodeAccess;

EdgeIteratorState tmpEdge;
Expand Down
260 changes: 0 additions & 260 deletions core/src/main/java/com/graphhopper/routing/util/DataFlagEncoder.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,10 @@
public class DefaultFlagEncoderFactory implements FlagEncoderFactory {
@Override
public FlagEncoder createFlagEncoder(String name, PMap configuration) {
if (name.equals(GENERIC))
return new DataFlagEncoder(configuration);

else if (name.equals(CAR))
if (name.equals(CAR))
return new CarFlagEncoder(configuration);

else if (name.equals(CAR4WD))
if (name.equals(CAR4WD))
return new Car4WDFlagEncoder(configuration);

if (name.equals(BIKE))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public interface FlagEncoderFactory {
String HIKE = "hike";
String MOTORCYCLE = "motorcycle";
String WHEELCHAIR = "wheelchair";
String GENERIC = "generic";

FlagEncoder createFlagEncoder(String name, PMap configuration);
}
Loading

0 comments on commit 58cdbdf

Please sign in to comment.