Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino
Annotation of /trunk/src/segments.h
Parent Directory
|
Revision Log
Revision 128 -
(hide annotations)
(download)
(as text)
Tue Feb 24 19:59:52 2009 UTC (16 years ago) by amb
File MIME type: text/x-chdr
File size: 2661 byte(s)
Tue Feb 24 19:59:52 2009 UTC (16 years ago) by amb
File MIME type: text/x-chdr
File size: 2661 byte(s)
Remove segment->next1 since it always points at the next segment or nowhere.
1 | amb | 24 | /*************************************** |
2 | amb | 128 | $Header: /home/amb/CVS/routino/src/segments.h,v 1.29 2009-02-24 19:59:36 amb Exp $ |
3 | amb | 24 | |
4 | A header file for the segments. | ||
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 SEGMENTS_H | ||
16 | #define SEGMENTS_H /*+ To stop multiple inclusions. +*/ | ||
17 | |||
18 | #include <stdint.h> | ||
19 | |||
20 | amb | 96 | #include "types.h" |
21 | amb | 82 | #include "profiles.h" |
22 | amb | 24 | |
23 | amb | 26 | |
24 | amb | 24 | /* Data structures */ |
25 | |||
26 | |||
27 | amb | 109 | /*+ A structure containing a single segment. +*/ |
28 | struct _Segment | ||
29 | amb | 88 | { |
30 | amb | 109 | index_t node1; /*+ The index of the starting node. +*/ |
31 | index_t node2; /*+ The index of the finishing node. +*/ | ||
32 | amb | 88 | |
33 | amb | 109 | index_t next2; /*+ The index of the next segment sharing node2. +*/ |
34 | amb | 88 | |
35 | amb | 109 | index_t way; /*+ The index of the way associated with the segment. +*/ |
36 | |||
37 | distance_t distance; /*+ The distance between the nodes. +*/ | ||
38 | }; | ||
39 | |||
40 | |||
41 | amb | 24 | /*+ A structure containing a set of segments (mmap format). +*/ |
42 | amb | 109 | struct _Segments |
43 | amb | 24 | { |
44 | amb | 104 | uint32_t number; /*+ How many entries are used in total? +*/ |
45 | amb | 88 | |
46 | amb | 104 | Segment *segments; /*+ An array of segments. +*/ |
47 | amb | 88 | |
48 | amb | 104 | void *data; /*+ The memory mapped data. +*/ |
49 | amb | 109 | }; |
50 | amb | 24 | |
51 | |||
52 | amb | 109 | /* Macros */ |
53 | amb | 24 | |
54 | |||
55 | amb | 109 | /*+ Return a Segment pointer given a set of segments and an index. +*/ |
56 | #define LookupSegment(xxx,yyy) (&(xxx)->segments[yyy]) | ||
57 | amb | 24 | |
58 | amb | 109 | /*+ Return true if this is a normal segment. +*/ |
59 | #define IsNormalSegment(xxx) (((xxx)->node1)&SUPER_FLAG) | ||
60 | amb | 24 | |
61 | amb | 109 | /*+ Return true if this is a super-segment. +*/ |
62 | #define IsSuperSegment(xxx) (((xxx)->node2)&SUPER_FLAG) | ||
63 | amb | 24 | |
64 | amb | 109 | /*+ Return true if the segment is oneway towards the specified node. +*/ |
65 | #define IsOnewayTo(xxx,yyy) ((NODE((xxx)->node1)==(yyy))?((xxx)->distance&ONEWAY_2TO1):((xxx)->distance&ONEWAY_1TO2)) | ||
66 | amb | 24 | |
67 | amb | 109 | /*+ Return true if the segment is oneway from the specified node. +*/ |
68 | #define IsOnewayFrom(xxx,yyy) ((NODE((xxx)->node2)==(yyy))?((xxx)->distance&ONEWAY_2TO1):((xxx)->distance&ONEWAY_1TO2)) | ||
69 | amb | 97 | |
70 | amb | 109 | /*+ Return the other node in the segment that is not the specified node. +*/ |
71 | #define OtherNode(xxx,yyy) ((NODE((xxx)->node1)==(yyy))?NODE((xxx)->node2):NODE((xxx)->node1)) | ||
72 | amb | 97 | |
73 | amb | 24 | |
74 | amb | 109 | /* Functions */ |
75 | amb | 39 | |
76 | amb | 24 | |
77 | amb | 109 | Segments *LoadSegmentList(const char *filename); |
78 | amb | 88 | |
79 | amb | 109 | Segment *NextSegment(Segments* segments,Segment *segment,index_t node); |
80 | amb | 88 | |
81 | amb | 114 | distance_t Distance(float lat1,float lon1,float lat2,float lon2); |
82 | amb | 99 | |
83 | amb | 82 | duration_t Duration(Segment *segment,Way *way,Profile *profile); |
84 | amb | 63 | |
85 | amb | 32 | |
86 | amb | 24 | #endif /* SEGMENTS_H */ |
Properties
Name | Value |
---|---|
cvs:description | Header file for segments. |