Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino
Annotation of /trunk/src/segments.h
Parent Directory
|
Revision Log
Revision 104 -
(hide annotations)
(download)
(as text)
Fri Feb 6 20:23:35 2009 UTC (16 years, 1 month ago) by amb
File MIME type: text/x-chdr
File size: 3005 byte(s)
Fri Feb 6 20:23:35 2009 UTC (16 years, 1 month ago) by amb
File MIME type: text/x-chdr
File size: 3005 byte(s)
Segments now not duplicated in database. Routing with all nodes works, not with super-nodes.
1 | amb | 24 | /*************************************** |
2 | amb | 104 | $Header: /home/amb/CVS/routino/src/segments.h,v 1.26 2009-02-06 20:23:33 amb Exp $ |
3 | amb | 24 | |
4 | A header file for the segments. | ||
5 | ******************/ /****************** | ||
6 | Written by Andrew M. Bishop | ||
7 | |||
8 | This file Copyright 2009 Andrew M. Bishop | ||
9 | It may be distributed under the GNU Public License, version 2, or | ||
10 | any higher version. See section COPYING of the GNU Public license | ||
11 | for conditions under which this file may be redistributed. | ||
12 | ***************************************/ | ||
13 | |||
14 | |||
15 | #ifndef SEGMENTS_H | ||
16 | #define SEGMENTS_H /*+ To stop multiple inclusions. +*/ | ||
17 | |||
18 | #include <stdint.h> | ||
19 | |||
20 | amb | 96 | #include "types.h" |
21 | amb | 26 | #include "nodes.h" |
22 | amb | 104 | #include "ways.h" |
23 | amb | 82 | #include "profiles.h" |
24 | amb | 24 | |
25 | amb | 26 | |
26 | amb | 24 | /* Data structures */ |
27 | |||
28 | |||
29 | amb | 88 | /*+ An extended structure used for processing. +*/ |
30 | amb | 97 | typedef struct _SegmentX |
31 | amb | 88 | { |
32 | amb | 104 | node_t node1; /*+ The starting node. +*/ |
33 | node_t node2; /*+ The finishing node. +*/ | ||
34 | amb | 88 | |
35 | amb | 104 | Segment segment; /*+ The real segment data. +*/ |
36 | amb | 88 | } |
37 | amb | 97 | SegmentX; |
38 | amb | 88 | |
39 | amb | 24 | /*+ A structure containing a set of segments (mmap format). +*/ |
40 | typedef struct _Segments | ||
41 | { | ||
42 | amb | 104 | uint32_t number; /*+ How many entries are used in total? +*/ |
43 | amb | 88 | |
44 | amb | 104 | Segment *segments; /*+ An array of segments. +*/ |
45 | amb | 88 | |
46 | amb | 104 | void *data; /*+ The memory mapped data. +*/ |
47 | amb | 24 | } |
48 | Segments; | ||
49 | |||
50 | /*+ A structure containing a set of segments (memory format). +*/ | ||
51 | amb | 97 | typedef struct _SegmentsX |
52 | amb | 24 | { |
53 | amb | 104 | uint32_t sorted; /*+ Is the data sorted and therefore searchable? +*/ |
54 | uint32_t alloced; /*+ How many entries are allocated? +*/ | ||
55 | uint32_t number; /*+ How many entries are used from those allocated? +*/ | ||
56 | uint32_t xnumber; /*+ How many entries are still useful? +*/ | ||
57 | amb | 24 | |
58 | amb | 104 | SegmentX **sdata; /*+ The extended segment data (sorted by node). +*/ |
59 | SegmentX *xdata; /*+ The extended segment data (unsorted). +*/ | ||
60 | amb | 24 | } |
61 | amb | 97 | SegmentsX; |
62 | amb | 24 | |
63 | |||
64 | amb | 26 | /* Functions in segments.c */ |
65 | amb | 24 | |
66 | |||
67 | Segments *LoadSegmentList(const char *filename); | ||
68 | |||
69 | amb | 97 | SegmentsX *NewSegmentList(void); |
70 | void FreeSegmentList(SegmentsX *segmentsx); | ||
71 | amb | 24 | |
72 | amb | 97 | void SaveSegmentList(SegmentsX *segmentsx,const char *filename); |
73 | |||
74 | amb | 104 | SegmentX **FindFirstSegmentX(SegmentsX* segmentsx,node_t node); |
75 | SegmentX **FindNextSegmentX(SegmentsX* segmentsx,SegmentX **segmentx); | ||
76 | amb | 97 | |
77 | amb | 104 | Segment *NextSegment(Segments* segments,Segment *segment,index_t node); |
78 | amb | 24 | |
79 | amb | 98 | Segment *AppendSegment(SegmentsX* segmentsx,node_t node1,node_t node2); |
80 | amb | 39 | |
81 | amb | 97 | void SortSegmentList(SegmentsX *segmentsx); |
82 | amb | 24 | |
83 | amb | 97 | void RemoveBadSegments(SegmentsX *segmentsx); |
84 | amb | 88 | |
85 | amb | 97 | void MeasureSegments(SegmentsX *segmentsx,NodesX *nodesx); |
86 | amb | 88 | |
87 | amb | 104 | void RotateSegments(SegmentsX* segmentsx,NodesX *nodesx); |
88 | |||
89 | void DeduplicateSegments(SegmentsX* segmentsx,NodesX *nodesx,WaysX *waysx); | ||
90 | |||
91 | void IndexSegments(SegmentsX* segmentsx,NodesX *nodesx); | ||
92 | |||
93 | amb | 99 | distance_t DistanceX(NodeX *nodex1,NodeX *nodex2); |
94 | amb | 24 | |
95 | amb | 99 | float Distance(float lat1,float lon1,float lat2,float lon2); |
96 | |||
97 | amb | 82 | duration_t Duration(Segment *segment,Way *way,Profile *profile); |
98 | amb | 63 | |
99 | amb | 104 | #define LookupSegmentX(xxx,yyy) ((xxx)->sdata[yyy]) |
100 | amb | 32 | |
101 | amb | 89 | |
102 | amb | 24 | #endif /* SEGMENTS_H */ |
Properties
Name | Value |
---|---|
cvs:description | Header file for segments. |