1 /***************************************
2 $Header: /home/amb/routino/src/RCS/nodesx.h,v 1.23 2010/03/19 19:47:09 amb Exp $
4 A header file for the extended nodes.
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 NODESX_H /*+ To stop multiple inclusions. +*/
37 /*+ An extended structure used for processing. +*/
40 node_t id; /*+ The node identifier. +*/
42 latlong_t latitude; /*+ The node latitude. +*/
43 latlong_t longitude; /*+ The node longitude. +*/
46 /*+ A structure containing a set of nodes (memory format). +*/
49 char *filename; /*+ The name of the temporary file. +*/
50 int fd; /*+ The file descriptor of the temporary file. +*/
52 uint32_t xnumber; /*+ The number of unsorted extended nodes. +*/
54 NodeX *xdata; /*+ The extended node data (sorted). +*/
55 NodeX cached[2]; /*+ Two cached nodes read from the file in slim mode. +*/
57 uint32_t number; /*+ How many entries are still useful? +*/
59 node_t *idata; /*+ The extended node IDs (sorted by ID). +*/
61 uint8_t *super; /*+ A marker for super nodes (same order sorted nodes). +*/
63 Node *ndata; /*+ The actual nodes (same order as geographically sorted nodes). +*/
65 uint32_t latbins; /*+ The number of bins containing latitude. +*/
66 uint32_t lonbins; /*+ The number of bins containing longitude. +*/
68 ll_bin_t latzero; /*+ The bin number of the furthest south bin. +*/
69 ll_bin_t lonzero; /*+ The bin number of the furthest west bin. +*/
71 uint32_t latlonbin; /*+ A temporary index into the offsets array. +*/
73 index_t *offsets; /*+ An array of offset to the first node in each bin. +*/
79 NodesX *NewNodeList(int append);
80 void FreeNodeList(NodesX *nodesx,int keep);
82 void SaveNodeList(NodesX *nodesx,const char *filename);
84 index_t IndexNodeX(NodesX* nodesx,node_t id);
85 NodeX *LookupNodeX(NodesX* nodesx,index_t index,int position);
87 void AppendNode(NodesX* nodesx,node_t id,double latitude,double longitude);
89 void SortNodeList(NodesX *nodesx);
91 void SortNodeListGeographically(NodesX* nodesx);
93 void RemoveNonHighwayNodes(NodesX *nodesx,SegmentsX *segmentsx);
95 void CreateRealNodes(NodesX *nodesx,int iteration);
97 void IndexNodes(NodesX *nodesx,SegmentsX *segmentsx);
100 #endif /* NODESX_H */