source: subversion/applications/utils/gary68/mw.pl @ 30595

Last change on this file since 30595 was 29098, checked in by gary68, 7 years ago

shield error in mapweaver corrected

File size: 4.7 KB
Line 
1#
2# PERL mapweaver by gary68
3#
4#
5#
6#
7# Copyright (C) 2011, Gerhard Schwanz
8#
9# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the
10# Free Software Foundation; either version 3 of the License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>
16#
17
18
19
20# 0.03 20110614 -help
21# 0.03 20110614 square for nodes
22# 0.03 print prg name and version
23# 0.03 ruler
24# 0.04 ruler positions; ruler background; disc opacity correction; -debug; -verbose
25# 0.04 scale, colors and positions; header/footer
26# 0.04 triangle and diamond for nodes; labels and icons for nodes
27# 0.05 categories for config values
28# 0.06 drawArea; area rules; extended help, added valid object properties
29# 0.07 way labels; minsizearea implemented;
30# 0.08 added coastlines; problems with completeObjects! use option -cie
31# 0.09 oneways
32# 0.10 pagenumbers; rectangles; comments and empty lines in rule file; config in rule file
33# 0.10 coast lines fixed; auto bridge implemented
34# 0.11 area icons / patterns added; time; street directory; poi directory; pdf directoriy
35# 0.12 way shields
36# 0.13 routes, not yet working...
37# 0.14 route work
38# 0.15 routes working now - finetuning needed; bgbolor implemented; multipolygons
39# 0.16 size check for multipolygon areas; scale rule sizes (x:y)
40# 0.17 -forcenodes; projection in footer
41# 0.18 direxclude options and rule properties
42# 0.19 pagenumber bug solved
43# 0.20 legend
44# 0.21 legend in separate file
45# 0.22 help texts for object properties in rule file
46# 0.23 latex string sanitize
47# 0.24 labels for areas
48# 0.25 labels for multipolygons
49# 0.26 fix directory bugs
50# 0.27 way name substitution, if name is too long for way. incl. legend for map
51# 0.28 oceancolor bug fixed
52# 0.29 fonts/families
53# 0.30 -wns=5 now possible; way name substitutions in separate file
54# 0.31 getXXXrule bug fixed; wnsunique
55# 0.32 -targetSize
56# 0.33 -onewayautosize
57# 0.34 pbf support; halo; label transform; bold print of labels
58# 0.35 svg text creation bug fixed
59# 0.36 font size error wns corrected; box occupy; new place management
60# 0.37 -dirprg program to create directory; gpx support
61# 0.38 -gpxcolor; -gpxsize
62# 0.39 parameter bug dirprg fixed; sanitize bug fixed
63# 0.40 draw only items inside drawing area; check for undefined relation nodes, reduce errors
64# 0.41 fixed icon space occupy error; eliminated labels drawn outside map area
65# 0.42 fixed error with area label svg string
66# 0.43 check if areas (simple ways) are closed before drawing
67# 0.44 overpass options added
68# 0.45 utf-8 encoding error solved for overpass data
69# 0.46 out parameter fixed
70# 0.47 added srtm option
71# 0.48 shield error corrected
72
73
74# TODO
75# -different tempfilenames
76
77my $version = "0.48" ;
78my $programName = "mapweaver" ;
79
80use strict ;
81use warnings ;
82
83use OSM::osm ;
84use mwConfig ;
85use mwMap ;
86use mwRules ;
87use mwFile ;
88use mwNodes ;
89use mwWays ;
90use mwRelations ;
91use mwMulti ;
92use mwMisc ;
93use mwOccupy ;
94use mwGPX ;
95
96my $time0 = time() ; 
97
98
99print "\n$programName $version by gary68\n\n" ;
100
101initConfig() ;
102
103getProgramOptions() ;
104
105readConfigFile( cv('ini') ) ;
106
107if ( cv('help') eq "1" ) {
108        printConfigDescriptions() ;
109        printValidObjectProperties() ;
110        die ("quit after help output\n") ;
111}
112
113if ( cv('verbose') eq "1" ) {
114        printConfig() ;
115}
116
117readRules() ;
118
119if ( cv('debug') eq "1" ) {
120        printNodeRules() ;
121        printWayRules() ;
122        printAreaRules() ;
123        printRouteRules() ;
124}
125
126readFile() ;
127
128my $renderTime0 = time() ;
129
130adaptRuleSizes() ;
131
132if ( cv('multionly') eq "0" ) {
133
134        processNodes() ;
135
136        if ( cv('poi') eq "1") {
137                createPoiDirectory() ;
138        }
139
140        initOneways() ;
141        processWays() ;
142
143        if ( cv('dir') eq "1") {
144                createDirectory() ;
145        }
146
147        if ( cv('dirpdf') eq "1") {
148                createDirPdf() ;
149        }
150
151        processRoutes() ;
152
153} # multionly
154
155processMultipolygons() ;
156
157
158if ( cv('legend') ne "0" ) { createLegend() ; }
159
160if ( cv('pagenumbers') ne "" ) { processPageNumbers() ; }
161if ( cv('rectangles') ne "" ) { processRectangles() ; }
162
163if ( cv ('test') eq "1") {
164        boxDrawOccupiedAreas() ;
165}
166
167if ( cv ('gpx') ne "") {
168        processGPXFile() ;
169}
170
171
172writeMap() ;
173
174my $renderTime1 = time() ;
175
176
177my ($paper, $x, $y) = fitsPaper () ; $x = int ($x*10) / 10 ; $y = int ($y*10) / 10 ;
178print "map ($x cm x $y cm) fits paper $paper\n\n" ;
179
180my $time1 = time() ;
181print "\nrender time (excluding all file operations) ", stringTimeSpent ($renderTime1-$renderTime0), "\n" ;
182print "\n$programName finished after ", stringTimeSpent ($time1-$time0), "\n\n" ;
183
184
Note: See TracBrowser for help on using the repository browser.