voice hints in json

This commit is contained in:
Arndt Brenschede 2018-12-31 16:52:26 +01:00
parent 68aebed3a5
commit a9e8731b3e
2 changed files with 17 additions and 0 deletions

View file

@ -563,6 +563,13 @@ public final class OsmTrack
sb.append( " \"total-time\": \"" ).append( getTotalSeconds() ).append( "\",\n" ); sb.append( " \"total-time\": \"" ).append( getTotalSeconds() ).append( "\",\n" );
sb.append( " \"total-energy\": \"" ).append( energy ).append( "\",\n" ); sb.append( " \"total-energy\": \"" ).append( energy ).append( "\",\n" );
sb.append( " \"cost\": \"" ).append( cost ).append( "\",\n" ); sb.append( " \"cost\": \"" ).append( cost ).append( "\",\n" );
sb.append( " \"voicehints\": [\n" );
for( VoiceHint hint: voiceHints.list )
{
sb.append( " [" ).append( hint.indexInTrack ).append( ',' ).append( hint.getCommand() ).append( ',' ).append( hint.getExitNumber() ).append( "],\n" );
}
sb.deleteCharAt( sb.lastIndexOf( "," ) );
sb.append( " ],\n" );
sb.append( " \"messages\": [\n" ); sb.append( " \"messages\": [\n" );
sb.append( " [\"" ).append( MESSAGES_HEADER.replaceAll( "\t", "\", \"" ) ).append( "\"],\n" ); sb.append( " [\"" ).append( MESSAGES_HEADER.replaceAll( "\t", "\", \"" ) ).append( "\"],\n" );
for ( String m : aggregateMessages() ) for ( String m : aggregateMessages() )

View file

@ -65,6 +65,16 @@ public class VoiceHint
badWays.add( badWay ); badWays.add( badWay );
} }
public int getCommand()
{
return cmd;
}
public int getExitNumber()
{
return roundaboutExit;
}
public String getCommandString() public String getCommandString()
{ {
switch ( cmd ) switch ( cmd )