Skip to content
This repository has been archived by the owner on Mar 1, 2021. It is now read-only.

WIP: handling viterbi breaks as multiple sequences #87

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2c1a010
initial work for handling viterbi breaks as multiple sequences
kodonnell Dec 11, 2016
d979ffd
handle case where viterbi breaks immediately after initialization
kodonnell Dec 12, 2016
6b856f1
merge U-turn work
kodonnell Dec 30, 2016
ade4037
refactoring sequences
kodonnell Jan 13, 2017
4b24cbc
use MatchEntry internally instead of GPXEntry
kodonnell Jan 14, 2017
5832623
debug and fix tests
kodonnell Jan 15, 2017
b6c3af4
rename timestep -> viterbimatchentry
kodonnell Jan 15, 2017
c0e5574
fix other tests
kodonnell Jan 15, 2017
2d184a2
tidying calcpath and gpxfile/main
kodonnell Jan 15, 2017
791e53c
web stuff ...
kodonnell Jan 15, 2017
eed78bf
giving up on that test ...
kodonnell Jan 15, 2017
ac105e7
woops, don't need that anymore ...
kodonnell Jan 15, 2017
d6bf213
refactor + tidy + all tests passing
kodonnell Jan 31, 2017
4e217d0
contiguous sequences
kodonnell Jan 31, 2017
f629883
undo test change to fix test change
kodonnell Feb 1, 2017
9e6cc60
add logging in again as per @stefanholder's request
kodonnell Feb 6, 2017
9d6f84b
Merge branch 'master' into sequences
kodonnell Feb 26, 2017
7f45557
note funny bug ...
kodonnell Feb 26, 2017
4a7420a
some changes as per @stefanholder
kodonnell Mar 20, 2017
13707e1
bringing back the missing readme
kodonnell Mar 20, 2017
efb7b57
a few more tidyups
kodonnell Mar 20, 2017
956e7d0
more tidy-ups
kodonnell Mar 20, 2017
1dd88e8
utilise LocationIndexTree.findWithinRadius
kodonnell Mar 20, 2017
56df0ab
ugly hacky gui ...
kodonnell Mar 28, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* @author kodonnell
* @author Stefan Holder
*/
public class GPXExtension {
public class Candidate {
private final GPXEntry entry;
private final QueryResult queryResult;
private final boolean isDirected;
Expand All @@ -48,7 +48,7 @@ public class GPXExtension {
/**
* Creates an undirected candidate for a real node.
*/
public GPXExtension(GPXEntry entry, QueryResult queryResult) {
public Candidate(GPXEntry entry, QueryResult queryResult) {
this.entry = entry;
this.queryResult = queryResult;
this.isDirected = false;
Expand All @@ -59,7 +59,7 @@ public GPXExtension(GPXEntry entry, QueryResult queryResult) {
/**
* Creates a directed candidate for a virtual node.
*/
public GPXExtension(GPXEntry entry, QueryResult queryResult,
public Candidate(GPXEntry entry, QueryResult queryResult,
VirtualEdgeIteratorState incomingVirtualEdge,
VirtualEdgeIteratorState outgoingVirtualEdge) {
this.entry = entry;
Expand Down

This file was deleted.

25 changes: 14 additions & 11 deletions matching-core/src/main/java/com/graphhopper/matching/GPXFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class GPXFile {
static final String DATE_FORMAT_Z_MS = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
private final List<GPXEntry> entries;
private boolean includeElevation = false;
private InstructionList instructions;
private List<InstructionList> instructions;

public GPXFile() {
entries = new ArrayList<GPXEntry>();
Expand All @@ -61,14 +61,14 @@ public GPXFile(List<GPXEntry> entries) {
this.entries = entries;
}

public GPXFile(MatchResult mr, InstructionList il) {
public GPXFile(MatchResult mr, List<InstructionList> il) {
this.instructions = il;
this.entries = new ArrayList<GPXEntry>(mr.getEdgeMatches().size());
// TODO fetch time from GPX or from calculated route?
long time = 0;
for (int emIndex = 0; emIndex < mr.getEdgeMatches().size(); emIndex++) {
EdgeMatch em = mr.getEdgeMatches().get(emIndex);
PointList pl = em.getEdgeState().fetchWayGeometry(emIndex == 0 ? 3 : 2);
MatchEdge em = mr.getEdgeMatches().get(emIndex);
PointList pl = em.edge.fetchWayGeometry(emIndex == 0 ? 3 : 2);
if (pl.is3D()) {
includeElevation = true;
}
Expand Down Expand Up @@ -198,17 +198,20 @@ public String createString() {
StringBuilder gpxOutput = new StringBuilder(header);
gpxOutput.append("\n<trk><name>").append("GraphHopper MapMatching").append("</name>");

// TODO: is this correct? how do we know there's a 'gap' in the instructions i.e. multiple
// sequences? Do instructions only make sense for a single sequence?
if (instructions != null && !instructions.isEmpty()) {
gpxOutput.append("\n<rte>");
Instruction nextInstr = null;
for (Instruction currInstr : instructions) {
if (null != nextInstr) {
instructions.createRteptBlock(gpxOutput, nextInstr, currInstr);
for (InstructionList instr: instructions) {
Instruction nextInstr = null;
for (Instruction currInstr : instr) {
if (null != nextInstr) {
instr.createRteptBlock(gpxOutput, nextInstr, currInstr);
}
nextInstr = currInstr;
}

nextInstr = currInstr;
instr.createRteptBlock(gpxOutput, nextInstr, null);
}
instructions.createRteptBlock(gpxOutput, nextInstr, null);
gpxOutput.append("\n</rte>");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.graphhopper.matching;

import com.graphhopper.util.GPXEntry;

public class GPXMapping {
public final GPXEntry originalGPXEntry;
public final int matchEdgeIdx;
public final boolean isNeighbor;
public final int neighborIdx;
public final MatchEntry matchEntry;
public GPXMapping(GPXEntry originalGPXEntry, MatchEntry matchEntry, int matchEdgeIdx, boolean isNeighbor, int neighborIdx) {
this.originalGPXEntry = originalGPXEntry;
this.matchEdgeIdx = matchEdgeIdx;
this.isNeighbor = isNeighbor;
this.neighborIdx = neighborIdx;
this.matchEntry = matchEntry;
}
}
Loading