mapweaver/mw.pl

88 lines
2.1 KiB
Perl
Executable File

#
# PERL mapweaver by gary68 & atlas48
#
# Copyright(C)2011, Gerhard Schwanz
#
# 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
# Free Software Foundation; either version 3 of the License, or(at your option)any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>
#
# TODO
# -different tempfilenames
my $version = "0.48";
my $programName = "mapweaver";
use strict; use warnings;
use OSM::osm;
use mwConfig;
use mwMap;
use mwRules;
use mwFile;
use mwNodes;
use mwWays;
use mwRelations;
use mwMulti;
use mwMisc;
use mwOccupy;
use mwGPX;
my $time0 = time();
print "\n$programName $version by gary68\n\n";
initConfig;
getProgramOptions;
readConfigFile cv('ini');
if(cv('help')eq "1"){ printConfigDescriptions;
printValidObjectProperties;
die "quit after help output\n";
}
printConfig if cv('verbose');
readRules;
if(cv('debug')eq "1"){ printNodeRules;
printWayRules;
printAreaRules;
printRouteRules;
}
readFile;
my $renderTime0 = time();
adaptRuleSizes;
unless(cv('multionly')){ processNodes;
createPoiDirectory()if cv('poi');
initOneways;
processWays;
createDirectory if cv('dir');
createDirPdf if cv('dirpdf');
processRoutes;
}
processMultipolygons;
createLegend if cv('legend');
processPageNumbers if cv('pagenumbers');
processRectanglesif if cv('rectangles');
boxDrawOccupiedAreas if cv('test');
processGPXFile if cv('gpx');
writeMap;
my $renderTime1 = time();
my($paper, $x, $y)= fitsPaper();
$x = int($x*10)/10;
$y = int($y*10)/10;
print "map($x cm x $y cm)fits paper $paper\n\n";
my $time1 = time();
print "\nrender time(excluding all file operations)", stringTimeSpent($renderTime1-$renderTime0), "\n";
print "\n$programName finished after ", stringTimeSpent($time1-$time0), "\n\n";