Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino
Contents of /trunk/src/filedumper.c
Parent Directory
|
Revision Log
Revision 411 -
(show annotations)
(download)
(as text)
Sat May 29 13:54:43 2010 UTC (14 years, 10 months ago) by amb
File MIME type: text/x-csrc
File size: 20084 byte(s)
Sat May 29 13:54:43 2010 UTC (14 years, 10 months ago) by amb
File MIME type: text/x-csrc
File size: 20084 byte(s)
Translate the names given to unnamed roads (the highway type).
1 | /*************************************** |
2 | $Header: /home/amb/CVS/routino/src/filedumper.c,v 1.42 2010-05-29 13:54:23 amb Exp $ |
3 | |
4 | Memory file dumper. |
5 | |
6 | Part of the Routino routing software. |
7 | ******************/ /****************** |
8 | This file Copyright 2008-2010 Andrew M. Bishop |
9 | |
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. |
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 | ***************************************/ |
23 | |
24 | |
25 | #include <stdio.h> |
26 | #include <stdlib.h> |
27 | #include <string.h> |
28 | #include <sys/stat.h> |
29 | #include <sys/time.h> |
30 | #include <time.h> |
31 | |
32 | #include "types.h" |
33 | #include "functions.h" |
34 | #include "visualiser.h" |
35 | #include "nodes.h" |
36 | #include "segments.h" |
37 | #include "ways.h" |
38 | #include "xmlparse.h" |
39 | |
40 | |
41 | /* Local functions */ |
42 | |
43 | static void print_node(Nodes* nodes,index_t item); |
44 | static void print_segment(Segments *segments,index_t item); |
45 | static void print_way(Ways *ways,index_t item); |
46 | |
47 | static void print_head_osm(void); |
48 | static void print_node_osm(Nodes* nodes,index_t item); |
49 | static void print_segment_osm(Segments *segments,index_t item,Ways *ways); |
50 | static void print_tail_osm(void); |
51 | |
52 | static char *RFC822Date(time_t t); |
53 | |
54 | static void print_usage(int detail); |
55 | |
56 | |
57 | /*++++++++++++++++++++++++++++++++++++++ |
58 | The main program for the file dumper. |
59 | ++++++++++++++++++++++++++++++++++++++*/ |
60 | |
61 | int main(int argc,char** argv) |
62 | { |
63 | Nodes *OSMNodes; |
64 | Segments *OSMSegments; |
65 | Ways *OSMWays; |
66 | int arg; |
67 | char *dirname=NULL,*prefix=NULL; |
68 | char *nodes_filename,*segments_filename,*ways_filename; |
69 | int option_statistics=0; |
70 | int option_visualiser=0,coordcount=0; |
71 | double latmin=0,latmax=0,lonmin=0,lonmax=0; |
72 | char *option_data=NULL; |
73 | int option_dump=0; |
74 | int option_dump_osm=0; |
75 | |
76 | /* Parse the command line arguments */ |
77 | |
78 | for(arg=1;arg<argc;arg++) |
79 | { |
80 | if(!strcmp(argv[arg],"--help")) |
81 | print_usage(1); |
82 | else if(!strncmp(argv[arg],"--dir=",6)) |
83 | dirname=&argv[arg][6]; |
84 | else if(!strncmp(argv[arg],"--prefix=",9)) |
85 | prefix=&argv[arg][9]; |
86 | else if(!strcmp(argv[arg],"--statistics")) |
87 | option_statistics=1; |
88 | else if(!strcmp(argv[arg],"--visualiser")) |
89 | option_visualiser=1; |
90 | else if(!strcmp(argv[arg],"--dump")) |
91 | option_dump=1; |
92 | else if(!strcmp(argv[arg],"--dump-osm")) |
93 | option_dump_osm=1; |
94 | else if(!strncmp(argv[arg],"--latmin",8) && argv[arg][8]=='=') |
95 | {latmin=degrees_to_radians(atof(&argv[arg][9]));coordcount++;} |
96 | else if(!strncmp(argv[arg],"--latmax",8) && argv[arg][8]=='=') |
97 | {latmax=degrees_to_radians(atof(&argv[arg][9]));coordcount++;} |
98 | else if(!strncmp(argv[arg],"--lonmin",8) && argv[arg][8]=='=') |
99 | {lonmin=degrees_to_radians(atof(&argv[arg][9]));coordcount++;} |
100 | else if(!strncmp(argv[arg],"--lonmax",8) && argv[arg][8]=='=') |
101 | {lonmax=degrees_to_radians(atof(&argv[arg][9]));coordcount++;} |
102 | else if(!strncmp(argv[arg],"--data",6) && argv[arg][6]=='=') |
103 | option_data=&argv[arg][7]; |
104 | else if(!strncmp(argv[arg],"--node=",7)) |
105 | ; |
106 | else if(!strncmp(argv[arg],"--segment=",10)) |
107 | ; |
108 | else if(!strncmp(argv[arg],"--way=",6)) |
109 | ; |
110 | else |
111 | print_usage(0); |
112 | } |
113 | |
114 | if(!option_statistics && !option_visualiser && !option_dump && !option_dump_osm) |
115 | print_usage(0); |
116 | |
117 | /* Load in the data - Note: No error checking because Load*List() will call exit() in case of an error. */ |
118 | |
119 | OSMNodes=LoadNodeList(nodes_filename=FileName(dirname,prefix,"nodes.mem")); |
120 | |
121 | OSMSegments=LoadSegmentList(segments_filename=FileName(dirname,prefix,"segments.mem")); |
122 | |
123 | OSMWays=LoadWayList(ways_filename=FileName(dirname,prefix,"ways.mem")); |
124 | |
125 | /* Write out the visualiser data */ |
126 | |
127 | if(option_visualiser) |
128 | { |
129 | if(coordcount!=4) |
130 | { |
131 | fprintf(stderr,"The --visualiser option must have --latmin, --latmax, --lonmin, --lonmax.\n"); |
132 | exit(1); |
133 | } |
134 | |
135 | if(!option_data) |
136 | { |
137 | fprintf(stderr,"The --visualiser option must have --data.\n"); |
138 | exit(1); |
139 | } |
140 | |
141 | if(!strcmp(option_data,"junctions")) |
142 | OutputJunctions(OSMNodes,OSMSegments,OSMWays,latmin,latmax,lonmin,lonmax); |
143 | else if(!strcmp(option_data,"super")) |
144 | OutputSuper(OSMNodes,OSMSegments,OSMWays,latmin,latmax,lonmin,lonmax); |
145 | else if(!strcmp(option_data,"oneway")) |
146 | OutputOneway(OSMNodes,OSMSegments,OSMWays,latmin,latmax,lonmin,lonmax); |
147 | else if(!strcmp(option_data,"speed")) |
148 | OutputSpeedLimits(OSMNodes,OSMSegments,OSMWays,latmin,latmax,lonmin,lonmax); |
149 | else if(!strcmp(option_data,"weight")) |
150 | OutputWeightLimits(OSMNodes,OSMSegments,OSMWays,latmin,latmax,lonmin,lonmax); |
151 | else if(!strcmp(option_data,"height")) |
152 | OutputHeightLimits(OSMNodes,OSMSegments,OSMWays,latmin,latmax,lonmin,lonmax); |
153 | else if(!strcmp(option_data,"width")) |
154 | OutputWidthLimits(OSMNodes,OSMSegments,OSMWays,latmin,latmax,lonmin,lonmax); |
155 | else if(!strcmp(option_data,"length")) |
156 | OutputLengthLimits(OSMNodes,OSMSegments,OSMWays,latmin,latmax,lonmin,lonmax); |
157 | else |
158 | { |
159 | fprintf(stderr,"Unrecognised data option '%s' with --visualiser.\n",option_data); |
160 | exit(1); |
161 | } |
162 | } |
163 | |
164 | /* Print out statistics */ |
165 | |
166 | if(option_statistics) |
167 | { |
168 | struct stat buf; |
169 | |
170 | /* Examine the files */ |
171 | |
172 | printf("Files\n"); |
173 | printf("-----\n"); |
174 | printf("\n"); |
175 | |
176 | stat(nodes_filename,&buf); |
177 | |
178 | printf("'%s%snodes.mem' - %9lld Bytes\n",prefix?prefix:"",prefix?"-":"",(long long)buf.st_size); |
179 | printf("%s\n",RFC822Date(buf.st_mtime)); |
180 | printf("\n"); |
181 | |
182 | stat(segments_filename,&buf); |
183 | |
184 | printf("'%s%ssegments.mem' - %9lld Bytes\n",prefix?prefix:"",prefix?"-":"",(long long)buf.st_size); |
185 | printf("%s\n",RFC822Date(buf.st_mtime)); |
186 | printf("\n"); |
187 | |
188 | stat(ways_filename,&buf); |
189 | |
190 | printf("'%s%sways.mem' - %9lld Bytes\n",prefix?prefix:"",prefix?"-":"",(long long)buf.st_size); |
191 | printf("%s\n",RFC822Date(buf.st_mtime)); |
192 | printf("\n"); |
193 | |
194 | /* Examine the nodes */ |
195 | |
196 | printf("Nodes\n"); |
197 | printf("-----\n"); |
198 | printf("\n"); |
199 | |
200 | printf("sizeof(Node) =%9d Bytes\n",sizeof(Node)); |
201 | printf("Number =%9d\n",OSMNodes->number); |
202 | printf("Number(super)=%9d\n",OSMNodes->snumber); |
203 | printf("\n"); |
204 | |
205 | printf("Lat bins= %4d\n",OSMNodes->latbins); |
206 | printf("Lon bins= %4d\n",OSMNodes->lonbins); |
207 | printf("\n"); |
208 | |
209 | printf("Lat zero=%5d (%8.4f deg)\n",OSMNodes->latzero,radians_to_degrees(latlong_to_radians(bin_to_latlong(OSMNodes->latzero)))); |
210 | printf("Lon zero=%5d (%8.4f deg)\n",OSMNodes->lonzero,radians_to_degrees(latlong_to_radians(bin_to_latlong(OSMNodes->lonzero)))); |
211 | |
212 | /* Examine the segments */ |
213 | |
214 | printf("\n"); |
215 | printf("Segments\n"); |
216 | printf("--------\n"); |
217 | printf("\n"); |
218 | |
219 | printf("sizeof(Segment)=%9d Bytes\n",sizeof(Segment)); |
220 | printf("Number(total) =%9d\n",OSMSegments->number); |
221 | printf("Number(super) =%9d\n",OSMSegments->snumber); |
222 | printf("Number(normal) =%9d\n",OSMSegments->nnumber); |
223 | |
224 | /* Examine the ways */ |
225 | |
226 | printf("\n"); |
227 | printf("Ways\n"); |
228 | printf("----\n"); |
229 | printf("\n"); |
230 | |
231 | printf("sizeof(Way) =%9d Bytes\n",sizeof(Way)); |
232 | printf("Number(compacted)=%9d\n",OSMWays->number); |
233 | printf("Number(original) =%9d\n",OSMWays->onumber); |
234 | printf("\n"); |
235 | |
236 | printf("Total names =%9ld Bytes\n",(long)buf.st_size-sizeof(Ways)-OSMWays->number*sizeof(Way)); |
237 | printf("\n"); |
238 | |
239 | printf("Included transports: %s\n",AllowedNameList(OSMWays->allow)); |
240 | printf("Included properties: %s\n",PropertiesNameList(OSMWays->props)); |
241 | } |
242 | |
243 | /* Print out internal data */ |
244 | |
245 | if(option_dump) |
246 | { |
247 | index_t item; |
248 | |
249 | for(arg=1;arg<argc;arg++) |
250 | if(!strcmp(argv[arg],"--node=all")) |
251 | { |
252 | for(item=0;item<OSMNodes->number;item++) |
253 | print_node(OSMNodes,item); |
254 | } |
255 | else if(!strncmp(argv[arg],"--node=",7)) |
256 | { |
257 | item=atoi(&argv[arg][7]); |
258 | |
259 | if(item>=0 && item<OSMNodes->number) |
260 | print_node(OSMNodes,item); |
261 | else |
262 | printf("Invalid node number; minimum=0, maximum=%d.\n",OSMNodes->number-1); |
263 | } |
264 | else if(!strcmp(argv[arg],"--segment=all")) |
265 | { |
266 | for(item=0;item<OSMSegments->number;item++) |
267 | print_segment(OSMSegments,item); |
268 | } |
269 | else if(!strncmp(argv[arg],"--segment=",10)) |
270 | { |
271 | item=atoi(&argv[arg][10]); |
272 | |
273 | if(item>=0 && item<OSMSegments->number) |
274 | print_segment(OSMSegments,item); |
275 | else |
276 | printf("Invalid segment number; minimum=0, maximum=%d.\n",OSMSegments->number-1); |
277 | } |
278 | else if(!strcmp(argv[arg],"--way=all")) |
279 | { |
280 | for(item=0;item<OSMWays->number;item++) |
281 | print_way(OSMWays,item); |
282 | } |
283 | else if(!strncmp(argv[arg],"--way=",6)) |
284 | { |
285 | item=atoi(&argv[arg][6]); |
286 | |
287 | if(item>=0 && item<OSMWays->number) |
288 | print_way(OSMWays,item); |
289 | else |
290 | printf("Invalid way number; minimum=0, maximum=%d.\n",OSMWays->number-1); |
291 | } |
292 | } |
293 | |
294 | /* Print out internal data in XML format */ |
295 | |
296 | if(option_dump_osm) |
297 | { |
298 | index_t item; |
299 | |
300 | print_head_osm(); |
301 | |
302 | for(item=0;item<OSMNodes->number;item++) |
303 | print_node_osm(OSMNodes,item); |
304 | |
305 | for(item=0;item<OSMSegments->number;item++) |
306 | print_segment_osm(OSMSegments,item,OSMWays); |
307 | |
308 | print_tail_osm(); |
309 | } |
310 | |
311 | return(0); |
312 | } |
313 | |
314 | |
315 | /*++++++++++++++++++++++++++++++++++++++ |
316 | Print out the contents of a node from the routing database. |
317 | |
318 | Nodes *nodes The set of nodes to use. |
319 | |
320 | index_t item The node index to print. |
321 | ++++++++++++++++++++++++++++++++++++++*/ |
322 | |
323 | static void print_node(Nodes* nodes,index_t item) |
324 | { |
325 | Node *node=LookupNode(nodes,item); |
326 | double latitude,longitude; |
327 | |
328 | GetLatLong(nodes,item,&latitude,&longitude); |
329 | |
330 | printf("Node %d\n",item); |
331 | printf(" firstseg=%d\n",SEGMENT(node->firstseg)); |
332 | printf(" latoffset=%d lonoffset=%d (latitude=%.6f longitude=%.6f)\n",node->latoffset,node->lonoffset,radians_to_degrees(latitude),radians_to_degrees(longitude)); |
333 | if(IsSuperNode(nodes,item)) |
334 | printf(" Super-Node\n"); |
335 | } |
336 | |
337 | |
338 | /*++++++++++++++++++++++++++++++++++++++ |
339 | Print out the contents of a segment from the routing database. |
340 | |
341 | Segments *segments The set of segments to use. |
342 | |
343 | index_t item The segment index to print. |
344 | ++++++++++++++++++++++++++++++++++++++*/ |
345 | |
346 | static void print_segment(Segments *segments,index_t item) |
347 | { |
348 | Segment *segment=LookupSegment(segments,item); |
349 | |
350 | printf("Segment %d\n",item); |
351 | printf(" node1=%d node2=%d\n",segment->node1,segment->node2); |
352 | printf(" next2=%d\n",segment->next2); |
353 | printf(" way=%d\n",segment->way); |
354 | printf(" distance=%d (%.3f km)\n",DISTANCE(segment->distance),distance_to_km(DISTANCE(segment->distance))); |
355 | if(IsSuperSegment(segment) && IsNormalSegment(segment)) |
356 | printf(" Super-Segment AND normal Segment\n"); |
357 | else if(IsSuperSegment(segment) && !IsNormalSegment(segment)) |
358 | printf(" Super-Segment\n"); |
359 | if(IsOnewayTo(segment,segment->node1)) |
360 | printf(" One-Way from node2 to node1\n"); |
361 | if(IsOnewayTo(segment,segment->node2)) |
362 | printf(" One-Way from node1 to node2\n"); |
363 | } |
364 | |
365 | |
366 | /*++++++++++++++++++++++++++++++++++++++ |
367 | Print out the contents of a way from the routing database. |
368 | |
369 | Ways *ways The set of ways to use. |
370 | |
371 | index_t item The way index to print. |
372 | ++++++++++++++++++++++++++++++++++++++*/ |
373 | |
374 | static void print_way(Ways *ways,index_t item) |
375 | { |
376 | Way *way=LookupWay(ways,item); |
377 | |
378 | printf("Way %d\n",item); |
379 | printf(" name=%s\n",WayNameHighway(ways,way)); |
380 | printf(" type=%02x (%s%s%s)\n",way->type,HighwayName(HIGHWAY(way->type)),way->type&Way_OneWay?",One-Way":"",way->type&Way_Roundabout?",Roundabout":""); |
381 | printf(" allow=%02x (%s)\n",way->allow,AllowedNameList(way->allow)); |
382 | if(way->props) |
383 | printf(" props=%02x (%s)\n",way->props,PropertiesNameList(way->props)); |
384 | if(way->speed) |
385 | printf(" speed=%d (%d km/hr)\n",way->speed,speed_to_kph(way->speed)); |
386 | if(way->weight) |
387 | printf(" weight=%d (%.1f tonnes)\n",way->weight,weight_to_tonnes(way->weight)); |
388 | if(way->height) |
389 | printf(" height=%d (%.1f m)\n",way->height,height_to_metres(way->height)); |
390 | if(way->width) |
391 | printf(" width=%d (%.1f m)\n",way->width,width_to_metres(way->width)); |
392 | if(way->length) |
393 | printf(" length=%d (%.1f m)\n",way->length,length_to_metres(way->length)); |
394 | } |
395 | |
396 | |
397 | /*++++++++++++++++++++++++++++++++++++++ |
398 | Print out a header in OSM XML format. |
399 | ++++++++++++++++++++++++++++++++++++++*/ |
400 | |
401 | static void print_head_osm(void) |
402 | { |
403 | printf("<?xml version='1.0' encoding='UTF-8'?>\n"); |
404 | printf("<osm version='0.6' generator='JOSM'>\n"); |
405 | } |
406 | |
407 | |
408 | /*++++++++++++++++++++++++++++++++++++++ |
409 | Print out the contents of a node from the routing database in OSM XML format. |
410 | |
411 | Nodes *nodes The set of nodes to use. |
412 | |
413 | index_t item The node index to print. |
414 | ++++++++++++++++++++++++++++++++++++++*/ |
415 | |
416 | static void print_node_osm(Nodes* nodes,index_t item) |
417 | { |
418 | double latitude,longitude; |
419 | |
420 | GetLatLong(nodes,item,&latitude,&longitude); |
421 | |
422 | if(IsSuperNode(nodes,item)) |
423 | { |
424 | printf(" <node id='%lu' lat='%.7f' lon='%.7f' version='1'>\n",(unsigned long)item+1,radians_to_degrees(latitude),radians_to_degrees(longitude)); |
425 | printf(" <tag k='routino:super' v='yes' />\n"); |
426 | printf(" </node>\n"); |
427 | } |
428 | else |
429 | printf(" <node id='%lu' lat='%.7f' lon='%.7f' version='1' />\n",(unsigned long)item+1,radians_to_degrees(latitude),radians_to_degrees(longitude)); |
430 | } |
431 | |
432 | |
433 | /*++++++++++++++++++++++++++++++++++++++ |
434 | Print out the contents of a segment from the routing database as a way in OSM XML format. |
435 | |
436 | Segments *segments The set of segments to use. |
437 | |
438 | index_t item The segment index to print. |
439 | |
440 | Ways *ways The set of ways to use. |
441 | ++++++++++++++++++++++++++++++++++++++*/ |
442 | |
443 | static void print_segment_osm(Segments *segments,index_t item,Ways *ways) |
444 | { |
445 | Segment *segment=LookupSegment(segments,item); |
446 | Way *way=LookupWay(ways,segment->way); |
447 | int i; |
448 | |
449 | printf(" <way id='%lu' version='1'>\n",(unsigned long)item+1); |
450 | |
451 | if(IsOnewayTo(segment,segment->node1)) |
452 | { |
453 | printf(" <nd ref='%lu' />\n",(unsigned long)segment->node2+1); |
454 | printf(" <nd ref='%lu' />\n",(unsigned long)segment->node1+1); |
455 | } |
456 | else |
457 | { |
458 | printf(" <nd ref='%lu' />\n",(unsigned long)segment->node1+1); |
459 | printf(" <nd ref='%lu' />\n",(unsigned long)segment->node2+1); |
460 | } |
461 | |
462 | if(IsSuperSegment(segment)) |
463 | printf(" <tag k='routino:super' v='yes' />\n"); |
464 | if(IsNormalSegment(segment)) |
465 | printf(" <tag k='routino:normal' v='yes' />\n"); |
466 | |
467 | if(way->type & Way_OneWay) |
468 | printf(" <tag k='oneway' v='yes' />\n"); |
469 | if(way->type & Way_Roundabout) |
470 | printf(" <tag k='junction' v='roundabout' />\n"); |
471 | |
472 | printf(" <tag k='highway' v='%s' />\n",HighwayName(HIGHWAY(way->type))); |
473 | |
474 | if(IsNormalSegment(segment) && WayNamed(ways,way)) |
475 | printf(" <tag k='name' v='%s' />\n",ParseXML_Encode_Safe_XML(WayNameHighway(ways,way))); |
476 | |
477 | for(i=1;i<Transport_Count;i++) |
478 | if(way->allow & ALLOWED(i)) |
479 | printf(" <tag k='%s' v='yes' />\n",TransportName(i)); |
480 | |
481 | for(i=1;i<Property_Count;i++) |
482 | if(way->props & PROPERTIES(i)) |
483 | printf(" <tag k='%s' v='yes' />\n",PropertyName(i)); |
484 | |
485 | if(way->speed) |
486 | printf(" <tag k='maxspeed' v='%d' />\n",speed_to_kph(way->speed)); |
487 | |
488 | if(way->weight) |
489 | printf(" <tag k='maxweight' v='%.1f' />\n",weight_to_tonnes(way->weight)); |
490 | if(way->height) |
491 | printf(" <tag k='maxheight' v='%.1f' />\n",height_to_metres(way->height)); |
492 | if(way->width) |
493 | printf(" <tag k='maxwidth' v='%.1f' />\n",width_to_metres(way->width)); |
494 | if(way->length) |
495 | printf(" <tag k='maxlength' v='%.1f' />\n",length_to_metres(way->length)); |
496 | |
497 | printf(" </way>\n"); |
498 | } |
499 | |
500 | |
501 | /*++++++++++++++++++++++++++++++++++++++ |
502 | Print out a tail in OSM XML format. |
503 | ++++++++++++++++++++++++++++++++++++++*/ |
504 | |
505 | static void print_tail_osm(void) |
506 | { |
507 | printf("</osm>\n"); |
508 | } |
509 | |
510 | |
511 | /*+ Conversion from time_t to date string (day of week). +*/ |
512 | static const char* const weekdays[7]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"}; |
513 | |
514 | /*+ Conversion from time_t to date string (month of year). +*/ |
515 | static const char* const months[12]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"}; |
516 | |
517 | |
518 | /*++++++++++++++++++++++++++++++++++++++ |
519 | Convert the time into an RFC 822 compliant date. |
520 | |
521 | char *RFC822Date Returns a pointer to a fixed string containing the date. |
522 | |
523 | time_t t The time. |
524 | ++++++++++++++++++++++++++++++++++++++*/ |
525 | |
526 | static char *RFC822Date(time_t t) |
527 | { |
528 | static char value[32]; |
529 | char weekday[4]; |
530 | char month[4]; |
531 | struct tm *tim; |
532 | |
533 | tim=gmtime(&t); |
534 | |
535 | strcpy(weekday,weekdays[tim->tm_wday]); |
536 | strcpy(month,months[tim->tm_mon]); |
537 | |
538 | /* Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 */ |
539 | |
540 | sprintf(value,"%3s, %02d %3s %4d %02d:%02d:%02d %s", |
541 | weekday, |
542 | tim->tm_mday, |
543 | month, |
544 | tim->tm_year+1900, |
545 | tim->tm_hour, |
546 | tim->tm_min, |
547 | tim->tm_sec, |
548 | "GMT" |
549 | ); |
550 | |
551 | return(value); |
552 | } |
553 | |
554 | |
555 | /*++++++++++++++++++++++++++++++++++++++ |
556 | Print out the usage information. |
557 | |
558 | int detail The level of detail to use - 0 = low, 1 = high. |
559 | ++++++++++++++++++++++++++++++++++++++*/ |
560 | |
561 | static void print_usage(int detail) |
562 | { |
563 | fprintf(stderr, |
564 | "Usage: filedumper [--help]\n" |
565 | " [--dir=<dirname>] [--prefix=<name>]\n" |
566 | " [--statistics]\n" |
567 | " [--visualiser --latmin=<latmin> --latmax=<latmax>\n" |
568 | " --lonmin=<lonmin> --lonmax=<lonmax>\n" |
569 | " --data=<data-type>]\n" |
570 | " [--dump [--node=<node> ...]\n" |
571 | " [--segment=<segment> ...]\n" |
572 | " [--way=<way> ...]]\n" |
573 | " [--dump-osm]\n"); |
574 | |
575 | if(detail) |
576 | fprintf(stderr, |
577 | "\n" |
578 | "--help Prints this information.\n" |
579 | "\n" |
580 | "--dir=<dirname> The directory containing the routing database.\n" |
581 | "--prefix=<name> The filename prefix for the routing database.\n" |
582 | "\n" |
583 | "--statistics Print statistics about the routing database.\n" |
584 | "\n" |
585 | "--visualiser Extract selected data from the routing database:\n" |
586 | " --latmin=<latmin> * the minimum latitude (degrees N).\n" |
587 | " --latmax=<latmax> * the maximum latitude (degrees N).\n" |
588 | " --lonmin=<lonmin> * the minimum longitude (degrees E).\n" |
589 | " --lonmax=<lonmax> * the maximum longitude (degrees E).\n" |
590 | " --data=<data-type> * the type of data to select.\n" |
591 | "\n" |
592 | " <data-type> can be selected from:\n" |
593 | " junctions = segment count at each junction.\n" |
594 | " super = super-node and super-segments.\n" |
595 | " oneway = oneway segments.\n" |
596 | " speed = speed limits.\n" |
597 | " weight = weight limits.\n" |
598 | " height = height limits.\n" |
599 | " width = width limits.\n" |
600 | " length = length limits.\n" |
601 | "\n" |
602 | "--dump Dump selected contents of the database.\n" |
603 | " --node=<node> * the node with the selected number.\n" |
604 | " --segment=<segment> * the segment with the selected number.\n" |
605 | " --way=<way> * the way with the selected number.\n" |
606 | " Use 'all' instead of a number to get all of them.\n" |
607 | "\n" |
608 | "--dump-osm Dump the whole database as an OSM format XML file.\n"); |
609 | |
610 | exit(!detail); |
611 | } |
Properties
Name | Value |
---|---|
cvs:description | Test program for mmap files. |