Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino
Contents of /trunk/src/segments.h
Parent Directory
|
Revision Log
Revision 151 -
(show annotations)
(download)
(as text)
Wed Apr 8 16:54:34 2009 UTC (15 years, 11 months ago) by amb
File MIME type: text/x-chdr
File size: 3125 byte(s)
Wed Apr 8 16:54:34 2009 UTC (15 years, 11 months ago) by amb
File MIME type: text/x-chdr
File size: 3125 byte(s)
Changed the license to Affero GPLv3.
1 | /*************************************** |
2 | $Header: /home/amb/CVS/routino/src/segments.h,v 1.30 2009-04-08 16:54:34 amb Exp $ |
3 | |
4 | A header file for the segments. |
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 SEGMENTS_H |
26 | #define SEGMENTS_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 segment. +*/ |
38 | struct _Segment |
39 | { |
40 | index_t node1; /*+ The index of the starting node. +*/ |
41 | index_t node2; /*+ The index of the finishing node. +*/ |
42 | |
43 | index_t next2; /*+ The index of the next segment sharing node2. +*/ |
44 | |
45 | index_t way; /*+ The index of the way associated with the segment. +*/ |
46 | |
47 | distance_t distance; /*+ The distance between the nodes. +*/ |
48 | }; |
49 | |
50 | |
51 | /*+ A structure containing a set of segments (mmap format). +*/ |
52 | struct _Segments |
53 | { |
54 | uint32_t number; /*+ How many entries are used in total? +*/ |
55 | |
56 | Segment *segments; /*+ An array of segments. +*/ |
57 | |
58 | void *data; /*+ The memory mapped data. +*/ |
59 | }; |
60 | |
61 | |
62 | /* Macros */ |
63 | |
64 | |
65 | /*+ Return a Segment pointer given a set of segments and an index. +*/ |
66 | #define LookupSegment(xxx,yyy) (&(xxx)->segments[yyy]) |
67 | |
68 | /*+ Return true if this is a normal segment. +*/ |
69 | #define IsNormalSegment(xxx) (((xxx)->node1)&SUPER_FLAG) |
70 | |
71 | /*+ Return true if this is a super-segment. +*/ |
72 | #define IsSuperSegment(xxx) (((xxx)->node2)&SUPER_FLAG) |
73 | |
74 | /*+ Return true if the segment is oneway towards the specified node. +*/ |
75 | #define IsOnewayTo(xxx,yyy) ((NODE((xxx)->node1)==(yyy))?((xxx)->distance&ONEWAY_2TO1):((xxx)->distance&ONEWAY_1TO2)) |
76 | |
77 | /*+ Return true if the segment is oneway from the specified node. +*/ |
78 | #define IsOnewayFrom(xxx,yyy) ((NODE((xxx)->node2)==(yyy))?((xxx)->distance&ONEWAY_2TO1):((xxx)->distance&ONEWAY_1TO2)) |
79 | |
80 | /*+ Return the other node in the segment that is not the specified node. +*/ |
81 | #define OtherNode(xxx,yyy) ((NODE((xxx)->node1)==(yyy))?NODE((xxx)->node2):NODE((xxx)->node1)) |
82 | |
83 | |
84 | /* Functions */ |
85 | |
86 | |
87 | Segments *LoadSegmentList(const char *filename); |
88 | |
89 | Segment *NextSegment(Segments* segments,Segment *segment,index_t node); |
90 | |
91 | distance_t Distance(float lat1,float lon1,float lat2,float lon2); |
92 | |
93 | duration_t Duration(Segment *segment,Way *way,Profile *profile); |
94 | |
95 | |
96 | #endif /* SEGMENTS_H */ |
Properties
Name | Value |
---|---|
cvs:description | Header file for segments. |