Routino SVN Repository Browser

Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino

ViewVC logotype

Annotation of /trunk/src/nodes.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 99 - (hide annotations) (download) (as text)
Wed Feb 4 18:23:33 2009 UTC (16 years, 1 month ago) by amb
File MIME type: text/x-chdr
File size: 3391 byte(s)
Sort the nodes geographically and take coordinates as command line arguments.

1 amb 18 /***************************************
2 amb 99 $Header: /home/amb/CVS/routino/src/nodes.h,v 1.17 2009-02-04 18:23:33 amb Exp $
3 amb 18
4     A header file for the nodes.
5     ******************/ /******************
6     Written by Andrew M. Bishop
7    
8     This file Copyright 2009 Andrew M. Bishop
9     It may be distributed under the GNU Public License, version 2, or
10     any higher version. See section COPYING of the GNU Public license
11     for conditions under which this file may be redistributed.
12     ***************************************/
13    
14    
15     #ifndef NODES_H
16     #define NODES_H /*+ To stop multiple inclusions. +*/
17    
18     #include <stdint.h>
19    
20 amb 96 #include "types.h"
21 amb 18
22    
23     /* Simple Types */
24    
25    
26     /*+ A node identifier. +*/
27     typedef uint32_t node_t;
28    
29    
30     /* Data structures */
31    
32    
33 amb 88 /*+ An extended structure used for processing. +*/
34 amb 97 typedef struct _NodeX
35 amb 88 {
36     node_t id; /*+ The node identifier. +*/
37 amb 99 float latitude; /*+ The node latitude. +*/
38     float longitude; /*+ The node longitude. +*/
39 amb 89 int super; /*+ A marker for super nodes. +*/
40 amb 88
41     Node node; /*+ The real node data. +*/
42     }
43 amb 97 NodeX;
44 amb 88
45 amb 19 /*+ A structure containing a set of nodes (mmap format). +*/
46     typedef struct _Nodes
47     {
48 amb 65 uint32_t number; /*+ How many entries are used in total? +*/
49 amb 88
50 amb 99 uint32_t latbins; /*+ The number of bins containing latitude. +*/
51     uint32_t lonbins; /*+ The number of bins containing longitude. +*/
52    
53     float latzero; /*+ The latitude of the SW corner of the first bin. +*/
54     float lonzero; /*+ The longitude of the SW corner of the first bin. +*/
55    
56     index_t *offsets; /*+ The offset of the first node in each bin. +*/
57    
58 amb 88 Node *nodes; /*+ An array of nodes. +*/
59    
60     void *data; /*+ The memory mapped data. +*/
61 amb 19 }
62     Nodes;
63    
64 amb 18 /*+ A structure containing a set of nodes (memory format). +*/
65 amb 97 typedef struct _NodesX
66 amb 18 {
67 amb 88 uint32_t sorted; /*+ Is the data sorted and therefore searchable? +*/
68 amb 18 uint32_t alloced; /*+ How many entries are allocated? +*/
69 amb 19 uint32_t number; /*+ How many entries are used? +*/
70    
71 amb 99 float lat_min; /*+ The minimum latitude of the set of nodes. +*/
72     float lat_max; /*+ The maximum latitude of the set of nodes. +*/
73     float lon_min; /*+ The minimum longitude of the set of nodes. +*/
74     float lon_max; /*+ The maximum longitude of the set of nodes. +*/
75    
76     NodeX *gdata; /*+ The extended node data (sorted geographically). +*/
77     NodeX **idata; /*+ The extended node data (sorted by ID). +*/
78 amb 18 }
79 amb 97 NodesX;
80 amb 18
81    
82     /* Functions */
83    
84 amb 40 #include "segments.h"
85 amb 18
86 amb 40
87 amb 19 Nodes *LoadNodeList(const char *filename);
88 amb 18
89 amb 99 Node *FindNode(Nodes* nodes,float latitude,float longitude);
90    
91     void GetLatLong(Nodes *nodes,Node *node,float *latitude,float *longitude);
92    
93 amb 97 NodesX *NewNodeList(void);
94 amb 18
95 amb 97 void SaveNodeList(NodesX *nodesx,const char *filename);
96 amb 18
97 amb 98 NodeX *FindNodeX(NodesX* nodesx,node_t id);
98 amb 40
99 amb 98 Node *AppendNode(NodesX* nodesx,node_t id,float latitude,float longitude);
100 amb 18
101 amb 97 void SortNodeList(NodesX *nodesx);
102 amb 32
103 amb 97 void RemoveNonHighwayNodes(NodesX *nodesx,SegmentsX *segmentsx);
104 amb 88
105 amb 97 void FixupNodes(NodesX *nodesx,SegmentsX* segmentsx,int iteration);
106 amb 89
107 amb 99 #define LookupNodeX(xxx,yyy) (&(xxx)->gdata[NODE(yyy)])
108 amb 88
109 amb 99 #define IndexNodeX(xxx,yyy) ((yyy)-&(xxx)->gdata[0])
110 amb 97
111    
112 amb 18 #endif /* NODES_H */

Properties

Name Value
cvs:description Header file for nodes.