fixed rounding bug in locus/orux waypoint reading

This commit is contained in:
Arndt 2016-05-21 08:09:19 +02:00
parent 037ab7d734
commit cd8082f2b2
4 changed files with 26 additions and 10 deletions

View file

@ -163,7 +163,7 @@ public final class OsmTrack
dos.close(); 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; OsmTrack t = null;
if ( filename != null ) if ( filename != null )
@ -211,6 +211,11 @@ public final class OsmTrack
boolean nogoCheckOk = Math.abs( al[0] - nogoChecksums[0] ) <= 20 boolean nogoCheckOk = Math.abs( al[0] - nogoChecksums[0] ) <= 20
&& Math.abs( al[1] - nogoChecksums[1] ) <= 20 && Math.abs( al[1] - nogoChecksums[1] ) <= 20
&& Math.abs( al[2] - nogoChecksums[2] ) <= 20; && Math.abs( al[2] - nogoChecksums[2] ) <= 20;
if ( debugInfo != null )
{
debugInfo.append( "target-delta = " + dlon + "/" + dlat + " nogoCheckOk=" + nogoCheckOk );
}
if ( !nogoCheckOk ) return null; if ( !nogoCheckOk ) return null;
} }
catch (Exception e) catch (Exception e)

View file

@ -295,18 +295,29 @@ public class RoutingEngine extends Thread
OsmTrack totaltrack = new OsmTrack(); OsmTrack totaltrack = new OsmTrack();
int nUnmatched = waypoints.size(); int nUnmatched = waypoints.size();
if ( hasInfo() )
{
for( OsmNodeNamed wp : waypoints )
{
logInfo( "wp=" + wp );
}
}
// check for a track for that target // check for a track for that target
OsmTrack nearbyTrack = null; OsmTrack nearbyTrack = null;
if ( refTracks[waypoints.size()-2] == 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 ) if ( nearbyTrack != null )
{ {
nUnmatched--;
}
if ( hasInfo() ) if ( hasInfo() )
{ {
logInfo( "read referenceTrack, dirty=" + nearbyTrack.isDirty ); boolean found = nearbyTrack != null;
} boolean dirty = found ? nearbyTrack.isDirty : false;
nUnmatched--; logInfo( "read referenceTrack, found=" + found + " dirty=" + dirty + " " + debugInfo );
} }
} }

View file

@ -51,8 +51,8 @@ public class CoordinateReaderLocus extends CoordinateReader
OsmNodeNamed n = new OsmNodeNamed(); OsmNodeNamed n = new OsmNodeNamed();
String category = c.getString(0); String category = c.getString(0);
n.name = c.getString(1); n.name = c.getString(1);
n.ilon = (int)( ( Double.parseDouble( c.getString(2) ) + 180. )*1000000. + 0.5); n.ilon = (int)( ( c.getDouble(2) + 180. )*1000000. + 0.5);
n.ilat = (int)( ( Double.parseDouble( c.getString(3) ) + 90. )*1000000. + 0.5); n.ilat = (int)( ( c.getDouble(3) + 90. )*1000000. + 0.5);
checkAddPoint( category, n ); checkAddPoint( category, n );
} }
myDataBase.close(); myDataBase.close();

View file

@ -49,8 +49,8 @@ public class CoordinateReaderOrux extends CoordinateReader
{ {
OsmNodeNamed n = new OsmNodeNamed(); OsmNodeNamed n = new OsmNodeNamed();
n.name = c.getString(0); n.name = c.getString(0);
n.ilon = (int)( ( Double.parseDouble( c.getString(1) ) + 180. )*1000000. + 0.5); n.ilon = (int)( ( c.getDouble(1) + 180. )*1000000. + 0.5);
n.ilat = (int)( ( Double.parseDouble( c.getString(2) ) + 90. )*1000000. + 0.5); n.ilat = (int)( ( c.getDouble(2) + 90. )*1000000. + 0.5);
String category = c.getString(3); String category = c.getString(3);
checkAddPoint( category, n ); checkAddPoint( category, n );
} }