Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino
Annotation of /trunk/src/segmentsx.h
Parent Directory
|
Revision Log
Revision 279 -
(hide annotations)
(download)
(as text)
Thu Oct 8 19:20:29 2009 UTC (15 years, 5 months ago) by amb
File MIME type: text/x-chdr
File size: 3262 byte(s)
Thu Oct 8 19:20:29 2009 UTC (15 years, 5 months ago) by amb
File MIME type: text/x-chdr
File size: 3262 byte(s)
Replace node, segment and way indexes with a single index for a set of segments containing the location of the first segment for each node.
1 | amb | 110 | /*************************************** |
2 | amb | 279 | $Header: /home/amb/CVS/routino/src/segmentsx.h,v 1.19 2009-10-08 19:20:29 amb Exp $ |
3 | amb | 110 | |
4 | A header file for the extended segments. | ||
5 | amb | 151 | |
6 | Part of the Routino routing software. | ||
7 | amb | 110 | ******************/ /****************** |
8 | amb | 151 | This file Copyright 2008,2009 Andrew M. Bishop |
9 | amb | 110 | |
10 | amb | 151 | 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 | amb | 110 | ***************************************/ |
23 | |||
24 | |||
25 | #ifndef SEGMENTSX_H | ||
26 | #define SEGMENTSX_H /*+ To stop multiple inclusions. +*/ | ||
27 | |||
28 | #include <stdint.h> | ||
29 | |||
30 | amb | 199 | #include "typesx.h" |
31 | amb | 110 | #include "types.h" |
32 | |||
33 | |||
34 | /* Data structures */ | ||
35 | |||
36 | |||
37 | /*+ An extended structure used for processing. +*/ | ||
38 | struct _SegmentX | ||
39 | { | ||
40 | amb | 209 | node_t node1; /*+ The id of the starting node. +*/ |
41 | node_t node2; /*+ The id of the finishing node. +*/ | ||
42 | amb | 110 | |
43 | amb | 209 | way_t way; /*+ The id of the way. +*/ |
44 | amb | 203 | |
45 | amb | 209 | distance_t distance; /*+ The distance between the nodes. +*/ |
46 | amb | 110 | }; |
47 | |||
48 | |||
49 | /*+ A structure containing a set of segments (memory format). +*/ | ||
50 | struct _SegmentsX | ||
51 | { | ||
52 | amb | 256 | char *filename; /*+ The name of the temporary file. +*/ |
53 | int fd; /*+ The file descriptor of the temporary file. +*/ | ||
54 | amb | 216 | |
55 | amb | 256 | uint32_t xnumber; /*+ The number of unsorted extended nodes. +*/ |
56 | amb | 216 | |
57 | amb | 256 | SegmentX *xdata; /*+ The extended segment data (unsorted). +*/ |
58 | amb | 275 | SegmentX cached[2]; /*+ Two cached segments read from the file in slim mode. +*/ |
59 | amb | 256 | |
60 | amb | 128 | uint32_t number; /*+ How many entries are still useful? +*/ |
61 | amb | 110 | |
62 | amb | 275 | node_t *idata; /*+ The extended segment data (sorted by node1 then node2). +*/ |
63 | amb | 279 | index_t *firstnode; /*+ The first segment index for each node. +*/ |
64 | amb | 209 | |
65 | amb | 229 | Segment *sdata; /*+ The segment data (same order as n1data). +*/ |
66 | amb | 110 | }; |
67 | |||
68 | |||
69 | /* Functions */ | ||
70 | |||
71 | |||
72 | SegmentsX *NewSegmentList(void); | ||
73 | void FreeSegmentList(SegmentsX *segmentsx); | ||
74 | |||
75 | void SaveSegmentList(SegmentsX *segmentsx,const char *filename); | ||
76 | |||
77 | amb | 275 | SegmentX *LookupSegmentX(SegmentsX* segmentsx,index_t index,int position); |
78 | amb | 110 | |
79 | amb | 275 | index_t IndexFirstSegmentX(SegmentsX* segmentsx,node_t node); |
80 | amb | 256 | |
81 | amb | 279 | index_t IndexNextSegmentX(SegmentsX* segmentsx,index_t segindex,index_t nodeindex); |
82 | |||
83 | amb | 209 | void AppendSegment(SegmentsX* segmentsx,way_t way,node_t node1,node_t node2,distance_t distance); |
84 | amb | 110 | |
85 | amb | 279 | void SortSegmentList(SegmentsX* segmentsx); |
86 | amb | 110 | |
87 | amb | 204 | void RemoveBadSegments(NodesX *nodesx,SegmentsX *segmentsx); |
88 | amb | 110 | |
89 | amb | 279 | void UpdateSegments(SegmentsX *segmentsx,NodesX *nodesx,WaysX *waysx); |
90 | amb | 110 | |
91 | amb | 275 | void RotateSegments(SegmentsX* segmentsx); |
92 | |||
93 | amb | 279 | void DeduplicateSegments(SegmentsX* segmentsx,NodesX *nodesx,WaysX *waysx); |
94 | amb | 110 | |
95 | amb | 209 | void CreateRealSegments(SegmentsX *segmentsx,WaysX *waysx); |
96 | |||
97 | amb | 110 | void IndexSegments(SegmentsX* segmentsx,NodesX *nodesx); |
98 | |||
99 | |||
100 | #endif /* SEGMENTSX_H */ |
Properties
Name | Value |
---|---|
cvs:description | Extended segments header. |