Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino
Annotation of /trunk/src/relationsx.h
Parent Directory
|
Revision Log
Revision 1160 -
(hide annotations)
(download)
(as text)
Tue Nov 20 14:04:44 2012 UTC (12 years, 4 months ago) by amb
File MIME type: text/x-chdr
File size: 4191 byte(s)
Tue Nov 20 14:04:44 2012 UTC (12 years, 4 months ago) by amb
File MIME type: text/x-chdr
File size: 4191 byte(s)
Tidy up all of the recent code changes - change the order of the functions within the files to a more sensible and consitent order.
1 | amb | 496 | /*************************************** |
2 | A header file for the extended Relations structure. | ||
3 | |||
4 | Part of the Routino routing software. | ||
5 | ******************/ /****************** | ||
6 | amb | 1098 | This file Copyright 2010-2012 Andrew M. Bishop |
7 | amb | 496 | |
8 | This program is free software: you can redistribute it and/or modify | ||
9 | it under the terms of the GNU Affero General Public License as published by | ||
10 | the Free Software Foundation, either version 3 of the License, or | ||
11 | (at your option) any later version. | ||
12 | |||
13 | This program is distributed in the hope that it will be useful, | ||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | GNU Affero General Public License for more details. | ||
17 | |||
18 | You should have received a copy of the GNU Affero General Public License | ||
19 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
20 | ***************************************/ | ||
21 | |||
22 | |||
23 | #ifndef RELATIONSX_H | ||
24 | #define RELATIONSX_H /*+ To stop multiple inclusions. +*/ | ||
25 | |||
26 | #include <stdint.h> | ||
27 | |||
28 | #include "types.h" | ||
29 | |||
30 | #include "typesx.h" | ||
31 | |||
32 | |||
33 | /* Data structures */ | ||
34 | |||
35 | |||
36 | /*+ An extended structure containing a single route relation. +*/ | ||
37 | struct _RouteRelX | ||
38 | { | ||
39 | amb | 529 | relation_t id; /*+ The relation identifier. +*/ |
40 | amb | 496 | |
41 | amb | 529 | transports_t routes; /*+ The types of transports that that this relation is for. +*/ |
42 | amb | 496 | }; |
43 | |||
44 | |||
45 | amb | 540 | /*+ An extended structure containing a single turn restriction relation. +*/ |
46 | struct _TurnRestrictRelX | ||
47 | { | ||
48 | relation_t id; /*+ The relation identifier. +*/ | ||
49 | |||
50 | amb | 599 | way_t from; /*+ The id of the starting way; initially the OSM value, later the NodeX index then the SegmentX index. +*/ |
51 | amb | 540 | node_t via; /*+ The id of the via node; initially the OSM value, later the NodeX index. +*/ |
52 | amb | 599 | way_t to; /*+ The id of the ending way; initially the OSM value, later the NodeX index then the SegmentX index. +*/ |
53 | amb | 540 | |
54 | amb | 786 | TurnRestriction restriction; /*+ The type of restriction. +*/ |
55 | amb | 540 | transports_t except; /*+ The types of transports that that this relation does not apply to. +*/ |
56 | }; | ||
57 | |||
58 | |||
59 | amb | 496 | /*+ A structure containing a set of relations. +*/ |
60 | struct _RelationsX | ||
61 | { | ||
62 | /* Route relations */ | ||
63 | |||
64 | amb | 1120 | char *rfilename; /*+ The name of the intermediate file (for the RouteRelX). +*/ |
65 | char *rfilename_tmp; /*+ The name of the temporary file (for the RouteRelX). +*/ | ||
66 | amb | 496 | |
67 | amb | 1120 | int rfd; /*+ The file descriptor of the open file (for the RouteRelX). +*/ |
68 | |||
69 | amb | 650 | index_t rnumber; /*+ The number of extended route relations. +*/ |
70 | amb | 540 | |
71 | /* Turn restriction relations */ | ||
72 | |||
73 | amb | 1120 | char *trfilename; /*+ The name of the intermediate file (for the TurnRestrictRelX). +*/ |
74 | char *trfilename_tmp; /*+ The name of the temporary file (for the TurnRestrictRelX). +*/ | ||
75 | |||
76 | amb | 540 | int trfd; /*+ The file descriptor of the temporary file (for the TurnRestrictRelX). +*/ |
77 | |||
78 | amb | 650 | index_t trnumber; /*+ The number of extended turn restriction relations. +*/ |
79 | amb | 496 | }; |
80 | |||
81 | |||
82 | amb | 680 | /* Functions in relationsx.c */ |
83 | amb | 496 | |
84 | amb | 1123 | RelationsX *NewRelationList(int append,int readonly); |
85 | amb | 1151 | void FreeRelationList(RelationsX *relationsx,int preserve); |
86 | amb | 496 | |
87 | amb | 540 | void AppendRouteRelation(RelationsX* relationsx,relation_t id, |
88 | transports_t routes, | ||
89 | amb | 496 | way_t *ways,int nways, |
90 | relation_t *relations,int nrelations); | ||
91 | amb | 540 | void AppendTurnRestrictRelation(RelationsX* relationsx,relation_t id, |
92 | way_t from,way_t to,node_t via, | ||
93 | TurnRestriction restriction,transports_t except); | ||
94 | amb | 1151 | void FinishRelationList(RelationsX *relationsx); |
95 | |||
96 | amb | 496 | void SortRelationList(RelationsX *relationsx); |
97 | |||
98 | amb | 1136 | void ProcessRouteRelations(RelationsX *relationsx,WaysX *waysx,int preserve); |
99 | amb | 496 | |
100 | amb | 1136 | void ProcessTurnRelations1(RelationsX *relationsx,NodesX *nodesx,WaysX *waysx,int preserve); |
101 | amb | 645 | void ProcessTurnRelations2(RelationsX *relationsx,NodesX *nodesx,SegmentsX *segmentsx,WaysX *waysx); |
102 | amb | 496 | |
103 | amb | 1098 | void RemovePrunedTurnRelations(RelationsX *relationsx,NodesX *nodesx); |
104 | |||
105 | amb | 1108 | void SortTurnRelationListGeographically(RelationsX *relationsx,NodesX *nodesx,SegmentsX *segmentsx); |
106 | amb | 542 | |
107 | void SaveRelationList(RelationsX* relationsx,const char *filename); | ||
108 | |||
109 | |||
110 | amb | 496 | #endif /* RELATIONSX_H */ |