Routino SVN Repository Browser

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

ViewVC logotype

Contents of /trunk/src/nodes.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 232 - (show annotations) (download) (as text)
Sun Jul 19 14:10:27 2009 UTC (15 years, 8 months ago) by amb
File MIME type: text/x-chdr
File size: 2912 byte(s)
Include the number of super-nodes, super-segments etc in the database as useful
information to put in the statistics output.

1 /***************************************
2 $Header: /home/amb/CVS/routino/src/nodes.h,v 1.29 2009-07-19 14:10:26 amb Exp $
3
4 A header file for the nodes.
5
6 Part of the Routino routing software.
7 ******************/ /******************
8 This file Copyright 2008,2009 Andrew M. Bishop
9
10 This program is free software: you can redistribute it and/or modify
11 it under the terms of the GNU Affero General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Affero General Public License for more details.
19
20 You should have received a copy of the GNU Affero General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 ***************************************/
23
24
25 #ifndef NODES_H
26 #define NODES_H /*+ To stop multiple inclusions. +*/
27
28 #include <stdint.h>
29
30 #include "types.h"
31 #include "profiles.h"
32
33
34 /* Data structures */
35
36
37 /*+ A structure containing a single node. +*/
38 struct _Node
39 {
40 index_t firstseg; /*+ The index of the first segment. +*/
41
42 ll_off_t latoffset; /*+ The node latitude offset within its bin. +*/
43 ll_off_t lonoffset; /*+ The node longitude offset within its bin. +*/
44 };
45
46
47 /*+ A structure containing a set of nodes (mmap format). +*/
48 struct _Nodes
49 {
50 uint32_t number; /*+ How many nodes in total? +*/
51 uint32_t snumber; /*+ How many super-nodes? +*/
52
53 uint32_t latbins; /*+ The number of bins containing latitude. +*/
54 uint32_t lonbins; /*+ The number of bins containing longitude. +*/
55
56 ll_bin_t latzero; /*+ The bin number of the furthest south bin. +*/
57 ll_bin_t lonzero; /*+ The bin number of the furthest west bin. +*/
58
59 index_t *offsets; /*+ An array of offset to the first node in each bin. +*/
60
61 Node *nodes; /*+ An array of nodes. +*/
62
63 void *data; /*+ The memory mapped data. +*/
64 };
65
66
67 /* Macros */
68
69 /*+ Return a Node pointer given a set of nodes and an index. +*/
70 #define LookupNode(xxx,yyy) (&(xxx)->nodes[yyy])
71
72 /*+ Return a Segment points given a Node pointer and a set of segments. +*/
73 #define FirstSegment(xxx,yyy,zzz) LookupSegment((xxx),SEGMENT((yyy)->nodes[zzz].firstseg))
74
75 /*+ Return true if this is a super-node. +*/
76 #define IsSuperNode(xxx,yyy) (((xxx)->nodes[yyy].firstseg)&NODE_SUPER)
77
78
79 /* Functions */
80
81
82 Nodes *LoadNodeList(const char *filename);
83
84 index_t FindNode(Nodes* nodes,Segments *segments,Ways *ways,double latitude,double longitude,distance_t *distance,Profile *profile);
85
86 void GetLatLong(Nodes *nodes,index_t index,double *latitude,double *longitude);
87
88
89 #endif /* NODES_H */

Properties

Name Value
cvs:description Header file for nodes.