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 219 -
(show annotations)
(download)
(as text)
Thu Jul 9 17:31:56 2009 UTC (15 years, 8 months ago) by amb
File MIME type: text/x-chdr
File size: 2863 byte(s)
Thu Jul 9 17:31:56 2009 UTC (15 years, 8 months ago) by amb
File MIME type: text/x-chdr
File size: 2863 byte(s)
Change from float to double for latitude and longitude. Store latitude and longitude as an integer type rather than float (higher precision).
1 | /*************************************** |
2 | $Header: /home/amb/CVS/routino/src/nodes.h,v 1.27 2009-07-09 17:31:55 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 entries are used in total? +*/ |
51 | |
52 | uint32_t latbins; /*+ The number of bins containing latitude. +*/ |
53 | uint32_t lonbins; /*+ The number of bins containing longitude. +*/ |
54 | |
55 | ll_bin_t xlatzero; /*+ The bin number of the furthest south bin. +*/ |
56 | ll_bin_t xlonzero; /*+ The bin number of the furthest west bin. +*/ |
57 | |
58 | index_t *offsets; /*+ An array of offset to the first node in each bin. +*/ |
59 | |
60 | Node *nodes; /*+ An array of nodes. +*/ |
61 | |
62 | void *data; /*+ The memory mapped data. +*/ |
63 | }; |
64 | |
65 | |
66 | /* Macros */ |
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 a Segment points given a Node pointer and a set of segments. +*/ |
72 | #define FirstSegment(xxx,yyy,zzz) LookupSegment((xxx),SEGMENT((yyy)->nodes[zzz].firstseg)) |
73 | |
74 | /*+ Return true if this is a super-node. +*/ |
75 | #define IsSuperNode(xxx,yyy) (((xxx)->nodes[yyy].firstseg)&NODE_SUPER) |
76 | |
77 | |
78 | /* Functions */ |
79 | |
80 | |
81 | Nodes *LoadNodeList(const char *filename); |
82 | |
83 | index_t FindNode(Nodes* nodes,Segments *segments,Ways *ways,double latitude,double longitude,distance_t *distance,Profile *profile); |
84 | |
85 | void GetLatLong(Nodes *nodes,index_t index,double *latitude,double *longitude); |
86 | |
87 | |
88 | #endif /* NODES_H */ |
Properties
Name | Value |
---|---|
cvs:description | Header file for nodes. |