Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino
Annotation of /trunk/src/nodesx.h
Parent Directory
|
Revision Log
Revision 216 -
(hide annotations)
(download)
(as text)
Sat Jul 4 17:58:06 2009 UTC (15 years, 9 months ago) by amb
File MIME type: text/x-chdr
File size: 3039 byte(s)
Sat Jul 4 17:58:06 2009 UTC (15 years, 9 months ago) by amb
File MIME type: text/x-chdr
File size: 3039 byte(s)
Change data structure to avoid calling realloc() each time to allocate more memory.
1 | amb | 110 | /*************************************** |
2 | amb | 216 | $Header: /home/amb/CVS/routino/src/nodesx.h,v 1.7 2009-07-04 17:58:05 amb Exp $ |
3 | amb | 110 | |
4 | A header file for the extended nodes. | ||
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 NODESX_H | ||
26 | #define NODESX_H /*+ To stop multiple inclusions. +*/ | ||
27 | |||
28 | #include <stdint.h> | ||
29 | |||
30 | amb | 199 | #include "typesx.h" |
31 | amb | 110 | #include "types.h" |
32 | #include "nodes.h" | ||
33 | |||
34 | |||
35 | /* Data structures */ | ||
36 | |||
37 | |||
38 | /*+ An extended structure used for processing. +*/ | ||
39 | struct _NodeX | ||
40 | { | ||
41 | node_t id; /*+ The node identifier. +*/ | ||
42 | amb | 199 | |
43 | amb | 110 | float latitude; /*+ The node latitude. +*/ |
44 | float longitude; /*+ The node longitude. +*/ | ||
45 | amb | 199 | |
46 | amb | 212 | uint8_t super; /*+ A marker for super nodes. +*/ |
47 | amb | 110 | }; |
48 | |||
49 | /*+ A structure containing a set of nodes (memory format). +*/ | ||
50 | struct _NodesX | ||
51 | { | ||
52 | uint32_t sorted; /*+ Is the data sorted and therefore searchable? +*/ | ||
53 | amb | 216 | |
54 | int32_t row; /*+ How many rows are allocated? +*/ | ||
55 | uint32_t col; /*+ How many columns are used in the last row? +*/ | ||
56 | |||
57 | NodeX **xdata; /*+ The extended node data (unsorted). +*/ | ||
58 | |||
59 | amb | 110 | uint32_t number; /*+ How many entries are still useful? +*/ |
60 | |||
61 | amb | 216 | NodeX **gdata; /*+ The extended node data (sorted geographically). +*/ |
62 | NodeX **idata; /*+ The extended node data (sorted by ID). +*/ | ||
63 | |||
64 | Node *ndata; /*+ The actual nodes (same order as idata). +*/ | ||
65 | |||
66 | amb | 110 | float lat_min; /*+ The minimum latitude of the set of nodes. +*/ |
67 | float lat_max; /*+ The maximum latitude of the set of nodes. +*/ | ||
68 | float lon_min; /*+ The minimum longitude of the set of nodes. +*/ | ||
69 | float lon_max; /*+ The maximum longitude of the set of nodes. +*/ | ||
70 | }; | ||
71 | |||
72 | |||
73 | /* Functions */ | ||
74 | |||
75 | NodesX *NewNodeList(void); | ||
76 | |||
77 | void SaveNodeList(NodesX *nodesx,const char *filename); | ||
78 | |||
79 | amb | 212 | NodeX **FindNodeX(NodesX* nodesx,node_t id); |
80 | amb | 110 | |
81 | amb | 212 | void AppendNode(NodesX* nodesx,node_t id,float latitude,float longitude); |
82 | amb | 110 | |
83 | void SortNodeList(NodesX *nodesx); | ||
84 | |||
85 | amb | 212 | void SortNodeListGeographically(NodesX* nodesx); |
86 | |||
87 | amb | 110 | void RemoveNonHighwayNodes(NodesX *nodesx,SegmentsX *segmentsx); |
88 | |||
89 | amb | 212 | void CreateRealNodes(NodesX *nodesx,int iteration); |
90 | amb | 110 | |
91 | amb | 209 | void IndexNodes(NodesX *nodesx,SegmentsX *segmentsx); |
92 | amb | 110 | |
93 | |||
94 | #endif /* NODESX_H */ |
Properties
Name | Value |
---|---|
cvs:description | Extended nodes header. |