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 303 - (show annotations) (download) (as text)
Sat Nov 14 19:39:20 2009 UTC (15 years, 4 months ago) by amb
File MIME type: text/x-chdr
File size: 3270 byte(s)
If a selected waypoint is not very close to an existing node then insert a fake
node in the segment that comes closest and use that instead.

1 /***************************************
2 $Header: /home/amb/CVS/routino/src/nodes.h,v 1.30 2009-11-14 19:39:19 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 FindClosestNode(Nodes* nodes,Segments *segments,Ways *ways,double latitude,double longitude,
85 distance_t distance,Profile *profile,distance_t *bestdist);
86
87 Segment *FindClosestSegment(Nodes* nodes,Segments *segments,Ways *ways,double latitude,double longitude,
88 distance_t distance,Profile *profile, distance_t *bestdist,
89 index_t *bestnode1,index_t *bestnode2,distance_t *bestdist1,distance_t *bestdist2);
90
91 void GetLatLong(Nodes *nodes,index_t index,double *latitude,double *longitude);
92
93
94 #endif /* NODES_H */

Properties

Name Value
cvs:description Header file for nodes.