Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino
Contents of /trunk/src/nodes.h
Parent Directory
|
Revision Log
Revision 151 -
(show annotations)
(download)
(as text)
Wed Apr 8 16:54:34 2009 UTC (16 years ago) by amb
File MIME type: text/x-chdr
File size: 2878 byte(s)
Wed Apr 8 16:54:34 2009 UTC (16 years ago) by amb
File MIME type: text/x-chdr
File size: 2878 byte(s)
Changed the license to Affero GPLv3.
1 | /*************************************** |
2 | $Header: /home/amb/CVS/routino/src/nodes.h,v 1.22 2009-04-08 16:54:34 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 | |
32 | |
33 | /* Data structures */ |
34 | |
35 | |
36 | /*+ A structure containing a single node. +*/ |
37 | struct _Node |
38 | { |
39 | index_t firstseg; /*+ The index of the first segment. +*/ |
40 | |
41 | ll_off_t latoffset; /*+ The node latitude offset within its bin. +*/ |
42 | ll_off_t lonoffset; /*+ The node longitude offset within its bin. +*/ |
43 | }; |
44 | |
45 | |
46 | /*+ A structure containing a set of nodes (mmap format). +*/ |
47 | struct _Nodes |
48 | { |
49 | uint32_t number; /*+ How many entries are used in total? +*/ |
50 | |
51 | uint32_t latbins; /*+ The number of bins containing latitude. +*/ |
52 | uint32_t lonbins; /*+ The number of bins containing longitude. +*/ |
53 | |
54 | int32_t latzero; /*+ The latitude of the SW corner of the first bin. +*/ |
55 | int32_t lonzero; /*+ The longitude of the SW corner of the first bin. +*/ |
56 | |
57 | index_t *offsets; /*+ The offset of the first node in each bin. +*/ |
58 | |
59 | Node *nodes; /*+ An array of nodes. +*/ |
60 | |
61 | void *data; /*+ The memory mapped data. +*/ |
62 | }; |
63 | |
64 | |
65 | /* Macros */ |
66 | |
67 | |
68 | /*+ Return a Node pointer given a set of nodes and an index. +*/ |
69 | #define LookupNode(xxx,yyy) (&(xxx)->nodes[yyy]) |
70 | |
71 | /*+ Return an index for a Node pointer given a set of nodes. +*/ |
72 | #define IndexNode(xxx,yyy) ((yyy)-&(xxx)->nodes[0]) |
73 | |
74 | /*+ Return a Segment points given a Node pointer and a set of segments. +*/ |
75 | #define FirstSegment(xxx,yyy) LookupSegment((xxx),SEGMENT((yyy)->firstseg)) |
76 | |
77 | /*+ Return true if this is a super-node. +*/ |
78 | #define IsSuperNode(xxx) (((xxx)->firstseg)&SUPER_FLAG) |
79 | |
80 | |
81 | /* Functions */ |
82 | |
83 | |
84 | Nodes *LoadNodeList(const char *filename); |
85 | |
86 | Node *FindNode(Nodes* nodes,float latitude,float longitude,distance_t *distance); |
87 | |
88 | void GetLatLong(Nodes *nodes,Node *node,float *latitude,float *longitude); |
89 | |
90 | |
91 | #endif /* NODES_H */ |
Properties
Name | Value |
---|---|
cvs:description | Header file for nodes. |