Routino SVN Repository Browser

Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino

ViewVC logotype

Annotation of /trunk/src/segments.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 99 - (hide annotations) (download) (as text)
Wed Feb 4 18:23:33 2009 UTC (16 years, 1 month ago) by amb
File MIME type: text/x-chdr
File size: 2728 byte(s)
Sort the nodes geographically and take coordinates as command line arguments.

1 amb 24 /***************************************
2 amb 99 $Header: /home/amb/CVS/routino/src/segments.h,v 1.25 2009-02-04 18: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 82 #include "profiles.h"
23 amb 24
24 amb 26
25 amb 24 /* Data structures */
26    
27    
28 amb 88 /*+ An extended structure used for processing. +*/
29 amb 97 typedef struct _SegmentX
30 amb 88 {
31     node_t node1; /*+ The starting node. +*/
32     node_t node2; /*+ The finishing node. +*/
33    
34     Segment segment; /*+ The real segment data. +*/
35     }
36 amb 97 SegmentX;
37 amb 88
38 amb 24 /*+ A structure containing a set of segments (mmap format). +*/
39     typedef struct _Segments
40     {
41 amb 65 uint32_t number; /*+ How many entries are used in total? +*/
42 amb 88
43     Segment *segments; /*+ An array of segments. +*/
44    
45     void *data; /*+ The memory mapped data. +*/
46 amb 24 }
47     Segments;
48    
49     /*+ A structure containing a set of segments (memory format). +*/
50 amb 97 typedef struct _SegmentsX
51 amb 24 {
52 amb 88 uint32_t sorted; /*+ Is the data sorted and therefore searchable? +*/
53 amb 24 uint32_t alloced; /*+ How many entries are allocated? +*/
54     uint32_t number; /*+ How many entries are used? +*/
55    
56 amb 98 SegmentX *xdata; /*+ The extended segment data. +*/
57 amb 24 }
58 amb 97 SegmentsX;
59 amb 24
60    
61 amb 26 /* Functions in segments.c */
62 amb 24
63    
64     Segments *LoadSegmentList(const char *filename);
65    
66 amb 97 SegmentsX *NewSegmentList(void);
67     void FreeSegmentList(SegmentsX *segmentsx);
68 amb 24
69 amb 97 void SaveSegmentList(SegmentsX *segmentsx,const char *filename);
70    
71 amb 98 SegmentX *FindFirstSegmentX(SegmentsX* segmentsx,node_t node);
72     SegmentX *FindNextSegmentX(SegmentsX* segmentsx,SegmentX *segmentx);
73 amb 97
74 amb 88 Segment *NextSegment(Segments *segments,Segment *segment);
75 amb 24
76 amb 98 Segment *AppendSegment(SegmentsX* segmentsx,node_t node1,node_t node2);
77 amb 39
78 amb 97 void SortSegmentList(SegmentsX *segmentsx);
79 amb 24
80 amb 97 void RemoveBadSegments(SegmentsX *segmentsx);
81 amb 88
82 amb 97 void MeasureSegments(SegmentsX *segmentsx,NodesX *nodesx);
83     void FixupSegments(SegmentsX* segmentsx,NodesX *nodesx,SegmentsX* supersegmentsx);
84 amb 88
85 amb 99 distance_t DistanceX(NodeX *nodex1,NodeX *nodex2);
86 amb 24
87 amb 99 float Distance(float lat1,float lon1,float lat2,float lon2);
88    
89 amb 82 duration_t Duration(Segment *segment,Way *way,Profile *profile);
90 amb 63
91 amb 97 #define LookupSegmentX(xxx,yyy) (&(xxx)->xdata[yyy])
92 amb 32
93 amb 97 #define IndexSegmentX(xxx,yyy) ((yyy)-&(xxx)->xdata[0])
94 amb 89
95    
96 amb 24 #endif /* SEGMENTS_H */

Properties

Name Value
cvs:description Header file for segments.