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 118 - (show annotations) (download) (as text)
Sun Feb 15 13:45:54 2009 UTC (16 years, 1 month ago) by amb
File MIME type: text/x-chdr
File size: 2393 byte(s)
Add macros for handling lat/long to bin conversions.

1 /***************************************
2 $Header: /home/amb/CVS/routino/src/nodes.h,v 1.20 2009-02-15 13:45:54 amb Exp $
3
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 #include "types.h"
21
22
23 /* Data structures */
24
25
26 /*+ A structure containing a single node. +*/
27 struct _Node
28 {
29 index_t firstseg; /*+ The index of the first segment. +*/
30
31 ll_off_t latoffset; /*+ The node latitude offset within its bin. +*/
32 ll_off_t lonoffset; /*+ The node longitude offset within its bin. +*/
33 };
34
35
36 /*+ A structure containing a set of nodes (mmap format). +*/
37 struct _Nodes
38 {
39 uint32_t number; /*+ How many entries are used in total? +*/
40
41 uint32_t latbins; /*+ The number of bins containing latitude. +*/
42 uint32_t lonbins; /*+ The number of bins containing longitude. +*/
43
44 int32_t latzero; /*+ The latitude of the SW corner of the first bin. +*/
45 int32_t lonzero; /*+ The longitude of the SW corner of the first bin. +*/
46
47 index_t *offsets; /*+ The offset of the first node in each bin. +*/
48
49 Node *nodes; /*+ An array of nodes. +*/
50
51 void *data; /*+ The memory mapped data. +*/
52 };
53
54
55 /* Macros */
56
57
58 /*+ Return a Node pointer given a set of nodes and an index. +*/
59 #define LookupNode(xxx,yyy) (&(xxx)->nodes[yyy])
60
61 /*+ Return an index for a Node pointer given a set of nodes. +*/
62 #define IndexNode(xxx,yyy) ((yyy)-&(xxx)->nodes[0])
63
64 /*+ Return a Segment points given a Node pointer and a set of segments. +*/
65 #define FirstSegment(xxx,yyy) LookupSegment((xxx),SEGMENT((yyy)->firstseg))
66
67 /*+ Return true if this is a super-node. +*/
68 #define IsSuperNode(xxx) (((xxx)->firstseg)&SUPER_FLAG)
69
70
71 /* Functions */
72
73
74 Nodes *LoadNodeList(const char *filename);
75
76 Node *FindNode(Nodes* nodes,float latitude,float longitude);
77
78 void GetLatLong(Nodes *nodes,Node *node,float *latitude,float *longitude);
79
80
81 #endif /* NODES_H */

Properties

Name Value
cvs:description Header file for nodes.