fixed rounding bug in locus/orux waypoint reading
This commit is contained in:
parent
037ab7d734
commit
cd8082f2b2
4 changed files with 26 additions and 10 deletions
|
@ -163,7 +163,7 @@ public final class OsmTrack
|
|||
dos.close();
|
||||
}
|
||||
|
||||
public static OsmTrack readBinary( String filename, OsmNodeNamed newEp, long[] nogoChecksums )
|
||||
public static OsmTrack readBinary( String filename, OsmNodeNamed newEp, long[] nogoChecksums, StringBuilder debugInfo )
|
||||
{
|
||||
OsmTrack t = null;
|
||||
if ( filename != null )
|
||||
|
@ -211,6 +211,11 @@ public final class OsmTrack
|
|||
boolean nogoCheckOk = Math.abs( al[0] - nogoChecksums[0] ) <= 20
|
||||
&& Math.abs( al[1] - nogoChecksums[1] ) <= 20
|
||||
&& Math.abs( al[2] - nogoChecksums[2] ) <= 20;
|
||||
|
||||
if ( debugInfo != null )
|
||||
{
|
||||
debugInfo.append( "target-delta = " + dlon + "/" + dlat + " nogoCheckOk=" + nogoCheckOk );
|
||||
}
|
||||
if ( !nogoCheckOk ) return null;
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
@ -295,18 +295,29 @@ public class RoutingEngine extends Thread
|
|||
OsmTrack totaltrack = new OsmTrack();
|
||||
int nUnmatched = waypoints.size();
|
||||
|
||||
if ( hasInfo() )
|
||||
{
|
||||
for( OsmNodeNamed wp : waypoints )
|
||||
{
|
||||
logInfo( "wp=" + wp );
|
||||
}
|
||||
}
|
||||
|
||||
// check for a track for that target
|
||||
OsmTrack nearbyTrack = null;
|
||||
if ( refTracks[waypoints.size()-2] == null )
|
||||
{
|
||||
nearbyTrack = OsmTrack.readBinary( routingContext.rawTrackPath, waypoints.get( waypoints.size()-1), routingContext.getNogoChecksums() );
|
||||
StringBuilder debugInfo = hasInfo() ? new StringBuilder() : null;
|
||||
nearbyTrack = OsmTrack.readBinary( routingContext.rawTrackPath, waypoints.get( waypoints.size()-1), routingContext.getNogoChecksums(), debugInfo );
|
||||
if ( nearbyTrack != null )
|
||||
{
|
||||
nUnmatched--;
|
||||
}
|
||||
if ( hasInfo() )
|
||||
{
|
||||
logInfo( "read referenceTrack, dirty=" + nearbyTrack.isDirty );
|
||||
}
|
||||
nUnmatched--;
|
||||
boolean found = nearbyTrack != null;
|
||||
boolean dirty = found ? nearbyTrack.isDirty : false;
|
||||
logInfo( "read referenceTrack, found=" + found + " dirty=" + dirty + " " + debugInfo );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,8 +51,8 @@ public class CoordinateReaderLocus extends CoordinateReader
|
|||
OsmNodeNamed n = new OsmNodeNamed();
|
||||
String category = c.getString(0);
|
||||
n.name = c.getString(1);
|
||||
n.ilon = (int)( ( Double.parseDouble( c.getString(2) ) + 180. )*1000000. + 0.5);
|
||||
n.ilat = (int)( ( Double.parseDouble( c.getString(3) ) + 90. )*1000000. + 0.5);
|
||||
n.ilon = (int)( ( c.getDouble(2) + 180. )*1000000. + 0.5);
|
||||
n.ilat = (int)( ( c.getDouble(3) + 90. )*1000000. + 0.5);
|
||||
checkAddPoint( category, n );
|
||||
}
|
||||
myDataBase.close();
|
||||
|
|
|
@ -49,8 +49,8 @@ public class CoordinateReaderOrux extends CoordinateReader
|
|||
{
|
||||
OsmNodeNamed n = new OsmNodeNamed();
|
||||
n.name = c.getString(0);
|
||||
n.ilon = (int)( ( Double.parseDouble( c.getString(1) ) + 180. )*1000000. + 0.5);
|
||||
n.ilat = (int)( ( Double.parseDouble( c.getString(2) ) + 90. )*1000000. + 0.5);
|
||||
n.ilon = (int)( ( c.getDouble(1) + 180. )*1000000. + 0.5);
|
||||
n.ilat = (int)( ( c.getDouble(2) + 90. )*1000000. + 0.5);
|
||||
String category = c.getString(3);
|
||||
checkAddPoint( category, n );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue