Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino
Contents of /branches/MS-Windows/src/relationsx.h
Parent Directory
|
Revision Log
Revision 1740 -
(show annotations)
(download)
(as text)
Sat Jul 11 14:23:50 2015 UTC (9 years, 8 months ago) by amb
File MIME type: text/x-chdr
File size: 4672 byte(s)
Sat Jul 11 14:23:50 2015 UTC (9 years, 8 months ago) by amb
File MIME type: text/x-chdr
File size: 4672 byte(s)
Define a custom type for the offset within a file (because MS Windows can create a 4GB file but only seek +/-2GB within it).
1 | /*************************************** |
2 | A header file for the extended Relations structure. |
3 | |
4 | Part of the Routino routing software. |
5 | ******************/ /****************** |
6 | This file Copyright 2010-2015 Andrew M. Bishop |
7 | |
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 | relation_t id; /*+ The relation identifier. +*/ |
40 | |
41 | transports_t routes; /*+ The types of transports that that this relation is for. +*/ |
42 | }; |
43 | |
44 | |
45 | /*+ An extended structure containing a single turn restriction relation. +*/ |
46 | struct _TurnRelX |
47 | { |
48 | relation_t id; /*+ The relation identifier. +*/ |
49 | |
50 | way_t from; /*+ The id of the starting way; initially the OSM value, later the SegmentX index. +*/ |
51 | node_t via; /*+ The id of the via node; initially the OSM value, later the NodeX index. +*/ |
52 | way_t to; /*+ The id of the ending way; initially the OSM value, later the SegmentX index. +*/ |
53 | |
54 | TurnRestriction restriction; /*+ The type of restriction. +*/ |
55 | transports_t except; /*+ The types of transports that that this relation does not apply to. +*/ |
56 | }; |
57 | |
58 | |
59 | /*+ A structure containing a set of relations. +*/ |
60 | struct _RelationsX |
61 | { |
62 | /* Route relations */ |
63 | |
64 | char *rrfilename; /*+ The name of the intermediate file (for the RouteRelX). +*/ |
65 | char *rrfilename_tmp; /*+ The name of the temporary file (for the RouteRelX). +*/ |
66 | |
67 | int rrfd; /*+ The file descriptor of the open file (for the RouteRelX). +*/ |
68 | |
69 | index_t rrnumber; /*+ The number of extended route relations. +*/ |
70 | index_t rrknumber; /*+ The number of extended route relations kept for next time. +*/ |
71 | |
72 | relation_t *rridata; /*+ The extended relation IDs (sorted by ID). +*/ |
73 | offset_t *rrodata; /*+ The offset of the route relation in the file (used for error log). +*/ |
74 | |
75 | /* Turn restriction relations */ |
76 | |
77 | char *trfilename; /*+ The name of the intermediate file (for the TurnRelX). +*/ |
78 | char *trfilename_tmp; /*+ The name of the temporary file (for the TurnRelX). +*/ |
79 | |
80 | int trfd; /*+ The file descriptor of the temporary file (for the TurnRelX). +*/ |
81 | |
82 | index_t trnumber; /*+ The number of extended turn restriction relations. +*/ |
83 | index_t trknumber; /*+ The number of extended turn relations kept for next time. +*/ |
84 | |
85 | relation_t *tridata; /*+ The extended relation IDs (sorted by ID). +*/ |
86 | }; |
87 | |
88 | |
89 | /* Functions in relationsx.c */ |
90 | |
91 | RelationsX *NewRelationList(int append,int readonly); |
92 | void FreeRelationList(RelationsX *relationsx,int keep); |
93 | |
94 | void AppendRouteRelationList(RelationsX* relationsx,relation_t id, |
95 | transports_t routes, |
96 | node_t *nodes,int nnodes, |
97 | way_t *ways,int nways, |
98 | relation_t *relations,int nrelations); |
99 | void AppendTurnRelationList(RelationsX* relationsx,relation_t id, |
100 | way_t from,way_t to,node_t via, |
101 | TurnRestriction restriction,transports_t except); |
102 | void FinishRelationList(RelationsX *relationsx); |
103 | |
104 | index_t IndexRouteRelX(RelationsX *relationsx,relation_t id); |
105 | index_t IndexTurnRelX(RelationsX *relationsx,relation_t id); |
106 | |
107 | void SortRelationList(RelationsX *relationsx); |
108 | |
109 | void ProcessRouteRelations(RelationsX *relationsx,WaysX *waysx,int keep); |
110 | |
111 | void ProcessTurnRelations(RelationsX *relationsx,NodesX *nodesx,SegmentsX *segmentsx,WaysX *waysx,int keep); |
112 | |
113 | void RemovePrunedTurnRelations(RelationsX *relationsx,NodesX *nodesx); |
114 | |
115 | void SortTurnRelationListGeographically(RelationsX *relationsx,NodesX *nodesx,SegmentsX *segmentsx); |
116 | |
117 | void SaveRelationList(RelationsX* relationsx,const char *filename); |
118 | |
119 | |
120 | #endif /* RELATIONSX_H */ |