1 /***************************************
2 $Header: /home/amb/routino/src/RCS/segmentsx.h,v 1.20 2010/03/19 19:47:09 amb Exp $
4 A header file for the extended segments.
6 Part of the Routino routing software.
7 ******************/ /******************
8 This file Copyright 2008-2010 Andrew M. Bishop
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.
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.
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 ***************************************/
26 #define SEGMENTSX_H /*+ To stop multiple inclusions. +*/
37 /*+ An extended structure used for processing. +*/
40 node_t node1; /*+ The id of the starting node. +*/
41 node_t node2; /*+ The id of the finishing node. +*/
43 way_t way; /*+ The id of the way. +*/
45 distance_t distance; /*+ The distance between the nodes. +*/
49 /*+ A structure containing a set of segments (memory format). +*/
52 char *filename; /*+ The name of the temporary file. +*/
53 int fd; /*+ The file descriptor of the temporary file. +*/
55 uint32_t xnumber; /*+ The number of unsorted extended nodes. +*/
57 SegmentX *xdata; /*+ The extended segment data (unsorted). +*/
58 SegmentX cached[2]; /*+ Two cached segments read from the file in slim mode. +*/
60 uint32_t number; /*+ How many entries are still useful? +*/
62 node_t *idata; /*+ The extended segment data (sorted by node1 then node2). +*/
63 index_t *firstnode; /*+ The first segment index for each node. +*/
65 Segment *sdata; /*+ The segment data (same order as n1data). +*/
72 SegmentsX *NewSegmentList(int append);
73 void FreeSegmentList(SegmentsX *segmentsx,int keep);
75 void SaveSegmentList(SegmentsX *segmentsx,const char *filename);
77 SegmentX *LookupSegmentX(SegmentsX* segmentsx,index_t index,int position);
79 index_t IndexFirstSegmentX(SegmentsX* segmentsx,node_t node);
81 index_t IndexNextSegmentX(SegmentsX* segmentsx,index_t segindex,index_t nodeindex);
83 void AppendSegment(SegmentsX* segmentsx,way_t way,node_t node1,node_t node2,distance_t distance);
85 void SortSegmentList(SegmentsX* segmentsx);
87 void RemoveBadSegments(NodesX *nodesx,SegmentsX *segmentsx);
89 void UpdateSegments(SegmentsX *segmentsx,NodesX *nodesx,WaysX *waysx);
91 void RotateSegments(SegmentsX* segmentsx);
93 void DeduplicateSegments(SegmentsX* segmentsx,NodesX *nodesx,WaysX *waysx);
95 void CreateRealSegments(SegmentsX *segmentsx,WaysX *waysx);
97 void IndexSegments(SegmentsX* segmentsx,NodesX *nodesx);
100 #endif /* SEGMENTSX_H */