-
Notifications
You must be signed in to change notification settings - Fork 273
WIP: handling viterbi breaks as multiple sequences #87
Changes from 1 commit
2c1a010
d979ffd
6b856f1
ade4037
4b24cbc
5832623
b6c3af4
c0e5574
2d184a2
791e53c
eed78bf
ac105e7
d6bf213
4e217d0
f629883
9e6cc60
9d6f84b
7f45557
4a7420a
13707e1
efb7b57
956e7d0
1dd88e8
56df0ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,80 @@ | ||
/* | ||
* Licensed to GraphHopper GmbH under one or more contributor | ||
* license agreements. See the NOTICE file distributed with this work for | ||
* additional information regarding copyright ownership. | ||
* | ||
* GraphHopper GmbH licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except in | ||
* compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.graphhopper.matching; | ||
|
||
import java.util.List; | ||
|
||
import com.bmw.hmm.SequenceState; | ||
import com.graphhopper.matching.util.TimeStep; | ||
import com.graphhopper.routing.Path; | ||
import com.graphhopper.util.EdgeIteratorState; | ||
import com.graphhopper.util.GPXEntry; | ||
import com.graphhopper.util.shapes.GHPoint3D; | ||
|
||
public class MatchEntry { | ||
public final int sequenceIdx; | ||
public static enum MatchState { MATCHING_NOT_STARTED, NOT_USED_FOR_MATCHING, MATCHED }; | ||
private MatchState matchState = MatchState.MATCHING_NOT_STARTED; | ||
public final GPXEntry gpxEntry; | ||
public final List<GPXEntry> neighboringGpxEntries; | ||
public final GHPoint3D point; | ||
public final EdgeIteratorState directedRealEdge; | ||
public final int sequenceMatchEdgeIdx; | ||
public final double distanceAlongRealEdge; | ||
public MatchEntry(int sequenceIdx, SequenceState<GPXExtension, GPXEntry, Path> matchStep, TimeStep timeStep, EdgeIteratorState directedRealEdge, int sequenceMatchEdgeIdx, double distanceAlongRealEdge) { | ||
private int sequenceIdx; | ||
private GHPoint3D snappedPoint; | ||
private EdgeIteratorState directedRealEdge; | ||
private int sequenceMatchEdgeIdx; | ||
private double distanceAlongRealEdge; | ||
private boolean locked = false; | ||
|
||
protected MatchEntry(GPXEntry gpxEntry) { | ||
this.gpxEntry = gpxEntry; | ||
} | ||
|
||
protected void markAsNotUsedForMatching() { | ||
assert !locked; | ||
this.matchState = MatchState.NOT_USED_FOR_MATCHING; | ||
locked = true; | ||
} | ||
|
||
protected void saveMatchingState(int sequenceIdx, int sequenceMatchEdgeIdx, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See below. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The method is called externally (e.g. here) and I don't want it to be available to users - I could be missing something, but isn't this the purpose of 'protected'? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case you should use package-private (no modifier) instead of protected. Protected should only be used if you plan to access the method in derived classes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry about that, and thanks for pointing it out. |
||
EdgeIteratorState directedRealEdge, double distanceAlongRealEdge, | ||
GHPoint3D snappedPoint) { | ||
assert !locked; | ||
this.sequenceIdx = sequenceIdx; | ||
this.gpxEntry = matchStep.observation; | ||
this.point = matchStep.state.getQueryResult().getSnappedPoint(); | ||
this.sequenceMatchEdgeIdx = sequenceMatchEdgeIdx; | ||
this.directedRealEdge = directedRealEdge; | ||
this.distanceAlongRealEdge = distanceAlongRealEdge; | ||
this.neighboringGpxEntries = timeStep.getNeighboringEntries(); | ||
this.snappedPoint = snappedPoint; | ||
locked = true; | ||
} | ||
|
||
public MatchState getMatchState() { | ||
return matchState; | ||
} | ||
|
||
public int getSequenceIdx() { | ||
return sequenceIdx; | ||
} | ||
|
||
public GHPoint3D getSnappedPoint() { | ||
return snappedPoint; | ||
} | ||
|
||
public EdgeIteratorState getDirectedRealEdge() { | ||
return directedRealEdge; | ||
} | ||
|
||
public int getSequenceMatchEdgeIdx() { | ||
return sequenceMatchEdgeIdx; | ||
} | ||
|
||
public double getDistanceAlongRealEdge() { | ||
return distanceAlongRealEdge; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this protected, do you plan to inherit from this class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.