reworked csv-listing
This commit is contained in:
parent
65d150fd43
commit
1ee41026c1
@ -98,6 +98,8 @@ final class OsmPath implements OsmLinkHolder
|
|||||||
int linkdist = 0;
|
int linkdist = 0;
|
||||||
int linkelevationcost = 0;
|
int linkelevationcost = 0;
|
||||||
int linkturncost = 0;
|
int linkturncost = 0;
|
||||||
|
int linknodecost = 0;
|
||||||
|
int linkinitcost = 0;
|
||||||
|
|
||||||
OsmTransferNode transferNode = link.decodeFirsttransfer();
|
OsmTransferNode transferNode = link.decodeFirsttransfer();
|
||||||
OsmNode targetNode = link.targetNode;
|
OsmNode targetNode = link.targetNode;
|
||||||
@ -139,6 +141,8 @@ final class OsmPath implements OsmLinkHolder
|
|||||||
linkdist = 0;
|
linkdist = 0;
|
||||||
linkelevationcost = 0;
|
linkelevationcost = 0;
|
||||||
linkturncost = 0;
|
linkturncost = 0;
|
||||||
|
linknodecost = 0;
|
||||||
|
linkinitcost = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dist = rc.calcDistance( lon1, lat1, lon2, lat2 );
|
int dist = rc.calcDistance( lon1, lat1, lon2, lat2 );
|
||||||
@ -176,7 +180,7 @@ final class OsmPath implements OsmLinkHolder
|
|||||||
linkdisttotal += dist;
|
linkdisttotal += dist;
|
||||||
|
|
||||||
|
|
||||||
// *** penalty for way-change
|
// *** penalty for turning angles
|
||||||
if ( origin.originElement != null )
|
if ( origin.originElement != null )
|
||||||
{
|
{
|
||||||
// penalty proportional to direction change
|
// penalty proportional to direction change
|
||||||
@ -283,6 +287,7 @@ final class OsmPath implements OsmLinkHolder
|
|||||||
lastCostfactor = newcostfactor;
|
lastCostfactor = newcostfactor;
|
||||||
float initialcost = rc.expctxWay.getInitialcost();
|
float initialcost = rc.expctxWay.getInitialcost();
|
||||||
int iicost = (int)initialcost;
|
int iicost = (int)initialcost;
|
||||||
|
linkinitcost += iicost;
|
||||||
cost += iicost;
|
cost += iicost;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,7 +301,9 @@ final class OsmPath implements OsmLinkHolder
|
|||||||
+ iCost + "\t"
|
+ iCost + "\t"
|
||||||
+ linkelevationcost
|
+ linkelevationcost
|
||||||
+ "\t" + linkturncost
|
+ "\t" + linkturncost
|
||||||
+ rc.expctxWay.getCsvDescription( link.counterLinkWritten, description );
|
+ "\t" + linknodecost
|
||||||
|
+ "\t" + linkinitcost
|
||||||
|
+ rc.expctxWay.getKeyValueDescription( link.counterLinkWritten, description );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( stopAtEndpoint )
|
if ( stopAtEndpoint )
|
||||||
@ -305,6 +312,7 @@ final class OsmPath implements OsmLinkHolder
|
|||||||
{
|
{
|
||||||
originElement = new OsmPathElement( rc.ilonshortest, rc.ilatshortest, ele2, originElement );
|
originElement = new OsmPathElement( rc.ilonshortest, rc.ilatshortest, ele2, originElement );
|
||||||
originElement.cost = cost;
|
originElement.cost = cost;
|
||||||
|
originElement.message = lastMessage;
|
||||||
}
|
}
|
||||||
if ( rc.nogomatch )
|
if ( rc.nogomatch )
|
||||||
{
|
{
|
||||||
@ -359,6 +367,7 @@ final class OsmPath implements OsmLinkHolder
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int iicost = (int)initialcost;
|
int iicost = (int)initialcost;
|
||||||
|
linknodecost += iicost;
|
||||||
cost += iicost;
|
cost += iicost;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -349,11 +349,7 @@ public final class OsmTrack
|
|||||||
{
|
{
|
||||||
// csv-header-line
|
// csv-header-line
|
||||||
|
|
||||||
String header = "Longitude\tLatitude\tElevation\tDistance\tCostPerKm\tElevCost\tTurnCost";
|
String header = "Longitude\tLatitude\tElevation\tDistance\tCostPerKm\tElevCost\tTurnCost\tNodeCost\tInitialCost\tOsmTags";
|
||||||
if ( rc.expctxWay != null )
|
|
||||||
{
|
|
||||||
header += rc.expctxWay.getCsvHeader();
|
|
||||||
}
|
|
||||||
dumpLine( bw, header );
|
dumpLine( bw, header );
|
||||||
for( OsmPathElement n : nodes )
|
for( OsmPathElement n : nodes )
|
||||||
{
|
{
|
||||||
|
|||||||
@ -166,7 +166,7 @@ public final class BExpressionContext
|
|||||||
decode( ld2, ab );
|
decode( ld2, ab );
|
||||||
for( int inum = 0; inum < lookupValues.size(); inum++ ) // loop over lookup names
|
for( int inum = 0; inum < lookupValues.size(); inum++ ) // loop over lookup names
|
||||||
{
|
{
|
||||||
if ( ld2[inum] != ld[inum] ) throw new RuntimeException( "assertion failed encoding " + getKeyValueDescription(ab) );
|
if ( ld2[inum] != ld[inum] ) throw new RuntimeException( "assertion failed encoding " + getKeyValueDescription(false, ab) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return ab;
|
return ab;
|
||||||
@ -273,7 +273,7 @@ public final class BExpressionContext
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCsvDescription( boolean inverseDirection, byte[] ab )
|
public String getKeyValueDescription( boolean inverseDirection, byte[] ab )
|
||||||
{
|
{
|
||||||
int inverseBitByteIndex = meta.readVarLength ? 0 : 7;
|
int inverseBitByteIndex = meta.readVarLength ? 0 : 7;
|
||||||
int abLen = ab.length;
|
int abLen = ab.length;
|
||||||
@ -285,41 +285,16 @@ public final class BExpressionContext
|
|||||||
decode( lookupData, ab_copy );
|
decode( lookupData, ab_copy );
|
||||||
for( int inum = 0; inum < lookupValues.size(); inum++ ) // loop over lookup names
|
for( int inum = 0; inum < lookupValues.size(); inum++ ) // loop over lookup names
|
||||||
{
|
{
|
||||||
int idx = meta.readVarLength ? (inum+1)%lookupValues.size() : inum; // reversebit at the end..
|
BExpressionLookupValue[] va = lookupValues.get(inum);
|
||||||
|
String value = va[lookupData[inum]].toString();
|
||||||
BExpressionLookupValue[] va = lookupValues.get(idx);
|
if ( value != null && value.length() > 0 )
|
||||||
sb.append( '\t' ).append( va[lookupData[idx]].toString() );
|
{
|
||||||
|
sb.append( " " + lookupNames.get( inum ) + "=" + value );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCsvHeader()
|
|
||||||
{
|
|
||||||
StringBuilder sb = new StringBuilder( 200 );
|
|
||||||
for( int inum = 0; inum < lookupNames.size(); inum++ ) // loop over lookup names
|
|
||||||
{
|
|
||||||
int idx = meta.readVarLength ? (inum+1)%lookupValues.size() : inum; // reversebit at the end..
|
|
||||||
sb.append( '\t' ).append( lookupNames.get(idx) );
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getKeyValueDescription( byte[] ab )
|
|
||||||
{
|
|
||||||
StringBuilder sb = new StringBuilder( 200 );
|
|
||||||
decode( lookupData, ab );
|
|
||||||
for( int inum = 0; inum < lookupValues.size(); inum++ ) // loop over lookup names
|
|
||||||
{
|
|
||||||
BExpressionLookupValue[] va = lookupValues.get(inum);
|
|
||||||
String value = va[lookupData[inum]].toString();
|
|
||||||
if ( value != null && value.length() > 0 )
|
|
||||||
{
|
|
||||||
sb.append( " " + lookupNames.get( inum ) + "=" + value );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private int parsedLines = 0;
|
private int parsedLines = 0;
|
||||||
private boolean fixTagsWritten = false;
|
private boolean fixTagsWritten = false;
|
||||||
|
|
||||||
|
|||||||
@ -131,7 +131,7 @@ public class RelationMerger extends MapCreatorBase
|
|||||||
expctxCheck.evaluate( false, data.description, null );
|
expctxCheck.evaluate( false, data.description, null );
|
||||||
ok = expctxCheck.getCostfactor() < 10000.;
|
ok = expctxCheck.getCostfactor() < 10000.;
|
||||||
|
|
||||||
System.out.println( "** relation access conflict for wid = " + data.wid + " tags:" + expctxReport.getKeyValueDescription( data.description ) + " (ok=" + ok + ")" );
|
System.out.println( "** relation access conflict for wid = " + data.wid + " tags:" + expctxReport.getKeyValueDescription( false, data.description ) + " (ok=" + ok + ")" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ok )
|
if ( ok )
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user