routino-3.0/ 40755 233 144 0 12575040001 6201 5 routino-3.0/src/ 40755 233 144 0 12575036710 7004 5 routino-3.0/src/nodesx.h 644 233 144 12730 12550012612 10500 0 /***************************************
A header file for the extended nodes.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2008-2015 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#ifndef NODESX_H
#define NODESX_H /*+ To stop multiple inclusions. +*/
#include
#include "types.h"
#include "nodes.h"
#include "typesx.h"
#include "cache.h"
#include "files.h"
/* Data structures */
/*+ An extended structure used for processing. +*/
struct _NodeX
{
node_t id; /*+ The node identifier; initially the OSM value, later the Node index, finally the first segment. +*/
latlong_t latitude; /*+ The node latitude. +*/
latlong_t longitude; /*+ The node longitude. +*/
transports_t allow; /*+ The node allowed traffic. +*/
nodeflags_t flags; /*+ The node flags. +*/
};
/*+ A structure containing a set of nodes (memory format). +*/
struct _NodesX
{
char *filename; /*+ The name of the intermediate file (for the NodesX). +*/
char *filename_tmp; /*+ The name of the temporary file (for the NodesX). +*/
int fd; /*+ The file descriptor of the open file (for the NodesX). +*/
index_t number; /*+ The number of extended nodes still being considered. +*/
index_t knumber; /*+ The number of extended nodes kept for next time. +*/
#if !SLIM
NodeX *data; /*+ The extended node data (when mapped into memory). +*/
#else
NodeX cached[3]; /*+ Three cached extended nodes read from the file in slim mode. +*/
index_t incache[3]; /*+ The indexes of the cached extended nodes. +*/
NodeXCache *cache; /*+ A RAM cache of extended nodes read from the file. +*/
#endif
node_t *idata; /*+ The extended node IDs (sorted by ID). +*/
index_t *pdata; /*+ The node indexes after pruning. +*/
index_t *gdata; /*+ The final node indexes (sorted geographically). +*/
BitMask *super; /*+ A bit-mask marker for super nodes (same order as sorted nodes). +*/
index_t latbins; /*+ The number of bins containing latitude. +*/
index_t lonbins; /*+ The number of bins containing longitude. +*/
ll_bin_t latzero; /*+ The bin number of the furthest south bin. +*/
ll_bin_t lonzero; /*+ The bin number of the furthest west bin. +*/
};
/* Functions in nodesx.c */
NodesX *NewNodeList(int append,int readonly);
void FreeNodeList(NodesX *nodesx,int keep);
void AppendNodeList(NodesX *nodesx,node_t id,double latitude,double longitude,transports_t allow,nodeflags_t flags);
void FinishNodeList(NodesX *nodesx);
index_t IndexNodeX(NodesX *nodesx,node_t id);
void SortNodeList(NodesX *nodesx);
void RemoveNonHighwayNodes(NodesX *nodesx,WaysX *waysx,int keep);
void RemovePrunedNodes(NodesX *nodesx,SegmentsX *segmentsx);
void SortNodeListGeographically(NodesX *nodesx);
void SaveNodeList(NodesX *nodesx,const char *filename,SegmentsX *segmentsx);
/* Macros and inline functions */
#if !SLIM
#define LookupNodeX(nodesx,index,position) &(nodesx)->data[index]
#define PutBackNodeX(nodesx,nodex) while(0) { /* nop */ }
#else
/* Prototypes */
static inline NodeX *LookupNodeX(NodesX *nodesx,index_t index,int position);
static inline void PutBackNodeX(NodesX *nodesx,NodeX *nodex);
CACHE_NEWCACHE_PROTO(NodeX)
CACHE_DELETECACHE_PROTO(NodeX)
CACHE_FETCHCACHE_PROTO(NodeX)
CACHE_REPLACECACHE_PROTO(NodeX)
CACHE_INVALIDATECACHE_PROTO(NodeX)
/* Data type */
CACHE_STRUCTURE(NodeX)
/* Inline functions */
CACHE_NEWCACHE(NodeX)
CACHE_DELETECACHE(NodeX)
CACHE_FETCHCACHE(NodeX)
CACHE_REPLACECACHE(NodeX)
CACHE_INVALIDATECACHE(NodeX)
/*++++++++++++++++++++++++++++++++++++++
Lookup a particular extended node with the specified id from the file on disk.
NodeX *LookupNodeX Returns a pointer to a cached copy of the extended node.
NodesX *nodesx The set of nodes to use.
index_t index The node index to look for.
int position The position in the cache to use.
++++++++++++++++++++++++++++++++++++++*/
static inline NodeX *LookupNodeX(NodesX *nodesx,index_t index,int position)
{
nodesx->cached[position-1]=*FetchCachedNodeX(nodesx->cache,index,nodesx->fd,0);
nodesx->incache[position-1]=index;
return(&nodesx->cached[position-1]);
}
/*++++++++++++++++++++++++++++++++++++++
Put back an extended node's data into the file on disk.
NodesX *nodesx The set of nodes to modify.
NodeX *nodex The extended node to be put back.
++++++++++++++++++++++++++++++++++++++*/
static inline void PutBackNodeX(NodesX *nodesx,NodeX *nodex)
{
int position1=nodex-&nodesx->cached[0];
ReplaceCachedNodeX(nodesx->cache,nodex,nodesx->incache[position1],nodesx->fd,0);
}
#endif /* SLIM */
#endif /* NODESX_H */
routino-3.0/src/nodes.h 644 233 144 12404 12550223461 10314 0 /***************************************
A header file for the nodes.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2008-2015 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#ifndef NODES_H
#define NODES_H /*+ To stop multiple inclusions. +*/
#include
#include
#include "types.h"
#include "cache.h"
#include "files.h"
#include "profiles.h"
/* Data structures */
/*+ A structure containing a single node. +*/
struct _Node
{
index_t firstseg; /*+ The index of the first segment. +*/
ll_off_t latoffset; /*+ The node latitude offset within its bin. +*/
ll_off_t lonoffset; /*+ The node longitude offset within its bin. +*/
transports_t allow; /*+ The types of transport that are allowed through the node. +*/
nodeflags_t flags; /*+ Flags containing extra information (e.g. super-node, turn restriction). +*/
};
/*+ A structure containing the header from the file. +*/
typedef struct _NodesFile
{
index_t number; /*+ The number of nodes in total. +*/
index_t snumber; /*+ The number of super-nodes. +*/
ll_bin_t latbins; /*+ The number of bins containing latitude. +*/
ll_bin_t lonbins; /*+ The number of bins containing longitude. +*/
ll_bin_t latzero; /*+ The bin number of the furthest south bin. +*/
ll_bin_t lonzero; /*+ The bin number of the furthest west bin. +*/
}
NodesFile;
/*+ A structure containing a set of nodes. +*/
struct _Nodes
{
NodesFile file; /*+ The header data from the file. +*/
#if !SLIM
char *data; /*+ The memory mapped data in the file. +*/
index_t *offsets; /*+ A pointer to the array of offsets in the file. +*/
Node *nodes; /*+ A pointer to the array of nodes in the file. +*/
#else
int fd; /*+ The file descriptor for the file. +*/
index_t *offsets; /*+ An allocated array with a copy of the file offsets. +*/
offset_t nodesoffset; /*+ The offset of the nodes within the file. +*/
Node cached[6]; /*+ Some cached nodes read from the file in slim mode. +*/
NodeCache *cache; /*+ A RAM cache of nodes read from the file. +*/
#endif
};
/* Functions in nodes.c */
Nodes *LoadNodeList(const char *filename);
void DestroyNodeList(Nodes *nodes);
index_t FindClosestNode(Nodes *nodes,Segments *segments,Ways *ways,double latitude,double longitude,
distance_t distance,Profile *profile,distance_t *bestdist);
index_t FindClosestSegment(Nodes *nodes,Segments *segments,Ways *ways,double latitude,double longitude,
distance_t distance,Profile *profile, distance_t *bestdist,
index_t *bestnode1,index_t *bestnode2,distance_t *bestdist1,distance_t *bestdist2);
void GetLatLong(Nodes *nodes,index_t index,Node *nodep,double *latitude,double *longitude);
/* Macros and inline functions */
/*+ Return true if this is a super-node. +*/
#define IsSuperNode(xxx) (((xxx)->flags)&NODE_SUPER)
/*+ Return true if this is a turn restricted node. +*/
#define IsTurnRestrictedNode(xxx) (((xxx)->flags)&NODE_TURNRSTRCT)
/*+ Return a Segment index given a Node pointer and a set of segments. +*/
#define FirstSegment(xxx,yyy,ppp) LookupSegment((xxx),(yyy)->firstseg,ppp)
/*+ Return the offset of a geographical region given a set of nodes. +*/
#define LookupNodeOffset(xxx,yyy) ((xxx)->offsets[yyy])
#if !SLIM
/*+ Return a Node pointer given a set of nodes and an index. +*/
#define LookupNode(xxx,yyy,ppp) (&(xxx)->nodes[yyy])
#else
/* Prototypes */
static inline Node *LookupNode(Nodes *nodes,index_t index,int position);
CACHE_NEWCACHE_PROTO(Node)
CACHE_DELETECACHE_PROTO(Node)
CACHE_FETCHCACHE_PROTO(Node)
CACHE_INVALIDATECACHE_PROTO(Node)
/* Data type */
CACHE_STRUCTURE(Node)
/* Inline functions */
CACHE_NEWCACHE(Node)
CACHE_DELETECACHE(Node)
CACHE_FETCHCACHE(Node)
CACHE_INVALIDATECACHE(Node)
/*++++++++++++++++++++++++++++++++++++++
Find the Node information for a particular node.
Node *LookupNode Returns a pointer to the cached node information.
Nodes *nodes The set of nodes to use.
index_t index The index of the node.
int position The position in the cache to store the value.
++++++++++++++++++++++++++++++++++++++*/
static inline Node *LookupNode(Nodes *nodes,index_t index,int position)
{
nodes->cached[position-1]=*FetchCachedNode(nodes->cache,index,nodes->fd,nodes->nodesoffset);
return(&nodes->cached[position-1]);
}
#endif
#endif /* NODES_H */
routino-3.0/src/queue.c 644 233 144 12331 12167322456 10332 0 /***************************************
Queue data type functions.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2008-2013 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#include
#include
#include "results.h"
/*+ A queue of results. +*/
struct _Queue
{
int nincrement; /*+ The amount to increment the queue when full. +*/
int nallocated; /*+ The number of entries allocated. +*/
int noccupied; /*+ The number of entries occupied. +*/
Result **results; /*+ The queue of pointers to results. +*/
};
/*++++++++++++++++++++++++++++++++++++++
Allocate a new queue.
Queue *NewQueueList Returns the queue.
uint8_t log2bins The base 2 logarithm of the initial number of bins in the queue.
++++++++++++++++++++++++++++++++++++++*/
Queue *NewQueueList(uint8_t log2bins)
{
Queue *queue;
queue=(Queue*)malloc(sizeof(Queue));
queue->nincrement=1<nallocated=queue->nincrement;
queue->noccupied=0;
queue->results=(Result**)malloc(queue->nallocated*sizeof(Result*));
return(queue);
}
/*++++++++++++++++++++++++++++++++++++++
Re-use an existing queue.
Queue *queue The queue to reset for re-use.
++++++++++++++++++++++++++++++++++++++*/
void ResetQueueList(Queue *queue)
{
queue->noccupied=0;
}
/*++++++++++++++++++++++++++++++++++++++
Free a queue.
Queue *queue The queue to be freed.
++++++++++++++++++++++++++++++++++++++*/
void FreeQueueList(Queue *queue)
{
free(queue->results);
free(queue);
}
/*++++++++++++++++++++++++++++++++++++++
Insert a new item into the queue in the right place.
The data is stored in a "Binary Heap" http://en.wikipedia.org/wiki/Binary_heap
and this operation is adding an item to the heap.
Queue *queue The queue to insert the result into.
Result *result The result to insert into the queue.
score_t score The score to use for sorting the node.
++++++++++++++++++++++++++++++++++++++*/
void InsertInQueue(Queue *queue,Result *result,score_t score)
{
int index;
if(result->queued==NOT_QUEUED)
{
queue->noccupied++;
index=queue->noccupied;
if(queue->noccupied==queue->nallocated)
{
queue->nallocated=queue->nallocated+queue->nincrement;
queue->results=(Result**)realloc((void*)queue->results,queue->nallocated*sizeof(Result*));
}
queue->results[index]=result;
queue->results[index]->queued=index;
}
else
index=result->queued;
queue->results[index]->sortby=score;
/* Bubble up the new value */
while(index>1)
{
int newindex;
Result *temp;
newindex=index/2;
if(queue->results[index]->sortby>=queue->results[newindex]->sortby)
break;
temp=queue->results[index];
queue->results[index]=queue->results[newindex];
queue->results[newindex]=temp;
queue->results[index]->queued=index;
queue->results[newindex]->queued=newindex;
index=newindex;
}
}
/*++++++++++++++++++++++++++++++++++++++
Pop an item from the front of the queue.
The data is stored in a "Binary Heap" http://en.wikipedia.org/wiki/Binary_heap
and this operation is deleting the root item from the heap.
Result *PopFromQueue Returns the top item.
Queue *queue The queue to remove the result from.
++++++++++++++++++++++++++++++++++++++*/
Result *PopFromQueue(Queue *queue)
{
int index;
Result *retval;
if(queue->noccupied==0)
return(NULL);
retval=queue->results[1];
retval->queued=NOT_QUEUED;
index=1;
queue->results[index]=queue->results[queue->noccupied];
queue->noccupied--;
/* Bubble down the newly promoted value */
while((2*index)noccupied)
{
int newindex;
Result *temp;
newindex=2*index;
if(queue->results[newindex]->sortby>queue->results[newindex+1]->sortby)
newindex=newindex+1;
if(queue->results[index]->sortby<=queue->results[newindex]->sortby)
break;
temp=queue->results[newindex];
queue->results[newindex]=queue->results[index];
queue->results[index]=temp;
queue->results[index]->queued=index;
queue->results[newindex]->queued=newindex;
index=newindex;
}
if((2*index)==queue->noccupied)
{
int newindex;
Result *temp;
newindex=2*index;
if(queue->results[index]->sortby<=queue->results[newindex]->sortby)
; /* break */
else
{
temp=queue->results[newindex];
queue->results[newindex]=queue->results[index];
queue->results[index]=temp;
queue->results[index]->queued=index;
queue->results[newindex]->queued=newindex;
}
}
return(retval);
}
routino-3.0/src/uncompress.c 644 233 144 24015 12535623410 11377 0 /***************************************
File uncompression.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2012-2015 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#include
#if defined(_MSC_VER)
#include
#define read(fd,address,length) _read(fd,address,(unsigned int)(length))
#define write(fd,address,length) _write(fd,address,(unsigned int)(length))
#define close _close
#else
#include
#endif
#include
#if defined(USE_BZIP2) && USE_BZIP2
#define BZ_NO_STDIO
#include
#endif
#if defined(USE_GZIP) && USE_GZIP
#include
#endif
#if defined(USE_XZ) && USE_XZ
#include
#endif
#include "logging.h"
#include "uncompress.h"
/* Local functions */
#if !defined(_MSC_VER) && !defined(__MINGW32__)
#if (defined(USE_BZIP2) && USE_BZIP2) || (defined(USE_GZIP) && USE_GZIP) || (defined(USE_XZ) && USE_XZ)
static int pipe_and_fork(int filefd,int *pipefd);
#endif
#if defined(USE_BZIP2) && USE_BZIP2
static void uncompress_bzip2_pipe(int filefd,int pipefd);
#endif
#if defined(USE_GZIP) && USE_GZIP
static void uncompress_gzip_pipe(int filefd,int pipefd);
#endif
#if defined(USE_XZ) && USE_XZ
static void uncompress_xz_pipe(int filefd,int pipefd);
#endif
#endif /* !defined(_MSC_VER) && !defined(__MINGW32__) */
/*++++++++++++++++++++++++++++++++++++++
Create a child process to uncompress data on a file descriptor as if it were a pipe.
int Uncompress_Bzip2 Returns the file descriptor of the uncompressed end of the pipe.
int filefd The file descriptor of the compressed end of the pipe.
++++++++++++++++++++++++++++++++++++++*/
int Uncompress_Bzip2(int filefd)
{
#if defined(USE_BZIP2) && USE_BZIP2 && !defined(_MSC_VER) && !defined(__MINGW32__)
int pipefd=-1;
if(pipe_and_fork(filefd,&pipefd))
return(pipefd);
uncompress_bzip2_pipe(filefd,pipefd);
exit(EXIT_SUCCESS);
#else /* USE_BZIP2 */
logassert(0,"No bzip2 compression support available (re-compile and try again)");
return(0);
#endif /* USE_BZIP2 */
}
/*++++++++++++++++++++++++++++++++++++++
Create a child process to uncompress data on a file descriptor as if it were a pipe.
int Uncompress_Gzip Returns the file descriptor of the uncompressed end of the pipe.
int filefd The file descriptor of the compressed end of the pipe.
++++++++++++++++++++++++++++++++++++++*/
int Uncompress_Gzip(int filefd)
{
#if defined(USE_GZIP) && USE_GZIP && !defined(_MSC_VER) && !defined(__MINGW32__)
int pipefd=-1;
if(pipe_and_fork(filefd,&pipefd))
return(pipefd);
uncompress_gzip_pipe(filefd,pipefd);
exit(EXIT_SUCCESS);
#else /* USE_GZIP */
logassert(0,"No gzip compression support available (re-compile and try again)");
return(0);
#endif /* USE_GZIP */
}
/*++++++++++++++++++++++++++++++++++++++
Create a child process to uncompress data on a file descriptor as if it were a pipe.
int Uncompress_Xz Returns the file descriptor of the uncompressed end of the pipe.
int filefd The file descriptor of the compressed end of the pipe.
++++++++++++++++++++++++++++++++++++++*/
int Uncompress_Xz(int filefd)
{
#if defined(USE_XZ) && USE_XZ && !defined(_MSC_VER) && !defined(__MINGW32__)
int pipefd=-1;
if(pipe_and_fork(filefd,&pipefd))
return(pipefd);
uncompress_xz_pipe(filefd,pipefd);
exit(EXIT_SUCCESS);
#else /* USE_XZ */
logassert(0,"No xz compression support available (re-compile and try again)");
return(0);
#endif /* USE_XZ */
}
#if !defined(_MSC_VER) && !defined(__MINGW32__)
#if (defined(USE_BZIP2) && USE_BZIP2) || (defined(USE_GZIP) && USE_GZIP) || (defined(USE_XZ) && USE_XZ)
/*++++++++++++++++++++++++++++++++++++++
Create a pipe and then fork returning in the parent and child with a different end of the pipe.
int pipe_and_fork Returns 1 for the reading (parent) end of the pipe and 0 for the writing (child) end.
int filefd The file descriptor of the file.
int *pipefd Returns the file descriptor for the end of the pipe.
++++++++++++++++++++++++++++++++++++++*/
static int pipe_and_fork(int filefd,int *pipefd)
{
int pipe_fd[2]={-1,-1};
pid_t childpid;
#define PIPE_READER 0
#define PIPE_WRITER 1
if(pipe(pipe_fd))
{
logassert(0,"Cannot create pipe for uncompressor (try without using a compressed file)");
return(1);
}
if((childpid=fork()) == -1)
{
logassert(0,"Cannot create new process for uncompressor (try without using a compressed file)");
return(1);
}
if(childpid==0) /* The child */
{
int i;
*pipefd=pipe_fd[PIPE_WRITER];
/* Close all unneeded file descriptors */
for(i=0;i<255;i++)
if(i!=filefd && i!=*pipefd)
close(i);
return(0);
}
else /* The parent */
{
struct sigaction action;
*pipefd=pipe_fd[PIPE_READER];
/* Close all unneeded file descriptors */
close(pipe_fd[PIPE_WRITER]);
close(filefd);
/* Ignore child exiting and pipe signals */
/* SIGCHLD */
action.sa_handler=SIG_IGN;
sigemptyset(&action.sa_mask);
action.sa_flags=0;
sigaction(SIGCHLD,&action,NULL);
/* SIGPIPE */
action.sa_handler=SIG_IGN;
sigemptyset(&action.sa_mask);
action.sa_flags=0;
sigaction(SIGPIPE,&action,NULL);
return(1);
}
}
#endif /* (defined(USE_BZIP2) && USE_BZIP2) || (defined(USE_GZIP) && USE_GZIP) || (defined(USE_XZ) && USE_XZ) */
#if defined(USE_BZIP2) && USE_BZIP2
/*++++++++++++++++++++++++++++++++++++++
Uncompress a file using bzip2 as a pipeline.
int filefd The incoming, compressed, data.
int pipefd The outgoing, uncompressed, data.
++++++++++++++++++++++++++++++++++++++*/
static void uncompress_bzip2_pipe(int filefd,int pipefd)
{
bz_stream bz={0};
char inbuffer[16384],outbuffer[16384];
int infinished=0;
int state;
if(BZ2_bzDecompressInit(&bz,0,0)!=BZ_OK)
exit(EXIT_FAILURE);
do
{
if(bz.avail_in==0 && !infinished)
{
ssize_t n=read(filefd,inbuffer,sizeof(inbuffer));
if(n<=0)
infinished=1;
else
{
bz.next_in=inbuffer;
bz.avail_in=n;
}
}
bz.next_out=outbuffer;
bz.avail_out=sizeof(outbuffer);
state=BZ2_bzDecompress(&bz);
if(state!=BZ_OK && state!=BZ_STREAM_END)
exit(EXIT_FAILURE);
if(bz.avail_out0)
{
m=write(pipefd,p,n);
if(m<=0)
exit(EXIT_FAILURE);
p+=m;
n-=m;
}
}
}
while(state!=BZ_STREAM_END);
if(BZ2_bzDecompressEnd(&bz)!=BZ_OK)
exit(EXIT_FAILURE);
exit(EXIT_SUCCESS);
}
#endif /* USE_BZIP2 */
#if defined(USE_GZIP) && USE_GZIP
/*++++++++++++++++++++++++++++++++++++++
Uncompress a file using gzip as a pipeline.
int filefd The incoming, compressed, data.
int pipefd The outgoing, uncompressed, data.
++++++++++++++++++++++++++++++++++++++*/
static void uncompress_gzip_pipe(int filefd,int pipefd)
{
z_stream z={0};
unsigned char inbuffer[16384],outbuffer[16384];
int infinished=0;
int state;
if(inflateInit2(&z,15+32)!=Z_OK)
exit(EXIT_FAILURE);
do
{
if(z.avail_in==0 && !infinished)
{
ssize_t n=read(filefd,inbuffer,sizeof(inbuffer));
if(n<=0)
infinished=1;
else
{
z.next_in=inbuffer;
z.avail_in=n;
}
}
z.next_out=outbuffer;
z.avail_out=sizeof(outbuffer);
state=inflate(&z,Z_NO_FLUSH);
if(state!=Z_OK && state!=Z_STREAM_END)
{
exit(EXIT_FAILURE);
}
if(z.avail_out0)
{
m=write(pipefd,p,n);
if(m<=0)
exit(EXIT_FAILURE);
p+=m;
n-=m;
}
}
}
while(state!=Z_STREAM_END);
if(inflateEnd(&z)!=Z_OK)
exit(EXIT_FAILURE);
exit(EXIT_SUCCESS);
}
#endif /* USE_GZIP */
#if defined(USE_XZ) && USE_XZ
/*++++++++++++++++++++++++++++++++++++++
Uncompress a file using xz as a pipeline.
int filefd The incoming, compressed, data.
int pipefd The outgoing, uncompressed, data.
++++++++++++++++++++++++++++++++++++++*/
static void uncompress_xz_pipe(int filefd,int pipefd)
{
lzma_stream lzma=LZMA_STREAM_INIT;
unsigned char inbuffer[16384],outbuffer[16384];
int infinished=0;
lzma_ret retval;
if(lzma_stream_decoder(&lzma,UINT64_MAX,0)!=LZMA_OK)
exit(EXIT_FAILURE);
do
{
if(lzma.avail_in==0 && !infinished)
{
ssize_t n=read(filefd,inbuffer,sizeof(inbuffer));
if(n<=0)
infinished=1;
else
{
lzma.next_in=inbuffer;
lzma.avail_in=n;
}
}
lzma.next_out=outbuffer;
lzma.avail_out=sizeof(outbuffer);
retval=lzma_code(&lzma,LZMA_RUN);
if(retval!=LZMA_OK && retval!=LZMA_STREAM_END)
{
exit(EXIT_FAILURE);
}
if(lzma.avail_out0)
{
m=write(pipefd,p,n);
if(m<=0)
exit(EXIT_FAILURE);
p+=m;
n-=m;
}
}
}
while(retval!=LZMA_STREAM_END);
lzma_end(&lzma);
exit(EXIT_SUCCESS);
}
#endif /* USE_XZ */
#endif /* !defined(_MSC_VER) && !defined(__MINGW32__) */
routino-3.0/src/xmlparse.c 644 233 144 210007 12563633052 11056 0 /***************************************
A simple generic XML parser where the structure comes from the function parameters.
Not intended to be fully conforming to XML standard or a validating parser but
sufficient to parse OSM XML and simple program configuration files.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2010-2015 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#include
#if defined(_MSC_VER)
#include
#include
#define read(fd,address,length) _read(fd,address,(unsigned int)(length))
#define snprintf _snprintf
#define ssize_t SSIZE_T
#else
#include
#endif
#include
#include
#include
#include
#include
#if defined(_MSC_VER) || defined(__MINGW32__)
#define strcasecmp _stricmp
#else
#include
#endif
#include
#include "xmlparse.h"
/* Parser states */
#define LEX_EOF 0
#define LEX_FUNC_TAG_BEGIN 1
#define LEX_FUNC_XML_DECL_BEGIN 2
#define LEX_FUNC_TAG_POP 3
#define LEX_FUNC_TAG_PUSH 4
#define LEX_FUNC_XML_DECL_FINISH 5
#define LEX_FUNC_TAG_FINISH 6
#define LEX_FUNC_ATTR_KEY 7
#define LEX_FUNC_ATTR_VAL 8
#define LEX_STATE_INITIAL 10
#define LEX_STATE_BANGTAG 11
#define LEX_STATE_COMMENT 12
#define LEX_STATE_XML_DECL_START 13
#define LEX_STATE_XML_DECL 14
#define LEX_STATE_TAG_START 15
#define LEX_STATE_TAG 16
#define LEX_STATE_ATTR_KEY 17
#define LEX_STATE_ATTR_VAL 18
#define LEX_STATE_END_TAG1 19
#define LEX_STATE_END_TAG2 20
#define LEX_STATE_DQUOTED 21
#define LEX_STATE_SQUOTED 22
#define LEX_ERROR_TAG_START 101
#define LEX_ERROR_XML_DECL_START 102
#define LEX_ERROR_TAG 103
#define LEX_ERROR_XML_DECL 104
#define LEX_ERROR_ATTR 105
#define LEX_ERROR_END_TAG 106
#define LEX_ERROR_COMMENT 107
#define LEX_ERROR_CLOSE 108
#define LEX_ERROR_ATTR_VAL 109
#define LEX_ERROR_ENTITY_REF 110
#define LEX_ERROR_CHAR_REF 111
#define LEX_ERROR_TEXT_OUTSIDE 112
#define LEX_ERROR_UNEXP_TAG 201
#define LEX_ERROR_UNBALANCED 202
#define LEX_ERROR_NO_START 203
#define LEX_ERROR_UNEXP_ATT 204
#define LEX_ERROR_UNEXP_EOF 205
#define LEX_ERROR_XML_NOT_FIRST 206
#define LEX_ERROR_CALLBACK 255
/* Parsing variables and functions (re-initialised for each file) */
static uint64_t lineno;
static unsigned char buffer[2][16384];
static unsigned char *buffer_token,*buffer_end,*buffer_ptr;
static int buffer_active=0;
static char *stored_message=NULL;
/*++++++++++++++++++++++++++++++++++++++
Refill the data buffer making sure that the string starting at buffer_token is contiguous.
int buffer_refill Return 0 if everything is OK or 1 for EOF.
int fd The file descriptor to read from.
++++++++++++++++++++++++++++++++++++++*/
static inline int buffer_refill(int fd)
{
ssize_t n;
size_t m=0;
m=(buffer_end-buffer[buffer_active])+1;
if(m>(sizeof(buffer[0])/2)) /* more than half full */
{
m=0;
buffer_active=!buffer_active;
if(buffer_token)
{
m=(buffer_end-buffer_token)+1;
memcpy(buffer[buffer_active],buffer_token,m);
buffer_token=buffer[buffer_active];
}
}
n=read(fd,buffer[buffer_active]+m,sizeof(buffer[0])-m);
buffer_ptr=buffer[buffer_active]+m;
buffer_end=buffer[buffer_active]+m+n-1;
if(n<=0)
return(1);
else
return(0);
}
/* Macros to simplify the parser (and make it look more like lex) */
#define BEGIN(xx) do{ state=(xx); goto new_state; } while(0)
#define NEXT(xx) next_state=(xx)
#define START_TOKEN buffer_token=buffer_ptr
#define END_TOKEN buffer_token=NULL
#define NEXT_CHAR \
do{ \
if(buffer_ptr==buffer_end) \
{ if(buffer_refill(fd)) BEGIN(LEX_EOF); } \
else \
buffer_ptr++; \
} while(0)
/* -------- equivalent flex definition --------
S [ \t\r]
N (\n)
U1 [\x09\x0A\x0D\x20-\x7F]
U2 [\xC2-\xDF][\x80-\xBF]
U3a \xE0[\xA0-\xBF][\x80-\xBF]
U3b [\xE1-\xEC][\x80-\xBF][\x80-\xBF]
U3c \xED[\x80-\x9F][\x80-\xBF]
U3d [\xEE-\xEF][\x80-\xBF][\x80-\xBF]
U3 {U3a}|{U3b}|{U3c}|{U3d}
U4a \xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF]
U4b [\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF]
U4c \xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF]
U4 {U4a}|{U4b}|{U4c}
U ({U1}|{U2}|{U3}|{U4})
U1_xml ([\x09\x0A\x0D\x20-\x25\x27-\x3B\x3D\x3F-\x7F])
U1quotedS_xml ([\x09\x0A\x0D\x20-\x25\x28-\x3B\x3D\x3F-\x7F])
U1quotedD_xml ([\x09\x0A\x0D\x20-\x21\x23-\x25\x27-\x3B\x3D\x3F-\x7F])
UquotedS ({U1quotedS_xml}|{U2}|{U3}|{U4})
UquotedD ({U1quotedD_xml}|{U2}|{U3}|{U4})
letter [a-zA-Z]
digit [0-9]
xdigit [a-fA-F0-9]
namechar ({letter}|{digit}|[-._:])
namestart ({letter}|[_:])
name ({namestart}{namechar}*)
entityref (&{name};)
charref (({digit}+|x{xdigit}+);)
-------- equivalent flex definition -------- */
/* Tables containing character class defintions (advance declaration for data at end of file). */
static const unsigned char quotedD[256],quotedS[256];
static const unsigned char *U2[1],*U3a[2],*U3b[2],*U3c[2],*U3d[2],*U4a[3],*U4b[3],*U4c[3];
static const unsigned char namestart[256],namechar[256],whitespace[256],digit[256],xdigit[256];
/*++++++++++++++++++++++++++++++++++++++
A function to call the callback function with the parameters needed.
int call_callback Returns 1 if the callback returned with an error.
const char *name The name of the tag.
int (*callback)() The callback function.
int type The type of tag (start and/or end).
int nattributes The number of attributes collected.
unsigned char *attributes[XMLPARSE_MAX_ATTRS] The list of attributes.
++++++++++++++++++++++++++++++++++++++*/
static inline int call_callback(const char *name,int (*callback)(),int type,int nattributes,unsigned char *attributes[XMLPARSE_MAX_ATTRS])
{
switch(nattributes)
{
case 0: return (*callback)(name,type);
case 1: return (*callback)(name,type,attributes[0]);
case 2: return (*callback)(name,type,attributes[0],attributes[1]);
case 3: return (*callback)(name,type,attributes[0],attributes[1],attributes[2]);
case 4: return (*callback)(name,type,attributes[0],attributes[1],attributes[2],attributes[3]);
case 5: return (*callback)(name,type,attributes[0],attributes[1],attributes[2],attributes[3],attributes[4]);
case 6: return (*callback)(name,type,attributes[0],attributes[1],attributes[2],attributes[3],attributes[4],attributes[5]);
case 7: return (*callback)(name,type,attributes[0],attributes[1],attributes[2],attributes[3],attributes[4],attributes[5],attributes[6]);
case 8: return (*callback)(name,type,attributes[0],attributes[1],attributes[2],attributes[3],attributes[4],attributes[5],attributes[6],attributes[7]);
case 9: return (*callback)(name,type,attributes[0],attributes[1],attributes[2],attributes[3],attributes[4],attributes[5],attributes[6],attributes[7],attributes[8]);
case 10: return (*callback)(name,type,attributes[0],attributes[1],attributes[2],attributes[3],attributes[4],attributes[5],attributes[6],attributes[7],attributes[8],attributes[9]);
case 11: return (*callback)(name,type,attributes[0],attributes[1],attributes[2],attributes[3],attributes[4],attributes[5],attributes[6],attributes[7],attributes[8],attributes[9],attributes[10]);
case 12: return (*callback)(name,type,attributes[0],attributes[1],attributes[2],attributes[3],attributes[4],attributes[5],attributes[6],attributes[7],attributes[8],attributes[9],attributes[10],attributes[11]);
case 13: return (*callback)(name,type,attributes[0],attributes[1],attributes[2],attributes[3],attributes[4],attributes[5],attributes[6],attributes[7],attributes[8],attributes[9],attributes[10],attributes[11],attributes[12]);
case 14: return (*callback)(name,type,attributes[0],attributes[1],attributes[2],attributes[3],attributes[4],attributes[5],attributes[6],attributes[7],attributes[8],attributes[9],attributes[10],attributes[11],attributes[12],attributes[13]);
case 15: return (*callback)(name,type,attributes[0],attributes[1],attributes[2],attributes[3],attributes[4],attributes[5],attributes[6],attributes[7],attributes[8],attributes[9],attributes[10],attributes[11],attributes[12],attributes[13],attributes[14]);
case 16: return (*callback)(name,type,attributes[0],attributes[1],attributes[2],attributes[3],attributes[4],attributes[5],attributes[6],attributes[7],attributes[8],attributes[9],attributes[10],attributes[11],attributes[12],attributes[13],attributes[14],attributes[15]);
default:
ParseXML_SetError("Too many attributes for tag '%s' source code needs changing.",name);
return(1);
}
}
/*++++++++++++++++++++++++++++++++++++++
Parse the XML and call the functions for each tag as seen.
int ParseXML Returns 0 if OK or something else in case of an error.
int fd The file descriptor of the file to parse.
const xmltag *const *tags The array of pointers to tags for the top level.
int options A list of XML Parser options OR-ed together.
++++++++++++++++++++++++++++++++++++++*/
int ParseXML(int fd,const xmltag *const *tags,int options)
{
int i;
int state,next_state,after_attr;
unsigned char saved_buffer_ptr=0;
const unsigned char *quoted;
unsigned char *attributes[XMLPARSE_MAX_ATTRS]={NULL};
int attribute=0;
int stackdepth=0,stackused=0;
const xmltag * const **tags_stack=NULL;
const xmltag **tag_stack=NULL;
const xmltag *tag=NULL;
/* The actual parser. */
lineno=1;
if(stored_message)
free(stored_message);
stored_message=NULL;
buffer_end=buffer[buffer_active]+sizeof(buffer[0])-1;
buffer_token=NULL;
buffer_refill(fd);
BEGIN(LEX_STATE_INITIAL);
new_state:
switch(state)
{
/* ================ Parsing states ================ */
/* -------- equivalent flex definition --------
""" { BEGIN(END_TAG1); }
"" { BEGIN(XML_DECL_START); }
"<" { BEGIN(TAG_START); }
">" { return(LEX_ERROR_CLOSE); }
{N} { lineno++; }
{S}+ { }
. { return(LEX_ERROR_TEXT_OUTSIDE); }
-------- equivalent flex definition -------- */
case LEX_STATE_INITIAL:
while(1)
{
while(whitespace[(int)*buffer_ptr])
NEXT_CHAR;
if(*buffer_ptr=='\n')
{
NEXT_CHAR;
lineno++;
}
else if(*buffer_ptr=='<')
{
NEXT_CHAR;
if(*buffer_ptr=='/')
{
NEXT_CHAR;
BEGIN(LEX_STATE_END_TAG1);
}
else if(*buffer_ptr=='!')
{
NEXT_CHAR;
BEGIN(LEX_STATE_BANGTAG);
}
else if(*buffer_ptr=='?')
{
NEXT_CHAR;
BEGIN(LEX_STATE_XML_DECL_START);
}
else
BEGIN(LEX_STATE_TAG_START);
}
else if(*buffer_ptr=='>')
BEGIN(LEX_ERROR_CLOSE);
else
BEGIN(LEX_ERROR_TEXT_OUTSIDE);
}
break;
/* -------- equivalent flex definition --------
"--" { BEGIN(COMMENT); }
{N} { return(LEX_ERROR_TAG_START); }
. { return(LEX_ERROR_TAG_START); }
-------- equivalent flex definition -------- */
case LEX_STATE_BANGTAG:
if(*buffer_ptr!='-')
BEGIN(LEX_ERROR_TAG_START);
NEXT_CHAR;
if(*buffer_ptr!='-')
BEGIN(LEX_ERROR_TAG_START);
NEXT_CHAR;
BEGIN(LEX_STATE_COMMENT);
break;
/* -------- equivalent flex definition --------
"-->" { BEGIN(INITIAL); }
"--"[^>] { return(LEX_ERROR_COMMENT); }
"-" { }
{N} { lineno++; }
[^-\n]+ { }
-------- equivalent flex definition -------- */
case LEX_STATE_COMMENT:
while(1)
{
while(*buffer_ptr!='-' && *buffer_ptr!='\n')
NEXT_CHAR;
if(*buffer_ptr=='-')
{
NEXT_CHAR;
if(*buffer_ptr!='-')
continue;
NEXT_CHAR;
if(*buffer_ptr=='>')
{
NEXT_CHAR;
BEGIN(LEX_STATE_INITIAL);
}
BEGIN(LEX_ERROR_COMMENT);
}
else /* if(*buffer_ptr=='\n') */
{
NEXT_CHAR;
lineno++;
}
}
break;
/* -------- equivalent flex definition --------
xml { BEGIN(XML_DECL); return(LEX_XML_DECL_BEGIN); }
{N} { return(LEX_ERROR_XML_DECL_START); }
. { return(LEX_ERROR_XML_DECL_START); }
-------- equivalent flex definition -------- */
case LEX_STATE_XML_DECL_START:
START_TOKEN;
if(*buffer_ptr=='x')
{
NEXT_CHAR;
if(*buffer_ptr=='m')
{
NEXT_CHAR;
if(*buffer_ptr=='l')
{
NEXT_CHAR;
saved_buffer_ptr=*buffer_ptr;
*buffer_ptr=0;
NEXT(LEX_STATE_XML_DECL);
BEGIN(LEX_FUNC_XML_DECL_BEGIN);
}
}
}
BEGIN(LEX_ERROR_XML_DECL_START);
/* -------- equivalent flex definition --------
"?>" { BEGIN(INITIAL); return(LEX_XML_DECL_FINISH); }
{S}+ { }
{N} { lineno++; }
{name} { after_attr=XML_DECL; BEGIN(ATTR_KEY); return(LEX_ATTR_KEY); }
. { return(LEX_ERROR_XML_DECL); }
-------- equivalent flex definition -------- */
case LEX_STATE_XML_DECL:
while(1)
{
while(whitespace[(int)*buffer_ptr])
NEXT_CHAR;
if(namestart[(int)*buffer_ptr])
{
START_TOKEN;
NEXT_CHAR;
while(namechar[(int)*buffer_ptr])
NEXT_CHAR;
saved_buffer_ptr=*buffer_ptr;
*buffer_ptr=0;
after_attr=LEX_STATE_XML_DECL;
NEXT(LEX_STATE_ATTR_KEY);
BEGIN(LEX_FUNC_ATTR_KEY);
}
else if(*buffer_ptr=='?')
{
NEXT_CHAR;
if(*buffer_ptr=='>')
{
NEXT_CHAR;
NEXT(LEX_STATE_INITIAL);
BEGIN(LEX_FUNC_XML_DECL_FINISH);
}
BEGIN(LEX_ERROR_XML_DECL);
}
else if(*buffer_ptr=='\n')
{
NEXT_CHAR;
lineno++;
}
else
BEGIN(LEX_ERROR_XML_DECL);
}
break;
/* -------- equivalent flex definition --------
{name} { BEGIN(TAG); return(LEX_TAG_BEGIN); }
{N} { return(LEX_ERROR_TAG_START); }
. { return(LEX_ERROR_TAG_START); }
-------- equivalent flex definition -------- */
case LEX_STATE_TAG_START:
if(namestart[(int)*buffer_ptr])
{
START_TOKEN;
NEXT_CHAR;
while(namechar[(int)*buffer_ptr])
NEXT_CHAR;
saved_buffer_ptr=*buffer_ptr;
*buffer_ptr=0;
NEXT(LEX_STATE_TAG);
BEGIN(LEX_FUNC_TAG_BEGIN);
}
BEGIN(LEX_ERROR_TAG_START);
/* -------- equivalent flex definition --------
{name} { BEGIN(END_TAG2); return(LEX_TAG_POP); }
{N} { return(LEX_ERROR_END_TAG); }
. { return(LEX_ERROR_END_TAG); }
-------- equivalent flex definition -------- */
case LEX_STATE_END_TAG1:
if(namestart[(int)*buffer_ptr])
{
START_TOKEN;
NEXT_CHAR;
while(namechar[(int)*buffer_ptr])
NEXT_CHAR;
saved_buffer_ptr=*buffer_ptr;
*buffer_ptr=0;
NEXT(LEX_STATE_END_TAG2);
BEGIN(LEX_FUNC_TAG_POP);
}
BEGIN(LEX_ERROR_END_TAG);
/* -------- equivalent flex definition --------
">" { BEGIN(INITIAL); }
{N} { return(LEX_ERROR_END_TAG); }
. { return(LEX_ERROR_END_TAG); }
-------- equivalent flex definition -------- */
case LEX_STATE_END_TAG2:
if(*buffer_ptr=='>')
{
NEXT_CHAR;
BEGIN(LEX_STATE_INITIAL);
}
BEGIN(LEX_ERROR_END_TAG);
/* -------- equivalent flex definition --------
"/>" { BEGIN(INITIAL); return(LEX_TAG_FINISH); }
">" { BEGIN(INITIAL); return(LEX_TAG_PUSH); }
{S}+ { }
{N} { lineno++; }
{name} { after_attr=TAG; BEGIN(ATTR_KEY); return(LEX_ATTR_KEY); }
. { return(LEX_ERROR_TAG); }
-------- equivalent flex definition -------- */
case LEX_STATE_TAG:
while(1)
{
while(whitespace[(int)*buffer_ptr])
NEXT_CHAR;
if(namestart[(int)*buffer_ptr])
{
START_TOKEN;
NEXT_CHAR;
while(namechar[(int)*buffer_ptr])
NEXT_CHAR;
saved_buffer_ptr=*buffer_ptr;
*buffer_ptr=0;
after_attr=LEX_STATE_TAG;
NEXT(LEX_STATE_ATTR_KEY);
BEGIN(LEX_FUNC_ATTR_KEY);
}
else if(*buffer_ptr=='/')
{
NEXT_CHAR;
if(*buffer_ptr=='>')
{
NEXT_CHAR;
NEXT(LEX_STATE_INITIAL);
BEGIN(LEX_FUNC_TAG_FINISH);
}
BEGIN(LEX_ERROR_TAG);
}
else if(*buffer_ptr=='>')
{
NEXT_CHAR;
NEXT(LEX_STATE_INITIAL);
BEGIN(LEX_FUNC_TAG_PUSH);
}
else if(*buffer_ptr=='\n')
{
NEXT_CHAR;
lineno++;
}
else
BEGIN(LEX_ERROR_TAG);
}
break;
/* -------- equivalent flex definition --------
= { BEGIN(ATTR_VAL); }
{N} { return(LEX_ERROR_ATTR); }
. { return(LEX_ERROR_ATTR); }
-------- equivalent flex definition -------- */
case LEX_STATE_ATTR_KEY:
if(*buffer_ptr=='=')
{
NEXT_CHAR;
BEGIN(LEX_STATE_ATTR_VAL);
}
BEGIN(LEX_ERROR_ATTR);
/* -------- equivalent flex definition --------
\" { BEGIN(DQUOTED); }
\' { BEGIN(SQUOTED); }
{N} { return(LEX_ERROR_ATTR); }
. { return(LEX_ERROR_ATTR); }
-------- equivalent flex definition -------- */
case LEX_STATE_ATTR_VAL:
if(*buffer_ptr=='"')
{
NEXT_CHAR;
BEGIN(LEX_STATE_DQUOTED);
}
else if(*buffer_ptr=='\'')
{
NEXT_CHAR;
BEGIN(LEX_STATE_SQUOTED);
}
BEGIN(LEX_ERROR_ATTR);
/* -------- equivalent flex definition --------
\" { BEGIN(after_attr); return(LEX_ATTR_VAL); }
{entityref} { if(options&XMLPARSE_RETURN_ATTR_ENCODED) {append_string(yytext);}
else { const char *str=ParseXML_Decode_Entity_Ref(yytext); if(str) {append_string(str);} else {return(LEX_ERROR_ENTITY_REF);} } }
{charref} { if(options&XMLPARSE_RETURN_ATTR_ENCODED) {append_string(yytext);}
else { const char *str=ParseXML_Decode_Char_Ref(yytext); if(str) {append_string(str);} else {return(LEX_ERROR_CHAR_REF);} } }
{UquotedD} { }
[<>&] { return(LEX_ERROR_ATTR_VAL); }
. { return(LEX_ERROR_ATTR_VAL); }
\' { BEGIN(after_attr); return(LEX_ATTR_VAL); }
{entityref} { if(options&XMLPARSE_RETURN_ATTR_ENCODED) {append_string(yytext);}
else { const char *str=ParseXML_Decode_Entity_Ref(yytext); if(str) {append_string(str);} else {return(LEX_ERROR_ENTITY_REF);} } }
{charref} { if(options&XMLPARSE_RETURN_ATTR_ENCODED) {append_string(yytext);}
else { const char *str=ParseXML_Decode_Char_Ref(yytext); if(str) {append_string(str);} else {return(LEX_ERROR_CHAR_REF);} } }
{UquotedS} { append_string(yytext); }
[<>&] { return(LEX_ERROR_ATTR_VAL); }
. { return(LEX_ERROR_ATTR_VAL); }
-------- equivalent flex definition -------- */
case LEX_STATE_DQUOTED:
case LEX_STATE_SQUOTED:
if(state==LEX_STATE_DQUOTED)
quoted=quotedD;
else
quoted=quotedS;
START_TOKEN;
while(1)
{
switch(quoted[(int)*buffer_ptr])
{
case 10: /* U1 - used by all tag keys and many values */
do
{
NEXT_CHAR;
}
while(quoted[(int)*buffer_ptr]==10);
break;
case 20: /* U2 */
NEXT_CHAR;
if(!U2[0][(int)*buffer_ptr])
BEGIN(LEX_ERROR_ATTR_VAL);
NEXT_CHAR;
break;
case 31: /* U3a */
NEXT_CHAR;
if(!U3a[0][(int)*buffer_ptr])
BEGIN(LEX_ERROR_ATTR_VAL);
NEXT_CHAR;
if(!U3a[1][(int)*buffer_ptr])
BEGIN(LEX_ERROR_ATTR_VAL);
NEXT_CHAR;
break;
case 32: /* U3b */
NEXT_CHAR;
if(!U3b[0][(int)*buffer_ptr])
BEGIN(LEX_ERROR_ATTR_VAL);
NEXT_CHAR;
if(!U3b[1][(int)*buffer_ptr])
BEGIN(LEX_ERROR_ATTR_VAL);
NEXT_CHAR;
break;
case 33: /* U3c */
NEXT_CHAR;
if(!U3c[0][(int)*buffer_ptr])
BEGIN(LEX_ERROR_ATTR_VAL);
NEXT_CHAR;
if(!U3c[1][(int)*buffer_ptr])
BEGIN(LEX_ERROR_ATTR_VAL);
NEXT_CHAR;
break;
case 34: /* U3d */
NEXT_CHAR;
if(!U3d[0][(int)*buffer_ptr])
BEGIN(LEX_ERROR_ATTR_VAL);
NEXT_CHAR;
if(!U3d[1][(int)*buffer_ptr])
BEGIN(LEX_ERROR_ATTR_VAL);
NEXT_CHAR;
break;
case 41: /* U4a */
NEXT_CHAR;
if(!U4a[0][(int)*buffer_ptr])
BEGIN(LEX_ERROR_ATTR_VAL);
NEXT_CHAR;
if(!U4a[1][(int)*buffer_ptr])
BEGIN(LEX_ERROR_ATTR_VAL);
NEXT_CHAR;
if(!U4a[2][(int)*buffer_ptr])
BEGIN(LEX_ERROR_ATTR_VAL);
NEXT_CHAR;
break;
case 42: /* U4b */
NEXT_CHAR;
if(!U4b[0][(int)*buffer_ptr])
BEGIN(LEX_ERROR_ATTR_VAL);
NEXT_CHAR;
if(!U4b[1][(int)*buffer_ptr])
BEGIN(LEX_ERROR_ATTR_VAL);
NEXT_CHAR;
if(!U4b[2][(int)*buffer_ptr])
BEGIN(LEX_ERROR_ATTR_VAL);
NEXT_CHAR;
break;
case 43: /* U4c */
NEXT_CHAR;
if(!U4c[0][(int)*buffer_ptr])
BEGIN(LEX_ERROR_ATTR_VAL);
NEXT_CHAR;
if(!U4c[1][(int)*buffer_ptr])
BEGIN(LEX_ERROR_ATTR_VAL);
NEXT_CHAR;
if(!U4c[2][(int)*buffer_ptr])
BEGIN(LEX_ERROR_ATTR_VAL);
NEXT_CHAR;
break;
case 50: /* entityref or charref */
NEXT_CHAR;
if(*buffer_ptr=='#') /* charref */
{
int charref_len=3;
NEXT_CHAR;
if(digit[(int)*buffer_ptr]) /* decimal */
{
NEXT_CHAR;
charref_len++;
while(digit[(int)*buffer_ptr])
{
NEXT_CHAR;
charref_len++;
}
if(*buffer_ptr!=';')
BEGIN(LEX_ERROR_ATTR_VAL);
}
else if(*buffer_ptr=='x') /* hex */
{
NEXT_CHAR;
charref_len++;
while(xdigit[(int)*buffer_ptr])
{
NEXT_CHAR;
charref_len++;
}
if(*buffer_ptr!=';')
BEGIN(LEX_ERROR_ATTR_VAL);
}
else /* other */
BEGIN(LEX_ERROR_ATTR_VAL);
NEXT_CHAR;
if(!(options&XMLPARSE_RETURN_ATTR_ENCODED))
{
const char *str;
saved_buffer_ptr=*buffer_ptr;
*buffer_ptr=0;
str=ParseXML_Decode_Char_Ref((char*)(buffer_ptr-charref_len));
if(!str)
{
buffer_ptr-=charref_len;
BEGIN(LEX_ERROR_CHAR_REF);
}
buffer_token=memmove(buffer_token+(charref_len-strlen(str)),buffer_token,buffer_ptr-buffer_token-charref_len);
memcpy(buffer_ptr-strlen(str),str,strlen(str));
*buffer_ptr=saved_buffer_ptr;
}
}
else if(namestart[(int)*buffer_ptr]) /* entityref */
{
int entityref_len=3;
NEXT_CHAR;
while(namechar[(int)*buffer_ptr])
{
NEXT_CHAR;
entityref_len++;
}
if(*buffer_ptr!=';')
BEGIN(LEX_ERROR_ATTR_VAL);
NEXT_CHAR;
if(!(options&XMLPARSE_RETURN_ATTR_ENCODED))
{
const char *str;
saved_buffer_ptr=*buffer_ptr;
*buffer_ptr=0;
str=ParseXML_Decode_Entity_Ref((char*)(buffer_ptr-entityref_len));
if(!str)
{
buffer_ptr-=entityref_len;
BEGIN(LEX_ERROR_ENTITY_REF);
}
buffer_token=memmove(buffer_token+(entityref_len-strlen(str)),buffer_token,buffer_ptr-buffer_token-entityref_len);
memcpy(buffer_ptr-strlen(str),str,strlen(str));
*buffer_ptr=saved_buffer_ptr;
}
}
else /* other */
BEGIN(LEX_ERROR_ATTR_VAL);
break;
case 99: /* quote */
*buffer_ptr=0;
NEXT_CHAR;
NEXT(after_attr);
BEGIN(LEX_FUNC_ATTR_VAL);
default: /* other */
BEGIN(LEX_ERROR_ATTR_VAL);
}
}
break;
/* ================ Functional states ================ */
/* The start of a tag for an XML declaration */
case LEX_FUNC_XML_DECL_BEGIN:
if(tag_stack)
BEGIN(LEX_ERROR_XML_NOT_FIRST);
/* The start of a tag for an element */
case LEX_FUNC_TAG_BEGIN:
tag=NULL;
for(i=0;tags[i];i++)
if(buffer_token[0]==tags[i]->name[0] || tolower(buffer_token[0])==tags[i]->name[0])
if(!strcasecmp((char*)buffer_token+1,tags[i]->name+1))
{
tag=tags[i];
for(i=0;inattributes;i++)
attributes[i]=NULL;
break;
}
if(tag==NULL)
BEGIN(LEX_ERROR_UNEXP_TAG);
END_TOKEN;
*buffer_ptr=saved_buffer_ptr;
BEGIN(next_state);
/* The end of the start-tag for an element */
case LEX_FUNC_TAG_PUSH:
if(stackused==stackdepth)
{
tag_stack =realloc(tag_stack ,(stackdepth+=8)*sizeof(xmltag*));
tags_stack=realloc(tags_stack,(stackdepth+=8)*sizeof(xmltag**));
}
tag_stack [stackused]=tag;
tags_stack[stackused]=tags;
stackused++;
if(tag->callback)
if(call_callback(tag->name,tag->callback,XMLPARSE_TAG_START,tag->nattributes,attributes))
BEGIN(LEX_ERROR_CALLBACK);
tags=tag->subtags;
BEGIN(next_state);
/* The end of the empty-element-tag for an XML declaration */
case LEX_FUNC_XML_DECL_FINISH:
/* The end of the empty-element-tag for an element */
case LEX_FUNC_TAG_FINISH:
if(tag->callback)
if(call_callback(tag->name,tag->callback,XMLPARSE_TAG_START|XMLPARSE_TAG_END,tag->nattributes,attributes))
BEGIN(LEX_ERROR_CALLBACK);
if(stackused>0)
tag=tag_stack[stackused-1];
else
tag=NULL;
BEGIN(next_state);
/* The end of the end-tag for an element */
case LEX_FUNC_TAG_POP:
stackused--;
tags=tags_stack[stackused];
tag =tag_stack [stackused];
if(strcmp((char*)buffer_token,tag->name))
BEGIN(LEX_ERROR_UNBALANCED);
if(stackused<0)
BEGIN(LEX_ERROR_NO_START);
for(i=0;inattributes;i++)
attributes[i]=NULL;
if(tag->callback)
if(call_callback(tag->name,tag->callback,XMLPARSE_TAG_END,tag->nattributes,attributes))
BEGIN(LEX_ERROR_CALLBACK);
if(stackused>0)
tag=tag_stack[stackused-1];
else
tag=NULL;
END_TOKEN;
*buffer_ptr=saved_buffer_ptr;
BEGIN(next_state);
/* An attribute key */
case LEX_FUNC_ATTR_KEY:
attribute=-1;
for(i=0;inattributes;i++)
if(buffer_token[0]==tag->attributes[i][0] || tolower(buffer_token[0])==tag->attributes[i][0])
if(!strcasecmp((char*)buffer_token+1,tag->attributes[i]+1))
{
attribute=i;
break;
}
if(attribute==-1)
{
if((options&XMLPARSE_UNKNOWN_ATTRIBUTES)==XMLPARSE_UNKNOWN_ATTR_ERROR ||
((options&XMLPARSE_UNKNOWN_ATTRIBUTES)==XMLPARSE_UNKNOWN_ATTR_ERRNONAME && !strchr((char*)buffer_token,':')))
BEGIN(LEX_ERROR_UNEXP_ATT);
#ifndef LIBROUTINO
else if((options&XMLPARSE_UNKNOWN_ATTRIBUTES)==XMLPARSE_UNKNOWN_ATTR_WARN)
ParseXML_SetError("Warning on line %"PRIu64": unexpected attribute '%s' for tag '%s'.",lineno,buffer_token,tag->name);
#endif
}
END_TOKEN;
*buffer_ptr=saved_buffer_ptr;
BEGIN(next_state);
/* An attribute value */
case LEX_FUNC_ATTR_VAL:
if(tag->callback && attribute!=-1)
attributes[attribute]=buffer_token;
END_TOKEN;
BEGIN(next_state);
/* End of file */
case LEX_EOF:
if(tag)
BEGIN(LEX_ERROR_UNEXP_EOF);
break;
/* ================ Error states ================ */
case LEX_ERROR_TAG_START:
ParseXML_SetError("Character '<' seen not at start of tag.");
break;
case LEX_ERROR_XML_DECL_START:
ParseXML_SetError("Characters '' seen not at start of XML declaration.");
break;
case LEX_ERROR_TAG:
ParseXML_SetError("Invalid character seen inside tag '<%s...>'.",tag->name);
break;
case LEX_ERROR_XML_DECL:
ParseXML_SetError("Invalid character seen inside XML declaration ''.");
break;
case LEX_ERROR_ATTR:
ParseXML_SetError("Invalid attribute definition seen in tag.");
break;
case LEX_ERROR_END_TAG:
ParseXML_SetError("Invalid character seen in end-tag.");
break;
case LEX_ERROR_COMMENT:
ParseXML_SetError("Invalid comment seen.");
break;
case LEX_ERROR_CLOSE:
ParseXML_SetError("Character '>' seen not at end of tag.");
break;
case LEX_ERROR_ATTR_VAL:
ParseXML_SetError("Invalid character '%c' seen in attribute value.",*buffer_ptr);
break;
case LEX_ERROR_ENTITY_REF:
ParseXML_SetError("Invalid entity reference '%s' seen in attribute value.",buffer_ptr);
break;
case LEX_ERROR_CHAR_REF:
ParseXML_SetError("Invalid character reference '%s' seen in attribute value.",buffer_ptr);
break;
case LEX_ERROR_TEXT_OUTSIDE:
ParseXML_SetError("Non-whitespace '%c' seen outside tag.",*buffer_ptr);
break;
case LEX_ERROR_UNEXP_TAG:
ParseXML_SetError("Unexpected tag '%s'.",buffer_token);
break;
case LEX_ERROR_UNBALANCED:
ParseXML_SetError("End tag '%s>' doesn't match start tag '<%s ...>'.",buffer_token,tag->name);
break;
case LEX_ERROR_NO_START:
ParseXML_SetError("End tag '%s>' seen but there was no start tag '<%s ...>'.",buffer_token,buffer_token);
break;
case LEX_ERROR_UNEXP_ATT:
ParseXML_SetError("Unexpected attribute '%s' for tag '%s'.",buffer_token,tag->name);
break;
case LEX_ERROR_UNEXP_EOF:
ParseXML_SetError("End of file seen without end tag '%s>'.",tag->name);
break;
case LEX_ERROR_XML_NOT_FIRST:
ParseXML_SetError("XML declaration '' not before all other tags.");
break;
case LEX_ERROR_CALLBACK:
/* The error message should have been set by the callback function, have a fallback just in case */
if(!stored_message)
ParseXML_SetError("Unknown error from tag callback function.");
break;
}
/* Print the error message */
#ifndef LIBROUTINO
if(state)
fprintf(stderr,"XML Parser: %s\n",stored_message);
#endif
/* Delete the tagdata */
if(stackdepth)
{
free(tag_stack);
free(tags_stack);
}
return(state);
}
/*++++++++++++++++++++++++++++++++++++++
Return the current parser line number.
uint64_t ParseXML_LineNumber Returns the line number.
++++++++++++++++++++++++++++++++++++++*/
uint64_t ParseXML_LineNumber(void)
{
return(lineno);
}
/*++++++++++++++++++++++++++++++++++++++
Store an error message for later.
const char *format The format string.
... The other arguments.
++++++++++++++++++++++++++++++++++++++*/
void ParseXML_SetError(const char *format, ...)
{
va_list ap;
char temp[2];
int line_length,error_length;
line_length=snprintf(temp,1,"Error on line %" PRIu64 ": ",lineno);
va_start(ap,format);
error_length=vsnprintf(temp,1,format,ap);
va_end(ap);
if(stored_message)
free(stored_message);
stored_message=malloc(error_length+line_length+1);
line_length=sprintf(stored_message,"Error on line %" PRIu64 ": ",lineno);
va_start(ap,format);
vsprintf(stored_message+line_length,format,ap);
va_end(ap);
}
/*++++++++++++++++++++++++++++++++++++++
Return a stored error message.
char *ParseXML_GetError Returns the most recent stored error.
++++++++++++++++++++++++++++++++++++++*/
char *ParseXML_GetError(void)
{
return(stored_message);
}
/*++++++++++++++++++++++++++++++++++++++
Convert an XML entity reference into an ASCII string.
char *ParseXML_Decode_Entity_Ref Returns a pointer to the replacement decoded string.
const char *string The entity reference string.
++++++++++++++++++++++++++++++++++++++*/
char *ParseXML_Decode_Entity_Ref(const char *string)
{
if(!strcmp(string,"&")) return("&");
if(!strcmp(string,"<")) return("<");
if(!strcmp(string,">")) return(">");
if(!strcmp(string,"'")) return("'");
if(!strcmp(string,""")) return("\"");
return(NULL);
}
/*++++++++++++++++++++++++++++++++++++++
Convert an XML character reference into an ASCII string.
char *ParseXML_Decode_Char_Ref Returns a pointer to the replacement decoded string.
const char *string The character reference string.
++++++++++++++++++++++++++++++++++++++*/
char *ParseXML_Decode_Char_Ref(const char *string)
{
static char result[5]=""; /* static allocation of return value (set each call) */
long int unicode;
if(string[2]=='x') unicode=strtol(string+3,NULL,16);
else unicode=strtol(string+2,NULL,10);
if(unicode<0x80)
{
/* 0000 0000-0000 007F => 0xxxxxxx */
result[0]=(char)unicode;
result[1]=0;
}
else if(unicode<0x07FF)
{
/* 0000 0080-0000 07FF => 110xxxxx 10xxxxxx */
result[0]=(char)(0xC0+((unicode&0x07C0)>>6));
result[1]=(char)(0x80+ (unicode&0x003F));
result[2]=0;
}
else if(unicode<0xFFFF)
{
/* 0000 0800-0000 FFFF => 1110xxxx 10xxxxxx 10xxxxxx */
result[0]=(char)(0xE0+((unicode&0xF000)>>12));
result[1]=(char)(0x80+((unicode&0x0FC0)>>6));
result[2]=(char)(0x80+ (unicode&0x003F));
result[3]=0;
}
else if(unicode<0x1FFFFF)
{
/* 0001 0000-001F FFFF => 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */
result[0]=(char)(0xF0+((unicode&0x1C0000)>>18));
result[1]=(char)(0x80+((unicode&0x03F000)>>12));
result[2]=(char)(0x80+((unicode&0x000FC0)>>6));
result[3]=(char)(0x80+ (unicode&0x00003F));
result[4]=0;
}
else
{
result[0]=(char)0xFF;
result[1]=(char)0xFD;
result[2]=0;
}
return(result);
}
/*++++++++++++++++++++++++++++++++++++++
Convert a string into something that is safe to output in an XML file.
char *ParseXML_Encode_Safe_XML Returns a pointer to a static replacement encoded string (or the original if no change needed).
const char *string The string to convert.
++++++++++++++++++++++++++++++++++++++*/
char *ParseXML_Encode_Safe_XML(const char *string)
{
static const char hexstring[17]="0123456789ABCDEF"; /* local lookup table */
static char *result=NULL; /* static allocation of return value */
int i=0,j=0,len;
for(i=0;string[i];i++)
if(string[i]=='<' || string[i]=='>' || string[i]=='&' || string[i]=='\'' || string[i]=='"' || string[i]<32 || (unsigned char)string[i]>127)
break;
if(!string[i])
return((char*)string);
len=i+256-6;
result=(char*)realloc((void*)result,len+7);
strncpy(result,string,j=i);
do
{
for(;j')
{
result[j++]='&';
result[j++]='g';
result[j++]='t';
result[j++]=';';
}
else if(string[i]>=32 && (unsigned char)string[i]<=127)
result[j++]=string[i];
else
{
unsigned int unicode;
/* Decode the UTF-8 */
if((string[i]&0x80)==0)
{
/* 0000 0000-0000 007F => 0xxxxxxx */
unicode=string[i];
}
else if((string[i]&0xE0)==0xC0 && (string[i]&0x1F)>=2 && (string[i+1]&0xC0)==0x80)
{
/* 0000 0080-0000 07FF => 110xxxxx 10xxxxxx */
unicode =(string[i++]&0x1F)<<6;
unicode|= string[i ]&0x3F;
}
else if((string[i]&0xF0)==0xE0 && (string[i+1]&0xC0)==0x80 && (string[i+2]&0xC0)==0x80)
{
/* 0000 0800-0000 FFFF => 1110xxxx 10xxxxxx 10xxxxxx */
unicode =(string[i++]&0x0F)<<12;
unicode|=(string[i++]&0x3F)<<6;
unicode|= string[i ]&0x3F;
}
else if((string[i]&0xF8)==0xF0 && (string[i+1]&0xC0)==0x80 && (string[i+2]&0xC0)==0x80 && (string[i+3]&0xC0)==0x80)
{
/* 0001 0000-001F FFFF => 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */
unicode =(string[i++]&0x07)<<18;
unicode|=(string[i++]&0x3F)<<12;
unicode|=(string[i++]&0x3F)<<6;
unicode|= string[i ]&0x3F;
}
else
unicode=0xFFFD;
/* Output the character entity */
result[j++]='&';
result[j++]='#';
result[j++]='x';
if(unicode&0x00FF0000)
{
result[j++]=hexstring[((unicode>>16)&0xf0)>>4];
result[j++]=hexstring[((unicode>>16)&0x0f) ];
}
if(unicode&0x00FFFF00)
{
result[j++]=hexstring[((unicode>>8)&0xf0)>>4];
result[j++]=hexstring[((unicode>>8)&0x0f) ];
}
result[j++]=hexstring[(unicode&0xf0)>>4];
result[j++]=hexstring[(unicode&0x0f) ];
result[j++]=';';
}
if(string[i]) /* Not finished */
{
len+=256;
result=(char*)realloc((void*)result,len+7);
}
}
while(string[i]);
result[j]=0;
return(result);
}
/*++++++++++++++++++++++++++++++++++++++
Check that a string really is an integer.
int ParseXML_IsInteger Returns 1 if an integer could be found or 0 otherwise.
const char *string The string to be parsed.
++++++++++++++++++++++++++++++++++++++*/
int ParseXML_IsInteger(const char *string)
{
const unsigned char *p=(unsigned char*)string;
if(*p=='-' || *p=='+')
p++;
while(digit[(int)*p])
p++;
if(*p)
return(0);
else
return(1);
}
/*++++++++++++++++++++++++++++++++++++++
Check that a string really is a floating point number.
int ParseXML_IsFloating Returns 1 if a floating point number could be found or 0 otherwise.
const char *string The string to be parsed.
++++++++++++++++++++++++++++++++++++++*/
int ParseXML_IsFloating(const char *string)
{
const unsigned char *p=(unsigned char*)string;
if(*p=='-' || *p=='+')
p++;
while(digit[(int)*p] || *p=='.')
p++;
if(*p=='e' || *p=='E')
{
p++;
if(*p=='-' || *p=='+')
p++;
while(digit[*p])
p++;
}
if(*p)
return(0);
else
return(1);
}
/* Table for checking for double-quoted characters. */
static const unsigned char quotedD[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0,10,10, 0, 0,10, 0, 0, /* 0x00-0x0f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10-0x1f " " */
10,10,99,10,10,10,50,10,10,10,10,10,10,10,10,10, /* 0x20-0x2f " !"#$%&'()*+,-./" */
10,10,10,10,10,10,10,10,10,10,10,10, 0,10, 0,10, /* 0x30-0x3f "0123456789:;<=>?" */
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 0x40-0x4f "@ABCDEFGHIJKLMNO" */
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 0x50-0x5f "PQRSTUVWXYZ[\]^_" */
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 0x60-0x6f "`abcdefghijklmno" */
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 0x70-0x7f "pqrstuvwxyz{|}~ " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80-0x8f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90-0x9f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xa0-0xaf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xb0-0xbf " " */
0, 0,20,20,20,20,20,20,20,20,20,20,20,20,20,20, /* 0xc0-0xcf " " */
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20, /* 0xd0-0xdf " " */
31,32,32,32,32,32,32,32,32,32,32,32,32,33,34,34, /* 0xe0-0xef " " */
41,42,42,42,43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; /* 0xf0-0xff " " */
/* Table for checking for single-quoted characters. */
static const unsigned char quotedS[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0,10,10, 0, 0,10, 0, 0, /* 0x00-0x0f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10-0x1f " " */
10,10,10,10,10,10,50,99,10,10,10,10,10,10,10,10, /* 0x20-0x2f " !"#$%&'()*+,-./" */
10,10,10,10,10,10,10,10,10,10,10,10, 0,10, 0,10, /* 0x30-0x3f "0123456789:;<=>?" */
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 0x40-0x4f "@ABCDEFGHIJKLMNO" */
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 0x50-0x5f "PQRSTUVWXYZ[\]^_" */
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 0x60-0x6f "`abcdefghijklmno" */
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 0x70-0x7f "pqrstuvwxyz{|}~ " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80-0x8f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90-0x9f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xa0-0xaf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xb0-0xbf " " */
0, 0,20,20,20,20,20,20,20,20,20,20,20,20,20,20, /* 0xc0-0xcf " " */
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20, /* 0xd0-0xdf " " */
31,32,32,32,32,32,32,32,32,32,32,32,32,33,34,34, /* 0xe0-0xef " " */
41,42,42,42,43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; /* 0xf0-0xff " " */
/* Table for checking for characters between 0x80 and 0x8f. */
static const unsigned char U_80_8F[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00-0x0f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10-0x1f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20-0x2f " !"#$%&'()*+,-./" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30-0x3f "0123456789:;<=>?" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40-0x4f "@ABCDEFGHIJKLMNO" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50-0x5f "PQRSTUVWXYZ[\]^_" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x6f "`abcdefghijklmno" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70-0x7f "pqrstuvwxyz{|}~ " */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x80-0x8f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90-0x9f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xa0-0xaf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xb0-0xbf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xc0-0xcf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xd0-0xdf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xe0-0xef " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; /* 0xf0-0xff " " */
/* Table for checking for characters between 0x80 and 0x9f. */
static const unsigned char U_80_9F[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00-0x0f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10-0x1f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20-0x2f " !"#$%&'()*+,-./" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30-0x3f "0123456789:;<=>?" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40-0x4f "@ABCDEFGHIJKLMNO" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50-0x5f "PQRSTUVWXYZ[\]^_" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x6f "`abcdefghijklmno" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70-0x7f "pqrstuvwxyz{|}~ " */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x80-0x8f " " */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x90-0x9f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xa0-0xaf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xb0-0xbf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xc0-0xcf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xd0-0xdf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xe0-0xef " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; /* 0xf0-0xff " " */
/* Table for checking for characters between 0x80 and 0xbf. */
static const unsigned char U_80_BF[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00-0x0f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10-0x1f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20-0x2f " !"#$%&'()*+,-./" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30-0x3f "0123456789:;<=>?" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40-0x4f "@ABCDEFGHIJKLMNO" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50-0x5f "PQRSTUVWXYZ[\]^_" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x6f "`abcdefghijklmno" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70-0x7f "pqrstuvwxyz{|}~ " */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x80-0x8f " " */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x90-0x9f " " */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xa0-0xaf " " */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xb0-0xbf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xc0-0xcf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xd0-0xdf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xe0-0xef " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; /* 0xf0-0xff " " */
/* Table for checking for characters between 0x90 and 0xbf. */
static const unsigned char U_90_BF[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00-0x0f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10-0x1f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20-0x2f " !"#$%&'()*+,-./" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30-0x3f "0123456789:;<=>?" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40-0x4f "@ABCDEFGHIJKLMNO" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50-0x5f "PQRSTUVWXYZ[\]^_" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x6f "`abcdefghijklmno" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70-0x7f "pqrstuvwxyz{|}~ " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80-0x8f " " */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x90-0x9f " " */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xa0-0xaf " " */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xb0-0xbf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xc0-0xcf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xd0-0xdf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xe0-0xef " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; /* 0xf0-0xff " " */
/* Table for checking for characters between 0xa0 and 0xbf. */
static const unsigned char U_A0_BF[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00-0x0f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10-0x1f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20-0x2f " !"#$%&'()*+,-./" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30-0x3f "0123456789:;<=>?" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40-0x4f "@ABCDEFGHIJKLMNO" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50-0x5f "PQRSTUVWXYZ[\]^_" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x6f "`abcdefghijklmno" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70-0x7f "pqrstuvwxyz{|}~ " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80-0x8f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90-0x9f " " */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xa0-0xaf " " */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xb0-0xbf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xc0-0xcf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xd0-0xdf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xe0-0xef " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; /* 0xf0-0xff " " */
/* Table for checking for U2 characters = C2-DF,80-BF = U+0080-U+07FF. */
static const unsigned char *U2[1]={ U_80_BF };
/* Table for checking for U3a characters = E0,A0-BF,80-BF = U+0800-U+0FFF. */
static const unsigned char *U3a[2]={ U_A0_BF, U_80_BF };
/* Table for checking for U3b characters = E1-EC,80-BF,80-BF = U+1000-U+CFFF. */
static const unsigned char *U3b[2]={ U_80_BF, U_80_BF };
/* Table for checking for U3c characters = ED,80-9F,80-BF = U+D000-U+D7FF (U+D800-U+DFFF are not legal in XML). */
static const unsigned char *U3c[2]={ U_80_9F, U_80_BF };
/* Table for checking for U3d characters = EE-EF,80-BF,80-BF = U+E000-U+FFFF (U+FFFE-U+FFFF are not legal in XML but handled). */
static const unsigned char *U3d[2]={ U_80_BF, U_80_BF };
/* Table for checking for U4a characters = F0,90-BF,80-BF,80-BF = U+10000-U+3FFFF. */
static const unsigned char *U4a[3]={ U_90_BF, U_80_BF, U_80_BF };
/* Table for checking for U4b characters = F1-F3,80-BF,80-BF,80-BF = U+40000-U+FFFFF. */
static const unsigned char *U4b[3]={ U_80_BF, U_80_BF, U_80_BF };
/* Table for checking for U4c characters = F4,80-8F,80-BF,80-BF = U+100000-U+10FFFF (U+110000- are not legal in XML). */
static const unsigned char *U4c[3]={ U_80_8F, U_80_BF, U_80_BF };
/* Table for checking for namestart characters. */
static const unsigned char namestart[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00-0x0f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10-0x1f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20-0x2f " !"#$%&'()*+,-./" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, /* 0x30-0x3f "0123456789:;<=>?" */
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x40-0x4f "@ABCDEFGHIJKLMNO" */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, /* 0x50-0x5f "PQRSTUVWXYZ[\]^_" */
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x60-0x6f "`abcdefghijklmno" */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, /* 0x70-0x7f "pqrstuvwxyz{|}~ " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80-0x8f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90-0x9f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xa0-0xaf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xb0-0xbf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xc0-0xcf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xd0-0xdf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xe0-0xef " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; /* 0xf0-0xff " " */
/* Table for checking for namechar characters. */
static const unsigned char namechar[256] ={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00-0x0f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10-0x1f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, /* 0x20-0x2f " !"#$%&'()*+,-./" */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, /* 0x30-0x3f "0123456789:;<=>?" */
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x40-0x4f "@ABCDEFGHIJKLMNO" */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, /* 0x50-0x5f "PQRSTUVWXYZ[\]^_" */
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x60-0x6f "`abcdefghijklmno" */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, /* 0x70-0x7f "pqrstuvwxyz{|}~ " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80-0x8f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90-0x9f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xa0-0xaf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xb0-0xbf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xc0-0xcf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xd0-0xdf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xe0-0xef " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; /* 0xf0-0xff " " */
/* Table for checking for whitespace characters. */
static const unsigned char whitespace[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, /* 0x00-0x0f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10-0x1f " " */
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20-0x2f " !"#$%&'()*+,-./" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30-0x3f "0123456789:;<=>?" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40-0x4f "@ABCDEFGHIJKLMNO" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50-0x5f "PQRSTUVWXYZ[\]^_" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x6f "`abcdefghijklmno" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70-0x7f "pqrstuvwxyz{|}~ " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80-0x8f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90-0x9f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xa0-0xaf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xb0-0xbf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xc0-0xcf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xd0-0xdf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xe0-0xef " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; /* 0xf0-0xff " " */
/* Table for checking for digit characters. */
static const unsigned char digit[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00-0x0f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10-0x1f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20-0x2f " !"#$%&'()*+,-./" */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, /* 0x30-0x3f "0123456789:;<=>?" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40-0x4f "@ABCDEFGHIJKLMNO" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50-0x5f "PQRSTUVWXYZ[\]^_" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x6f "`abcdefghijklmno" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70-0x7f "pqrstuvwxyz{|}~ " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80-0x8f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90-0x9f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xa0-0xaf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xb0-0xbf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xc0-0xcf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xd0-0xdf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xe0-0xef " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; /* 0xf0-0xff " " */
/* Table for checking for xdigit characters. */
static const unsigned char xdigit[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00-0x0f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10-0x1f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20-0x2f " !"#$%&'()*+,-./" */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, /* 0x30-0x3f "0123456789:;<=>?" */
0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40-0x4f "@ABCDEFGHIJKLMNO" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50-0x5f "PQRSTUVWXYZ[\]^_" */
0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x6f "`abcdefghijklmno" */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70-0x7f "pqrstuvwxyz{|}~ " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80-0x8f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90-0x9f " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xa0-0xaf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xb0-0xbf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xc0-0xcf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xd0-0xdf " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xe0-0xef " " */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; /* 0xf0-0xff " " */
routino-3.0/src/filedumperx.c 644 233 144 22356 12574074473 11547 0 /***************************************
Memory file dumper for the intermediate files containing parsed data.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2008-2015 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#include
#include
#include
#include
#include "version.h"
#include "typesx.h"
#include "nodesx.h"
#include "waysx.h"
#include "relationsx.h"
#include "files.h"
#include "sorting.h"
/* Local functions */
static void print_nodes(const char *filename);
static void print_ways(const char *filename);
static void print_route_relations(const char *filename);
static void print_turn_relations(const char *filename);
static void print_usage(int detail,const char *argerr,const char *err);
/*++++++++++++++++++++++++++++++++++++++
The main program for the file dumper.
++++++++++++++++++++++++++++++++++++++*/
int main(int argc,char** argv)
{
int arg;
char *dirname=NULL,*prefix=NULL;
char *nodes_filename,*ways_filename,*route_relations_filename,*turn_relations_filename;
int option_dump;
/* Parse the command line arguments */
for(arg=1;arg=0)
{
fprintf(stderr,
"Usage: filedumperx [--version]\n"
" [--help]\n"
" [--dir=] [--prefix=]\n"
" [--dump [--nodes]\n"
" [--ways]\n"
" [--route-relations]\n"
" [--turn-relations]]\n");
if(argerr)
fprintf(stderr,
"\n"
"Error with command line parameter: %s\n",argerr);
if(err)
fprintf(stderr,
"\n"
"Error: %s\n",err);
}
if(detail==1)
fprintf(stderr,
"\n"
"--version Print the version of Routino.\n"
"\n"
"--help Prints this information.\n"
"\n"
"--dir= The directory containing the routing database.\n"
"--prefix= The filename prefix for the routing database.\n"
"\n"
"--dump Dump the intermediate files after parsing.\n"
" --nodes * all of the nodes.\n"
" --ways * all of the ways.\n"
" --route-relations * all of the route relations.\n"
" --turn-relations * all of the turn relations.\n");
exit(!detail);
}
routino-3.0/src/results.c 644 233 144 16673 12563633052 10721 0 /***************************************
Result data type functions.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2008-2015 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#include
#include
#include "results.h"
#include "logging.h"
#define HASH_NODE_SEGMENT(node,segment) ((node)^(segment<<4))
/*++++++++++++++++++++++++++++++++++++++
Allocate a new results list.
Results *NewResultsList Returns the results list.
uint8_t log2bins The base 2 logarithm of the initial number of bins in the results array.
++++++++++++++++++++++++++++++++++++++*/
Results *NewResultsList(uint8_t log2bins)
{
Results *results;
results=(Results*)malloc(sizeof(Results));
results->nbins=1<mask=results->nbins-1;
results->ncollisions=log2bins-4;
results->number=0;
results->count=(uint8_t*)calloc(results->nbins,sizeof(uint8_t));
results->point=(Result**)calloc(results->nbins,sizeof(Result*));
#ifndef LIBROUTINO
log_malloc(results->count,results->nbins*sizeof(uint8_t));
log_malloc(results->point,results->nbins*sizeof(Result*));
#endif
results->ndata1=0;
results->nallocdata1=0;
results->ndata2=results->nbins>>2;
results->data=NULL;
results->start_node=NO_NODE;
results->prev_segment=NO_SEGMENT;
results->finish_node=NO_NODE;
results->last_segment=NO_SEGMENT;
results->start_waypoint=NO_WAYPOINT;
results->finish_waypoint=NO_WAYPOINT;
return(results);
}
/*++++++++++++++++++++++++++++++++++++++
Allocate a new results list.
Results *results The results list to be reset.
++++++++++++++++++++++++++++++++++++++*/
void ResetResultsList(Results *results)
{
uint32_t i;
results->number=0;
results->ndata1=0;
for(i=0;inbins;i++)
{
results->point[i]=NULL;
results->count[i]=0;
}
results->start_node=NO_NODE;
results->prev_segment=NO_SEGMENT;
results->finish_node=NO_NODE;
results->last_segment=NO_SEGMENT;
}
/*++++++++++++++++++++++++++++++++++++++
Free a results list.
Results *results The results list to be destroyed.
++++++++++++++++++++++++++++++++++++++*/
void FreeResultsList(Results *results)
{
uint32_t i;
for(i=0;inallocdata1;i++)
{
#ifndef LIBROUTINO
log_free(results->data[i]);
#endif
free(results->data[i]);
}
free(results->data);
#ifndef LIBROUTINO
log_free(results->point);
#endif
free(results->point);
#ifndef LIBROUTINO
log_free(results->count);
#endif
free(results->count);
free(results);
}
/*++++++++++++++++++++++++++++++++++++++
Insert a new result into the results data structure in the right order.
Result *InsertResult Returns the result that has been inserted.
Results *results The results structure to insert into.
index_t node The node that is to be inserted into the results.
index_t segment The segment that is to be inserted into the results.
++++++++++++++++++++++++++++++++++++++*/
Result *InsertResult(Results *results,index_t node,index_t segment)
{
Result *result;
uint32_t bin=HASH_NODE_SEGMENT(node,segment)&results->mask;
/* Check if we have hit the limit on the number of collisions per bin */
if(results->count[bin]==results->ncollisions)
{
uint32_t i;
results->nbins<<=1;
results->mask=results->nbins-1;
results->ncollisions++;
results->count=(uint8_t*)realloc((void*)results->count,results->nbins*sizeof(uint8_t));
results->point=(Result**)realloc((void*)results->point,results->nbins*sizeof(Result*));
#ifndef LIBROUTINO
log_malloc(results->count,results->nbins*sizeof(uint8_t));
log_malloc(results->point,results->nbins*sizeof(Result*));
#endif
for(i=0;inbins/2;i++)
{
Result *r=results->point[i];
Result **bin1,**bin2;
results->count[i] =0;
results->count[i+results->nbins/2]=0;
bin1=&results->point[i];
bin2=&results->point[i+results->nbins/2];
*bin1=NULL;
*bin2=NULL;
while(r)
{
Result *rh=r->hashnext;
uint32_t newbin=HASH_NODE_SEGMENT(r->node,r->segment)&results->mask;
r->hashnext=NULL;
if(newbin==i)
{ *bin1=r; bin1=&r->hashnext; }
else
{ *bin2=r; bin2=&r->hashnext; }
results->count[newbin]++;
r=rh;
}
}
bin=HASH_NODE_SEGMENT(node,segment)&results->mask;
}
/* Check if we need more data space allocated */
if((results->number%results->ndata2)==0)
{
results->ndata1++;
if(results->ndata1>=results->nallocdata1)
{
results->nallocdata1++;
results->data=(Result**)realloc((void*)results->data,results->nallocdata1*sizeof(Result*));
results->data[results->nallocdata1-1]=(Result*)malloc(results->ndata2*sizeof(Result));
#ifndef LIBROUTINO
log_malloc(results->data[results->nallocdata1-1],results->ndata2*sizeof(Result));
#endif
}
}
/* Insert the new entry */
result=&results->data[results->ndata1-1][results->number%results->ndata2];
result->hashnext=results->point[bin];
results->point[bin]=result;
results->count[bin]++;
results->number++;
/* Initialise the result */
result->node=node;
result->segment=segment;
result->prev=NULL;
result->next=NULL;
result->score=0;
result->sortby=0;
result->queued=NOT_QUEUED;
return(result);
}
/*++++++++++++++++++++++++++++++++++++++
Find a result; search by node and segment.
Result *FindResult Returns the result that has been found.
Results *results The results structure to search.
index_t node The node that is to be found.
index_t segment The segment that was used to reach this node.
++++++++++++++++++++++++++++++++++++++*/
Result *FindResult(Results *results,index_t node,index_t segment)
{
Result *r;
uint32_t bin=HASH_NODE_SEGMENT(node,segment)&results->mask;
r=results->point[bin];
while(r)
{
if(r->segment==segment && r->node==node)
break;
r=r->hashnext;
}
return(r);
}
/*++++++++++++++++++++++++++++++++++++++
Find the first result from a set of results.
Result *FirstResult Returns the first result.
Results *results The set of results.
++++++++++++++++++++++++++++++++++++++*/
Result *FirstResult(Results *results)
{
return(&results->data[0][0]);
}
/*++++++++++++++++++++++++++++++++++++++
Find the next result from a set of results.
Result *NextResult Returns the next result.
Results *results The set of results.
Result *result The previous result.
++++++++++++++++++++++++++++++++++++++*/
Result *NextResult(Results *results,Result *result)
{
uint32_t i;
size_t j=0;
for(i=0;indata1;i++)
if(result>=results->data[i])
{
j=result-results->data[i];
if(jndata2)
break;
}
if(++j>=results->ndata2)
{i++;j=0;}
if((i*results->ndata2+j)>=results->number)
return(NULL);
return(&results->data[i][j]);
}
routino-3.0/src/logging.c 644 233 144 32423 12531126220 10622 0 /***************************************
Functions to handle logging functions.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2008-2015 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#include
#include
#include
#include
#include
#if defined(_MSC_VER)
#include
#include
static const uint64_t EPOCH = ((uint64_t) 116444736000000000ULL);
int gettimeofday(struct timeval * tp, struct timezone * tzp)
{
FILETIME file_time;
SYSTEMTIME system_time;
ULARGE_INTEGER ularge;
GetSystemTime(&system_time);
SystemTimeToFileTime(&system_time, &file_time);
ularge.LowPart = file_time.dwLowDateTime;
ularge.HighPart = file_time.dwHighDateTime;
tp->tv_sec = (long) ((ularge.QuadPart - EPOCH) / 10000000L);
tp->tv_usec = (long) (system_time.wMilliseconds * 1000);
return 0;
}
#else
#include
#endif
#include "logging.h"
/* Global variables */
/*+ The option to print the output in a way that allows logging to a file. +*/
int option_loggable=0;
/*+ The option to print elapsed time with the output. +*/
int option_logtime=0;
/*+ The option to print memory usage with the output. +*/
int option_logmemory=0;
/* Local data types */
/*+ A structure to contain the list of allocated memory. +*/
struct mallocinfo
{
void *address; /*+ The address of the allocated memory. +*/
size_t size; /*+ The size of the allocated memory. +*/
};
/* Local functions */
static void vfprintf_first(FILE *file,const char *format,va_list ap);
static void vfprintf_middle(FILE *file,const char *format,va_list ap);
static void vfprintf_last(FILE *file,const char *format,va_list ap);
static void fprintf_elapsed_time(FILE *file,struct timeval *start);
static void fprintf_max_memory(FILE *file,size_t max_alloc,size_t max_mmap);
/* Local variables */
/*+ The time that program_start() was called. +*/
static struct timeval program_start_time;
/*+ The time that printf_first() was called. +*/
static struct timeval function_start_time;
/*+ The list of allocated memory. +*/
static struct mallocinfo *mallocedmem;
/*+ The number of allocated memory blocks. +*/
static int nmallocedmem=0;
/*+ The length of the string printed out last time. +*/
static int printed_length=0;
/*+ The maximum amount of memory allocated and memory mapped since starting the program. +*/
static size_t program_max_alloc=0,program_max_mmap=0;
/*+ The maximum amount of memory allocated and memory mapped since starting the function. +*/
static size_t function_max_alloc=0,function_max_mmap=0;
/*+ The current amount of memory allocated and memory mapped. +*/
static size_t current_alloc=0,current_mmap=0;
/*++++++++++++++++++++++++++++++++++++++
Record the time that the program started.
++++++++++++++++++++++++++++++++++++++*/
void printf_program_start(void)
{
gettimeofday(&program_start_time,NULL);
program_max_alloc=program_max_mmap=0;
}
/*++++++++++++++++++++++++++++++++++++++
Record the time that the program started.
++++++++++++++++++++++++++++++++++++++*/
void printf_program_end(void)
{
if(option_logtime || option_logmemory)
{
if(option_logtime)
fprintf_elapsed_time(stdout,&program_start_time);
if(option_logmemory)
fprintf_max_memory(stdout,program_max_alloc,program_max_mmap);
printf("Finish Program\n");
if(option_logtime==2)
printf("[ m:ss.micros] ");
else if(option_logtime==1)
printf("[ m:ss.mil] ");
if(option_logmemory)
printf("[RAM,FILE MB] ");
if(option_logtime)
printf("elapsed time");
if(option_logmemory)
{
if(option_logtime)
printf(", ");
printf("maximum memory");
}
printf("\n");
fflush(stdout);
}
}
/*++++++++++++++++++++++++++++++++++++++
Print the first message in an overwriting sequence (to stdout).
const char *format The format string.
... The other arguments.
++++++++++++++++++++++++++++++++++++++*/
void printf_first(const char *format, ...)
{
va_list ap;
if(option_logtime)
gettimeofday(&function_start_time,NULL);
if(option_logmemory)
{
function_max_alloc=current_alloc;
function_max_mmap=current_mmap;
}
if(option_loggable)
return;
va_start(ap,format);
vfprintf_first(stdout,format,ap);
va_end(ap);
}
/*++++++++++++++++++++++++++++++++++++++
Print the middle message in an overwriting sequence (to stdout).
const char *format The format string.
... The other arguments.
++++++++++++++++++++++++++++++++++++++*/
void printf_middle(const char *format, ...)
{
va_list ap;
if(option_loggable)
return;
va_start(ap,format);
vfprintf_middle(stdout,format,ap);
va_end(ap);
}
/*++++++++++++++++++++++++++++++++++++++
Print the last message in an overwriting sequence (to stdout).
const char *format The format string.
... The other arguments.
++++++++++++++++++++++++++++++++++++++*/
void printf_last(const char *format, ...)
{
va_list ap;
va_start(ap,format);
vfprintf_last(stdout,format,ap);
va_end(ap);
}
/*++++++++++++++++++++++++++++++++++++++
Print the first message in an overwriting sequence to a specified file.
FILE *file The file to write to.
const char *format The format string.
... The other arguments.
++++++++++++++++++++++++++++++++++++++*/
void fprintf_first(FILE *file,const char *format, ...)
{
va_list ap;
if(option_logtime)
gettimeofday(&function_start_time,NULL);
if(option_logmemory)
{
function_max_alloc=current_alloc;
function_max_mmap=current_mmap;
}
if(option_loggable)
return;
va_start(ap,format);
vfprintf_first(file,format,ap);
va_end(ap);
}
/*++++++++++++++++++++++++++++++++++++++
Print the middle message in an overwriting sequence to a specified file.
FILE *file The file to write to.
const char *format The format string.
... The other arguments.
++++++++++++++++++++++++++++++++++++++*/
void fprintf_middle(FILE *file,const char *format, ...)
{
va_list ap;
if(option_loggable)
return;
va_start(ap,format);
vfprintf_middle(file,format,ap);
va_end(ap);
}
/*++++++++++++++++++++++++++++++++++++++
Print the last message in an overwriting sequence to a specified file.
FILE *file The file to write to.
const char *format The format string.
... The other arguments.
++++++++++++++++++++++++++++++++++++++*/
void fprintf_last(FILE *file,const char *format, ...)
{
va_list ap;
va_start(ap,format);
vfprintf_last(file,format,ap);
va_end(ap);
}
/*++++++++++++++++++++++++++++++++++++++
Record the memory allocations (record the amount in use).
void *address The address that has been allocated.
size_t size The size of the memory that has been allocated.
++++++++++++++++++++++++++++++++++++++*/
void log_malloc(void *address,size_t size)
{
int i;
if(!option_logmemory)
return;
/* Store the information about the allocated memory */
for(i=0;ifunction_max_alloc)
function_max_alloc=current_alloc;
if(current_alloc>program_max_alloc)
program_max_alloc=current_alloc;
}
/*++++++++++++++++++++++++++++++++++++++
Record the memory de-allocations.
void *address The address that has been freed.
++++++++++++++++++++++++++++++++++++++*/
void log_free(void *address)
{
size_t size=0;
int i;
if(!option_logmemory)
return;
/* Remove the information about the allocated memory */
for(i=0;ii)
memmove(&mallocedmem[i],&mallocedmem[i+1],(nmallocedmem-i)*sizeof(struct mallocinfo));
/* Reduce the sum of allocated memory */
current_alloc-=size;
}
/*++++++++++++++++++++++++++++++++++++++
Record the amount of memory that has been mapped into files.
size_t size The size of the file that has been mapped.
++++++++++++++++++++++++++++++++++++++*/
void log_mmap(size_t size)
{
if(!option_logmemory)
return;
current_mmap+=size;
if(current_mmap>function_max_mmap)
function_max_mmap=current_mmap;
if(current_mmap>program_max_mmap)
program_max_mmap=current_mmap;
}
/*++++++++++++++++++++++++++++++++++++++
Record the amount of memory that has been unmapped from files.
size_t size The size of the file that has been unmapped.
++++++++++++++++++++++++++++++++++++++*/
void log_munmap(size_t size)
{
if(!option_logmemory)
return;
current_mmap-=size;
}
/*++++++++++++++++++++++++++++++++++++++
Do the work to print the first message in an overwriting sequence.
FILE *file The file to write to.
const char *format The format string.
va_list ap The other arguments.
++++++++++++++++++++++++++++++++++++++*/
static void vfprintf_first(FILE *file,const char *format,va_list ap)
{
int retval;
if(option_logtime)
fprintf_elapsed_time(file,&function_start_time);
if(option_logmemory)
fprintf_max_memory(file,function_max_alloc,function_max_mmap);
retval=vfprintf(file,format,ap);
fflush(file);
if(retval>0)
printed_length=retval;
}
/*++++++++++++++++++++++++++++++++++++++
Do the work to print the middle message in an overwriting sequence.
FILE *file The file to write to.
const char *format The format string.
va_list ap The other arguments.
++++++++++++++++++++++++++++++++++++++*/
static void vfprintf_middle(FILE *file,const char *format,va_list ap)
{
int retval;
fputc('\r',file);
if(option_logtime)
fprintf_elapsed_time(file,&function_start_time);
if(option_logmemory)
fprintf_max_memory(file,function_max_alloc,function_max_mmap);
retval=vfprintf(file,format,ap);
fflush(file);
if(retval>0)
{
int new_printed_length=retval;
while(retval++0)
while(retval++tv_sec;
elapsed.tv_usec=finish.tv_usec-start->tv_usec;
if(elapsed.tv_usec<0)
{
elapsed.tv_sec -=1;
elapsed.tv_usec+=1000000;
}
if(option_logtime==2)
fprintf(file,"[%2ld:%02ld.%06ld] ",elapsed.tv_sec/60,elapsed.tv_sec%60,elapsed.tv_usec);
else
fprintf(file,"[%2ld:%02ld.%03ld] ",elapsed.tv_sec/60,elapsed.tv_sec%60,elapsed.tv_usec/1000);
}
/*++++++++++++++++++++++++++++++++++++++
Print the maximum used memory without a following newline.
FILE *file The file to print to.
size_t max_alloc The maximum amount of allocated memory.
size_t max_mmap The maximum amount of memory mapped memory.
++++++++++++++++++++++++++++++++++++++*/
static void fprintf_max_memory(FILE *file,size_t max_alloc,size_t max_mmap)
{
fprintf(file,"[%3zu, %3zu MB] ",max_alloc/(1024*1024),max_mmap/(1024*1024));
}
/*++++++++++++++++++++++++++++++++++++++
Log a fatal error and exit
const char *message The error message.
const char *file The file in which the error occured.
int line The line number in the file at which the error occured.
++++++++++++++++++++++++++++++++++++++*/
void _logassert(const char *message,const char *file,int line)
{
fprintf(stderr,"Routino Fatal Error (%s:%d): %s\n",file,line,message);
exit(EXIT_FAILURE);
}
routino-3.0/src/cache.h 644 233 144 21730 12550223461 10251 0 /***************************************
Functions to maintain an in-RAM cache of on-disk data for slim mode.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2013-2015 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#if SLIM
#ifndef CACHE_H
#define CACHE_H /*+ To stop multiple inclusions. +*/
#include
#include "types.h"
/* Macros for constants */
#define CACHEWIDTH 8192 /*+ The width of the cache. +*/
#define CACHEDEPTH 16 /*+ The depth of the cache. +*/
/* Macro for structure forward declaration */
#define CACHE_STRUCTURE_FWD(type) typedef struct _##type##Cache type##Cache;
/* Macro for structure declaration */
/*+ A macro to create a cache structure. +*/
#define CACHE_STRUCTURE(type) \
\
struct _##type##Cache \
{ \
int first [CACHEWIDTH]; /*+ The first entry to fill +*/ \
\
type data [CACHEWIDTH][CACHEDEPTH]; /*+ The array of type##s. +*/ \
index_t indices[CACHEWIDTH][CACHEDEPTH]; /*+ The array of indexes. +*/ \
};
/* Macros for function prototypes */
#define CACHE_NEWCACHE_PROTO(type) static inline type##Cache *New##type##Cache(void);
#define CACHE_DELETECACHE_PROTO(type) static inline void Delete##type##Cache(type##Cache *cache);
#define CACHE_FETCHCACHE_PROTO(type) static inline type *FetchCached##type(type##Cache *cache,index_t index,int fd,offset_t offset);
#define CACHE_REPLACECACHE_PROTO(type) static inline void ReplaceCached##type(type##Cache *cache,type *value,index_t index,int fd,offset_t offset);
#define CACHE_INVALIDATECACHE_PROTO(type) static inline void Invalidate##type##Cache(type##Cache *cache);
/* Macros for function definitions */
/*+ A macro to create a function that creates a new cache data structure. +*/
#define CACHE_NEWCACHE(type) \
\
static inline type##Cache *New##type##Cache(void) \
{ \
type##Cache *cache; \
\
cache=(type##Cache*)malloc(sizeof(type##Cache)); \
\
Invalidate##type##Cache(cache); \
\
return(cache); \
}
/*+ A macro to create a function that deletes a cache data structure. +*/
#define CACHE_DELETECACHE(type) \
\
static inline void Delete##type##Cache(type##Cache *cache) \
{ \
free(cache); \
}
/*+ A macro to create a function that fetches an item from a cache data structure or reads from file. +*/
#define CACHE_FETCHCACHE(type) \
\
static inline type *FetchCached##type(type##Cache *cache,index_t index,int fd,offset_t offset) \
{ \
int row=index%CACHEWIDTH; \
int col; \
\
for(col=0;colindices[row][col]==index) \
return(&cache->data[row][col]); \
\
col=cache->first[row]; \
\
cache->first[row]=(cache->first[row]+1)%CACHEDEPTH; \
\
SlimFetch(fd,&cache->data[row][col],sizeof(type),offset+(offset_t)index*sizeof(type)); \
\
cache->indices[row][col]=index; \
\
return(&cache->data[row][col]); \
}
/*+ A macro to create a function that replaces an item in a cache data structure and writes to file. +*/
#define CACHE_REPLACECACHE(type) \
\
static inline void ReplaceCached##type(type##Cache *cache,type *value,index_t index,int fd,offset_t offset) \
{ \
int row=index%CACHEWIDTH; \
int col; \
\
for(col=0;colindices[row][col]==index) \
break; \
\
if(col==CACHEDEPTH) \
{ \
col=cache->first[row]; \
\
cache->first[row]=(cache->first[row]+1)%CACHEDEPTH; \
} \
\
cache->indices[row][col]=index; \
\
cache->data[row][col]=*value; \
\
SlimReplace(fd,&cache->data[row][col],sizeof(type),offset+(offset_t)index*sizeof(type)); \
}
/*+ A macro to create a function that invalidates the contents of a cache data structure. +*/
#define CACHE_INVALIDATECACHE(type) \
\
static inline void Invalidate##type##Cache(type##Cache *cache) \
{ \
int row,col; \
\
for(row=0;rowfirst[row]=0; \
\
for(col=0;colindices[row][col]=NO_NODE; \
} \
}
/*+ Cache data structure forward declarations (for planetsplitter). +*/
CACHE_STRUCTURE_FWD(NodeX)
CACHE_STRUCTURE_FWD(SegmentX)
CACHE_STRUCTURE_FWD(WayX)
/*+ Cache data structure forward declarations (for router). +*/
CACHE_STRUCTURE_FWD(Node)
CACHE_STRUCTURE_FWD(Segment)
CACHE_STRUCTURE_FWD(Way)
CACHE_STRUCTURE_FWD(TurnRelation)
#endif /* CACHE_H */
#endif /* SLIM */
routino-3.0/src/prunex.c 644 233 144 124362 12420524666 10556 0 /***************************************
Data pruning functions.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2011-2014 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#include
#include "types.h"
#include "segments.h"
#include "typesx.h"
#include "nodesx.h"
#include "segmentsx.h"
#include "waysx.h"
#include "prunex.h"
#include "files.h"
#include "logging.h"
/* Global variables */
/*+ The command line '--tmpdir' option or its default value. +*/
extern char *option_tmpdirname;
/* Local functions */
static void prune_segment(SegmentsX *segmentsx,SegmentX *segmentx);
static void modify_segment(SegmentsX *segmentsx,SegmentX *segmentx,index_t newnode1,index_t newnode2);
static void unlink_segment_node1_refs(SegmentsX *segmentsx,SegmentX *segmentx);
static void unlink_segment_node2_refs(SegmentsX *segmentsx,SegmentX *segmentx);
static double distance(double lat1,double lon1,double lat2,double lon2);
/*++++++++++++++++++++++++++++++++++++++
Initialise the data structures needed for pruning.
NodesX *nodesx The set of nodes to use.
SegmentsX *segmentsx The set of segments to use.
WaysX *waysx The set of ways to use.
++++++++++++++++++++++++++++++++++++++*/
void StartPruning(NodesX *nodesx,SegmentsX *segmentsx,WaysX *waysx)
{
SegmentX segmentx;
index_t index=0,lastnode1=NO_NODE;
if(segmentsx->number==0)
return;
/* Print the start message */
printf_first("Adding Extra Segment Indexes: Segments=0");
/* Allocate the array of next segment */
segmentsx->next1=(index_t*)calloc(segmentsx->number,sizeof(index_t));
log_malloc(segmentsx->next1,segmentsx->number*sizeof(index_t));
logassert(segmentsx->next1,"Failed to allocate memory (try using slim mode?)"); /* Check calloc() worked */
/* Open the file read-only */
segmentsx->fd=ReOpenFileBuffered(segmentsx->filename_tmp);
/* Read the on-disk image */
while(!ReadFileBuffered(segmentsx->fd,&segmentx,sizeof(SegmentX)))
{
index_t node1=segmentx.node1;
if(index==0)
;
else if(lastnode1==node1)
segmentsx->next1[index-1]=index;
else
segmentsx->next1[index-1]=NO_SEGMENT;
lastnode1=node1;
index++;
if(!(index%10000))
printf_middle("Added Extra Segment Indexes: Segments=%"Pindex_t,index);
}
segmentsx->next1[index-1]=NO_SEGMENT;
/* Close the file */
segmentsx->fd=CloseFileBuffered(segmentsx->fd);
/* Print the final message */
printf_last("Added Extra Segment Indexes: Segments=%"Pindex_t,segmentsx->number);
}
/*++++++++++++++++++++++++++++++++++++++
Delete the data structures needed for pruning.
NodesX *nodesx The set of nodes to use.
SegmentsX *segmentsx The set of segments to use.
WaysX *waysx The set of ways to use.
++++++++++++++++++++++++++++++++++++++*/
void FinishPruning(NodesX *nodesx,SegmentsX *segmentsx,WaysX *waysx)
{
if(segmentsx->next1)
{
log_free(segmentsx->next1);
free(segmentsx->next1);
segmentsx->next1=NULL;
}
}
/*++++++++++++++++++++++++++++++++++++++
Prune out any groups of nodes and segments whose total length is less than a
specified minimum.
NodesX *nodesx The set of nodes to use.
SegmentsX *segmentsx The set of segments to use.
WaysX *waysx The set of ways to use.
distance_t minimum The minimum distance to keep.
++++++++++++++++++++++++++++++++++++++*/
void PruneIsolatedRegions(NodesX *nodesx,SegmentsX *segmentsx,WaysX *waysx,distance_t minimum)
{
WaysX *newwaysx;
WayX tmpwayx;
transport_t transport;
BitMask *connected,*region;
index_t *regionsegments,*othersegments;
index_t nallocregionsegments,nallocothersegments;
if(nodesx->number==0 || segmentsx->number==0)
return;
/* Map into memory / open the files */
#if !SLIM
nodesx->data=MapFile(nodesx->filename_tmp);
segmentsx->data=MapFileWriteable(segmentsx->filename_tmp);
waysx->data=MapFile(waysx->filename_tmp);
#else
nodesx->fd=SlimMapFile(nodesx->filename_tmp);
segmentsx->fd=SlimMapFileWriteable(segmentsx->filename_tmp);
waysx->fd=SlimMapFile(waysx->filename_tmp);
InvalidateNodeXCache(nodesx->cache);
InvalidateSegmentXCache(segmentsx->cache);
InvalidateWayXCache(waysx->cache);
#endif
newwaysx=NewWayList(0,0);
CloseFileBuffered(newwaysx->fd);
newwaysx->fd=SlimMapFileWriteable(newwaysx->filename_tmp);
connected=AllocBitMask(segmentsx->number);
region =AllocBitMask(segmentsx->number);
log_malloc(connected,LengthBitMask(segmentsx->number)*sizeof(BitMask));
log_malloc(region ,LengthBitMask(segmentsx->number)*sizeof(BitMask));
logassert(connected,"Failed to allocate memory (try using slim mode?)"); /* Check AllocBitMask() worked */
logassert(region ,"Failed to allocate memory (try using slim mode?)"); /* Check AllocBitMask() worked */
regionsegments=(index_t*)malloc((nallocregionsegments=1024)*sizeof(index_t));
othersegments =(index_t*)malloc((nallocothersegments =1024)*sizeof(index_t));
logassert(regionsegments,"Failed to allocate memory (try using slim mode?)"); /* Check malloc() worked */
logassert(othersegments ,"Failed to allocate memory (try using slim mode?)"); /* Check malloc() worked */
/* Loop through the transport types */
for(transport=Transport_None+1;transportallow&transports))
continue;
/* Print the start message */
printf_first("Pruning Isolated Regions (%s): Segments=0 Adjusted=0 Pruned=0",transport_str);
/* Loop through the segments and find the disconnected ones */
ClearAllBits(connected,segmentsx->number);
ClearAllBits(region ,segmentsx->number);
for(i=0;inumber;i++)
{
index_t nregionsegments=0,nothersegments=0;
distance_t total=0;
SegmentX *segmentx;
WayX *wayx;
if(IsBitSet(connected,i))
goto endloop;
segmentx=LookupSegmentX(segmentsx,i,1);
if(IsPrunedSegmentX(segmentx))
goto endloop;
if(segmentx->waynumber)
wayx=LookupWayX(waysx,segmentx->way,1);
else
SlimFetch(newwaysx->fd,(wayx=&tmpwayx),sizeof(WayX),(segmentx->way-waysx->number)*sizeof(WayX));
if(!(wayx->way.allow&transports))
goto endloop;
othersegments[nothersegments++]=i;
SetBit(region,i);
do
{
index_t thissegment,nodes[2];
thissegment=othersegments[--nothersegments];
if(nregionsegments==nallocregionsegments)
regionsegments=(index_t*)realloc(regionsegments,(nallocregionsegments+=1024)*sizeof(index_t));
regionsegments[nregionsegments++]=thissegment;
segmentx=LookupSegmentX(segmentsx,thissegment,1);
nodes[0]=segmentx->node1;
nodes[1]=segmentx->node2;
total+=DISTANCE(segmentx->distance);
for(j=0;j<2;j++)
{
NodeX *nodex=LookupNodeX(nodesx,nodes[j],1);
if(!(nodex->allow&transports))
continue;
segmentx=FirstSegmentX(segmentsx,nodes[j],1);
while(segmentx)
{
index_t segment=IndexSegmentX(segmentsx,segmentx);
if(segment!=thissegment)
{
if(segmentx->waynumber)
wayx=LookupWayX(waysx,segmentx->way,1);
else
SlimFetch(newwaysx->fd,(wayx=&tmpwayx),sizeof(WayX),(segmentx->way-waysx->number)*sizeof(WayX));
if(wayx->way.allow&transports)
{
/* Already connected - finish */
if(IsBitSet(connected,segment))
{
total=minimum;
goto foundconnection;
}
/* Not in region - add to list */
if(!IsBitSet(region,segment))
{
if(nothersegments==nallocothersegments)
othersegments=(index_t*)realloc(othersegments,(nallocothersegments+=1024)*sizeof(index_t));
othersegments[nothersegments++]=segment;
SetBit(region,segment);
}
}
}
segmentx=NextSegmentX(segmentsx,segmentx,nodes[j]);
}
}
}
while(nothersegments>0 && totalwaynumber)
wayx=LookupWayX(waysx,segmentx->way,1);
else
SlimFetch(newwaysx->fd,(wayx=&tmpwayx),sizeof(WayX),(segmentx->way-waysx->number)*sizeof(WayX));
if(wayx->way.allow==transports)
{
prune_segment(segmentsx,segmentx);
npruned++;
}
else
{
if(segmentx->waynumber) /* create a new way */
{
tmpwayx=*wayx;
tmpwayx.way.allow&=~transports;
segmentx->way=waysx->number+newwaysx->number;
SlimReplace(newwaysx->fd,&tmpwayx,sizeof(WayX),(segmentx->way-waysx->number)*sizeof(WayX));
newwaysx->number++;
PutBackSegmentX(segmentsx,segmentx);
}
else /* modify the existing one */
{
tmpwayx.way.allow&=~transports;
SlimReplace(newwaysx->fd,&tmpwayx,sizeof(WayX),(segmentx->way-waysx->number)*sizeof(WayX));
}
nadjusted++;
}
}
}
else /* connected - mark as part of the main region */
{
for(j=0;jnumber,nadjusted,npruned,nregions);
}
/* Unmap from memory / close the files */
log_free(region);
log_free(connected);
free(region);
free(connected);
free(regionsegments);
free(othersegments);
#if !SLIM
nodesx->data=UnmapFile(nodesx->data);
segmentsx->data=UnmapFile(segmentsx->data);
waysx->data=UnmapFile(waysx->data);
#else
nodesx->fd=SlimUnmapFile(nodesx->fd);
segmentsx->fd=SlimUnmapFile(segmentsx->fd);
waysx->fd=SlimUnmapFile(waysx->fd);
#endif
SlimUnmapFile(newwaysx->fd);
waysx->number+=newwaysx->number;
waysx->fd=OpenFileBufferedAppend(waysx->filename_tmp);
newwaysx->fd=ReOpenFileBuffered(newwaysx->filename_tmp);
while(!ReadFileBuffered(newwaysx->fd,&tmpwayx,sizeof(WayX)))
WriteFileBuffered(waysx->fd,&tmpwayx,sizeof(WayX));
CloseFileBuffered(waysx->fd);
CloseFileBuffered(newwaysx->fd);
FreeWayList(newwaysx,0);
}
/*++++++++++++++++++++++++++++++++++++++
Prune out any segments that are shorter than a specified minimum.
NodesX *nodesx The set of nodes to use.
SegmentsX *segmentsx The set of segments to use.
WaysX *waysx The set of ways to use.
distance_t minimum The maximum length to remove or one less than the minimum length to keep.
++++++++++++++++++++++++++++++++++++++*/
void PruneShortSegments(NodesX *nodesx,SegmentsX *segmentsx,WaysX *waysx,distance_t minimum)
{
index_t i;
index_t nshort=0,npruned=0;
if(nodesx->number==0 || segmentsx->number==0 || waysx->number==0)
return;
/* Print the start message */
printf_first("Pruning Short Segments: Segments=0 Short=0 Pruned=0");
/* Map into memory / open the files */
#if !SLIM
nodesx->data=MapFileWriteable(nodesx->filename_tmp);
segmentsx->data=MapFileWriteable(segmentsx->filename_tmp);
waysx->data=MapFile(waysx->filename_tmp);
#else
nodesx->fd=SlimMapFileWriteable(nodesx->filename_tmp);
segmentsx->fd=SlimMapFileWriteable(segmentsx->filename_tmp);
waysx->fd=SlimMapFile(waysx->filename_tmp);
InvalidateNodeXCache(nodesx->cache);
InvalidateSegmentXCache(segmentsx->cache);
InvalidateWayXCache(waysx->cache);
#endif
/* Loop through the segments and find the short ones for possible modification */
for(i=0;inumber;i++)
{
SegmentX *segmentx2=LookupSegmentX(segmentsx,i,2);
if(IsPrunedSegmentX(segmentx2))
goto endloop;
/*
:
Initial state: ..N3 -------- N2
: S2
:
Final state: ..N3
:
= OR =
: :
Initial state: ..N1 -------- N2 ---- N3 -------- N4..
: S1 S2 S3 :
: :
Final state: ..N1 ------------ N3 ------------ N4..
: S1 S3 :
Not if N1 is the same as N4.
Must not delete N2 (or N3) if S2 (or S3) has different one-way properties from S1.
Must not delete N2 (or N3) if S2 (or S3) has different highway properties from S1.
Must combine N2, S2 and N3 disallowed transports into new N3.
Must not delete N2 (or N3) if it is a mini-roundabout.
Must not delete N2 (or N3) if it is involved in a turn restriction.
= OR =
: :
Initial state: ..N1 -------- N2 ---- N3..
: S1 S2 :
: :
Final state: ..N1 ------------ N3..
: S1 :
Not if N1 is the same as N3.
Not if S1 has different one-way properties from S2.
Not if S1 has different highway properties from S2.
Not if N2 disallows transports allowed on S1 and S2.
Not if N2 is a mini-roundabout.
Not if N2 is involved in a turn restriction.
*/
if(DISTANCE(segmentx2->distance)<=minimum)
{
index_t node1=NO_NODE,node2,node3,node4=NO_NODE;
index_t segment1=NO_SEGMENT,segment2=i,segment3=NO_SEGMENT;
SegmentX *segmentx;
int segcount2=0,segcount3=0;
nshort++;
node2=segmentx2->node1;
node3=segmentx2->node2;
/* Count the segments connected to N2 */
segmentx=FirstSegmentX(segmentsx,node2,4);
while(segmentx)
{
segcount2++;
if(segment1==NO_SEGMENT)
{
index_t segment=IndexSegmentX(segmentsx,segmentx);
if(segment!=segment2)
{
segment1=segment;
node1=OtherNode(segmentx,node2);
}
}
else if(segcount2>2)
break;
segmentx=NextSegmentX(segmentsx,segmentx,node2);
}
/* Count the segments connected to N3 */
segmentx=FirstSegmentX(segmentsx,node3,4);
while(segmentx)
{
segcount3++;
if(segment3==NO_SEGMENT)
{
index_t segment=IndexSegmentX(segmentsx,segmentx);
if(segment!=segment2)
{
segment3=segment;
node4=OtherNode(segmentx,node3);
}
}
else if(segcount3>2)
break;
segmentx=NextSegmentX(segmentsx,segmentx,node3);
}
/* Check which case we are handling (and canonicalise) */
if(segcount2>2 && segcount3>2) /* none of the cases in diagram - too complicated */
{
goto endloop;
}
else if(segcount2==1 || segcount3==1) /* first case in diagram - prune segment */
{
prune_segment(segmentsx,segmentx2);
}
else if(segcount2==2 && segcount3==2) /* second case in diagram - modify one segment and prune segment */
{
SegmentX *segmentx1,*segmentx3;
WayX *wayx1,*wayx2,*wayx3;
NodeX *nodex2,*nodex3,*newnodex;
index_t newnode;
int join12=1,join23=1,same13=1;
/* Check if pruning would collapse a loop */
if(node1==node4)
goto endloop;
/* Check if allowed due to one-way properties */
segmentx1=LookupSegmentX(segmentsx,segment1,1);
segmentx3=LookupSegmentX(segmentsx,segment3,3);
if(!IsOneway(segmentx1) && !IsOneway(segmentx2))
;
else if(IsOneway(segmentx1) && IsOneway(segmentx2))
{
if(IsOnewayTo(segmentx1,node2) && !IsOnewayFrom(segmentx2,node2)) /* S1 is one-way but S2 doesn't continue */
join12=0;
if(IsOnewayFrom(segmentx1,node2) && !IsOnewayTo(segmentx2,node2)) /* S1 is one-way but S2 doesn't continue */
join12=0;
}
else
join12=0;
if(!IsOneway(segmentx3) && !IsOneway(segmentx2))
;
else if(IsOneway(segmentx3) && IsOneway(segmentx2))
{
if(IsOnewayTo(segmentx3,node3) && !IsOnewayFrom(segmentx2,node3)) /* S3 is one-way but S2 doesn't continue */
join23=0;
if(IsOnewayFrom(segmentx3,node3) && !IsOnewayTo(segmentx2,node3)) /* S3 is one-way but S2 doesn't continue */
join23=0;
}
else
join23=0;
if(!join12 && !join23)
goto endloop;
/* Check if allowed due to highway properties */
wayx1=LookupWayX(waysx,segmentx1->way,1);
wayx2=LookupWayX(waysx,segmentx2->way,2);
wayx3=LookupWayX(waysx,segmentx3->way,3);
if(WaysCompare(&wayx1->way,&wayx2->way))
join12=0;
if(WaysCompare(&wayx3->way,&wayx2->way))
join23=0;
if(!join12 && !join23)
goto endloop;
/* Check if allowed due to mini-roundabout and turn restriction */
nodex2=LookupNodeX(nodesx,node2,2);
nodex3=LookupNodeX(nodesx,node3,3);
if(nodex2->flags&NODE_MINIRNDBT)
join12=0;
if(nodex3->flags&NODE_MINIRNDBT)
join23=0;
if(!join12 && !join23)
goto endloop;
if(nodex2->flags&NODE_TURNRSTRCT2 || nodex2->flags&NODE_TURNRSTRCT)
join12=0;
if(nodex3->flags&NODE_TURNRSTRCT2 || nodex3->flags&NODE_TURNRSTRCT)
join23=0;
if(!join12 && !join23)
goto endloop;
/* New node properties */
if(join12)
{
newnode=node3;
newnodex=nodex3;
}
else /* if(join23) */
{
newnode=node2;
newnodex=nodex2;
}
newnodex->allow=nodex2->allow&nodex3->allow; /* combine the restrictions of the two nodes */
newnodex->allow&=~((~wayx2->way.allow)&wayx3->way.allow); /* disallow anything blocked by segment2 */
newnodex->allow&=~((~wayx2->way.allow)&wayx1->way.allow); /* disallow anything blocked by segment2 */
newnodex->latitude =(nodex2->latitude +nodex3->latitude )/2;
newnodex->longitude=(nodex2->longitude+nodex3->longitude)/2;
PutBackNodeX(nodesx,newnodex);
/* Modify segments - update the distances */
if(!IsOneway(segmentx1) && !IsOneway(segmentx3))
;
else if(IsOneway(segmentx1) && IsOneway(segmentx3))
{
if(IsOnewayTo(segmentx1,node3) && !IsOnewayFrom(segmentx3,node3)) /* S1 is one-way but S3 doesn't continue */
same13=0;
if(IsOnewayFrom(segmentx1,node3) && !IsOnewayTo(segmentx3,node3)) /* S1 is one-way but S3 doesn't continue */
same13=0;
}
else
same13=0;
if(WaysCompare(&wayx1->way,&wayx3->way))
same13=0;
if(same13)
{
segmentx1->distance+=DISTANCE(segmentx2->distance)/2;
segmentx3->distance+=DISTANCE(segmentx2->distance)-DISTANCE(segmentx2->distance)/2;
}
else if(join12)
segmentx1->distance+=DISTANCE(segmentx2->distance);
else /* if(join23) */
segmentx3->distance+=DISTANCE(segmentx2->distance);
/* Modify segments - update the segments */
if(segmentx1->node1==node1)
{
if(segmentx1->node2!=newnode)
modify_segment(segmentsx,segmentx1,node1,newnode);
else
PutBackSegmentX(segmentsx,segmentx1);
}
else /* if(segmentx1->node2==node1) */
{
if(segmentx1->node1!=newnode)
modify_segment(segmentsx,segmentx1,newnode,node1);
else
PutBackSegmentX(segmentsx,segmentx1);
}
if(segmentx3->node1==node4)
{
if(segmentx3->node2!=newnode)
modify_segment(segmentsx,segmentx3,node4,newnode);
else
PutBackSegmentX(segmentsx,segmentx3);
}
else /* if(segmentx3->node2==node4) */
{
if(segmentx3->node1!=newnode)
modify_segment(segmentsx,segmentx3,newnode,node4);
else
PutBackSegmentX(segmentsx,segmentx3);
}
ReLookupSegmentX(segmentsx,segmentx2);
prune_segment(segmentsx,segmentx2);
}
else /* third case in diagram - prune one segment */
{
SegmentX *segmentx1;
WayX *wayx1,*wayx2;
NodeX *nodex2;
if(segcount3==2) /* not as in diagram, shuffle things round */
{
index_t temp;
temp=segment1; segment1=segment3; segment3=temp;
temp=node1; node1=node4; node4=temp;
temp=node2; node2=node3; node3=temp;
}
/* Check if pruning would collapse a loop */
if(node1==node3)
goto endloop;
/* Check if allowed due to one-way properties */
segmentx1=LookupSegmentX(segmentsx,segment1,1);
if(!IsOneway(segmentx1) && !IsOneway(segmentx2))
;
else if(IsOneway(segmentx1) && IsOneway(segmentx2))
{
if(IsOnewayTo(segmentx1,node2) && !IsOnewayFrom(segmentx2,node2)) /* S1 is one-way but S2 doesn't continue */
goto endloop;
if(IsOnewayFrom(segmentx1,node2) && !IsOnewayTo(segmentx2,node2)) /* S1 is one-way but S2 doesn't continue */
goto endloop;
}
else
goto endloop;
/* Check if allowed due to highway properties */
wayx1=LookupWayX(waysx,segmentx1->way,1);
wayx2=LookupWayX(waysx,segmentx2->way,2);
if(WaysCompare(&wayx1->way,&wayx2->way))
goto endloop;
/* Check if allowed due to mini-roundabout and turn restriction */
nodex2=LookupNodeX(nodesx,node2,2);
if(nodex2->flags&NODE_MINIRNDBT)
goto endloop;
if(nodex2->flags&NODE_TURNRSTRCT2 || nodex2->flags&NODE_TURNRSTRCT)
goto endloop;
/* Check if allowed due to node restrictions */
if((nodex2->allow&wayx1->way.allow)!=wayx1->way.allow)
goto endloop;
if((nodex2->allow&wayx2->way.allow)!=wayx2->way.allow)
goto endloop;
/* Modify segments */
segmentx1->distance+=DISTANCE(segmentx2->distance);
if(segmentx1->node1==node1)
modify_segment(segmentsx,segmentx1,node1,node3);
else /* if(segmentx1->node2==node1) */
modify_segment(segmentsx,segmentx1,node3,node1);
ReLookupSegmentX(segmentsx,segmentx2);
prune_segment(segmentsx,segmentx2);
}
npruned++;
}
endloop:
if(!((i+1)%10000))
printf_middle("Pruning Short Segments: Segments=%"Pindex_t" Short=%"Pindex_t" Pruned=%"Pindex_t,i+1,nshort,npruned);
}
/* Unmap from memory / close the files */
#if !SLIM
nodesx->data=UnmapFile(nodesx->data);
segmentsx->data=UnmapFile(segmentsx->data);
waysx->data=UnmapFile(waysx->data);
#else
nodesx->fd=SlimUnmapFile(nodesx->fd);
segmentsx->fd=SlimUnmapFile(segmentsx->fd);
waysx->fd=SlimUnmapFile(waysx->fd);
#endif
/* Print the final message */
printf_last("Pruned Short Segments: Segments=%"Pindex_t" Short=%"Pindex_t" Pruned=%"Pindex_t,segmentsx->number,nshort,npruned);
}
/*++++++++++++++++++++++++++++++++++++++
Prune out any nodes from straight highways where the introduced error is smaller than a specified maximum.
NodesX *nodesx The set of nodes to use.
SegmentsX *segmentsx The set of segments to use.
WaysX *waysx The set of ways to use.
distance_t maximum The maximum error to introduce.
++++++++++++++++++++++++++++++++++++++*/
void PruneStraightHighwayNodes(NodesX *nodesx,SegmentsX *segmentsx,WaysX *waysx,distance_t maximum)
{
index_t i;
index_t npruned=0;
index_t nalloc;
BitMask *checked;
index_t *nodes,*segments;
double *lats,*lons;
double maximumf;
if(nodesx->number==0 || segmentsx->number==0 || waysx->number==0)
return;
/* Print the start message */
printf_first("Pruning Straight Highway Nodes: Nodes=0 Pruned=0");
/* Map into memory / open the files */
#if !SLIM
nodesx->data=MapFile(nodesx->filename_tmp);
segmentsx->data=MapFileWriteable(segmentsx->filename_tmp);
waysx->data=MapFile(waysx->filename_tmp);
#else
nodesx->fd=SlimMapFile(nodesx->filename_tmp);
segmentsx->fd=SlimMapFileWriteable(segmentsx->filename_tmp);
waysx->fd=SlimMapFile(waysx->filename_tmp);
InvalidateNodeXCache(nodesx->cache);
InvalidateSegmentXCache(segmentsx->cache);
InvalidateWayXCache(waysx->cache);
#endif
checked=AllocBitMask(nodesx->number);
log_malloc(checked,LengthBitMask(nodesx->number)*sizeof(BitMask));
logassert(checked,"Failed to allocate memory (try using slim mode?)"); /* Check AllocBitMask() worked */
nodes =(index_t*)malloc((nalloc=1024)*sizeof(index_t));
segments=(index_t*)malloc( nalloc *sizeof(index_t));
logassert(nodes ,"Failed to allocate memory (try using slim mode?)"); /* Check malloc() worked */
logassert(segments,"Failed to allocate memory (try using slim mode?)"); /* Check malloc() worked */
lats=(double*)malloc(nalloc*sizeof(double));
lons=(double*)malloc(nalloc*sizeof(double));
logassert(lats,"Failed to allocate memory (try using slim mode?)"); /* Check malloc() worked */
logassert(lons,"Failed to allocate memory (try using slim mode?)"); /* Check malloc() worked */
/* Loop through the nodes and find stretches of simple highway for possible modification */
maximumf=distance_to_km(maximum);
for(i=0;inumber;i++)
{
int lowerbounded=0,upperbounded=0;
index_t lower=nalloc/2,current=nalloc/2,upper=nalloc/2;
if(IsBitSet(checked,i))
goto endloop;
if(segmentsx->firstnode[i]==NO_SEGMENT)
goto endloop;
/* Find all connected nodes */
nodes[current]=i;
do
{
index_t node1=NO_NODE,node2=NO_NODE;
index_t segment1=NO_SEGMENT,segment2=NO_SEGMENT;
index_t way1=NO_WAY,way2=NO_WAY;
int segcount=0;
NodeX *nodex;
/* Get the node data */
nodex=LookupNodeX(nodesx,nodes[current],1);
lats[current]=latlong_to_radians(nodex->latitude);
lons[current]=latlong_to_radians(nodex->longitude);
/* Count the segments at the node if not forced to be an end node */
if(IsBitSet(checked,nodes[current]))
;
else if(nodex->flags&NODE_MINIRNDBT)
;
else if(nodex->flags&NODE_TURNRSTRCT2 || nodex->flags&NODE_TURNRSTRCT)
;
else
{
SegmentX *segmentx;
/* Count the segments connected to the node */
segmentx=FirstSegmentX(segmentsx,nodes[current],3);
while(segmentx)
{
segcount++;
if(node1==NO_NODE)
{
segment1=IndexSegmentX(segmentsx,segmentx);
node1=OtherNode(segmentx,nodes[current]);
way1=segmentx->way;
}
else if(node2==NO_NODE)
{
segment2=IndexSegmentX(segmentsx,segmentx);
node2=OtherNode(segmentx,nodes[current]);
way2=segmentx->way;
}
else
break;
segmentx=NextSegmentX(segmentsx,segmentx,nodes[current]);
}
}
/* Check if allowed due to one-way properties */
if(segcount==2)
{
SegmentX *segmentx1,*segmentx2;
segmentx1=LookupSegmentX(segmentsx,segment1,1);
segmentx2=LookupSegmentX(segmentsx,segment2,2);
if(!IsOneway(segmentx1) && !IsOneway(segmentx2))
;
else if(IsOneway(segmentx1) && IsOneway(segmentx2))
{
if(IsOnewayTo(segmentx1,nodes[current]) && !IsOnewayFrom(segmentx2,nodes[current])) /* S1 is one-way but S2 doesn't continue */
segcount=0;
if(IsOnewayFrom(segmentx1,nodes[current]) && !IsOnewayTo(segmentx2,nodes[current])) /* S1 is one-way but S2 doesn't continue */
segcount=0;
}
else
segcount=0;
}
/* Check if allowed due to highway properties and node restrictions */
if(segcount==2)
{
WayX *wayx1,*wayx2;
wayx1=LookupWayX(waysx,way1,1);
wayx2=LookupWayX(waysx,way2,2);
if(WaysCompare(&wayx1->way,&wayx2->way))
segcount=0;
if(wayx1->way.name!=wayx2->way.name)
segcount=0;
if((nodex->allow&wayx1->way.allow)!=wayx1->way.allow)
segcount=0;
if((nodex->allow&wayx2->way.allow)!=wayx2->way.allow)
segcount=0;
}
/* Update the lists */
if(segcount==2)
{
/* Make space in the lists */
if(upper==(nalloc-1))
{
nodes =(index_t*)realloc(nodes ,(nalloc+=1024)*sizeof(index_t));
segments=(index_t*)realloc(segments, nalloc *sizeof(index_t));
lats=(double*)realloc(lats,nalloc*sizeof(double));
lons=(double*)realloc(lons,nalloc*sizeof(double));
}
if(lower==0) /* move everything up by one */
{
memmove(nodes+1 ,nodes ,(1+upper-lower)*sizeof(index_t));
memmove(segments+1,segments,(1+upper-lower)*sizeof(index_t));
memmove(lats+1,lats,(1+upper-lower)*sizeof(double));
memmove(lons+1,lons,(1+upper-lower)*sizeof(double));
current++;
lower++;
upper++;
}
if(lower==upper) /* first */
{
lower--;
nodes[lower]=node1;
segments[lower]=segment1;
upper++;
nodes[upper]=node2;
segments[upper-1]=segment2;
segments[upper]=NO_SEGMENT;
current--;
}
else if(current==lower)
{
lower--;
if(nodes[current+1]==node2)
{
nodes[lower]=node1;
segments[lower]=segment1;
}
else /* if(nodes[current+1]==node1) */
{
nodes[lower]=node2;
segments[lower]=segment2;
}
current--;
}
else /* if(current==upper) */
{
upper++;
if(nodes[current-1]==node2)
{
nodes[upper]=node1;
segments[upper-1]=segment1;
}
else /* if(nodes[current-1]==node1) */
{
nodes[upper]=node2;
segments[upper-1]=segment2;
}
segments[upper]=NO_SEGMENT;
current++;
}
if(nodes[upper]==nodes[lower])
{
if(!lowerbounded && !upperbounded)
{
nodex=LookupNodeX(nodesx,nodes[lower],1);
lats[lower]=latlong_to_radians(nodex->latitude);
lons[lower]=latlong_to_radians(nodex->longitude);
}
lats[upper]=lats[lower];
lons[upper]=lons[lower];
lowerbounded=1;
upperbounded=1;
}
}
else /* if(segment!=2) */
{
if(current==upper)
upperbounded=1;
if(current==lower)
{
lowerbounded=1;
current=upper;
}
}
}
while(!(lowerbounded && upperbounded));
/* Mark the nodes */
for(current=lower;current<=upper;current++)
SetBit(checked,nodes[current]);
/* Check for straight highway */
for(;lower<(upper-1);lower++)
{
for(current=upper;current>(lower+1);current--)
{
SegmentX *segmentx;
distance_t dist=0;
double dist1,dist2,dist3,distp;
index_t c;
dist3=distance(lats[lower],lons[lower],lats[current],lons[current]);
for(c=lower+1;c=0 && dist3b>=0)
distp=sqrt(dist1*dist1-dist3a*dist3a);
else if(dist3a>0)
distp=dist2;
else /* if(dist3b>0) */
distp=dist1;
}
if(distp>maximumf) /* gone too far */
break;
}
if(cdistance);
prune_segment(segmentsx,segmentx);
npruned++;
}
segmentx=LookupSegmentX(segmentsx,segments[lower],1);
if(nodes[lower]==nodes[current]) /* loop; all within maximum distance */
{
prune_segment(segmentsx,segmentx);
npruned++;
}
else
{
segmentx->distance+=dist;
if(segmentx->node1==nodes[lower])
modify_segment(segmentsx,segmentx,nodes[lower],nodes[current]);
else /* if(segmentx->node2==nodes[lower]) */
modify_segment(segmentsx,segmentx,nodes[current],nodes[lower]);
}
lower=current-1;
break;
}
}
endloop:
if(!((i+1)%10000))
printf_middle("Pruning Straight Highway Nodes: Nodes=%"Pindex_t" Pruned=%"Pindex_t,i+1,npruned);
}
/* Unmap from memory / close the files */
log_free(checked);
free(checked);
free(nodes);
free(segments);
free(lats);
free(lons);
#if !SLIM
nodesx->data=UnmapFile(nodesx->data);
segmentsx->data=UnmapFile(segmentsx->data);
waysx->data=UnmapFile(waysx->data);
#else
nodesx->fd=SlimUnmapFile(nodesx->fd);
segmentsx->fd=SlimUnmapFile(segmentsx->fd);
waysx->fd=SlimUnmapFile(waysx->fd);
#endif
/* Print the final message */
printf_last("Pruned Straight Highway Nodes: Nodes=%"Pindex_t" Pruned=%"Pindex_t,nodesx->number,npruned);
}
/*++++++++++++++++++++++++++++++++++++++
Prune a segment; unused nodes and ways will get marked for pruning later.
SegmentsX *segmentsx The set of segments to use.
SegmentX *segmentx The segment to be pruned.
++++++++++++++++++++++++++++++++++++++*/
static void prune_segment(SegmentsX *segmentsx,SegmentX *segmentx)
{
unlink_segment_node1_refs(segmentsx,segmentx);
unlink_segment_node2_refs(segmentsx,segmentx);
segmentx->node1=NO_NODE;
segmentx->node2=NO_NODE;
segmentx->next2=NO_SEGMENT;
PutBackSegmentX(segmentsx,segmentx);
}
/*++++++++++++++++++++++++++++++++++++++
Modify a segment's nodes; unused nodes will get marked for pruning later.
SegmentsX *segmentsx The set of segments to use.
SegmentX *segmentx The segment to be modified.
index_t newnode1 The new value of node1.
index_t newnode2 The new value of node2.
++++++++++++++++++++++++++++++++++++++*/
static void modify_segment(SegmentsX *segmentsx,SegmentX *segmentx,index_t newnode1,index_t newnode2)
{
index_t thissegment=IndexSegmentX(segmentsx,segmentx);
if(newnode1>newnode2) /* rotate the segment around */
{
index_t temp;
if(segmentx->distance&(ONEWAY_2TO1|ONEWAY_1TO2))
segmentx->distance^=ONEWAY_2TO1|ONEWAY_1TO2;
temp=newnode1;
newnode1=newnode2;
newnode2=temp;
}
if(newnode1!=segmentx->node1)
unlink_segment_node1_refs(segmentsx,segmentx);
if(newnode2!=segmentx->node2)
unlink_segment_node2_refs(segmentsx,segmentx);
if(newnode1!=segmentx->node1) /* only modify it if the node has changed */
{
segmentx->node1=newnode1;
segmentsx->next1[thissegment]=segmentsx->firstnode[newnode1];
segmentsx->firstnode[newnode1]=thissegment;
}
if(newnode2!=segmentx->node2) /* only modify it if the node has changed */
{
segmentx->node2=newnode2;
segmentx->next2=segmentsx->firstnode[newnode2];
segmentsx->firstnode[newnode2]=thissegment;
}
PutBackSegmentX(segmentsx,segmentx);
}
/*++++++++++++++++++++++++++++++++++++++
Unlink a node1 from a segment by modifying the linked list type arrangement of node references.
SegmentsX *segmentsx The set of segments to use.
SegmentX *segmentx The segment to be modified.
++++++++++++++++++++++++++++++++++++++*/
static void unlink_segment_node1_refs(SegmentsX *segmentsx,SegmentX *segmentx)
{
index_t segment,thissegment;
thissegment=IndexSegmentX(segmentsx,segmentx);
segment=segmentsx->firstnode[segmentx->node1];
if(segment==thissegment)
segmentsx->firstnode[segmentx->node1]=segmentsx->next1[thissegment];
else
{
do
{
index_t nextsegment;
SegmentX *segx=LookupSegmentX(segmentsx,segment,4);
if(segx->node1==segmentx->node1)
{
nextsegment=segmentsx->next1[segment];
if(nextsegment==thissegment)
segmentsx->next1[segment]=segmentsx->next1[thissegment];
}
else /* if(segx->node2==segmentx->node1) */
{
nextsegment=segx->next2;
if(nextsegment==thissegment)
{
segx->next2=segmentsx->next1[thissegment];
PutBackSegmentX(segmentsx,segx);
}
}
segment=nextsegment;
}
while(segment!=thissegment && segment!=NO_SEGMENT);
}
}
/*++++++++++++++++++++++++++++++++++++++
Unlink a node2 from a segment by modifying the linked list type arrangement of node references.
SegmentsX *segmentsx The set of segments to use.
SegmentX *segmentx The segment to be modified.
++++++++++++++++++++++++++++++++++++++*/
static void unlink_segment_node2_refs(SegmentsX *segmentsx,SegmentX *segmentx)
{
index_t segment,thissegment;
thissegment=IndexSegmentX(segmentsx,segmentx);
segment=segmentsx->firstnode[segmentx->node2];
if(segment==thissegment)
segmentsx->firstnode[segmentx->node2]=segmentx->next2;
else
{
do
{
index_t nextsegment;
SegmentX *segx=LookupSegmentX(segmentsx,segment,4);
if(segx->node1==segmentx->node2)
{
nextsegment=segmentsx->next1[segment];
if(nextsegment==thissegment)
segmentsx->next1[segment]=segmentx->next2;
}
else /* if(segx->node2==segmentx->node2) */
{
nextsegment=segx->next2;
if(nextsegment==thissegment)
{
segx->next2=segmentx->next2;
PutBackSegmentX(segmentsx,segx);
}
}
segment=nextsegment;
}
while(segment!=thissegment && segment!=NO_SEGMENT);
}
}
/*++++++++++++++++++++++++++++++++++++++
Calculate the distance between two locations.
double distance Returns the distance between the locations.
double lat1 The latitude of the first location.
double lon1 The longitude of the first location.
double lat2 The latitude of the second location.
double lon2 The longitude of the second location.
++++++++++++++++++++++++++++++++++++++*/
static double distance(double lat1,double lon1,double lat2,double lon2)
{
double dlon = lon1 - lon2;
double dlat = lat1 - lat2;
double a1,a2,a,sa,c,d;
if(dlon==0 && dlat==0)
return 0;
a1 = sin (dlat / 2);
a2 = sin (dlon / 2);
a = (a1 * a1) + cos (lat1) * cos (lat2) * a2 * a2;
sa = sqrt (a);
if (sa <= 1.0)
{c = 2 * asin (sa);}
else
{c = 2 * asin (1.0);}
d = 6378.137 * c;
return(d);
}
routino-3.0/src/test/ 40755 233 144 0 12573351516 7765 5 routino-3.0/src/test/a-b-c.sh 755 233 144 5213 12563633052 11215 0 #!/bin/sh
# Exit on error
set -e
# Test name
name=`basename $0 .sh`
# Slim or non-slim
if [ "$1" = "slim" ]; then
slim="-slim"
dir="slim"
else
slim=""
dir="fat"
fi
# Libroutino or not libroutino
LD_LIBRARY_PATH=$PWD/..:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
if [ "$2" = "lib" ]; then
lib="+lib"
else
lib=""
fi
# Pruned or non-pruned
if [ "$2" = "prune" ]; then
prune=""
pruned="-pruned"
else
prune="--prune-none"
pruned=""
fi
# Create the output directory
dir="$dir$lib$pruned"
[ -d $dir ] || mkdir $dir
# Run the programs under a run-time debugger
debugger=valgrind
debugger=
# Name related options
osm=$name.osm
log=$name$lib$slim$pruned.log
option_prefix="--prefix=$name"
option_dir="--dir=$dir"
# Generic program options
option_planetsplitter="--loggable --tagging=../../xml/routino-tagging.xml --errorlog $prune"
option_filedumper="--dump-osm"
option_router="--profile=motorcar --profiles=../../xml/routino-profiles.xml --translations=copyright.xml"
if [ ! "$2" = "lib" ]; then
option_router="$option_router --loggable"
fi
# Run planetsplitter
echo "Running planetsplitter"
echo ../planetsplitter$slim $option_dir $option_prefix $option_planetsplitter $osm > $log
$debugger ../planetsplitter$slim $option_dir $option_prefix $option_planetsplitter $osm >> $log
# Run filedumper
echo "Running filedumper"
echo ../filedumper$slim $option_dir $option_prefix $option_filedumper >> $log
$debugger ../filedumper$slim $option_dir $option_prefix $option_filedumper > $dir/$osm
# Waypoints
waypoints=`perl waypoints.pl $osm list`
# Run the router for each waypoint
for waypoint in $waypoints; do
case $waypoint in
*a) waypoint=`echo $waypoint | sed -e 's%a$%%'` ;;
*) continue ;;
esac
echo "Running router : $waypoint"
waypoint_a=`perl waypoints.pl $osm ${waypoint}a 1`
waypoint_b=`perl waypoints.pl $osm ${waypoint}b 2`
waypoint_c=`perl waypoints.pl $osm ${waypoint}c 3`
[ -d $dir/$name-$waypoint ] || mkdir $dir/$name-$waypoint
echo ../router$lib$slim $option_dir $option_prefix $option_osm $option_router $waypoint_a $waypoint_b $waypoint_c >> $log
$debugger ../router$lib$slim $option_dir $option_prefix $option_osm $option_router $waypoint_a $waypoint_b $waypoint_c >> $log
mv shortest* $dir/$name-$waypoint
echo diff -u expected/$name-$waypoint.txt $dir/$name-$waypoint/shortest-all.txt >> $log
if ./is-fast-math; then
diff -U 0 expected/$name-$waypoint.txt $dir/$name-$waypoint/shortest-all.txt | 2>&1 egrep '^[-+] ' || true
else
diff -u expected/$name-$waypoint.txt $dir/$name-$waypoint/shortest-all.txt >> $log
fi
done
routino-3.0/src/test/oneway-loop.sh 777 233 144 0 12064636362 15630 2start-1-finish.sh routino-3.0/src/test/loops.osm 644 233 144 16247 12064636362 11707 0
routino-3.0/src/test/invalid-turn-relations.osm 644 233 144 22476 12105426741 15160 0
routino-3.0/src/test/super-or-not.sh 777 233 144 0 12064636362 13617 2a-b.sh routino-3.0/src/test/waypoints.pl 755 233 144 3443 12306670127 12376 0 #!/usr/bin/perl
#
# Routing test case generator tool.
#
# Part of the Routino routing software.
#
# This file Copyright 2011-2014 Andrew M. Bishop
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
#
use strict;
# Command line
if($#ARGV<1 || $ARGV>2 || ! -f $ARGV[0])
{
die "Usage: waypoints.pl list\n".
" waypoints.pl \n";
}
# Parse the file
open(FILE,"<$ARGV[0]") || die "Cannot open '$ARGV[0]'\n";
my %waypoints=();
my @waypoints=();
my @waypoint_lat=();
my @waypoint_lon=();
my $innode=0;
while()
{
if($innode)
{
if(m%%);
}
elsif(m%%)
{
$innode=1;
push(@waypoint_lat,$1);
push(@waypoint_lon,$2);
}
}
close(FILE);
# Perform the action
if($ARGV[1] eq "list")
{
print join(" ",sort @waypoints)."\n";
exit 0;
}
if($waypoints{$ARGV[1]} ne "")
{
print "--lat$ARGV[2]=$waypoint_lat[$waypoints{$ARGV[1]}] --lon$ARGV[2]=$waypoint_lon[$waypoints{$ARGV[1]}]\n";
exit 0;
}
exit 1;
routino-3.0/src/test/node-restrictions.osm 644 233 144 16636 12114366273 14225 0
routino-3.0/src/test/node-restrictions.sh 777 233 144 0 12064636362 17032 2start-1-finish.sh routino-3.0/src/test/cycle-both-ways.sh 777 233 144 0 12327512664 16026 2cycle-drive.sh routino-3.0/src/test/coincident-waypoint.sh 777 233 144 0 12333356554 15676 2a-b-c-d.sh routino-3.0/src/test/dead-ends.sh 777 233 144 0 12064636362 15203 2start-1-finish.sh routino-3.0/src/test/loops.sh 777 233 144 0 12064636362 14513 2start-1-finish.sh routino-3.0/src/test/run-tests.sh 755 233 144 3205 12563633052 12301 0 #!/bin/sh
status=true
run_a_test ()
{
script=$1
shift
if ./$script $@ ; then
echo "... passed"
else
echo "... FAILED"
status=false
fi
}
compare_results ()
{
if diff -q -r $1 $2; then
echo "... matched"
else
echo "... match FAILED"
status=false
fi
}
# Initial informational message
echo ""
./is-fast-math message
# Loop round the different test types
for type in 1 2 3; do
case $type in
1)
suffix=""
arg=""
description=""
;;
2)
suffix="+lib"
arg="lib"
description="libroutino"
;;
3)
suffix="-pruned"
arg="prune"
description="pruned"
;;
esac
# Normal mode
for script in $@; do
echo ""
echo "Testing: $script (non-slim, $description) ... "
run_a_test $script fat $arg
done
# Normal mode
for script in $@; do
echo ""
echo "Testing: $script (slim, $description) ... "
run_a_test $script slim $arg
done
# Check results
if $status; then
echo "Success: all tests passed"
else
echo "Warning: Some tests FAILED"
exit 1
fi
# Compare normal/slim results
echo ""
echo "Comparing: slim and non-slim results ($description) ... "
compare_results fat$suffix slim$suffix
# Check comparison
if $status; then
echo "Success: slim and non-slim results match"
else
echo "Warning: slim and non-slim results are different"
exit 1
fi
done
exit 0
routino-3.0/src/test/prune-short.sh 777 233 144 0 12114364765 15207 2only-split.sh routino-3.0/src/test/prune-short.osm 644 233 144 65656 12114416166 13043 0
routino-3.0/src/test/super-or-not.osm 644 233 144 4757 12064636362 13110 0
routino-3.0/src/test/prune-straight.osm 644 233 144 20500 12327506436 13512 0
routino-3.0/src/test/cycle-drive.sh 755 233 144 5151 12563633052 12545 0 #!/bin/sh
# Exit on error
set -e
# Test name
name=`basename $0 .sh`
# Slim or non-slim
if [ "$1" = "slim" ]; then
slim="-slim"
dir="slim"
else
slim=""
dir="fat"
fi
# Libroutino or not libroutino
LD_LIBRARY_PATH=$PWD/..:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
if [ "$2" = "lib" ]; then
lib="+lib"
else
lib=""
fi
# Pruned or non-pruned
if [ "$2" = "prune" ]; then
prune=""
pruned="-pruned"
else
prune="--prune-none"
pruned=""
fi
# Create the output directory
dir=$dir$lib$pruned
[ -d $dir ] || mkdir $dir
# Run the programs under a run-time debugger
debugger=valgrind
debugger=
# Name related options
osm=$name.osm
log=$name$lib$slim$pruned.log
option_prefix="--prefix=$name"
option_dir="--dir=$dir"
# Generic program options
option_planetsplitter="--loggable --tagging=../../xml/routino-tagging.xml --errorlog $prune"
option_filedumper="--dump-osm"
option_router="--profiles=../../xml/routino-profiles.xml --translations=copyright.xml"
if [ ! "$2" = "lib" ]; then
option_router="$option_router --loggable"
fi
# Run planetsplitter
echo "Running planetsplitter"
echo ../planetsplitter$slim $option_dir $option_prefix $option_planetsplitter $osm > $log
$debugger ../planetsplitter$slim $option_dir $option_prefix $option_planetsplitter $osm >> $log
# Run filedumper
echo "Running filedumper"
echo ../filedumper$slim $option_dir $option_prefix $option_filedumper >> $log
$debugger ../filedumper$slim $option_dir $option_prefix $option_filedumper > $dir/$osm
# Waypoints
waypoints=`perl waypoints.pl $osm list`
waypoint_start=`perl waypoints.pl $osm WPstart 1`
waypoint_finish=`perl waypoints.pl $osm WPfinish 2`
# Run the router for each profile type
profiles="motorcar bicycle"
for profile in $profiles; do
case $profile in
motorcar) waypoint=WP01 ;;
*) waypoint=WP02 ;;
esac
echo "Running router : $waypoint"
[ -d $dir/$name-$waypoint ] || mkdir $dir/$name-$waypoint
echo ../router$lib$slim $option_dir $option_prefix $option_osm $option_router --profile=$profile $waypoint_start $waypoint_finish >> $log
$debugger ../router$lib$slim $option_dir $option_prefix $option_osm $option_router --profile=$profile $waypoint_start $waypoint_finish >> $log
mv shortest* $dir/$name-$waypoint
echo diff -u expected/$name-$waypoint.txt $dir/$name-$waypoint/shortest-all.txt >> $log
if ./is-fast-math; then
diff -U 0 expected/$name-$waypoint.txt $dir/$name-$waypoint/shortest-all.txt | 2>&1 egrep '^[-+] ' || true
else
diff -u expected/$name-$waypoint.txt $dir/$name-$waypoint/shortest-all.txt >> $log
fi
done
routino-3.0/src/test/a-b-c-d.sh 755 233 144 5330 12563633052 11436 0 #!/bin/sh
# Exit on error
set -e
# Test name
name=`basename $0 .sh`
# Slim or non-slim
if [ "$1" = "slim" ]; then
slim="-slim"
dir="slim"
else
slim=""
dir="fat"
fi
# Libroutino or not libroutino
LD_LIBRARY_PATH=$PWD/..:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
if [ "$2" = "lib" ]; then
lib="+lib"
else
lib=""
fi
# Pruned or non-pruned
if [ "$2" = "prune" ]; then
prune=""
pruned="-pruned"
else
prune="--prune-none"
pruned=""
fi
# Create the output directory
dir=$dir$lib$pruned
[ -d $dir ] || mkdir $dir
# Run the programs under a run-time debugger
debugger=valgrind
debugger=
# Name related options
osm=$name.osm
log=$name$slim$lib$pruned.log
option_prefix="--prefix=$name"
option_dir="--dir=$dir"
# Generic program options
option_planetsplitter="--loggable --tagging=../../xml/routino-tagging.xml --errorlog $prune"
option_filedumper="--dump-osm"
option_router="--profile=motorcar --profiles=../../xml/routino-profiles.xml --translations=copyright.xml"
if [ ! "$2" = "lib" ]; then
option_router="$option_router --loggable"
fi
# Run planetsplitter
echo "Running planetsplitter"
echo ../planetsplitter$slim $option_dir $option_prefix $option_planetsplitter $osm > $log
$debugger ../planetsplitter$slim $option_dir $option_prefix $option_planetsplitter $osm >> $log
# Run filedumper
echo "Running filedumper"
echo ../filedumper$slim $option_dir $option_prefix $option_filedumper >> $log
$debugger ../filedumper$slim $option_dir $option_prefix $option_filedumper > $dir/$osm
# Waypoints
waypoints=`perl waypoints.pl $osm list`
# Run the router for each waypoint
for waypoint in $waypoints; do
case $waypoint in
*a) waypoint=`echo $waypoint | sed -e 's%a$%%'` ;;
*) continue ;;
esac
echo "Running router : $waypoint"
waypoint_a=`perl waypoints.pl $osm ${waypoint}a 1`
waypoint_b=`perl waypoints.pl $osm ${waypoint}b 2`
waypoint_c=`perl waypoints.pl $osm ${waypoint}c 3`
waypoint_d=`perl waypoints.pl $osm ${waypoint}d 4`
[ -d $dir/$name-$waypoint ] || mkdir $dir/$name-$waypoint
echo ../router$lib$slim $option_dir $option_prefix $option_osm $option_router $waypoint_a $waypoint_b $waypoint_c $waypoint_d >> $log
$debugger ../router$lib$slim $option_dir $option_prefix $option_osm $option_router $waypoint_a $waypoint_b $waypoint_c $waypoint_d >> $log
mv shortest* $dir/$name-$waypoint
echo diff -u expected/$name-$waypoint.txt $dir/$name-$waypoint/shortest-all.txt >> $log
if ./is-fast-math; then
diff -U 0 expected/$name-$waypoint.txt $dir/$name-$waypoint/shortest-all.txt | 2>&1 egrep '^[-+] ' || true
else
diff -u expected/$name-$waypoint.txt $dir/$name-$waypoint/shortest-all.txt >> $log
fi
done
routino-3.0/src/test/dead-ends.osm 644 233 144 16570 12326256227 12375 0
routino-3.0/src/test/fake-node-with-loop.osm 644 233 144 10546 12327506445 14320 0
routino-3.0/src/test/is-fast-math.c 644 233 144 450 12154147145 12415 0 #include
int main(int argc,char **argv)
{
#ifdef __FAST_MATH__
if(argc>1)
printf("Compiled with -ffast-math => results may differ slightly.\n");
return 0;
#else
if(argc>1)
printf("Not compiled with -ffast-math => results should match exactly.\n");
return 1;
#endif
}
routino-3.0/src/test/a-b.sh 755 233 144 5074 12563633052 11002 0 #!/bin/sh
# Exit on error
set -e
# Test name
name=`basename $0 .sh`
# Slim or non-slim
if [ "$1" = "slim" ]; then
slim="-slim"
dir="slim"
else
slim=""
dir="fat"
fi
# Libroutino or not libroutino
LD_LIBRARY_PATH=$PWD/..:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
if [ "$2" = "lib" ]; then
lib="+lib"
else
lib=""
fi
# Pruned or non-pruned
if [ "$2" = "prune" ]; then
prune=""
pruned="-pruned"
else
prune="--prune-none"
pruned=""
fi
# Create the output directory
dir="$dir$lib$pruned"
[ -d $dir ] || mkdir $dir
# Run the programs under a run-time debugger
debugger=valgrind
debugger=
# Name related options
osm=$name.osm
log=$name$lib$slim$pruned.log
option_prefix="--prefix=$name"
option_dir="--dir=$dir"
# Generic program options
option_planetsplitter="--loggable --tagging=../../xml/routino-tagging.xml --errorlog $prune"
option_filedumper="--dump-osm"
option_router="--profile=motorcar --profiles=../../xml/routino-profiles.xml --translations=copyright.xml"
if [ ! "$2" = "lib" ]; then
option_router="$option_router --loggable"
fi
# Run planetsplitter
echo "Running planetsplitter"
echo ../planetsplitter$slim $option_dir $option_prefix $option_planetsplitter $osm > $log
$debugger ../planetsplitter$slim $option_dir $option_prefix $option_planetsplitter $osm >> $log
# Run filedumper
echo "Running filedumper"
echo ../filedumper$slim $option_dir $option_prefix $option_filedumper >> $log
$debugger ../filedumper$slim $option_dir $option_prefix $option_filedumper > $dir/$osm
# Waypoints
waypoints=`perl waypoints.pl $osm list`
# Run the router for each waypoint
for waypoint in $waypoints; do
case $waypoint in
*a) waypoint=`echo $waypoint | sed -e 's%a$%%'` ;;
*) continue ;;
esac
echo "Running router : $waypoint"
waypoint_a=`perl waypoints.pl $osm ${waypoint}a 1`
waypoint_b=`perl waypoints.pl $osm ${waypoint}b 2`
[ -d $dir/$name-$waypoint ] || mkdir $dir/$name-$waypoint
echo ../router$lib$slim $option_dir $option_prefix $option_osm $option_router $waypoint_a $waypoint_b >> $log
$debugger ../router$lib$slim $option_dir $option_prefix $option_osm $option_router $waypoint_a $waypoint_b >> $log
mv shortest* $dir/$name-$waypoint
echo diff -u expected/$name-$waypoint.txt $dir/$name-$waypoint/shortest-all.txt >> $log
if ./is-fast-math; then
diff -U 0 expected/$name-$waypoint.txt $dir/$name-$waypoint/shortest-all.txt | 2>&1 egrep '^[-+] ' || true
else
diff -u expected/$name-$waypoint.txt $dir/$name-$waypoint/shortest-all.txt >> $log
fi
done
routino-3.0/src/test/prune-straight.sh 777 233 144 0 12114436047 15666 2only-split.sh routino-3.0/src/test/Makefile 644 233 144 3442 12563636736 11455 0 # Test cases Makefile
#
# Part of the Routino routing software.
#
# This file Copyright 2011-2015 Andrew M. Bishop
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
#
# All configuration is in the top-level Makefile.conf
include ../../Makefile.conf
# executables
ROUTINO_EXE=planetsplitter$(.EXE) planetsplitter-slim$(.EXE) \
router$(.EXE) router-slim$(.EXE) \
router+lib$(.EXE) router+lib-slim$(.EXE) \
filedumper$(.EXE) filedumper-slim$(.EXE)
EXE=is-fast-math$(.EXE)
# Compilation targets
O=$(notdir $(wildcard *.osm))
S=$(foreach f,$(O),$(addsuffix .sh,$(basename $f)))
########
all :
########
test : test-exe $(EXE)
@./run-tests.sh $(S)
########
test-exe :
cd .. && $(MAKE) $(ROUTINO_EXE)
is-fast-math$(.EXE) : is-fast-math.o
$(LD) $< -o $@ $(LDFLAGS)
is-fast-math.o : is-fast-math.c
$(CC) -c $(CFLAGS) $< -o $@
########
install:
########
clean:
rm -rf fat
rm -rf slim
rm -rf fat+lib
rm -rf slim+lib
rm -rf fat-pruned
rm -rf slim-pruned
rm -f *.log
rm -f *~
rm -f *.o
rm -f $(EXE)
rm -f core
rm -f *.gcda *.gcno *.gcov gmon.out
########
distclean: clean
########
.PHONY:: all test install clean distclean
.PHONY:: test-exe
routino-3.0/src/test/copyright.xml 644 233 144 2406 12563645242 12536 0
routino-3.0/src/test/start-1-finish.sh 755 233 144 5203 12563633052 13106 0 #!/bin/sh
# Exit on error
set -e
# Test name
name=`basename $0 .sh`
# Slim or non-slim
if [ "$1" = "slim" ]; then
slim="-slim"
dir="slim"
else
slim=""
dir="fat"
fi
# Libroutino or not libroutino
LD_LIBRARY_PATH=$PWD/..:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
if [ "$2" = "lib" ]; then
lib="+lib"
else
lib=""
fi
# Pruned or non-pruned
if [ "$2" = "prune" ]; then
prune=""
pruned="-pruned"
else
prune="--prune-none"
pruned=""
fi
# Create the output directory
dir=$dir$lib$pruned
[ -d $dir ] || mkdir $dir
# Run the programs under a run-time debugger
debugger=valgrind
debugger=
# Name related options
osm=$name.osm
log=$name$lib$slim$pruned.log
option_prefix="--prefix=$name"
option_dir="--dir=$dir"
# Generic program options
option_planetsplitter="--loggable --tagging=../../xml/routino-tagging.xml --errorlog $prune"
option_filedumper="--dump-osm"
option_router="--profile=motorcar --profiles=../../xml/routino-profiles.xml --translations=copyright.xml"
if [ ! "$2" = "lib" ]; then
option_router="$option_router --loggable"
fi
# Run planetsplitter
echo "Running planetsplitter"
echo ../planetsplitter$slim $option_dir $option_prefix $option_planetsplitter $osm > $log
$debugger ../planetsplitter$slim $option_dir $option_prefix $option_planetsplitter $osm >> $log
# Run filedumper
echo "Running filedumper"
echo ../filedumper$slim $option_dir $option_prefix $option_filedumper >> $log
$debugger ../filedumper$slim $option_dir $option_prefix $option_filedumper > $dir/$osm
# Waypoints
waypoints=`perl waypoints.pl $osm list`
waypoint_start=`perl waypoints.pl $osm WPstart 1`
waypoint_finish=`perl waypoints.pl $osm WPfinish 3`
# Run the router for each waypoint
for waypoint in $waypoints; do
[ ! $waypoint = "WPstart" ] || continue
[ ! $waypoint = "WPfinish" ] || continue
echo "Running router : $waypoint"
waypoint_test=`perl waypoints.pl $osm $waypoint 2`
[ -d $dir/$name-$waypoint ] || mkdir $dir/$name-$waypoint
echo ../router$lib$slim $option_dir $option_prefix $option_osm $option_router $waypoint_start $waypoint_test $waypoint_finish >> $log
$debugger ../router$lib$slim $option_dir $option_prefix $option_osm $option_router $waypoint_start $waypoint_test $waypoint_finish >> $log
mv shortest* $dir/$name-$waypoint
echo diff -u expected/$name-$waypoint.txt $dir/$name-$waypoint/shortest-all.txt >> $log
if ./is-fast-math; then
diff -U 0 expected/$name-$waypoint.txt $dir/$name-$waypoint/shortest-all.txt | 2>&1 egrep '^[-+] ' || true
else
diff -u expected/$name-$waypoint.txt $dir/$name-$waypoint/shortest-all.txt >> $log
fi
done
routino-3.0/src/test/cycle-both-ways.osm 644 233 144 10655 12327513605 13556 0
routino-3.0/src/test/only-split.sh 755 233 144 3111 12563633052 12443 0 #!/bin/sh
# Exit on error
set -e
# Test name
name=`basename $0 .sh`
# Slim or non-slim
if [ "$1" = "slim" ]; then
slim="-slim"
dir="slim"
else
slim=""
dir="fat"
fi
# Libroutino or not libroutino
LD_LIBRARY_PATH=$PWD/..:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
if [ "$2" = "lib" ]; then
lib="+lib"
else
lib=""
fi
# Pruned or non-pruned
if [ "$2" = "prune" ]; then
case $name in
prune-isolated) prune="--prune-none --prune-isolated=100";;
prune-short) prune="--prune-none --prune-short=5";;
prune-straight) prune="--prune-none --prune-straight=5";;
*) prune="";;
esac
pruned="-pruned"
else
prune="--prune-none"
pruned=""
fi
# Create the output directory
dir=$dir$lib$pruned
[ -d $dir ] || mkdir $dir
# Run the programs under a run-time debugger
debugger=valgrind
debugger=
# Name related options
osm=$name.osm
log=$name$lib$slim$pruned.log
option_prefix="--prefix=$name"
option_dir="--dir=$dir"
# Generic program options
option_planetsplitter="--loggable --tagging=../../xml/routino-tagging.xml --errorlog $prune"
option_filedumper="--dump-osm"
# Run planetsplitter
echo "Running planetsplitter"
echo ../planetsplitter$slim $option_dir $option_prefix $option_planetsplitter $osm > $log
$debugger ../planetsplitter$slim $option_dir $option_prefix $option_planetsplitter $osm >> $log
# Run filedumper
echo "Running filedumper"
echo ../filedumper$slim $option_dir $option_prefix $option_filedumper >> $log
$debugger ../filedumper$slim $option_dir $option_prefix $option_filedumper > $dir/$osm
routino-3.0/src/test/oneway-loop.osm 644 233 144 10263 12114366272 13010 0
routino-3.0/src/test/coincident-waypoint.osm 644 233 144 10700 12333376606 14527 0
routino-3.0/src/test/no-super.sh 777 233 144 0 12064636362 13235 2a-b-c.sh routino-3.0/src/test/expected/ 40755 233 144 0 12333376644 11571 5 routino-3.0/src/test/expected/dead-ends-WP10.txt 644 233 144 3017 12154145517 14652 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219535 -0.521016 -1 Waypt 0.000 0.00 0.00 0.0
-0.220223 -0.521052 5* Junct- 0.076 0.05 0.08 0.0 96 182 main 1
-0.220666 -0.521060 4* Junct 0.049 0.03 0.12 0.1 96 180 main 1
-0.220702 -0.519478 12* Junct 0.176 0.22 0.30 0.3 48 91 high street
-0.220739 -0.517804 18* Junct 0.186 0.23 0.49 0.5 48 91 high street
-0.220782 -0.516137 24* Junct 0.185 0.23 0.67 0.8 48 91 high street
-0.220361 -0.515961 25* Junct- 0.050 0.06 0.72 0.8 48 22 dead-end 3
-0.220019 -0.515847 26 Inter 0.040 0.05 0.76 0.9 48 18 dead-end 3
-0.219672 -0.516031 -2 Waypt 0.043 0.05 0.81 0.9 48 332 dead-end 3
-0.220019 -0.515847 26 Inter 0.043 0.05 0.85 1.0 48 152 dead-end 3
-0.220361 -0.515961 25* Junct- 0.040 0.05 0.89 1.0 48 198 dead-end 3
-0.220782 -0.516137 24* Junct 0.050 0.06 0.94 1.1 48 202 dead-end 3
-0.220817 -0.514062 32* Junct 0.230 0.29 1.17 1.4 48 90 high street
-0.220344 -0.514042 33* Junct- 0.052 0.03 1.22 1.4 96 2 main 2
-0.219539 -0.514007 -3 Waypt 0.089 0.06 1.31 1.5 96 2 main 2
routino-3.0/src/test/expected/turns-WP02.txt 644 233 144 2403 12064636362 14203 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct- 0.072 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 5* Junct 0.173 0.11 0.24 0.2 96 182 main 1
-0.220671 -0.520223 11* Junct 0.074 0.09 0.32 0.2 48 90 high street
-0.220691 -0.519461 19* Junct 0.084 0.10 0.40 0.3 48 91 high street
-0.220111 -0.519553 17 Inter 0.065 0.08 0.47 0.4 48 351 loop 1
-0.219817 -0.519807 15 Inter 0.043 0.05 0.51 0.5 48 319 loop 1
-0.220067 -0.520109 13* Waypt 0.043 0.05 0.55 0.5 48 230 loop 1
-0.220671 -0.520223 11* Junct 0.068 0.09 0.62 0.6 48 190 loop 1
-0.220666 -0.520893 5* Junct 0.074 0.09 0.70 0.7 48 270 high street
-0.221308 -0.520914 4* Junct- 0.071 0.04 0.77 0.8 96 181 main 1
-0.221561 -0.520922 -3 Waypt 0.027 0.02 0.79 0.8 96 181 main 1
routino-3.0/src/test/expected/loops-WP05.txt 644 233 144 3337 12064636362 14176 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219562 -0.520851 -1 Waypt 0.000 0.00 0.00 0.0
-0.220223 -0.520885 5* Junct- 0.073 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 4* Junct 0.049 0.03 0.12 0.1 96 181 main 1
-0.220695 -0.519489 11* Junct 0.156 0.20 0.28 0.3 48 91 high street
-0.220280 -0.519256 15* Junct- 0.052 0.07 0.33 0.3 48 29 loop 1
-0.219910 -0.519112 17 Inter 0.044 0.06 0.37 0.4 48 21 loop 1
-0.219237 -0.519286 13* Junct 0.077 0.10 0.45 0.5 48 345 loop 1
-0.218764 -0.519471 12 Inter 0.056 0.07 0.51 0.6 48 338 loop 1
-0.218380 -0.519134 16 Waypt 0.056 0.07 0.56 0.6 48 41 loop 1
-0.218776 -0.518838 18 Inter 0.055 0.07 0.62 0.7 48 143 loop 1
-0.219237 -0.519286 13* Junct 0.071 0.09 0.69 0.8 48 224 loop 1
-0.219910 -0.519112 17 Inter 0.077 0.10 0.77 0.9 48 165 loop 1
-0.220280 -0.519256 15* Junct- 0.044 0.06 0.81 0.9 48 201 loop 1
-0.220695 -0.519489 11* Junct 0.052 0.07 0.86 1.0 48 209 loop 1
-0.220739 -0.517801 19* Junct 0.187 0.23 1.05 1.2 48 91 high street
-0.220784 -0.516035 30* Junct 0.196 0.24 1.25 1.5 48 91 high street
-0.220311 -0.516015 31* Junct- 0.052 0.03 1.30 1.5 96 2 main 2
-0.219596 -0.515984 -3 Waypt 0.079 0.05 1.38 1.6 96 2 main 2
routino-3.0/src/test/expected/dead-ends-WP11.txt 644 233 144 3265 12154145517 14660 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219535 -0.521016 -1 Waypt 0.000 0.00 0.00 0.0
-0.220223 -0.521052 5* Junct- 0.076 0.05 0.08 0.0 96 182 main 1
-0.220666 -0.521060 4* Junct 0.049 0.03 0.12 0.1 96 180 main 1
-0.220702 -0.519478 12* Junct 0.176 0.22 0.30 0.3 48 91 high street
-0.220739 -0.517804 18* Junct 0.186 0.23 0.49 0.5 48 91 high street
-0.220782 -0.516137 24* Junct 0.185 0.23 0.67 0.8 48 91 high street
-0.220361 -0.515961 25* Junct- 0.050 0.06 0.72 0.8 48 22 dead-end 3
-0.220019 -0.515847 26 Inter 0.040 0.05 0.76 0.9 48 18 dead-end 3
-0.219341 -0.516206 23 Inter 0.085 0.10 0.85 1.0 48 332 dead-end 3
-0.218493 -0.515789 27* Waypt 0.105 0.13 0.95 1.1 48 26 dead-end 3
-0.219341 -0.516206 23 Inter 0.105 0.13 1.06 1.2 48 206 dead-end 3
-0.220019 -0.515847 26 Inter 0.085 0.10 1.14 1.3 48 152 dead-end 3
-0.220361 -0.515961 25* Junct- 0.040 0.05 1.18 1.4 48 198 dead-end 3
-0.220782 -0.516137 24* Junct 0.050 0.06 1.23 1.5 48 202 dead-end 3
-0.220817 -0.514062 32* Junct 0.230 0.29 1.46 1.7 48 90 high street
-0.220344 -0.514042 33* Junct- 0.052 0.03 1.51 1.8 96 2 main 2
-0.219539 -0.514007 -3 Waypt 0.089 0.06 1.60 1.8 96 2 main 2
routino-3.0/src/test/expected/fake-node-with-loop-WP02.txt 644 233 144 2420 12327215464 16576 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.216959 -0.520771 -1 Waypt 0.000 0.00 0.00 0.0
-0.217286 -0.520780 10 Junct- 0.036 0.02 0.04 0.0 96 181 main 1
-0.218523 -0.520806 9 Junct- 0.137 0.09 0.17 0.1 96 181 main 1
-0.219171 -0.520827 -2 Waypt 0.071 0.04 0.24 0.1 96 181 main 1
-0.219482 -0.520837 8* Junct 0.034 0.02 0.28 0.2 96 181 main 1
-0.219692 -0.520509 14 Junct- 0.043 0.03 0.32 0.2 96 122 roundabout
-0.220082 -0.520522 13 Junct- 0.043 0.03 0.36 0.2 96 181 roundabout
-0.220268 -0.520863 7 Inter 0.043 0.03 0.41 0.2 96 241 roundabout
-0.220062 -0.521204 4 Junct- 0.044 0.03 0.45 0.3 96 301 roundabout
-0.219665 -0.521190 5 Junct- 0.044 0.03 0.49 0.3 96 1 roundabout
-0.219482 -0.520837 8* Junct 0.044 0.03 0.54 0.3 96 62 roundabout
-0.218842 -0.520816 -3 Waypt 0.070 0.04 0.61 0.4 96 1 main 1
routino-3.0/src/test/expected/dead-ends-WP01.txt 644 233 144 2301 12154145517 14645 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219535 -0.521016 -1 Waypt 0.000 0.00 0.00 0.0
-0.220223 -0.521052 5* Junct- 0.076 0.05 0.08 0.0 96 182 main 1
-0.220666 -0.521060 4* Junct 0.049 0.03 0.12 0.1 96 180 main 1
-0.220702 -0.519478 12* Junct 0.176 0.22 0.30 0.3 48 91 high street
-0.220263 -0.519309 13* Waypt 0.052 0.07 0.35 0.4 48 21 dead-end 1
-0.220702 -0.519478 12* Junct 0.052 0.07 0.41 0.4 48 201 dead-end 1
-0.220739 -0.517804 18* Junct 0.186 0.23 0.59 0.7 48 91 high street
-0.220782 -0.516137 24* Junct 0.185 0.23 0.78 0.9 48 91 high street
-0.220817 -0.514062 32* Junct 0.230 0.29 1.01 1.2 48 90 high street
-0.220344 -0.514042 33* Junct- 0.052 0.03 1.06 1.2 96 2 main 2
-0.219539 -0.514007 -3 Waypt 0.089 0.06 1.15 1.3 96 2 main 2
routino-3.0/src/test/expected/coincident-waypoint-WP04.txt 644 233 144 1172 12333376614 17023 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.217286 -0.520780 7 Waypt 0.000 0.00 0.00 0.0
-0.217286 -0.520780 7 Waypt 0.000 0.00 0.00 0.0 96 270 main 1
-0.218523 -0.520806 6 Waypt 0.137 0.09 0.14 0.1 96 181 main 1
-0.218523 -0.520806 6 Waypt 0.000 0.00 0.14 0.1 96 270 main 1
routino-3.0/src/test/expected/node-restrictions-WP02.txt 644 233 144 3420 12064636362 16503 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219564 -0.520846 -1 Waypt 0.000 0.00 0.00 0.0
-0.220666 -0.520893 4* Junct 0.122 0.07 0.12 0.1 96 182 main 1
-0.220682 -0.520141 9* Junct 0.083 0.08 0.20 0.2 64 91 high street
-0.220695 -0.519489 12* Change 0.072 0.07 0.28 0.2 64 91 high street
-0.221123 -0.519360 13 Inter 0.049 0.06 0.33 0.3 48 163 somepass road
-0.221154 -0.518671 -2 Waypt 0.075 0.09 0.40 0.4 48 92 somepass road
-0.221123 -0.519360 13 Inter 0.075 0.09 0.48 0.5 48 272 somepass road
-0.220695 -0.519489 12* Junct 0.049 0.06 0.53 0.5 48 343 somepass road
-0.220694 -0.519227 15 Inter 0.029 0.04 0.55 0.6 48 89 long road
-0.220386 -0.519076 16 Inter 0.038 0.05 0.59 0.6 48 26 long road
-0.220961 -0.518928 17 Inter 0.066 0.08 0.66 0.7 48 165 long road
-0.220427 -0.518622 18 Inter 0.068 0.09 0.73 0.8 48 29 long road
-0.220949 -0.518422 21 Inter 0.062 0.08 0.79 0.8 48 159 long road
-0.220455 -0.518238 22 Inter 0.058 0.07 0.85 0.9 48 20 long road
-0.220746 -0.518070 23 Inter 0.037 0.04 0.88 1.0 48 149 long road
-0.220739 -0.517801 26* Junct 0.029 0.04 0.91 1.0 48 88 long road
-0.220784 -0.516035 31* Junct 0.196 0.18 1.11 1.2 64 91 high street
-0.219593 -0.515985 -3 Waypt 0.132 0.08 1.24 1.3 96 2 main 2
routino-3.0/src/test/expected/dead-ends-WP09.txt 644 233 144 2551 12154145517 14664 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219535 -0.521016 -1 Waypt 0.000 0.00 0.00 0.0
-0.220223 -0.521052 5* Junct- 0.076 0.05 0.08 0.0 96 182 main 1
-0.220666 -0.521060 4* Junct 0.049 0.03 0.12 0.1 96 180 main 1
-0.220702 -0.519478 12* Junct 0.176 0.22 0.30 0.3 48 91 high street
-0.220739 -0.517804 18* Junct 0.186 0.23 0.49 0.5 48 91 high street
-0.220782 -0.516137 24* Junct 0.185 0.23 0.67 0.8 48 91 high street
-0.220361 -0.515961 25* Junct- 0.050 0.06 0.72 0.8 48 22 dead-end 3
-0.220019 -0.515847 26 Waypt 0.040 0.05 0.76 0.9 48 18 dead-end 3
-0.220361 -0.515961 25* Junct- 0.040 0.05 0.80 0.9 48 198 dead-end 3
-0.220782 -0.516137 24* Junct 0.050 0.06 0.85 1.0 48 202 dead-end 3
-0.220817 -0.514062 32* Junct 0.230 0.29 1.08 1.3 48 90 high street
-0.220344 -0.514042 33* Junct- 0.052 0.03 1.13 1.3 96 2 main 2
-0.219539 -0.514007 -3 Waypt 0.089 0.06 1.22 1.4 96 2 main 2
routino-3.0/src/test/expected/node-restrictions-WP01.txt 644 233 144 3420 12064636362 16502 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219564 -0.520846 -1 Waypt 0.000 0.00 0.00 0.0
-0.220666 -0.520893 4* Junct 0.122 0.07 0.12 0.1 96 182 main 1
-0.220682 -0.520141 9* Junct 0.083 0.08 0.20 0.2 64 91 high street
-0.220695 -0.519489 12* Change 0.072 0.07 0.28 0.2 64 91 high street
-0.221123 -0.519360 13 Inter 0.049 0.06 0.33 0.3 48 163 somepass road
-0.221156 -0.518615 19* Waypt 0.082 0.10 0.41 0.4 48 92 somepass road
-0.221123 -0.519360 13 Inter 0.082 0.10 0.49 0.5 48 272 somepass road
-0.220695 -0.519489 12* Junct 0.049 0.06 0.54 0.5 48 343 somepass road
-0.220694 -0.519227 15 Inter 0.029 0.04 0.57 0.6 48 89 long road
-0.220386 -0.519076 16 Inter 0.038 0.05 0.61 0.6 48 26 long road
-0.220961 -0.518928 17 Inter 0.066 0.08 0.67 0.7 48 165 long road
-0.220427 -0.518622 18 Inter 0.068 0.09 0.74 0.8 48 29 long road
-0.220949 -0.518422 21 Inter 0.062 0.08 0.80 0.9 48 159 long road
-0.220455 -0.518238 22 Inter 0.058 0.07 0.86 0.9 48 20 long road
-0.220746 -0.518070 23 Inter 0.037 0.04 0.90 1.0 48 149 long road
-0.220739 -0.517801 26* Junct 0.029 0.04 0.93 1.0 48 88 long road
-0.220784 -0.516035 31* Junct 0.196 0.18 1.12 1.2 64 91 high street
-0.219593 -0.515985 -3 Waypt 0.132 0.08 1.25 1.3 96 2 main 2
routino-3.0/src/test/expected/loops-WP02.txt 644 233 144 3337 12333160116 14157 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219562 -0.520851 -1 Waypt 0.000 0.00 0.00 0.0
-0.220223 -0.520885 5* Junct- 0.073 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 4* Junct 0.049 0.03 0.12 0.1 96 181 main 1
-0.220695 -0.519489 11* Junct 0.156 0.20 0.28 0.3 48 91 high street
-0.220280 -0.519256 15* Junct- 0.052 0.07 0.33 0.3 48 29 loop 1
-0.219910 -0.519112 17 Waypt 0.044 0.06 0.37 0.4 48 21 loop 1
-0.219237 -0.519286 13* Junct 0.077 0.10 0.45 0.5 48 345 loop 1
-0.218764 -0.519471 12 Inter 0.056 0.07 0.51 0.6 48 338 loop 1
-0.218380 -0.519134 16 Inter 0.056 0.07 0.56 0.6 48 41 loop 1
-0.218776 -0.518838 18 Inter 0.055 0.07 0.62 0.7 48 143 loop 1
-0.219237 -0.519286 13* Junct 0.071 0.09 0.69 0.8 48 224 loop 1
-0.219910 -0.519112 17 Inter 0.077 0.10 0.77 0.9 48 165 loop 1
-0.220280 -0.519256 15* Junct- 0.044 0.06 0.81 0.9 48 201 loop 1
-0.220695 -0.519489 11* Junct 0.052 0.07 0.86 1.0 48 209 loop 1
-0.220739 -0.517801 19* Junct 0.187 0.23 1.05 1.2 48 91 high street
-0.220784 -0.516035 30* Junct 0.196 0.24 1.25 1.5 48 91 high street
-0.220311 -0.516015 31* Junct- 0.052 0.03 1.30 1.5 96 2 main 2
-0.219596 -0.515984 -3 Waypt 0.079 0.05 1.38 1.6 96 2 main 2
routino-3.0/src/test/expected/turns-WP12.txt 644 233 144 4573 12064636362 14216 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct 0.072 0.04 0.07 0.0 96 182 main 1
-0.219123 -0.520207 12* Junct 0.069 0.09 0.14 0.1 48 91 top road
-0.219131 -0.519426 20* Junct 0.086 0.11 0.23 0.2 48 90 top road
-0.219135 -0.518823 23* Junct 0.067 0.08 0.29 0.3 48 90 top road
-0.219145 -0.517626 33* Junct 0.133 0.17 0.43 0.5 48 90 top road
-0.219144 -0.517257 36* Junct 0.041 0.05 0.47 0.5 48 89 top road
-0.219291 -0.517193 38 Inter 0.017 0.02 0.48 0.6 48 156 roundabout
-0.219352 -0.517060 42 Junct- 0.016 0.02 0.50 0.6 48 114 roundabout
-0.219304 -0.516904 45 Inter 0.018 0.02 0.52 0.6 48 72 roundabout
-0.219153 -0.516826 46* Junct- 0.018 0.02 0.54 0.6 48 27 roundabout
-0.218966 -0.516910 44 Inter 0.022 0.03 0.56 0.6 48 335 roundabout
-0.218923 -0.517072 39 Junct- 0.018 0.02 0.58 0.7 48 284 roundabout
-0.218998 -0.517207 37 Inter 0.017 0.02 0.59 0.7 48 240 roundabout
-0.219144 -0.517257 36* Junct 0.017 0.02 0.61 0.7 48 199 roundabout
-0.219145 -0.517626 33* Junct 0.041 0.05 0.65 0.8 48 269 top road
-0.219135 -0.518823 23* Junct 0.133 0.17 0.79 0.9 48 270 top road
-0.219131 -0.519426 20* Junct 0.067 0.08 0.85 1.0 48 270 top road
-0.218482 -0.519542 18* Inter 0.073 0.09 0.93 1.1 48 349 loop 4
-0.218258 -0.519789 16 Waypt 0.037 0.04 0.96 1.1 48 312 loop 4
-0.218474 -0.520060 14* Inter 0.038 0.05 1.00 1.2 48 231 loop 4
-0.219123 -0.520207 12* Junct 0.074 0.09 1.07 1.3 48 192 loop 4
-0.219107 -0.520828 6* Junct 0.069 0.09 1.14 1.4 48 271 top road
-0.220666 -0.520893 5* Junct- 0.173 0.11 1.32 1.5 96 182 main 1
-0.221308 -0.520914 4* Junct- 0.071 0.04 1.39 1.5 96 181 main 1
-0.221561 -0.520922 -3 Waypt 0.027 0.02 1.41 1.5 96 181 main 1
routino-3.0/src/test/expected/loops-WP09.txt 644 233 144 3457 12064636362 14205 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219562 -0.520851 -1 Waypt 0.000 0.00 0.00 0.0
-0.220223 -0.520885 5* Junct- 0.073 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 4* Junct 0.049 0.03 0.12 0.1 96 181 main 1
-0.220695 -0.519489 11* Junct 0.156 0.20 0.28 0.3 48 91 high street
-0.220739 -0.517801 19* Junct 0.187 0.23 0.47 0.5 48 91 high street
-0.220301 -0.517576 22* Junct- 0.054 0.07 0.52 0.6 48 27 loop 2
-0.219946 -0.517397 24 Inter 0.044 0.06 0.56 0.6 48 26 loop 2
-0.219266 -0.517579 21* Junct 0.078 0.10 0.64 0.7 48 345 loop 2
-0.219013 -0.517333 -2 Waypt 0.039 0.05 0.68 0.8 48 44 loop 2
-0.218805 -0.517131 25 Inter 0.032 0.04 0.71 0.8 48 44 loop 2
-0.218417 -0.517462 23* Junct- 0.056 0.07 0.77 0.9 48 319 loop 2
-0.218794 -0.517763 20 Inter 0.053 0.07 0.82 0.9 48 218 loop 2
-0.219266 -0.517579 21* Junct 0.056 0.07 0.88 1.0 48 158 loop 2
-0.219946 -0.517397 24 Inter 0.078 0.10 0.95 1.1 48 165 loop 2
-0.220301 -0.517576 22* Junct- 0.044 0.06 1.00 1.2 48 206 loop 2
-0.220739 -0.517801 19* Junct 0.054 0.07 1.05 1.2 48 207 loop 2
-0.220784 -0.516035 30* Junct 0.196 0.24 1.25 1.5 48 91 high street
-0.220311 -0.516015 31* Junct- 0.052 0.03 1.30 1.5 96 2 main 2
-0.219596 -0.515984 -3 Waypt 0.079 0.05 1.38 1.6 96 2 main 2
routino-3.0/src/test/expected/turns-WP14.txt 644 233 144 6532 12064636362 14215 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct 0.072 0.04 0.07 0.0 96 182 main 1
-0.219123 -0.520207 12* Junct 0.069 0.09 0.14 0.1 48 91 top road
-0.219131 -0.519426 20* Junct 0.086 0.11 0.23 0.2 48 90 top road
-0.219135 -0.518823 23* Junct 0.067 0.08 0.29 0.3 48 90 top road
-0.219145 -0.517626 33* Junct 0.133 0.17 0.43 0.5 48 90 top road
-0.219144 -0.517257 36* Junct 0.041 0.05 0.47 0.5 48 89 top road
-0.219291 -0.517193 38 Inter 0.017 0.02 0.48 0.6 48 156 roundabout
-0.219352 -0.517060 42 Junct- 0.016 0.02 0.50 0.6 48 114 roundabout
-0.219304 -0.516904 45 Inter 0.018 0.02 0.52 0.6 48 72 roundabout
-0.219153 -0.516826 46* Junct- 0.018 0.02 0.54 0.6 48 27 roundabout
-0.218966 -0.516910 44 Inter 0.022 0.03 0.56 0.6 48 335 roundabout
-0.218923 -0.517072 39 Junct- 0.018 0.02 0.58 0.7 48 284 roundabout
-0.218998 -0.517207 37 Inter 0.017 0.02 0.59 0.7 48 240 roundabout
-0.219144 -0.517257 36* Junct 0.017 0.02 0.61 0.7 48 199 roundabout
-0.219145 -0.517626 33* Junct 0.041 0.05 0.65 0.8 48 269 top road
-0.218619 -0.517921 32* Inter 0.067 0.08 0.72 0.8 48 330 loop 5
-0.218431 -0.518243 28 Inter 0.041 0.05 0.76 0.9 48 300 loop 5
-0.218600 -0.518557 25* Waypt 0.039 0.05 0.80 0.9 48 241 loop 5
-0.219135 -0.518823 23* Junct 0.066 0.08 0.86 1.0 48 206 loop 5
-0.219145 -0.517626 33* Junct 0.133 0.17 1.00 1.2 48 90 top road
-0.219144 -0.517257 36* Junct 0.041 0.05 1.04 1.2 48 89 top road
-0.219291 -0.517193 38 Inter 0.017 0.02 1.06 1.3 48 156 roundabout
-0.219352 -0.517060 42 Junct- 0.016 0.02 1.07 1.3 48 114 roundabout
-0.219304 -0.516904 45 Inter 0.018 0.02 1.09 1.3 48 72 roundabout
-0.219153 -0.516826 46* Junct- 0.018 0.02 1.11 1.3 48 27 roundabout
-0.218966 -0.516910 44 Inter 0.022 0.03 1.13 1.3 48 335 roundabout
-0.218923 -0.517072 39 Junct- 0.018 0.02 1.15 1.4 48 284 roundabout
-0.218998 -0.517207 37 Inter 0.017 0.02 1.17 1.4 48 240 roundabout
-0.219144 -0.517257 36* Junct 0.017 0.02 1.18 1.4 48 199 roundabout
-0.219145 -0.517626 33* Junct 0.041 0.05 1.22 1.5 48 269 top road
-0.219135 -0.518823 23* Junct 0.133 0.17 1.36 1.6 48 270 top road
-0.219131 -0.519426 20* Junct 0.067 0.08 1.42 1.7 48 270 top road
-0.219123 -0.520207 12* Junct 0.086 0.11 1.51 1.8 48 270 top road
-0.219107 -0.520828 6* Junct 0.069 0.09 1.58 1.9 48 271 top road
-0.220666 -0.520893 5* Junct- 0.173 0.11 1.75 2.0 96 182 main 1
-0.221308 -0.520914 4* Junct- 0.071 0.04 1.82 2.0 96 181 main 1
-0.221561 -0.520922 -3 Waypt 0.027 0.02 1.85 2.1 96 181 main 1
routino-3.0/src/test/expected/oneway-loop-WP01.txt 644 233 144 2317 12064636362 15304 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219564 -0.520846 -1 Waypt 0.000 0.00 0.00 0.0
-0.220666 -0.520893 4* Junct 0.122 0.07 0.12 0.1 96 182 main 1
-0.220695 -0.519489 9* Inter 0.156 0.20 0.28 0.3 48 91 high street
-0.220739 -0.517801 12* Junct 0.187 0.23 0.47 0.5 48 91 high street
-0.220405 -0.517799 13 Inter 0.037 0.04 0.50 0.5 48 0 reverse loop
-0.220210 -0.518605 11 Waypt 0.092 0.12 0.59 0.7 48 283 reverse loop
-0.220333 -0.519485 10 Inter 0.098 0.12 0.69 0.8 48 262 reverse loop
-0.220695 -0.519489 9* Inter 0.040 0.05 0.73 0.8 48 180 reverse loop
-0.220739 -0.517801 12* Junct 0.187 0.23 0.92 1.1 48 91 high street
-0.220784 -0.516035 18* Junct 0.196 0.24 1.11 1.3 48 91 high street
-0.219593 -0.515985 -3 Waypt 0.132 0.08 1.25 1.4 96 2 main 2
routino-3.0/src/test/expected/node-restrictions-WP04.txt 644 233 144 3410 12064636362 16504 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219564 -0.520846 -1 Waypt 0.000 0.00 0.00 0.0
-0.220666 -0.520893 4* Junct 0.122 0.07 0.12 0.1 96 182 main 1
-0.220682 -0.520141 9* Junct 0.083 0.08 0.20 0.2 64 91 high street
-0.220695 -0.519489 12* Change 0.072 0.07 0.28 0.2 64 91 high street
-0.220140 -0.519342 14 Inter 0.063 0.08 0.34 0.3 48 14 nopass road
-0.220173 -0.518597 20 Waypt 0.082 0.10 0.42 0.4 48 92 nopass road
-0.220140 -0.519342 14 Inter 0.082 0.10 0.50 0.5 48 272 nopass road
-0.220695 -0.519489 12* Junct 0.063 0.08 0.57 0.6 48 194 nopass road
-0.220694 -0.519227 15 Inter 0.029 0.04 0.60 0.6 48 89 long road
-0.220386 -0.519076 16 Inter 0.038 0.05 0.63 0.7 48 26 long road
-0.220961 -0.518928 17 Inter 0.066 0.08 0.70 0.7 48 165 long road
-0.220427 -0.518622 18 Inter 0.068 0.09 0.77 0.8 48 29 long road
-0.220949 -0.518422 21 Inter 0.062 0.08 0.83 0.9 48 159 long road
-0.220455 -0.518238 22 Inter 0.058 0.07 0.89 1.0 48 20 long road
-0.220746 -0.518070 23 Inter 0.037 0.04 0.93 1.0 48 149 long road
-0.220739 -0.517801 26* Junct 0.029 0.04 0.95 1.1 48 88 long road
-0.220784 -0.516035 31* Junct 0.196 0.18 1.15 1.2 64 91 high street
-0.219593 -0.515985 -3 Waypt 0.132 0.08 1.28 1.3 96 2 main 2
routino-3.0/src/test/expected/turns-WP08.txt 644 233 144 4461 12064636362 14217 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct 0.072 0.04 0.07 0.0 96 182 main 1
-0.219123 -0.520207 12* Junct 0.069 0.09 0.14 0.1 48 91 top road
-0.219131 -0.519426 20* Junct 0.086 0.11 0.23 0.2 48 90 top road
-0.219135 -0.518823 23* Junct 0.067 0.08 0.29 0.3 48 90 top road
-0.219145 -0.517626 33* Junct 0.133 0.17 0.43 0.5 48 90 top road
-0.219144 -0.517257 36* Junct 0.041 0.05 0.47 0.5 48 89 top road
-0.219291 -0.517193 38 Inter 0.017 0.02 0.48 0.6 48 156 roundabout
-0.219352 -0.517060 42 Junct- 0.016 0.02 0.50 0.6 48 114 roundabout
-0.219304 -0.516904 45 Inter 0.018 0.02 0.52 0.6 48 72 roundabout
-0.219153 -0.516826 46* Junct 0.018 0.02 0.54 0.6 48 27 roundabout
-0.219184 -0.515968 55* Junct 0.095 0.12 0.63 0.7 48 92 top road
-0.220784 -0.516035 54* Junct 0.178 0.11 0.81 0.8 96 182 main 2
-0.220760 -0.516647 48* Junct 0.068 0.09 0.88 0.9 48 272 high street
-0.220097 -0.516762 47* Inter 0.074 0.09 0.95 1.0 48 350 loop 3
-0.219872 -0.517009 43 Inter 0.037 0.04 0.99 1.1 48 312 loop 3
-0.220089 -0.517279 35* Waypt 0.038 0.05 1.03 1.1 48 231 loop 3
-0.220739 -0.517425 34* Junct 0.074 0.09 1.10 1.2 48 192 loop 3
-0.220724 -0.518071 31* Junct 0.071 0.09 1.17 1.3 48 271 high street
-0.220708 -0.518842 22* Junct 0.085 0.10 1.26 1.4 48 271 high street
-0.220691 -0.519461 19* Junct 0.069 0.09 1.33 1.5 48 271 high street
-0.220671 -0.520223 11* Junct 0.084 0.10 1.41 1.6 48 271 high street
-0.220666 -0.520893 5* Junct 0.074 0.09 1.48 1.7 48 270 high street
-0.221308 -0.520914 4* Junct- 0.071 0.04 1.55 1.7 96 181 main 1
-0.221561 -0.520922 -3 Waypt 0.027 0.02 1.58 1.7 96 181 main 1
routino-3.0/src/test/expected/super-or-not-WP02.txt 644 233 144 1205 12064636362 15401 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.216828 -0.519457 -1 Waypt 0.000 0.00 0.00 0.0
-0.217245 -0.519637 2* Junct 0.050 0.06 0.05 0.1 48 203 Local road
-0.217248 -0.515206 10* Junct 0.493 0.31 0.54 0.4 96 90 Main road
-0.216919 -0.515308 -2 Waypt 0.038 0.05 0.58 0.4 48 342 Local road
routino-3.0/src/test/expected/roundabout-waypoints-WP01.txt 644 233 144 1446 12317763605 17254 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218454 -0.520798 -1 Waypt 0.000 0.00 0.00 0.0
-0.219482 -0.520837 9* Waypt 0.113 0.07 0.11 0.1 96 182 main 1
-0.219692 -0.520509 15 Junct- 0.043 0.03 0.16 0.1 96 122 roundabout
-0.220082 -0.520522 14 Junct- 0.043 0.03 0.20 0.1 96 181 roundabout
-0.220268 -0.520863 8* Junct 0.043 0.03 0.24 0.1 96 241 roundabout
-0.221566 -0.520921 -3 Waypt 0.143 0.09 0.39 0.2 96 182 main 2
routino-3.0/src/test/expected/loops-WP01.txt 644 233 144 3336 12333160116 14155 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219562 -0.520851 -1 Waypt 0.000 0.00 0.00 0.0
-0.220223 -0.520885 5* Junct- 0.073 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 4* Junct 0.049 0.03 0.12 0.1 96 181 main 1
-0.220695 -0.519489 11* Junct 0.156 0.20 0.28 0.3 48 91 high street
-0.220280 -0.519256 15* Waypt 0.052 0.07 0.33 0.3 48 29 loop 1
-0.219910 -0.519112 17 Inter 0.044 0.06 0.37 0.4 48 21 loop 1
-0.219237 -0.519286 13* Junct 0.077 0.10 0.45 0.5 48 345 loop 1
-0.218764 -0.519471 12 Inter 0.056 0.07 0.51 0.6 48 338 loop 1
-0.218380 -0.519134 16 Inter 0.056 0.07 0.56 0.6 48 41 loop 1
-0.218776 -0.518838 18 Inter 0.055 0.07 0.62 0.7 48 143 loop 1
-0.219237 -0.519286 13* Junct 0.071 0.09 0.69 0.8 48 224 loop 1
-0.219910 -0.519112 17 Inter 0.077 0.10 0.77 0.9 48 165 loop 1
-0.220280 -0.519256 15* Junct- 0.044 0.06 0.81 0.9 48 201 loop 1
-0.220695 -0.519489 11* Junct 0.052 0.07 0.86 1.0 48 209 loop 1
-0.220739 -0.517801 19* Junct 0.187 0.23 1.05 1.2 48 91 high street
-0.220784 -0.516035 30* Junct 0.196 0.24 1.25 1.5 48 91 high street
-0.220311 -0.516015 31* Junct- 0.052 0.03 1.30 1.5 96 2 main 2
-0.219596 -0.515984 -3 Waypt 0.079 0.05 1.38 1.6 96 2 main 2
routino-3.0/src/test/expected/roundabout-waypoints-WP07.txt 644 233 144 1446 12317763605 17262 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218454 -0.520798 -1 Waypt 0.000 0.00 0.00 0.0
-0.219482 -0.520837 9* Junct 0.113 0.07 0.11 0.1 96 182 main 1
-0.219692 -0.520509 15 Junct- 0.043 0.03 0.16 0.1 96 122 roundabout
-0.220082 -0.520522 14 Junct- 0.043 0.03 0.20 0.1 96 181 roundabout
-0.220268 -0.520863 8* Waypt 0.043 0.03 0.24 0.1 96 241 roundabout
-0.221566 -0.520921 -3 Waypt 0.143 0.09 0.39 0.2 96 182 main 2
routino-3.0/src/test/expected/cycle-both-ways-WP02.txt 644 233 144 2177 12327514136 16046 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.221402 -0.520913 -1 Waypt 0.000 0.00 0.00 0.0
-0.220268 -0.520863 8* Junct 0.125 0.38 0.12 0.4 20 2 main 2
-0.220062 -0.521204 2 Inter 0.044 0.13 0.17 0.5 20 301 roundabout
-0.219665 -0.521190 3 Junct- 0.044 0.13 0.21 0.6 20 1 roundabout
-0.219482 -0.520837 9* Junct- 0.044 0.13 0.26 0.8 20 62 roundabout
-0.219692 -0.520509 15* Junct- 0.043 0.13 0.30 0.9 20 122 roundabout
-0.220082 -0.520522 14* Junct 0.043 0.13 0.34 1.0 20 181 roundabout
-0.220768 -0.519742 16 Inter 0.115 0.34 0.46 1.4 20 131 residential road
-0.220811 -0.518939 19* Junct 0.089 0.27 0.55 1.6 20 93 residential road
-0.221319 -0.518949 -2 Waypt 0.056 0.17 0.60 1.8 20 181 main 3
routino-3.0/src/test/expected/loops-WP06.txt 644 233 144 3337 12333160116 14163 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219562 -0.520851 -1 Waypt 0.000 0.00 0.00 0.0
-0.220223 -0.520885 5* Junct- 0.073 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 4* Junct 0.049 0.03 0.12 0.1 96 181 main 1
-0.220695 -0.519489 11* Junct 0.156 0.20 0.28 0.3 48 91 high street
-0.220739 -0.517801 19* Junct 0.187 0.23 0.47 0.5 48 91 high street
-0.220301 -0.517576 22* Waypt 0.054 0.07 0.52 0.6 48 27 loop 2
-0.219946 -0.517397 24 Inter 0.044 0.06 0.56 0.6 48 26 loop 2
-0.219266 -0.517579 21* Junct 0.078 0.10 0.64 0.7 48 345 loop 2
-0.218794 -0.517763 20 Inter 0.056 0.07 0.70 0.8 48 338 loop 2
-0.218417 -0.517462 23* Junct- 0.053 0.07 0.75 0.9 48 38 loop 2
-0.218805 -0.517131 25 Inter 0.056 0.07 0.81 0.9 48 139 loop 2
-0.219266 -0.517579 21* Junct 0.071 0.09 0.88 1.0 48 224 loop 2
-0.219946 -0.517397 24 Inter 0.078 0.10 0.95 1.1 48 165 loop 2
-0.220301 -0.517576 22* Junct- 0.044 0.06 1.00 1.2 48 206 loop 2
-0.220739 -0.517801 19* Junct 0.054 0.07 1.05 1.2 48 207 loop 2
-0.220784 -0.516035 30* Junct 0.196 0.24 1.25 1.5 48 91 high street
-0.220311 -0.516015 31* Junct- 0.052 0.03 1.30 1.5 96 2 main 2
-0.219596 -0.515984 -3 Waypt 0.079 0.05 1.38 1.6 96 2 main 2
routino-3.0/src/test/expected/no-super-WP02.txt 644 233 144 1051 12064636362 14576 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.216472 -0.519026 -1 Waypt 0.000 0.00 0.00 0.0
-0.216671 -0.515660 -2 Waypt 0.374 0.47 0.37 0.5 48 93 road2
-0.216579 -0.517212 -3 Waypt 0.172 0.21 0.55 0.7 48 273 road2
routino-3.0/src/test/expected/coincident-waypoint-WP03.txt 644 233 144 1432 12333375370 17017 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.217022 -0.520773 -1 Waypt 0.000 0.00 0.00 0.0
-0.217022 -0.520773 -2 Waypt 0.000 0.00 0.00 0.0 96 270 main 1
-0.217286 -0.520780 7 Junct- 0.029 0.02 0.03 0.0 96 181 main 1
-0.218523 -0.520806 6 Junct- 0.137 0.09 0.17 0.1 96 181 main 1
-0.219153 -0.520826 -3 Waypt 0.069 0.04 0.23 0.1 96 181 main 1
-0.219153 -0.520826 -4 Waypt 0.000 0.00 0.23 0.1 96 270 main 1
routino-3.0/src/test/expected/node-restrictions-WP05.txt 644 233 144 3410 12064636362 16505 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219564 -0.520846 -1 Waypt 0.000 0.00 0.00 0.0
-0.220666 -0.520893 4* Junct 0.122 0.07 0.12 0.1 96 182 main 1
-0.220682 -0.520141 9* Junct 0.083 0.08 0.20 0.2 64 91 high street
-0.220695 -0.519489 12* Change 0.072 0.07 0.28 0.2 64 91 high street
-0.220140 -0.519342 14 Inter 0.063 0.08 0.34 0.3 48 14 nopass road
-0.220170 -0.518653 -2 Waypt 0.075 0.09 0.41 0.4 48 92 nopass road
-0.220140 -0.519342 14 Inter 0.075 0.09 0.49 0.5 48 272 nopass road
-0.220695 -0.519489 12* Junct 0.063 0.08 0.55 0.6 48 194 nopass road
-0.220694 -0.519227 15 Inter 0.029 0.04 0.58 0.6 48 89 long road
-0.220386 -0.519076 16 Inter 0.038 0.05 0.62 0.6 48 26 long road
-0.220961 -0.518928 17 Inter 0.066 0.08 0.69 0.7 48 165 long road
-0.220427 -0.518622 18 Inter 0.068 0.09 0.75 0.8 48 29 long road
-0.220949 -0.518422 21 Inter 0.062 0.08 0.82 0.9 48 159 long road
-0.220455 -0.518238 22 Inter 0.058 0.07 0.87 1.0 48 20 long road
-0.220746 -0.518070 23 Inter 0.037 0.04 0.91 1.0 48 149 long road
-0.220739 -0.517801 26* Junct 0.029 0.04 0.94 1.0 48 88 long road
-0.220784 -0.516035 31* Junct 0.196 0.18 1.14 1.2 64 91 high street
-0.219593 -0.515985 -3 Waypt 0.132 0.08 1.27 1.3 96 2 main 2
routino-3.0/src/test/expected/turns-WP06.txt 644 233 144 3642 12064636362 14215 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct- 0.072 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 5* Junct 0.173 0.11 0.24 0.2 96 182 main 1
-0.220671 -0.520223 11* Junct 0.074 0.09 0.32 0.2 48 90 high street
-0.220691 -0.519461 19* Junct 0.084 0.10 0.40 0.3 48 91 high street
-0.220708 -0.518842 22* Junct 0.069 0.09 0.47 0.4 48 91 high street
-0.220724 -0.518071 31* Junct 0.085 0.10 0.56 0.5 48 91 high street
-0.220143 -0.518162 30 Inter 0.065 0.08 0.62 0.6 48 351 loop 2
-0.219850 -0.518416 27 Waypt 0.043 0.05 0.67 0.7 48 319 loop 2
-0.220100 -0.518718 24* Inter 0.043 0.05 0.71 0.7 48 230 loop 2
-0.220708 -0.518842 22* Junct 0.069 0.09 0.78 0.8 48 191 loop 2
-0.220724 -0.518071 31* Junct 0.085 0.10 0.86 0.9 48 91 high street
-0.220739 -0.517425 34* Junct 0.071 0.09 0.93 1.0 48 91 high street
-0.220760 -0.516647 48* Junct 0.086 0.11 1.02 1.1 48 91 high street
-0.220784 -0.516035 54* Junct 0.068 0.09 1.09 1.2 48 92 high street
-0.221431 -0.516056 53* Junct 0.072 0.04 1.16 1.2 96 181 main 2
-0.221376 -0.518235 29* Junct 0.242 0.30 1.40 1.5 48 271 bottom road
-0.221360 -0.518860 21* Junct 0.069 0.09 1.47 1.6 48 271 bottom road
-0.221308 -0.520914 4* Junct 0.228 0.28 1.70 1.9 48 271 bottom road
-0.221561 -0.520922 -3 Waypt 0.027 0.02 1.73 1.9 96 181 main 1
routino-3.0/src/test/expected/cycle-both-ways-WP01.txt 644 233 144 2172 12327514136 16040 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.221402 -0.520913 -1 Waypt 0.000 0.00 0.00 0.0
-0.220268 -0.520863 8* Junct 0.125 0.08 0.12 0.1 96 2 main 2
-0.220062 -0.521204 2 Inter 0.044 0.03 0.17 0.1 96 301 roundabout
-0.219665 -0.521190 3 Inter 0.044 0.03 0.21 0.1 96 1 roundabout
-0.219482 -0.520837 9* Junct- 0.044 0.03 0.26 0.2 96 62 roundabout
-0.219692 -0.520509 15* Junct 0.043 0.03 0.30 0.2 96 122 roundabout
-0.219271 -0.519532 17 Inter 0.118 0.15 0.42 0.3 48 66 residential road
-0.219302 -0.518908 20* Junct 0.069 0.09 0.49 0.4 48 92 residential road
-0.220811 -0.518939 19* Junct- 0.167 0.10 0.65 0.5 96 181 main 3
-0.221319 -0.518949 -2 Waypt 0.056 0.04 0.71 0.6 96 181 main 3
routino-3.0/src/test/expected/no-super-WP03.txt 644 233 144 1541 12064636362 14603 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.217185 -0.519054 5 Waypt 0.000 0.00 0.00 0.0
-0.217382 -0.518273 8 Inter 0.089 0.11 0.09 0.1 48 104 road3
-0.217219 -0.517733 11 Inter 0.062 0.08 0.15 0.2 48 73 road3
-0.217399 -0.516857 14 Inter 0.099 0.12 0.25 0.3 48 101 road3
-0.217202 -0.515964 17 Waypt 0.101 0.12 0.35 0.4 48 77 road3
-0.217399 -0.516857 14 Inter 0.101 0.12 0.45 0.6 48 257 road3
-0.217219 -0.517733 11 Waypt 0.099 0.12 0.55 0.7 48 281 road3
routino-3.0/src/test/expected/no-super-WP04.txt 644 233 144 2231 12064636362 14601 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.217903 -0.519035 6 Waypt 0.000 0.00 0.00 0.0
-0.218100 -0.518253 9 Inter 0.089 0.11 0.09 0.1 48 104 road4
-0.217937 -0.517713 12 Inter 0.062 0.08 0.15 0.2 48 73 road4
-0.218117 -0.516837 16 Inter 0.099 0.12 0.25 0.3 48 101 road4
-0.217920 -0.515945 18 Inter 0.101 0.12 0.35 0.4 48 77 road4
-0.218143 -0.515189 21 Inter 0.087 0.11 0.44 0.5 48 106 road4
-0.217911 -0.514640 26 Waypt 0.066 0.08 0.50 0.6 48 67 road4
-0.218143 -0.515189 21 Inter 0.066 0.08 0.57 0.7 48 247 road4
-0.217920 -0.515945 18 Inter 0.087 0.11 0.66 0.8 48 286 road4
-0.218117 -0.516837 16 Inter 0.101 0.12 0.76 0.9 48 257 road4
-0.217937 -0.517713 12 Waypt 0.099 0.12 0.86 1.1 48 281 road4
routino-3.0/src/test/expected/dead-ends-WP03.txt 644 233 144 3017 12154145517 14654 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219535 -0.521016 -1 Waypt 0.000 0.00 0.00 0.0
-0.220223 -0.521052 5* Junct- 0.076 0.05 0.08 0.0 96 182 main 1
-0.220666 -0.521060 4* Junct 0.049 0.03 0.12 0.1 96 180 main 1
-0.220702 -0.519478 12* Junct 0.176 0.22 0.30 0.3 48 91 high street
-0.220263 -0.519309 13* Junct- 0.052 0.07 0.35 0.4 48 21 dead-end 1
-0.219924 -0.519179 14 Inter 0.040 0.05 0.39 0.4 48 20 dead-end 1
-0.219567 -0.519373 -2 Waypt 0.045 0.06 0.44 0.5 48 331 dead-end 1
-0.219924 -0.519179 14 Inter 0.045 0.06 0.48 0.5 48 151 dead-end 1
-0.220263 -0.519309 13* Junct- 0.040 0.05 0.52 0.6 48 200 dead-end 1
-0.220702 -0.519478 12* Junct 0.052 0.07 0.57 0.6 48 201 dead-end 1
-0.220739 -0.517804 18* Junct 0.186 0.23 0.76 0.9 48 91 high street
-0.220782 -0.516137 24* Junct 0.185 0.23 0.95 1.1 48 91 high street
-0.220817 -0.514062 32* Junct 0.230 0.29 1.18 1.4 48 90 high street
-0.220344 -0.514042 33* Junct- 0.052 0.03 1.23 1.4 96 2 main 2
-0.219539 -0.514007 -3 Waypt 0.089 0.06 1.32 1.5 96 2 main 2
routino-3.0/src/test/expected/node-restrictions-WP07.txt 644 233 144 3144 12064636362 16513 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219564 -0.520846 -1 Waypt 0.000 0.00 0.00 0.0
-0.220666 -0.520893 4* Junct 0.122 0.07 0.12 0.1 96 182 main 1
-0.220682 -0.520141 9* Junct 0.083 0.08 0.20 0.2 64 91 high street
-0.219009 -0.520075 10* Waypt 0.186 0.17 0.39 0.3 64 2 dead end road
-0.220682 -0.520141 9* Junct 0.186 0.17 0.58 0.5 64 182 dead end road
-0.220695 -0.519489 12* Change 0.072 0.07 0.65 0.6 64 91 high street
-0.220694 -0.519227 15 Inter 0.029 0.04 0.68 0.6 48 89 long road
-0.220386 -0.519076 16 Inter 0.038 0.05 0.72 0.6 48 26 long road
-0.220961 -0.518928 17 Inter 0.066 0.08 0.78 0.7 48 165 long road
-0.220427 -0.518622 18 Inter 0.068 0.09 0.85 0.8 48 29 long road
-0.220949 -0.518422 21 Inter 0.062 0.08 0.91 0.9 48 159 long road
-0.220455 -0.518238 22 Inter 0.058 0.07 0.97 1.0 48 20 long road
-0.220746 -0.518070 23 Inter 0.037 0.04 1.01 1.0 48 149 long road
-0.220739 -0.517801 26* Junct 0.029 0.04 1.04 1.0 48 88 long road
-0.220784 -0.516035 31* Junct 0.196 0.18 1.23 1.2 64 91 high street
-0.219593 -0.515985 -3 Waypt 0.132 0.08 1.36 1.3 96 2 main 2
routino-3.0/src/test/expected/turns-WP07.txt 644 233 144 5050 12064636362 14211 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct 0.072 0.04 0.07 0.0 96 182 main 1
-0.219123 -0.520207 12* Junct 0.069 0.09 0.14 0.1 48 91 top road
-0.219131 -0.519426 20* Junct 0.086 0.11 0.23 0.2 48 90 top road
-0.219135 -0.518823 23* Junct 0.067 0.08 0.29 0.3 48 90 top road
-0.219145 -0.517626 33* Junct 0.133 0.17 0.43 0.5 48 90 top road
-0.219144 -0.517257 36* Junct 0.041 0.05 0.47 0.5 48 89 top road
-0.219291 -0.517193 38 Inter 0.017 0.02 0.48 0.6 48 156 roundabout
-0.219352 -0.517060 42 Junct- 0.016 0.02 0.50 0.6 48 114 roundabout
-0.219304 -0.516904 45 Inter 0.018 0.02 0.52 0.6 48 72 roundabout
-0.219153 -0.516826 46* Junct 0.018 0.02 0.54 0.6 48 27 roundabout
-0.219184 -0.515968 55* Junct 0.095 0.12 0.63 0.7 48 92 top road
-0.220784 -0.516035 54* Junct 0.178 0.11 0.81 0.8 96 182 main 2
-0.220760 -0.516647 48* Junct 0.068 0.09 0.88 0.9 48 272 high street
-0.220739 -0.517425 34* Junct 0.086 0.11 0.96 1.0 48 271 high street
-0.220238 -0.517313 -2 Waypt 0.057 0.07 1.02 1.1 48 12 loop 3
-0.220089 -0.517279 35* Inter 0.017 0.02 1.04 1.1 48 12 loop 3
-0.219872 -0.517009 43 Inter 0.038 0.05 1.08 1.2 48 51 loop 3
-0.220097 -0.516762 47* Inter 0.037 0.04 1.11 1.2 48 132 loop 3
-0.220760 -0.516647 48* Junct 0.074 0.09 1.19 1.3 48 170 loop 3
-0.220739 -0.517425 34* Junct 0.086 0.11 1.27 1.4 48 271 high street
-0.220724 -0.518071 31* Junct 0.071 0.09 1.34 1.5 48 271 high street
-0.220708 -0.518842 22* Junct 0.085 0.10 1.43 1.6 48 271 high street
-0.220691 -0.519461 19* Junct 0.069 0.09 1.50 1.7 48 271 high street
-0.220671 -0.520223 11* Junct 0.084 0.10 1.58 1.8 48 271 high street
-0.220666 -0.520893 5* Junct 0.074 0.09 1.66 1.9 48 270 high street
-0.221308 -0.520914 4* Junct- 0.071 0.04 1.73 1.9 96 181 main 1
-0.221561 -0.520922 -3 Waypt 0.027 0.02 1.75 2.0 96 181 main 1
routino-3.0/src/test/expected/turns-WP16.txt 644 233 144 2145 12064636362 14213 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct- 0.072 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 5* Junct- 0.173 0.11 0.24 0.2 96 182 main 1
-0.221308 -0.520914 4* Junct 0.071 0.04 0.32 0.2 96 181 main 1
-0.221360 -0.518860 21* Junct 0.228 0.28 0.54 0.5 48 91 bottom road
-0.221711 -0.518511 26* Waypt 0.055 0.07 0.60 0.5 48 135 loop 6
-0.221376 -0.518235 29* Junct 0.048 0.06 0.65 0.6 48 39 loop 6
-0.221360 -0.518860 21* Junct 0.069 0.09 0.72 0.7 48 271 bottom road
-0.221308 -0.520914 4* Junct 0.228 0.28 0.94 1.0 48 271 bottom road
-0.221561 -0.520922 -3 Waypt 0.027 0.02 0.97 1.0 96 181 main 1
routino-3.0/src/test/expected/fake-node-with-loop-WP01.txt 644 233 144 2540 12327215464 16600 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.216904 -0.520770 -1 Waypt 0.000 0.00 0.00 0.0
-0.217286 -0.520780 10 Junct- 0.042 0.03 0.04 0.0 96 181 main 1
-0.218086 -0.520797 -2 Waypt 0.088 0.06 0.13 0.1 96 181 main 1
-0.218523 -0.520806 9 Junct- 0.048 0.03 0.18 0.1 96 181 main 1
-0.219482 -0.520837 8* Junct 0.106 0.07 0.28 0.2 96 181 main 1
-0.219692 -0.520509 14 Junct- 0.043 0.03 0.33 0.2 96 122 roundabout
-0.220082 -0.520522 13 Junct- 0.043 0.03 0.37 0.2 96 181 roundabout
-0.220268 -0.520863 7 Inter 0.043 0.03 0.41 0.3 96 241 roundabout
-0.220062 -0.521204 4 Junct- 0.044 0.03 0.46 0.3 96 301 roundabout
-0.219665 -0.521190 5 Junct- 0.044 0.03 0.50 0.3 96 1 roundabout
-0.219482 -0.520837 8* Junct 0.044 0.03 0.55 0.3 96 62 roundabout
-0.218523 -0.520806 9 Junct- 0.106 0.07 0.65 0.4 96 1 main 1
-0.217741 -0.520789 -3 Waypt 0.086 0.05 0.74 0.5 96 1 main 1
routino-3.0/src/test/expected/loops-WP07.txt 644 233 144 3340 12333160116 14156 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219562 -0.520851 -1 Waypt 0.000 0.00 0.00 0.0
-0.220223 -0.520885 5* Junct- 0.073 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 4* Junct 0.049 0.03 0.12 0.1 96 181 main 1
-0.220695 -0.519489 11* Junct 0.156 0.20 0.28 0.3 48 91 high street
-0.220739 -0.517801 19* Junct 0.187 0.23 0.47 0.5 48 91 high street
-0.220301 -0.517576 22* Junct- 0.054 0.07 0.52 0.6 48 27 loop 2
-0.219946 -0.517397 24 Waypt 0.044 0.06 0.56 0.6 48 26 loop 2
-0.219266 -0.517579 21* Junct 0.078 0.10 0.64 0.7 48 345 loop 2
-0.218794 -0.517763 20 Inter 0.056 0.07 0.70 0.8 48 338 loop 2
-0.218417 -0.517462 23* Junct- 0.053 0.07 0.75 0.9 48 38 loop 2
-0.218805 -0.517131 25 Inter 0.056 0.07 0.81 0.9 48 139 loop 2
-0.219266 -0.517579 21* Junct 0.071 0.09 0.88 1.0 48 224 loop 2
-0.219946 -0.517397 24 Inter 0.078 0.10 0.95 1.1 48 165 loop 2
-0.220301 -0.517576 22* Junct- 0.044 0.06 1.00 1.2 48 206 loop 2
-0.220739 -0.517801 19* Junct 0.054 0.07 1.05 1.2 48 207 loop 2
-0.220784 -0.516035 30* Junct 0.196 0.24 1.25 1.5 48 91 high street
-0.220311 -0.516015 31* Junct- 0.052 0.03 1.30 1.5 96 2 main 2
-0.219596 -0.515984 -3 Waypt 0.079 0.05 1.38 1.6 96 2 main 2
routino-3.0/src/test/expected/loops-WP10.txt 644 233 144 3340 12064636362 14164 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219562 -0.520851 -1 Waypt 0.000 0.00 0.00 0.0
-0.220223 -0.520885 5* Junct- 0.073 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 4* Junct 0.049 0.03 0.12 0.1 96 181 main 1
-0.220695 -0.519489 11* Junct 0.156 0.20 0.28 0.3 48 91 high street
-0.220739 -0.517801 19* Junct 0.187 0.23 0.47 0.5 48 91 high street
-0.220301 -0.517576 22* Junct- 0.054 0.07 0.52 0.6 48 27 loop 2
-0.219946 -0.517397 24 Inter 0.044 0.06 0.56 0.6 48 26 loop 2
-0.219266 -0.517579 21* Junct 0.078 0.10 0.64 0.7 48 345 loop 2
-0.218805 -0.517131 25 Waypt 0.071 0.09 0.71 0.8 48 44 loop 2
-0.218417 -0.517462 23* Junct- 0.056 0.07 0.77 0.9 48 319 loop 2
-0.218794 -0.517763 20 Inter 0.053 0.07 0.82 0.9 48 218 loop 2
-0.219266 -0.517579 21* Junct 0.056 0.07 0.88 1.0 48 158 loop 2
-0.219946 -0.517397 24 Inter 0.078 0.10 0.95 1.1 48 165 loop 2
-0.220301 -0.517576 22* Junct- 0.044 0.06 1.00 1.2 48 206 loop 2
-0.220739 -0.517801 19* Junct 0.054 0.07 1.05 1.2 48 207 loop 2
-0.220784 -0.516035 30* Junct 0.196 0.24 1.25 1.5 48 91 high street
-0.220311 -0.516015 31* Junct- 0.052 0.03 1.30 1.5 96 2 main 2
-0.219596 -0.515984 -3 Waypt 0.079 0.05 1.38 1.6 96 2 main 2
routino-3.0/src/test/expected/turns-WP10.txt 644 233 144 5154 12064636362 14210 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct 0.072 0.04 0.07 0.0 96 182 main 1
-0.219123 -0.520207 12* Junct 0.069 0.09 0.14 0.1 48 91 top road
-0.219131 -0.519426 20* Junct 0.086 0.11 0.23 0.2 48 90 top road
-0.219135 -0.518823 23* Junct 0.067 0.08 0.29 0.3 48 90 top road
-0.219145 -0.517626 33* Junct 0.133 0.17 0.43 0.5 48 90 top road
-0.219144 -0.517257 36* Junct 0.041 0.05 0.47 0.5 48 89 top road
-0.219291 -0.517193 38 Inter 0.017 0.02 0.48 0.6 48 156 roundabout
-0.219352 -0.517060 42 Junct- 0.016 0.02 0.50 0.6 48 114 roundabout
-0.219304 -0.516904 45 Inter 0.018 0.02 0.52 0.6 48 72 roundabout
-0.219153 -0.516826 46* Junct- 0.018 0.02 0.54 0.6 48 27 roundabout
-0.218966 -0.516910 44 Inter 0.022 0.03 0.56 0.6 48 335 roundabout
-0.218923 -0.517072 39 Junct- 0.018 0.02 0.58 0.7 48 284 roundabout
-0.218998 -0.517207 37 Inter 0.017 0.02 0.59 0.7 48 240 roundabout
-0.219144 -0.517257 36* Junct 0.017 0.02 0.61 0.7 48 199 roundabout
-0.219145 -0.517626 33* Junct 0.041 0.05 0.65 0.8 48 269 top road
-0.219135 -0.518823 23* Junct 0.133 0.17 0.79 0.9 48 270 top road
-0.219131 -0.519426 20* Junct 0.067 0.08 0.85 1.0 48 270 top road
-0.219123 -0.520207 12* Junct 0.086 0.11 0.94 1.1 48 270 top road
-0.218605 -0.520090 -2 Waypt 0.059 0.07 1.00 1.2 48 12 loop 4
-0.218474 -0.520060 14* Inter 0.015 0.02 1.01 1.2 48 12 loop 4
-0.218258 -0.519789 16 Inter 0.038 0.05 1.05 1.2 48 51 loop 4
-0.218482 -0.519542 18* Inter 0.037 0.04 1.09 1.3 48 132 loop 4
-0.219131 -0.519426 20* Junct 0.073 0.09 1.16 1.4 48 169 loop 4
-0.219123 -0.520207 12* Junct 0.086 0.11 1.25 1.5 48 270 top road
-0.219107 -0.520828 6* Junct 0.069 0.09 1.31 1.6 48 271 top road
-0.220666 -0.520893 5* Junct- 0.173 0.11 1.49 1.7 96 182 main 1
-0.221308 -0.520914 4* Junct- 0.071 0.04 1.56 1.7 96 181 main 1
-0.221561 -0.520922 -3 Waypt 0.027 0.02 1.59 1.7 96 181 main 1
routino-3.0/src/test/expected/turns-WP15.txt 644 233 144 6532 12064636362 14216 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct 0.072 0.04 0.07 0.0 96 182 main 1
-0.219123 -0.520207 12* Junct 0.069 0.09 0.14 0.1 48 91 top road
-0.219131 -0.519426 20* Junct 0.086 0.11 0.23 0.2 48 90 top road
-0.219135 -0.518823 23* Junct 0.067 0.08 0.29 0.3 48 90 top road
-0.219145 -0.517626 33* Junct 0.133 0.17 0.43 0.5 48 90 top road
-0.219144 -0.517257 36* Junct 0.041 0.05 0.47 0.5 48 89 top road
-0.219291 -0.517193 38 Inter 0.017 0.02 0.48 0.6 48 156 roundabout
-0.219352 -0.517060 42 Junct- 0.016 0.02 0.50 0.6 48 114 roundabout
-0.219304 -0.516904 45 Inter 0.018 0.02 0.52 0.6 48 72 roundabout
-0.219153 -0.516826 46* Junct- 0.018 0.02 0.54 0.6 48 27 roundabout
-0.218966 -0.516910 44 Inter 0.022 0.03 0.56 0.6 48 335 roundabout
-0.218923 -0.517072 39 Junct- 0.018 0.02 0.58 0.7 48 284 roundabout
-0.218998 -0.517207 37 Inter 0.017 0.02 0.59 0.7 48 240 roundabout
-0.219144 -0.517257 36* Junct 0.017 0.02 0.61 0.7 48 199 roundabout
-0.219145 -0.517626 33* Junct 0.041 0.05 0.65 0.8 48 269 top road
-0.218619 -0.517921 32* Inter 0.067 0.08 0.72 0.8 48 330 loop 5
-0.218431 -0.518243 28 Waypt 0.041 0.05 0.76 0.9 48 300 loop 5
-0.218600 -0.518557 25* Inter 0.039 0.05 0.80 0.9 48 241 loop 5
-0.219135 -0.518823 23* Junct 0.066 0.08 0.86 1.0 48 206 loop 5
-0.219145 -0.517626 33* Junct 0.133 0.17 1.00 1.2 48 90 top road
-0.219144 -0.517257 36* Junct 0.041 0.05 1.04 1.2 48 89 top road
-0.219291 -0.517193 38 Inter 0.017 0.02 1.06 1.3 48 156 roundabout
-0.219352 -0.517060 42 Junct- 0.016 0.02 1.07 1.3 48 114 roundabout
-0.219304 -0.516904 45 Inter 0.018 0.02 1.09 1.3 48 72 roundabout
-0.219153 -0.516826 46* Junct- 0.018 0.02 1.11 1.3 48 27 roundabout
-0.218966 -0.516910 44 Inter 0.022 0.03 1.13 1.3 48 335 roundabout
-0.218923 -0.517072 39 Junct- 0.018 0.02 1.15 1.4 48 284 roundabout
-0.218998 -0.517207 37 Inter 0.017 0.02 1.17 1.4 48 240 roundabout
-0.219144 -0.517257 36* Junct 0.017 0.02 1.18 1.4 48 199 roundabout
-0.219145 -0.517626 33* Junct 0.041 0.05 1.22 1.5 48 269 top road
-0.219135 -0.518823 23* Junct 0.133 0.17 1.36 1.6 48 270 top road
-0.219131 -0.519426 20* Junct 0.067 0.08 1.42 1.7 48 270 top road
-0.219123 -0.520207 12* Junct 0.086 0.11 1.51 1.8 48 270 top road
-0.219107 -0.520828 6* Junct 0.069 0.09 1.58 1.9 48 271 top road
-0.220666 -0.520893 5* Junct- 0.173 0.11 1.75 2.0 96 182 main 1
-0.221308 -0.520914 4* Junct- 0.071 0.04 1.82 2.0 96 181 main 1
-0.221561 -0.520922 -3 Waypt 0.027 0.02 1.85 2.1 96 181 main 1
routino-3.0/src/test/expected/node-restrictions-WP03.txt 644 233 144 3420 12064636362 16504 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219564 -0.520846 -1 Waypt 0.000 0.00 0.00 0.0
-0.220666 -0.520893 4* Junct 0.122 0.07 0.12 0.1 96 182 main 1
-0.220682 -0.520141 9* Junct 0.083 0.08 0.20 0.2 64 91 high street
-0.220695 -0.519489 12* Change 0.072 0.07 0.28 0.2 64 91 high street
-0.220694 -0.519227 15 Inter 0.029 0.04 0.31 0.3 48 89 long road
-0.220386 -0.519076 16 Inter 0.038 0.05 0.34 0.3 48 26 long road
-0.220961 -0.518928 17 Inter 0.066 0.08 0.41 0.4 48 165 long road
-0.220427 -0.518622 18 Inter 0.068 0.09 0.48 0.5 48 29 long road
-0.220949 -0.518422 21 Inter 0.062 0.08 0.54 0.5 48 159 long road
-0.220455 -0.518238 22 Inter 0.058 0.07 0.60 0.6 48 20 long road
-0.220746 -0.518070 23 Inter 0.037 0.04 0.64 0.7 48 149 long road
-0.220739 -0.517801 26* Junct 0.029 0.04 0.66 0.7 48 88 long road
-0.221166 -0.517916 24 Inter 0.049 0.06 0.71 0.8 48 195 somepass road
-0.221157 -0.518560 -2 Waypt 0.070 0.09 0.78 0.8 48 270 somepass road
-0.221166 -0.517916 24 Inter 0.070 0.09 0.85 0.9 48 90 somepass road
-0.220739 -0.517801 26* Junct 0.049 0.06 0.90 1.0 48 15 somepass road
-0.220784 -0.516035 31* Junct 0.196 0.18 1.10 1.2 64 91 high street
-0.219593 -0.515985 -3 Waypt 0.132 0.08 1.23 1.3 96 2 main 2
routino-3.0/src/test/expected/node-restrictions-WP08.txt 644 233 144 3144 12154146101 16477 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219564 -0.520846 -1 Waypt 0.000 0.00 0.00 0.0
-0.220666 -0.520893 4* Junct 0.122 0.07 0.12 0.1 96 182 main 1
-0.220682 -0.520141 9* Junct 0.083 0.08 0.20 0.2 64 91 high street
-0.219009 -0.520075 10* Waypt 0.186 0.17 0.39 0.3 64 2 dead end road
-0.220682 -0.520141 9* Junct 0.186 0.17 0.58 0.5 64 182 dead end road
-0.220695 -0.519489 12* Change 0.072 0.07 0.65 0.6 64 91 high street
-0.220694 -0.519227 15 Inter 0.029 0.04 0.68 0.6 48 89 long road
-0.220386 -0.519076 16 Inter 0.038 0.05 0.72 0.6 48 26 long road
-0.220961 -0.518928 17 Inter 0.066 0.08 0.78 0.7 48 165 long road
-0.220427 -0.518622 18 Inter 0.068 0.09 0.85 0.8 48 29 long road
-0.220949 -0.518422 21 Inter 0.062 0.08 0.91 0.9 48 159 long road
-0.220455 -0.518238 22 Inter 0.058 0.07 0.97 1.0 48 20 long road
-0.220746 -0.518070 23 Inter 0.037 0.04 1.01 1.0 48 149 long road
-0.220739 -0.517801 26* Junct 0.029 0.04 1.04 1.0 48 88 long road
-0.220784 -0.516035 31* Junct 0.196 0.18 1.23 1.2 64 91 high street
-0.219593 -0.515985 -3 Waypt 0.132 0.08 1.36 1.3 96 2 main 2
routino-3.0/src/test/expected/loops-WP08.txt 644 233 144 3457 12064636362 14204 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219562 -0.520851 -1 Waypt 0.000 0.00 0.00 0.0
-0.220223 -0.520885 5* Junct- 0.073 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 4* Junct 0.049 0.03 0.12 0.1 96 181 main 1
-0.220695 -0.519489 11* Junct 0.156 0.20 0.28 0.3 48 91 high street
-0.220739 -0.517801 19* Junct 0.187 0.23 0.47 0.5 48 91 high street
-0.220301 -0.517576 22* Junct- 0.054 0.07 0.52 0.6 48 27 loop 2
-0.219946 -0.517397 24 Inter 0.044 0.06 0.56 0.6 48 26 loop 2
-0.219597 -0.517490 -2 Waypt 0.040 0.05 0.60 0.7 48 345 loop 2
-0.219266 -0.517579 21* Junct 0.038 0.05 0.64 0.7 48 345 loop 2
-0.218794 -0.517763 20 Inter 0.056 0.07 0.70 0.8 48 338 loop 2
-0.218417 -0.517462 23* Junct- 0.053 0.07 0.75 0.9 48 38 loop 2
-0.218805 -0.517131 25 Inter 0.056 0.07 0.81 0.9 48 139 loop 2
-0.219266 -0.517579 21* Junct 0.071 0.09 0.88 1.0 48 224 loop 2
-0.219946 -0.517397 24 Inter 0.078 0.10 0.95 1.1 48 165 loop 2
-0.220301 -0.517576 22* Junct- 0.044 0.06 1.00 1.2 48 206 loop 2
-0.220739 -0.517801 19* Junct 0.054 0.07 1.05 1.2 48 207 loop 2
-0.220784 -0.516035 30* Junct 0.196 0.24 1.25 1.5 48 91 high street
-0.220311 -0.516015 31* Junct- 0.052 0.03 1.30 1.5 96 2 main 2
-0.219596 -0.515984 -3 Waypt 0.079 0.05 1.38 1.6 96 2 main 2
routino-3.0/src/test/expected/loops-WP11.txt 644 233 144 3337 12064636362 14173 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219562 -0.520851 -1 Waypt 0.000 0.00 0.00 0.0
-0.220223 -0.520885 5* Junct- 0.073 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 4* Junct 0.049 0.03 0.12 0.1 96 181 main 1
-0.220695 -0.519489 11* Junct 0.156 0.20 0.28 0.3 48 91 high street
-0.220739 -0.517801 19* Junct 0.187 0.23 0.47 0.5 48 91 high street
-0.220301 -0.517576 22* Junct- 0.054 0.07 0.52 0.6 48 27 loop 2
-0.219946 -0.517397 24 Inter 0.044 0.06 0.56 0.6 48 26 loop 2
-0.219266 -0.517579 21* Junct 0.078 0.10 0.64 0.7 48 345 loop 2
-0.218794 -0.517763 20 Inter 0.056 0.07 0.70 0.8 48 338 loop 2
-0.218417 -0.517462 23* Waypt 0.053 0.07 0.75 0.9 48 38 loop 2
-0.218805 -0.517131 25 Inter 0.056 0.07 0.81 0.9 48 139 loop 2
-0.219266 -0.517579 21* Junct 0.071 0.09 0.88 1.0 48 224 loop 2
-0.219946 -0.517397 24 Inter 0.078 0.10 0.95 1.1 48 165 loop 2
-0.220301 -0.517576 22* Junct- 0.044 0.06 1.00 1.2 48 206 loop 2
-0.220739 -0.517801 19* Junct 0.054 0.07 1.05 1.2 48 207 loop 2
-0.220784 -0.516035 30* Junct 0.196 0.24 1.25 1.5 48 91 high street
-0.220311 -0.516015 31* Junct- 0.052 0.03 1.30 1.5 96 2 main 2
-0.219596 -0.515984 -3 Waypt 0.079 0.05 1.38 1.6 96 2 main 2
routino-3.0/src/test/expected/coincident-waypoint-WP02.txt 644 233 144 1312 12333375370 17013 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.216959 -0.520771 -1 Waypt 0.000 0.00 0.00 0.0
-0.217286 -0.520780 7 Junct- 0.036 0.02 0.04 0.0 96 181 main 1
-0.218523 -0.520806 6 Waypt 0.137 0.09 0.17 0.1 96 181 main 1
-0.218523 -0.520806 6 Waypt 0.000 0.00 0.17 0.1 96 270 main 1
-0.219117 -0.520825 -4 Waypt 0.065 0.04 0.24 0.1 96 181 main 1
routino-3.0/src/test/expected/coincident-waypoint-WP01.txt 644 233 144 1432 12333375370 17015 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.216904 -0.520770 -1 Waypt 0.000 0.00 0.00 0.0
-0.217286 -0.520780 7 Junct- 0.042 0.03 0.04 0.0 96 181 main 1
-0.217741 -0.520789 -2 Waypt 0.050 0.03 0.09 0.1 96 181 main 1
-0.217741 -0.520789 -3 Waypt 0.000 0.00 0.09 0.1 96 270 main 1
-0.218523 -0.520806 6 Junct- 0.086 0.05 0.18 0.1 96 181 main 1
-0.219080 -0.520824 -4 Waypt 0.061 0.04 0.24 0.1 96 181 main 1
routino-3.0/src/test/expected/roundabout-waypoints-WP04.txt 644 233 144 1571 12317763605 17256 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218454 -0.520798 -1 Waypt 0.000 0.00 0.00 0.0
-0.219482 -0.520837 9* Junct 0.113 0.07 0.11 0.1 96 182 main 1
-0.219692 -0.520509 15 Junct- 0.043 0.03 0.16 0.1 96 122 roundabout
-0.219878 -0.520515 -2 Waypt 0.020 0.01 0.18 0.1 96 181 roundabout
-0.220082 -0.520522 14 Junct- 0.022 0.01 0.20 0.1 96 181 roundabout
-0.220268 -0.520863 8* Junct 0.043 0.03 0.24 0.1 96 241 roundabout
-0.221566 -0.520921 -3 Waypt 0.143 0.09 0.38 0.2 96 182 main 2
routino-3.0/src/test/expected/no-super-WP01.txt 644 233 144 2113 12064636362 14575 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.215814 -0.519419 -1 Waypt 0.000 0.00 0.00 0.0
-0.215737 -0.519035 7 Inter 0.043 0.05 0.04 0.1 48 78 road1
-0.215935 -0.518253 10 Inter 0.089 0.11 0.13 0.2 48 104 road1
-0.215772 -0.517713 13 Inter 0.062 0.08 0.19 0.2 48 73 road1
-0.215952 -0.516838 15 Inter 0.099 0.12 0.29 0.4 48 101 road1
-0.215755 -0.515945 19 Inter 0.101 0.12 0.39 0.5 48 77 road1
-0.215897 -0.515462 -2 Waypt 0.055 0.07 0.45 0.6 48 106 road1
-0.215755 -0.515945 19 Inter 0.055 0.07 0.50 0.6 48 286 road1
-0.215952 -0.516838 15 Inter 0.101 0.12 0.60 0.8 48 257 road1
-0.215868 -0.517244 -3 Waypt 0.046 0.06 0.65 0.8 48 281 road1
routino-3.0/src/test/expected/super-or-not-WP01.txt 644 233 144 1577 12064636362 15414 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.216158 -0.518809 -1 Waypt 0.000 0.00 0.00 0.0
-0.216435 -0.518515 4 Inter 0.044 0.06 0.04 0.1 48 133 Local road
-0.215866 -0.517931 5 Inter 0.090 0.11 0.13 0.2 48 45 Local road
-0.216470 -0.517412 6 Inter 0.088 0.11 0.22 0.3 48 139 Local road
-0.215930 -0.516823 7 Inter 0.088 0.11 0.31 0.4 48 47 Local road
-0.216451 -0.516221 8 Inter 0.088 0.11 0.40 0.5 48 130 Local road
-0.216158 -0.515870 -2 Waypt 0.050 0.06 0.45 0.6 48 50 Local road
routino-3.0/src/test/expected/turns-WP01.txt 644 233 144 2522 12064636362 14204 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct- 0.072 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 5* Junct 0.173 0.11 0.24 0.2 96 182 main 1
-0.220671 -0.520223 11* Junct 0.074 0.09 0.32 0.2 48 90 high street
-0.220691 -0.519461 19* Junct 0.084 0.10 0.40 0.3 48 91 high street
-0.220111 -0.519553 17 Inter 0.065 0.08 0.47 0.4 48 351 loop 1
-0.219817 -0.519807 15 Inter 0.043 0.05 0.51 0.5 48 319 loop 1
-0.220067 -0.520109 13* Inter 0.043 0.05 0.55 0.5 48 230 loop 1
-0.220191 -0.520132 -2 Waypt 0.014 0.02 0.57 0.6 48 190 loop 1
-0.220671 -0.520223 11* Junct 0.054 0.07 0.62 0.6 48 190 loop 1
-0.220666 -0.520893 5* Junct 0.074 0.09 0.70 0.7 48 270 high street
-0.221308 -0.520914 4* Junct- 0.071 0.04 0.77 0.8 96 181 main 1
-0.221561 -0.520922 -3 Waypt 0.027 0.02 0.79 0.8 96 181 main 1
routino-3.0/src/test/expected/loops-WP03.txt 644 233 144 3456 12064636362 14176 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219562 -0.520851 -1 Waypt 0.000 0.00 0.00 0.0
-0.220223 -0.520885 5* Junct- 0.073 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 4* Junct 0.049 0.03 0.12 0.1 96 181 main 1
-0.220695 -0.519489 11* Junct 0.156 0.20 0.28 0.3 48 91 high street
-0.220280 -0.519256 15* Junct- 0.052 0.07 0.33 0.3 48 29 loop 1
-0.219910 -0.519112 17 Inter 0.044 0.06 0.37 0.4 48 21 loop 1
-0.219578 -0.519198 -2 Waypt 0.038 0.05 0.41 0.4 48 345 loop 1
-0.219237 -0.519286 13* Junct 0.039 0.05 0.45 0.5 48 345 loop 1
-0.218764 -0.519471 12 Inter 0.056 0.07 0.51 0.6 48 338 loop 1
-0.218380 -0.519134 16 Inter 0.056 0.07 0.56 0.6 48 41 loop 1
-0.218776 -0.518838 18 Inter 0.055 0.07 0.62 0.7 48 143 loop 1
-0.219237 -0.519286 13* Junct 0.071 0.09 0.69 0.8 48 224 loop 1
-0.219910 -0.519112 17 Inter 0.077 0.10 0.77 0.9 48 165 loop 1
-0.220280 -0.519256 15* Junct- 0.044 0.06 0.81 0.9 48 201 loop 1
-0.220695 -0.519489 11* Junct 0.052 0.07 0.86 1.0 48 209 loop 1
-0.220739 -0.517801 19* Junct 0.187 0.23 1.05 1.2 48 91 high street
-0.220784 -0.516035 30* Junct 0.196 0.24 1.25 1.5 48 91 high street
-0.220311 -0.516015 31* Junct- 0.052 0.03 1.30 1.5 96 2 main 2
-0.219596 -0.515984 -3 Waypt 0.079 0.05 1.38 1.6 96 2 main 2
routino-3.0/src/test/expected/turns-WP11.txt 644 233 144 4573 12064636362 14215 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct 0.072 0.04 0.07 0.0 96 182 main 1
-0.219123 -0.520207 12* Junct 0.069 0.09 0.14 0.1 48 91 top road
-0.219131 -0.519426 20* Junct 0.086 0.11 0.23 0.2 48 90 top road
-0.219135 -0.518823 23* Junct 0.067 0.08 0.29 0.3 48 90 top road
-0.219145 -0.517626 33* Junct 0.133 0.17 0.43 0.5 48 90 top road
-0.219144 -0.517257 36* Junct 0.041 0.05 0.47 0.5 48 89 top road
-0.219291 -0.517193 38 Inter 0.017 0.02 0.48 0.6 48 156 roundabout
-0.219352 -0.517060 42 Junct- 0.016 0.02 0.50 0.6 48 114 roundabout
-0.219304 -0.516904 45 Inter 0.018 0.02 0.52 0.6 48 72 roundabout
-0.219153 -0.516826 46* Junct- 0.018 0.02 0.54 0.6 48 27 roundabout
-0.218966 -0.516910 44 Inter 0.022 0.03 0.56 0.6 48 335 roundabout
-0.218923 -0.517072 39 Junct- 0.018 0.02 0.58 0.7 48 284 roundabout
-0.218998 -0.517207 37 Inter 0.017 0.02 0.59 0.7 48 240 roundabout
-0.219144 -0.517257 36* Junct 0.017 0.02 0.61 0.7 48 199 roundabout
-0.219145 -0.517626 33* Junct 0.041 0.05 0.65 0.8 48 269 top road
-0.219135 -0.518823 23* Junct 0.133 0.17 0.79 0.9 48 270 top road
-0.219131 -0.519426 20* Junct 0.067 0.08 0.85 1.0 48 270 top road
-0.218482 -0.519542 18* Inter 0.073 0.09 0.93 1.1 48 349 loop 4
-0.218258 -0.519789 16 Inter 0.037 0.04 0.96 1.1 48 312 loop 4
-0.218474 -0.520060 14* Waypt 0.038 0.05 1.00 1.2 48 231 loop 4
-0.219123 -0.520207 12* Junct 0.074 0.09 1.07 1.3 48 192 loop 4
-0.219107 -0.520828 6* Junct 0.069 0.09 1.14 1.4 48 271 top road
-0.220666 -0.520893 5* Junct- 0.173 0.11 1.32 1.5 96 182 main 1
-0.221308 -0.520914 4* Junct- 0.071 0.04 1.39 1.5 96 181 main 1
-0.221561 -0.520922 -3 Waypt 0.027 0.02 1.41 1.5 96 181 main 1
routino-3.0/src/test/expected/roundabout-waypoints-WP06.txt 644 233 144 1571 12317763605 17260 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218454 -0.520798 -1 Waypt 0.000 0.00 0.00 0.0
-0.219482 -0.520837 9* Junct 0.113 0.07 0.11 0.1 96 182 main 1
-0.219692 -0.520509 15 Junct- 0.043 0.03 0.16 0.1 96 122 roundabout
-0.220082 -0.520522 14 Junct- 0.043 0.03 0.20 0.1 96 181 roundabout
-0.220171 -0.520685 -2 Waypt 0.020 0.01 0.22 0.1 96 241 roundabout
-0.220268 -0.520863 8* Junct 0.022 0.01 0.24 0.1 96 241 roundabout
-0.221566 -0.520921 -3 Waypt 0.143 0.09 0.38 0.2 96 182 main 2
routino-3.0/src/test/expected/turns-WP04.txt 644 233 144 3761 12064636362 14215 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct- 0.072 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 5* Junct 0.173 0.11 0.24 0.2 96 182 main 1
-0.220671 -0.520223 11* Junct 0.074 0.09 0.32 0.2 48 90 high street
-0.220691 -0.519461 19* Junct 0.084 0.10 0.40 0.3 48 91 high street
-0.220708 -0.518842 22* Junct 0.069 0.09 0.47 0.4 48 91 high street
-0.220724 -0.518071 31* Junct 0.085 0.10 0.56 0.5 48 91 high street
-0.220143 -0.518162 30 Inter 0.065 0.08 0.62 0.6 48 351 loop 2
-0.219850 -0.518416 27 Inter 0.043 0.05 0.67 0.7 48 319 loop 2
-0.220100 -0.518718 24* Inter 0.043 0.05 0.71 0.7 48 230 loop 2
-0.220206 -0.518739 -2 Waypt 0.012 0.01 0.72 0.7 48 191 loop 2
-0.220708 -0.518842 22* Junct 0.057 0.07 0.78 0.8 48 191 loop 2
-0.220724 -0.518071 31* Junct 0.085 0.10 0.86 0.9 48 91 high street
-0.220739 -0.517425 34* Junct 0.071 0.09 0.93 1.0 48 91 high street
-0.220760 -0.516647 48* Junct 0.086 0.11 1.02 1.1 48 91 high street
-0.220784 -0.516035 54* Junct 0.068 0.09 1.09 1.2 48 92 high street
-0.221431 -0.516056 53* Junct 0.072 0.04 1.16 1.2 96 181 main 2
-0.221376 -0.518235 29* Junct 0.242 0.30 1.40 1.5 48 271 bottom road
-0.221360 -0.518860 21* Junct 0.069 0.09 1.47 1.6 48 271 bottom road
-0.221308 -0.520914 4* Junct 0.228 0.28 1.70 1.9 48 271 bottom road
-0.221561 -0.520922 -3 Waypt 0.027 0.02 1.73 1.9 96 181 main 1
routino-3.0/src/test/expected/node-restrictions-WP06.txt 644 233 144 3410 12064636362 16506 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219564 -0.520846 -1 Waypt 0.000 0.00 0.00 0.0
-0.220666 -0.520893 4* Junct 0.122 0.07 0.12 0.1 96 182 main 1
-0.220682 -0.520141 9* Junct 0.083 0.08 0.20 0.2 64 91 high street
-0.220695 -0.519489 12* Change 0.072 0.07 0.28 0.2 64 91 high street
-0.220694 -0.519227 15 Inter 0.029 0.04 0.31 0.3 48 89 long road
-0.220386 -0.519076 16 Inter 0.038 0.05 0.34 0.3 48 26 long road
-0.220961 -0.518928 17 Inter 0.066 0.08 0.41 0.4 48 165 long road
-0.220427 -0.518622 18 Inter 0.068 0.09 0.48 0.5 48 29 long road
-0.220949 -0.518422 21 Inter 0.062 0.08 0.54 0.5 48 159 long road
-0.220455 -0.518238 22 Inter 0.058 0.07 0.60 0.6 48 20 long road
-0.220746 -0.518070 23 Inter 0.037 0.04 0.64 0.7 48 149 long road
-0.220739 -0.517801 26* Junct 0.029 0.04 0.66 0.7 48 88 long road
-0.220212 -0.517903 25 Inter 0.059 0.07 0.72 0.8 48 349 nopass road
-0.220176 -0.518543 -2 Waypt 0.070 0.09 0.79 0.9 48 273 nopass road
-0.220212 -0.517903 25 Inter 0.070 0.09 0.86 0.9 48 93 nopass road
-0.220739 -0.517801 26* Junct 0.059 0.07 0.92 1.0 48 169 nopass road
-0.220784 -0.516035 31* Junct 0.196 0.18 1.12 1.2 64 91 high street
-0.219593 -0.515985 -3 Waypt 0.132 0.08 1.25 1.3 96 2 main 2
routino-3.0/src/test/expected/turns-WP05.txt 644 233 144 3642 12064636362 14214 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct- 0.072 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 5* Junct 0.173 0.11 0.24 0.2 96 182 main 1
-0.220671 -0.520223 11* Junct 0.074 0.09 0.32 0.2 48 90 high street
-0.220691 -0.519461 19* Junct 0.084 0.10 0.40 0.3 48 91 high street
-0.220708 -0.518842 22* Junct 0.069 0.09 0.47 0.4 48 91 high street
-0.220724 -0.518071 31* Junct 0.085 0.10 0.56 0.5 48 91 high street
-0.220143 -0.518162 30 Inter 0.065 0.08 0.62 0.6 48 351 loop 2
-0.219850 -0.518416 27 Inter 0.043 0.05 0.67 0.7 48 319 loop 2
-0.220100 -0.518718 24* Waypt 0.043 0.05 0.71 0.7 48 230 loop 2
-0.220708 -0.518842 22* Junct 0.069 0.09 0.78 0.8 48 191 loop 2
-0.220724 -0.518071 31* Junct 0.085 0.10 0.86 0.9 48 91 high street
-0.220739 -0.517425 34* Junct 0.071 0.09 0.93 1.0 48 91 high street
-0.220760 -0.516647 48* Junct 0.086 0.11 1.02 1.1 48 91 high street
-0.220784 -0.516035 54* Junct 0.068 0.09 1.09 1.2 48 92 high street
-0.221431 -0.516056 53* Junct 0.072 0.04 1.16 1.2 96 181 main 2
-0.221376 -0.518235 29* Junct 0.242 0.30 1.40 1.5 48 271 bottom road
-0.221360 -0.518860 21* Junct 0.069 0.09 1.47 1.6 48 271 bottom road
-0.221308 -0.520914 4* Junct 0.228 0.28 1.70 1.9 48 271 bottom road
-0.221561 -0.520922 -3 Waypt 0.027 0.02 1.73 1.9 96 181 main 1
routino-3.0/src/test/expected/dead-ends-WP05.txt 644 233 144 2301 12154145517 14651 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219535 -0.521016 -1 Waypt 0.000 0.00 0.00 0.0
-0.220223 -0.521052 5* Junct- 0.076 0.05 0.08 0.0 96 182 main 1
-0.220666 -0.521060 4* Junct 0.049 0.03 0.12 0.1 96 180 main 1
-0.220702 -0.519478 12* Junct 0.176 0.22 0.30 0.3 48 91 high street
-0.220739 -0.517804 18* Junct 0.186 0.23 0.49 0.5 48 91 high street
-0.220296 -0.517634 20* Waypt 0.052 0.07 0.54 0.6 48 21 dead-end 2
-0.220739 -0.517804 18* Junct 0.052 0.07 0.59 0.7 48 201 dead-end 2
-0.220782 -0.516137 24* Junct 0.185 0.23 0.78 0.9 48 91 high street
-0.220817 -0.514062 32* Junct 0.230 0.29 1.01 1.2 48 90 high street
-0.220344 -0.514042 33* Junct- 0.052 0.03 1.06 1.2 96 2 main 2
-0.219539 -0.514007 -3 Waypt 0.089 0.06 1.15 1.3 96 2 main 2
routino-3.0/src/test/expected/dead-ends-WP02.txt 644 233 144 2551 12154145517 14655 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219535 -0.521016 -1 Waypt 0.000 0.00 0.00 0.0
-0.220223 -0.521052 5* Junct- 0.076 0.05 0.08 0.0 96 182 main 1
-0.220666 -0.521060 4* Junct 0.049 0.03 0.12 0.1 96 180 main 1
-0.220702 -0.519478 12* Junct 0.176 0.22 0.30 0.3 48 91 high street
-0.220263 -0.519309 13* Junct- 0.052 0.07 0.35 0.4 48 21 dead-end 1
-0.219924 -0.519179 14 Waypt 0.040 0.05 0.39 0.4 48 20 dead-end 1
-0.220263 -0.519309 13* Junct- 0.040 0.05 0.43 0.5 48 200 dead-end 1
-0.220702 -0.519478 12* Junct 0.052 0.07 0.48 0.5 48 201 dead-end 1
-0.220739 -0.517804 18* Junct 0.186 0.23 0.67 0.8 48 91 high street
-0.220782 -0.516137 24* Junct 0.185 0.23 0.86 1.0 48 91 high street
-0.220817 -0.514062 32* Junct 0.230 0.29 1.09 1.3 48 90 high street
-0.220344 -0.514042 33* Junct- 0.052 0.03 1.14 1.3 96 2 main 2
-0.219539 -0.514007 -3 Waypt 0.089 0.06 1.23 1.4 96 2 main 2
routino-3.0/src/test/expected/loops-WP04.txt 644 233 144 3456 12064636362 14177 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219562 -0.520851 -1 Waypt 0.000 0.00 0.00 0.0
-0.220223 -0.520885 5* Junct- 0.073 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 4* Junct 0.049 0.03 0.12 0.1 96 181 main 1
-0.220695 -0.519489 11* Junct 0.156 0.20 0.28 0.3 48 91 high street
-0.220280 -0.519256 15* Junct- 0.052 0.07 0.33 0.3 48 29 loop 1
-0.219910 -0.519112 17 Inter 0.044 0.06 0.37 0.4 48 21 loop 1
-0.219237 -0.519286 13* Junct 0.077 0.10 0.45 0.5 48 345 loop 1
-0.218997 -0.519053 -2 Waypt 0.037 0.04 0.49 0.5 48 44 loop 1
-0.218776 -0.518838 18 Inter 0.034 0.04 0.52 0.6 48 44 loop 1
-0.218380 -0.519134 16 Inter 0.055 0.07 0.58 0.6 48 323 loop 1
-0.218764 -0.519471 12 Inter 0.056 0.07 0.63 0.7 48 221 loop 1
-0.219237 -0.519286 13* Junct 0.056 0.07 0.69 0.8 48 158 loop 1
-0.219910 -0.519112 17 Inter 0.077 0.10 0.77 0.9 48 165 loop 1
-0.220280 -0.519256 15* Junct- 0.044 0.06 0.81 0.9 48 201 loop 1
-0.220695 -0.519489 11* Junct 0.052 0.07 0.86 1.0 48 209 loop 1
-0.220739 -0.517801 19* Junct 0.187 0.23 1.05 1.2 48 91 high street
-0.220784 -0.516035 30* Junct 0.196 0.24 1.25 1.5 48 91 high street
-0.220311 -0.516015 31* Junct- 0.052 0.03 1.30 1.5 96 2 main 2
-0.219596 -0.515984 -3 Waypt 0.079 0.05 1.38 1.6 96 2 main 2
routino-3.0/src/test/expected/turns-WP13.txt 644 233 144 6651 12064636362 14216 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct 0.072 0.04 0.07 0.0 96 182 main 1
-0.219123 -0.520207 12* Junct 0.069 0.09 0.14 0.1 48 91 top road
-0.219131 -0.519426 20* Junct 0.086 0.11 0.23 0.2 48 90 top road
-0.219135 -0.518823 23* Junct 0.067 0.08 0.29 0.3 48 90 top road
-0.219145 -0.517626 33* Junct 0.133 0.17 0.43 0.5 48 90 top road
-0.219144 -0.517257 36* Junct 0.041 0.05 0.47 0.5 48 89 top road
-0.219291 -0.517193 38 Inter 0.017 0.02 0.48 0.6 48 156 roundabout
-0.219352 -0.517060 42 Junct- 0.016 0.02 0.50 0.6 48 114 roundabout
-0.219304 -0.516904 45 Inter 0.018 0.02 0.52 0.6 48 72 roundabout
-0.219153 -0.516826 46* Junct- 0.018 0.02 0.54 0.6 48 27 roundabout
-0.218966 -0.516910 44 Inter 0.022 0.03 0.56 0.6 48 335 roundabout
-0.218923 -0.517072 39 Junct- 0.018 0.02 0.58 0.7 48 284 roundabout
-0.218998 -0.517207 37 Inter 0.017 0.02 0.59 0.7 48 240 roundabout
-0.219144 -0.517257 36* Junct 0.017 0.02 0.61 0.7 48 199 roundabout
-0.219145 -0.517626 33* Junct 0.041 0.05 0.65 0.8 48 269 top road
-0.218619 -0.517921 32* Inter 0.067 0.08 0.72 0.8 48 330 loop 5
-0.218431 -0.518243 28 Inter 0.041 0.05 0.76 0.9 48 300 loop 5
-0.218600 -0.518557 25* Inter 0.039 0.05 0.80 0.9 48 241 loop 5
-0.218691 -0.518602 -2 Waypt 0.011 0.01 0.81 1.0 48 206 loop 5
-0.219135 -0.518823 23* Junct 0.054 0.07 0.86 1.0 48 206 loop 5
-0.219145 -0.517626 33* Junct 0.133 0.17 1.00 1.2 48 90 top road
-0.219144 -0.517257 36* Junct 0.041 0.05 1.04 1.2 48 89 top road
-0.219291 -0.517193 38 Inter 0.017 0.02 1.05 1.3 48 156 roundabout
-0.219352 -0.517060 42 Junct- 0.016 0.02 1.07 1.3 48 114 roundabout
-0.219304 -0.516904 45 Inter 0.018 0.02 1.09 1.3 48 72 roundabout
-0.219153 -0.516826 46* Junct- 0.018 0.02 1.11 1.3 48 27 roundabout
-0.218966 -0.516910 44 Inter 0.022 0.03 1.13 1.3 48 335 roundabout
-0.218923 -0.517072 39 Junct- 0.018 0.02 1.15 1.4 48 284 roundabout
-0.218998 -0.517207 37 Inter 0.017 0.02 1.16 1.4 48 240 roundabout
-0.219144 -0.517257 36* Junct 0.017 0.02 1.18 1.4 48 199 roundabout
-0.219145 -0.517626 33* Junct 0.041 0.05 1.22 1.5 48 269 top road
-0.219135 -0.518823 23* Junct 0.133 0.17 1.35 1.6 48 270 top road
-0.219131 -0.519426 20* Junct 0.067 0.08 1.42 1.7 48 270 top road
-0.219123 -0.520207 12* Junct 0.086 0.11 1.51 1.8 48 270 top road
-0.219107 -0.520828 6* Junct 0.069 0.09 1.58 1.9 48 271 top road
-0.220666 -0.520893 5* Junct- 0.173 0.11 1.75 2.0 96 182 main 1
-0.221308 -0.520914 4* Junct- 0.071 0.04 1.82 2.0 96 181 main 1
-0.221561 -0.520922 -3 Waypt 0.027 0.02 1.85 2.1 96 181 main 1
routino-3.0/src/test/expected/roundabout-waypoints-WP02.txt 644 233 144 1571 12317763605 17254 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218454 -0.520798 -1 Waypt 0.000 0.00 0.00 0.0
-0.219482 -0.520837 9* Junct 0.113 0.07 0.11 0.1 96 182 main 1
-0.219577 -0.520689 -2 Waypt 0.019 0.01 0.13 0.1 96 122 roundabout
-0.219692 -0.520509 15 Junct- 0.023 0.01 0.15 0.1 96 122 roundabout
-0.220082 -0.520522 14 Junct- 0.043 0.03 0.20 0.1 96 181 roundabout
-0.220268 -0.520863 8* Junct 0.043 0.03 0.24 0.1 96 241 roundabout
-0.221566 -0.520921 -3 Waypt 0.143 0.09 0.38 0.2 96 182 main 2
routino-3.0/src/test/expected/dead-ends-WP04.txt 644 233 144 3265 12154145517 14662 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219535 -0.521016 -1 Waypt 0.000 0.00 0.00 0.0
-0.220223 -0.521052 5* Junct- 0.076 0.05 0.08 0.0 96 182 main 1
-0.220666 -0.521060 4* Junct 0.049 0.03 0.12 0.1 96 180 main 1
-0.220702 -0.519478 12* Junct 0.176 0.22 0.30 0.3 48 91 high street
-0.220263 -0.519309 13* Junct- 0.052 0.07 0.35 0.4 48 21 dead-end 1
-0.219924 -0.519179 14 Inter 0.040 0.05 0.39 0.4 48 20 dead-end 1
-0.219235 -0.519555 11 Inter 0.087 0.11 0.48 0.5 48 331 dead-end 1
-0.218387 -0.519137 15 Waypt 0.105 0.13 0.58 0.7 48 26 dead-end 1
-0.219235 -0.519555 11 Inter 0.105 0.13 0.69 0.8 48 206 dead-end 1
-0.219924 -0.519179 14 Inter 0.087 0.11 0.78 0.9 48 151 dead-end 1
-0.220263 -0.519309 13* Junct- 0.040 0.05 0.82 0.9 48 200 dead-end 1
-0.220702 -0.519478 12* Junct 0.052 0.07 0.87 1.0 48 201 dead-end 1
-0.220739 -0.517804 18* Junct 0.186 0.23 1.05 1.2 48 91 high street
-0.220782 -0.516137 24* Junct 0.185 0.23 1.24 1.5 48 91 high street
-0.220817 -0.514062 32* Junct 0.230 0.29 1.47 1.8 48 90 high street
-0.220344 -0.514042 33* Junct- 0.052 0.03 1.52 1.8 96 2 main 2
-0.219539 -0.514007 -3 Waypt 0.089 0.06 1.61 1.8 96 2 main 2
routino-3.0/src/test/expected/dead-ends-WP08.txt 644 233 144 2301 12154146045 14651 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219535 -0.521016 -1 Waypt 0.000 0.00 0.00 0.0
-0.220223 -0.521052 5* Junct- 0.076 0.05 0.08 0.0 96 182 main 1
-0.220666 -0.521060 4* Junct 0.049 0.03 0.12 0.1 96 180 main 1
-0.220702 -0.519478 12* Junct 0.176 0.22 0.30 0.3 48 91 high street
-0.220739 -0.517804 18* Junct 0.186 0.23 0.49 0.5 48 91 high street
-0.220782 -0.516137 24* Junct 0.185 0.23 0.67 0.8 48 91 high street
-0.220361 -0.515961 25* Waypt 0.050 0.06 0.72 0.8 48 22 dead-end 3
-0.220782 -0.516137 24* Junct 0.050 0.06 0.77 0.9 48 202 dead-end 3
-0.220817 -0.514062 32* Junct 0.230 0.29 1.00 1.2 48 90 high street
-0.220344 -0.514042 33* Junct- 0.052 0.03 1.05 1.2 96 2 main 2
-0.219539 -0.514007 -3 Waypt 0.089 0.06 1.14 1.3 96 2 main 2
routino-3.0/src/test/expected/roundabout-waypoints-WP03.txt 644 233 144 1445 12317763605 17255 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218454 -0.520798 -1 Waypt 0.000 0.00 0.00 0.0
-0.219482 -0.520837 9* Junct 0.113 0.07 0.11 0.1 96 182 main 1
-0.219692 -0.520509 15 Waypt 0.043 0.03 0.16 0.1 96 122 roundabout
-0.220082 -0.520522 14 Junct- 0.043 0.03 0.20 0.1 96 181 roundabout
-0.220268 -0.520863 8* Junct 0.043 0.03 0.24 0.1 96 241 roundabout
-0.221566 -0.520921 -3 Waypt 0.143 0.09 0.39 0.2 96 182 main 2
routino-3.0/src/test/expected/super-or-not-WP03.txt 644 233 144 1206 12064636362 15403 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.217245 -0.519637 2* Waypt 0.000 0.00 0.00 0.0
-0.215919 -0.519064 3 Inter 0.160 0.20 0.16 0.2 48 23 Local road
-0.216435 -0.518515 4 Inter 0.083 0.10 0.24 0.3 48 133 Local road
-0.215866 -0.517931 5 Waypt 0.090 0.11 0.33 0.4 48 45 Local road
routino-3.0/src/test/expected/dead-ends-WP07.txt 644 233 144 3017 12154145517 14660 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219535 -0.521016 -1 Waypt 0.000 0.00 0.00 0.0
-0.220223 -0.521052 5* Junct- 0.076 0.05 0.08 0.0 96 182 main 1
-0.220666 -0.521060 4* Junct 0.049 0.03 0.12 0.1 96 180 main 1
-0.220702 -0.519478 12* Junct 0.176 0.22 0.30 0.3 48 91 high street
-0.220739 -0.517804 18* Junct 0.186 0.23 0.49 0.5 48 91 high street
-0.220296 -0.517634 20* Junct- 0.052 0.07 0.54 0.6 48 21 dead-end 2
-0.219991 -0.517512 21 Inter 0.036 0.04 0.57 0.6 48 21 dead-end 2
-0.219635 -0.517707 -2 Waypt 0.045 0.06 0.62 0.7 48 331 dead-end 2
-0.219991 -0.517512 21 Inter 0.045 0.06 0.67 0.7 48 151 dead-end 2
-0.220296 -0.517634 20* Junct- 0.036 0.04 0.70 0.8 48 201 dead-end 2
-0.220739 -0.517804 18* Junct 0.052 0.07 0.75 0.9 48 201 dead-end 2
-0.220782 -0.516137 24* Junct 0.185 0.23 0.94 1.1 48 91 high street
-0.220817 -0.514062 32* Junct 0.230 0.29 1.17 1.4 48 90 high street
-0.220344 -0.514042 33* Junct- 0.052 0.03 1.22 1.4 96 2 main 2
-0.219539 -0.514007 -3 Waypt 0.089 0.06 1.31 1.5 96 2 main 2
routino-3.0/src/test/expected/turns-WP09.txt 644 233 144 4461 12064636362 14220 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct 0.072 0.04 0.07 0.0 96 182 main 1
-0.219123 -0.520207 12* Junct 0.069 0.09 0.14 0.1 48 91 top road
-0.219131 -0.519426 20* Junct 0.086 0.11 0.23 0.2 48 90 top road
-0.219135 -0.518823 23* Junct 0.067 0.08 0.29 0.3 48 90 top road
-0.219145 -0.517626 33* Junct 0.133 0.17 0.43 0.5 48 90 top road
-0.219144 -0.517257 36* Junct 0.041 0.05 0.47 0.5 48 89 top road
-0.219291 -0.517193 38 Inter 0.017 0.02 0.48 0.6 48 156 roundabout
-0.219352 -0.517060 42 Junct- 0.016 0.02 0.50 0.6 48 114 roundabout
-0.219304 -0.516904 45 Inter 0.018 0.02 0.52 0.6 48 72 roundabout
-0.219153 -0.516826 46* Junct 0.018 0.02 0.54 0.6 48 27 roundabout
-0.219184 -0.515968 55* Junct 0.095 0.12 0.63 0.7 48 92 top road
-0.220784 -0.516035 54* Junct 0.178 0.11 0.81 0.8 96 182 main 2
-0.220760 -0.516647 48* Junct 0.068 0.09 0.88 0.9 48 272 high street
-0.220097 -0.516762 47* Inter 0.074 0.09 0.95 1.0 48 350 loop 3
-0.219872 -0.517009 43 Waypt 0.037 0.04 0.99 1.1 48 312 loop 3
-0.220089 -0.517279 35* Inter 0.038 0.05 1.03 1.1 48 231 loop 3
-0.220739 -0.517425 34* Junct 0.074 0.09 1.10 1.2 48 192 loop 3
-0.220724 -0.518071 31* Junct 0.071 0.09 1.17 1.3 48 271 high street
-0.220708 -0.518842 22* Junct 0.085 0.10 1.26 1.4 48 271 high street
-0.220691 -0.519461 19* Junct 0.069 0.09 1.33 1.5 48 271 high street
-0.220671 -0.520223 11* Junct 0.084 0.10 1.41 1.6 48 271 high street
-0.220666 -0.520893 5* Junct 0.074 0.09 1.48 1.7 48 270 high street
-0.221308 -0.520914 4* Junct- 0.071 0.04 1.55 1.7 96 181 main 1
-0.221561 -0.520922 -3 Waypt 0.027 0.02 1.58 1.7 96 181 main 1
routino-3.0/src/test/expected/dead-ends-WP06.txt 644 233 144 2551 12154145517 14661 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219535 -0.521016 -1 Waypt 0.000 0.00 0.00 0.0
-0.220223 -0.521052 5* Junct- 0.076 0.05 0.08 0.0 96 182 main 1
-0.220666 -0.521060 4* Junct 0.049 0.03 0.12 0.1 96 180 main 1
-0.220702 -0.519478 12* Junct 0.176 0.22 0.30 0.3 48 91 high street
-0.220739 -0.517804 18* Junct 0.186 0.23 0.49 0.5 48 91 high street
-0.220296 -0.517634 20* Junct- 0.052 0.07 0.54 0.6 48 21 dead-end 2
-0.219991 -0.517512 21 Waypt 0.036 0.04 0.57 0.6 48 21 dead-end 2
-0.220296 -0.517634 20* Junct- 0.036 0.04 0.61 0.7 48 201 dead-end 2
-0.220739 -0.517804 18* Junct 0.052 0.07 0.66 0.7 48 201 dead-end 2
-0.220782 -0.516137 24* Junct 0.185 0.23 0.85 1.0 48 91 high street
-0.220817 -0.514062 32* Junct 0.230 0.29 1.08 1.3 48 90 high street
-0.220344 -0.514042 33* Junct- 0.052 0.03 1.13 1.3 96 2 main 2
-0.219539 -0.514007 -3 Waypt 0.089 0.06 1.22 1.4 96 2 main 2
routino-3.0/src/test/expected/roundabout-waypoints-WP05.txt 644 233 144 1445 12317763605 17257 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218454 -0.520798 -1 Waypt 0.000 0.00 0.00 0.0
-0.219482 -0.520837 9* Junct 0.113 0.07 0.11 0.1 96 182 main 1
-0.219692 -0.520509 15 Junct- 0.043 0.03 0.16 0.1 96 122 roundabout
-0.220082 -0.520522 14 Waypt 0.043 0.03 0.20 0.1 96 181 roundabout
-0.220268 -0.520863 8* Junct 0.043 0.03 0.24 0.1 96 241 roundabout
-0.221566 -0.520921 -3 Waypt 0.143 0.09 0.39 0.2 96 182 main 2
routino-3.0/src/test/expected/turns-WP03.txt 644 233 144 2403 12064636362 14204 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct- 0.072 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 5* Junct 0.173 0.11 0.24 0.2 96 182 main 1
-0.220671 -0.520223 11* Junct 0.074 0.09 0.32 0.2 48 90 high street
-0.220691 -0.519461 19* Junct 0.084 0.10 0.40 0.3 48 91 high street
-0.220111 -0.519553 17 Inter 0.065 0.08 0.47 0.4 48 351 loop 1
-0.219817 -0.519807 15 Waypt 0.043 0.05 0.51 0.5 48 319 loop 1
-0.220067 -0.520109 13* Inter 0.043 0.05 0.55 0.5 48 230 loop 1
-0.220671 -0.520223 11* Junct 0.068 0.09 0.62 0.6 48 190 loop 1
-0.220666 -0.520893 5* Junct 0.074 0.09 0.70 0.7 48 270 high street
-0.221308 -0.520914 4* Junct- 0.071 0.04 0.77 0.8 96 181 main 1
-0.221561 -0.520922 -3 Waypt 0.027 0.02 0.79 0.8 96 181 main 1
routino-3.0/src/test/invalid-turn-relations.sh 777 233 144 0 12064636362 17332 2only-split.sh routino-3.0/src/test/roundabout-waypoints.osm 644 233 144 10276 12327506431 14757 0
routino-3.0/src/test/roundabout-waypoints.sh 777 233 144 0 12317323573 17572 2start-1-finish.sh routino-3.0/src/test/turns.sh 777 233 144 0 12064636362 14532 2start-1-finish.sh routino-3.0/src/test/fake-node-with-loop.sh 777 233 144 0 12326742550 15234 2a-b-c.sh routino-3.0/src/test/no-super.osm 644 233 144 11616 12064636362 12316 0
routino-3.0/src/test/turns.osm 644 233 144 43517 12064636362 11726 0
routino-3.0/src/types.c 644 233 144 32536 12563633052 10360 0 /***************************************
Functions for handling the data types.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2008-2015 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#include
#include "types.h"
/*++++++++++++++++++++++++++++++++++++++
Decide on the type of a way given the "highway" parameter.
Highway HighwayType Returns the highway type of the way.
const char *highway The string containing the type of the way.
++++++++++++++++++++++++++++++++++++++*/
Highway HighwayType(const char *highway)
{
switch(*highway)
{
case 'c':
if(!strcmp(highway,"cycleway")) return(Highway_Cycleway);
break;
case 'f':
if(!strcmp(highway,"ferry")) return(Highway_Ferry);
break;
case 'm':
if(!strcmp(highway,"motorway")) return(Highway_Motorway);
break;
case 'p':
if(!strcmp(highway,"primary")) return(Highway_Primary);
if(!strcmp(highway,"path")) return(Highway_Path);
break;
case 'r':
if(!strcmp(highway,"residential")) return(Highway_Residential);
break;
case 's':
if(!strcmp(highway,"secondary")) return(Highway_Secondary);
if(!strcmp(highway,"service")) return(Highway_Service);
if(!strcmp(highway,"steps")) return(Highway_Steps);
break;
case 't':
if(!strcmp(highway,"trunk")) return(Highway_Trunk);
if(!strcmp(highway,"tertiary")) return(Highway_Tertiary);
if(!strcmp(highway,"track")) return(Highway_Track);
break;
case 'u':
if(!strcmp(highway,"unclassified")) return(Highway_Unclassified);
break;
default:
;
}
return(Highway_None);
}
/*++++++++++++++++++++++++++++++++++++++
Decide on the type of transport given the name of it.
Transport TransportType Returns the type of the transport.
const char *transport The string containing the method of transport.
++++++++++++++++++++++++++++++++++++++*/
Transport TransportType(const char *transport)
{
switch(*transport)
{
case 'b':
if(!strcmp(transport,"bicycle"))
return(Transport_Bicycle);
break;
case 'f':
if(!strcmp(transport,"foot"))
return(Transport_Foot);
break;
case 'g':
if(!strcmp(transport,"goods"))
return(Transport_Goods);
break;
case 'h':
if(!strcmp(transport,"horse"))
return(Transport_Horse);
if(!strcmp(transport,"hgv"))
return(Transport_HGV);
break;
case 'm':
if(!strcmp(transport,"moped"))
return(Transport_Moped);
if(!strcmp(transport,"motorcycle"))
return(Transport_Motorcycle);
if(!strcmp(transport,"motorcar"))
return(Transport_Motorcar);
break;
case 'p':
if(!strcmp(transport,"psv"))
return(Transport_PSV);
break;
case 'w':
if(!strcmp(transport,"wheelchair"))
return(Transport_Wheelchair);
break;
default:
return(Transport_None);
}
return(Transport_None);
}
/*++++++++++++++++++++++++++++++++++++++
Decide on the type of property given the name of it.
Property PropertyType Returns the type of the property.
const char *property The string containing the method of property.
++++++++++++++++++++++++++++++++++++++*/
Property PropertyType(const char *property)
{
switch(*property)
{
case 'b':
if(!strcmp(property,"bicycleroute"))
return(Property_BicycleRoute);
if(!strcmp(property,"bridge"))
return(Property_Bridge);
break;
case 'f':
if(!strcmp(property,"footroute"))
return(Property_FootRoute);
break;
case 'm':
if(!strcmp(property,"multilane"))
return(Property_Multilane);
break;
case 'p':
if(!strcmp(property,"paved"))
return(Property_Paved);
break;
case 't':
if(!strcmp(property,"tunnel"))
return(Property_Tunnel);
break;
default:
return(Property_None);
}
return(Property_None);
}
/*++++++++++++++++++++++++++++++++++++++
A string containing the name of a type of highway.
const char *HighwayName Returns the name.
Highway highway The highway type.
++++++++++++++++++++++++++++++++++++++*/
const char *HighwayName(Highway highway)
{
switch(highway)
{
case Highway_None:
return("NONE");
case Highway_Motorway:
return("motorway");
case Highway_Trunk:
return("trunk");
case Highway_Primary:
return("primary");
case Highway_Secondary:
return("secondary");
case Highway_Tertiary:
return("tertiary");
case Highway_Unclassified:
return("unclassified");
case Highway_Residential:
return("residential");
case Highway_Service:
return("service");
case Highway_Track:
return("track");
case Highway_Cycleway:
return("cycleway");
case Highway_Path:
return("path");
case Highway_Steps:
return("steps");
case Highway_Ferry:
return("ferry");
case Highway_Count:
;
case Highway_CycleBothWays:
;
case Highway_OneWay:
;
case Highway_Roundabout:
;
case Highway_Area:
;
}
return(NULL);
}
/*++++++++++++++++++++++++++++++++++++++
A string containing the name of a type of transport.
const char *TransportName Returns the name.
Transport transport The transport type.
++++++++++++++++++++++++++++++++++++++*/
const char *TransportName(Transport transport)
{
switch(transport)
{
case Transport_None:
return("NONE");
case Transport_Foot:
return("foot");
case Transport_Horse:
return("horse");
case Transport_Wheelchair:
return("wheelchair");
case Transport_Bicycle:
return("bicycle");
case Transport_Moped:
return("moped");
case Transport_Motorcycle:
return("motorcycle");
case Transport_Motorcar:
return("motorcar");
case Transport_Goods:
return("goods");
case Transport_HGV:
return("hgv");
case Transport_PSV:
return("psv");
case Transport_Count:
;
}
return(NULL);
}
/*++++++++++++++++++++++++++++++++++++++
A string containing the name of a highway property.
const char *PropertyName Returns the name.
Property property The property type.
++++++++++++++++++++++++++++++++++++++*/
const char *PropertyName(Property property)
{
switch(property)
{
case Property_None:
return("NONE");
case Property_Paved:
return("paved");
case Property_Multilane:
return("multilane");
case Property_Bridge:
return("bridge");
case Property_Tunnel:
return("tunnel");
case Property_FootRoute:
return("footroute");
case Property_BicycleRoute:
return("bicycleroute");
case Property_Count:
;
}
return(NULL);
}
/*++++++++++++++++++++++++++++++++++++++
A string containing the names of highways.
const char *HighwaysNameList Returns the list of names.
highways_t highways The highways type.
++++++++++++++++++++++++++++++++++++++*/
const char *HighwaysNameList(highways_t highways)
{
static char string[256]; /* static allocation of return value (set each call) */
string[0]=0;
if(highways & Highways_Motorway)
strcat(string,"motorway");
if(highways & Highways_Trunk)
{
if(*string) strcat(string,", ");
strcat(string,"trunk");
}
if(highways & Highways_Primary)
{
if(*string) strcat(string,", ");
strcat(string,"primary");
}
if(highways & Highways_Tertiary)
{
if(*string) strcat(string,", ");
strcat(string,"tertiary");
}
if(highways & Highways_Unclassified)
{
if(*string) strcat(string,", ");
strcat(string,"unclassified");
}
if(highways & Highways_Residential)
{
if(*string) strcat(string,", ");
strcat(string,"residential");
}
if(highways & Highways_Service)
{
if(*string) strcat(string,", ");
strcat(string,"service");
}
if(highways & Highways_Track)
{
if(*string) strcat(string,", ");
strcat(string,"track");
}
if(highways & Highways_Cycleway)
{
if(*string) strcat(string,", ");
strcat(string,"cycleway");
}
if(highways & Highways_Path)
{
if(*string) strcat(string,", ");
strcat(string,"path");
}
if(highways & Highways_Steps)
{
if(*string) strcat(string,", ");
strcat(string,"steps");
}
if(highways & Highways_Ferry)
{
if(*string) strcat(string,", ");
strcat(string,"ferry");
}
return(string);
}
/*++++++++++++++++++++++++++++++++++++++
A string containing the names of allowed transports on a way.
const char *AllowedNameList Returns the list of names.
transports_t allowed The allowed type.
++++++++++++++++++++++++++++++++++++++*/
const char *AllowedNameList(transports_t allowed)
{
static char string[256]; /* static allocation of return value (set each call) */
string[0]=0;
if(allowed & Transports_Foot)
strcat(string,"foot");
if(allowed & Transports_Horse)
{
if(*string) strcat(string,", ");
strcat(string,"horse");
}
if(allowed & Transports_Wheelchair)
{
if(*string) strcat(string,", ");
strcat(string,"wheelchair");
}
if(allowed & Transports_Bicycle)
{
if(*string) strcat(string,", ");
strcat(string,"bicycle");
}
if(allowed & Transports_Moped)
{
if(*string) strcat(string,", ");
strcat(string,"moped");
}
if(allowed & Transports_Motorcycle)
{
if(*string) strcat(string,", ");
strcat(string,"motorcycle");
}
if(allowed & Transports_Motorcar)
{
if(*string) strcat(string,", ");
strcat(string,"motorcar");
}
if(allowed & Transports_Goods)
{
if(*string) strcat(string,", ");
strcat(string,"goods");
}
if(allowed & Transports_HGV)
{
if(*string) strcat(string,", ");
strcat(string,"hgv");
}
if(allowed & Transports_PSV)
{
if(*string) strcat(string,", ");
strcat(string,"psv");
}
return(string);
}
/*++++++++++++++++++++++++++++++++++++++
A string containing the names of the properties of a way.
const char *PropertiesNameList Returns the list of names.
properties_t properties The properties of the way.
++++++++++++++++++++++++++++++++++++++*/
const char *PropertiesNameList(properties_t properties)
{
static char string[256]; /* static allocation of return value (set each call) */
string[0]=0;
if(properties & Properties_Paved)
{
if(*string) strcat(string,", ");
strcat(string,"paved");
}
if(properties & Properties_Multilane)
{
if(*string) strcat(string,", ");
strcat(string,"multilane");
}
if(properties & Properties_Bridge)
{
if(*string) strcat(string,", ");
strcat(string,"bridge");
}
if(properties & Properties_Tunnel)
{
if(*string) strcat(string,", ");
strcat(string,"tunnel");
}
if(properties & Properties_FootRoute)
{
if(*string) strcat(string,", ");
strcat(string,"footroute");
}
if(properties & Properties_BicycleRoute)
{
if(*string) strcat(string,", ");
strcat(string,"bicycleroute");
}
return(string);
}
/*++++++++++++++++++++++++++++++++++++++
Returns a list of all the highway types.
const char *HighwayList Return a list of all the highway types.
++++++++++++++++++++++++++++++++++++++*/
const char *HighwayList(void)
{
return " motorway = Motorway\n"
" trunk = Trunk\n"
" primary = Primary\n"
" secondary = Secondary\n"
" tertiary = Tertiary\n"
" unclassified = Unclassified\n"
" residential = Residential\n"
" service = Service\n"
" track = Track\n"
" cycleway = Cycleway\n"
" path = Path\n"
" steps = Steps\n"
" ferry = Ferry\n"
;
}
/*++++++++++++++++++++++++++++++++++++++
Returns a list of all the transport types.
const char *TransportList Return a list of all the transport types.
++++++++++++++++++++++++++++++++++++++*/
const char *TransportList(void)
{
return " foot = Foot\n"
" bicycle = Bicycle\n"
" wheelchair = Wheelchair\n"
" horse = Horse\n"
" moped = Moped (Small motorcycle, limited speed)\n"
" motorcycle = Motorcycle\n"
" motorcar = Motorcar\n"
" goods = Goods (Small lorry, van)\n"
" hgv = HGV (Heavy Goods Vehicle - large lorry)\n"
" psv = PSV (Public Service Vehicle - bus, coach)\n"
;
}
/*++++++++++++++++++++++++++++++++++++++
Returns a list of all the property types.
const char *PropertyList Return a list of all the highway proprties.
++++++++++++++++++++++++++++++++++++++*/
const char *PropertyList(void)
{
return " paved = Paved (suitable for normal wheels)\n"
" multilane = Multiple lanes\n"
" bridge = Bridge\n"
" tunnel = Tunnel\n"
" footroute = A route marked for foot travel\n"
" bicycleroute = A route marked for bicycle travel\n"
;
}
routino-3.0/src/files.h 644 233 144 11413 12563634111 10307 0 /***************************************
Header file for file function prototypes
Part of the Routino routing software.
******************/ /******************
This file Copyright 2008-2015 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#ifndef FILES_H
#define FILES_H /*+ To stop multiple inclusions. +*/
/* If your system does not have the pread() and pwrite() system calls then you
* will need to change this line to the value 0 so that seek() and
* read()/write() are used instead of pread()/pwrite(). */
#if defined(_MSC_VER) || defined(__MINGW32__)
#define HAVE_PREAD_PWRITE 0
#else
#define HAVE_PREAD_PWRITE 1
#endif
#if defined(_MSC_VER)
#include
#include
#define read(fd,address,length) _read(fd,address,(unsigned int)(length))
#define write(fd,address,length) _write(fd,address,(unsigned int)(length))
#define ssize_t SSIZE_T
#else
#include
#endif
#if defined(_MSC_VER) || defined(__MINGW32__)
#undef lseek
#define lseek _lseeki64
#endif
#include
#include
#include "logging.h"
/* Types */
/*+ A 64-bit file offset since a 32-bit off_t (which is signed) is smaller than a
32-bit size_t (which is unsigned) that can be writtento or read from a file. +*/
typedef int64_t offset_t;
/* Functions in files.c */
char *FileName(const char *dirname,const char *prefix, const char *name);
void *MapFile(const char *filename);
void *MapFileWriteable(const char *filename);
void *UnmapFile(const void *address);
int SlimMapFile(const char *filename);
int SlimMapFileWriteable(const char *filename);
int SlimUnmapFile(int fd);
int OpenFileBufferedNew(const char *filename);
int OpenFileBufferedAppend(const char *filename);
int ReOpenFileBuffered(const char *filename);
int ReplaceFileBuffered(const char *filename,int *oldfd);
int WriteFileBuffered(int fd,const void *address,size_t length);
int ReadFileBuffered(int fd,void *address,size_t length);
int SeekFileBuffered(int fd,offset_t position);
int SkipFileBuffered(int fd,offset_t skip);
int CloseFileBuffered(int fd);
int OpenFile(const char *filename);
void CloseFile(int fd);
offset_t SizeFile(const char *filename);
offset_t SizeFileFD(int fd);
int ExistsFile(const char *filename);
int DeleteFile(const char *filename);
int RenameFile(const char *oldfilename,const char *newfilename);
/* Functions in files.h */
static inline int SlimReplace(int fd,const void *address,size_t length,offset_t position);
static inline int SlimFetch(int fd,void *address,size_t length,offset_t position);
/* Inline the frequently called functions */
/*++++++++++++++++++++++++++++++++++++++
Write data to a file that has been opened for slim mode access.
int SlimReplace Returns 0 if OK or something else in case of an error.
int fd The file descriptor to write to.
const void *address The address of the data to be written.
size_t length The length of data to write.
offset_t position The position in the file to seek to.
++++++++++++++++++++++++++++++++++++++*/
static inline int SlimReplace(int fd,const void *address,size_t length,offset_t position)
{
/* Seek and write the data */
#if HAVE_PREAD_PWRITE
if(pwrite(fd,address,length,position)!=(ssize_t)length)
return(-1);
#else
if(lseek(fd,position,SEEK_SET)!=position)
return(-1);
if(write(fd,address,length)!=(ssize_t)length)
return(-1);
#endif
return(0);
}
/*++++++++++++++++++++++++++++++++++++++
Read data from a file that has been opened for slim mode access.
int SlimFetch Returns 0 if OK or something else in case of an error.
int fd The file descriptor to read from.
void *address The address the data is to be read into.
size_t length The length of data to read.
offset_t position The position in the file to seek to.
++++++++++++++++++++++++++++++++++++++*/
static inline int SlimFetch(int fd,void *address,size_t length,offset_t position)
{
/* Seek and read the data */
#if HAVE_PREAD_PWRITE
if(pread(fd,address,length,position)!=(ssize_t)length)
return(-1);
#else
if(lseek(fd,position,SEEK_SET)!=position)
return(-1);
if(read(fd,address,length)!=(ssize_t)length)
return(-1);
#endif
return(0);
}
#endif /* FILES_H */
routino-3.0/src/fakes.h 644 233 144 3742 12563633051 10266 0 /***************************************
Header file for fake node and segment function prototypes
Part of the Routino routing software.
******************/ /******************
This file Copyright 2008-2015 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#ifndef FAKES_H
#define FAKES_H /*+ To stop multiple inclusions. +*/
#include "types.h"
/* Macros */
/*+ Return true if this is a fake node. +*/
#define IsFakeNode(xxx) ((xxx)>=NODE_FAKE && (xxx)!=NO_NODE)
/*+ Return true if this is a fake segment. +*/
#define IsFakeSegment(xxx) ((xxx)>=SEGMENT_FAKE && (xxx)!=NO_SEGMENT)
/* Functions in fakes.c */
index_t CreateFakes(Nodes *nodes,Segments *segments,int point,Segment *segmentp,index_t node1,index_t node2,distance_t dist1,distance_t dist2);
index_t CreateFakeNullSegment(Segments *segments,index_t node,index_t segment,int point);
void DeleteFakeNodes(void);
void GetFakeLatLong(index_t fakenode, double *latitude,double *longitude);
Segment *FirstFakeSegment(index_t fakenode);
Segment *NextFakeSegment(Segment *fakesegmentp,index_t fakenode);
Segment *ExtraFakeSegment(index_t realnode,index_t fakenode);
Segment *LookupFakeSegment(index_t index);
index_t IndexFakeSegment(Segment *fakesegmentp);
index_t IndexRealSegment(index_t fakesegment);
int IsFakeUTurn(index_t fakesegment1,index_t fakesegment2);
#endif /* FAKES_H */
routino-3.0/src/fakes.c 644 233 144 27550 12563633051 10304 0 /***************************************
Fake node and segment generation.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2008-2015 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#include "types.h"
#include "nodes.h"
#include "segments.h"
#include "fakes.h"
/*+ The minimum distance along a segment from a node to insert a fake node. (in km). +*/
#define MINSEGMENT 0.005
/* Local variables (re-initialised by DeleteFakeNodes() function) */
/*+ A set of fake segments to allow start/finish in the middle of a segment. +*/
static Segment fake_segments[4*NWAYPOINTS+1];
/*+ A set of pointers to the real segments underlying the fake segments. +*/
static index_t real_segments[4*NWAYPOINTS+1];
/*+ A set of fake node latitudes and longitudes. +*/
static double fake_lon[NWAYPOINTS+1],fake_lat[NWAYPOINTS+1];
/*+ The previous waypoint. +*/
static int prevpoint=0;
/*++++++++++++++++++++++++++++++++++++++
Create a pair of fake segments corresponding to the given segment split in two
(and will create an extra two fake segments if adjacent waypoints are on the
same segment).
index_t CreateFakes Returns the fake node index (or a real one in special cases).
Nodes *nodes The set of nodes to use.
Segments *segments The set of segments to use.
int point Which of the waypoints this is.
Segment *segmentp The segment to split.
index_t node1 The first node at the end of this segment.
index_t node2 The second node at the end of this segment.
distance_t dist1 The distance to the first node.
distance_t dist2 The distance to the second node.
++++++++++++++++++++++++++++++++++++++*/
index_t CreateFakes(Nodes *nodes,Segments *segments,int point,Segment *segmentp,index_t node1,index_t node2,distance_t dist1,distance_t dist2)
{
index_t fakenode;
double lat1,lon1,lat2,lon2;
/* Initialise all the connecting segments to fake values */
fake_segments[4*point-4].node1=NO_NODE;
fake_segments[4*point-4].node2=NO_NODE;
fake_segments[4*point-3].node1=NO_NODE;
fake_segments[4*point-3].node2=NO_NODE;
fake_segments[4*point-2].node1=NO_NODE;
fake_segments[4*point-2].node2=NO_NODE;
fake_segments[4*point-1].node1=NO_NODE;
fake_segments[4*point-1].node2=NO_NODE;
/* Check if we are actually close enough to an existing node */
if(dist1<=km_to_distance(MINSEGMENT) && dist2>km_to_distance(MINSEGMENT))
{
prevpoint=point;
return(node1);
}
if(dist2<=km_to_distance(MINSEGMENT) && dist1>km_to_distance(MINSEGMENT))
{
prevpoint=point;
return(node2);
}
if(dist1<=km_to_distance(MINSEGMENT) && dist2<=km_to_distance(MINSEGMENT))
{
prevpoint=point;
if(dist13 && lat2<-3)
lat2+=2*M_PI;
else if(lat1<-3 && lat2>3)
lat1+=2*M_PI;
fake_lat[point]=lat1+(lat2-lat1)*(double)dist1/(double)(dist1+dist2); /* (dist1+dist2) must be > 0 */
fake_lon[point]=lon1+(lon2-lon1)*(double)dist1/(double)(dist1+dist2); /* (dist1+dist2) must be > 0 */
if(fake_lat[point]>M_PI) fake_lat[point]-=2*M_PI;
/*
* node1 fakenode node2
* #----------*----------------------------# real_segments[4*point-{4,3}]
*
* #----------* fake_segments[4*point-4]
* *----------------------------# fake_segments[4*point-3]
*
*
* node1 fakenode[prevpoint] node2
* #----------*------------------%---------# real_segments[4*prevpoint-{4,3,1}], real_segments[4*point-{4,3,2}]
* fakenode[point]
* #----------* fake_segments[4*prevpoint-4]
* *----------------------------# fake_segments[4*prevpoint-3]
* *------------------% fake_segments[4*prevpoint-1]
* #-----------------------------% fake_segments[4*point-4]
* %---------# fake_segments[4*point-3]
* *------------------% fake_segments[4*point-2]
*/
/* Create the first fake segment */
fake_segments[4*point-4]=*segmentp;
fake_segments[4*point-4].node2=fakenode;
fake_segments[4*point-4].distance=DISTANCE(dist1)|DISTFLAG(segmentp->distance);
real_segments[4*point-4]=IndexSegment(segments,segmentp);
/* Create the second fake segment */
fake_segments[4*point-3]=*segmentp;
fake_segments[4*point-3].node1=fakenode;
fake_segments[4*point-3].distance=DISTANCE(dist2)|DISTFLAG(segmentp->distance);
real_segments[4*point-3]=IndexSegment(segments,segmentp);
/* Create a third fake segment to join adjacent points if both are fake and on the same real segment */
if(prevpoint>0 && fake_segments[4*prevpoint-4].node1==node1 && fake_segments[4*prevpoint-3].node2==node2)
{
if(DISTANCE(dist1)>DISTANCE(fake_segments[4*prevpoint-4].distance)) /* point is further from node1 than prevpoint */
{
fake_segments[4*point-2]=fake_segments[4*prevpoint-3];
fake_segments[4*point-2].node2=fakenode;
fake_segments[4*point-2].distance=(DISTANCE(dist1)-DISTANCE(fake_segments[4*prevpoint-4].distance))|DISTFLAG(segmentp->distance);
}
else
{
fake_segments[4*point-2]=fake_segments[4*prevpoint-4];
fake_segments[4*point-2].node1=fakenode;
fake_segments[4*point-2].distance=(DISTANCE(fake_segments[4*prevpoint-4].distance)-DISTANCE(dist1))|DISTFLAG(segmentp->distance);
}
real_segments[4*point-2]=IndexSegment(segments,segmentp);
fake_segments[4*prevpoint-1]=fake_segments[4*point-2];
real_segments[4*prevpoint-1]=real_segments[4*point-2];
}
/* Return the fake node */
prevpoint=point;
return(fakenode);
}
/*++++++++++++++++++++++++++++++++++++++
Create a fake segment connecting a node to itself.
index_t CreateFakeNullSegment Returns the index of a fake segment.
Segments *segments The list of segments to use.
index_t node The node that is to be linked.
index_t segment The segment that is to be emulated.
int point The waypoint number.
++++++++++++++++++++++++++++++++++++++*/
index_t CreateFakeNullSegment(Segments *segments,index_t node,index_t segment,int point)
{
Segment *segmentp=LookupSegment(segments,segment,1);
fake_segments[4*point-2].node1=node;
fake_segments[4*point-2].node2=node;
fake_segments[4*point-2].way=segmentp->way;
fake_segments[4*point-2].distance=0;
return(4*point-2+SEGMENT_FAKE);
}
/*++++++++++++++++++++++++++++++++++++++
Re-initialise the fake node data storage.
++++++++++++++++++++++++++++++++++++++*/
void DeleteFakeNodes(void)
{
unsigned int i;
for(i=0;i