diff -Nru mobile-atlas-creator-1.9.16+dfsg1/build.xml mobile-atlas-creator-2.1.0/build.xml --- mobile-atlas-creator-1.9.16+dfsg1/build.xml 2014-02-06 05:48:14.000000000 +0000 +++ mobile-atlas-creator-2.1.0/build.xml 2018-06-23 07:55:46.000000000 +0000 @@ -1,5 +1,4 @@ - + @@ -18,14 +17,18 @@ - - + + + - + + + + @@ -34,15 +37,16 @@ + + + - + - + @@ -62,17 +66,14 @@ - + - + - - + + @@ -83,8 +84,7 @@ - + @@ -107,9 +107,7 @@ - + @@ -117,8 +115,7 @@ - + @@ -130,33 +127,28 @@ - + - + - + - + - + @@ -166,11 +158,15 @@ - + + + + + + @@ -178,6 +174,19 @@ + + + + + + + + + + + + + @@ -194,125 +203,12 @@ - - - - -libraryjars "${rtlibraryjar}" - -injars - "${jar.name}" - -outjars - build/temp.jar - -keepattributes *Annotation* - -keep class ${main.class} { - public static void main(java.lang.String[]); } - -keep class - mobac.program.* { public *; } - -keep class mobac.program.interfaces.* { - public *; } - -keep class mobac.program.model.package-info - -keep class - mobac.program.model.* { public *; } - -keep class mobac.program.jaxb.* { - public *; } - -keep class mobac.program.interfaces.* { public *; } - -keep - class mobac.program.download.UserAgent { public *; } - -keep class - mobac.exceptions.* { public *; } - -keep class - mobac.program.tilestore.berkeleydb.* { *; } - -keep class - mobac.program.tilestore.TileStoreEntry { public *; } - -keep class - mobac.program.atlascreators.AtlasCreator { public *; } - -keep class - mobac.utilities.beanshell.* { public *; } - -keep class - mobac.utilities.tar.TarIndex { public *; } - -keep class - mobac.utilities.tar.TarIndexedArchive { public *; } - -keep class - mobac.data.gpx.gpx11.* { public *; } - -keep class - mobac.mapsources.MapSourceTools { public *; } - -keep class - mobac.mapsources.MapSourceUrlUpdater { public *; } - -keep class - mobac.mapsources.custom.* { *; } - -keep class org.apache.log4j.Layout { - public *; } - -keep class org.apache.log4j.Level { public *; } - -keep - class org.apache.commons.lang3.StringEscapeUtils { public *; } - -keep - class org.apache.log4j.Category { public *; } - -keep class - org.apache.log4j.Priority { public *; } - -keep class - org.apache.log4j.spi.LoggingEvent { public *; } - -keep class - org.apache.log4j.spi.ThrowableInformation { public *; } - -keep class - org.apache.log4j.spi.LocationInfo { public *; } - -keep class - org.apache.log4j.PatternLayout { public *; } - -keep class - org.apache.log4j.Appender { public *; } - -keep class - org.apache.log4j.FileAppender { public *; } - -keep class - com.sixlegs.png.PngImage { public *; } - -keep class bsh.This { public - *; } - -keep class bsh.XThis { public *; } - -keep class - com.sleepycat.persist.PrimaryIndex { public *; } - -keepclassmembers - enum * { - public static **[] values(); - public static ** - valueOf(java.lang.String); - } - -keepclassmembers class * - implements - java.io.Serializable { - static final long serialVersionUID; - private void - writeObject(java.io.ObjectOutputStream); - private void - readObject(java.io.ObjectInputStream); - java.lang.Object - writeReplace(); - java.lang.Object readResolve(); - } - -keepclassmembers - class * implements - com.sleepycat.persist.evolve.Conversion { - boolean - equals(java.lang.Object); - } - -dontnote java.** - -dontnote javax.** - -dontnote com.sun.** - -dontnote sun.** - -dontwarn - -dontoptimize - -dontobfuscate - - - - - + - + @@ -327,11 +223,11 @@ - + + @@ -348,8 +244,7 @@ - + diff -Nru mobile-atlas-creator-1.9.16+dfsg1/CHANGELOG.txt mobile-atlas-creator-2.1.0/CHANGELOG.txt --- mobile-atlas-creator-1.9.16+dfsg1/CHANGELOG.txt 2014-02-06 05:48:18.000000000 +0000 +++ mobile-atlas-creator-2.1.0/CHANGELOG.txt 2018-06-23 07:44:28.000000000 +0000 @@ -11,6 +11,71 @@ ======= +2.1.0 (2018-??-??) + ! 4uMaps.eu fixed + ~ Mapsforge updated to version 0.9.1 + - Removed: map source OpenPisteMap (does not exist anymore) + + JAXB libraries included into MOBAC (for Java 9+) + +2.0.1 (2017-11-11) + ! Fixed: Custom maps source loading problem when using custom map sources in a + custom multi-layer map source (#294) + ~ Clean-up: USGS map sources (some removed, some updated) + + Extra start commands for Java 9: + "start_java9.sh", "Mobile Atlas Creator Java9.exe" + +2.0.0 (2017-04-14) + ~ Mapsforge library updated to version 0.8.0 + ~ SQLite-jdbc library updated to version 3.16.1 + +2.0.0 beta 3 (2017-01-02) + ~ Mapsforge library updated to version 0.7.0 + ! Fixed multi-threading problem for MapsForge maps (truncated labels) + ~ Updated xerial sqlite-jdbc library to version 3.8.11.2 + ! Fixed: Mapsforge cusom map did not had an effect + + New: Mapsforge custom map property + - MapQuest map source deleted (map not available anymore) + + Custom Mapsforge Map: Multiple map files ( elements) are now + possible (see example) + ! Fixed: MOBAC on Windows now works when started on UNC network path + +2.0.0 beta 2 (2016-04-24) + ! Fixed New Zealand Topographic Maps (see bug #282 & patch #43) + - Removed maps: OpenStreetMap Mapnik and OpenSeaMap (maps are no longer + available for MOBAC) + + Left panel is now resizeable by mouse + + Refreshing the preview map view via "F5" now clears the label cache of + Mapsforge maps + + BeanShell map source: "displayName" added (allows to use non-ascii characters + as map name shown in MOBAC + +2.0.0 beta 1 (2015-11-26) + ~ Mapsforge library updated to version 0.6.0 + ~ Map pack update certificate re-created due to expired certificate. + The map pack update url changed, old MOBAC versions can no longer receive + map pack online updates. + ! NzTopoMaps updated to new schema + +2.0.0 alpha 4 (2015-09-01) + + Canada Toporama map source reactivated + ~ Mapsforge library updated to version 0.5.2 + +2.0.0 alpha 3 (2015-04-16) + ~ Mapsforge vector maps library updated to 0.5.1 + ! Mapsforge custom caching implemented (required for correct label rendering) + +2.0.0 alpha 2 (2014-10-31) + ! Fixed problems using mapsforge vector maps as a layer of a multi-layer map + ! TrekBuddyTar: test added for too long layer & map names + + Maverick: Old atlas format (.jpg.tile) reactivated as additional atlas format. + + New atlas format (experimental): GeoPackage + +2.0.0 alpha 1 (2014-07-31) + ~ GUI design improved + + Custom map sources can be grouped by subdirectories + + Direct rendering of bitmap tiles based on mapsforge vector maps + (see README.HTM for details). + 1.9.16 (2014-02-06) ! Background color does not work in case of a multi-layer map source with only one layer (#252) diff -Nru mobile-atlas-creator-1.9.16+dfsg1/.classpath mobile-atlas-creator-2.1.0/.classpath --- mobile-atlas-creator-1.9.16+dfsg1/.classpath 2014-02-06 05:48:18.000000000 +0000 +++ mobile-atlas-creator-2.1.0/.classpath 2018-06-23 07:35:02.000000000 +0000 @@ -4,7 +4,11 @@ - + + + + + @@ -19,19 +23,31 @@ - - - + + + + + + + + + - + + + + + + + diff -Nru mobile-atlas-creator-1.9.16+dfsg1/debian/changelog mobile-atlas-creator-2.1.0/debian/changelog --- mobile-atlas-creator-1.9.16+dfsg1/debian/changelog 2014-03-18 18:19:59.000000000 +0000 +++ mobile-atlas-creator-2.1.0/debian/changelog 2019-03-05 08:48:41.000000000 +0000 @@ -1,3 +1,22 @@ +mobile-atlas-creator (2.1.0-1~18.04.1) bionic; urgency=medium + + * Backport from Disco. + * Updated to fix build and runtime incompatibility with OpenJDK 11. + (LP: #1814133) + + -- Tiago Stürmer Daitx Tue, 05 Mar 2019 08:48:41 +0000 + +mobile-atlas-creator (2.1.0-1) unstable; urgency=low + + * New upstream release + - Now build with Java 9 (Closes: #874159) + * Remove debian/menu: we already provide the desktop file + * Bump Standards-Version to 4.2.1: nothing needs to be changed + * Bump debhelper version to 11 + * Update debian/control to describe this app as mobac (Closes: #777693) + + -- Ying-Chun Liu (PaulLiu) Tue, 27 Nov 2018 13:23:51 +0800 + mobile-atlas-creator (1.9.16+dfsg1-1) unstable; urgency=low * New upstream release diff -Nru mobile-atlas-creator-1.9.16+dfsg1/debian/compat mobile-atlas-creator-2.1.0/debian/compat --- mobile-atlas-creator-1.9.16+dfsg1/debian/compat 2012-05-06 07:49:40.000000000 +0000 +++ mobile-atlas-creator-2.1.0/debian/compat 2018-11-27 05:14:45.000000000 +0000 @@ -1 +1 @@ -9 +11 diff -Nru mobile-atlas-creator-1.9.16+dfsg1/debian/control mobile-atlas-creator-2.1.0/debian/control --- mobile-atlas-creator-1.9.16+dfsg1/debian/control 2014-03-18 18:20:10.000000000 +0000 +++ mobile-atlas-creator-2.1.0/debian/control 2018-11-27 05:23:33.000000000 +0000 @@ -2,25 +2,30 @@ Section: utils Priority: optional Maintainer: Ying-Chun Liu (PaulLiu) -Build-Depends: debhelper (>= 9), docbook-xsl, javahelper, netpbm, xsltproc +Build-Depends: debhelper (>= 11), docbook-xsl, javahelper, netpbm, xsltproc Build-Depends-Indep: ant, ant-contrib, ant-optional, bsh, default-jdk, + libactivation-java, libcommons-codec-java, libcommons-io-java, libcommons-lang3-java, libdb-je-java (>= 3.3.93), + libistack-commons-java, libitext5-java, libjtidy-java, + libkxml2-java, liblog4j1.2-java, + libmapsforge-java, libpng-sixlegs-java, + libsvgsalamander-java, libsvn-java, libsvnkit-java, proguard, svnkit -Standards-Version: 3.9.5 +Standards-Version: 4.2.1 Homepage: https://sourceforge.net/projects/mobac/ Package: mobile-atlas-creator @@ -32,4 +37,4 @@ Description: program to create offline atlases for GPS/cell phone applications Formerly known as "TrekBuddy Atlas Creator". This application creates off-line atlases for the J2ME application TrekBuddy and various other mobile - applications on Android and WindowsCE. + applications on Android and WindowsCE. The abbreviation of ths app is mobac. diff -Nru mobile-atlas-creator-1.9.16+dfsg1/debian/copyright mobile-atlas-creator-2.1.0/debian/copyright --- mobile-atlas-creator-1.9.16+dfsg1/debian/copyright 2012-05-24 15:17:23.000000000 +0000 +++ mobile-atlas-creator-2.1.0/debian/copyright 2018-11-27 05:01:58.000000000 +0000 @@ -4,6 +4,7 @@ Robert Source: http://sourceforge.net/projects/mobac/ We removed lib/*.jar because those binaries don't contain source code. +Files-Excluded: lib/*.jar *.exe Files: * Copyright: 2010 MOBAC developers diff -Nru mobile-atlas-creator-1.9.16+dfsg1/debian/install mobile-atlas-creator-2.1.0/debian/install --- mobile-atlas-creator-1.9.16+dfsg1/debian/install 2012-06-05 18:51:03.000000000 +0000 +++ mobile-atlas-creator-2.1.0/debian/install 2018-11-27 05:16:25.000000000 +0000 @@ -1,6 +1,6 @@ Mobile_Atlas_Creator.jar usr/share/mobile-atlas-creator debian/bin/mobile-atlas-creator usr/bin debian/usr/directories.ini usr/share/mobile-atlas-creator +debian/usr/mobile-atlas-creator.desktop usr/share/applications mapsources usr/share/mobile-atlas-creator mobac.xpm usr/share/pixmaps/mobile-atlas-creator -debian/usr/mobile-atlas-creator.desktop usr/share/applications diff -Nru mobile-atlas-creator-1.9.16+dfsg1/debian/menu mobile-atlas-creator-2.1.0/debian/menu --- mobile-atlas-creator-1.9.16+dfsg1/debian/menu 2011-02-19 18:22:29.000000000 +0000 +++ mobile-atlas-creator-2.1.0/debian/menu 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -?package(mobile-atlas-creator):needs="X11" \ - section="Applications/Science/Geoscience" \ - title="mobile-atlas-creator" command="/usr/bin/mobile-atlas-creator" \ - icon="/usr/share/pixmaps/mobile-atlas-creator/mobac.xpm" diff -Nru mobile-atlas-creator-1.9.16+dfsg1/debian/mobile-atlas-creator.xml mobile-atlas-creator-2.1.0/debian/mobile-atlas-creator.xml --- mobile-atlas-creator-1.9.16+dfsg1/debian/mobile-atlas-creator.xml 2010-07-19 09:57:27.000000000 +0000 +++ mobile-atlas-creator-2.1.0/debian/mobile-atlas-creator.xml 2018-11-27 05:23:51.000000000 +0000 @@ -129,4 +129,26 @@ OPTIONS The program does not have any options. + + FILES + + + ${HOME}/.config/mobac + + The directory for per-user configuration files to control the + behaviour of &dhpackage;. You might need + to delete this directory when upgrading to newer versions. + + + + + ${HOME}/.mobac + + The directory for per-user cache. You might need + to delete this directory when upgrading to newer versions. + + + + + diff -Nru mobile-atlas-creator-1.9.16+dfsg1/debian/patches/01_use_system_lib.patch mobile-atlas-creator-2.1.0/debian/patches/01_use_system_lib.patch --- mobile-atlas-creator-1.9.16+dfsg1/debian/patches/01_use_system_lib.patch 2014-03-18 18:23:03.000000000 +0000 +++ mobile-atlas-creator-2.1.0/debian/patches/01_use_system_lib.patch 2018-11-27 05:14:30.000000000 +0000 @@ -3,14 +3,17 @@ We are going to use the system provided instead of the embedded ones. Author: Ying-Chun Liu (PaulLiu) Last-Update: 2011-02-19 -Index: mobile-atlas-creator-1.9.16+dfsg1/build.xml +Index: mobile-atlas-creator-2.1.0/build.xml =================================================================== ---- mobile-atlas-creator-1.9.16+dfsg1.orig/build.xml 2014-03-19 02:20:34.093564256 +0800 -+++ mobile-atlas-creator-1.9.16+dfsg1/build.xml 2014-03-19 02:22:45.721441798 +0800 -@@ -26,14 +26,16 @@ +--- mobile-atlas-creator-2.1.0.orig/build.xml ++++ mobile-atlas-creator-2.1.0/build.xml +@@ -26,20 +26,28 @@ +- +- +- - - - @@ -18,20 +21,35 @@ - - - -+ -+ -+ -+ -+ -+ -+ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ -+ -+ +- +- +- ++ ++ ++ ++ ++ ++ ++ ++ - +@@ -89,7 +97,7 @@ @@ -40,15 +58,20 @@ -@@ -167,17 +169,8 @@ +@@ -158,35 +166,8 @@ + - -+ value="./ sqlite-jdbc-${sqlite-version}.jar sqlite.jar jai_core.jar jai_codec.jar jai_*.jar /usr/share/java/db-je.jar /usr/share/java/bsh.jar /usr/share/java/commons-codec.jar /usr/share/java/commons-io.jar /usr/share/java/commons-lang3.jar /usr/share/java/jtidy.jar /usr/share/java/itext5.jar /usr/share/java/png.jar /usr/share/java/log4j-1.2.jar" /> +- ++ - - +- +- +- +- +- - - - @@ -56,15 +79,19 @@ - - - +- +- +- +- +- +- +- +- +- +- +- +- +- -@@ -197,7 +190,7 @@ - -- -+ - - -libraryjars "${rtlibraryjar}" - -injars diff -Nru mobile-atlas-creator-1.9.16+dfsg1/debian/patches/03_dont_use_jai.patch mobile-atlas-creator-2.1.0/debian/patches/03_dont_use_jai.patch --- mobile-atlas-creator-1.9.16+dfsg1/debian/patches/03_dont_use_jai.patch 2014-03-18 18:23:17.000000000 +0000 +++ mobile-atlas-creator-2.1.0/debian/patches/03_dont_use_jai.patch 2018-11-27 04:51:20.000000000 +0000 @@ -2,11 +2,11 @@ We don't have it in Debian yet. Remove the support of PNG8 and PNG4 savings. Author: Ying-Chun Liu (PaulLiu) Last-Update: 2011-02-19 -Index: mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/optional/JavaAdvancedImaging.java +Index: mobile-atlas-creator-2.1.0/src/main/java/mobac/optional/JavaAdvancedImaging.java =================================================================== ---- mobile-atlas-creator-1.9.16+dfsg1.orig/src/main/java/mobac/optional/JavaAdvancedImaging.java 2014-03-19 02:23:14.163672422 +0800 -+++ mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/optional/JavaAdvancedImaging.java 2014-03-19 02:23:14.155672920 +0800 -@@ -20,9 +20,6 @@ +--- mobile-atlas-creator-2.1.0.orig/src/main/java/mobac/optional/JavaAdvancedImaging.java ++++ mobile-atlas-creator-2.1.0/src/main/java/mobac/optional/JavaAdvancedImaging.java +@@ -20,9 +20,6 @@ import java.awt.Color; import java.awt.Graphics; import java.awt.image.BufferedImage; @@ -16,7 +16,7 @@ /** * Centralizes all methods that require the optional Java Advanced Imaging * library. -@@ -48,9 +45,19 @@ +@@ -48,9 +45,19 @@ public class JavaAdvancedImaging { g.dispose(); image = trueColorImage; } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/debian/README.Debian mobile-atlas-creator-2.1.0/debian/README.Debian --- mobile-atlas-creator-1.9.16+dfsg1/debian/README.Debian 1970-01-01 00:00:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/debian/README.Debian 2018-11-27 05:23:51.000000000 +0000 @@ -0,0 +1,7 @@ +mobac for Debian +----------------------- + +When upgrading to newer versions, you might need to clean ~/.config/mobac +and ~/.mobac + + -- Ying-Chun Liu (PaulLiu) Tue, 27 Nov 2018 13:23:51 +0800 diff -Nru mobile-atlas-creator-1.9.16+dfsg1/debian/usr/mobile-atlas-creator.desktop mobile-atlas-creator-2.1.0/debian/usr/mobile-atlas-creator.desktop --- mobile-atlas-creator-1.9.16+dfsg1/debian/usr/mobile-atlas-creator.desktop 2012-06-05 18:39:36.000000000 +0000 +++ mobile-atlas-creator-2.1.0/debian/usr/mobile-atlas-creator.desktop 2018-11-27 05:09:02.000000000 +0000 @@ -54,6 +54,5 @@ TryExec=/usr/bin/mobile-atlas-creator Exec=/usr/bin/mobile-atlas-creator Terminal=false -MimeType= Categories=Education;Geography diff -Nru mobile-atlas-creator-1.9.16+dfsg1/misc/launch4j.xml mobile-atlas-creator-2.1.0/misc/launch4j.xml --- mobile-atlas-creator-1.9.16+dfsg1/misc/launch4j.xml 2014-02-06 05:48:14.000000000 +0000 +++ mobile-atlas-creator-2.1.0/misc/launch4j.xml 2018-06-23 07:51:36.000000000 +0000 @@ -1,3 +1,4 @@ + true gui @@ -9,27 +10,32 @@ normal http://java.com/download - false false + false mobac.ico - 1.6.0_14 + false + false + 1.7.0 preferJre - 1024 + 64/32 + 1200 - 1.0.0.0 + 2.1.0.0 - Mobile Atlas Creator Windows Launcher MOBAC developers - 1.0.0.0 + 2.1.0.0 - Mobile Atlas Creator - Mobile Atlas Creator 1024MB max Heap + Mobile Atlas Creator 1200MB max Heap Mobile Atlas Creator.exe + + ENGLISH_US \ No newline at end of file diff -Nru mobile-atlas-creator-1.9.16+dfsg1/README.HTM mobile-atlas-creator-2.1.0/README.HTM --- mobile-atlas-creator-1.9.16+dfsg1/README.HTM 2014-02-06 05:47:54.000000000 +0000 +++ mobile-atlas-creator-2.1.0/README.HTM 2017-01-23 01:32:16.000000000 +0000 @@ -118,6 +118,8 @@
  • Custom BeanShell map sources
  • Custom MapPack
  • +
  • MOBAC integrated rendering of + tiles based on OpenStreetmap (mapsforge) vector data
  • Custom atlas as map source / locally generated tiles
  • @@ -159,9 +161,7 @@

    Requirements

    -

    This application requires that a Java Runtime Environment - Version 6 Update 14 (v1.6.0_14) or higher is installed on the - computer.

    +

    This application requires that a Java SE Runtime Environment 7 or higher is installed on the computer.

    If you have the choice between different Java Runtimes you should prefer the Java Runtime provided by Sun/Oracle. Especially the OpenJDK has some bugs regarding MOBAC and tends to crash on certain @@ -1029,7 +1029,7 @@ If have a new online map which is not available in Mobile Atlas Creator there my be change to add it. Before opening a Feature Request please take a look into the list + href="http://svn.code.sf.net/p/mobac/code/tags/MOBAC%202.0/v2.0.0%20beta%203/misc/Incompatible%20maps.txt">list of map sources known to incompatible with Mobile Atlas Creator.

    @@ -1122,7 +1122,7 @@

    For changing the directory configuration pattern for all users of a MOBAC installation save this + href="http://svn.code.sf.net/p/mobac/code/tags/MOBAC%202.0/v2.0.0%20beta%203/directories.ini.template">this file into the same directory where Mobile_Atlas_Creator.jar has been installed into and change it's name to @@ -1203,7 +1203,7 @@

    Annotated + href="http://svn.code.sf.net/p/mobac/code/tags/MOBAC%202.0/v2.0.0%20beta%203/tools/test.xml">Annotated sample file download

    @@ -1299,7 +1299,7 @@

    Example file for download: + href="http://svn.code.sf.net/p/mobac/code/tags/MOBAC%202.0/v2.0.0%20beta%203/mapsources/Example%20custom%20map%20source.xml"> Example custom map source.xml

    @@ -1325,7 +1325,7 @@ </customWmsMapSource>

    Example file (with comments) for download: + href="http://svn.code.sf.net/p/mobac/code/tags/MOBAC%202.0/v2.0.0%20beta%203/mapsources/Example%20custom%20WMS%20map%20source.xml"> Example custom WMS map source.xml

    @@ -1343,6 +1343,7 @@ <customMultiLayerMapSource> <name>Custom OSM Mapnik with Hills (Ger)</name> <tileType>PNG</tileType> + <backgroundColor>#000000</backgroundColor> <layers> <customMapSource> <name>Custom OSM Mapnik</name> @@ -1351,7 +1352,6 @@ <tileType>PNG</tileType> <tileUpdate>None</tileUpdate> <url>http://tile.openstreetmap.org/{$z}/{$x}/{$y}.png</url> - <backgroundColor>#000000</backgroundColor> </customMapSource> <customMapSource> <name>Custom transparent hillshade</name> @@ -1366,7 +1366,7 @@

    Example file for download: + href="http://svn.code.sf.net/p/mobac/code/tags/MOBAC%202.0/v2.0.0%20beta%203/mapsources/Example%20custom%20multi-layer%20map%20source.xml"> Example custom multi-layer map source.xml

    @@ -1387,7 +1387,7 @@ </cloudMade>

    Example file for download: + href="http://svn.code.sf.net/p/mobac/code/tags/MOBAC%202.0/v2.0.0%20beta%203/mapsources/Example%20CloudMade1960.xml"> Example CloudMade1960.xml

    @@ -1410,7 +1410,7 @@
    name = "Your map source name here";

    Example file for download: + href="http://svn.code.sf.net/p/mobac/code/tags/MOBAC%202.0/v2.0.0%20beta%203/mapsources/Example%20beanshell%20map%20source.bsh"> Example beanshell map source.bsh

    @@ -1431,6 +1431,60 @@ trunk version.

    +

    + MOBAC integrated rendering of tiles based on + OpenStreetmap (mapsforge) vector data +

    +

    + Since version 2.0 MOBAC includes the mapsforge rendering + engine. This allows MOBAC to render bitmap tiles on-the-fly using + Mapsforge vector data files. Those vector data files can be downloaded + pre-generated for a large number of regions world-wide. Alternatively + you can convert + OpenStreetMap data to mapsforge format on your own. The map rendering + of the vector data can be configured using xml + base render themes. +

    +

    For using mapsforge vector data within MOBAC the following steps + are required:

    +
      +
    1. Download or + create a mapsforge vector data file and save it on your compurter
    2. +
    3. Create a custom XML map source file in the mapsources + subdirectory similar to the example + file.
      +<?xml version="1.0" encoding="UTF-8"?>
      +<mapsforge>
      +	<!-- name of the map - as shown in map source list -->
      +	<name>Custom Mapsforge</name>
      +	
      +	<!-- optional -->
      +	<minZoom>0</minZoom> 
      +	
      +	<!-- optional -->
      +	<maxZoom>20</maxZoom> 
      +	    
      +	<!-- absolute or relative file name -->
      +	<mapFile>mapsforge-test.map</mapFile>
      +	
      +	<!-- optional default OSMARENDERER Theme -->
      +	<!-- <xmlRenderTheme>mytheme.xml</xmlRenderTheme> -->
      +	
      +	<transparent>false</transparent>
      +	
      +	<!-- text size scale factor -->
      +	<textScale>1.0</textScale>
      +	
      +</mapsforge>
      +
      +
    4. +
    5. Start or Restart MOBAC
    6. +

    Custom atlas as map source / locally generated @@ -1440,9 +1494,9 @@ Existing atlases or locally rendered tiles can be directly integrated into MOBAC as custom map source without having to set-up a local web-server.
    At the moment the formats used by OSMTracker, - AndNav, Maverick and OSMAND are supported. For - adding such an atlas as map source download the
    Example + AndNav, Maverick and OSMAND are supported. For adding such an atlas as + map source download the Example custom tile files source.xml file, adapt the <sourceFolder> entry and place it in the @@ -1452,14 +1506,15 @@

    Tiles can also be packed into one or more zip files and directly used by MOBAC. For details please see the Example + href="http://svn.code.sf.net/p/mobac/code/tags/MOBAC%202.0/v2.0.0%20beta%203/mapsources/Example%20custom%20tile%20zip%20source.xml">Example custom tile zip source.xml.
    Note: When working with large ZIP files (more than 4 GB) it is required to use Java 7.

    - SQLite based atlas formats can also be used directly by MOBAC. For + SQLite based atlas formats (RMaps, MBTiles, BigPlanetTracks, + NaviComputer or OSMAND) can also be used directly by MOBAC. For details please see the Example + href="http://svn.code.sf.net/p/mobac/code/tags/MOBAC%202.0/v2.0.0%20beta%203/mapsources/Example%20custom%20tile%20SQLite%20source.xml">Example custom tile SQLite source.xml

    diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/exceptions/NotImplementedException.java mobile-atlas-creator-2.1.0/src/main/java/mobac/exceptions/NotImplementedException.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/exceptions/NotImplementedException.java 1970-01-01 00:00:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/exceptions/NotImplementedException.java 2014-10-15 11:27:56.000000000 +0000 @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) MOBAC developers + * + * 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 2 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 . + ******************************************************************************/ +package mobac.exceptions; + +public class NotImplementedException extends RuntimeException { + + private static final String NOT_IMPLEMENTED = "Method not implemented"; + + public NotImplementedException() { + super(NOT_IMPLEMENTED); + } + + public NotImplementedException(Throwable cause) { + super(NOT_IMPLEMENTED, cause); + } + + public NotImplementedException(Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + super(NOT_IMPLEMENTED, cause, enableSuppression, writableStackTrace); + } + +} diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/actions/SettingsButtonListener.java mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/actions/SettingsButtonListener.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/actions/SettingsButtonListener.java 1970-01-01 00:00:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/actions/SettingsButtonListener.java 2014-04-12 11:37:02.000000000 +0000 @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) MOBAC developers + * + * 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 2 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 . + ******************************************************************************/ +package mobac.gui.actions; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import mobac.gui.MainGUI; +import mobac.gui.settings.SettingsGUI; + +public class SettingsButtonListener implements ActionListener { + + @Override + public void actionPerformed(ActionEvent arg0) { + MainGUI mg = MainGUI.getMainGUI(); + SettingsGUI.showSettingsDialog(mg); + } +} \ No newline at end of file diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/actions/SplitPaneHideLeftComponent.java mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/actions/SplitPaneHideLeftComponent.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/actions/SplitPaneHideLeftComponent.java 1970-01-01 00:00:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/actions/SplitPaneHideLeftComponent.java 2016-04-14 11:39:14.000000000 +0000 @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) MOBAC developers + * + * 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 2 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 . + ******************************************************************************/ +package mobac.gui.actions; + +import java.awt.Component; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JSplitPane; + +public class SplitPaneHideLeftComponent implements ActionListener { + + private JSplitPane splitPane; + private Component leftComponent; + private int dividerSize = 0; + + public SplitPaneHideLeftComponent(JSplitPane splitPane) { + super(); + this.splitPane = splitPane; + this.leftComponent = splitPane.getLeftComponent(); + } + + public void actionPerformed(ActionEvent e) { + if (splitPane.getLeftComponent() == null) { + // show left panel + splitPane.setLeftComponent(leftComponent); + splitPane.setDividerSize(dividerSize); + } else { + // hide left panel + dividerSize = splitPane.getDividerSize(); + leftComponent.setPreferredSize(new Dimension(leftComponent.getWidth(), 100)); + splitPane.setDividerSize(0); + splitPane.setLeftComponent(null); + } + splitPane.revalidate(); + } + +} diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/components/JCollapsiblePanel.java mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/components/JCollapsiblePanel.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/components/JCollapsiblePanel.java 2014-02-06 05:48:02.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/components/JCollapsiblePanel.java 2014-09-04 11:21:16.000000000 +0000 @@ -38,13 +38,10 @@ import mobac.utilities.GBC; import mobac.utilities.Utilities; - /** - * Bases upon "TitleContainer" from project "swivel" - * http://code.google.com/p/swivel/ (LGPL license) + * Bases upon "TitleContainer" from project "swivel" http://code.google.com/p/swivel/ (LGPL license) * - * A {@code TitleContainer} is a simple container that provides an easily - * visible title. + * A {@code TitleContainer} is a simple container that provides an easily visible title. * */ public class JCollapsiblePanel extends JPanel { @@ -80,16 +77,6 @@ protected final CollapsingMouseListener collapsingMouseListener; private boolean isCollapsed; - /** - * Constructs a {@code TitleContainer} that wraps the specified container. - * - * @param container - * the main container - */ - public JCollapsiblePanel(Container container) { - this(container, ""); - } - public JCollapsiblePanel(String title) { this(new JPanel(), title); } @@ -100,8 +87,7 @@ } /** - * Constructs a {@code TitleContainer} that wraps the specified component - * and has the specified title. + * Constructs a {@code TitleContainer} that wraps the specified component and has the specified title. * * @param container * the main container @@ -112,7 +98,7 @@ super(); setName(title); titleIcon = new JLabel(arrowOpen); - titleLabel = new JLabel(title); + titleLabel = new JLabel(title + ":"); titlePanel = new JPanel(new GridBagLayout()); // mainComponentPanel = new JPanel(new GridBagLayout()); collapsingMouseListener = new CollapsingMouseListener(); @@ -129,15 +115,28 @@ setTitleBarPadding(DEFAULT_TITLE_PADDING); // layout - titlePanel.add(titleIcon, GBC.std()); - titlePanel.add(titleLabel, GBC.std().insets(5, 0, 1, 0)); - titlePanel.add(Box.createHorizontalGlue(), GBC.eol().fill()); + fillTitlePanel(); + + titlePanel.add(Box.createHorizontalGlue(), GBC.std().fill()); setLayout(new BorderLayout()); add(titlePanel, BorderLayout.NORTH); add(container, BorderLayout.CENTER); setContentContainer(container); setBorder(BorderFactory.createEtchedBorder()); + setTitlePanelPreferredSize(); + } + + protected void fillTitlePanel() { + titlePanel.add(titleIcon, GBC.std()); + titlePanel.add(titleLabel, GBC.std().insets(5, 0, 1, 0)); + } + + private void setTitlePanelPreferredSize() { + Dimension containerPreferredDimension = contentContainer.getLayout().preferredLayoutSize(contentContainer); + Dimension titlePanelPreferredDimension = titlePanel.getPreferredSize(); + titlePanel.setPreferredSize(new Dimension(containerPreferredDimension.width, + titlePanelPreferredDimension.height)); } /** @@ -156,9 +155,7 @@ // We have to make sure that the panel width does not shrink because // of the hidden content of contentContainer - Dimension dcont = contentContainer.getLayout().preferredLayoutSize(contentContainer); - Dimension pref = titlePanel.getPreferredSize(); - titlePanel.setPreferredSize(new Dimension(dcont.width, pref.height)); + setTitlePanelPreferredSize(); } else { titleIcon.setIcon(arrowOpen); } @@ -283,8 +280,8 @@ } /** - * Sets the visibility of the title bar. If the title bar is invisible, the - * user will not be able to collapse or decollapse the container. + * Sets the visibility of the title bar. If the title bar is invisible, the user will not be able to collapse or + * decollapse the container. * * @param visible * visibility of the title bar @@ -302,12 +299,11 @@ return this.titlePanel.isVisible(); } - //-------------------------------------------------------------------------- + // -------------------------------------------------------------------------- /** - * A {@code MouseListener} that changes the cursor when moved over the title - * bar to indicate that it is clickable. Clicking the title bar collapses - * the container. + * A {@code MouseListener} that changes the cursor when moved over the title bar to indicate that it is clickable. + * Clicking the title bar collapses the container. */ private class CollapsingMouseListener extends MouseAdapter { private final Cursor CLICK_ME_CURSOR = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/components/JMapSourceTree.java mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/components/JMapSourceTree.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/components/JMapSourceTree.java 1970-01-01 00:00:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/components/JMapSourceTree.java 2017-10-18 11:21:34.000000000 +0000 @@ -0,0 +1,549 @@ +/******************************************************************************* + * Copyright (c) MOBAC developers + * + * 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 2 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 . + ******************************************************************************/ + +package mobac.gui.components; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Font; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.event.MouseEvent; +import java.io.File; +import java.util.Enumeration; +import java.util.Vector; + +import javax.swing.BorderFactory; +import javax.swing.ImageIcon; +import javax.swing.JTree; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreeNode; +import javax.swing.tree.TreePath; +import javax.swing.tree.TreeSelectionModel; + +import org.apache.commons.lang3.StringEscapeUtils; + +import mobac.mapsources.AbstractMultiLayerMapSource; +import mobac.program.interfaces.FileBasedMapSource; +import mobac.program.interfaces.HttpMapSource; +import mobac.program.interfaces.MapSource; +import mobac.program.model.MapSourceLoaderInfo; +import mobac.utilities.I18nUtils; +import mobac.utilities.Utilities; + +//import org.apache.log4j.Logger; + +/** + * @author Maksym "elmuSSo" Kondej + * + * This class holds methods needed for managing a MapSources loaded into a JTree structure + */ +public class JMapSourceTree extends JTree { + + /** + * ComparableTreeNode is a DefaultMutableTreeNode with a mechanism of comparison with other nodes. This is used when + * putting a node into a tree in an alphabetic order and placing folder nodes above other types of nodes. + */ + class ComparableTreeNode extends DefaultMutableTreeNode implements Comparable { + private static final long serialVersionUID = 1L; + + public ComparableTreeNode(MapSource mapSource) { + super(mapSource); + } + + public ComparableTreeNode(String string) { + super(string); + } + + @Override + public int compareTo(DefaultMutableTreeNode treeNode) { + Class thisObjectClass = this.getUserObject().getClass(); + Class comparedObjectClass = treeNode.getUserObject().getClass(); + + // This rule will always put "folders" above MapSources. + if (thisObjectClass.equals(folderClass) != comparedObjectClass.equals(folderClass)) { + return thisObjectClass.equals(folderClass) ? -1 : 1; + } + + return this.toString().compareToIgnoreCase(treeNode.toString()); + } + + } + + /** + * CustomIconRenderer was created to manage icons within a tree + */ + static class CustomIconRenderer extends DefaultTreeCellRenderer { + private static final long serialVersionUID = 1L; + + private ImageIcon multiLayerIcon, fileBasedIcon, httpIcon, debugIcon, folderOpenedIcon, folderClosedIcon; + + public CustomIconRenderer() { + multiLayerIcon = new ImageIcon(Utilities.getResourceImageUrl("icon_multilayer_ms.png")); + fileBasedIcon = new ImageIcon(Utilities.getResourceImageUrl("icon_filebased_ms.png")); + httpIcon = new ImageIcon(Utilities.getResourceImageUrl("icon_http_ms.png")); + debugIcon = new ImageIcon(Utilities.getResourceImageUrl("icon_debug_ms.png")); + folderOpenedIcon = new ImageIcon(Utilities.getResourceImageUrl("icon_folder_opened.png")); + folderClosedIcon = new ImageIcon(Utilities.getResourceImageUrl("icon_folder_closed.png")); + } + + public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, + boolean leaf, int row, boolean hasFocus) { + super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); + + setTextSelectionColor(getTextNonSelectionColor()); + setBorderSelectionColor(null); + + if (selected) { + // Special style for selected node + this.setFont(getFont().deriveFont(Font.BOLD)); + setBackgroundSelectionColor(mapSourceInTreeHighlightColor); + } else { + this.setFont(getFont().deriveFont(Font.PLAIN)); + setBackgroundSelectionColor(null); + } + + // Adding additional left margin of icon + setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); + + // Setting icons for opened/closed folder + setOpenIcon(folderOpenedIcon); + setClosedIcon(folderClosedIcon); + + Object treeNodeObject = ((DefaultMutableTreeNode) value).getUserObject(); + + // Giving a appropriate icon to each category of MapSource (taken from node's userObject) + if (treeNodeObject instanceof AbstractMultiLayerMapSource) { + setIcon(multiLayerIcon); + } else if (treeNodeObject instanceof FileBasedMapSource) { + setIcon(fileBasedIcon); + } else if (treeNodeObject instanceof HttpMapSource) { + setIcon(httpIcon); + } else if (treeNodeObject instanceof MapSource) { + setIcon(debugIcon); + } + return this; + } + } + + // private final Logger log = Logger.getLogger(JMapSourceTree.class); + private static final long serialVersionUID = 1L; + + // Specifying a class which will determine if a node is a folder + static final Class folderClass = String.class; + + private static Color mapSourceInTreeHighlightColor = new Color(230, 245, 255); + + private Vector mapSources; + private MapSource selectedMapSource, previouslySelectedMapSource; + + private ComparableTreeNode rootNode = new ComparableTreeNode("Maps sources root"); + private DefaultTreeModel treeModel = new DefaultTreeModel(rootNode); + + public JMapSourceTree(Vector enabledOrderedMapSources) { + super(); + // Setting a cell renderer which will provide proper icons behavior + setCellRenderer(new CustomIconRenderer()); + initialize(enabledOrderedMapSources); + setRootVisible(false); + getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); + setExpandsSelectedPaths(true); + setToggleClickCount(1); + setToolTipText(I18nUtils.localizedStringForKey("lp_map_source_tree_tips")); + } + + /** + * This method takes a list of all valid and enabled MapSources, saves them into internal list of MapSources, and + * then generates a tree model basing on them + * + * @param enabledOrderedMapSources + * - list of all MapSources that must be put into a tree. + */ + public void initialize(Vector enabledOrderedMapSources) { + mapSources = enabledOrderedMapSources; + resetTree(); + generateTreeModel(); + super.setModel(treeModel); + } + + /** + * This method will take a MapSource and will analyzed it's folder path to check if there is no need to put it into + * any folders/subfolders structure. + * + * @param mapSource + * - this mapSource's path will be analyzed + */ + private void addChildBasedOnFolderPath(MapSource mapSource) { + MapSourceLoaderInfo loaderInfo = mapSource.getLoaderInfo(); + String[] folderPath = null; + if (loaderInfo != null) { + folderPath = loaderInfo.getRelativePath(); + } + ComparableTreeNode parent = rootNode; + if (folderPath != null) { + for (String folderPathElementName : folderPath) { + + ComparableTreeNode folderPathElement = null; + ComparableTreeNode childFound = getChildByUserObject(parent, folderPathElementName); + + if (childFound != null) { + folderPathElement = childFound; + } else { + folderPathElement = new ComparableTreeNode(folderPathElementName); + insertInRightOrder(parent, folderPathElement); + } + parent = folderPathElement; + } + } + ComparableTreeNode newLeaf = new ComparableTreeNode(mapSource); + insertInRightOrder(parent, newLeaf); + } + + /** + * This method clears a tree and its model to make sure it is ready for (re)initialization + */ + private void resetTree() { + this.setModel(null); + rootNode.removeAllChildren(); + } + + /** + * This method inserts a node into a tree in an order based on comparator from ComparableTreeNode + * + * @param parentNode + * - a parent node to which a new node will be attached + * @param insertedNode + * - a new node + */ + private void insertInRightOrder(ComparableTreeNode parentNode, ComparableTreeNode insertedNode) { + int parentChildCount = treeModel.getChildCount(parentNode); + int insertIndex = 0; + + if (parentChildCount != 0) { + insertIndex = parentChildCount; + for (int i = parentChildCount - 1; i >= 0; i--) { + ComparableTreeNode child = (ComparableTreeNode) treeModel.getChild(parentNode, i); + + if (insertedNode.compareTo(child) <= 0) { + insertIndex = i; + } else { + break; + } + } + } + treeModel.insertNodeInto(insertedNode, parentNode, insertIndex); + } + + /** + * This method searches for a parentNode's child relying on its name + * + * @param parentNode + * - its children will be iterated during search + * @param nodeName + * - name of a sought node + * @return found child, or null if child was not found + */ + private static ComparableTreeNode getChildByUserObject(ComparableTreeNode parentNode, String nodeName) { + @SuppressWarnings("unchecked") + Enumeration childsOfParent = parentNode.breadthFirstEnumeration(); + while (childsOfParent.hasMoreElements()) { + ComparableTreeNode child = (ComparableTreeNode) childsOfParent.nextElement(); + if (child.getUserObject().equals(nodeName)) { + return child; + } + } + return null; + } + + /** + * Method is iterating over all MapSources and adding them to a tree's model in an appropriate place + */ + private void generateTreeModel() { + for (MapSource mapSource : this.mapSources) { + addChildBasedOnFolderPath(mapSource); + } + } + + /** + * This method searches for an index of a MapSource with a requested name + * + * @param mapSourceName + * - name of a sought MapSource + * @return index of found MapSource or -1 in case nothing was found + */ + private int getMapSourceIndexByName(String mapSourceName) { + for (int i = 0; i < mapSources.size(); i++) { + MapSource mapSource = mapSources.get(i); + String mapSourceAsString = mapSource.toString(); + if (mapSourceAsString.equals(mapSourceName)) { + return i; + } + } + return -1; + } + + /** + * This method searches for a MapSource object with a requested name + * + * @param mapSourceName + * - name of a sought MapSource + * @return found MapSource object or null otherwise + */ + private MapSource getMapSourceByName(String mapSourceName) { + int mapSourceIndex = getMapSourceIndexByName(mapSourceName); + + if (mapSourceIndex == -1) { + return null; + } + return this.mapSources.get(mapSourceIndex); + } + + /** + * This method searches for a TreePath of a requested MapSouce + * + * @param mapSource + * - analyzed mapSource object + * @return TreePath of a specified MapSource or null otherwise + */ + private TreePath findTreePathOfMapSource(MapSource mapSource) { + Enumeration rootDescendants = rootNode.depthFirstEnumeration(); + while (rootDescendants.hasMoreElements()) { + ComparableTreeNode descendantNode = (ComparableTreeNode) rootDescendants.nextElement(); + + if (descendantNode.getUserObject().equals(mapSource)) { + return new TreePath(descendantNode.getPath()); + } + } + return null; + } + + /** + * This method is a main gateway for selecting a mapSource, it should be used by other functions. Firstly it + * searches for a requested MapSource and if it will find it, it will mark it internally as selected and then it + * will be passed to be selected in a graphical tree. + * + * @param mapSourceToSelect + * - MapSource that will be internally marked as selected + * @return a true if MapSource was found, false otherwise + */ + public boolean selectMapSource(MapSource mapSourceToSelect) { + int foundMapSourceIndex = mapSources.indexOf(mapSourceToSelect); + if (foundMapSourceIndex != -1) { + previouslySelectedMapSource = selectedMapSource; + // Marking internally as selected MapSource + selectedMapSource = mapSourceToSelect; + chooseAndShowTreeNodeInTree(mapSourceToSelect); + return true; + } + return false; + } + + /** + * This method is selecting a requested MapSource and focusing on it IN A TREE. MapSource is not being marked + * internally as selected in this method. + * + * @param mapSourceToSelect + * - MapSource that will be selected + */ + private void chooseAndShowTreeNodeInTree(MapSource mapSourceToSelect) { + TreePath pathFound = findTreePathOfMapSource(mapSourceToSelect); + if (pathFound != null) { + // Expand all folders and subfolders to show a chosen node + expandPath(pathFound.getParentPath()); + // Choose the node + setSelectionPath(pathFound); + // Scroll a JTree viewport to the chosen node + scrollPathToVisibleVerticalOnly(pathFound); + // Signaling to refresh a node, after its font/color was changed + ((DefaultTreeModel) this.getModel()).nodeChanged((TreeNode) pathFound.getLastPathComponent()); + } + } + + /** + * This method will vertically scroll to the requested treePath, but without touching a horizontal scroll-bar + * + * @param treePath + * - TreePath to be vertically scrolled to + */ + private void scrollPathToVisibleVerticalOnly(TreePath treePath) { + if (treePath != null) { + makeVisible(treePath); + + Rectangle pathBounds = getPathBounds(treePath); + if (pathBounds != null) { + pathBounds.x = 0; + scrollRectToVisible(pathBounds); + } + } + } + + /** + * This method should be called after clicking on any node in a tree. It gets a clicked/chosen node from a tree and + * pass it to the method that will mark it as internally selected. + * + * @return true if clicked MapSource was successfully selected internally, false otherwise + */ + public boolean selectClickedMapSource() { + if (getSelectionPath() != null) { + String selectedTreeElement = getSelectionPath().getLastPathComponent().toString(); + MapSource foundMapSource = getMapSourceByName(selectedTreeElement); + if (foundMapSource == null) { + // React if a non-MapSource node was clicked + setSelectionPath(findTreePathOfMapSource(previouslySelectedMapSource)); + } else { + // A mapSource type was clicked + return selectMapSource(foundMapSource); + } + } + return false; + } + + /** + * @return internally selected MapSource + */ + public MapSource getSelectedMapSource() { + return selectedMapSource; + } + + /** + * Selects a next MapSource from internal list of MapSources + */ + public boolean selectNextMapSource() { + if (mapSources.lastElement().equals(selectedMapSource)) { + return false; + } else { + int indexOfSelectedMapSource = mapSources.indexOf(selectedMapSource); + return selectMapSource(mapSources.get(indexOfSelectedMapSource + 1)); + } + } + + /** + * Selects a previous MapSource from internal list of MapSources + */ + public boolean selectPreviousMapSource() { + if (mapSources.firstElement().equals(selectedMapSource)) { + return false; + } else { + int indexOfSelectedMapSource = mapSources.indexOf(selectedMapSource); + return selectMapSource(mapSources.get(indexOfSelectedMapSource - 1)); + } + } + + /** + * Selects a first MapSource from internal list of MapSources. Because internal list is not in the same order as + * nodes in tree, user gets a random (from his point of view) MapSource. Perhaps, this method should ask user what + * MapSource he want to pick, or maybe automatically select a closest sibling of the previously selected MapSource? + */ + public boolean selectFirstMapSource() { + return selectMapSource(mapSources.get(0)); + } + + /** + * @return a size of internal list of MapSources + */ + public int getMapSourcesCount() { + return mapSources.size(); + } + + /** + * Check if the mouse cursor was over a clickable node + * + * @param eventPoint + * - a mouse position coordinates + * @return true if a node was clickable, false otherwise + */ + public boolean isLocationClickable(Point eventPoint) { + int x = (int) eventPoint.getX(); + int y = (int) eventPoint.getY(); + TreePath treePathForXY = getPathForLocation(x, y); + + // If a node is an ancestor of a currently selected node - it can't be closed, so it is unclickable. + if (treePathForXY != null && treePathForXY.isDescendant(findTreePathOfMapSource(selectedMapSource))) { + return false; + } + + boolean isInside = false; + if (treePathForXY != null) { + Rectangle pathBounds = this.getPathBounds(treePathForXY); + isInside = pathBounds.contains(eventPoint); + } + return isInside; + } + + @Override + public String getToolTipText(MouseEvent event) { + if (getRowForLocation(event.getX(), event.getY()) == -1) + return ""; + TreePath curPath = getPathForLocation(event.getX(), event.getY()); + Object lastPathComponent = curPath.getLastPathComponent(); + if (lastPathComponent == null) + return null; + + Object userObject = ((ComparableTreeNode) lastPathComponent).getUserObject(); + if (userObject.getClass().equals(folderClass)) { + return null; + } + return generateMapSourceTooltip((MapSource) userObject); + } + + /** + * Static method used for dynamic generation of a tooltip with information about a mapSource + * + * @param mapSource + * - of which information will be put into a tooltip + * @return generated tooltip string + */ + public static String generateMapSourceTooltip(MapSource mapSource) { + boolean multiLayer = (mapSource instanceof AbstractMultiLayerMapSource); + boolean fileBased = (mapSource instanceof FileBasedMapSource); + + // Getting a localized string for an input to tooltip + String locName = I18nUtils.localizedStringForKey("lp_map_source_tooltip_layer_name"); + String locInternalName = I18nUtils.localizedStringForKey("lp_map_source_tooltip_inernal_name"); + String locType = I18nUtils.localizedStringForKey("lp_map_source_tooltip_type"); + String locLoadedFrom = I18nUtils.localizedStringForKey("lp_map_source_tooltip_loaded_from"); + String locFileName = I18nUtils.localizedStringForKey("lp_map_source_tooltip_file_name"); + + String locMultiLayer = I18nUtils.localizedStringForKey("lp_map_source_layer_multi"); + String locSingleLayer = I18nUtils.localizedStringForKey("lp_map_source_layer_single"); + String locFileBased = I18nUtils.localizedStringForKey("lp_map_source_layer_file_based"); + String locWebBased = I18nUtils.localizedStringForKey("lp_map_source_layer_web_based"); + + // Getting a values for some attributes + String name = StringEscapeUtils.escapeHtml4(mapSource.toString()); + String nameInternal = StringEscapeUtils.escapeHtml4(mapSource.getName()); + String type1 = multiLayer ? locMultiLayer : locSingleLayer; + String type2 = fileBased ? locFileBased : locWebBased; + + String toolTipString = locName + ": %s
    " + locInternalName + ": %s
    " + locType + ": %s (%s)"; + toolTipString = String.format(toolTipString, name, nameInternal, type1, type2); + + MapSourceLoaderInfo info = mapSource.getLoaderInfo(); + if (info != null) { + toolTipString += "
    " + locLoadedFrom + ": " + info.getLoaderType().displayName; + + File f = info.getSourceFile(); + if (f != null) { + toolTipString += "
    " + locFileName + ": " + StringEscapeUtils.escapeHtml4(f.getName()) + ""; + } + } + + return "" + toolTipString + ""; + } +} \ No newline at end of file diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/dialogs/Help.java mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/dialogs/Help.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/dialogs/Help.java 2014-02-06 05:48:02.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/dialogs/Help.java 2016-04-24 08:41:16.000000000 +0000 @@ -26,13 +26,13 @@ import java.awt.event.WindowListener; import java.io.DataInputStream; import java.io.IOException; +import java.nio.charset.StandardCharsets; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import mobac.gui.MainGUI; -import mobac.utilities.Charsets; import mobac.utilities.GBC; import mobac.utilities.I18nUtils; @@ -68,7 +68,7 @@ buf = new byte[in.available()]; in.readFully(buf); in.close(); - String helpMessage = new String(buf, Charsets.UTF_8); + String helpMessage = new String(buf, StandardCharsets.UTF_8); // Strip out all line breaks because JOptionPane shows // the raw HTML code otherwise // helpMessage = helpMessage.replaceAll("\n", ""); diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/dialogs/LicensesDialog.java mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/dialogs/LicensesDialog.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/dialogs/LicensesDialog.java 2014-02-06 05:48:02.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/dialogs/LicensesDialog.java 2014-08-07 06:57:30.000000000 +0000 @@ -51,7 +51,9 @@ new LicenseInfo("

    Library Berkely-DB JavaEdition

    ", "license-dbd-je.txt"), new LicenseInfo("

    Library BeanShell

    ", "lgpl-3.0.txt"), new LicenseInfo("

    Library JavaPNG

    ", "gpl.txt"), - new LicenseInfo("

    Library iTextPDF

    ", "agpl.txt") }; + new LicenseInfo("

    Library iTextPDF

    ", "agpl.txt"), + new LicenseInfo("

    mapsforge

    ", "lgpl-3.0.txt"), + new LicenseInfo("

    Silk Icons

    ", "cc-attribution-2.5.txt") }; private final JTextArea textArea; private final JTabbedPane tab; diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/dialogs/WorkinprogressDialog.java mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/dialogs/WorkinprogressDialog.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/dialogs/WorkinprogressDialog.java 2014-02-06 05:48:02.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/dialogs/WorkinprogressDialog.java 2014-06-04 14:13:28.000000000 +0000 @@ -57,7 +57,7 @@ setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); setLocationRelativeTo(owner); addWindowListener(this); - JButton abort = new JButton(I18nUtils.localizedStringForKey("dlg_progress_about_btn")); + JButton abort = new JButton(I18nUtils.localizedStringForKey("Abort")); abort.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/MainGUI.java mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/MainGUI.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/MainGUI.java 2014-02-06 05:48:04.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/MainGUI.java 2016-04-21 11:18:02.000000000 +0000 @@ -19,6 +19,7 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; +import java.awt.Cursor; import java.awt.Dimension; import java.awt.Font; import java.awt.Frame; @@ -34,6 +35,8 @@ import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionAdapter; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.ArrayList; @@ -43,7 +46,8 @@ import javax.swing.BorderFactory; import javax.swing.Box; -import javax.swing.DefaultComboBoxModel; +import javax.swing.ButtonGroup; +import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JCheckBoxMenuItem; @@ -58,7 +62,10 @@ import javax.swing.JPanel; import javax.swing.JRadioButtonMenuItem; import javax.swing.JScrollPane; +import javax.swing.JSeparator; import javax.swing.JSlider; +import javax.swing.JSplitPane; +import javax.swing.JTree; import javax.swing.KeyStroke; import javax.swing.SwingUtilities; import javax.swing.UIManager; @@ -66,8 +73,14 @@ import javax.swing.event.ChangeListener; import javax.swing.event.MenuEvent; import javax.swing.event.MenuListener; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; import javax.xml.bind.JAXBException; +import org.apache.log4j.Level; +import org.apache.log4j.Logger; + +import mobac.exceptions.MapSourceInitializationException; import mobac.externaltools.ExternalToolDef; import mobac.externaltools.ExternalToolsLoader; import mobac.gui.actions.AddGpxTrackAreaPolygonMap; @@ -89,14 +102,17 @@ import mobac.gui.actions.SelectionModeCircle; import mobac.gui.actions.SelectionModePolygon; import mobac.gui.actions.SelectionModeRectangle; +import mobac.gui.actions.SettingsButtonListener; import mobac.gui.actions.ShowAboutDialog; import mobac.gui.actions.ShowHelpAction; import mobac.gui.actions.ShowReadme; +import mobac.gui.actions.SplitPaneHideLeftComponent; import mobac.gui.atlastree.JAtlasTree; import mobac.gui.components.FilledLayeredPane; import mobac.gui.components.JAtlasNameField; import mobac.gui.components.JBookmarkMenuItem; import mobac.gui.components.JCollapsiblePanel; +import mobac.gui.components.JMapSourceTree; import mobac.gui.components.JMenuItem2; import mobac.gui.components.JZoomCheckBox; import mobac.gui.listeners.AtlasModelListener; @@ -111,14 +127,13 @@ import mobac.gui.mapview.interfaces.MapEventListener; import mobac.gui.panels.JCoordinatesPanel; import mobac.gui.panels.JGpxPanel; +import mobac.gui.panels.JMapSourcesPanel; import mobac.gui.panels.JProfilesPanel; import mobac.gui.panels.JTileImageParametersPanel; import mobac.gui.panels.JTileStoreCoveragePanel; -import mobac.gui.settings.SettingsGUI; import mobac.mapsources.MapSourcesManager; import mobac.program.ProgramInfo; import mobac.program.interfaces.AtlasInterface; -import mobac.program.interfaces.FileBasedMapSource; import mobac.program.interfaces.InitializableMapSource; import mobac.program.interfaces.MapSource; import mobac.program.model.Bookmark; @@ -134,9 +149,6 @@ import mobac.utilities.I18nUtils; import mobac.utilities.Utilities; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; - public class MainGUI extends JFrame implements MapEventListener { private static final long serialVersionUID = 1L; @@ -147,6 +159,10 @@ private static Color checkboxBackgroundColor = new Color(0, 0, 0, 40); private static Color labelForegroundColor = Color.WHITE; + public static final int LEFT_PANEL_MIN_SIZE = 254; + + private static final int LEFT_PANEL_MARGIN = 2; + private static MainGUI mainGUI = null; public static final ArrayList MOBAC_ICONS = new ArrayList(3); @@ -157,7 +173,7 @@ } protected JMenuBar menuBar; - protected JMenu toolsMenu = null; + protected JMenu externalToolsMenu = null; private JMenu bookmarkMenu = null; @@ -170,13 +186,13 @@ private JLabel zoomLevelText; private JComboBox gridZoomCombo; private JSlider zoomSlider; - private JComboBox mapSourceCombo; - private JButton settingsButton; + private JMapSourceTree mapSourceTree; private JAtlasNameField atlasNameTextField; private JButton createAtlasButton; private JPanel zoomLevelPanel; private JZoomCheckBox[] cbZoom = new JZoomCheckBox[0]; private JLabel amountOfTilesLabel; + private JMapSourcesPanel mapSourcePanel; private AtlasCreate atlasCreateAction = new AtlasCreate(jAtlasTree); @@ -186,6 +202,7 @@ private JTileStoreCoveragePanel tileStoreCoveragePanel; public JGpxPanel gpxPanel; + private JSplitPane splitPane; private JPanel mapControlPanel = new JPanel(new BorderLayout()); private JPanel leftPanel = new JPanel(new GridBagLayout()); private JPanel leftPanelContent = null; @@ -265,12 +282,23 @@ createControls(); calculateNrOfTilesToDownload(); setLayout(new BorderLayout()); - add(leftPanel, BorderLayout.WEST); - add(rightPanel, BorderLayout.EAST); + + // add(rightPanel, BorderLayout.EAST); JLayeredPane layeredPane = new FilledLayeredPane(); layeredPane.add(previewMap, Integer.valueOf(0)); layeredPane.add(mapControlPanel, Integer.valueOf(1)); - add(layeredPane, BorderLayout.CENTER); + // add(layeredPane, BorderLayout.CENTER); + + JPanel centerRightPanel = new JPanel(); + centerRightPanel.setLayout(new BorderLayout()); + centerRightPanel.add(layeredPane, BorderLayout.CENTER); + centerRightPanel.add(rightPanel, BorderLayout.EAST); + + leftPanel.setMinimumSize(new Dimension(LEFT_PANEL_MIN_SIZE, 100)); + splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, leftPanel, centerRightPanel); + splitPane.setOneTouchExpandable(true); + // splitPane.setDividerLocation(150); + add(splitPane); updateMapControlsPanel(); updateLeftPanel(); @@ -350,16 +378,19 @@ } }); - // map source combo - mapSourceCombo = new JComboBox(MapSourcesManager.getInstance().getEnabledOrderedMapSources()); - mapSourceCombo.setMaximumRowCount(20); - mapSourceCombo.addActionListener(new MapSourceComboListener()); - mapSourceCombo.setToolTipText(I18nUtils.localizedStringForKey("lp_map_source_combo_tips")); - - // settings button - settingsButton = new JButton(I18nUtils.localizedStringForKey("lp_main_setting_button_title")); - settingsButton.addActionListener(new SettingsButtonListener()); - settingsButton.setToolTipText(I18nUtils.localizedStringForKey("lp_main_setting_button_tips")); + // map source tree + mapSourceTree = new JMapSourceTree(MapSourcesManager.getInstance().getEnabledOrderedMapSources()); + mapSourceTree.addTreeSelectionListener(new MapSourceTreeListener()); + mapSourceTree.addMouseMotionListener(new MouseMotionAdapter() { + @Override + public void mouseMoved(MouseEvent e) { + boolean isLocationClickable = ((JMapSourceTree) e.getComponent()).isLocationClickable(e.getPoint()); + JTree jTree = (JTree) e.getComponent(); + // If a node is clickable, user will see a "hand" mouse cursor + jTree.setCursor(isLocationClickable ? Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) + : Cursor.getDefaultCursor()); + } + }); // atlas name text field atlasNameTextField = new JAtlasNameField(); @@ -369,6 +400,7 @@ // main button createAtlasButton = new JButton(I18nUtils.localizedStringForKey("lp_mian_create_btn_title")); + createAtlasButton.setIcon(new ImageIcon(MainGUI.class.getResource("/mobac/resources/images/atlas_create.png"))); createAtlasButton.addActionListener(atlasCreateAction); createAtlasButton.setToolTipText(I18nUtils.localizedStringForKey("lp_main_create_btn_tips")); @@ -394,96 +426,111 @@ private void prepareMenuBar() { // Atlas menu JMenu atlasMenu = new JMenu(I18nUtils.localizedStringForKey("menu_atlas")); + atlasMenu.setIcon(Utilities.loadResourceImageIcon("atlas.png")); atlasMenu.setMnemonic(KeyEvent.VK_A); JMenuItem newAtlas = new JMenuItem(I18nUtils.localizedStringForKey("menu_atlas_new")); + newAtlas.setIcon(Utilities.loadResourceImageIcon("atlas_add.png")); newAtlas.setMnemonic(KeyEvent.VK_N); newAtlas.addActionListener(new AtlasNew()); atlasMenu.add(newAtlas); JMenuItem convertAtlas = new JMenuItem(I18nUtils.localizedStringForKey("menu_atlas_convert_format")); + convertAtlas.setIcon(Utilities.loadResourceImageIcon("atlas_convert.png")); convertAtlas.setMnemonic(KeyEvent.VK_V); convertAtlas.addActionListener(new AtlasConvert()); atlasMenu.add(convertAtlas); atlasMenu.addSeparator(); JMenuItem createAtlas = new JMenuItem(I18nUtils.localizedStringForKey("menu_atlas_create")); + createAtlas.setIcon(Utilities.loadResourceImageIcon("atlas_create.png")); createAtlas.setMnemonic(KeyEvent.VK_C); createAtlas.addActionListener(atlasCreateAction); atlasMenu.add(createAtlas); - // Maps menu - JMenu mapsMenu = new JMenu(I18nUtils.localizedStringForKey("menu_maps")); - mapsMenu.setMnemonic(KeyEvent.VK_M); - JMenu selectionModeMenu = new JMenu(I18nUtils.localizedStringForKey("menu_maps_selection")); + // Selection menu - before, it was called "Maps menu" + JMenu selectionMenu = new JMenu(I18nUtils.localizedStringForKey("menu_selection")); + selectionMenu.setIcon(Utilities.loadResourceImageIcon("menu_icons/selections.png")); + selectionMenu.setMnemonic(KeyEvent.VK_S); + JMenu selectionModeMenu = new JMenu(I18nUtils.localizedStringForKey("menu_selection_selection")); + selectionModeMenu.setIcon(Utilities.loadResourceImageIcon("menu_icons/menu_selection_mode.png")); selectionModeMenu.setMnemonic(KeyEvent.VK_M); - mapsMenu.add(selectionModeMenu); + selectionMenu.add(selectionModeMenu); - smRectangle = new JRadioButtonMenuItem(I18nUtils.localizedStringForKey("menu_maps_selection_rect")); + smRectangle = new JCheckBoxMenuItem(I18nUtils.localizedStringForKey("menu_selection_selection_rect")); + smRectangle.setIcon(Utilities.loadResourceImageIcon("menu_icons/menu_selection_mode.png")); smRectangle.addActionListener(new SelectionModeRectangle()); smRectangle.setSelected(true); selectionModeMenu.add(smRectangle); - smPolygon = new JRadioButtonMenuItem(I18nUtils.localizedStringForKey("menu_maps_selection_polygon")); + smPolygon = new JCheckBoxMenuItem(I18nUtils.localizedStringForKey("menu_selection_selection_polygon")); + smPolygon.setIcon(Utilities.loadResourceImageIcon("menu_icons/menu_selection_polygon.png")); smPolygon.addActionListener(new SelectionModePolygon()); selectionModeMenu.add(smPolygon); - smCircle = new JRadioButtonMenuItem(I18nUtils.localizedStringForKey("menu_maps_selection_circle")); + smCircle = new JCheckBoxMenuItem(I18nUtils.localizedStringForKey("menu_selection_selection_circle")); + smCircle.setIcon(Utilities.loadResourceImageIcon("menu_icons/menu_selection_circle.png")); smCircle.addActionListener(new SelectionModeCircle()); selectionModeMenu.add(smCircle); - JMenuItem addSelection = new JMenuItem(I18nUtils.localizedStringForKey("menu_maps_selection_add")); + ButtonGroup selectionModeGroup = new ButtonGroup(); + selectionModeGroup.add(smRectangle); + selectionModeGroup.add(smPolygon); + selectionModeGroup.add(smCircle); + + JMenuItem addSelection = new JMenuItem(I18nUtils.localizedStringForKey("menu_selection_selection_add")); + addSelection.setIcon(Utilities.loadResourceImageIcon("menu_icons/menu_selection_add.png")); addSelection.addActionListener(AddMapLayer.INSTANCE); + + JSeparator selectionSeparator = new JSeparator(); + selectionMenu.add(selectionSeparator); addSelection.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.CTRL_MASK)); addSelection.setMnemonic(KeyEvent.VK_A); - mapsMenu.add(addSelection); + selectionMenu.add(addSelection); JMenuItem addGpxTrackSelection = new JMenuItem2( - I18nUtils.localizedStringForKey("menu_maps_selection_add_around_gpx"), AddGpxTrackPolygonMap.class); - mapsMenu.add(addGpxTrackSelection); + I18nUtils.localizedStringForKey("menu_selection_selection_add_around_gpx"), + AddGpxTrackPolygonMap.class); + addGpxTrackSelection.setIcon(Utilities.loadResourceImageIcon("menu_icons/menu_selection_add.png")); + selectionMenu.add(addGpxTrackSelection); JMenuItem addGpxTrackAreaSelection = new JMenuItem2( - I18nUtils.localizedStringForKey("menu_maps_selection_add_by_gpx"), + I18nUtils.localizedStringForKey("menu_selection_selection_add_by_gpx"), AddGpxTrackAreaPolygonMap.class); - mapsMenu.add(addGpxTrackAreaSelection); + addGpxTrackAreaSelection.setIcon(Utilities.loadResourceImageIcon("menu_icons/menu_selection_add.png")); + selectionMenu.add(addGpxTrackAreaSelection); // Bookmarks menu bookmarkMenu = new JMenu(I18nUtils.localizedStringForKey("menu_bookmark")); + bookmarkMenu.setIcon(Utilities.loadResourceImageIcon("menu_icons/menu_bookmarks.png")); bookmarkMenu.setMnemonic(KeyEvent.VK_B); JMenuItem addBookmark = new JMenuItem(I18nUtils.localizedStringForKey("menu_bookmark_save")); + addBookmark.setIcon(Utilities.loadResourceImageIcon("menu_icons/menu_save_view.png")); addBookmark.setMnemonic(KeyEvent.VK_S); addBookmark.addActionListener(new BookmarkAdd(previewMap)); bookmarkMenu.add(addBookmark); JMenuItem manageBookmarks = new JMenuItem2(I18nUtils.localizedStringForKey("menu_bookmark_manage"), BookmarkManage.class); + manageBookmarks.setIcon(Utilities.loadResourceImageIcon("menu_icons/menu_manage_bookmarks.png")); manageBookmarks.setMnemonic(KeyEvent.VK_S); bookmarkMenu.add(addBookmark); bookmarkMenu.add(manageBookmarks); bookmarkMenu.addSeparator(); - // Panels menu - JMenu panelsMenu = new JMenu(I18nUtils.localizedStringForKey("menu_panels")); - panelsMenu.setMnemonic(KeyEvent.VK_P); - JMenuItem showLeftPanel = new JMenuItem(I18nUtils.localizedStringForKey("menu_show_hide_left_panel")); - showLeftPanel.addActionListener(new PanelShowHide(leftPanel)); - JMenuItem showRightPanel = new JMenuItem(I18nUtils.localizedStringForKey("menu_show_hide_gpx_panel")); - showRightPanel.addActionListener(new PanelShowHide(rightPanel)); - panelsMenu.add(showLeftPanel); - panelsMenu.add(showRightPanel); - menuBar.add(atlasMenu); - menuBar.add(mapsMenu); + menuBar.add(selectionMenu); menuBar.add(bookmarkMenu); - menuBar.add(panelsMenu); - loadToolsMenu(); + loadExternalToolsMenu(); menuBar.add(Box.createHorizontalGlue()); // Debug menu JMenu debugMenu = new JMenu(I18nUtils.localizedStringForKey("menu_debug")); + debugMenu.setIcon(Utilities.loadResourceImageIcon("icon_debug_ms.png")); JMenuItem mapGrid = new JCheckBoxMenuItem(I18nUtils.localizedStringForKey("menu_debug_show_hide_tile_border"), false); + mapGrid.setIcon(Utilities.loadResourceImageIcon("menu_icons/menu_show_tile_borders.png")); mapGrid.addActionListener(new DebugShowMapTileGrid()); debugMenu.add(mapGrid); debugMenu.addSeparator(); @@ -491,20 +538,24 @@ debugMenu.setMnemonic(KeyEvent.VK_D); JMenuItem mapSourceNames = new JMenuItem2(I18nUtils.localizedStringForKey("menu_debug_show_all_map_source"), DebugShowMapSourceNames.class); + mapSourceNames.setIcon(Utilities.loadResourceImageIcon("menu_icons/menu_show_mapsources.png")); mapSourceNames.setMnemonic(KeyEvent.VK_N); debugMenu.add(mapSourceNames); debugMenu.addSeparator(); JMenuItem refreshCustomMapSources = new JMenuItem2( I18nUtils.localizedStringForKey("menu_debug_refresh_map_source"), RefreshCustomMapsources.class); + refreshCustomMapSources.setIcon(Utilities.loadResourceImageIcon("refresh.png")); debugMenu.add(refreshCustomMapSources); debugMenu.addSeparator(); JMenuItem showLog = new JMenuItem2(I18nUtils.localizedStringForKey("menu_debug_show_log_file"), DebugShowLogFile.class); + showLog.setIcon(Utilities.loadResourceImageIcon("menu_icons/menu_show_logfile.png")); showLog.setMnemonic(KeyEvent.VK_S); debugMenu.add(showLog); logLevelMenu = new JMenu(I18nUtils.localizedStringForKey("menu_debug_log_level")); + logLevelMenu.setIcon(Utilities.loadResourceImageIcon("menu_icons/menu_log_level.png")); logLevelMenu.setMnemonic(KeyEvent.VK_L); Level[] list = new Level[] { Level.TRACE, Level.DEBUG, Level.INFO, Level.ERROR, Level.FATAL, Level.OFF }; ActionListener al = new DebugSetLogLevel(); @@ -520,16 +571,50 @@ debugMenu.addSeparator(); JMenuItem report = new JMenuItem2(I18nUtils.localizedStringForKey("menu_debug_system_report"), DebugShowReport.class); + report.setIcon(Utilities.loadResourceImageIcon("menu_icons/menu_gen_sysreport.png")); report.setMnemonic(KeyEvent.VK_R); debugMenu.add(report); menuBar.add(debugMenu); + // Tools menu + JMenu toolsMenu = new JMenu(I18nUtils.localizedStringForKey("menu_tools")); + toolsMenu + .setIcon(new ImageIcon(MainGUI.class.getResource("/mobac/resources/images/menu_icons/menu_tools.png"))); + toolsMenu.setMnemonic(KeyEvent.VK_T); + menuBar.add(toolsMenu); + + JMenuItem settingsMenuItem = new JMenuItem2(I18nUtils.localizedStringForKey("menu_tools_settings"), + SettingsButtonListener.class); + settingsMenuItem.setIcon( + new ImageIcon(MainGUI.class.getResource("/mobac/resources/images/menu_icons/menu_settings.png"))); + toolsMenu.add(settingsMenuItem); + JSeparator separator = new JSeparator(); + toolsMenu.add(separator); + JMenuItem showRightPanel = new JMenuItem(I18nUtils.localizedStringForKey("menu_show_hide_gpx_panel")); + showRightPanel.setIcon( + new ImageIcon(MainGUI.class.getResource("/mobac/resources/images/menu_icons/menu_panels_right.png"))); + showRightPanel.addActionListener(new PanelShowHide(rightPanel)); + + JMenuItem showLeftPanel = new JMenuItem(I18nUtils.localizedStringForKey("menu_show_hide_left_panel")); + toolsMenu.add(showLeftPanel); + showLeftPanel.setIcon( + new ImageIcon(MainGUI.class.getResource("/mobac/resources/images/menu_icons/menu_panels_left.png"))); + + showLeftPanel.addActionListener(new SplitPaneHideLeftComponent(splitPane)); + toolsMenu.add(showRightPanel); + // Help menu JMenu help = new JMenu(I18nUtils.localizedStringForKey("menu_help")); + help.setIcon(new ImageIcon(MainGUI.class.getResource("/mobac/resources/images/menu_icons/menu_help.png"))); JMenuItem readme = new JMenuItem(I18nUtils.localizedStringForKey("menu_help_readme")); + readme.setIcon(new ImageIcon(MainGUI.class.getResource("/mobac/resources/images/menu_icons/menu_info.png"))); JMenuItem howToMap = new JMenuItem(I18nUtils.localizedStringForKey("menu_help_how_to_preview")); + howToMap.setIcon(new ImageIcon(MainGUI.class.getResource("/mobac/resources/images/menu_icons/menu_info.png"))); JMenuItem licenses = new JMenuItem(I18nUtils.localizedStringForKey("menu_help_licenses")); + licenses.setIcon( + new ImageIcon(MainGUI.class.getResource("/mobac/resources/images/menu_icons/menu_licenses.png"))); JMenuItem about = new JMenuItem(I18nUtils.localizedStringForKey("menu_help_about")); + about.setIcon(new ImageIcon(MainGUI.class.getResource("/mobac/resources/images/mobac16.png"))); readme.addActionListener(new ShowReadme()); about.addActionListener(new ShowAboutDialog()); howToMap.addActionListener(new ShowHelpAction()); @@ -544,15 +629,18 @@ menuBar.add(help); } - public void loadToolsMenu() { + public void loadExternalToolsMenu() { if (ExternalToolsLoader.load()) { - if (toolsMenu == null) { - toolsMenu = new JMenu(I18nUtils.localizedStringForKey("menu_tool")); - toolsMenu.addMenuListener(new MenuListener() { + if (externalToolsMenu == null) { + externalToolsMenu = new JMenu(I18nUtils.localizedStringForKey("menu_external_tools")); + externalToolsMenu.setIcon(new ImageIcon( + MainGUI.class.getResource("/mobac/resources/images/menu_icons/menu_external_tools.png"))); + externalToolsMenu.setMnemonic(KeyEvent.VK_E); + externalToolsMenu.addMenuListener(new MenuListener() { public void menuSelected(MenuEvent e) { - loadToolsMenu(); - log.debug("Tools menu Loaded"); + loadExternalToolsMenu(); + log.debug("External Tools menu Loaded"); } public void menuDeselected(MenuEvent e) { @@ -561,13 +649,15 @@ public void menuCanceled(MenuEvent e) { } }); - menuBar.add(toolsMenu); + menuBar.add(externalToolsMenu); } - toolsMenu.removeAll(); + externalToolsMenu.removeAll(); for (ExternalToolDef t : ExternalToolsLoader.tools) { - JMenuItem m = new JMenuItem(t.name); - m.addActionListener(t); - toolsMenu.add(m); + JMenuItem externalToolMenuItem = new JMenuItem(t.name); + externalToolMenuItem.addActionListener(t); + externalToolMenuItem.setIcon(new ImageIcon( + MainGUI.class.getResource("/mobac/resources/images/menu_icons/menu_external_tool_item.png"))); + externalToolsMenu.add(externalToolMenuItem); } } } @@ -577,17 +667,17 @@ coordinatesPanel.addButtonActionListener(new ApplySelectionButtonListener()); - JCollapsiblePanel mapSourcePanel = new JCollapsiblePanel( - I18nUtils.localizedStringForKey("lp_map_source_title"), new GridBagLayout()); - mapSourcePanel.addContent(mapSourceCombo, GBC.std().insets(2, 2, 2, 2).fill()); + mapSourcePanel = new JMapSourcesPanel(mapSourceTree); JCollapsiblePanel zoomLevelsPanel = new JCollapsiblePanel(I18nUtils.localizedStringForKey("lp_zoom_title"), new GridBagLayout()); zoomLevelsPanel.addContent(zoomLevelPanel, GBC.eol().insets(2, 4, 2, 0)); zoomLevelsPanel.addContent(amountOfTilesLabel, GBC.std().anchor(GBC.WEST).insets(0, 5, 0, 2)); + int leftPanelVerticalScrollWidth = 14; + GBC gbc_std = GBC.std().insets(5, 2, 5, 3); - GBC gbc_eol = GBC.eol().insets(5, 2, 5, 3); + GBC gbc_eol = GBC.eol().insets(LEFT_PANEL_MARGIN, 2, LEFT_PANEL_MARGIN, 3); JCollapsiblePanel atlasContentPanel = new JCollapsiblePanel(I18nUtils.localizedStringForKey("lp_atlas_title"), new GridBagLayout()); @@ -595,7 +685,6 @@ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); jAtlasTree.getTreeModel().addTreeModelListener(new AtlasModelListener(jAtlasTree, profilesPanel)); - treeScrollPane.setMinimumSize(new Dimension(100, 150)); treeScrollPane.setPreferredSize(new Dimension(100, 200)); treeScrollPane.setAutoscrolls(true); atlasContentPanel.addContent(treeScrollPane, GBC.eol().fill().insets(0, 1, 0, 0)); @@ -608,33 +697,23 @@ atlasContentPanel.addContent(new JLabel(I18nUtils.localizedStringForKey("lp_atlas_name_label_title")), gbc_std); atlasContentPanel.addContent(atlasNameTextField, gbc_eol.fill(GBC.HORIZONTAL)); - gbc_eol = GBC.eol().insets(5, 2, 5, 2).fill(GBC.HORIZONTAL); - leftPanelContent = new JPanel(new GridBagLayout()); - leftPanelContent.add(coordinatesPanel, gbc_eol); leftPanelContent.add(mapSourcePanel, gbc_eol); leftPanelContent.add(zoomLevelsPanel, gbc_eol); - leftPanelContent.add(tileImageParametersPanel, gbc_eol); leftPanelContent.add(atlasContentPanel, gbc_eol); - leftPanelContent.add(profilesPanel, gbc_eol); leftPanelContent.add(createAtlasButton, gbc_eol); - leftPanelContent.add(settingsButton, gbc_eol); + leftPanelContent.add(tileImageParametersPanel, gbc_eol); leftPanelContent.add(tileStoreCoveragePanel, gbc_eol); + leftPanelContent.add(coordinatesPanel, gbc_eol); leftPanelContent.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.VERTICAL)); JScrollPane scrollPane = new JScrollPane(leftPanelContent); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setBorder(BorderFactory.createEmptyBorder()); - // Set the scroll pane width large enough so that the - // scroll bar has enough space to appear right to it - Dimension d = scrollPane.getPreferredSize(); - d.width += 5 + scrollPane.getVerticalScrollBar().getWidth(); - // scrollPane.setPreferredSize(d); - scrollPane.setMinimumSize(d); + scrollPane.getVerticalScrollBar().setPreferredSize(new Dimension(leftPanelVerticalScrollWidth, 0)); + leftPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, Color.GRAY)); leftPanel.add(scrollPane, GBC.std().fill()); - // leftPanel.add(leftPanelContent, GBC.std().fill()); - } private void updateRightPanel() { @@ -676,11 +755,14 @@ } public void updateMapSourcesList() { - MapSource ms = (MapSource) mapSourceCombo.getSelectedItem(); - mapSourceCombo - .setModel(new DefaultComboBoxModel(MapSourcesManager.getInstance().getEnabledOrderedMapSources())); - mapSourceCombo.setSelectedItem(ms); - MapSource ms2 = (MapSource) mapSourceCombo.getSelectedItem(); + mapSourceTree.selectClickedMapSource(); + MapSource ms = mapSourceTree.getSelectedMapSource(); + mapSourceTree.initialize(MapSourcesManager.getInstance().getEnabledOrderedMapSources()); + if (!mapSourceTree.selectMapSource(ms)) { + mapSourceTree.selectFirstMapSource(); + } + MapSource ms2 = mapSourceTree.getSelectedMapSource(); + if (!ms.equals(ms2)) previewMap.setMapSource(ms2); } @@ -694,13 +776,17 @@ } bookmarkMenu.removeAll(); for (JMenuItem item : items) { - if (item != null) + if (item != null) { bookmarkMenu.add(item); - else + } else { bookmarkMenu.addSeparator(); + } } - for (Bookmark b : Settings.getInstance().placeBookmarks) { - bookmarkMenu.add(new JBookmarkMenuItem(b)); + for (Bookmark bookmark : Settings.getInstance().placeBookmarks) { + JBookmarkMenuItem bookmarkMenuItem = new JBookmarkMenuItem(bookmark); + bookmarkMenuItem.setIcon(new ImageIcon( + MainGUI.class.getResource("/mobac/resources/images/menu_icons/menu_bookmark_item.png"))); + bookmarkMenu.add(bookmarkMenuItem); } } @@ -752,6 +838,7 @@ setExtendedState(Frame.MAXIMIZED_BOTH); leftPanel.setVisible(settings.mainWindow.leftPanelVisible); + leftPanel.setPreferredSize(new Dimension(settings.mainWindow.leftPanelWidth, 100)); rightPanel.setVisible(settings.mainWindow.rightPanelVisible); if (leftPanelContent != null) { @@ -798,6 +885,7 @@ } } s.mainWindow.leftPanelVisible = leftPanel.isVisible(); + s.mainWindow.leftPanelWidth = leftPanel.getWidth(); s.mainWindow.rightPanelVisible = rightPanel.isVisible(); checkAndSaveSettings(); } catch (Exception e) { @@ -881,17 +969,31 @@ } } - private class MapSourceComboListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - MapSource mapSource = (MapSource) mapSourceCombo.getSelectedItem(); - if (mapSource == null) { - mapSourceCombo.setSelectedIndex(0); - mapSource = (MapSource) mapSourceCombo.getSelectedItem(); + private class MapSourceTreeListener implements TreeSelectionListener { + + @Override + public void valueChanged(TreeSelectionEvent e) { + mapSourceTree.selectClickedMapSource(); + MapSource selectedMapSource = mapSourceTree.getSelectedMapSource(); + if (selectedMapSource == null) { + boolean wasFirstValidSourceSelected = mapSourceTree.selectFirstMapSource(); + if (!wasFirstValidSourceSelected) { + return; + } + selectedMapSource = mapSourceTree.getSelectedMapSource(); } - if (mapSource instanceof InitializableMapSource) + if (selectedMapSource instanceof InitializableMapSource) { // initialize the map source e.g. detect available zoom levels - ((InitializableMapSource) mapSource).initialize(); - previewMap.setMapSource(mapSource); + try { + ((InitializableMapSource) selectedMapSource).initialize(); + } catch (MapSourceInitializationException e1) { + JOptionPane.showMessageDialog(null, + I18nUtils.localizedStringForKey("msg_map_source_initialization_failed", + selectedMapSource.toString(), e1.getLocalizedMessage()), + I18nUtils.localizedStringForKey("Error"), JOptionPane.ERROR_MESSAGE); + } + } + previewMap.setMapSource(selectedMapSource); zoomSlider.setMinimum(previewMap.getMapSource().getMinZoom()); zoomSlider.setMaximum(previewMap.getMapSource().getMaxZoom()); updateGridSizeCombo(); @@ -913,12 +1015,6 @@ } } - private class SettingsButtonListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - SettingsGUI.showSettingsDialog(MainGUI.this); - } - } - private void updateZoomLevelCheckBoxes() { MapSource tileSource = previewMap.getMapSource(); int zoomLevels = tileSource.getMaxZoom() - tileSource.getMinZoom() + 1; @@ -979,7 +1075,8 @@ } public MapSource getSelectedMapSource() { - return (MapSource) mapSourceCombo.getSelectedItem(); + mapSourceTree.selectClickedMapSource(); + return mapSourceTree.getSelectedMapSource(); } public SelectedZoomLevels getSelectedZoomLevels() { @@ -987,18 +1084,18 @@ } public void selectNextMapSource() { - if (mapSourceCombo.getSelectedIndex() == mapSourceCombo.getItemCount() - 1) { + if (!mapSourceTree.selectNextMapSource()) { Toolkit.getDefaultToolkit().beep(); } else { - mapSourceCombo.setSelectedIndex(mapSourceCombo.getSelectedIndex() + 1); + mapSourceChanged(mapSourceTree.getSelectedMapSource()); } } public void selectPreviousMapSource() { - if (mapSourceCombo.getSelectedIndex() == 0) { + if (!mapSourceTree.selectPreviousMapSource()) { Toolkit.getDefaultToolkit().beep(); } else { - mapSourceCombo.setSelectedIndex(mapSourceCombo.getSelectedIndex() - 1); + mapSourceChanged(mapSourceTree.getSelectedMapSource()); } } @@ -1007,7 +1104,8 @@ calculateNrOfTilesToDownload(); // if (newMapSource != null && newMapSource.equals(mapSourceCombo.getSelectedItem())) // return; - mapSourceCombo.setSelectedItem(newMapSource); + mapSourceTree.selectMapSource(newMapSource); + mapSourcePanel.setMapSourceLabel(newMapSource); } public void mapSelectionControllerChanged(JMapController newMapController) { @@ -1124,5 +1222,4 @@ s.mainWindow.position = getLocation(); } } - } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/mapview/JMapViewer.java mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/mapview/JMapViewer.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/mapview/JMapViewer.java 2014-02-06 05:48:04.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/mapview/JMapViewer.java 2014-10-09 09:31:04.000000000 +0000 @@ -47,6 +47,7 @@ import mobac.gui.mapview.layer.MapGridLayer; import mobac.program.interfaces.MapSource; import mobac.program.interfaces.MapSpace; +import mobac.utilities.I18nUtils; import mobac.utilities.Utilities; import org.apache.log4j.Logger; @@ -467,9 +468,9 @@ * the previous zoom level */ protected void zoomChanged(int oldZoom) { - zoomSlider.setToolTipText("Zoom level " + zoom); - zoomInButton.setToolTipText("Zoom to level " + (zoom + 1)); - zoomOutButton.setToolTipText("Zoom to level " + (zoom - 1)); + zoomSlider.setToolTipText(I18nUtils.localizedStringForKey("map_viewer_zoom_tooltip") + " " + zoom); + zoomInButton.setToolTipText(I18nUtils.localizedStringForKey("map_viewer_zoom_to_tooltip") + " " + (zoom + 1)); + zoomOutButton.setToolTipText(I18nUtils.localizedStringForKey("map_viewer_zoom_to_tooltip") + " " + (zoom - 1)); zoomOutButton.setEnabled(zoom > mapSource.getMinZoom()); zoomInButton.setEnabled(zoom < mapSource.getMaxZoom()); } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/mapview/JobDispatcher.java mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/mapview/JobDispatcher.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/mapview/JobDispatcher.java 2014-02-06 05:48:04.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/mapview/JobDispatcher.java 2014-10-15 11:27:56.000000000 +0000 @@ -25,6 +25,7 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; +import mobac.program.interfaces.MapSourceCallerThreadInfo; import mobac.program.tilestore.berkeleydb.DelayedInterruptThread; import org.apache.log4j.Logger; @@ -80,11 +81,24 @@ id = WORKER_THREAD_ID++; } log.trace("New map preview worker thread created with id=" + id); - return new DelayedInterruptThread(r, "Map preview thread " + id); + return new MapPreviewThread(r, "Map preview thread " + id); } public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { log.error("Map preview job rejected: " + r); } + public class MapPreviewThread extends DelayedInterruptThread implements MapSourceCallerThreadInfo { + + public MapPreviewThread(Runnable target, String name) { + super(target, name); + } + + @Override + public boolean isMapPreviewThread() { + return true; + } + + + } } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/mapview/PreviewMap.java mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/mapview/PreviewMap.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/mapview/PreviewMap.java 2014-02-06 05:48:04.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/mapview/PreviewMap.java 2016-04-21 11:29:40.000000000 +0000 @@ -25,6 +25,8 @@ import java.awt.image.BufferedImage; import java.util.LinkedList; +import org.apache.log4j.Logger; + import mobac.gui.mapview.controller.DefaultMapController; import mobac.gui.mapview.controller.JMapController; import mobac.gui.mapview.controller.MapKeyboardController; @@ -34,6 +36,7 @@ import mobac.program.interfaces.MapSource; import mobac.program.interfaces.MapSourceTextAttribution; import mobac.program.interfaces.MapSpace; +import mobac.program.interfaces.RefreshableMapSource; import mobac.program.model.Bookmark; import mobac.program.model.EastNorthCoordinate; import mobac.program.model.MapSelection; @@ -42,8 +45,6 @@ import mobac.utilities.I18nUtils; import mobac.utilities.MyMath; -import org.apache.log4j.Logger; - public class PreviewMap extends JMapViewer { private static final long serialVersionUID = 1L; @@ -132,7 +133,7 @@ @Override public void setMapSource(MapSource newMapSource) { - if (newMapSource.equals(mapSource)) + if (newMapSource == null || newMapSource.equals(mapSource)) return; log.trace("Preview map source changed from " + mapSource + " to " + newMapSource); super.setMapSource(newMapSource); @@ -472,6 +473,9 @@ */ public void refreshMap() { tileCache.clear(); + if (mapSource instanceof RefreshableMapSource) { + ((RefreshableMapSource) mapSource).refresh(); + } repaint(); } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/mapview/TileLoader.java mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/mapview/TileLoader.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/mapview/TileLoader.java 2014-02-06 05:48:04.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/mapview/TileLoader.java 2015-11-26 11:05:32.000000000 +0000 @@ -19,6 +19,7 @@ //License: GPL. Copyright 2008 by Jan Peter Stotz import java.awt.image.BufferedImage; +import java.io.FileNotFoundException; import java.net.ConnectException; import mobac.exceptions.DownloadFailedException; @@ -108,10 +109,8 @@ listener.tileLoadingFinished(tile, false); } return; - } catch (ConnectException e) { - log.warn("Downloading of " + tile + " failed " + e.getMessage()); - } catch (DownloadFailedException e) { - log.warn("Downloading of " + tile + " failed " + e.getMessage()); + } catch (ConnectException | FileNotFoundException | DownloadFailedException e) { + log.warn("Downloading of " + tile + " failed: " + e.getMessage()); } catch (Exception e) { log.debug("Downloading of " + tile + " failed", e); } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/panels/JMapSourcesPanel.java mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/panels/JMapSourcesPanel.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/panels/JMapSourcesPanel.java 1970-01-01 00:00:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/panels/JMapSourcesPanel.java 2014-09-04 11:21:16.000000000 +0000 @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) MOBAC developers + * + * 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 2 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 . + ******************************************************************************/ +package mobac.gui.panels; + +import java.awt.Dimension; +import java.awt.GridBagLayout; + +import javax.swing.JLabel; +import javax.swing.JScrollPane; + +import mobac.gui.components.JCollapsiblePanel; +import mobac.gui.components.JMapSourceTree; +import mobac.program.interfaces.MapSource; +import mobac.utilities.GBC; +import mobac.utilities.I18nUtils; + +public class JMapSourcesPanel extends JCollapsiblePanel { + + private static final long serialVersionUID = 1L; + protected JLabel mapSourceLabel; + + // initialMapSourceLabel can't be empty to let the mapSourceLabel initialize with a proper height + protected static final String initialMapSourceLabel = " "; + + protected final String plainTitle; + + public JMapSourcesPanel(JMapSourceTree mapSourceTree) { + super(I18nUtils.localizedStringForKey("lp_map_source_title"), new GridBagLayout()); + plainTitle = getTitle(); + + JScrollPane mapSourceTreeScrollPane = new JScrollPane(mapSourceTree, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, + JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + + mapSourceTreeScrollPane.setPreferredSize(new Dimension(100, 200)); + mapSourceTreeScrollPane.setAutoscrolls(true); + addContent(mapSourceTreeScrollPane, GBC.eol().fill().insets(0, 1, 0, 0)); + } + + @Override + protected void fillTitlePanel() { + super.fillTitlePanel(); + mapSourceLabel = new JLabel(initialMapSourceLabel); + mapSourceLabel.addMouseListener(collapsingMouseListener); + titlePanel.add(mapSourceLabel, GBC.std()); + titlePanel.revalidate(); + } + + public void setMapSourceLabel(MapSource mapSource) { + String mapSourceString = mapSource.toString(); + if (mapSourceString == null) { + mapSourceString = ""; + } + + mapSourceLabel.setText(mapSourceString); + mapSourceLabel.setToolTipText(JMapSourceTree.generateMapSourceTooltip(mapSource)); + mapSourceLabel.setVisible(!mapSourceString.isEmpty()); + } +} diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/panels/JTileStoreCoveragePanel.java mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/panels/JTileStoreCoveragePanel.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/panels/JTileStoreCoveragePanel.java 2014-02-06 05:48:02.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/panels/JTileStoreCoveragePanel.java 2016-04-14 11:43:14.000000000 +0000 @@ -16,7 +16,7 @@ ******************************************************************************/ package mobac.gui.panels; -import java.awt.FlowLayout; +import java.awt.Dimension; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -25,7 +25,6 @@ import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JLabel; -import javax.swing.JPanel; import mobac.gui.components.JCollapsiblePanel; import mobac.gui.mapview.PreviewMap; diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/settings/SettingsGUI.java mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/settings/SettingsGUI.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/gui/settings/SettingsGUI.java 2014-02-06 05:48:02.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/gui/settings/SettingsGUI.java 2014-09-24 11:25:40.000000000 +0000 @@ -397,22 +397,14 @@ JPanel rightPanel = new JPanel(new BorderLayout()); rightPanel.setBorder(createSectionBorder(I18nUtils.localizedStringForKey("set_mapsrc_mgr_title_disabled"))); - JButton up = new JButton(Utilities.loadResourceImageIcon("arrow_blue_up.png")); - up.setToolTipText(I18nUtils.localizedStringForKey("set_mapsrc_mgr_move_up_tips")); - JButton down = new JButton(Utilities.loadResourceImageIcon("arrow_blue_down.png")); - down.setToolTipText(I18nUtils.localizedStringForKey("set_mapsrc_mgr_move_down_tips")); JButton toLeft = new JButton(Utilities.loadResourceImageIcon("arrow_blue_left.png")); toLeft.setToolTipText(I18nUtils.localizedStringForKey("set_mapsrc_mgr_move_left_tips")); JButton toRight = new JButton(Utilities.loadResourceImageIcon("arrow_blue_right.png")); toRight.setToolTipText(I18nUtils.localizedStringForKey("set_mapsrc_mgr_move_right_tips")); Insets buttonInsets = new Insets(4, 4, 4, 4); Dimension buttonDimension = new Dimension(40, 40); - up.setPreferredSize(buttonDimension); - down.setPreferredSize(buttonDimension); toLeft.setPreferredSize(buttonDimension); toRight.setPreferredSize(buttonDimension); - up.setMargin(buttonInsets); - down.setMargin(buttonInsets); toLeft.setMargin(buttonInsets); toRight.setMargin(buttonInsets); @@ -437,46 +429,10 @@ disabledMapSourcesModel.sort(); } }); - up.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - int[] idx = enabledMapSources.getSelectedIndices(); - if (idx.length == 0) - return; - for (int i = 0; i < idx.length; i++) { - int index = idx[i]; - if (index == 0) - return; - if (enabledMapSourcesModel.moveUp(index)) - idx[i]--; - } - enabledMapSources.setSelectedIndices(idx); - enabledMapSources.ensureIndexIsVisible(idx[0]); - } - }); - down.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - int[] idx = enabledMapSources.getSelectedIndices(); - if (idx.length == 0) - return; - for (int i = idx.length - 1; i >= 0; i--) { - int index = idx[i]; - if (index == enabledMapSourcesModel.getSize() - 1) - return; - if (enabledMapSourcesModel.moveDown(index)) - idx[i]++; - } - enabledMapSources.setSelectedIndices(idx); - enabledMapSources.ensureIndexIsVisible(idx[idx.length - 1]); - } - }); GBC buttonGbc = GBC.eol(); centerPanel.add(Box.createVerticalStrut(25), GBC.eol()); centerPanel.add(toLeft, buttonGbc); centerPanel.add(toRight, buttonGbc); - centerPanel.add(up, buttonGbc); - centerPanel.add(down, buttonGbc); centerPanel.add(Box.createVerticalGlue(), GBC.std().fill()); MapSourcesManager msManager = MapSourcesManager.getInstance(); diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/AbstractHttpMapSource.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/AbstractHttpMapSource.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/AbstractHttpMapSource.java 2014-02-06 05:48:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/AbstractHttpMapSource.java 2014-09-24 11:25:42.000000000 +0000 @@ -55,7 +55,7 @@ protected HttpMapSource.TileUpdate tileUpdate; protected MapSpace mapSpace = MercatorPower2MapSpace.INSTANCE_256; protected MapSourceLoaderInfo loaderInfo = null; - + public AbstractHttpMapSource(String name, int minZoom, int maxZoom, TileImageType tileType) { this(name, minZoom, maxZoom, tileType, HttpMapSource.TileUpdate.None); } @@ -75,9 +75,8 @@ this.tileType = tileType; this.tileUpdate = tileUpdate; } - - public boolean ignoreContentMismatch() - { + + public boolean ignoreContentMismatch() { return false; } @@ -197,7 +196,7 @@ public void setLoaderInfo(MapSourceLoaderInfo loaderInfo) { if (this.loaderInfo != null) - throw new RuntimeException("LoaderInfo already set"); + throw new RuntimeException("LoaderInfo already set for map source " + name); this.loaderInfo = loaderInfo; } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/AbstractMultiLayerMapSource.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/AbstractMultiLayerMapSource.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/AbstractMultiLayerMapSource.java 2014-02-06 05:48:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/AbstractMultiLayerMapSource.java 2014-09-24 11:25:42.000000000 +0000 @@ -29,6 +29,7 @@ import javax.imageio.ImageIO; import javax.xml.bind.annotation.XmlTransient; +import mobac.exceptions.MapSourceInitializationException; import mobac.exceptions.TileException; import mobac.gui.mapview.PreviewMap; import mobac.program.interfaces.InitializableMapSource; @@ -76,7 +77,7 @@ } @Override - public void initialize() { + public void initialize() throws MapSourceInitializationException { MapSource refMapSource = mapSources[0]; mapSpace = refMapSource.getMapSpace(); maxZoom = PreviewMap.MAX_ZOOM; @@ -192,6 +193,9 @@ if (this.loaderInfo != null) throw new RuntimeException("LoaderInfo already set"); this.loaderInfo = loaderInfo; + for (MapSource ms : mapSources) { + ms.setLoaderInfo(loaderInfo); + } } } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/custom/BeanShellHttpMapSource.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/custom/BeanShellHttpMapSource.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/custom/BeanShellHttpMapSource.java 2014-02-06 05:48:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/custom/BeanShellHttpMapSource.java 2016-04-24 08:39:52.000000000 +0000 @@ -9,7 +9,10 @@ import java.io.StringWriter; import java.net.HttpURLConnection; import java.net.URL; +import java.nio.charset.StandardCharsets; +import bsh.EvalError; +import bsh.Interpreter; import mobac.exceptions.TileException; import mobac.gui.mapview.PreviewMap; import mobac.mapsources.AbstractHttpMapSource; @@ -18,10 +21,7 @@ import mobac.program.interfaces.MapSpace; import mobac.program.jaxb.ColorAdapter; import mobac.program.model.TileImageType; -import mobac.utilities.Charsets; import mobac.utilities.Utilities; -import bsh.EvalError; -import bsh.Interpreter; public class BeanShellHttpMapSource extends AbstractHttpMapSource { @@ -36,10 +36,12 @@ private boolean ignoreError = false; + private String displayName = null; + public static BeanShellHttpMapSource load(File f) throws EvalError, IOException { FileInputStream in = new FileInputStream(f); try { - BufferedReader br = new BufferedReader(new InputStreamReader(in, Charsets.UTF_8)); + BufferedReader br = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8)); StringWriter sw = new StringWriter(); String line = br.readLine(); while (line != null) { @@ -63,8 +65,13 @@ i.eval("import mobac.utilities.beanshell.*;"); i.eval(code); Object o = i.get("name"); - if (o != null) + if (o != null) { name = (String) o; + } + o = i.get("displayName"); + if (o != null) { + displayName = (String) o; + } o = i.get("tileSize"); if (o != null) { @@ -140,8 +147,8 @@ } @Override - public byte[] getTileData(int zoom, int x, int y, LoadMethod loadMethod) throws IOException, TileException, - InterruptedException { + public byte[] getTileData(int zoom, int x, int y, LoadMethod loadMethod) + throws IOException, TileException, InterruptedException { if (!ignoreError) return super.getTileData(zoom, x, y, loadMethod); try { @@ -184,6 +191,14 @@ return name; } + @Override + public String toString() { + if (displayName != null) { + return displayName; + } + return name; + } + @Override public TileUpdate getTileUpdate() { return tileUpdate; diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/custom/CustomCloudMade.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/custom/CustomCloudMade.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/custom/CustomCloudMade.java 2014-02-06 05:48:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/custom/CustomCloudMade.java 2014-09-24 11:25:42.000000000 +0000 @@ -16,8 +16,6 @@ ******************************************************************************/ package mobac.mapsources.custom; -import java.lang.reflect.Constructor; - import javax.swing.JOptionPane; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @@ -46,18 +44,12 @@ public String displayName; public MapSource getMapSource() { - try { - Constructor c = CLOUD_MADE_CLASS.getConstructor(String.class, String.class); - return c.newInstance(styleID, displayName); - } catch (Exception e) { - String errorMsg = I18nUtils.localizedStringForKey("msg_environment_error_load_cloudmade"); - if (!ERROR) { - JOptionPane.showMessageDialog(null, errorMsg, - I18nUtils.localizedStringForKey("Error"), JOptionPane.ERROR_MESSAGE); - ERROR = true; - } - throw new RuntimeException(errorMsg, e); + if (!ERROR) { + JOptionPane.showMessageDialog(null, "CloudMade map sources are no longer supported", + I18nUtils.localizedStringForKey("Error"), JOptionPane.ERROR_MESSAGE); + ERROR = true; } + return null; } } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/custom/CustomCombinedMapSource.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/custom/CustomCombinedMapSource.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/custom/CustomCombinedMapSource.java 1970-01-01 00:00:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/custom/CustomCombinedMapSource.java 2015-01-08 06:20:40.000000000 +0000 @@ -0,0 +1,158 @@ +/******************************************************************************* + * Copyright (c) MOBAC developers + * + * 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 2 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 . + ******************************************************************************/ +package mobac.mapsources.custom; + +import java.awt.Color; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.util.ArrayList; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlElements; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + +import mobac.exceptions.MapSourceInitializationException; +import mobac.exceptions.TileException; +import mobac.program.interfaces.FileBasedMapSource; +import mobac.program.interfaces.InitializableMapSource; +import mobac.program.interfaces.MapSource; +import mobac.program.interfaces.MapSpace; +import mobac.program.jaxb.ColorAdapter; +import mobac.program.model.MapSourceLoaderInfo; +import mobac.program.model.TileImageType; + +@XmlRootElement(name = "combined") +public class CustomCombinedMapSource implements InitializableMapSource { + + @XmlElementWrapper(name = "regionalMapSource") + @XmlElements({ + @XmlElement(name = "mapSource", type = StandardMapSourceLayer.class), + @XmlElement(name = "localTileSQLite", type = CustomLocalTileSQliteMapSource.class), + @XmlElement(name = "localTileFiles", type = CustomLocalTileFilesMapSource.class), + @XmlElement(name = "localTileZip", type = CustomLocalTileZipMapSource.class), + @XmlElement(name = "localImageFile", type = CustomLocalImageFileMapSource.class) }) + protected ArrayList regionalMapSource = new ArrayList(); + + @XmlElementWrapper(name = "baseMapSource") + @XmlElements({ @XmlElement(name = "customMapSource", type = CustomMapSource.class), + @XmlElement(name = "customWmsMapSource", type = CustomWmsMapSource.class), + @XmlElement(name = "mapSource", type = StandardMapSourceLayer.class), + @XmlElement(name = "cloudMade", type = CustomCloudMade.class), + @XmlElement(name = "mapsforge", type = CustomMapsforge.class), + @XmlElement(name = "localTileSQLite", type = CustomLocalTileSQliteMapSource.class), + @XmlElement(name = "localTileFiles", type = CustomLocalTileFilesMapSource.class), + @XmlElement(name = "localTileZip", type = CustomLocalTileZipMapSource.class), + @XmlElement(name = "localImageFile", type = CustomLocalImageFileMapSource.class) }) + protected ArrayList baseMapSource = new ArrayList(); + + @XmlElement + protected String name; + + @XmlElement(defaultValue = "#000000") + @XmlJavaTypeAdapter(ColorAdapter.class) + protected Color backgroundColor = Color.BLACK; + + @XmlElement + protected TileImageType tileType = TileImageType.PNG; + + public CustomCombinedMapSource() { + } + + @Override + public void initialize() throws MapSourceInitializationException { + if (regionalMapSource.size()==0) + throw new MapSourceInitializationException("Regional map missing"); + if (baseMapSource.size()==0) + throw new MapSourceInitializationException("Base map missing"); + if ((regionalMapSource.size()>1)|| baseMapSource.size()>1) + throw new MapSourceInitializationException("Invalid map source definition: multiple regional or base maps defined."); + if (!(regionalMapSource instanceof FileBasedMapSource)) + throw new MapSourceInitializationException("Invalid regional map file format. Only file based local maps are supported!"); + ((InitializableMapSource) regionalMapSource).initialize(); + if (baseMapSource instanceof InitializableMapSource) { + ((InitializableMapSource) baseMapSource).initialize(); + } + } + + @Override + public byte[] getTileData(int zoom, int x, int y, LoadMethod loadMethod) throws IOException, TileException, + InterruptedException { + try { + byte[] data = regionalMapSource.get(0).getTileData(zoom, x, y, loadMethod); + if (data != null) + return data; + } catch (Exception e) { + + } + return baseMapSource.get(0).getTileData(zoom, x, y, loadMethod); + } + + @Override + public BufferedImage getTileImage(int zoom, int x, int y, LoadMethod loadMethod) throws IOException, TileException, + InterruptedException { + try { + BufferedImage image = regionalMapSource.get(0).getTileImage(zoom, x, y, loadMethod); + if (image != null) + return image; + } catch (Exception e) { + + } + return baseMapSource.get(0).getTileImage(zoom, x, y, loadMethod); + } + + @Override + public TileImageType getTileImageType() { + return tileType; + } + + @Override + public int getMaxZoom() { + return baseMapSource.get(0).getMaxZoom(); + } + + @Override + public int getMinZoom() { + return baseMapSource.get(0).getMinZoom(); + } + + @Override + public String getName() { + return name; + } + + @Override + public MapSpace getMapSpace() { + return baseMapSource.get(0).getMapSpace(); + } + + @Override + public Color getBackgroundColor() { + return backgroundColor; + } + + @Override + public MapSourceLoaderInfo getLoaderInfo() { + return null; + } + + @Override + public void setLoaderInfo(MapSourceLoaderInfo loaderInfo) { + } + +} diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/custom/CustomMapsforge.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/custom/CustomMapsforge.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/custom/CustomMapsforge.java 1970-01-01 00:00:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/custom/CustomMapsforge.java 2016-08-15 12:04:22.000000000 +0000 @@ -0,0 +1,129 @@ +/******************************************************************************* + * Copyright (c) MOBAC developers + * + * 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 2 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 . + ******************************************************************************/ +package mobac.mapsources.custom; + +import java.io.File; +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JOptionPane; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +import org.apache.log4j.Logger; + +import mobac.exceptions.MapSourceInitializationException; +import mobac.mapsources.MapsforgeMapSource; +import mobac.program.DirectoryManager; +import mobac.program.model.MapSourceLoaderInfo; +import mobac.utilities.I18nUtils; +import mobac.utilities.Utilities; + +/** + * Requires the OpenStreetMap + * + * + */ +@XmlRootElement(name = "mapsforge") +public class CustomMapsforge extends MapsforgeMapSource { + + private static final Logger log = Logger.getLogger(CustomMapsforge.class); + + @XmlElement(nillable = false, defaultValue = "MapsforgeCustom") + private String name = "MapsforgeCustom"; + + @XmlElement(name = "mapFile") + private String[] mapFileNames; + + @XmlElement(name = "xmlRenderTheme", defaultValue = "") + private String xmlRenderThemeFileName = ""; + + @XmlElement(defaultValue = "0") + private int minZoom = 0; + + @XmlElement(defaultValue = "20") + private int maxZoom = 20; + + public CustomMapsforge() { + super(); + } + + @Override + public void initialize() throws MapSourceInitializationException { + xmlRenderThemeFileName = xmlRenderThemeFileName.trim(); + + // The custom map xml file used for loading this map + MapSourceLoaderInfo loaderInfo = getLoaderInfo(); + File mapSourceXmlDir = null; + if (loaderInfo != null) { + File mapSourceXmlFile = this.getLoaderInfo().getSourceFile(); + mapSourceXmlDir = mapSourceXmlFile.getParentFile(); + } + + List newMapFileList = new ArrayList<>(); + for (String mapFileName : mapFileNames) { + File mapFile = Utilities.findFile(mapFileName, mapSourceXmlDir, DirectoryManager.currentDir, + DirectoryManager.mapSourcesDir, DirectoryManager.userAppDataDir); + if (mapFile == null) { + JOptionPane.showMessageDialog(null, "Unable to find map file \"" + mapFileName + "\"", + I18nUtils.localizedStringForKey("Error"), JOptionPane.ERROR_MESSAGE); + return; + } + newMapFileList.add(mapFile); + } + this.mapFileList = newMapFileList; + + if (xmlRenderThemeFileName.length() > 0) { + File renderFile = Utilities.findFile(xmlRenderThemeFileName, mapSourceXmlDir, DirectoryManager.currentDir, + DirectoryManager.mapSourcesDir, DirectoryManager.userAppDataDir); + if (renderFile == null) { + JOptionPane.showMessageDialog(null, + "Unable to find xmlRenderTheme file \"" + xmlRenderThemeFileName + "\"", + I18nUtils.localizedStringForKey("Error"), JOptionPane.ERROR_MESSAGE); + return; + } + + try { + loadExternalRenderTheme(renderFile); + } catch (FileNotFoundException e) { + log.error("", e); + return; + } + } + super.initialize(); + } + + @Override + public String getName() { + return name; + } + + public int getMaxZoom() { + return maxZoom; + } + + public int getMinZoom() { + return minZoom; + } + + @Override + public String toString() { + return name; + } + +} diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/custom/CustomMapSource.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/custom/CustomMapSource.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/custom/CustomMapSource.java 2014-02-06 05:48:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/custom/CustomMapSource.java 2016-05-16 05:24:02.000000000 +0000 @@ -63,7 +63,7 @@ protected TileImageType tileType = TileImageType.PNG; @XmlElement(defaultValue = "NONE") - private HttpMapSource.TileUpdate tileUpdate; + private HttpMapSource.TileUpdate tileUpdate = TileUpdate.None; @XmlElement(required = true, nillable = false) protected String url = "http://127.0.0.1/{$x}_{$y}_{$z}"; @@ -82,9 +82,6 @@ @XmlList private String[] serverParts = null; private int currentServerPart = 0; - -// @XmlElement(required = false, defaultValue = "false") -// protected boolean ignoreContentMismatch = false; private MapSourceLoaderInfo loaderInfo = null; @@ -99,11 +96,6 @@ this.url = url; } -// public boolean ignoreContentMismatch() -// { -// return ignoreContentMismatch; -// } - public TileUpdate getTileUpdate() { return tileUpdate; } @@ -145,8 +137,8 @@ } } - public byte[] getTileData(int zoom, int x, int y, LoadMethod loadMethod) throws IOException, - UnrecoverableDownloadException, InterruptedException { + public byte[] getTileData(int zoom, int x, int y, LoadMethod loadMethod) + throws IOException, UnrecoverableDownloadException, InterruptedException { if (invertYCoordinate) y = ((1 << zoom) - y - 1); @@ -171,9 +163,9 @@ } } - public BufferedImage getTileImage(int zoom, int x, int y, LoadMethod loadMethod) throws IOException, - UnrecoverableDownloadException, InterruptedException { - + public BufferedImage getTileImage(int zoom, int x, int y, LoadMethod loadMethod) + throws IOException, UnrecoverableDownloadException, InterruptedException { + byte[] data = getTileData(zoom, x, y, loadMethod); if (data == null) { diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/custom/CustomMultiLayerMapSource.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/custom/CustomMultiLayerMapSource.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/custom/CustomMultiLayerMapSource.java 2014-02-06 05:48:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/custom/CustomMultiLayerMapSource.java 2014-09-24 11:25:42.000000000 +0000 @@ -49,6 +49,7 @@ @XmlElement(name = "customWmsMapSource", type = CustomWmsMapSource.class), @XmlElement(name = "mapSource", type = StandardMapSourceLayer.class), @XmlElement(name = "cloudMade", type = CustomCloudMade.class), + @XmlElement(name = "mapsforge", type = CustomMapsforge.class), @XmlElement(name = "localTileSQLite", type = CustomLocalTileSQliteMapSource.class), @XmlElement(name = "localTileFiles", type = CustomLocalTileFilesMapSource.class), @XmlElement(name = "localTileZip", type = CustomLocalTileZipMapSource.class), diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/custom/StandardMapSourceLayer.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/custom/StandardMapSourceLayer.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/custom/StandardMapSourceLayer.java 2014-02-06 05:48:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/custom/StandardMapSourceLayer.java 2014-09-24 11:25:40.000000000 +0000 @@ -40,6 +40,8 @@ protected MapSource mapSource = null; + protected MapSourceLoaderInfo loaderInfo = null; + @XmlElement(name = "name") protected String mapSourceName; @@ -50,7 +52,7 @@ protected void afterUnmarshal(Unmarshaller u, Object parent) { mapSource = MapSourcesManager.getInstance().getSourceByName(mapSourceName); if (mapSource == null) - throw new RuntimeException("Invalid map source name used: " + mapSourceName); + throw new RuntimeException("Unknown map source name used: " + mapSourceName); } public int getMaxZoom() { @@ -99,11 +101,11 @@ @XmlTransient public MapSourceLoaderInfo getLoaderInfo() { - return mapSource.getLoaderInfo(); + return loaderInfo; } public void setLoaderInfo(MapSourceLoaderInfo loaderInfo) { - mapSource.setLoaderInfo(loaderInfo); + this.loaderInfo = loaderInfo; } @Override diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/DefaultMapSourcesManager.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/DefaultMapSourcesManager.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/DefaultMapSourcesManager.java 2014-02-06 05:47:58.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/DefaultMapSourcesManager.java 2016-10-24 11:10:22.000000000 +0000 @@ -36,6 +36,7 @@ import mobac.mapsources.loader.CustomMapSourceLoader; import mobac.mapsources.loader.EclipseMapPackLoader; import mobac.mapsources.loader.MapPackManager; +import mobac.mapsources.mappacks.openstreetmap.Osm4uMaps; import mobac.program.interfaces.MapSource; import mobac.program.model.Settings; import mobac.utilities.I18nUtils; @@ -63,6 +64,7 @@ protected void loadMapSources() { try { boolean devMode = Settings.getInstance().devMode; + addMapSource(new MapsforgeMapSource()); if (devMode) { addMapSource(new DebugMapSource()); addMapSource(new DebugLocalMapSource()); @@ -83,7 +85,7 @@ try { MapPackManager mpm = new MapPackManager(mapSourcesDir); mpm.installUpdates(); - if (!devMode || !loadMapPacksEclipseMode()) { + if (!loadMapPacksEclipseMode()) { mpm.loadMapPacks(this); } } catch (Exception e) { @@ -133,7 +135,16 @@ } } } - allMapSources.put(mapSource.getName(), mapSource); + + String mapSourceName = mapSource.getName(); + if(allMapSources.containsKey(mapSourceName)) { + JOptionPane.showMessageDialog(null, + String.format(I18nUtils.localizedStringForKey("msg_environment_error_duplicate_map_source"), mapSourceName, mapSource.getLoaderInfo().getSourceFile() ), + I18nUtils.localizedStringForKey("Error"), + JOptionPane.ERROR_MESSAGE); + } else { + allMapSources.put(mapSourceName, mapSource); + } } public static void initialize() { @@ -219,7 +230,7 @@ @Override public MapSource getDefaultMapSource() { - MapSource ms = getSourceByName("MapQuest");// DEFAULT; + MapSource ms = getSourceByName(Osm4uMaps.NAME);// DEFAULT; if (ms != null) return ms; // Fallback: return first diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/impl/DebugMapSource.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/impl/DebugMapSource.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/impl/DebugMapSource.java 2014-02-06 05:47:58.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/impl/DebugMapSource.java 2014-04-12 11:37:02.000000000 +0000 @@ -36,7 +36,7 @@ public class DebugMapSource implements MapSource { - private int pngCompressionLevel = Deflater.BEST_SPEED; + private int pngCompressionLevel = Deflater.NO_COMPRESSION; private static final byte[] COLORS = { 0,// (byte) 0xff, (byte) 0xff, (byte) 0xff, // white diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/impl/DebugRandomLocalMapSource.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/impl/DebugRandomLocalMapSource.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/impl/DebugRandomLocalMapSource.java 2014-02-06 05:47:58.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/impl/DebugRandomLocalMapSource.java 2014-04-12 11:37:02.000000000 +0000 @@ -16,58 +16,13 @@ ******************************************************************************/ package mobac.mapsources.impl; -import java.awt.Color; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.security.SecureRandom; - -import javax.imageio.ImageIO; - -import mobac.exceptions.UnrecoverableDownloadException; -import mobac.gui.mapview.PreviewMap; -import mobac.mapsources.mapspace.MercatorPower2MapSpace; import mobac.program.interfaces.FileBasedMapSource; -import mobac.program.interfaces.MapSource; -import mobac.program.interfaces.MapSpace; -import mobac.program.model.MapSourceLoaderInfo; -import mobac.program.model.TileImageType; /** * A {@link FileBasedMapSource} for debugging and testing purposes */ -public class DebugRandomLocalMapSource implements MapSource, FileBasedMapSource { +public class DebugRandomLocalMapSource extends DebugRandomMapSource implements FileBasedMapSource { - BufferedImage image = null; - byte[] imageData = null; - - public Color getBackgroundColor() { - return Color.BLACK; - } - - public MapSpace getMapSpace() { - return MercatorPower2MapSpace.INSTANCE_256; - } - - public int getMaxZoom() { - return PreviewMap.MAX_ZOOM; - } - - public int getMinZoom() { - return 0; - } - - @Override - public TileImageType getTileImageType() { - return TileImageType.PNG; - } - - public void initialize() { - } - - public void reinitialize() { - } @Override public String getName() { @@ -79,59 +34,4 @@ return "Debug Random (local)"; } - public byte[] getTileData(int zoom, int x, int y, LoadMethod loadMethod) throws IOException, - UnrecoverableDownloadException, InterruptedException { - if (imageData != null) - return imageData; - synchronized (this) { - if (imageData != null) - return imageData; - ByteArrayOutputStream buf = new ByteArrayOutputStream(16000); - BufferedImage image = getTileImage(zoom, x, y, loadMethod); - if (image == null) - return null; - ImageIO.write(image, "png", buf); - imageData = buf.toByteArray(); - return imageData; - } - } - - public BufferedImage getTileImage(int zoom, int x, int y, LoadMethod loadMethod) throws IOException, - UnrecoverableDownloadException, InterruptedException { - if (image != null) - return image; - synchronized (this) { - if (image != null) - return image; - BufferedImage image = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB); - Graphics2D g2 = image.createGraphics(); - SecureRandom rnd = new SecureRandom(); - try { - g2.setColor(Color.WHITE); - g2.fillRect(0, 0, 255, 255); - for (int i = 0; i < 100; i++) { - g2.setColor(new Color(rnd.nextInt())); - int x1 = rnd.nextInt(256); - int y1 = rnd.nextInt(256); - int x2 = rnd.nextInt(256); - int y2 = rnd.nextInt(256); - g2.drawLine(x1, y1, x2, y2); - } - g2.setColor(Color.RED); - this.image = image; - return image; - } finally { - g2.dispose(); - } - } - } - - @Override - public MapSourceLoaderInfo getLoaderInfo() { - return null; - } - - @Override - public void setLoaderInfo(MapSourceLoaderInfo loaderInfo) { - } } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/impl/DebugRandomMapSource.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/impl/DebugRandomMapSource.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/impl/DebugRandomMapSource.java 1970-01-01 00:00:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/impl/DebugRandomMapSource.java 2014-04-12 11:37:02.000000000 +0000 @@ -0,0 +1,137 @@ +/******************************************************************************* + * Copyright (c) MOBAC developers + * + * 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 2 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 . + ******************************************************************************/ +package mobac.mapsources.impl; + +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.security.SecureRandom; + +import javax.imageio.ImageIO; + +import mobac.exceptions.UnrecoverableDownloadException; +import mobac.gui.mapview.PreviewMap; +import mobac.mapsources.mapspace.MercatorPower2MapSpace; +import mobac.program.interfaces.FileBasedMapSource; +import mobac.program.interfaces.MapSource; +import mobac.program.interfaces.MapSpace; +import mobac.program.model.MapSourceLoaderInfo; +import mobac.program.model.TileImageType; + +/** + * A {@link FileBasedMapSource} for debugging and testing purposes + */ +public class DebugRandomMapSource implements MapSource { + + BufferedImage image = null; + byte[] imageData = null; + + public Color getBackgroundColor() { + return Color.BLACK; + } + + public MapSpace getMapSpace() { + return MercatorPower2MapSpace.INSTANCE_256; + } + + public int getMaxZoom() { + return PreviewMap.MAX_ZOOM; + } + + public int getMinZoom() { + return 0; + } + + @Override + public TileImageType getTileImageType() { + return TileImageType.PNG; + } + + public void initialize() { + } + + public void reinitialize() { + } + + @Override + public String getName() { + return "DebugRandom"; + } + + @Override + public String toString() { + return "Debug Random"; + } + + public byte[] getTileData(int zoom, int x, int y, LoadMethod loadMethod) throws IOException, + UnrecoverableDownloadException, InterruptedException { + if (imageData != null) + return imageData; + synchronized (this) { + if (imageData != null) + return imageData; + ByteArrayOutputStream buf = new ByteArrayOutputStream(16000); + BufferedImage image = getTileImage(zoom, x, y, loadMethod); + if (image == null) + return null; + ImageIO.write(image, "png", buf); + imageData = buf.toByteArray(); + return imageData; + } + } + + public BufferedImage getTileImage(int zoom, int x, int y, LoadMethod loadMethod) throws IOException, + UnrecoverableDownloadException, InterruptedException { + if (image != null) + return image; + synchronized (this) { + if (image != null) + return image; + BufferedImage image = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB); + Graphics2D g2 = image.createGraphics(); + SecureRandom rnd = new SecureRandom(); + try { + g2.setColor(Color.WHITE); + g2.fillRect(0, 0, 255, 255); + for (int i = 0; i < 100; i++) { + g2.setColor(new Color(rnd.nextInt())); + int x1 = rnd.nextInt(256); + int y1 = rnd.nextInt(256); + int x2 = rnd.nextInt(256); + int y2 = rnd.nextInt(256); + g2.drawLine(x1, y1, x2, y2); + } + g2.setColor(Color.RED); + this.image = image; + return image; + } finally { + g2.dispose(); + } + } + } + + @Override + public MapSourceLoaderInfo getLoaderInfo() { + return null; + } + + @Override + public void setLoaderInfo(MapSourceLoaderInfo loaderInfo) { + } +} diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/loader/BeanShellMapSourceLoader.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/loader/BeanShellMapSourceLoader.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/loader/BeanShellMapSourceLoader.java 2014-02-06 05:48:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/loader/BeanShellMapSourceLoader.java 2014-09-24 11:25:42.000000000 +0000 @@ -1,6 +1,7 @@ package mobac.mapsources.loader; import java.io.File; +import java.util.List; import javax.swing.JOptionPane; @@ -8,7 +9,8 @@ import mobac.mapsources.custom.BeanShellHttpMapSource; import mobac.program.model.MapSourceLoaderInfo; import mobac.program.model.MapSourceLoaderInfo.LoaderType; -import mobac.utilities.file.FileExtFilter; +import mobac.utilities.Utilities; +import mobac.utilities.file.DirOrFileExtFilter; import org.apache.log4j.Logger; @@ -24,7 +26,7 @@ } public void loadBeanShellMapSources() { - File[] customMapSourceFiles = mapSourcesDir.listFiles(new FileExtFilter(".bsh")); + List customMapSourceFiles = Utilities.traverseFolder(mapSourcesDir, new DirOrFileExtFilter(".bsh")); for (File f : customMapSourceFiles) { try { BeanShellHttpMapSource mapSource = BeanShellHttpMapSource.load(f); diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/loader/CustomMapSourceLoader.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/loader/CustomMapSourceLoader.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/loader/CustomMapSourceLoader.java 2014-02-06 05:48:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/loader/CustomMapSourceLoader.java 2018-06-23 07:38:34.000000000 +0000 @@ -1,10 +1,12 @@ package mobac.mapsources.loader; import java.io.File; +import java.io.FileReader; +import java.io.IOException; import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; import javax.swing.JOptionPane; import javax.xml.bind.JAXBContext; @@ -13,6 +15,15 @@ import javax.xml.bind.ValidationEvent; import javax.xml.bind.ValidationEventHandler; import javax.xml.bind.ValidationEventLocator; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.log4j.Logger; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; import mobac.exceptions.MapSourceCreateException; import mobac.mapsources.MapSourcesManager; @@ -21,6 +32,7 @@ import mobac.mapsources.custom.CustomLocalTileSQliteMapSource; import mobac.mapsources.custom.CustomLocalTileZipMapSource; import mobac.mapsources.custom.CustomMapSource; +import mobac.mapsources.custom.CustomMapsforge; import mobac.mapsources.custom.CustomMultiLayerMapSource; import mobac.mapsources.custom.CustomWmsMapSource; import mobac.program.interfaces.FileBasedMapSource; @@ -28,45 +40,70 @@ import mobac.program.interfaces.WrappedMapSource; import mobac.program.model.MapSourceLoaderInfo; import mobac.program.model.MapSourceLoaderInfo.LoaderType; -import mobac.utilities.file.FileExtFilter; +import mobac.utilities.Utilities; +import mobac.utilities.file.DirOrFileExtFilter; -import org.apache.log4j.Logger; - -public class CustomMapSourceLoader implements ValidationEventHandler { +public class CustomMapSourceLoader { private final Logger log = Logger.getLogger(MapPackManager.class); private final MapSourcesManager mapSourcesManager; private final File mapSourcesDir; - private final Unmarshaller unmarshaller; + private final DocumentBuilderFactory dbFactory; + private final DocumentBuilder dBuilder; + private final JAXBContext context; public CustomMapSourceLoader(MapSourcesManager mapSourceManager, File mapSourcesDir) { this.mapSourcesManager = mapSourceManager; this.mapSourcesDir = mapSourcesDir; + dbFactory = DocumentBuilderFactory.newInstance(); try { - Class[] customMapClasses = new Class[] { CustomMapSource.class, CustomWmsMapSource.class, - CustomMultiLayerMapSource.class, CustomCloudMade.class, CustomLocalTileFilesMapSource.class, - CustomLocalTileZipMapSource.class, CustomLocalTileSQliteMapSource.class }; - JAXBContext context = JAXBContext.newInstance(customMapClasses); - unmarshaller = context.createUnmarshaller(); - unmarshaller.setEventHandler(this); + dBuilder = dbFactory.newDocumentBuilder(); + } catch (ParserConfigurationException e) { + throw new RuntimeException(e); + } + try { + Class[] customMapClasses = new Class[] { // + // + CustomMapSource.class, // + CustomWmsMapSource.class, // + CustomMultiLayerMapSource.class, // + // CustomCombinedMapSource.class, // + CustomMapsforge.class, // + CustomCloudMade.class, // + CustomLocalTileFilesMapSource.class, // + CustomLocalTileZipMapSource.class, // + CustomLocalTileSQliteMapSource.class // + }; + context = JAXBContext.newInstance(customMapClasses); } catch (JAXBException e) { throw new RuntimeException("Unable to create JAXB context for custom map sources", e); } } public void loadCustomMapSources() { - File[] customMapSourceFiles = mapSourcesDir.listFiles(new FileExtFilter(".xml")); - Arrays.sort(customMapSourceFiles); + List customMapSourceFiles = Utilities.traverseFolder(mapSourcesDir, new DirOrFileExtFilter(".xml")); + /* + * It is important to sort the files to be loaded, otherwise the order would be random which makes it difficult + * to reference custom map sources in a multi-layer map source if the referenced map source has not been loaded + * before. + * + * See https://sourceforge.net/p/mobac/bugs/294/ + */ + Collections.sort(customMapSourceFiles, new Comparator() { + @Override + public int compare(File f1, File f2) { + return f1.getName().compareTo(f2.getName()); + } + }); + for (File f : customMapSourceFiles) { try { - MapSource customMapSource; - Object o = unmarshaller.unmarshal(f); - if (o instanceof WrappedMapSource) - customMapSource = ((WrappedMapSource) o).getMapSource(); - else - customMapSource = (MapSource) o; - customMapSource.setLoaderInfo(new MapSourceLoaderInfo(LoaderType.XML, f)); + MapSource customMapSource = loadCustomMapSource(f); + if (customMapSource == null) { + log.info("Ingnoring xml file \"" + f.getName() + "\" - not a custom MOBAC XML map file"); + continue; // an element to be ignored + } if (!(customMapSource instanceof FileBasedMapSource) && customMapSource.getTileImageType() == null) log.warn("A problem occured while loading \"" + f.getName() + "\": tileType is null - some atlas formats will produce an error!"); @@ -78,49 +115,85 @@ } } - public MapSource loadCustomMapSource(InputStream in) throws MapSourceCreateException, JAXBException { - MapSource customMapSource; - Object o = unmarshaller.unmarshal(in); - if (o instanceof WrappedMapSource) - customMapSource = ((WrappedMapSource) o).getMapSource(); - else - customMapSource = (MapSource) o; - customMapSource.setLoaderInfo(new MapSourceLoaderInfo(LoaderType.XML, null)); - log.trace("Custom map source loaded: " + customMapSource); - return customMapSource; - } + public MapSource loadCustomMapSource(File mapSourceFile) + throws MapSourceCreateException, JAXBException, IOException, SAXException { - public boolean handleEvent(ValidationEvent event) { - ValidationEventLocator loc = event.getLocator(); - String file = loc.getURL().getFile(); try { - file = URLDecoder.decode(file, "UTF-8"); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException(e); - } - int lastSlash = file.lastIndexOf('/'); - if (lastSlash > 0) - file = file.substring(lastSlash + 1); - - String errorMsg = event.getMessage(); - if (errorMsg == null) { - Throwable t = event.getLinkedException(); - while (t != null && errorMsg == null) { - errorMsg = t.getMessage(); - t = t.getCause(); + Document doc = dBuilder.parse(mapSourceFile); + Element elem = doc.getDocumentElement(); + if ("rendertheme".equals(elem.getTagName())) { + return null; } + } catch (Exception e) { + + } + try (FileReader reader = new FileReader(mapSourceFile)) { + return internalLoadMapSource(new InputSource(reader), mapSourceFile); } + } - JOptionPane - .showMessageDialog(null, "

    Failed to load a custom map

    " + errorMsg - + "


    file: \"" + file + "\"
    line/column: " + loc.getLineNumber() - + "/" + loc.getColumnNumber() + "

    ", "Error: custom map loading failed", - JOptionPane.ERROR_MESSAGE); - log.error(event.toString()); - return false; + public MapSource loadCustomMapSource(InputStream in) + throws MapSourceCreateException, SAXException, IOException, JAXBException { + return internalLoadMapSource(new InputSource(in), null); } - public static class WrappedMap { + /** + * Load custom map source from XML document DOM + * + * @param source + * @param loaderInfoFile + * @return + * @throws MapSourceCreateException + * @throws JAXBException + * @throws SAXException + * @throws IOException + */ + protected MapSource internalLoadMapSource(InputSource source, final File loaderInfoFile) + throws MapSourceCreateException, SAXException, IOException, JAXBException { + MapSource customMapSource; + + // check for mapsforge rendertheme and if it is one ignore it + + Unmarshaller unmarshaller = context.createUnmarshaller(); + unmarshaller.setEventHandler(new ValidationEventHandler() { + @Override + public boolean handleEvent(ValidationEvent event) { + ValidationEventLocator loc = event.getLocator(); + String file = ""; + if (loaderInfoFile != null) { + file = loaderInfoFile.getName(); + } + int lastSlash = file.lastIndexOf('/'); + if (lastSlash > 0) + file = file.substring(lastSlash + 1); + + String errorMsg = event.getMessage(); + if (errorMsg == null) { + Throwable t = event.getLinkedException(); + while (t != null && errorMsg == null) { + errorMsg = t.getMessage(); + t = t.getCause(); + } + } + + JOptionPane.showMessageDialog(null, + "

    Failed to load a custom map

    " + errorMsg + "


    file: \"" + + file + "\"
    line/column: " + loc.getLineNumber() + "/" + + loc.getColumnNumber() + "

    ", + "Error: custom map loading failed", JOptionPane.ERROR_MESSAGE); + log.error(event.toString()); + return false; + } + }); + Object o = unmarshaller.unmarshal(source); + if (o instanceof WrappedMapSource) + customMapSource = ((WrappedMapSource) o).getMapSource(); + else + customMapSource = (MapSource) o; + customMapSource.setLoaderInfo(new MapSourceLoaderInfo(LoaderType.XML, loaderInfoFile)); + log.trace("Custom map source loaded: " + customMapSource); + return customMapSource; } + } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/loader/EclipseMapPackLoader.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/loader/EclipseMapPackLoader.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/loader/EclipseMapPackLoader.java 2014-02-06 05:48:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/loader/EclipseMapPackLoader.java 2016-11-10 06:15:10.000000000 +0000 @@ -18,16 +18,16 @@ import java.io.File; import java.io.IOException; -import java.net.URISyntaxException; +import java.net.URL; +import java.nio.charset.StandardCharsets; + +import org.apache.log4j.Logger; import mobac.mapsources.MapSourcesManager; import mobac.program.interfaces.MapSource; -import mobac.utilities.Charsets; import mobac.utilities.Utilities; import mobac.utilities.file.DirectoryFileFilter; -import org.apache.log4j.Logger; - /** * For map sources debugging inside eclipse. Allows to load the map sources directly from program class path instead of * the map packs. @@ -45,12 +45,16 @@ public boolean loadMapPacks() throws IOException { ClassLoader cl = EclipseMapPackLoader.class.getClassLoader(); + if (cl == null) + cl = ClassLoader.getSystemClassLoader(); boolean success = false; - File binDir; + URL clURL = cl.getResource("."); + File binDir = null; try { - binDir = new File(cl.getResource(".").toURI()); - } catch (URISyntaxException e) { - throw new IOException(e); + binDir = new File(clURL.toURI()); + } catch (Exception e) { + log.error("Error while testing for \"bin\" directory: " + e.getMessage()); + return false; } File mapPackDir = new File(binDir, "mobac/mapsources/mappacks"); if (!mapPackDir.isDirectory()) @@ -60,7 +64,7 @@ File list = new File(d, "mapsources.list"); if (!list.isFile()) continue; - String listContent = new String(Utilities.getFileBytes(list), Charsets.UTF_8); + String listContent = new String(Utilities.getFileBytes(list), StandardCharsets.UTF_8); String[] classNames = listContent.split("\\s+"); for (String className : classNames) { try { diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/loader/MapPackManager.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/loader/MapPackManager.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/loader/MapPackManager.java 2014-02-06 05:48:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/loader/MapPackManager.java 2014-09-24 11:25:40.000000000 +0000 @@ -61,6 +61,7 @@ import mobac.utilities.GUIExceptionHandler; import mobac.utilities.I18nUtils; import mobac.utilities.Utilities; +import mobac.utilities.file.DirOrFileExtFilter; import mobac.utilities.file.FileExtFilter; import org.apache.commons.codec.binary.Hex; @@ -117,12 +118,12 @@ } } - public File[] getAllMapPackFiles() { - return mapPackDir.listFiles(new FileExtFilter(".jar")); + public List getAllMapPackFiles() { + return Utilities.traverseFolder(mapPackDir, new DirOrFileExtFilter(".jar")); } public void loadMapPacks(MapSourcesManager mapSourcesManager) throws IOException, CertificateException { - File[] mapPacks = getAllMapPackFiles(); + List mapPacks = getAllMapPackFiles(); for (File mapPackFile : mapPacks) { File oldMapPackFile = new File(mapPackFile.getAbsolutePath() + ".old"); try { diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/openstreetmap/CloudMade.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/openstreetmap/CloudMade.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/openstreetmap/CloudMade.java 2014-02-06 05:47:58.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/openstreetmap/CloudMade.java 2016-04-24 08:41:06.000000000 +0000 @@ -16,9 +16,10 @@ ******************************************************************************/ package mobac.mapsources.mappacks.openstreetmap; +import java.nio.charset.StandardCharsets; + import mobac.exceptions.MapSourceInitializationException; import mobac.mapsources.MapSourceUrlUpdater; -import mobac.utilities.Charsets; public class CloudMade extends AbstractOsmMapSource { @@ -59,7 +60,7 @@ @Override protected void initernalInitialize() throws MapSourceInitializationException { - apiKey = MapSourceUrlUpdater.loadDocumentAndExtractGroup("http://maps.cloudmade.com/", Charsets.UTF_8, + apiKey = MapSourceUrlUpdater.loadDocumentAndExtractGroup("http://maps.cloudmade.com/", StandardCharsets.UTF_8, INIT_REGEX); } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/openstreetmap/Hikebikemap.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/openstreetmap/Hikebikemap.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/openstreetmap/Hikebikemap.java 2014-02-06 05:47:58.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/openstreetmap/Hikebikemap.java 2015-01-06 13:41:58.000000000 +0000 @@ -19,18 +19,21 @@ */ package mobac.mapsources.mappacks.openstreetmap; +import java.awt.Color; import java.awt.image.BufferedImage; import java.io.IOException; import mobac.exceptions.TileException; -import mobac.mapsources.AbstractHttpMapSource; import mobac.mapsources.AbstractMultiLayerMapSource; -import mobac.program.interfaces.HttpMapSource; import mobac.program.interfaces.MapSource; import mobac.program.model.TileImageType; public class Hikebikemap extends AbstractMultiLayerMapSource { + private static final String[] SERVERS = { "a", "b", "c" }; + private static int SERVER_NUM = 0; + private static final Color BACKGROUND = new Color(180, 180, 180); + public Hikebikemap() { super("OpenStreetMap Hikebikemap.de", TileImageType.PNG); mapSources = new MapSource[] { new HikebikemapBase(), new HikebikemapRelief() }; @@ -40,10 +43,12 @@ /** * http://hikebikemap.de/ */ - public static class HikebikemapBase extends AbstractHttpMapSource { + public static class HikebikemapBase extends AbstractOsmMapSource { public HikebikemapBase() { - super("HikebikemapTiles", 0, 17, TileImageType.PNG, HttpMapSource.TileUpdate.None); + super("HikebikemapTiles"); + maxZoom = 17; + tileUpdate = TileUpdate.IfNoneMatch; } @Override @@ -52,7 +57,9 @@ } public String getTileUrl(int zoom, int tilex, int tiley) { - return "http://toolserver.org/tiles/hikebike/" + zoom + "/" + tilex + "/" + tiley + ".png"; + String server = SERVERS[SERVER_NUM]; + SERVER_NUM = (SERVER_NUM + 1) % SERVERS.length; + return String.format("http://%s.tiles.wmflabs.org/hikebike/%d/%d/%d.png", server, zoom, tilex, tiley); } } @@ -62,14 +69,18 @@ * * http://hikebikemap.de/ */ - public static class HikebikemapRelief extends AbstractHttpMapSource { + public static class HikebikemapRelief extends AbstractOsmMapSource { public HikebikemapRelief() { - super("HikebikemapRelief", 0, 17, TileImageType.PNG, HttpMapSource.TileUpdate.None); + super("HikebikemapRelief"); + maxZoom = 17; + tileUpdate = TileUpdate.IfNoneMatch; } public String getTileUrl(int zoom, int tilex, int tiley) { - return "http://toolserver.org/~cmarqu/hill/" + zoom + "/" + tilex + "/" + tiley + ".png"; + String server = SERVERS[SERVER_NUM]; + SERVER_NUM = (SERVER_NUM + 1) % SERVERS.length; + return String.format("http://%s.tiles.wmflabs.org/hillshading/%d/%d/%d.png", server, zoom, tilex, tiley); } @Override @@ -81,4 +92,10 @@ } } + + @Override + public Color getBackgroundColor() { + return BACKGROUND; + } + } \ No newline at end of file diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/openstreetmap/MapQuest.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/openstreetmap/MapQuest.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/openstreetmap/MapQuest.java 2014-02-06 05:47:58.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/openstreetmap/MapQuest.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) MOBAC developers - * - * 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 2 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 . - ******************************************************************************/ -package mobac.mapsources.mappacks.openstreetmap; - -import java.io.IOException; -import java.util.concurrent.Semaphore; - -import mobac.exceptions.TileException; -import mobac.program.model.TileImageType; - -public class MapQuest extends AbstractOsmMapSource { - - private static String[] SERVERS = { "otile1", "otile2", "otile3", "otile4" }; - private static int SERVER_NUM = 0; - - private static final Semaphore SEM = new Semaphore(2); - - public MapQuest() { - super("MapQuest"); - minZoom = 0; - maxZoom = 18; - tileUpdate = TileUpdate.IfModifiedSince; - } - - @Override - public byte[] getTileData(int zoom, int x, int y, LoadMethod loadMethod) throws IOException, TileException, - InterruptedException { - SEM.acquire(); - try { - return super.getTileData(zoom, x, y, loadMethod); - } finally { - SEM.release(); - } - } - - @Override - public TileImageType getTileImageType() { - return TileImageType.JPG; - } - - @Override - public String getTileUrl(int zoom, int tilex, int tiley) { - String server = SERVERS[SERVER_NUM]; - SERVER_NUM = (SERVER_NUM + 1) % SERVERS.length; - String baseUrl = "http://" + server + ".mqcdn.com/tiles/1.0.0/osm"; - return baseUrl + super.getTileUrl(zoom, tilex, tiley); - } - - @Override - public String toString() { - return "OpenStreetMap MapQuest"; - } - -} diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/openstreetmap/mapsources.list mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/openstreetmap/mapsources.list --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/openstreetmap/mapsources.list 2014-02-06 05:47:58.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/openstreetmap/mapsources.list 2018-01-14 10:03:44.000000000 +0000 @@ -1,9 +1,5 @@ mobac.mapsources.mappacks.openstreetmap.CloudMade -mobac.mapsources.mappacks.openstreetmap.Mapnik mobac.mapsources.mappacks.openstreetmap.Hikebikemap -mobac.mapsources.mappacks.openstreetmap.OpenPisteMap -mobac.mapsources.mappacks.openstreetmap.OpenSeaMap -mobac.mapsources.mappacks.openstreetmap.MapQuest mobac.mapsources.mappacks.openstreetmap.Osm4uMaps mobac.mapsources.mappacks.openstreetmap.OsmPublicTransport mobac.mapsources.mappacks.openstreetmap.WanderreitkarteAbo diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/openstreetmap/OpenPisteMap.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/openstreetmap/OpenPisteMap.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/openstreetmap/OpenPisteMap.java 2014-02-06 05:47:58.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/openstreetmap/OpenPisteMap.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,135 +0,0 @@ -/******************************************************************************* - * Copyright (c) MOBAC developers - * - * 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 2 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 . - ******************************************************************************/ -/** - * - */ -package mobac.mapsources.mappacks.openstreetmap; - -import java.io.IOException; -import java.net.HttpURLConnection; - -import mobac.exceptions.DownloadFailedException; -import mobac.exceptions.StopAllDownloadsException; -import mobac.exceptions.TileException; -import mobac.mapsources.AbstractMultiLayerMapSource; -import mobac.program.interfaces.HttpMapSource; -import mobac.program.interfaces.MapSource; -import mobac.program.interfaces.MapSourceTextAttribution; -import mobac.program.model.TileImageType; - -public class OpenPisteMap extends AbstractMultiLayerMapSource implements MapSourceTextAttribution { - - private static final String BASE = "http://tiles.openpistemap.org/nocontours"; - //private static final String CONTOURS = "http://tiles.openpistemap.org/contours-only"; - private static final String LAMDSHED = "http://tiles2.openpistemap.org/landshaded"; - - public OpenPisteMap() { - super("OpenPisteMapBCL", TileImageType.PNG); - mapSources = new MapSource[] { new Mapnik(), new OpenPisteMapBase(), new OpenPisteMapLandshed()/*, new OpenPisteMapContours()*/ }; - initializeValues(); - } - - @Override - public String toString() { - return "Open Piste Map"; - } - - public String getAttributionText() { - return "© OpenStreetMap contributors, CC-BY-SA"; - } - - public String getAttributionLinkURL() { - return "http://openstreetmap.org"; - } - - public static abstract class AbstractOpenPisteMap extends AbstractOsmMapSource { - - public AbstractOpenPisteMap(String name) { - super(name); - } - - @Override - public byte[] getTileData(int zoom, int x, int y, LoadMethod loadMethod) throws IOException, TileException, - InterruptedException { - try { - return super.getTileData(zoom, x, y, loadMethod); - } catch (DownloadFailedException e) { - if (e.getHttpResponseCode() == HttpURLConnection.HTTP_FORBIDDEN) { - throw new StopAllDownloadsException("Server blocks mass download - aborting map dowload", e); - } else - throw e; - } - } - - } - - public static class OpenPisteMapBase extends AbstractOpenPisteMap { - - public OpenPisteMapBase() { - super("OpenPisteMap"); - maxZoom = 17; - tileUpdate = HttpMapSource.TileUpdate.LastModified; - } - - @Override - public String toString() { - return "Open Piste Contours Layer"; - } - - public String getTileUrl(int zoom, int tilex, int tiley) { - return BASE + super.getTileUrl(zoom, tilex, tiley); - } - - } - - // public static class OpenPisteMapContours extends AbstractOpenPisteMap { - // - // public OpenPisteMapContours() { - // super("OpenPisteMapCont"); - // maxZoom = 17; - // tileUpdate = HttpMapSource.TileUpdate.LastModified; - // } - // - // @Override - // public String toString() { - // return "Open Piste Map Base Layer"; - // } - // - // public String getTileUrl(int zoom, int tilex, int tiley) { - // return CONTOURS + super.getTileUrl(zoom, tilex, tiley); - // } - // - // } - - public static class OpenPisteMapLandshed extends AbstractOpenPisteMap { - - public OpenPisteMapLandshed() { - super("OpenPisteMapLandshed"); - maxZoom = 17; - tileUpdate = HttpMapSource.TileUpdate.LastModified; - } - - @Override - public String toString() { - return "Open Piste Landshed Layer"; - } - - public String getTileUrl(int zoom, int tilex, int tiley) { - return LAMDSHED + super.getTileUrl(zoom, tilex, tiley); - } - } -} \ No newline at end of file diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/openstreetmap/Osm4uMaps.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/openstreetmap/Osm4uMaps.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/openstreetmap/Osm4uMaps.java 2014-02-06 05:47:58.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/openstreetmap/Osm4uMaps.java 2018-03-25 09:09:38.000000000 +0000 @@ -16,12 +16,15 @@ ******************************************************************************/ package mobac.mapsources.mappacks.openstreetmap; +import java.net.HttpURLConnection; + public class Osm4uMaps extends AbstractOsmMapSource { - private static String SERVER = "http://4umaps.eu"; + public static final String NAME = "4uMaps"; + private static String SERVER = "https://tileserver.4umaps.com"; public Osm4uMaps() { - super("4uMaps"); + super(NAME); minZoom = 2; maxZoom = 15; tileUpdate = TileUpdate.IfNoneMatch; @@ -37,4 +40,11 @@ return "OpenStreetMap 4UMaps.eu"; } + @Override + protected void prepareTileUrlConnection(HttpURLConnection conn) { + super.prepareTileUrlConnection(conn); + conn.setInstanceFollowRedirects(true); + } + + } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/region_america_north/CanadaToporama.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/region_america_north/CanadaToporama.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/region_america_north/CanadaToporama.java 1970-01-01 00:00:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/region_america_north/CanadaToporama.java 2015-04-21 01:06:02.000000000 +0000 @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) MOBAC developers + * + * 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 2 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 . + ******************************************************************************/ +package mobac.mapsources.mappacks.region_america_north; + +import mobac.mapsources.AbstractHttpMapSource; +import mobac.program.interfaces.HttpMapSource; +import mobac.program.model.TileImageType; + +/** + * + * http://mobac.sourceforge.net/forum/viewtopic.php?f=1&t=1&e=1&view=unread#p1972 + * http://sourceforge.net/p/mobac/feature-requests/197/ + * http://geogratis.cgdi.gc.ca/geogratis/en/service/toporama.html + * + */ +public class CanadaToporama extends AbstractHttpMapSource { + + private static String BASE_URL = "http://wms.ess-ws.nrcan.gc.ca/wms/toporama_en?" + + "service=wms&request=GetMap&version=1.1.1&format=image/png&" + + "srs=epsg:4326&layers=WMS-Toporama&width=256&height=256&bbox="; + + public CanadaToporama() { + super("CanadaToporama", 2, 18, TileImageType.PNG, HttpMapSource.TileUpdate.None); + } + + private double tile2lon(int x, int z) { + return x / Math.pow(2.0, z) * 360.0 - 180; + } + + private double tile2lat(int y, int z) { + double n = Math.PI - (2.0 * Math.PI * y) / Math.pow(2.0, z); + return Math.toDegrees(Math.atan(Math.sinh(n))); + } + + @Override + public String getTileUrl(int zoom, int x, int y) { + + double north = tile2lat(y, zoom); + double south = tile2lat(y + 1, zoom); + double west = tile2lon(x, zoom); + double east = tile2lon(x + 1, zoom); + + return BASE_URL + west + "," + south + "," + east + "," + north; + + } + + @Override + public String toString() { + return "Canada Toporama"; + } + +} diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/region_america_north/mapsources.list mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/region_america_north/mapsources.list --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/region_america_north/mapsources.list 2014-02-06 05:47:58.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/region_america_north/mapsources.list 2017-06-29 08:02:58.000000000 +0000 @@ -1,3 +1,4 @@ +mobac.mapsources.mappacks.region_america_north.CanadaToporama mobac.mapsources.mappacks.region_america_north.FAA_Aeromaps mobac.mapsources.mappacks.region_america_north.ChartbundleENRA mobac.mapsources.mappacks.region_america_north.ChartbundleENRH @@ -5,8 +6,7 @@ mobac.mapsources.mappacks.region_america_north.ChartbundleSEC mobac.mapsources.mappacks.region_america_north.ChartbundleTAC mobac.mapsources.mappacks.region_america_north.ChartbundleWAC -mobac.mapsources.mappacks.region_america_north.USNationalMapBase mobac.mapsources.mappacks.region_america_north.USNationalMapImagery -mobac.mapsources.mappacks.region_america_north.USNationalMapImageryV -mobac.mapsources.mappacks.region_america_north.USNationalMapVector -mobac.mapsources.mappacks.region_america_north.USNationalMapTopo \ No newline at end of file +mobac.mapsources.mappacks.region_america_north.USNationalMapImageryTopo +mobac.mapsources.mappacks.region_america_north.USNationalMapTopo +mobac.mapsources.mappacks.region_america_north.USNationalMapRelief diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapBase.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapBase.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapBase.java 2014-02-06 05:47:58.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapBase.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) MOBAC developers - * - * 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 2 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 . - ******************************************************************************/ -package mobac.mapsources.mappacks.region_america_north; - -import mobac.mapsources.AbstractHttpMapSource; -import mobac.program.model.TileImageType; - -/** - * http://viewer.nationalmap.gov/example/services.html - */ -public class USNationalMapBase extends AbstractHttpMapSource { - - public USNationalMapBase() { - super("USGS National Map Base", 0, 15, TileImageType.JPG, TileUpdate.ETag); - } - - public String getTileUrl(int zoom, int x, int y) { - return "http://basemap.nationalmap.gov/ArcGIS/rest/services/USGSTopo/MapServer/tile/" + zoom + "/" + y + "/" - + x; - } - - // http://basemap.nationalmap.gov/ArcGIS/rest/services/USGSTopo/MapServer/tile/6/23/11 - // http://basemap.nationalmap.gov/ArcGIS/rest/services/USGSImageryOnly/MapServer/tile/4/7/3 - // http://basemap.nationalmap.gov/ArcGIS/rest/services/TNM_Vector_Fills_Small/MapServer/tile/4/6/1 - // http://basemap.nationalmap.gov/ArcGIS/rest/services/TNM_Vector_Small/MapServer/tile/4/6/2 - // http://raster1.nationalmap.gov/ArcGIS/rest/services/TNM_Small_Scale_Shaded_Relief/MapServer/tile/4/7/6 - -} \ No newline at end of file diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapImagery.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapImagery.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapImagery.java 2014-02-06 05:47:58.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapImagery.java 2017-06-29 07:39:56.000000000 +0000 @@ -20,7 +20,7 @@ import mobac.program.model.TileImageType; /** - * http://viewer.nationalmap.gov/example/services.html + * https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryOnly/MapServer */ public class USNationalMapImagery extends AbstractHttpMapSource { @@ -28,7 +28,7 @@ super("USGS National Map Satellite", 0, 15, TileImageType.JPG, TileUpdate.IfNoneMatch); } - private static final String BASE_URL = " http://basemap.nationalmap.gov/ArcGIS/rest/services/USGSImageryOnly/MapServer/tile/"; + private static final String BASE_URL = "https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryOnly/MapServer/tile/"; public String getTileUrl(int zoom, int x, int y) { return BASE_URL + zoom + "/" + y + "/" + x; diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapImageryTopo.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapImageryTopo.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapImageryTopo.java 1970-01-01 00:00:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapImageryTopo.java 2017-06-29 07:52:04.000000000 +0000 @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) MOBAC developers + * + * 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 2 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 . + ******************************************************************************/ +package mobac.mapsources.mappacks.region_america_north; + +import mobac.mapsources.AbstractHttpMapSource; +import mobac.program.model.TileImageType; + +/** + * USGSImageryTopo (MapServer) + * https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryTopo/MapServer + */ +public class USNationalMapImageryTopo extends AbstractHttpMapSource { + + public USNationalMapImageryTopo() { + super("USGS National Map Satellite & Topo", 0, 15, TileImageType.JPG, TileUpdate.IfNoneMatch); + } + + private static final String BASE_URL = "https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryTopo/MapServer/tile/"; + + public String getTileUrl(int zoom, int x, int y) { + return BASE_URL + zoom + "/" + y + "/" + x; + } +} diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapImageryV.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapImageryV.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapImageryV.java 2014-02-06 05:47:58.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapImageryV.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) MOBAC developers - * - * 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 2 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 . - ******************************************************************************/ -/** - * - */ -package mobac.mapsources.mappacks.region_america_north; - -import java.awt.Color; - -import mobac.mapsources.AbstractMultiLayerMapSource; -import mobac.program.interfaces.MapSource; -import mobac.program.model.TileImageType; - -/** - * http://viewer.nationalmap.gov/example/services.html - */ -public class USNationalMapImageryV extends AbstractMultiLayerMapSource { - - public USNationalMapImageryV() { - super("USGS National Map Satellite+", TileImageType.JPG); - mapSources = new MapSource[] { new USNationalMapImagery(), new USNationalMapVS() }; - initializeValues(); - } - - @Override - public Color getBackgroundColor() { - return Color.WHITE; - } -} \ No newline at end of file diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapRelief.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapRelief.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapRelief.java 2014-02-06 05:47:58.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapRelief.java 2017-06-29 07:44:32.000000000 +0000 @@ -20,15 +20,15 @@ import mobac.program.model.TileImageType; /** - * Unused + * Unused https://basemap.nationalmap.gov/arcgis/rest/services/USGSShadedReliefOnly/MapServer */ public class USNationalMapRelief extends AbstractHttpMapSource { public USNationalMapRelief() { - super("USGS National Map Relief", 0, 6, TileImageType.JPG, TileUpdate.IfNoneMatch); + super("USGS National Map Relief", 2, 16, TileImageType.JPG, TileUpdate.IfNoneMatch); } - private static final String BASE_URL = "http://raster1.nationalmap.gov/ArcGIS/rest/services/TNM_Small_Scale_Shaded_Relief/MapServer/tile/"; + private static final String BASE_URL = "https://basemap.nationalmap.gov/arcgis/rest/services/USGSShadedReliefOnly/MapServer/tile/"; public String getTileUrl(int zoom, int x, int y) { return BASE_URL + zoom + "/" + y + "/" + x; diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapTopo.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapTopo.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapTopo.java 2014-02-06 05:47:58.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapTopo.java 2017-06-29 07:47:28.000000000 +0000 @@ -19,13 +19,18 @@ import mobac.mapsources.AbstractHttpMapSource; import mobac.program.model.TileImageType; +/** + * https://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer + */ public class USNationalMapTopo extends AbstractHttpMapSource { public USNationalMapTopo() { - super("USGS National Map Topo", 0, 15, TileImageType.JPG, TileUpdate.IfNoneMatch); + // 0-11: PNG + // 12-15: JPEG + super("USGS National Map Topo", 0, 15, TileImageType.PNG, TileUpdate.IfNoneMatch); } - private static final String BASE_URL = "http://basemap.nationalmap.gov/ArcGIS/rest/services/USGSTopo/MapServer/tile/"; + private static final String BASE_URL = "https://basemap.nationalmap.gov/ArcGIS/rest/services/USGSTopo/MapServer/tile/"; public String getTileUrl(int zoom, int x, int y) { return BASE_URL + zoom + "/" + y + "/" + x; diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapVector.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapVector.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapVector.java 2014-02-06 05:47:58.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapVector.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) MOBAC developers - * - * 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 2 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 . - ******************************************************************************/ -/** - * - */ -package mobac.mapsources.mappacks.region_america_north; - -import java.awt.Color; - -import mobac.mapsources.AbstractMultiLayerMapSource; -import mobac.program.interfaces.MapSource; -import mobac.program.model.TileImageType; - -public class USNationalMapVector extends AbstractMultiLayerMapSource { - - public USNationalMapVector() { - super("USGS National Map Vector", TileImageType.PNG); - mapSources = new MapSource[] { new USNationalMapVFS(), new USNationalMapVS() }; - initializeValues(); - } - - @Override - public Color getBackgroundColor() { - return Color.WHITE; - } - -} \ No newline at end of file diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapVFS.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapVFS.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapVFS.java 2014-02-06 05:47:58.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapVFS.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) MOBAC developers - * - * 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 2 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 . - ******************************************************************************/ -package mobac.mapsources.mappacks.region_america_north; - -import mobac.mapsources.AbstractHttpMapSource; -import mobac.program.model.TileImageType; - -public class USNationalMapVFS extends AbstractHttpMapSource { - - public USNationalMapVFS() { - super("USGS National Map VectorFills Layer", 0, 13, TileImageType.JPG, TileUpdate.IfNoneMatch); - } - - private static final String BASE_URL = "http://basemap.nationalmap.gov/ArcGIS/rest/services/TNM_Vector_Fills_Small/MapServer/tile/"; - - public String getTileUrl(int zoom, int x, int y) { - return BASE_URL + zoom + "/" + y + "/" + x; - } - -} \ No newline at end of file diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapVS.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapVS.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapVS.java 2014-02-06 05:47:58.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/region_america_north/USNationalMapVS.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) MOBAC developers - * - * 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 2 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 . - ******************************************************************************/ -package mobac.mapsources.mappacks.region_america_north; - -import mobac.mapsources.AbstractHttpMapSource; -import mobac.program.model.TileImageType; - -public class USNationalMapVS extends AbstractHttpMapSource { - - public USNationalMapVS() { - super("USGS National Map Vector Layer", 0, 15, TileImageType.PNG, TileUpdate.IfNoneMatch); - } - - private static final String BASE_URL = "http://basemap.nationalmap.gov/ArcGIS/rest/services/TNM_Vector_Small/MapServer/tile/"; - - public String getTileUrl(int zoom, int x, int y) { - return BASE_URL + zoom + "/" + y + "/" + x; - } - -} \ No newline at end of file diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/region_oceania/NzTopoMaps.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/region_oceania/NzTopoMaps.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/mappacks/region_oceania/NzTopoMaps.java 2014-02-06 05:47:58.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/mappacks/region_oceania/NzTopoMaps.java 2016-04-13 11:42:16.000000000 +0000 @@ -32,18 +32,23 @@ * * Tiles created by and sourced from nztopomaps.com * + * * http://www.nztopomaps.com/ */ public class NzTopoMaps extends AbstractHttpMapSource implements MapSourceTextAttribution { + private final String[] SERVERS = new String[] { "nz1" }; + private int SERVER_NUM = 0; + public NzTopoMaps() { super("New Zealand Topographic Maps", 6, 15, TileImageType.PNG, TileUpdate.IfNoneMatch); } public String getTileUrl(int zoom, int x, int y) { - // nzy = 2^zoom - 1 - y int nzy = (1 << zoom) - 1 - y; - return "http://nz1.nztopomaps.com/" + zoom + "/" + x + "/" + nzy + ".png"; + SERVER_NUM = (SERVER_NUM + 1) % SERVERS.length; + String server = SERVERS[SERVER_NUM]; + return "http://" + server + ".nztopomaps.com/" + zoom + "/" + x + "/" + nzy + ".png"; } @Override diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/MapsforgeMapSource.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/MapsforgeMapSource.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/MapsforgeMapSource.java 1970-01-01 00:00:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/MapsforgeMapSource.java 2017-07-28 10:57:16.000000000 +0000 @@ -0,0 +1,337 @@ +/******************************************************************************* + * Copyright (c) MOBAC developers + * + * 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 2 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 . + ******************************************************************************/ +package mobac.mapsources; + +import java.awt.Color; +import java.awt.image.BufferedImage; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.imageio.ImageIO; +import javax.xml.bind.annotation.XmlElement; + +import org.apache.log4j.Logger; +import org.mapsforge.core.graphics.Bitmap; +import org.mapsforge.core.graphics.GraphicFactory; +import org.mapsforge.core.graphics.TileBitmap; +import org.mapsforge.core.mapelements.MapElementContainer; +import org.mapsforge.core.model.Tile; +import org.mapsforge.map.awt.graphics.AwtGraphicFactory; +import org.mapsforge.map.datastore.MultiMapDataStore; +import org.mapsforge.map.datastore.MultiMapDataStore.DataPolicy; +import org.mapsforge.map.layer.cache.TileCache; +import org.mapsforge.map.layer.labels.TileBasedLabelStore; +import org.mapsforge.map.layer.queue.Job; +import org.mapsforge.map.layer.renderer.DatabaseRenderer; +import org.mapsforge.map.layer.renderer.RendererJob; +import org.mapsforge.map.model.DisplayModel; +import org.mapsforge.map.model.common.Observer; +import org.mapsforge.map.reader.MapFile; +import org.mapsforge.map.rendertheme.ExternalRenderTheme; +import org.mapsforge.map.rendertheme.InternalRenderTheme; +import org.mapsforge.map.rendertheme.XmlRenderTheme; +import org.mapsforge.map.rendertheme.XmlRenderThemeMenuCallback; +import org.mapsforge.map.rendertheme.XmlRenderThemeStyleLayer; +import org.mapsforge.map.rendertheme.XmlRenderThemeStyleMenu; +import org.mapsforge.map.rendertheme.rule.RenderThemeFuture; + +import mobac.exceptions.MapSourceInitializationException; +import mobac.exceptions.NotImplementedException; +import mobac.exceptions.UnrecoverableDownloadException; +import mobac.mapsources.mapspace.MercatorPower2MapSpace; +import mobac.program.interfaces.CloneableMapSource; +import mobac.program.interfaces.FileBasedMapSource; +import mobac.program.interfaces.MapSource; +import mobac.program.interfaces.MapSpace; +import mobac.program.interfaces.RefreshableMapSource; +import mobac.program.model.Atlas; +import mobac.program.model.MapSourceLoaderInfo; +import mobac.program.model.TileImageType; + +public class MapsforgeMapSource implements MapSource, FileBasedMapSource, RefreshableMapSource, CloneableMapSource { + + private static final Logger LOG = Logger.getLogger(MapsforgeMapSource.class); + + private static final String name = "MapsforgeWorld"; + + private MapSourceLoaderInfo loaderInfo = null; + + private MapSpace mapSpace = MercatorPower2MapSpace.INSTANCE_256; + + protected List mapFileList = new ArrayList<>(); + protected DatabaseRenderer renderer; + protected XmlRenderTheme xmlRenderTheme; + protected DataPolicy dataPolicy = MultiMapDataStore.DataPolicy.RETURN_ALL; + protected DisplayModel displayModel; + protected MultiMapDataStore multiMapDataStore; + protected RenderThemeFuture renderThemeFuture; + protected XmlRenderThemeStyleMenu renderThemeStyleMenu; + + protected MapsForgeCache labelInfoCache = new MapsForgeCache(); + + protected TileBasedLabelStore tileBasedLabelStore = new MyTileBasedLabelStore(1000); + + @XmlElement(defaultValue = "false") + protected boolean transparent = false; + + @XmlElement(defaultValue = "1.0") + protected float textScale = 1.0f; + + public MapsforgeMapSource() { + this("world.map"); + } + + public MapsforgeMapSource(String mapFileName) { + mapFileList.add(new File(mapFileName)); + displayModel = new DisplayModel(); + xmlRenderTheme = InternalRenderTheme.OSMARENDER; + } + + @Override + public void initialize() throws MapSourceInitializationException { + for (File mapFile : mapFileList) { + if (!mapFile.exists()) + throw new MapSourceInitializationException("File does not exist: " + mapFile.getAbsolutePath()); + } + reinitialize(); + } + + @Override + public void reinitialize() { + GraphicFactory graphicFactory = AwtGraphicFactory.INSTANCE; + multiMapDataStore = new MultiMapDataStore(dataPolicy); + boolean first = true; + for (File mapFile : mapFileList) { + multiMapDataStore.addMapDataStore(new MapFile(mapFile), first, first); + first = false; + } + labelInfoCache.purge(); + tileBasedLabelStore.clear(); + renderer = new DatabaseRenderer(multiMapDataStore, graphicFactory, labelInfoCache, tileBasedLabelStore, true, + true, null); + renderThemeFuture = new RenderThemeFuture(graphicFactory, xmlRenderTheme, displayModel); + + // new Thread(renderThemeFuture).start(); + renderThemeFuture.run(); + // renderThemeFuture = new RenderThemeFuture(graphicFactory, xmlRenderTheme, displayModel); + // renderThemeFuture.run(); + } + + protected void loadExternalRenderTheme(File xmlRenderThemeFile) throws FileNotFoundException { + + XmlRenderThemeMenuCallback callBack = new XmlRenderThemeMenuCallback() { + + @Override + public Set getCategories(XmlRenderThemeStyleMenu styleMenu) { + renderThemeStyleMenu = styleMenu; + String id = styleMenu.getDefaultValue(); + XmlRenderThemeStyleLayer baseLayer = styleMenu.getLayer(id); + Set result = baseLayer.getCategories(); + + for (XmlRenderThemeStyleLayer overlay : baseLayer.getOverlays()) { + LOG.trace("Overlay " + overlay.getId() + " enabled: " + overlay.isEnabled()); + if (overlay.isEnabled()) { + result.addAll(overlay.getCategories()); + } + } + + return result; + } + + }; + this.xmlRenderTheme = new ExternalRenderTheme(xmlRenderThemeFile, callBack); + } + + @Override + public void refresh() { + reinitialize(); + } + + @XmlElement + protected void setMultiMapDataPolicy(MultiMapDataStore.DataPolicy value) { + dataPolicy = value; + } + + public Color getBackgroundColor() { + return Color.WHITE; + } + + public MapSpace getMapSpace() { + return mapSpace; + } + + public int getMaxZoom() { + return 19; + } + + public int getMinZoom() { + return 0; + } + + public String getName() { + return name; + } + + public byte[] getTileData(int zoom, int x, int y, LoadMethod loadMethod) + throws IOException, UnrecoverableDownloadException, InterruptedException { + ByteArrayOutputStream buf = new ByteArrayOutputStream(16000); + try { + BufferedImage image = getTileImage(zoom, x, y, loadMethod); + if (image == null) + return null; + ImageIO.write(image, "png", buf); + } catch (IOException e) { + throw new RuntimeException(e); + } + return buf.toByteArray(); + } + + public BufferedImage getTileImage(int zoom, int x, int y, LoadMethod loadMethod) + throws IOException, UnrecoverableDownloadException, InterruptedException { + if (mapFileList == null || xmlRenderTheme == null) + return null; + if (loadMethod == LoadMethod.CACHE) + return null; + + // ((MapSourceCallerThreadInfo)Thread.currentThread()).isMapPreviewThread() + RendererJob job; + Bitmap tileBitmap; + Tile tile = new Tile(x, y, (byte) zoom, 256); + job = new RendererJob(tile, multiMapDataStore, renderThemeFuture, displayModel, textScale, transparent, false); + + // We only need the TileCache for correct label rendering and it does not actually store the created tile + // therefore we can create the cache entry before rendering the tile... + synchronized (renderer) { + labelInfoCache.put(job, null); + tileBitmap = renderer.executeJob(job); + } + if (tileBitmap == null) { + LOG.error("Failed to render image " + zoom + " " + x + " " + y); + return null; + } + return AwtGraphicFactory.getBitmap(tileBitmap); + } + + @XmlElement + public void setUserScaleFactor(float scaleFactor) { + displayModel.setUserScaleFactor(scaleFactor); + } + + public float getUserScaleFactor() { + return displayModel.getUserScaleFactor(); + } + + public TileImageType getTileImageType() { + return TileImageType.PNG; + } + + public MapSourceLoaderInfo getLoaderInfo() { + return loaderInfo; + } + + public void setLoaderInfo(MapSourceLoaderInfo loaderInfo) { + this.loaderInfo = loaderInfo; + } + + @Override + public String toString() { + return name; + } + + /** + * Clone the Mapforge map source but clear the label cache. This prevents rendering problems with defect labels. + * + * This methods is executed while creating an deep clone of an {@link Atlas} (before atlas creation starts). + */ + @Override + public MapsforgeMapSource clone() throws CloneNotSupportedException { + MapsforgeMapSource mapSource = (MapsforgeMapSource) super.clone(); + mapSource.labelInfoCache = new MapsForgeCache(); + mapSource.tileBasedLabelStore = new MyTileBasedLabelStore(1000); + reinitialize(); + return mapSource; + } + + private static class MapsForgeCache implements TileCache { + + HashSet set = new HashSet<>(10000); + + public void put(Job job, TileBitmap tile) { + set.add(job.hashCode()); + // System.out.println("Added: " + job.getKey()); + } + + public boolean containsKey(Job job) { + return set.contains(job.hashCode()); + } + + public void destroy() { + } + + public TileBitmap get(Job job) { + throw new NotImplementedException(); + } + + public int getCapacity() { + throw new NotImplementedException(); + } + + public int getCapacityFirstLevel() { + throw new NotImplementedException(); + } + + public TileBitmap getImmediately(Job job) { + throw new NotImplementedException(); + } + + public void setWorkingSet(Set jobs) { + throw new NotImplementedException(); + } + + public void addObserver(Observer observer) { + throw new NotImplementedException(); + } + + public void removeObserver(Observer observer) { + throw new NotImplementedException(); + } + + public void purge() { + set.clear(); + } + + } + + private static class MyTileBasedLabelStore extends TileBasedLabelStore { + + public MyTileBasedLabelStore(int capacity) { + super(capacity); + } + + @Override + public synchronized List getVisibleItems(Tile upperLeft, Tile lowerRight) { + return super.getVisibleItems(upperLeft, lowerRight); + } + + } +} diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/MapSourceTools.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/MapSourceTools.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/MapSourceTools.java 2014-02-06 05:47:58.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/MapSourceTools.java 2015-01-05 06:21:56.000000000 +0000 @@ -16,6 +16,8 @@ ******************************************************************************/ package mobac.mapsources; +import java.security.SecureRandom; + import mobac.program.interfaces.MapSource; import mobac.program.interfaces.MapSpace; @@ -26,6 +28,8 @@ protected static final char[] NUM_CHAR = { '0', '1', '2', '3' }; + public static final SecureRandom RND = new SecureRandom(); + /** * See: http://msdn.microsoft.com/en-us/library/bb259689.aspx * @@ -93,4 +97,8 @@ tmp = tmp.replace("{$serverpart}", serverPart); return formatMapUrl(tmp, zoom, tilex, tiley); } + + public static String getRandomServerPart(String[] serverParts) { + return serverParts[RND.nextInt(serverParts.length)]; + } } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/MapSourceUrlUpdater.java mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/MapSourceUrlUpdater.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/mapsources/MapSourceUrlUpdater.java 2014-02-06 05:48:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/mapsources/MapSourceUrlUpdater.java 2014-04-12 11:37:02.000000000 +0000 @@ -115,7 +115,7 @@ try { document = loadDocument(url, charset); } catch (IOException e) { - throw new MapSourceInitializationException("Faile dto retrieve initialization document from url: " + url + throw new MapSourceInitializationException("Failed to retrieve initialization document from url: " + url + "\nError: " + e.getMessage(), e); } Matcher m = Pattern.compile(regex).matcher(document); diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/AbstractSQLite.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/AbstractSQLite.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/AbstractSQLite.java 1970-01-01 00:00:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/AbstractSQLite.java 2016-05-14 05:32:38.000000000 +0000 @@ -0,0 +1,149 @@ +/******************************************************************************* + * Copyright (c) MOBAC developers + * + * 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 2 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 . + ******************************************************************************/ +package mobac.program.atlascreators; + +import java.io.File; +import java.io.IOException; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +import mobac.exceptions.AtlasTestException; +import mobac.exceptions.MapCreationException; +import mobac.program.atlascreators.tileprovider.ConvertedRawTileProvider; +import mobac.program.interfaces.AtlasInterface; +import mobac.program.interfaces.RequiresSQLite; +import mobac.program.model.TileImageParameters; +import mobac.utilities.jdbc.SQLiteLoader; + +public abstract class AbstractSQLite extends AtlasCreator implements RequiresSQLite { + + private static final int MAX_BATCH_SIZE = 1000; + + protected File databaseFile; + + protected Connection conn = null; + protected PreparedStatement prepStmt; + + public AbstractSQLite() { + super(); + SQLiteLoader.loadSQLiteOrShowError(); + } + + protected void openConnection() throws SQLException, IOException { + if (conn == null || conn.isClosed()) { + String url = "jdbc:sqlite:" + databaseFile.getCanonicalPath(); + conn = DriverManager.getConnection(url); + } + } + + @Override + protected void testAtlas() throws AtlasTestException { + super.testAtlas(); + try { + SQLiteLoader.loadSQLite(); + } catch (SQLException e) { + throw new AtlasTestException(SQLiteLoader.getMsgSqliteMissing()); + } + } + + @Override + public void startAtlasCreation(AtlasInterface atlas, File customAtlasDir) throws IOException, AtlasTestException, + InterruptedException { + super.startAtlasCreation(atlas, customAtlasDir); + databaseFile = new File(atlasDir, getDatabaseFileName()); + log.debug("SQLite Database file: " + databaseFile); + } + + @Override + public void abortAtlasCreation() throws IOException { + SQLiteLoader.closeConnection(conn); + conn = null; + super.abortAtlasCreation(); + } + + @Override + public void finishAtlasCreation() throws IOException, InterruptedException { + SQLiteLoader.closeConnection(conn); + conn = null; + super.finishAtlasCreation(); + } + + protected void createTiles() throws InterruptedException, MapCreationException { + int maxMapProgress = 2 * (xMax - xMin + 1) * (yMax - yMin + 1); + atlasProgress.initMapCreation(maxMapProgress); + TileImageParameters param = map.getParameters(); + if (param != null) + mapDlTileProvider = new ConvertedRawTileProvider(mapDlTileProvider, param.getFormat()); + try { + conn.setAutoCommit(false); + int batchTileCount = 0; + int tilesWritten = 0; + Runtime r = Runtime.getRuntime(); + long heapMaxSize = r.maxMemory(); + prepStmt = conn.prepareStatement(getTileInsertSQL()); + for (int x = xMin; x <= xMax; x++) { + for (int y = yMin; y <= yMax; y++) { + checkUserAbort(); + atlasProgress.incMapCreationProgress(); + try { + byte[] sourceTileData = mapDlTileProvider.getTileData(x, y); + if (sourceTileData != null) { + writeTile(x, y, zoom, sourceTileData); + tilesWritten++; + long heapAvailable = heapMaxSize - r.totalMemory() + r.freeMemory(); + + batchTileCount++; + if ((heapAvailable < HEAP_MIN) || (batchTileCount >= MAX_BATCH_SIZE)) { + log.trace("Executing batch containing " + batchTileCount + " tiles"); + prepStmt.executeBatch(); + prepStmt.clearBatch(); + System.gc(); + conn.commit(); + atlasProgress.incMapCreationProgress(batchTileCount); + batchTileCount = 0; + } + } + } catch (IOException e) { + throw new MapCreationException(map, e); + } + } + } + prepStmt.executeBatch(); + prepStmt.clearBatch(); + prepStmt.close(); + prepStmt = null; + System.gc(); + if (tilesWritten > 0) + updateTileMetaInfo(); + log.trace("Final commit containing " + batchTileCount + " tiles"); + conn.commit(); + atlasProgress.setMapCreationProgress(maxMapProgress); + } catch (SQLException e) { + throw new MapCreationException(map, e); + } + } + + protected abstract String getTileInsertSQL(); + + protected abstract void writeTile(int x, int y, int z, byte[] tileData) throws SQLException, IOException; + + protected abstract String getDatabaseFileName(); + + protected abstract void updateTileMetaInfo() throws SQLException; +} diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/AtlasCreator.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/AtlasCreator.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/AtlasCreator.java 2014-02-06 05:48:10.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/AtlasCreator.java 2016-04-24 08:39:16.000000000 +0000 @@ -19,10 +19,13 @@ import java.io.File; import java.io.IOException; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.text.SimpleDateFormat; import java.util.Date; import java.util.EnumSet; +import org.apache.log4j.Logger; + import mobac.exceptions.AtlasTestException; import mobac.exceptions.MapCreationException; import mobac.gui.AtlasProgress; @@ -37,11 +40,8 @@ import mobac.program.model.Settings; import mobac.program.model.TileImageFormat; import mobac.program.model.TileImageParameters; -import mobac.utilities.Charsets; import mobac.utilities.Utilities; -import org.apache.log4j.Logger; - /** * Abstract base class for all AtlasCreator implementations. * @@ -55,7 +55,7 @@ */ public abstract class AtlasCreator { - public static final Charset TEXT_FILE_CHARSET = Charsets.ISO_8859_1; + public static final Charset TEXT_FILE_CHARSET = StandardCharsets.ISO_8859_1; protected final Logger log; diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/GeoPackage.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/GeoPackage.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/GeoPackage.java 1970-01-01 00:00:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/GeoPackage.java 2016-05-14 05:36:28.000000000 +0000 @@ -0,0 +1,254 @@ +/******************************************************************************* + * Copyright (c) MOBAC developers + * + * 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 2 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 . + ******************************************************************************/ +package mobac.program.atlascreators; + +import java.io.File; +import java.io.IOException; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.sql.Statement; + +import mobac.exceptions.AtlasTestException; +import mobac.exceptions.MapCreationException; +import mobac.program.ProgramInfo; +import mobac.program.annotations.AtlasCreatorName; +import mobac.program.annotations.SupportedParameters; +import mobac.program.interfaces.AtlasInterface; +import mobac.program.interfaces.MapSource; +import mobac.program.model.TileImageParameters.Name; +import mobac.utilities.Utilities; + +/** + * + * Warning: This implementation is defect and incomplete! + * + * https://sourceforge.net/p/mobac/feature-requests/263/ + * + * http://www.geopackage.org/spec/ + */ +@AtlasCreatorName(value = "GeoPackage SQLite", type = "GeoPackage") +@SupportedParameters(names = { Name.format }) +public class GeoPackage extends AbstractSQLite { + + private static final double PIXEL_WORLD_CONST = 156543.0339280409984; + + private static final String CREATE_TABLE_CONTENTS = "CREATE TABLE gpkg_contents " + + "(table_name TEXT NOT NULL PRIMARY KEY, data_type TEXT NOT NULL, identifier TEXT UNIQUE, " + + "description TEXT DEFAULT '', last_change DATETIME NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')), " + + "min_x DOUBLE, min_y DOUBLE, max_x DOUBLE, max_y DOUBLE, srs_id INTEGER, " + + "CONSTRAINT fk_gc_r_srs_id FOREIGN KEY (srs_id) REFERENCES gpkg_spatial_ref_sys(srs_id))"; + + private static final String CREATE_TABLE_SPATIAL_REF_SYS = "CREATE TABLE gpkg_spatial_ref_sys " + + "(srs_name TEXT NOT NULL, srs_id INTEGER NOT NULL PRIMARY KEY, organization TEXT NOT NULL, " + + "organization_coordsys_id INTEGER NOT NULL, definition TEXT NOT NULL, description TEXT)"; + + private static final String CREATE_TABLE_TILE_MATRIX = "CREATE TABLE gpkg_tile_matrix " + + "(table_name TEXT NOT NULL, zoom_level INTEGER NOT NULL, matrix_width INTEGER NOT NULL, " + + "matrix_height INTEGER NOT NULL, tile_width INTEGER NOT NULL, tile_height INTEGER NOT NULL, " + + "pixel_x_size DOUBLE NOT NULL, pixel_y_size DOUBLE NOT NULL, " + + "CONSTRAINT pk_ttm PRIMARY KEY (table_name, zoom_level), " + + "CONSTRAINT fk_tmm_table_name FOREIGN KEY (table_name) REFERENCES gpkg_contents(table_name))"; + + private static final String CREATE_TABLE_TILE_MATRIX_SET = "CREATE TABLE gpkg_tile_matrix_set " + + "(table_name TEXT NOT NULL PRIMARY KEY, srs_id INTEGER NOT NULL, min_x DOUBLE NOT NULL, " + + "min_y DOUBLE NOT NULL, max_x DOUBLE NOT NULL, max_y DOUBLE NOT NULL, " + + "CONSTRAINT fk_gtms_table_name FOREIGN KEY (table_name) REFERENCES gpkg_contents(table_name), " + + "CONSTRAINT fk_gtms_srs FOREIGN KEY (srs_id) REFERENCES gpkg_spatial_ref_sys(srs_id))"; + + private static final String CREATE_TABLE_TILES = "CREATE TABLE tiles " + + "(id INTEGER PRIMARY KEY AUTOINCREMENT, zoom_level INTEGER NOT NULL, " + + "tile_column INTEGER NOT NULL, tile_row INTEGER NOT NULL, tile_data BLOB NOT NULL, " + + "UNIQUE (zoom_level, tile_column, tile_row))"; + + private static final String INSERT_TILE = "INSERT INTO tiles " + + "(zoom_level, tile_column, tile_row, tile_data) VALUES (?, ?, ?, ?)"; + + private boolean atlasInitialized = false; + + double minLon, minLat, maxLat, maxLon; + + public GeoPackage() { + super(); + } + + @Override + public boolean testMapSource(MapSource mapSource) { + return true; + } + + @Override + protected String getDatabaseFileName() { + return atlas.getName() + ".gpkg"; + } + + @Override + public void startAtlasCreation(AtlasInterface atlas, File customAtlasDir) + throws IOException, AtlasTestException, InterruptedException { + super.startAtlasCreation(atlas, customAtlasDir); + Utilities.mkDir(atlasDir); + minLat = Double.MAX_VALUE; + minLon = Double.MAX_VALUE; + maxLat = Double.MIN_VALUE; + maxLon = Double.MIN_VALUE; + } + + @Override + public void createMap() throws MapCreationException, InterruptedException { + try { + if (!atlasInitialized) { + atlasInitialized = true; + openConnection(); + initializeDB(); + } + createTiles(); + } catch (SQLException | IOException e) { + throw new MapCreationException("Error writing SQL database \"" + databaseFile + "\": " + e.getMessage(), + map, e); + } + } + + private void initializeDB() throws SQLException { + Statement stat = conn.createStatement(); + stat.executeUpdate(CREATE_TABLE_CONTENTS); + stat.executeUpdate(CREATE_TABLE_SPATIAL_REF_SYS); + stat.executeUpdate(CREATE_TABLE_TILE_MATRIX); + stat.executeUpdate(CREATE_TABLE_TILE_MATRIX_SET); + stat.executeUpdate(CREATE_TABLE_TILES); + + stat.executeUpdate("INSERT INTO gpkg_spatial_ref_sys VALUES(' ',-1,'NONE',-1,'undefined',NULL)"); + stat.executeUpdate("INSERT INTO gpkg_spatial_ref_sys VALUES(' ',0,'NONE',0,'undefined',NULL)"); + stat.executeUpdate("INSERT INTO gpkg_spatial_ref_sys VALUES('WGS 84 / World Mercator',3395,'epsg',3395,' " + + "PROJCS[\"WGS 84 / World Mercator\",GEOGCS[\"WGS 84\", DATUM[\"WGS_1984\"," + + "SPHEROID[\"WGS 84\",6378137,298.257223563, AUTHORITY[\"EPSG\",\"7030\"]]," + + "AUTHORITY[\"EPSG\",\"6326\"]], PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]], " + + "UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]], " + + "AUTHORITY[\"EPSG\",\"4326\"]],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]], " + + "PROJECTION[\"Mercator_1SP\"],PARAMETER[\"central_meridian\",0], PARAMETER[\"scale_factor\",1]," + + "PARAMETER[\"false_easting\",0], PARAMETER[\"false_northing\",0], AUTHORITY[\"EPSG\",\"3395\"], " + + "AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH]] ',NULL)"); + stat.executeUpdate("INSERT INTO gpkg_spatial_ref_sys VALUES('WGS 84 / Pseudo-Mercator',3857,'epsg',3857,' " + + "PROJCS[\"WGS 84 / Pseudo-Mercator\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\", " + + "SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]]," + + "AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\", \"8901\"]]," + + "UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]]," + + "AUTHORITY[\"EPSG\",\"9122\"]]AUTHORITY[\"EPSG\",\"4326\"]]," + + "PROJECTION[\"Mercator_1SP\"],PARAMETER[\"central_meridian\",0]," + + "PARAMETER[ \"scale_factor\",1],PARAMETER[\"false_easting\",0]," + + "PARAMETER[ \"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]]," + + "AXIS[ \"X\",EAST],AXIS[\"Y\",NORTH] ',NULL)"); + stat.executeUpdate("INSERT INTO gpkg_spatial_ref_sys VALUES('WGS 84',4326,'epsg',4326," + + "'GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137, 298.257223563," + + "AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\", \"6326\"]],PRIMEM[\"Greenwich\",0," + + "AUTHORITY[\"EPSG\",\"8901\"]],UNIT [\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]]," + + "AUTHORITY[\"EPSG\",\"4326\"]]',NULL)"); + stat.executeUpdate("INSERT INTO gpkg_spatial_ref_sys VALUES('WGS 84 / Scaled World Mercator',9804,'epsg',9804," + + "'PROJCS[\"unnamed\",GEOGCS[\"WGS 84\", DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563, " + + "AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]], PRIMEM[\"Greenwich\",0]," + + "UNIT[\"degree\",0.0174532925199433], AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Mercator_1SP\"]," + + "PARAMETER[\"central_meridian\",0], PARAMETER[\"scale_factor\",0.803798909747978]," + + "PARAMETER[\"false_easting\",0], PARAMETER[\"false_northing\",0], " + + "UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]]] ',NULL)"); + + stat.close(); + } + + @Override + protected void createTiles() throws InterruptedException, MapCreationException { + super.createTiles(); + try { + PreparedStatement prepStmt = conn + .prepareStatement("INSERT INTO gpkg_tile_matrix " + "VALUES('tiles',?,?,?,256,256,?,?)"); + prepStmt.setInt(1, map.getZoom()); + prepStmt.setInt(2, xMax - xMin + 1); // matrix_width + prepStmt.setInt(3, yMax - yMin + 1); // matrix_height + double pixel_size = PIXEL_WORLD_CONST / Math.pow(2.0, map.getZoom()); + prepStmt.setDouble(4, pixel_size); // pixel_x_size + prepStmt.setDouble(5, pixel_size); // pixel_y_size + prepStmt.executeUpdate(); + prepStmt.close(); + conn.commit(); + } catch (SQLException e) { + throw new MapCreationException(map, e); + } + + } + + private double lonToMetersX(double lon) { + return lon * Math.PI * 6378137.0 / 180.0; + } + + private double latToMetersY(double lat) { + double meters_y = Math.log(Math.tan((90 + lat) * Math.PI / 360.0)) / (Math.PI / 180.0); + meters_y = meters_y * Math.PI * 6378137.0 / 180.0; + return meters_y; + } + + @Override + protected void updateTileMetaInfo() throws SQLException { + minLon = Math.min(minLon, map.getMinLon()); + minLat = Math.min(minLat, map.getMinLat()); + maxLat = Math.max(maxLat, map.getMaxLon()); + maxLon = Math.max(maxLon, map.getMaxLat()); + + double min_y = latToMetersY(minLat); + double max_y = latToMetersY(maxLat); + double min_x = lonToMetersX(minLon); + double max_x = lonToMetersX(maxLon); + + Statement stat = conn.createStatement(); + stat.execute("DELETE FROM gpkg_contents;"); + stat.execute("DELETE FROM gpkg_tile_matrix_set;"); + stat.close(); + + PreparedStatement prepStmt; + prepStmt = conn.prepareStatement("INSERT INTO gpkg_contents " + + "(rowid, table_name, data_type, identifier, description, min_x, min_y, max_x, max_y,srs_id) " + + "VALUES (1,'tiles','tiles','Raster Tiles',?,?,?,?,?,3857)"); + + prepStmt.setString(1, "created by " + ProgramInfo.getCompleteTitle()); + prepStmt.setDouble(2, min_x); // min_x + prepStmt.setDouble(3, min_y); // min_y + prepStmt.setDouble(4, max_x); // max_x + prepStmt.setDouble(5, max_y); // max_y + prepStmt.executeUpdate(); + prepStmt.close(); + + prepStmt = conn.prepareStatement("INSERT INTO gpkg_tile_matrix_set VALUES('tiles',3857,?,?,?,?)"); + prepStmt.setDouble(1, min_x); // min_x + prepStmt.setDouble(2, min_y); // min_y + prepStmt.setDouble(3, max_x); // max_x + prepStmt.setDouble(4, max_y); // max_y + prepStmt.executeUpdate(); + prepStmt.close(); + conn.commit(); + } + + @Override + protected String getTileInsertSQL() { + return INSERT_TILE; + } + + @Override + protected void writeTile(int x, int y, int z, byte[] tileData) throws SQLException, IOException { + prepStmt.setInt(1, z); + prepStmt.setInt(2, x - xMin); + prepStmt.setInt(3, y - yMin); + prepStmt.setBytes(4, tileData); + prepStmt.addBatch(); + } + +} diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/impl/aqm/FlatPackCreator.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/impl/aqm/FlatPackCreator.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/impl/aqm/FlatPackCreator.java 2014-02-06 05:48:08.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/impl/aqm/FlatPackCreator.java 2016-04-24 08:40:14.000000000 +0000 @@ -23,8 +23,8 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; +import java.nio.charset.StandardCharsets; -import mobac.utilities.Charsets; import mobac.utilities.Utilities; public class FlatPackCreator { @@ -55,7 +55,7 @@ dataStream = new FileOutputStream(packPath + ".tmp"); structBuffer = new ByteArrayOutputStream(); - structBufferWriter = new OutputStreamWriter(structBuffer, Charsets.ISO_8859_1); + structBufferWriter = new OutputStreamWriter(structBuffer, StandardCharsets.ISO_8859_1); currentDataWritedSize = 0; currentNbFiles = 0; @@ -88,7 +88,7 @@ // write file size String fileSize = Integer.toString(buff.length) + "\0"; - dataStream.write(fileSize.getBytes(Charsets.ISO_8859_1)); + dataStream.write(fileSize.getBytes(StandardCharsets.ISO_8859_1)); // write file into pack data if (buff.length > 0) @@ -118,16 +118,16 @@ String nbFiles = Long.toString(currentNbFiles) + "\0"; // write header - packStream.write(FLAT_PACK_HEADER.getBytes(Charsets.ISO_8859_1)); + packStream.write(FLAT_PACK_HEADER.getBytes(StandardCharsets.ISO_8859_1)); // write struct structBufferWriter.flush(); structBufferWriter.close(); int headerSize = structBuffer.size() + nbFiles.length(); - packStream.write(Integer.toString(headerSize).getBytes(Charsets.ISO_8859_1)); + packStream.write(Integer.toString(headerSize).getBytes(StandardCharsets.ISO_8859_1)); packStream.write('\0'); - packStream.write(nbFiles.getBytes(Charsets.ISO_8859_1)); + packStream.write(nbFiles.getBytes(StandardCharsets.ISO_8859_1)); structBuffer.writeTo(packStream); diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/impl/rungps/RunGPSAtlasFile.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/impl/rungps/RunGPSAtlasFile.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/impl/rungps/RunGPSAtlasFile.java 2014-02-06 05:48:08.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/impl/rungps/RunGPSAtlasFile.java 2016-04-24 08:40:28.000000000 +0000 @@ -23,10 +23,10 @@ import java.io.IOException; import java.io.OutputStream; import java.io.RandomAccessFile; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; -import mobac.utilities.Charsets; import mobac.utilities.Utilities; /** @@ -411,7 +411,7 @@ } public void setString(List keyHierarchy, String value) throws IOException { - byte[] data = value.getBytes(Charsets.UTF_8); + byte[] data = value.getBytes(StandardCharsets.UTF_8); addData(keyHierarchy, data); } @@ -422,7 +422,7 @@ public String getString(List keyHierarchy) throws IOException { byte[] data = getData(keyHierarchy); if (data != null) { - return new String(data, Charsets.UTF_8); + return new String(data, StandardCharsets.UTF_8); } return null; } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/IPhone3MapTiles5.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/IPhone3MapTiles5.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/IPhone3MapTiles5.java 2014-02-06 05:48:10.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/IPhone3MapTiles5.java 2016-05-14 05:36:04.000000000 +0000 @@ -108,7 +108,7 @@ } @Override - protected void openConnection() throws SQLException { + protected void openConnection() throws SQLException, IOException { if (databaseFile.isFile()) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HHmmss"); databaseFile = new File(atlasDir, atlas.getName() + "_" + sdf.format(new Date()) + ".sqlitedb"); diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/Maverick.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/Maverick.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/Maverick.java 2014-02-06 05:48:08.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/Maverick.java 2014-10-01 11:59:30.000000000 +0000 @@ -24,7 +24,7 @@ * * Map/Atlas format see http://help.codesector.com/MapsCache */ -@AtlasCreatorName("Maverick atlas format") +@AtlasCreatorName("Maverick SQLite atlas format") public class Maverick extends RMapsSQLite { public Maverick() { diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/MaverickOld.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/MaverickOld.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/MaverickOld.java 1970-01-01 00:00:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/MaverickOld.java 2014-10-01 11:59:30.000000000 +0000 @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) MOBAC developers + * + * 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 2 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 . + ******************************************************************************/ +package mobac.program.atlascreators; + +import mobac.program.annotations.AtlasCreatorName; + +/** + * Creates maps using the Maverick atlas format (Android + * application). + * + * Map/Atlas format see http://help.codesector.com/MapsCache + */ +@AtlasCreatorName("Maverick simple tiles atlas format") +public class MaverickOld extends OSMTracker { + + public MaverickOld() { + super(); + tileFileNamePattern = "%d/%d/%d.jpg.tile"; + } + +} diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/MBTiles.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/MBTiles.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/MBTiles.java 2014-02-06 05:48:10.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/MBTiles.java 2016-05-14 05:35:56.000000000 +0000 @@ -94,7 +94,7 @@ } @Override - protected void openConnection() throws SQLException { + protected void openConnection() throws SQLException, IOException { if (databaseFile.isFile()) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HHmmss"); databaseFile = new File(atlasDir, atlas.getName() + "_" + sdf.format(new Date()) + ".mbtiles"); diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/NaviComputer.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/NaviComputer.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/NaviComputer.java 2014-02-06 05:48:08.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/NaviComputer.java 2016-05-14 05:38:42.000000000 +0000 @@ -49,23 +49,14 @@ + "CREATE TABLE Tiles (id INTEGER NOT NULL PRIMARY KEY, X INTEGER NOT NULL, Y INTEGER NOT NULL, Zoom INTEGER NOT NULL);\n" + "CREATE TABLE TilesData (id INTEGER NOT NULL PRIMARY KEY CONSTRAINT fk_Tiles_id REFERENCES Tiles(id) ON DELETE CASCADE, Tile BLOB NULL);\n" - + "CREATE TRIGGER fkdc_TilesData_id_Tiles_id " - + "BEFORE DELETE ON Tiles " - + "FOR EACH ROW BEGIN " - + "DELETE FROM TilesData WHERE TilesData.id = OLD.id; " - + "END;\n" - + "CREATE TRIGGER fki_TilesData_id_Tiles_id " - + "BEFORE INSERT ON [TilesData] " - + "FOR EACH ROW BEGIN " + + "CREATE TRIGGER fkdc_TilesData_id_Tiles_id " + "BEFORE DELETE ON Tiles " + "FOR EACH ROW BEGIN " + + "DELETE FROM TilesData WHERE TilesData.id = OLD.id; " + "END;\n" + + "CREATE TRIGGER fki_TilesData_id_Tiles_id " + "BEFORE INSERT ON [TilesData] " + "FOR EACH ROW BEGIN " + "SELECT RAISE(ROLLBACK, 'insert on table TilesData violates foreign key constraint fki_TilesData_id_Tiles_id') " - + "WHERE (SELECT id FROM Tiles WHERE id = NEW.id) IS NULL; " - + "END;\n" - + "CREATE TRIGGER fku_TilesData_id_Tiles_id " - + "BEFORE UPDATE ON [TilesData] " - + "FOR EACH ROW BEGIN " + + "WHERE (SELECT id FROM Tiles WHERE id = NEW.id) IS NULL; " + "END;\n" + + "CREATE TRIGGER fku_TilesData_id_Tiles_id " + "BEFORE UPDATE ON [TilesData] " + "FOR EACH ROW BEGIN " + "SELECT RAISE(ROLLBACK, 'update on table TilesData violates foreign key constraint fku_TilesData_id_Tiles_id') " - + "WHERE (SELECT id FROM Tiles WHERE id = NEW.id) IS NULL; " - + "END;\n" + + "WHERE (SELECT id FROM Tiles WHERE id = NEW.id) IS NULL; " + "END;\n" + "CREATE INDEX IndexOfTiles ON Tiles (X, Y, Zoom);"; private static final String INSERT_TILES = "INSERT INTO Tiles (id,X,Y,Zoom) VALUES (?,?,?,?)"; @@ -73,7 +64,7 @@ private static final String INSERT_MAP_INFO = "INSERT INTO MapInfo (MapType,Zoom,MinX,MaxX,MinY,MaxY) " + "SELECT ?,Min(Zoom),Min(x),Max(x),Min(y),Max(y) FROM Tiles WHERE Zoom=?;"; - private String databaseFile; + private File databaseFile; private int wmsTileCount = 1; private static final int COMMIT_RATE = 100; @@ -92,8 +83,8 @@ } @Override - public void startAtlasCreation(AtlasInterface atlas, File customAtlasDir) throws IOException, AtlasTestException, - InterruptedException { + public void startAtlasCreation(AtlasInterface atlas, File customAtlasDir) + throws IOException, AtlasTestException, InterruptedException { if (customAtlasDir == null) customAtlasDir = Settings.getInstance().getAtlasOutputDirectory(); super.startAtlasCreation(atlas, customAtlasDir); @@ -129,9 +120,9 @@ } - private void openConnection() throws SQLException { + private void openConnection() throws SQLException, IOException { if (conn == null || conn.isClosed()) { - String url = "jdbc:sqlite:/" + this.databaseFile; + String url = "jdbc:sqlite:" + databaseFile.getCanonicalPath(); conn = DriverManager.getConnection(url); } } @@ -226,10 +217,9 @@ prepTilesData.execute(); } - protected String getDatabaseFileName() { + protected File getDatabaseFileName() { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HHmmss_"); - databaseFile = new File(atlasDir, sdf.format(new Date()) + atlas.getName() + ".nmap").getAbsolutePath(); - return databaseFile; + return new File(atlasDir, sdf.format(new Date()) + atlas.getName() + ".nmap"); } } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/OruxMaps.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/OruxMaps.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/OruxMaps.java 2014-02-06 05:48:08.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/OruxMaps.java 2017-01-23 01:36:36.000000000 +0000 @@ -22,6 +22,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; +import java.nio.charset.StandardCharsets; import java.util.Locale; import mobac.exceptions.AtlasTestException; @@ -40,7 +41,6 @@ import mobac.program.model.TileImageFormat; import mobac.program.model.TileImageParameters; import mobac.program.model.TileImageParameters.Name; -import mobac.utilities.Charsets; import mobac.utilities.Utilities; /** @@ -73,8 +73,8 @@ protected File oruxMapsImagesDir; protected LayerInterface currentLayer; - - // We need to override the map name, All maps must have the same prefix (layer name) + + // We need to override the map name, All maps must have the same prefix (layer name) protected String mapName; public OruxMaps() { @@ -87,30 +87,28 @@ return (mapSource.getMapSpace() instanceof MercatorPower2MapSpace); } - + @Override protected void testAtlas() throws AtlasTestException { - + for (LayerInterface layer : atlas) { int cont = layer.getMapCount(); - for (int i = 0; i < cont; i++){ + for (int i = 0; i < cont; i++) { MapInterface currMap = layer.getMap(i); int currZoomLevel = currMap.getZoom(); - for (int j = i + 1; j < cont; j++){ + for (int j = i + 1; j < cont; j++) { MapInterface nextMap = layer.getMap(j); int nextZoomLevel = nextMap.getZoom(); if (currZoomLevel == nextZoomLevel) throw new AtlasTestException( - "Unable to create a map with more than a layer with the same zoom level: " + - currMap + " & " + nextMap + - "\nPossible causes:\n" + - "You are combining several layers (using drag & drop in 'Atlas Content')\n" + - "You are creating a large map, and you have not selected the maximum value in 'Settings - Map size'"); - } + "Unable to create a map with more than a layer with the same zoom level: " + currMap + + " & " + nextMap + "\nPossible causes:\n" + + "You are combining several layers (using drag & drop in 'Atlas Content')\n" + + "You are creating a large map, and you have not selected the maximum value in 'Settings - Map size'"); + } } - } + } } - /* * @see mobac.program.atlascreators.AtlasCreator#initLayerCreation(mobac.program .interfaces.LayerInterface) @@ -156,8 +154,7 @@ oruxMapsLayerDir = new File(oruxMapsMainDir, mapName); oruxMapsImagesDir = new File(oruxMapsLayerDir, "set"); try { - Utilities.mkDir(oruxMapsLayerDir); - Utilities.mkDir(oruxMapsImagesDir); + Utilities.mkDirs(oruxMapsImagesDir); writeOtrk2File(); createTiles(); } catch (InterruptedException e) { @@ -189,14 +186,11 @@ */ private void writeMainOtrk2File(String name) { - OutputStreamWriter writer; - FileOutputStream otrk2FileStream = null; File otrk2 = new File(oruxMapsMainDir, name + ORUXMAPS_EXT); - try { - writer = new OutputStreamWriter(new FileOutputStream(otrk2), Charsets.UTF_8); + try (OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(otrk2), StandardCharsets.UTF_8)) { writer.append("\n"); - writer.append("\n"); + writer.append("\n"); writer.append("\n"); writer.append("\n"); @@ -207,8 +201,6 @@ writer.flush(); } catch (IOException e) { log.error("", e); - } finally { - Utilities.closeStream(otrk2FileStream); } } @@ -221,19 +213,12 @@ * */ protected void writeOtrk2File() { - - FileOutputStream stream = null; - OutputStreamWriter mapWriter; File otrk2File = new File(oruxMapsLayerDir, mapName + ORUXMAPS_EXT); - try { - stream = new FileOutputStream(otrk2File); - mapWriter = new OutputStreamWriter(stream, "UTF8"); + try (OutputStreamWriter mapWriter = new OutputStreamWriter(new FileOutputStream(otrk2File), "UTF8")) { mapWriter.append(prepareOtrk2File()); mapWriter.flush(); } catch (IOException e) { log.error("", e); - } finally { - Utilities.closeStream(stream); } } @@ -249,8 +234,8 @@ double longitudeMax = mapSpace.cXToLon((xMax + 1) * tileSize, zoom); double latitudeMin = mapSpace.cYToLat((yMax + 1) * tileSize, zoom); double latitudeMax = mapSpace.cYToLat(yMin * tileSize, zoom); - mapWriter.append("\n"); + mapWriter.append( + "\n"); mapWriter.append("\n"); mapWriter.append("\n"); @@ -302,11 +287,9 @@ public void writeTile(int tilex, int tiley, String tileType, byte[] tileData) throws IOException { String tileFileName = String.format("%s_%d_%d.omc2", mapName, tilex, tiley); - FileOutputStream out = new FileOutputStream(new File(oruxMapsImagesDir, tileFileName)); - try { + File tileFile = new File(oruxMapsImagesDir, tileFileName); + try (FileOutputStream out = new FileOutputStream(tileFile)) { out.write(tileData); - } finally { - Utilities.closeStream(out); } } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/OruxMapsSqlite.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/OruxMapsSqlite.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/OruxMapsSqlite.java 2014-02-06 05:48:10.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/OruxMapsSqlite.java 2016-05-14 05:35:40.000000000 +0000 @@ -50,7 +50,7 @@ private static final String DATABASE_FILENAME = "OruxMapsImages.db"; - private String databaseFile; + private File databaseFile; private Connection conn = null; private PreparedStatement prepStmt; @@ -86,7 +86,7 @@ public void initLayerCreation(LayerInterface layer) throws IOException { super.initLayerCreation(layer); - databaseFile = new File(oruxMapsMainDir, DATABASE_FILENAME).getAbsolutePath(); + databaseFile = new File(oruxMapsMainDir, DATABASE_FILENAME); log.debug("SQLite Database file: " + databaseFile); otrk2MapsContent = new StringBuilder(); try { @@ -113,8 +113,8 @@ closeConnection(); } - private Connection getConnection() throws SQLException { - String url = "jdbc:sqlite:/" + this.databaseFile; + private Connection getConnection() throws SQLException, IOException { + String url = "jdbc:sqlite:" + databaseFile.getCanonicalPath(); Connection conn = DriverManager.getConnection(url); return conn; } @@ -187,8 +187,6 @@ private class OruxMapTileWriterDB implements MapTileWriter { - private static final int MAX_BATCH_SIZE = 1000; - private int tileCounter = 0; private Runtime r = Runtime.getRuntime(); diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/OSMAND_SQlite.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/OSMAND_SQlite.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/OSMAND_SQlite.java 2014-02-06 05:48:08.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/OSMAND_SQlite.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) MOBAC developers - * - * 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 2 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 . - ******************************************************************************/ -package mobac.program.atlascreators; - -import mobac.mapsources.mapspace.MercatorPower2MapSpace; -import mobac.program.annotations.AtlasCreatorName; -import mobac.program.interfaces.MapSource; - -@AtlasCreatorName(value = "OSMAND SQLite", type = "OSMAND_SQlite") -public class OSMAND_SQlite extends RMapsSQLite { - - @Override - public boolean testMapSource(MapSource mapSource) { - return MercatorPower2MapSpace.INSTANCE_256.equals(mapSource.getMapSpace()); - } - -} diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/OSMAND_SQLite.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/OSMAND_SQLite.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/OSMAND_SQLite.java 1970-01-01 00:00:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/OSMAND_SQLite.java 2014-10-09 09:22:16.000000000 +0000 @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) MOBAC developers + * + * 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 2 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 . + ******************************************************************************/ +package mobac.program.atlascreators; + +import mobac.mapsources.mapspace.MercatorPower2MapSpace; +import mobac.program.annotations.AtlasCreatorName; +import mobac.program.interfaces.MapSource; + +@AtlasCreatorName(value = "OSMAND SQLite", type = "OSMAND_SQLite") +public class OSMAND_SQLite extends RMapsSQLite { + + @Override + public boolean testMapSource(MapSource mapSource) { + return MercatorPower2MapSpace.INSTANCE_256.equals(mapSource.getMapSpace()); + } + +} diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/OsmdroidSQLite.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/OsmdroidSQLite.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/OsmdroidSQLite.java 2014-02-06 05:48:10.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/OsmdroidSQLite.java 2016-05-12 02:51:02.000000000 +0000 @@ -47,8 +47,6 @@ @SupportedParameters(names = { Name.format }) public class OsmdroidSQLite extends AtlasCreator implements RequiresSQLite { - private static final int MAX_BATCH_SIZE = 1000; - protected Connection conn = null; public OsmdroidSQLite() { diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/RMapsSQLite.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/RMapsSQLite.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/RMapsSQLite.java 2014-02-06 05:48:08.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/RMapsSQLite.java 2016-05-14 05:36:46.000000000 +0000 @@ -18,8 +18,6 @@ import java.io.File; import java.io.IOException; -import java.sql.Connection; -import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; @@ -30,17 +28,13 @@ import mobac.exceptions.MapCreationException; import mobac.program.annotations.AtlasCreatorName; import mobac.program.annotations.SupportedParameters; -import mobac.program.atlascreators.tileprovider.ConvertedRawTileProvider; import mobac.program.interfaces.AtlasInterface; import mobac.program.interfaces.MapSource; import mobac.program.interfaces.MapSpace; import mobac.program.interfaces.MapSpace.ProjectionCategory; -import mobac.program.interfaces.RequiresSQLite; import mobac.program.model.Settings; -import mobac.program.model.TileImageParameters; import mobac.program.model.TileImageParameters.Name; import mobac.utilities.Utilities; -import mobac.utilities.jdbc.SQLiteLoader; /** * Atlas/Map creator for "BigPlanet-Maps application for Android" (offline SQLite maps) @@ -58,9 +52,7 @@ */ @AtlasCreatorName(value = "RMaps SQLite", type = "RMaps") @SupportedParameters(names = { Name.format }) -public class RMapsSQLite extends AtlasCreator implements RequiresSQLite { - - private static final int MAX_BATCH_SIZE = 1000; +public class RMapsSQLite extends AbstractSQLite { private static final String TABLE_DDL = "CREATE TABLE IF NOT EXISTS tiles (x int, y int, z int, s int, image blob, PRIMARY KEY (x,y,z,s))"; private static final String INDEX_DDL = "CREATE INDEX IF NOT EXISTS IND on tiles (x,y,z,s)"; @@ -71,14 +63,8 @@ private static final String RMAPS_INFO_MAX_SQL = "SELECT DISTINCT z FROM tiles ORDER BY z DESC LIMIT 1;"; private static final String RMAPS_INFO_MIN_SQL = "SELECT DISTINCT z FROM tiles ORDER BY z ASC LIMIT 1;"; - protected File databaseFile; - - protected Connection conn = null; - protected PreparedStatement prepStmt; - public RMapsSQLite() { super(); - SQLiteLoader.loadSQLiteOrShowError(); } @Override @@ -91,13 +77,11 @@ } @Override - public void startAtlasCreation(AtlasInterface atlas, File customAtlasDir) throws IOException, AtlasTestException, - InterruptedException { + public void startAtlasCreation(AtlasInterface atlas, File customAtlasDir) + throws IOException, AtlasTestException, InterruptedException { if (customAtlasDir == null) customAtlasDir = Settings.getInstance().getAtlasOutputDirectory(); super.startAtlasCreation(atlas, customAtlasDir); - databaseFile = new File(atlasDir, getDatabaseFileName()); - log.debug("SQLite Database file: " + databaseFile); } @Override @@ -108,41 +92,15 @@ throw new MapCreationException(map, e); } try { - SQLiteLoader.loadSQLite(); - } catch (SQLException e) { - throw new MapCreationException(SQLiteLoader.getMsgSqliteMissing(), map, e); - } - try { openConnection(); initializeDB(); createTiles(); - } catch (SQLException e) { + } catch (SQLException | IOException e) { throw new MapCreationException("Error creating SQL database \"" + databaseFile + "\": " + e.getMessage(), map, e); } } - protected void openConnection() throws SQLException { - if (conn == null || conn.isClosed()) { - String url = "jdbc:sqlite:/" + databaseFile.getAbsolutePath(); - conn = DriverManager.getConnection(url); - } - } - - @Override - public void abortAtlasCreation() throws IOException { - SQLiteLoader.closeConnection(conn); - conn = null; - super.abortAtlasCreation(); - } - - @Override - public void finishAtlasCreation() throws IOException, InterruptedException { - SQLiteLoader.closeConnection(conn); - conn = null; - super.finishAtlasCreation(); - } - protected void initializeDB() throws SQLException { Statement stat = conn.createStatement(); stat.executeUpdate(TABLE_DDL); @@ -161,59 +119,7 @@ stat.executeUpdate(RMAPS_TABLE_INFO_DDL); } - protected void createTiles() throws InterruptedException, MapCreationException { - int maxMapProgress = 2 * (xMax - xMin + 1) * (yMax - yMin + 1); - atlasProgress.initMapCreation(maxMapProgress); - TileImageParameters param = map.getParameters(); - if (param != null) - mapDlTileProvider = new ConvertedRawTileProvider(mapDlTileProvider, param.getFormat()); - try { - conn.setAutoCommit(false); - int batchTileCount = 0; - int tilesWritten = 0; - Runtime r = Runtime.getRuntime(); - long heapMaxSize = r.maxMemory(); - prepStmt = conn.prepareStatement(getTileInsertSQL()); - for (int x = xMin; x <= xMax; x++) { - for (int y = yMin; y <= yMax; y++) { - checkUserAbort(); - atlasProgress.incMapCreationProgress(); - try { - byte[] sourceTileData = mapDlTileProvider.getTileData(x, y); - if (sourceTileData != null) { - writeTile(x, y, zoom, sourceTileData); - tilesWritten++; - long heapAvailable = heapMaxSize - r.totalMemory() + r.freeMemory(); - - batchTileCount++; - if ((heapAvailable < HEAP_MIN) || (batchTileCount >= MAX_BATCH_SIZE)) { - log.trace("Executing batch containing " + batchTileCount + " tiles"); - prepStmt.executeBatch(); - prepStmt.clearBatch(); - System.gc(); - conn.commit(); - atlasProgress.incMapCreationProgress(batchTileCount); - batchTileCount = 0; - } - } - } catch (IOException e) { - throw new MapCreationException(map, e); - } - } - } - prepStmt.executeBatch(); - prepStmt.clearBatch(); - System.gc(); - if (tilesWritten > 0) - updateTileMetaInfo(); - log.trace("Final commit containing " + batchTileCount + " tiles"); - conn.commit(); - atlasProgress.setMapCreationProgress(maxMapProgress); - } catch (SQLException e) { - throw new MapCreationException(map, e); - } - } - + @Override protected void updateTileMetaInfo() throws SQLException { Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery(RMAPS_INFO_MAX_SQL); @@ -236,6 +142,7 @@ ps.close(); } + @Override protected void writeTile(int x, int y, int z, byte[] tileData) throws SQLException, IOException { prepStmt.setInt(1, x); prepStmt.setInt(2, y); @@ -244,10 +151,12 @@ prepStmt.addBatch(); } + @Override protected String getDatabaseFileName() { return atlas.getName() + ".sqlitedb"; } + @Override protected String getTileInsertSQL() { return INSERT_SQL; } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/tileprovider/DownloadedTileProvider.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/tileprovider/DownloadedTileProvider.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/tileprovider/DownloadedTileProvider.java 2014-02-06 05:48:10.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/tileprovider/DownloadedTileProvider.java 2014-02-13 09:31:26.000000000 +0000 @@ -54,7 +54,11 @@ byte[] unconvertedTileData = getTileData(x, y); if (unconvertedTileData == null) return null; - return ImageIO.read(new ByteArrayInputStream(unconvertedTileData)); + try { + return ImageIO.read(new ByteArrayInputStream(unconvertedTileData)); + } catch (Exception e) { + throw new IOException("Unable to load image x=" + x + " y=" + y + " - error: " + e); + } } public boolean preferTileImageUsage() { diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/tileprovider/GpxPainterTileProvider.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/tileprovider/GpxPainterTileProvider.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/tileprovider/GpxPainterTileProvider.java 2014-02-06 05:48:10.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/tileprovider/GpxPainterTileProvider.java 2014-04-04 13:00:20.000000000 +0000 @@ -16,10 +16,18 @@ ******************************************************************************/ package mobac.program.atlascreators.tileprovider; +import java.awt.Graphics2D; +import java.awt.Point; import java.awt.image.BufferedImage; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import mobac.data.gpx.gpx11.Gpx; +import mobac.data.gpx.gpx11.TrkType; +import mobac.data.gpx.gpx11.TrksegType; +import mobac.data.gpx.gpx11.WptType; +import mobac.data.gpx.interfaces.GpxPoint; import mobac.program.interfaces.MapSource; import mobac.program.interfaces.MapSpace; import mobac.program.model.TileImageFormat; @@ -38,23 +46,79 @@ public class GpxPainterTileProvider extends ConvertedRawTileProvider { private final MapSpace mapSpace; + private final int zoom; + + private List points = new ArrayList(); + private List lines = new ArrayList(); public GpxPainterTileProvider(MapSourceProvider tileProvider, TileImageFormat tileImageFormat, Gpx gpx) { super(tileProvider, tileImageFormat); - int zoom = tileProvider.getZoom(); + zoom = tileProvider.getZoom(); MapSource mapSource = tileProvider.getMapSource(); mapSpace = mapSource.getMapSpace(); // TODO Prepare GPX points + for (TrkType trk : gpx.getTrk()) { + for (TrksegType trkSeg : trk.getTrkseg()) { + List trackPoints = trkSeg.getTrkpt(); + + if (trackPoints.size() < 2) + continue; + Point last = convert(trackPoints.get(0)); + points.add(last); + for (int i = 1; i < trackPoints.size(); i++) { + Point current = convert(trackPoints.get(i)); + points.add(current); + lines.add(new Line(last, current)); + last = current; + } + } + } + } + + private Point convert(GpxPoint gpxPoint) { + int x = mapSpace.cLonToX(gpxPoint.getLon().doubleValue(), zoom); + int y = mapSpace.cLatToY(gpxPoint.getLat().doubleValue(), zoom); + return new Point(x, y); } @Override public BufferedImage getTileImage(int x, int y) throws IOException { BufferedImage image = super.getTileImage(x, y); - // TODO Perform GPX painting + // Calculate tile bounds: + final int tileSize = mapSpace.getTileSize(); + int xMin = tileSize * x; + int yMin = tileSize * y; + int xMax = xMin + tileSize - 1; + int yMax = yMin + tileSize - 1; + + Graphics2D g = (Graphics2D) image.getGraphics(); + try { + for (Point p : points) { + if (p.x < xMin || p.x > xMax || p.y < yMin || p.y > yMax) + continue; // Point is outside of tile + int px = p.x - xMin; + int py = p.y - yMin; + g.drawOval(px, py, 5, 5); + } + // TODO paint lines + } finally { + g.dispose(); + } return image; } + public static class Line { + public final Point start; + public final Point end; + + public Line(Point start, Point end) { + super(); + this.start = start; + this.end = end; + } + + } } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/TomTomRaster.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/TomTomRaster.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/TomTomRaster.java 2014-02-06 05:48:08.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/TomTomRaster.java 2016-04-24 08:39:42.000000000 +0000 @@ -28,6 +28,7 @@ import java.io.IOException; import java.io.OutputStreamWriter; import java.io.StringWriter; +import java.nio.charset.StandardCharsets; import java.text.NumberFormat; import javax.imageio.ImageIO; @@ -43,7 +44,6 @@ import mobac.program.interfaces.MapSpace.ProjectionCategory; import mobac.program.interfaces.TileImageDataWriter; import mobac.program.tiledatawriter.TileImageJpegDataWriter; -import mobac.utilities.Charsets; import mobac.utilities.Utilities; /** @@ -61,8 +61,8 @@ @Override public boolean testMapSource(MapSource mapSource) { MapSpace mapSpace = mapSource.getMapSpace(); - return (mapSpace instanceof MercatorPower2MapSpace && ProjectionCategory.SPHERE.equals(mapSpace - .getProjectionCategory())); + return (mapSpace instanceof MercatorPower2MapSpace + && ProjectionCategory.SPHERE.equals(mapSpace.getProjectionCategory())); } @Override @@ -76,8 +76,8 @@ int w = map.getMaxTileCoordinate().x - map.getMinTileCoordinate().x; int h = map.getMaxTileCoordinate().y - map.getMinTileCoordinate().y; if (w > maxMapSize || h > maxMapSize) - throw new AtlasTestException("Map size too large for memory (is: " + Math.max(w, h) + " max: " - + maxMapSize + ")", map); + throw new AtlasTestException( + "Map size too large for memory (is: " + Math.max(w, h) + " max: " + maxMapSize + ")", map); } } @@ -140,7 +140,8 @@ try { if (scaleImage) { graphics.setTransform(AffineTransform.getScaleInstance(scaleFactor, scaleFactor)); - graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); + graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, + RenderingHints.VALUE_INTERPOLATION_BILINEAR); } int lineY = 0; for (int y = yMin; y <= yMax; y++) { @@ -233,8 +234,8 @@ int i = imageFileName.lastIndexOf('.'); String satFileName = imageFileName.substring(0, i) + ".sat"; - FileOutputStream fout = new FileOutputStream(new File(layerDir,satFileName)); - OutputStreamWriter writer = new OutputStreamWriter(fout, Charsets.ISO_8859_1); + FileOutputStream fout = new FileOutputStream(new File(layerDir, satFileName)); + OutputStreamWriter writer = new OutputStreamWriter(fout, StandardCharsets.ISO_8859_1); writer.append(sw.toString()); writer.flush(); writer.close(); diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/TrekBuddyTared.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/TrekBuddyTared.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/atlascreators/TrekBuddyTared.java 2014-02-06 05:48:08.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/atlascreators/TrekBuddyTared.java 2014-09-24 11:25:40.000000000 +0000 @@ -22,10 +22,11 @@ import java.util.LinkedList; import java.util.List; -import org.apache.commons.io.FileUtils; - +import mobac.exceptions.AtlasTestException; import mobac.program.annotations.AtlasCreatorName; import mobac.program.atlascreators.impl.MapTileWriter; +import mobac.program.interfaces.LayerInterface; +import mobac.program.interfaces.MapInterface; import mobac.utilities.Utilities; import mobac.utilities.tar.TarArchive; import mobac.utilities.tar.TarTmiArchive; @@ -34,6 +35,20 @@ public class TrekBuddyTared extends TrekBuddy { @Override + protected void testAtlas() throws AtlasTestException { + super.testAtlas(); + for (LayerInterface layer : atlas) { + for (MapInterface map : layer) { + String mapFileName = layer.getName() + "/" + map.getName() + "/" + map.getName() + ".map"; + if (mapFileName.length() > 100) + throw new AtlasTestException("Layer and map name too long for Trekbuddy Tar format!\n" + + mapFileName + "\n\nCurrent length: " + mapFileName.length() + + " characters\nMaximum length: 100 characters", map); + } + } + } + + @Override public void finishAtlasCreation() { createAtlasTarArchive("cr"); } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/AtlasThread.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/AtlasThread.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/AtlasThread.java 2014-02-06 05:48:10.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/AtlasThread.java 2016-05-12 02:45:30.000000000 +0000 @@ -23,6 +23,8 @@ import javax.swing.JOptionPane; import javax.swing.SwingUtilities; +import org.apache.log4j.Logger; + import mobac.exceptions.AtlasTestException; import mobac.exceptions.MapDownloadSkippedException; import mobac.gui.AtlasProgress; @@ -40,6 +42,7 @@ import mobac.program.interfaces.MapInterface; import mobac.program.interfaces.MapSource; import mobac.program.interfaces.MapSource.LoadMethod; +import mobac.program.interfaces.MapSourceCallerThreadInfo; import mobac.program.model.AtlasOutputFormat; import mobac.program.model.Settings; import mobac.program.tilestore.TileStore; @@ -49,9 +52,8 @@ import mobac.utilities.tar.TarIndex; import mobac.utilities.tar.TarIndexedArchive; -import org.apache.log4j.Logger; - -public class AtlasThread extends Thread implements DownloadJobListener, AtlasCreationController { +public class AtlasThread extends Thread + implements DownloadJobListener, AtlasCreationController, MapSourceCallerThreadInfo { private static final Logger log = Logger.getLogger(AtlasThread.class); private static int threadNum = 0; @@ -95,7 +97,7 @@ MapSource mapSource = map.getMapSource(); if (!atlasCreator.testMapSource(mapSource)) throw new AtlasTestException("The selected atlas output format \"" + atlas.getOutputFormat() - + "\" does not support the map source \"" + map.getMapSource() + "\""); + + "\" does not support the map source \"" + map.getMapSource() + "\"", map); } } } catch (AtlasTestException e) { @@ -175,9 +177,10 @@ if (totalNrOfOnlineTiles > 500000) { // NumberFormat f = DecimalFormat.getInstance(); - JOptionPane.showMessageDialog(null, String.format( - I18nUtils.localizedStringForKey("msg_too_many_tiles_msg"), 500000, totalNrOfOnlineTiles), I18nUtils - .localizedStringForKey("msg_too_many_tiles_title"), JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, + String.format(I18nUtils.localizedStringForKey("msg_too_many_tiles_msg"), 500000, + totalNrOfOnlineTiles), + I18nUtils.localizedStringForKey("msg_too_many_tiles_title"), JOptionPane.ERROR_MESSAGE); return; } try { @@ -193,7 +196,7 @@ Settings s = Settings.getInstance(); - downloadJobDispatcher = new JobDispatcher(s.downloadThreadCount, pauseResumeHandler, ap); + downloadJobDispatcher = new JobDispatcher(this, s.downloadThreadCount, pauseResumeHandler, ap); try { for (LayerInterface layer : atlas) { atlasCreator.initLayerCreation(layer); @@ -290,7 +293,8 @@ } else log.debug("Downloading to tile store only"); - djp = new DownloadJobProducerThread(this, downloadJobDispatcher, tileArchive, (DownloadableElement) map); + djp = new DownloadJobProducerThread(this, downloadJobDispatcher, tileArchive, + (DownloadableElement) map); boolean failedMessageAnswered = false; @@ -336,8 +340,9 @@ int missing = tileCount - tileIndex.size(); log.debug("Expected tile count: " + tileCount + " downloaded tile count: " + tileIndex.size() + " missing: " + missing); - int answer = JOptionPane.showConfirmDialog(ap, String.format( - I18nUtils.localizedStringForKey("dlg_download_errors_missing_tile_msg"), missing), + int answer = JOptionPane.showConfirmDialog(ap, + String.format(I18nUtils.localizedStringForKey("dlg_download_errors_missing_tile_msg"), + missing), I18nUtils.localizedStringForKey("dlg_download_errors_missing_tile"), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE); if (answer != JOptionPane.YES_OPTION) @@ -453,4 +458,9 @@ this.quitMobacAfterAtlasCreation = quitMobacAfterAtlasCreation; } + @Override + public boolean isMapPreviewThread() { + return false; + } + } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/download/TileDownLoader.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/download/TileDownLoader.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/download/TileDownLoader.java 2014-02-06 05:48:10.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/download/TileDownLoader.java 2017-10-18 11:23:28.000000000 +0000 @@ -37,7 +37,7 @@ public class TileDownLoader { - public static String ACCEPT = "text/html, image/png, image/jpeg, image/gif, */*;q=0.1"; + private static final Settings settings = Settings.getInstance(); static { Object defaultReadTimeout = System.getProperty("sun.net.client.defaultReadTimeout"); @@ -48,8 +48,6 @@ private static Logger log = Logger.getLogger(TileDownLoader.class); - private static Settings settings = Settings.getInstance(); - public static byte[] getImage(int x, int y, int zoom, HttpMapSource mapSource) throws IOException, InterruptedException, UnrecoverableDownloadException { @@ -68,10 +66,8 @@ // if (Math.random()>0.7) throw new // IOException("intentionally download error"); - Settings s = Settings.getInstance(); - TileStoreEntry tile = null; - if (s.tileStoreEnabled) { + if (settings.tileStoreEnabled) { // Copy the file from the persistent tilestore instead of // downloading it from internet. @@ -132,7 +128,7 @@ */ public static byte[] downloadTileAndUpdateStore(int x, int y, int zoom, HttpMapSource mapSource) throws UnrecoverableDownloadException, IOException, InterruptedException { - return downloadTileAndUpdateStore(x, y, zoom, mapSource, Settings.getInstance().tileStoreEnabled); + return downloadTileAndUpdateStore(x, y, zoom, mapSource, settings.tileStoreEnabled); } public static byte[] downloadTile(int x, int y, int zoom, HttpMapSource mapSource) @@ -160,10 +156,10 @@ if (code != HttpURLConnection.HTTP_OK) throw new DownloadFailedException(conn, code); - + checkContentType(conn, data); checkContentLength(conn, data); - + String eTag = conn.getHeaderField("ETag"); long timeLastModified = conn.getLastModified(); long timeExpires = conn.getExpiration(); @@ -237,13 +233,11 @@ conn.connect(); - Settings s = Settings.getInstance(); - int code = conn.getResponseCode(); if (conditionalRequest && code == HttpURLConnection.HTTP_NOT_MODIFIED) { // Data unchanged on server - if (s.tileStoreEnabled) { + if (settings.tileStoreEnabled) { tile.update(conn.getExpiration()); TileStore.getInstance().putTile(tile, mapSource); } @@ -267,7 +261,7 @@ TileImageType imageType = Utilities.getImageType(data); if (imageType == null) throw new UnrecoverableDownloadException("The returned image is of unknown format"); - if (s.tileStoreEnabled) { + if (settings.tileStoreEnabled) { TileStore.getInstance().putTileData(data, x, y, zoom, mapSource, timeLastModified, timeExpires, eTag); } Utilities.checkForInterruption(); @@ -304,7 +298,7 @@ try { if (Thread.currentThread() instanceof MapSourceListener) { // We only throttle atlas downloads, not downloads for the preview map - long bandwidthLimit = Settings.getInstance().getBandwidthLimit(); + long bandwidthLimit = settings.getBandwidthLimit(); if (bandwidthLimit > 0) { input = new ThrottledInputStream(input); } @@ -341,7 +335,7 @@ } HttpURLConnection conn = mapSource.getTileUrlConnection(tile.getZoom(), tile.getX(), tile.getY()); conn.setRequestMethod("HEAD"); - conn.setRequestProperty("Accept", ACCEPT); + conn.setRequestProperty("Accept", settings.getHttpAccept()); long newLastModified = conn.getLastModified(); if (newLastModified == 0) return true; @@ -356,7 +350,7 @@ } HttpURLConnection conn = mapSource.getTileUrlConnection(tile.getZoom(), tile.getX(), tile.getY()); conn.setRequestMethod("HEAD"); - conn.setRequestProperty("Accept", ACCEPT); + conn.setRequestProperty("Accept", settings.getHttpAccept()); String onlineETag = conn.getHeaderField("ETag"); if (onlineETag == null || onlineETag.length() == 0) return true; @@ -366,12 +360,11 @@ protected static void prepareConnection(HttpURLConnection conn) throws ProtocolException { conn.setRequestMethod("GET"); - Settings s = Settings.getInstance(); - conn.setConnectTimeout(1000 * s.httpConnectionTimeout); - conn.setReadTimeout(1000 * s.httpReadTimeout); + conn.setConnectTimeout(1000 * settings.httpConnectionTimeout); + conn.setReadTimeout(1000 * settings.httpReadTimeout); if (conn.getRequestProperty("User-agent") == null) - conn.setRequestProperty("User-agent", s.getUserAgent()); - conn.setRequestProperty("Accept", ACCEPT); + conn.setRequestProperty("User-agent", settings.getUserAgent()); + conn.setRequestProperty("Accept", settings.getHttpAccept()); } protected static void checkContentType(HttpURLConnection conn, byte[] data) throws UnrecoverableDownloadException { @@ -382,7 +375,7 @@ if (log.isTraceEnabled() && contentType.startsWith("text/")) { log.trace("Content (" + contentType + "): " + new String(data)); } - throw new UnrecoverableDownloadException("Content type of the loaded image is unknown: " + contentType, + throw new UnrecoverableDownloadException("Content type of the loaded image is unknown: " + contentType, UnrecoverableDownloadException.ERROR_CODE_CONTENT_TYPE); } } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/interfaces/AtlasObject.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/interfaces/AtlasObject.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/interfaces/AtlasObject.java 2014-02-06 05:48:04.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/interfaces/AtlasObject.java 2014-10-25 08:45:54.000000000 +0000 @@ -19,8 +19,8 @@ import mobac.exceptions.InvalidNameException; /** - * Marker interface that indicates that the implementing class/instance is an - * atlas or is part of an atlas (layer or map) + * Marker interface that indicates that the implementing class/instance is an atlas or is part of an atlas (layer or + * map) */ public interface AtlasObject { @@ -35,8 +35,31 @@ */ public boolean checkData(); + /** + * minimum latitude (corresponds to row/y value) + * + * @return + */ public double getMinLat(); + + /** + * maximum latitude (corresponds to row/y value) + * + * @return + */ public double getMaxLat(); + + /** + * minimum longitude (corresponds to column/x value) + * + * @return + */ public double getMinLon(); - public double getMaxLon(); + + /** + * maximum longitude (corresponds to column/x value) + * + * @return + */ + public double getMaxLon(); } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/interfaces/CloneableMapSource.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/interfaces/CloneableMapSource.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/interfaces/CloneableMapSource.java 1970-01-01 00:00:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/interfaces/CloneableMapSource.java 2016-04-25 12:07:48.000000000 +0000 @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) MOBAC developers + * + * 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 2 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 . + ******************************************************************************/ +package mobac.program.interfaces; + +public interface CloneableMapSource extends Cloneable { + public MapSource clone() throws CloneNotSupportedException; +} diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/interfaces/InitializableMapSource.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/interfaces/InitializableMapSource.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/interfaces/InitializableMapSource.java 2014-02-06 05:48:04.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/interfaces/InitializableMapSource.java 2014-06-06 11:53:16.000000000 +0000 @@ -16,8 +16,10 @@ ******************************************************************************/ package mobac.program.interfaces; +import mobac.exceptions.MapSourceInitializationException; + public interface InitializableMapSource extends MapSource { - public void initialize(); + public void initialize() throws MapSourceInitializationException; } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/interfaces/LayerInterface.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/interfaces/LayerInterface.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/interfaces/LayerInterface.java 2014-02-06 05:48:04.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/interfaces/LayerInterface.java 2017-11-11 08:47:18.000000000 +0000 @@ -16,7 +16,9 @@ ******************************************************************************/ package mobac.program.interfaces; -public interface LayerInterface extends AtlasObject, Iterable, CapabilityDeletable { +import javax.swing.tree.TreeNode; + +public interface LayerInterface extends AtlasObject, Iterable, CapabilityDeletable, TreeNode { public void addMap(MapInterface map); diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/interfaces/MapInterface.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/interfaces/MapInterface.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/interfaces/MapInterface.java 2014-02-06 05:48:04.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/interfaces/MapInterface.java 2017-11-11 08:47:46.000000000 +0000 @@ -19,11 +19,11 @@ import java.awt.Dimension; import java.awt.Point; -import mobac.program.model.TileImageParameters; - +import javax.swing.tree.TreeNode; +import mobac.program.model.TileImageParameters; -public interface MapInterface extends AtlasObject, CapabilityDeletable { +public interface MapInterface extends AtlasObject, CapabilityDeletable, TreeNode { public Point getMinTileCoordinate(); @@ -46,9 +46,9 @@ public long calculateTilesToDownload(); public String getInfoText(); - + public TileFilter getTileFilter(); - + public MapInterface deepClone(LayerInterface newLayer); } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/interfaces/MapSourceCallerThreadInfo.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/interfaces/MapSourceCallerThreadInfo.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/interfaces/MapSourceCallerThreadInfo.java 1970-01-01 00:00:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/interfaces/MapSourceCallerThreadInfo.java 2014-10-15 11:27:56.000000000 +0000 @@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) MOBAC developers + * + * 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 2 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 . + ******************************************************************************/ +package mobac.program.interfaces; + +public interface MapSourceCallerThreadInfo { + + public boolean isMapPreviewThread(); +} diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/interfaces/RefreshableMapSource.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/interfaces/RefreshableMapSource.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/interfaces/RefreshableMapSource.java 1970-01-01 00:00:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/interfaces/RefreshableMapSource.java 2016-04-21 11:27:50.000000000 +0000 @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) MOBAC developers + * + * 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 2 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 . + ******************************************************************************/ +package mobac.program.interfaces; + +import mobac.gui.mapview.PreviewMap; + +public interface RefreshableMapSource { + + /** + * Called whenever {@link PreviewMap#refreshMap()} is executed + */ + public void refresh(); +} diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/interfaces/RequiresSQLite.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/interfaces/RequiresSQLite.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/interfaces/RequiresSQLite.java 2014-02-06 05:48:04.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/interfaces/RequiresSQLite.java 2015-04-19 04:25:14.000000000 +0000 @@ -21,6 +21,8 @@ */ public interface RequiresSQLite { + public static final int MAX_BATCH_SIZE = 1000; + /** * Accumulate tiles in batch process until 20MB of heap are remaining */ diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/JobDispatcher.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/JobDispatcher.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/JobDispatcher.java 2014-02-06 05:48:06.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/JobDispatcher.java 2014-09-24 11:25:42.000000000 +0000 @@ -34,18 +34,19 @@ private static Logger log = Logger.getLogger(JobDispatcher.class); + protected final AtlasThread atlasThread; + protected final PauseResumeHandler pauseResumeHandler; + protected final MapSourceListener mapSourceListener; + protected final WorkerThread[] workers; + protected int maxJobsInQueue = 100; protected int minJobsInQueue = 50; - protected WorkerThread[] workers; - - protected PauseResumeHandler pauseResumeHandler; - - protected MapSourceListener mapSourceListener; + protected final BlockingQueue jobQueue = new LinkedBlockingQueue(); - protected BlockingQueue jobQueue = new LinkedBlockingQueue(); - - public JobDispatcher(int threadCount, PauseResumeHandler pauseResumeHandler, MapSourceListener mapSourceListener) { + public JobDispatcher(AtlasThread atlasThread, int threadCount, PauseResumeHandler pauseResumeHandler, + MapSourceListener mapSourceListener) { + this.atlasThread = atlasThread; this.pauseResumeHandler = pauseResumeHandler; this.mapSourceListener = mapSourceListener; workers = new WorkerThread[threadCount]; @@ -135,7 +136,7 @@ * Each worker thread takes the first job from the job queue and executes it. If the queue is empty the worker * blocks, waiting for the next job. */ - protected class WorkerThread extends DelayedInterruptThread implements MapSourceListener { + public class WorkerThread extends DelayedInterruptThread implements MapSourceListener { Job job = null; @@ -199,6 +200,9 @@ mapSourceListener.tileLoadedFromCache(size); } + public AtlasThread getAtlasThread() { + return JobDispatcher.this.atlasThread; + } } } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/Logging.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/Logging.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/Logging.java 2014-02-06 05:48:08.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/Logging.java 2016-02-24 01:10:56.000000000 +0000 @@ -161,6 +161,7 @@ log.info("Directories:" /**/ + n + "currentDir: \t\t" + DirectoryManager.currentDir /**/ + n + "programDir: \t\t" + DirectoryManager.programDir /**/ + + n + "mapSourcesDir: \t\t" + DirectoryManager.mapSourcesDir /**/ + n + "tempDir: \t\t" + DirectoryManager.tempDir /**/ + n + "userHomeDir: \t\t" + DirectoryManager.userHomeDir /**/ + n + "userSettingsDir: \t" + DirectoryManager.userSettingsDir /**/ diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/model/Atlas.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/model/Atlas.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/model/Atlas.java 2014-02-06 05:48:06.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/model/Atlas.java 2017-11-11 08:47:28.000000000 +0000 @@ -175,8 +175,9 @@ return sw.toString(); } - public Enumeration children() { - return Collections.enumeration(layers); + @SuppressWarnings("unchecked") + public Enumeration children() { + return (Enumeration) Collections.enumeration(layers); } public boolean getAllowsChildren() { diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/model/AtlasOutputFormat.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/model/AtlasOutputFormat.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/model/AtlasOutputFormat.java 2014-02-06 05:48:06.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/model/AtlasOutputFormat.java 2015-03-18 00:31:44.000000000 +0000 @@ -36,6 +36,7 @@ import mobac.program.atlascreators.GCLive; import mobac.program.atlascreators.Galileo; import mobac.program.atlascreators.GarminCustom; +import mobac.program.atlascreators.GeoPackage; import mobac.program.atlascreators.Glopus; import mobac.program.atlascreators.GlopusMapFile; import mobac.program.atlascreators.GoogleEarthOverlay; @@ -46,12 +47,13 @@ import mobac.program.atlascreators.MagellanRmp; import mobac.program.atlascreators.Maplorer; import mobac.program.atlascreators.Maverick; +import mobac.program.atlascreators.MaverickOld; import mobac.program.atlascreators.MobileTrailExplorer; import mobac.program.atlascreators.MobileTrailExplorerCache; import mobac.program.atlascreators.NFComPass; import mobac.program.atlascreators.NaviComputer; import mobac.program.atlascreators.OSMAND; -import mobac.program.atlascreators.OSMAND_SQlite; +import mobac.program.atlascreators.OSMAND_SQLite; import mobac.program.atlascreators.OSMTracker; import mobac.program.atlascreators.OruxMaps; import mobac.program.atlascreators.OruxMapsSqlite; @@ -96,6 +98,7 @@ FORMATS.add(createByClass(Galileo.class)); FORMATS.add(createByClass(GarminCustom.class)); FORMATS.add(createByClass(GCLive.class)); + // FORMATS.add(createByClass(GeoPackage.class)); FORMATS.add(createByClass(Glopus.class)); FORMATS.add(createByClass(GlopusMapFile.class)); FORMATS.add(createByClass(GoogleEarthOverlay.class)); @@ -104,6 +107,7 @@ FORMATS.add(createByClass(MagellanRmp.class)); FORMATS.add(createByClass(Maplorer.class)); FORMATS.add(createByClass(Maverick.class)); + FORMATS.add(createByClass(MaverickOld.class)); FORMATS.add(createByClass(MBTiles.class)); FORMATS.add(createByClass(MGMaps.class)); FORMATS.add(createByClass(MobileTrailExplorer.class)); @@ -113,7 +117,7 @@ FORMATS.add(createByClass(OruxMaps.class)); FORMATS.add(createByClass(OruxMapsSqlite.class)); FORMATS.add(createByClass(OSMAND.class)); - FORMATS.add(createByClass(OSMAND_SQlite.class)); + FORMATS.add(createByClass(OSMAND_SQLite.class)); FORMATS.add(createByClass(Osmdroid.class)); FORMATS.add(createByClass(OsmdroidGEMF.class)); FORMATS.add(createByClass(OsmdroidSQLite.class)); @@ -195,4 +199,13 @@ return getTypeName().compareTo(o.toString()); } + /** + * Print all atlas formats + */ + public static void main(String[] args) { + for (AtlasOutputFormat s : FORMATS) { + System.out.println("|" + s); + System.out.println("|-"); + } + } } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/model/Layer.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/model/Layer.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/model/Layer.java 2014-02-06 05:48:06.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/model/Layer.java 2017-10-18 11:21:32.000000000 +0000 @@ -240,8 +240,9 @@ return maps.iterator(); } - public Enumeration children() { - return Collections.enumeration(maps); + @SuppressWarnings("unchecked") + public Enumeration children() { + return (Enumeration) Collections.enumeration(maps); } public boolean getAllowsChildren() { diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/model/Map.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/model/Map.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/model/Map.java 2014-02-06 05:48:06.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/model/Map.java 2017-10-18 11:21:32.000000000 +0000 @@ -30,6 +30,7 @@ import mobac.program.JobDispatcher.Job; import mobac.program.download.jobenumerators.DownloadJobEnumerator; import mobac.program.interfaces.CapabilityDeletable; +import mobac.program.interfaces.CloneableMapSource; import mobac.program.interfaces.DownloadJobListener; import mobac.program.interfaces.DownloadableElement; import mobac.program.interfaces.LayerInterface; @@ -152,7 +153,8 @@ sw.write(""); sw.write(I18nUtils.localizedStringForKey("lp_atlas_info_map_title")); sw.write(I18nUtils.localizedStringForKey("lp_atlas_info_map_source", - StringEscapeUtils.escapeHtml4(mapSource.toString()), StringEscapeUtils.escapeHtml4(mapSource.getName()))); + StringEscapeUtils.escapeHtml4(mapSource.toString()), + StringEscapeUtils.escapeHtml4(mapSource.getName()))); sw.write(I18nUtils.localizedStringForKey("lp_atlas_info_map_zoom_lv", zoom)); sw.write(I18nUtils.localizedStringForKey("lp_atlas_info_map_area_start", tl.toString(), minTileCoordinate.x, minTileCoordinate.y)); @@ -163,8 +165,8 @@ if (parameters != null) { sw.write(String.format(I18nUtils.localizedStringForKey("lp_atlas_info_tile_size"), parameters.getWidth(), parameters.getHeight())); - sw.write(String.format(I18nUtils.localizedStringForKey("lp_atlas_info_tile_format"), parameters.getFormat() - .toString())); + sw.write(String.format(I18nUtils.localizedStringForKey("lp_atlas_info_tile_format"), + parameters.getFormat().toString())); } else { sw.write(I18nUtils.localizedStringForKey("lp_atlas_info_tile_format_origin")); } @@ -209,7 +211,7 @@ this.name = newName; } - public Enumeration children() { + public Enumeration children() { return null; } @@ -294,7 +296,11 @@ try { Map map = this.getClass().newInstance(); map.layer = (Layer) newLayer; - map.mapSource = mapSource; + if (mapSource instanceof CloneableMapSource) { + map.mapSource = ((CloneableMapSource) mapSource).clone(); + } else { + map.mapSource = mapSource; + } map.maxTileCoordinate = (Point) maxTileCoordinate.clone(); map.minTileCoordinate = (Point) minTileCoordinate.clone(); map.name = name; diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/model/MapSourceLoaderInfo.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/model/MapSourceLoaderInfo.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/model/MapSourceLoaderInfo.java 2014-02-06 05:48:06.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/model/MapSourceLoaderInfo.java 2014-09-24 11:25:40.000000000 +0000 @@ -17,14 +17,20 @@ package mobac.program.model; import java.io.File; +import java.util.LinkedList; public class MapSourceLoaderInfo { public enum LoaderType { - MAPPACK, // map pack file - XML, // custom map xml - BSH // BeanShell script + MAPPACK("Mappack"), // map pack file + XML("Custom XML"), // custom map xml + BSH("BeanShell") // BeanShell script ; + public final String displayName; + + private LoaderType(String displayName) { + this.displayName = displayName; + } }; protected final LoaderType loaderType; @@ -56,4 +62,25 @@ return revision; } + /** + * This method gets a MapSource's path, relative to the /mapsources folder. + * + * @return Path - relative path to the /mapsources folder, returns null if the file is directly in the /mapsources + * folder + * + */ + public String[] getRelativePath() { + File mapSourcesDir = Settings.getInstance().getMapSourcesDirectory(); + File dir = sourceFile.getParentFile(); + LinkedList pathList = new LinkedList(); + while (!mapSourcesDir.equals(dir)) { + pathList.offerFirst(dir.getName()); + dir = dir.getParentFile(); + } + if (pathList.size() == 0) { + return null; + } else { + return pathList.toArray(new String[pathList.size()]); + } + } } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/model/Profile.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/model/Profile.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/model/Profile.java 2014-02-06 05:48:06.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/model/Profile.java 2017-06-29 09:13:56.000000000 +0000 @@ -20,6 +20,7 @@ import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FilenameFilter; +import java.lang.reflect.InvocationTargetException; import java.util.Collections; import java.util.HashSet; import java.util.Set; @@ -36,6 +37,8 @@ import javax.xml.bind.ValidationEventHandler; import javax.xml.bind.ValidationEventLocator; +import org.apache.log4j.Logger; + import mobac.gui.panels.JProfilesPanel; import mobac.program.DirectoryManager; import mobac.program.interfaces.AtlasInterface; @@ -43,8 +46,6 @@ import mobac.utilities.I18nUtils; import mobac.utilities.Utilities; -import org.apache.log4j.Logger; - /** * A profile is a saved atlas. The available profiles ({@link Profile} instances) are visible in the * profilesCombo in the {@link JProfilesPanel}. @@ -57,8 +58,8 @@ public static final String PROFILE_FILENAME_PREFIX = "mobac-profile-"; - public static final Pattern PROFILE_FILENAME_PATTERN = Pattern.compile(PROFILE_FILENAME_PREFIX + "(" - + PROFILE_NAME_REGEX + ").xml"); + public static final Pattern PROFILE_FILENAME_PATTERN = Pattern + .compile(PROFILE_FILENAME_PREFIX + "(" + PROFILE_NAME_REGEX + ").xml"); public static final Profile DEFAULT = new Profile(); @@ -185,12 +186,25 @@ ValidationEventLocator loc = event.getLocator(); String file = loc.getURL().getFile(); int lastSlash = file.lastIndexOf('/'); - if (lastSlash > 0) + if (lastSlash > 0) { file = file.substring(lastSlash + 1); - int ret = JOptionPane.showConfirmDialog( - null, - String.format(I18nUtils.localizedStringForKey("msg_error_load_atlas_profile"), - event.getMessage(), file, loc.getLineNumber(), loc.getColumnNumber()), + } + String message = event.getMessage(); + if (message == null) { + // No message - try to find an error message in the linked Exceptions + Throwable ex = event.getLinkedException(); + while (ex instanceof InvocationTargetException) { + ex = ex.getCause(); + } + if (ex != null) { + message = ex.getMessage(); + } else { + message = "?"; + } + } + int ret = JOptionPane.showConfirmDialog(null, + String.format(I18nUtils.localizedStringForKey("msg_error_load_atlas_profile"), message, file, + loc.getLineNumber(), loc.getColumnNumber()), I18nUtils.localizedStringForKey("msg_error_load_atlas_profile_title"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE); log.error(event.toString()); diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/model/Settings.java mobile-atlas-creator-2.1.0/src/main/java/mobac/program/model/Settings.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/program/model/Settings.java 2014-02-06 05:48:06.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/program/model/Settings.java 2014-09-24 11:25:40.000000000 +0000 @@ -16,6 +16,8 @@ ******************************************************************************/ package mobac.program.model; +import static mobac.gui.MainGUI.LEFT_PANEL_MIN_SIZE; + import java.awt.Dimension; import java.awt.Point; import java.awt.Toolkit; @@ -99,6 +101,7 @@ public String elementName = null; private String userAgent = null; + private String httpAccept = null; public int downloadThreadCount = 2; public int downloadRetryCount = 1; @@ -185,8 +188,13 @@ public Point position = new Point(-1, -1); public boolean maximized = true; - public boolean leftPanelVisible = true; public boolean rightPanelVisible = true; + public boolean leftPanelVisible = true; + + /** + * Width of the left panel. Default value it taken from MainGUI.LEFT_PANEL_MIN_SIZE + */ + public int leftPanelWidth = LEFT_PANEL_MIN_SIZE; @XmlElementWrapper(name = "collapsedPanels") @XmlElement(name = "collapsedPanel") @@ -355,6 +363,22 @@ this.userAgent = userAgent; } + public String getHttpAccept() { + if (httpAccept != null) + return httpAccept; + else + return "text/html, image/png, image/jpeg, image/gif, */*; q=0.1"; + } + + public void setHttpAccept(String httpAccept) { + if (httpAccept != null) { + httpAccept = httpAccept.trim(); + if (httpAccept.length() == 0) + httpAccept = null; + } + this.httpAccept = httpAccept; + } + public boolean isCustomTileSize() { return customTileProcessing; } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/StartMOBAC.java mobile-atlas-creator-2.1.0/src/main/java/mobac/StartMOBAC.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/StartMOBAC.java 2014-02-06 05:47:56.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/StartMOBAC.java 2014-10-15 11:43:52.000000000 +0000 @@ -19,8 +19,6 @@ import javax.swing.JOptionPane; import javax.swing.UIManager; -import mobac.utilities.I18nUtils; - /** * Main class for starting Mobile Atlas Creator. * @@ -28,6 +26,8 @@ * of the class specified by {@link #MAIN_CLASS}. The class to be instantiated is specified by it's name intentionally * as this allows to compile this class without any further class dependencies. * + * Note: Translation of Strings in this file do not make sense because the settings are not loaded yet. Therefore all + * messages are always shown in the default language. */ public class StartMOBAC { @@ -46,9 +46,9 @@ Class.forName(MAIN_CLASS).newInstance(); } catch (Exception e) { e.printStackTrace(); - JOptionPane.showMessageDialog(null, I18nUtils.localizedStringForKey("msg_environment_unable_to_start") + e.getMessage(), - I18nUtils.localizedStringForKey("Error"), + JOptionPane.showMessageDialog(null, "Unable to start Mobile Atlas Creator: \n" + e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); + System.exit(1); } } @@ -57,7 +57,7 @@ if (System.getProperty("swing.defaultlaf") != null) return; UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - //MainGUI.setDefaultFontOfAllUIComponents(MainGUI.customFont()); + // MainGUI.setDefaultFontOfAllUIComponents(MainGUI.customFont()); } catch (Exception e) { } } @@ -76,13 +76,14 @@ } int version = (major * 1000) + minor; // 1.5 -> 1005; 1.6 -> 1006; 1.7 -> 1007 - if (version < 1006) { + if (version < 1007) { JOptionPane.showMessageDialog(null, - String.format(I18nUtils.localizedStringForKey("msg_environment_jre_bellow"), ver), - I18nUtils.localizedStringForKey("msg_environment_jre_bellow_title"), + "The used Java Runtime Environment does not meet the minimum requirements.\n\n" + + "Mobile Atlas Creator requires at least Java 7 (1.7) or higher.\n" + + "Please update your Java Runtime before starting Mobile Atlas Creator.\n\n" + + "Detected Java Runtime Version: " + ver, "Java Runtime version problem detected", JOptionPane.ERROR_MESSAGE); System.exit(1); } } - } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/utilities/Charsets.java mobile-atlas-creator-2.1.0/src/main/java/mobac/utilities/Charsets.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/utilities/Charsets.java 2014-02-06 05:48:10.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/utilities/Charsets.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) MOBAC developers - * - * 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 2 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 . - ******************************************************************************/ -package mobac.utilities; - -import java.nio.charset.Charset; - -public class Charsets { - - public static final Charset UTF_8 = Charset.forName("UTF-8"); - - public static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1"); - -} diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/utilities/file/DirOrFileExtFilter.java mobile-atlas-creator-2.1.0/src/main/java/mobac/utilities/file/DirOrFileExtFilter.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/utilities/file/DirOrFileExtFilter.java 1970-01-01 00:00:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/utilities/file/DirOrFileExtFilter.java 2014-04-12 11:37:04.000000000 +0000 @@ -0,0 +1,43 @@ +package mobac.utilities.file; + +/******************************************************************************* + * Copyright (c) MOBAC developers + * + * 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 2 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 . + ******************************************************************************/ +import java.io.File; + +/** + * @author Maksym "elmuSSo" Kondej + * + * This filter will pass-through every directory, + * but all files will be filtered by a FileExtFilter. + */ +public class DirOrFileExtFilter extends FileExtFilter { + + public DirOrFileExtFilter(String acceptedFileExt) { + super(acceptedFileExt); + } + + @Override + public boolean accept(File pathname) { + if(pathname.isDirectory()) { + // All directories are accepted + return true; + } else { + // Files are passed to the accept method of FileExtFilter + return super.accept(pathname); + } + } +} \ No newline at end of file diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/utilities/file/FileExtFilter.java mobile-atlas-creator-2.1.0/src/main/java/mobac/utilities/file/FileExtFilter.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/utilities/file/FileExtFilter.java 2014-02-06 05:48:10.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/utilities/file/FileExtFilter.java 2014-04-12 11:37:04.000000000 +0000 @@ -21,7 +21,7 @@ public class FileExtFilter implements FileFilter { - private final String acceptedFileExt; + protected final String acceptedFileExt; public FileExtFilter(String acceptedFileExt) { this.acceptedFileExt = acceptedFileExt; diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/utilities/geo/CoordinateTileFormat.java mobile-atlas-creator-2.1.0/src/main/java/mobac/utilities/geo/CoordinateTileFormat.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/utilities/geo/CoordinateTileFormat.java 2014-02-06 05:48:10.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/utilities/geo/CoordinateTileFormat.java 2014-05-27 11:28:44.000000000 +0000 @@ -21,6 +21,7 @@ import java.text.ParsePosition; import mobac.gui.MainGUI; +import mobac.program.interfaces.MapSource; import mobac.program.interfaces.MapSpace; import org.apache.log4j.Logger; @@ -38,7 +39,10 @@ @Override public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { MainGUI gui = MainGUI.getMainGUI(); - MapSpace mapSpace = gui.getSelectedMapSource().getMapSpace(); + MapSource mapSource = gui.getSelectedMapSource(); + if (mapSource == null) + return toAppendTo; + MapSpace mapSpace = mapSource.getMapSpace(); int zoom = gui.previewMap.getZoom(); int tileNum = 0; if (isLongitude) diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/utilities/GUIExceptionHandler.java mobile-atlas-creator-2.1.0/src/main/java/mobac/utilities/GUIExceptionHandler.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/utilities/GUIExceptionHandler.java 2014-02-06 05:48:10.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/utilities/GUIExceptionHandler.java 2014-08-05 03:29:28.000000000 +0000 @@ -98,18 +98,17 @@ public static void processFatalExceptionSimpleDialog(String dialogMessage, Throwable e) { log.error(dialogMessage + ": " + e.getMessage(), e); - String[] options = { I18nUtils.localizedStringForKey("Exit"), + String[] options = { I18nUtils.localizedStringForKey("Exit"), I18nUtils.localizedStringForKey("dlg_download_show_error_report") }; - int a = JOptionPane.showOptionDialog(null, dialogMessage, - I18nUtils.localizedStringForKey("Error"), 0, JOptionPane.ERROR_MESSAGE, null, options, - options[0]); + int a = JOptionPane.showOptionDialog(null, dialogMessage, I18nUtils.localizedStringForKey("Error"), 0, + JOptionPane.ERROR_MESSAGE, null, options, options[0]); if (a == 1) GUIExceptionHandler.showExceptionDialog(e); System.exit(1); } public static void processException(Thread thread, Throwable t) { - log.error("Uncaught exception: ", t); + log.error("Uncaught exception: " + t, t); showExceptionDialog(thread, t, null); } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/utilities/I18nUtils.java mobile-atlas-creator-2.1.0/src/main/java/mobac/utilities/I18nUtils.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/utilities/I18nUtils.java 2014-02-06 05:48:10.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/utilities/I18nUtils.java 2014-10-15 11:33:50.000000000 +0000 @@ -18,7 +18,6 @@ import java.io.IOException; import java.io.InputStream; -import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import java.util.Locale; @@ -26,8 +25,9 @@ import java.util.ResourceBundle; import java.util.ResourceBundle.Control; -import mobac.Main; +import mobac.StartMOBAC; import mobac.program.model.Settings; +import mobac.utilities.stream.UnicodeReader; public class I18nUtils { @@ -90,8 +90,7 @@ } if (stream != null) { try { - // Only this line is changed to make it to read properties files as UTF-8. - bundle = new PropertyResourceBundle(new InputStreamReader(stream, Charsets.UTF_8)); + bundle = new PropertyResourceBundle(new UnicodeReader(stream, "UTF-8")); } finally { stream.close(); } @@ -106,13 +105,13 @@ String country = s.localeCountry; String language = s.localeLanguage; InputStream in; - in = Main.class.getResourceAsStream(String.format("%s_%s_%s.%s", name, language, country, extension)); + in = StartMOBAC.class.getResourceAsStream(String.format("%s_%s_%s.%s", name, language, country, extension)); if (in != null) return in; - in = Main.class.getResourceAsStream(String.format("%s_%s.%s", name, language, extension)); + in = StartMOBAC.class.getResourceAsStream(String.format("%s_%s.%s", name, language, extension)); if (in != null) return in; - in = Main.class.getResourceAsStream(String.format("%s.%s", name, extension)); + in = StartMOBAC.class.getResourceAsStream(String.format("%s.%s", name, extension)); return in; } } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/utilities/imageio/ImageFormatDetector.java mobile-atlas-creator-2.1.0/src/main/java/mobac/utilities/imageio/ImageFormatDetector.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/utilities/imageio/ImageFormatDetector.java 1970-01-01 00:00:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/utilities/imageio/ImageFormatDetector.java 2017-07-21 13:35:38.000000000 +0000 @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) MOBAC developers + * + * 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 2 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 . + ******************************************************************************/ +package mobac.utilities.imageio; + +import java.io.ByteArrayInputStream; +import java.io.DataInputStream; +import java.io.IOException; + +import org.apache.log4j.Logger; + +public class ImageFormatDetector { + + private static final Logger LOG = Logger.getLogger(ImageFormatDetector.class); + + private static final int MAGIC_JPEG = 0xFFD8FF00; // 3 of 4 bytes + private static final int MAGIC_PNG = 0x89504E47; + + + public enum FormatEnum { + JPEG, PNG, UNKNOWN + } + + public static FormatEnum detectFormat(byte[] data) { + if (data == null || data.length < 4) { + return FormatEnum.UNKNOWN; + } + try (DataInputStream in = new DataInputStream(new ByteArrayInputStream(data))) { + int magic = in.readInt(); + + if (magic == MAGIC_PNG) { + return FormatEnum.PNG; + } + + if ((magic & 0xFFFFFF) == MAGIC_JPEG) { + return FormatEnum.JPEG; + } + + + + } catch (IOException e) { + LOG.error("Failed to detect image format: " + e.getMessage(), e); + return FormatEnum.UNKNOWN; + } + return FormatEnum.UNKNOWN; + } +} diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/utilities/stream/UnicodeReader.java mobile-atlas-creator-2.1.0/src/main/java/mobac/utilities/stream/UnicodeReader.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/utilities/stream/UnicodeReader.java 1970-01-01 00:00:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/utilities/stream/UnicodeReader.java 2014-04-12 11:37:04.000000000 +0000 @@ -0,0 +1,112 @@ +/* Copyright (c) 2008 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package mobac.utilities.stream; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PushbackInputStream; +import java.io.Reader; + +/** + * Generic Unicode text reader, which uses a BOM (Byte Order Mark) to identify + * the encoding to be used. This also has the side effect of removing the BOM + * from the input stream (when present). + * + * @see + * JDK Bug 4508058 + * + * + */ +public class UnicodeReader extends Reader { + + private final InputStreamReader internalInputStreamReader; + private final String defaultEnc; + + private static final int BOM_SIZE = 4; + + /** + * @param in input stream + * @param defaultEnc default encoding (used only if BOM is not found) or + * null to use system default + * @throws IOException if an I/O error occurs + */ + public UnicodeReader(InputStream in, String defaultEnc) throws IOException { + this.defaultEnc = defaultEnc; + + // Read ahead four bytes and check for BOM marks. Extra bytes are unread + // back to the stream; only BOM bytes are skipped. + String encoding; + byte bom[] = new byte[BOM_SIZE]; + int n, unread; + + PushbackInputStream pushbackStream = new PushbackInputStream(in, BOM_SIZE); + n = pushbackStream.read(bom, 0, bom.length); + + if ((bom[0] == (byte) 0xEF) && (bom[1] == (byte) 0xBB) + && (bom[2] == (byte) 0xBF)) { + encoding = "UTF-8"; + unread = n - 3; + } else if ((bom[0] == (byte) 0xFE) && (bom[1] == (byte) 0xFF)) { + encoding = "UTF-16BE"; + unread = n - 2; + } else if ((bom[0] == (byte) 0xFF) && (bom[1] == (byte) 0xFE)) { + encoding = "UTF-16LE"; + unread = n - 2; + } else if ((bom[0] == (byte) 0x00) && (bom[1] == (byte) 0x00) + && (bom[2] == (byte) 0xFE) && (bom[3] == (byte) 0xFF)) { + encoding = "UTF-32BE"; + unread = n - 4; + } else if ((bom[0] == (byte) 0xFF) && (bom[1] == (byte) 0xFE) + && (bom[2] == (byte) 0x00) && (bom[3] == (byte) 0x00)) { + encoding = "UTF-32LE"; + unread = n - 4; + } else { + // Unicode BOM mark not found, unread all bytes + encoding = defaultEnc; + unread = n; + } + if (unread > 0) { + pushbackStream.unread(bom, (n - unread), unread); + } else if (unread < -1) { + pushbackStream.unread(bom, 0, 0); + } + + // Use given encoding + if (encoding == null) { + internalInputStreamReader = new InputStreamReader(pushbackStream); + } else { + internalInputStreamReader = new InputStreamReader(pushbackStream, + encoding); + } + } + + public String getDefaultEncoding() { + return defaultEnc; + } + + public String getEncoding() { + return internalInputStreamReader.getEncoding(); + } + + @Override public void close() throws IOException { + internalInputStreamReader.close(); + } + + @Override public int read(char[] cbuf, int off, int len) throws IOException { + return internalInputStreamReader.read(cbuf, off, len); + } +} \ No newline at end of file diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/utilities/tar/TarHeader.java mobile-atlas-creator-2.1.0/src/main/java/mobac/utilities/tar/TarHeader.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/utilities/tar/TarHeader.java 2014-02-06 05:48:10.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/utilities/tar/TarHeader.java 2014-09-05 12:14:26.000000000 +0000 @@ -83,8 +83,8 @@ String filePath = theFile.getAbsolutePath(); String basePath = theBaseFilePath.getAbsolutePath(); if (!filePath.startsWith(basePath)) - throw new RuntimeException("File \"" + filePath - + "\" is outside of archive base path \"" + basePath + "\"!"); + throw new RuntimeException("File \"" + filePath + "\" is outside of archive base path \"" + basePath + + "\"!"); String tarFileName = filePath.substring(basePath.length(), filePath.length()); @@ -99,15 +99,17 @@ } public void setFileName(String newFileName) { + int newFileNameLength = newFileName.length(); + if (newFileNameLength > fileName.length) + throw new RuntimeException("File name length exceeds limit of 100 characters: " + newFileNameLength + + "chars:" + newFileName); + char[] theFileName = newFileName.toCharArray(); + System.arraycopy(theFileName, 0, fileName, 0, newFileNameLength); + fileNameLength = newFileNameLength; - fileNameLength = newFileName.length(); - for (int i = 0; i < fileName.length; i++) { - if (i < theFileName.length) { - fileName[i] = theFileName[i]; - } else { - fileName[i] = 0; - } + for (int i = newFileNameLength; i < fileName.length; i++) { + fileName[i] = 0; } } @@ -228,21 +230,18 @@ /** *

    * Checksum field content:
    - * Header checksum, stored as an octal number in ASCII. To compute the - * checksum, set the checksum field to all spaces, then sum all bytes in the - * header using unsigned arithmetic. This field should be stored as six - * octal digits followed by a null and a space character. Note that many - * early implementations of tar used signed arithmetic for the checksum - * field, which can cause inter- operability problems when transferring - * archives between systems. Modern robust readers compute the checksum both - * ways and accept the header if either computation matches.
    - * definition source + * Header checksum, stored as an octal number in ASCII. To compute the checksum, set the checksum field to all + * spaces, then sum all bytes in the header using unsigned arithmetic. This field should be stored as six octal + * digits followed by a null and a space character. Note that many early implementations of tar used signed + * arithmetic for the checksum field, which can cause inter- operability problems when transferring archives between + * systems. Modern robust readers compute the checksum both ways and accept the header if either computation + * matches.
    + * definition source *

    * * @param header - * array containing a tar header at offset 0 (512 bytes of size) - * with prepared checksum field (filled with spaces) + * array containing a tar header at offset 0 (512 bytes of size) with prepared checksum field (filled + * with spaces) */ public void correctCheckSum(byte[] header) { // Compute the checksum diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/utilities/Utilities.java mobile-atlas-creator-2.1.0/src/main/java/mobac/utilities/Utilities.java --- mobile-atlas-creator-1.9.16+dfsg1/src/main/java/mobac/utilities/Utilities.java 2014-02-06 05:48:10.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/java/mobac/utilities/Utilities.java 2016-04-24 08:41:00.000000000 +0000 @@ -35,6 +35,7 @@ import java.net.URISyntaxException; import java.net.URL; import java.nio.channels.FileChannel; +import java.nio.charset.StandardCharsets; import java.security.CodeSource; import java.security.ProtectionDomain; import java.sql.SQLException; @@ -43,6 +44,7 @@ import java.text.DecimalFormatSymbols; import java.text.ParseException; import java.text.ParsePosition; +import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Locale; @@ -56,15 +58,16 @@ import javax.swing.ImageIcon; import javax.swing.JComponent; +import org.apache.log4j.Logger; + import mobac.Main; import mobac.exceptions.MOBACOutOfMemoryException; import mobac.program.Logging; import mobac.program.interfaces.MapSource; import mobac.program.model.TileImageType; +import mobac.utilities.file.DirOrFileExtFilter; import mobac.utilities.file.DirectoryFileFilter; -import org.apache.log4j.Logger; - public class Utilities { public static final Color COLOR_TRANSPARENT = new Color(0, 0, 0, 0); @@ -118,6 +121,9 @@ public static BufferedImage safeCreateBufferedImage(int width, int height, int imageType) { try { return new BufferedImage(width, height, imageType); + } catch (NegativeArraySizeException e) { + String message = String.format("Image size is too large: " + "%dx%d pixels", width, height); + throw new RuntimeException(message); } catch (OutOfMemoryError e) { int bytesPerPixel = getBytesPerPixel(imageType); if (bytesPerPixel < 0) @@ -221,7 +227,7 @@ buf = new byte[in.available()]; in.readFully(buf); in.close(); - String text = new String(buf, Charsets.UTF_8); + String text = new String(buf, StandardCharsets.UTF_8); return text; } @@ -732,4 +738,60 @@ return Integer.parseInt(m.group(1)); } + /** + * This method recursively traverse a folder and all its descendants, applying to them a FileExtFilter. + * DirOrFileExtFilter was used, to don't filter out the folders, when traversing them. But in the end, only files + * will be returned + * + * @param dirOrFile + * - file or directory that will be traversed and analyzed + * @param dirOFileExtFilter + * - filter that will pass-through all folders and files only with requested extension + * @return a list of files with requested extension + * + * @author Maksym "elmuSSo" Kondej + */ + public static List traverseFolder(File dirOrFile, DirOrFileExtFilter dirOFileExtFilter) { + ArrayList result = new ArrayList(); + if (dirOrFile.isDirectory()) { + File allFiles[] = dirOrFile.listFiles(dirOFileExtFilter); + for (File innerFile : allFiles) { + result.addAll(traverseFolder(innerFile, dirOFileExtFilter)); + } + } else if (dirOrFile.isFile()) { + // Only files are added to the results list + result.add(dirOrFile); + } + return result; + } + + /** + * Searches for the file specified by the relative fileName in all supplied directories. Returns the + * first existing (isFile() == true) combination of fileName and searchDir or null in case + * no match was found. + * + * In case fileName is an absolute path it will be returned as File in case it exists. + * + * @param fileName + * @param searchDirs + * @return + */ + public static File findFile(String fileName, File... searchDirs) { + File f = new File(fileName); + if (f.isAbsolute()) { + if (f.isFile()) + return f; + else + return null; + } + for (File dir : searchDirs) { + if (dir == null) + continue; // ignore null entries + log.debug("Searching for file \"" + fileName + "\" in directory \"" + dir + "\""); + f = new File(dir, fileName); + if (f.isFile()) + return f; + } + return null; + } } diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/mobac.properties mobile-atlas-creator-2.1.0/src/main/resources/mobac/mobac.properties --- mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/mobac.properties 2014-02-06 05:48:12.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/resources/mobac/mobac.properties 2018-06-23 07:52:02.000000000 +0000 @@ -1,6 +1,6 @@ -mobac.version=1.9.16 -mobac.revision.fallback=$Revision: 2157 $ -mobac.revision.hide=true -mobac.updateurl=http://mobac.sourceforge.net/mapsources-update/v2/mappacks-md5.txt -mobac.updatebaseurl=http://mobac.sourceforge.net/mapsources-update/v2/ +mobac.version=2.1.0 +mobac.revision.fallback=$Revision: 2370 $ +mobac.revision.hide=false +mobac.updateurl=http://mobac.sourceforge.net/mapsources-update/v3/mappacks-md5.txt +mobac.updatebaseurl=http://mobac.sourceforge.net/mapsources-update/v3/ mobac.mappackversion=1 \ No newline at end of file diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/mobac-rev.properties mobile-atlas-creator-2.1.0/src/main/resources/mobac/mobac-rev.properties --- mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/mobac-rev.properties 2014-02-06 05:49:24.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/resources/mobac/mobac-rev.properties 2018-06-23 07:56:02.000000000 +0000 @@ -1,3 +1,3 @@ -#Thu, 06 Feb 2014 13:49:23 +0100 +#Sat, 23 Jun 2018 15:56:01 +0200 -mobac.revision=2157 +mobac.revision=2371\:2381M Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/cert/MapPack.cer and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/cert/MapPack.cer differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/atlas_add.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/atlas_add.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/atlas_convert.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/atlas_convert.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/atlas_create.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/atlas_create.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/icon_debug_ms.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/icon_debug_ms.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/icon_filebased_ms.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/icon_filebased_ms.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/icon_folder_closed.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/icon_folder_closed.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/icon_folder_opened.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/icon_folder_opened.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/icon_http_ms.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/icon_http_ms.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/icon_multilayer_ms.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/icon_multilayer_ms.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/map.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/map.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/menu_icons/menu_bookmark_item.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/menu_icons/menu_bookmark_item.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/menu_icons/menu_bookmarks.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/menu_icons/menu_bookmarks.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/menu_icons/menu_external_tool_item.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/menu_icons/menu_external_tool_item.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/menu_icons/menu_external_tools.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/menu_icons/menu_external_tools.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/menu_icons/menu_gen_sysreport.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/menu_icons/menu_gen_sysreport.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/menu_icons/menu_help.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/menu_icons/menu_help.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/menu_icons/menu_info.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/menu_icons/menu_info.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/menu_icons/menu_licenses.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/menu_icons/menu_licenses.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/menu_icons/menu_log_level.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/menu_icons/menu_log_level.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/menu_icons/menu_manage_bookmarks.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/menu_icons/menu_manage_bookmarks.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/menu_icons/menu_panels_left.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/menu_icons/menu_panels_left.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/menu_icons/menu_panels.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/menu_icons/menu_panels.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/menu_icons/menu_panels_right.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/menu_icons/menu_panels_right.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/menu_icons/menu_readme.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/menu_icons/menu_readme.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/menu_icons/menu_save_view.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/menu_icons/menu_save_view.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/menu_icons/menu_selection_add.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/menu_icons/menu_selection_add.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/menu_icons/menu_selection_circle.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/menu_icons/menu_selection_circle.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/menu_icons/menu_selection_mode.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/menu_icons/menu_selection_mode.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/menu_icons/menu_selection_polygon.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/menu_icons/menu_selection_polygon.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/menu_icons/menu_settings.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/menu_icons/menu_settings.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/menu_icons/menu_show_logfile.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/menu_icons/menu_show_logfile.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/menu_icons/menu_show_mapsources.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/menu_icons/menu_show_mapsources.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/menu_icons/menu_show_tile_borders.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/menu_icons/menu_show_tile_borders.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/menu_icons/menu_tools.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/menu_icons/menu_tools.png differ Binary files /tmp/tmps6DePD/nhMO2hKkhW/mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/images/menu_icons/selections.png and /tmp/tmps6DePD/800uuzZPVH/mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/images/menu_icons/selections.png differ diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/text/cc-attribution-2.5.txt mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/text/cc-attribution-2.5.txt --- mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/text/cc-attribution-2.5.txt 1970-01-01 00:00:00.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/text/cc-attribution-2.5.txt 2014-04-12 11:37:04.000000000 +0000 @@ -0,0 +1,203 @@ +Silk Icons by famfamfam is licensed under a Creative Commons Attribution 2.5 License. +Based on a work at http://www.famfamfam.com/lab/icons/silk/. + +Creative Commons +Attribution 2.5 + +CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. +DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. +CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS +MAKES NO WARRANTIES REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR +DAMAGES RESULTING FROM ITS USE. + +License + +THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS +PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER +APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR +COPYRIGHT LAW IS PROHIBITED. + +BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND +BY THE TERMS OF THIS LICENSE. THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN +CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS. + +1. Definitions + + "Collective Work" means a work, such as a periodical issue, anthology or +encyclopedia, in which the Work in its entirety in unmodified form, along with a +number of other contributions, constituting separate and independent works in +themselves, are assembled into a collective whole. A work that constitutes a +Collective Work will not be considered a Derivative Work (as defined below) for +the purposes of this License. + "Derivative Work" means a work based upon the Work or upon the Work and other +pre-existing works, such as a translation, musical arrangement, dramatization, +fictionalization, motion picture version, sound recording, art reproduction, +abridgment, condensation, or any other form in which the Work may be recast, +transformed, or adapted, except that a work that constitutes a Collective Work +will not be considered a Derivative Work for the purpose of this License. For the +avoidance of doubt, where the Work is a musical composition or sound recording, +the synchronization of the Work in timed-relation with a moving image +("synching") will be considered a Derivative Work for the purpose of this License. + "Licensor" means the individual or entity that offers the Work under the terms of +this License. + "Original Author" means the individual or entity who created the Work. + "Work" means the copyrightable work of authorship offered under the terms of this +License. + "You" means an individual or entity exercising rights under this License who has +not previously violated the terms of this License with respect to the Work, or +who has received express permission from the Licensor to exercise rights under +this License despite a previous violation. + +2. Fair Use Rights. Nothing in this license is intended to reduce, limit, or restrict +any rights arising from fair use, first sale or other limitations on the exclusive +rights of the copyright owner under copyright law or other applicable laws. + +3. License Grant. Subject to the terms and conditions of this License, Licensor +hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the +duration of the applicable copyright) license to exercise the rights in the Work as +stated below: + + to reproduce the Work, to incorporate the Work into one or more Collective Works, +and to reproduce the Work as incorporated in the Collective Works; + to create and reproduce Derivative Works; + to distribute copies or phonorecords of, display publicly, perform publicly, and +perform publicly by means of a digital audio transmission the Work including as +incorporated in Collective Works; + to distribute copies or phonorecords of, display publicly, perform publicly, and +perform publicly by means of a digital audio transmission Derivative Works. + + For the avoidance of doubt, where the work is a musical composition: + Performance Royalties Under Blanket Licenses. Licensor waives the exclusive +right to collect, whether individually or via a performance rights society +(e.g. ASCAP, BMI, SESAC), royalties for the public performance or public +digital performance (e.g. webcast) of the Work. + Mechanical Rights and Statutory Royalties. Licensor waives the exclusive +right to collect, whether individually or via a music rights agency or +designated agent (e.g. Harry Fox Agency), royalties for any phonorecord You +create from the Work ("cover version") and distribute, subject to the +compulsory license created by 17 USC Section 115 of the US Copyright Act (or +the equivalent in other jurisdictions). + Webcasting Rights and Statutory Royalties. For the avoidance of doubt, where the +Work is a sound recording, Licensor waives the exclusive right to collect, +whether individually or via a performance-rights society (e.g. SoundExchange), +royalties for the public digital performance (e.g. webcast) of the Work, subject +to the compulsory license created by 17 USC Section 114 of the US Copyright Act +(or the equivalent in other jurisdictions). + +The above rights may be exercised in all media and formats whether now known or +hereafter devised. The above rights include the right to make such modifications as +are technically necessary to exercise the rights in other media and formats. All +rights not expressly granted by Licensor are hereby reserved. + +4. Restrictions.The license granted in Section 3 above is expressly made subject to +and limited by the following restrictions: + + You may distribute, publicly display, publicly perform, or publicly digitally +perform the Work only under the terms of this License, and You must include a +copy of, or the Uniform Resource Identifier for, this License with every copy or +phonorecord of the Work You distribute, publicly display, publicly perform, or +publicly digitally perform. You may not offer or impose any terms on the Work +that alter or restrict the terms of this License or the recipients' exercise of +the rights granted hereunder. You may not sublicense the Work. You must keep +intact all notices that refer to this License and to the disclaimer of +warranties. You may not distribute, publicly display, publicly perform, or +publicly digitally perform the Work with any technological measures that control +access or use of the Work in a manner inconsistent with the terms of this License +Agreement. The above applies to the Work as incorporated in a Collective Work, +but this does not require the Collective Work apart from the Work itself to be +made subject to the terms of this License. If You create a Collective Work, upon +notice from any Licensor You must, to the extent practicable, remove from the +Collective Work any credit as required by clause 4(b), as requested. If You +create a Derivative Work, upon notice from any Licensor You must, to the extent +practicable, remove from the Derivative Work any credit as required by clause +4(b), as requested. + If you distribute, publicly display, publicly perform, or publicly digitally +perform the Work or any Derivative Works or Collective Works, You must keep +intact all copyright notices for the Work and provide, reasonable to the medium +or means You are utilizing: (i) the name of the Original Author (or pseudonym, if +applicable) if supplied, and/or (ii) if the Original Author and/or Licensor +designate another party or parties (e.g. a sponsor institute, publishing entity, +journal) for attribution in Licensor's copyright notice, terms of service or by +other reasonable means, the name of such party or parties; the title of the Work +if supplied; to the extent reasonably practicable, the Uniform Resource +Identifier, if any, that Licensor specifies to be associated with the Work, +unless such URI does not refer to the copyright notice or licensing information +for the Work; and in the case of a Derivative Work, a credit identifying the use +of the Work in the Derivative Work (e.g., "French translation of the Work by +Original Author," or "Screenplay based on original Work by Original Author"). +Such credit may be implemented in any reasonable manner; provided, however, that +in the case of a Derivative Work or Collective Work, at a minimum such credit +will appear where any other comparable authorship credit appears and in a manner +at least as prominent as such other comparable authorship credit. + +5. Representations, Warranties and Disclaimer + +UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE +WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE +WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, +WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, +NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE +OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW +THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU. + +6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO +EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, +CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE +OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. Termination + + This License and the rights granted hereunder will terminate automatically upon +any breach by You of the terms of this License. Individuals or entities who have +received Derivative Works or Collective Works from You under this License, +however, will not have their licenses terminated provided such individuals or +entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, +and 8 will survive any termination of this License. + Subject to the above terms and conditions, the license granted here is perpetual +(for the duration of the applicable copyright in the Work). Notwithstanding the +above, Licensor reserves the right to release the Work under different license +terms or to stop distributing the Work at any time; provided, however that any +such election will not serve to withdraw this License (or any other license that +has been, or is required to be, granted under the terms of this License), and +this License will continue in full force and effect unless terminated as stated +above. + +8. Miscellaneous + + Each time You distribute or publicly digitally perform the Work or a Collective +Work, the Licensor offers to the recipient a license to the Work on the same +terms and conditions as the license granted to You under this License. + Each time You distribute or publicly digitally perform a Derivative Work, +Licensor offers to the recipient a license to the original Work on the same terms +and conditions as the license granted to You under this License. + If any provision of this License is invalid or unenforceable under applicable +law, it shall not affect the validity or enforceability of the remainder of the +terms of this License, and without further action by the parties to this +agreement, such provision shall be reformed to the minimum extent necessary to +make such provision valid and enforceable. + No term or provision of this License shall be deemed waived and no breach +consented to unless such waiver or consent shall be in writing and signed by the +party to be charged with such waiver or consent. + This License constitutes the entire agreement between the parties with respect to +the Work licensed here. There are no understandings, agreements or +representations with respect to the Work not specified here. Licensor shall not +be bound by any additional provisions that may appear in any communication from +You. This License may not be modified without the mutual written agreement of the +Licensor and You. + +Creative Commons is not a party to this License, and makes no warranty whatsoever in +connection with the Work. Creative Commons will not be liable to You or any party on +any legal theory for any damages whatsoever, including without limitation any +general, special, incidental or consequential damages arising in connection to this +license. Notwithstanding the foregoing two (2) sentences, if Creative Commons has +expressly identified itself as the Licensor hereunder, it shall have all rights and +obligations of Licensor. + +Except for the limited purpose of indicating to the public that the Work is licensed +under the CCPL, neither party will use the trademark "Creative Commons" or any +related trademark or logo of Creative Commons without the prior written consent of +Creative Commons. Any permitted use will be in compliance with Creative Commons' +then-current trademark usage guidelines, as may be published on its website or +otherwise made available upon request from time to time. + +Creative Commons may be contacted at http://creativecommons.org/. diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/text/localize_fr_FR.properties mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/text/localize_fr_FR.properties --- mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/text/localize_fr_FR.properties 2014-02-06 05:48:12.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/text/localize_fr_FR.properties 2014-09-09 11:50:38.000000000 +0000 @@ -1,4 +1,4 @@ -#---------- Version ------------------------- +#---------- Version ------------------------- mobac_version_subfix=International Edition mobac_version_subfix_dev= #---------- Basic ------------------------- @@ -61,7 +61,7 @@ lp_coords_invalid_text=Coordonnée invalide !
    Tapez un nombre entre %s et %s #map source lp_map_source_title=Source de carte -lp_map_source_combo_tips=Sélectionne une source de carte +lp_map_source_tree_tips=Sélectionne une source de carte #zoom level lp_zoom_title=Niveaux de zoom lp_zoom_total_tile_count_tips=Nombre total de dalles à télécharger @@ -152,8 +152,6 @@ #main button lp_mian_create_btn_title=Créer l'atlas lp_main_create_btn_tips=Crée l'atlas -lp_main_setting_button_title=Configuration -lp_main_setting_button_tips=Ouvre la boîte de dialogue des préférences #tile store coverage lp_tile_store_title=Zones disponibles hors connexion lp_tile_store_title_tips=Affiche les zones de la source de carte actuellement sélectionnée qui ont été
    \ @@ -201,14 +199,14 @@ menu_atlas_new=Nouvel atlas menu_atlas_convert_format=Changer le format de l'atlas menu_atlas_create=Créer un atlas -#Maps +#Selection menu_maps=Cartes -menu_maps_selection=Mode de sélection -menu_maps_selection_rect=Rectangulaire -menu_maps_selection_polygon=Polygonal -menu_maps_selection_circle=Circulaire -menu_maps_selection_add=Ajouter la sélection -menu_maps_selection_add_by_gpx=Sélectionner avec une trace GPX +menu_selection_selection=Mode de sélection +menu_selection_selection_rect=Rectangulaire +menu_selection_selection_polygon=Polygonal +menu_selection_selection_circle=Circulaire +menu_selection_selection_add=Ajouter la sélection +menu_selection_selection_add_by_gpx=Sélectionner avec une trace GPX #Bookmark menu_bookmark=Favoris menu_bookmark_save=Enregistrer la vue actuelle @@ -225,6 +223,10 @@ menu_debug_show_log_file=Afficher le journal de bord menu_debug_log_level=Niveau d'enregistrement du journal de bord menu_debug_system_report=Créer un rapport système +#tools +menu_tools=Tools +menu_tools_settings=Configuration +menu_tools_settings_tips=Ouvre la boîte de dialogue des préférences #help menu_help=Aide menu_help_readme=Afficher les notes @@ -232,7 +234,7 @@ menu_help_licenses=Licences menu_help_about=À propos #tools -menu_tool=Outils +menu_external_tools=Outils #---------- Dialog ------------------------- #About @@ -263,7 +265,6 @@ dlg_new_atlas_select_format_title=Choisissez le format de l'atlas #Working Progress dlg_progress_title=Progression -dlg_progress_about_btn=À propos dlg_progress_count=Nombre : 0 dlg_progress_count_i=Nombre : %d #Select GPX Track @@ -536,7 +537,7 @@ msg_add_gpx_polygon_too_many_track=Le fichier GPX sélectionné contient plus d'un trace.\nVeuillez sélectionner une trace ou un segment de trace. msg_add_gpx_polygon_too_many_segment=La trace sélectionnée contient plus d'un segment de trace.\nVeuillez sélectionner un segment de trace. msg_add_gpx_polygon_no_select=Aucun segment de trace n'a été sélectionné. -x=Maximum map size violated +msg_add_gpx_polygon_maxsize_title=Taille maximale de la carte violé msg_add_gpx_polygon_maxsize=Au moins une carte dépasse la taille maximale autorisée.\n\ Le découpage automatique d'une carte polygonale en morceaux plus petits n'est pas encore implémenté.\n\nVoulez-vous continuer tout de même ? #Convert Atlas @@ -612,11 +613,11 @@ Vérifiez que vous avez bien décompacté l'archive ZIP\n\ de MOBAC, y compris tous les sous-dossiers ! msg_environment_unable_to_start=Impossible de lancer Mobile Atlas Creator : \n -msg_environment_jre_bellow=L'environnement d'exécution Java ne possède pas les caractéristiques minimales requises.\n\ -Mobile Atlas Creator nécessite Java 6 (1.6) ou plus récent.\n\ +msg_environment_jre_below=L'environnement d'exécution Java ne possède pas les caractéristiques minimales requises.\n\ +Mobile Atlas Creator nécessite Java 7 (1.7) ou plus récent.\n\ Veuillez mettre à jour votre environnement d'exécution Java avant de lancer Mobile Atlas Creator.\n\n\ Version de l'environnement Java : %@ -msg_environment_jre_bellow_title=Problème de version de l'environnement Java +msg_environment_jre_below_title=Problème de version de l'environnement Java msg_environment_invalid_source_folder=Le dossier demandé n'existe pas :\nMap name: %s\ \nDossier source : %s msg_environment_invalid_source_folder_zoom=Aucun dossier de niveau de zoom n'a été trouvé :\nNom de la carte : %s\ diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/text/localize_ja_JP.properties mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/text/localize_ja_JP.properties --- mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/text/localize_ja_JP.properties 2014-02-06 05:48:12.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/text/localize_ja_JP.properties 2014-09-09 11:50:38.000000000 +0000 @@ -1,4 +1,4 @@ -#---------- Version ------------------------- +#---------- Version ------------------------- mobac_version_subfix=多言語版 mobac_version_subfix_dev= #---------- Basic ------------------------- @@ -41,6 +41,8 @@ map_ctrl_wgs_grid_density_seconds=″ map_ctrl_wgs_grid_density_second=″ map_loading_wait=お待ちください - マップデータの読み込み中... +map_viewer_zoom_tooltip=ズームレベル +map_viewer_zoom_to_tooltip=ズームレベルの変更 #---------- Left Panel ------------------------- #coordinate @@ -61,7 +63,16 @@ lp_coords_invalid_text=無効な座標値です!
    %s と %s の間の数値を入力してください #map source lp_map_source_title=地図データの取得元 -lp_map_source_combo_tips=地図データの取得元を選択します +lp_map_source_tree_tips=地図データの取得元を選択します +lp_map_source_layer_single=単一レイヤ +lp_map_source_layer_multi=複数レイヤ +lp_map_source_layer_file_based=ローカルファイル +lp_map_source_layer_web_based=ウェブ +lp_map_source_tooltip_layer_name=名称 +lp_map_source_tooltip_inernal_name=内部名称 +lp_map_source_tooltip_type=タイプ +lp_map_source_tooltip_loaded_from=読み込み元 +lp_map_source_tooltip_file_name=ファイル名 #zoom level lp_zoom_title=ズームレベル lp_zoom_total_tile_count_tips=ダウンロードされるタイルの総数 @@ -72,11 +83,8 @@ #Tile parameters settings lp_tile_param_title=レイヤ設定 (タイル処理設定) lp_tile_param_recreate_checkbox_title=タイルのサイズ変更とファイル形式変換 -lp_tile_param_recreate_checkbox_tips=\ -有効化するとタイルのサイズ変更とファイル形式変換を実行します。
    \ -作成する地図(アトラス)全体に同じ条件のタイル処理を適用したり、
    \ -レイヤやマップ毎に別条件のタイル処理を適用することもできます。
    \ -なお、この処理には CPU パワーが必要なので時間が掛かります。 +lp_tile_param_recreate_checkbox_tips=有効化するとタイルのサイズ変更とファイル形式変換を実行します。
    作成する地図(アトラス)全体に同じ条件のタイル処理を適用したり、
    \ +レイヤやマップ毎に別条件のタイル処理を適用することもできます。
    なお、この処理には CPU パワーが必要なので時間が掛かります。 lp_tile_param_width_title=幅 : lp_tile_param_width_tips=タイルの幅 lp_tile_param_height_title=高さ : @@ -130,10 +138,10 @@ lp_atlas_info_tile_format_origin=タイル形式 : 256x256 (タイル処理なし)
    #atlas content node pop menu lp_atlas_pop_menu_show_detail=詳細表示 -lp_atlas_pop_menu_display_select_area=エリアを地図上に表示 -lp_atlas_pop_menu_select_map_box=エリアを選択 -lp_atlas_pop_menu_zoom_to_map_box=エリアをズーム表示 -lp_atlas_pop_menu_zoom_to=ズーム表示 +lp_atlas_pop_menu_display_select_area=エリアのハイライト表示 +lp_atlas_pop_menu_select_map_box=エリアを矩形選択 +lp_atlas_pop_menu_zoom_to_map_box=エリアにズーム +lp_atlas_pop_menu_zoom_to=エリア全体にズーム lp_atlas_pop_menu_rename=名称変更 lp_atlas_pop_menu_apply_tile_process=タイル処理の適用 lp_atlas_pop_menu_clear_atals=地図(アトラス)の消去 @@ -155,16 +163,12 @@ #main button lp_mian_create_btn_title=地図(アトラス)の構築処理の実行 lp_main_create_btn_tips=地図データの取得元からタイルをダウンロードして
    \地図(アトラス)の構築処理を実行します -lp_main_setting_button_title=設定 -lp_main_setting_button_tips=設定画面を開きます #tile store coverage lp_tile_store_title=タイル取得済みエリアの表示 -lp_tile_store_title_tips=\ -選択した地図データの取得元について、
    \ +lp_tile_store_title_tips=選択した地図データの取得元について、
    \ タイルを既に取得したエリアを表示します lp_tile_store_show_coverage_btn_title=表示 -lp_tile_store_show_coverage_btn_tips=\ -タイルを既に取得したエリアを表示します。
    \ +lp_tile_store_show_coverage_btn_tips=タイルを既に取得したエリアを表示します。
    \ 緑色のエリアはタイル取得済みで、
    \ 灰色のエリアはタイル未取得です。 lp_tile_store_hide_coverage_btn_title=非表示 @@ -197,7 +201,7 @@ rp_gpx_unname_wpt_name=ポイント rp_gpx_msg_confirm_reopen_file=一つ以上の GPX ファイルが既に読み込まれています。\nこれらのファイルを新たに読み込みますか? rp_gpx_msg_error_save_gpx_file=GPX ファイルの保存エラーが発生しました -rp_gpx_msg_no_select_file=Gpx ファイルが選択されていません +rp_gpx_msg_no_select_file=GPX ファイルが選択されていません rp_gpx_node_seg_name=トラック %s #---------- Main Menu ------------------------- @@ -206,14 +210,15 @@ menu_atlas_new=地図(アトラス)の新規作成 menu_atlas_convert_format=地図形式の変更 menu_atlas_create=地図(アトラス)の構築処理の実行 -#Maps -menu_maps=タイル選択 -menu_maps_selection=選択モード -menu_maps_selection_rect=矩形選択 -menu_maps_selection_polygon=ポリゴン選択 -menu_maps_selection_circle=円形選択 -menu_maps_selection_add=選択範囲を地図に追加 -menu_maps_selection_add_by_gpx=GPX に基づいて地図に追加 +#Selection +menu_selection=選択 +menu_selection_selection=選択モード +menu_selection_selection_rect=矩形選択 +menu_selection_selection_polygon=ポリゴン選択 +menu_selection_selection_circle=円形選択 +menu_selection_selection_add=選択範囲を地図に追加 +menu_selection_selection_add_around_gpx=GPX に沿って地図に追加 +menu_selection_selection_add_by_gpx=GPX で囲んで地図に追加 #Bookmark menu_bookmark=ブックマーク menu_bookmark_save=地図の表示状態のブックマーク @@ -221,23 +226,30 @@ #Panels menu_panels=パネル menu_show_hide_left_panel=左パネルの表示/非表示 -menu_show_hide_gpx_panel=右パネルの表示/非表示 +menu_show_hide_gpx_panel=GPX パネルの表示/非表示 +menu_show_expand_left_panel=拡張 +menu_show_shrink_left_panel=縮小 #Debug -menu_debug=Debug +menu_debug=デバッグ menu_debug_show_hide_tile_border=タイルの境界線の表示/非表示 menu_debug_show_all_map_source=地図データの取得元のリスト表示 menu_debug_refresh_map_source=地図データの取得元の再読み込み menu_debug_show_log_file=ログファイルの表示 menu_debug_log_level=ログレベルの変更 menu_debug_system_report=システムレポートの作成 +#tools +menu_tools=ツール +menu_tools_settings=設定 +menu_tools_settings_tips=設定画面を開きます +menu_tools_leftpanel=左パネル #help menu_help=ヘルプ menu_help_readme=Readme の表示 menu_help_how_to_preview=キーボードとマウスによる操作 menu_help_licenses=ライセンス menu_help_about=このソフトウェアについて -#tools -menu_tool=ツール +#external tools +menu_external_tools=外部ツール #---------- Dialog ------------------------- #About @@ -268,12 +280,12 @@ dlg_new_atlas_select_format_title=地図形式を選択してください #Working Progress dlg_progress_title=進捗状況 -dlg_progress_about_btn=アバウト dlg_progress_count=カウント : 0 dlg_progress_count_i=カウント : %d #Select GPX Track dlg_gpx_track_select_title=幅の設定 -dlg_gpx_track_select_distance=トラックに沿って選択するエリアの幅 : %d %s +dlg_gpx_track_select_distance=トラックに沿って選択する範囲の幅 : %d %s +dlg_gpx_track_select_preview=選択範囲のプレビュー #Add GPS point dlg_gpx_inpu_point_name=ポイントの名称を入力してください : #Show All Map Source @@ -287,7 +299,7 @@ dlg_select_dir_description=フォルダ #Atlas download progress dlg_download_title=地図(アトラス)の作成中... -dlg_download_zoom_level_progress=タイル取得 : ズームレベル +dlg_download_zoom_level_progress=タイル取得 : ズームレベル dlg_download_map_progress=マップ処理 dlg_download_atlas_progress=%d%% 実行中 - 名称 "%s", 地図形式 "%s" の処理中 dlg_download_done_percent=%d%% @@ -302,11 +314,11 @@ dlg_download_tile_done_count_default=1000000 of 1000000 tiles done dlg_download_tile_done_count=%d / %d タイル dlg_download_map_create_title=地図(アトラス)の構築 -dlg_download_avg_speed=平均 DL 速度 +dlg_download_avg_speed=平均ダウンロード速度 dlg_download_avg_speed_value=: %s / 秒 dlg_download_total_bytes=ダウンロード -dlg_download_bytes_from_cache=保管タイルの読込 -dlg_download_thread_count=DL スレッド数 +dlg_download_bytes_from_cache=取得済みタイルの読込 +dlg_download_thread_count=スレッド数 dlg_download_retry_count=一時的エラー dlg_download_retry_count_value=: 処理中: %d, 全体: %d dlg_download_failed_count=修復不能エラー @@ -338,7 +350,7 @@ dlg_download_succeed_window_title=

    地図(アトラス)の作成に成功しました

    dlg_download_errors_todo=ダウンロードエラーが多数発生しました - 続行しますか? dlg_download_errors_todo_msg=複数のタイルのダウンロードに失敗しました。\ -サーバーへの接続またはエリアの選択に問題があると思われます。\ +サーバーへの接続または選択エリアに問題があると思われます。\
    どうしますか? :

    \ エラーを無視してダウンロードを 続行 する。(タイルに空白部分が生じます)
    \ ダウンロードを 再試行 する。?
    \ @@ -346,7 +358,8 @@ 地図(アトラス)の構築処理を 中断 する。
    dlg_download_errors_missing_tile=エラー - タイルがありません - とにかく続行しますか? dlg_download_errors_missing_tile_msg=タイルのダウンロードに問題があります。\n\ -タイルのダウンロード数が試算したほど多くありません。\nしたがって、構築した地図(アトラス)ではタイルの不足があると思われます。\n タイルの不足数は %d です。\n\n\ +タイルのダウンロード数が試算したほど多くありません。\n\ +したがって、構築した地図(アトラス)ではタイルの不足があると思われます。\nタイルの不足数は %d です。\n\n\ とにかく続行して地図(アトラス)を構築しますか? dlg_download_show_error_report=エラーレポートの表示 dlg_download_erro_head=エラーが発生しました : @@ -407,7 +420,8 @@ タイルには、ときにサーバーで指定されている
    有効期限があります。\ もしサーバーで有効期限が指定されていない場合はデフォルトの有効期限が適用されます。

    set_tile_update_default_expiration=デフォルトの有効期限 -set_tile_update_default_expiration_desc=デフォルトの有効期限は、タイルの有効期限が地図データの取得元で指定されていない場合に適用されます。 +set_tile_update_default_expiration_desc=デフォルトの有効期限は、\ +タイルの有効期限が地図データの取得元で指定されていない場合に適用されます。 set_tile_update_max_expiration=最長有効期限 set_tile_update_min_expiration=最短有効期限 #Tile Store @@ -467,7 +481,7 @@ set_paper_size=サイズ set_paper_size_default=デフォルト set_paper_size_default_tips=ページサイズを規定値から選択します -set_paper_size_default_format_tips=ページサイズを選択します +set_paper_size_default_combo_tips=ページサイズを選択します set_paper_size_default_landscape=ランドスケープ set_paper_size_default_landscape_tips=用紙方向をランドスケープ(横置き)にします set_paper_size_custom=カスタム @@ -499,14 +513,20 @@ #Paper Atlas - Advanced set_paper_advanced=詳細設定 set_paper_advanced_compression=圧縮レベル -set_paper_advanced_compression_tips=PDF ファイルに使用する圧縮レベルを指定します。
    圧縮レベル 0 は無圧縮で、圧縮レベルの数値が大きいほど高圧縮となり、
    圧縮レベル 9 が最高値です。デフォルトの圧縮レベルは 6 です。 +set_paper_advanced_compression_tips=PDF ファイルに使用する圧縮レベルを指定します。
    \ +圧縮レベル 0 は無圧縮で、圧縮レベルの数値が大きいほど高圧縮となり、
    \ +圧縮レベル 9 が最高値です。デフォルトの圧縮レベルは 6 です。 set_paper_advanced_dpi=解像度 -set_paper_advanced_dpi_tips=画像の解像度(DPI)を指定します。
    一般的に数値が大きいほど高品質になりますが、
    グリッドや距離目盛り等が小さく表示されます。
    デフォルトの解像度は 96 DPI で、
    120 DPI の指定でより高品質になります。 +set_paper_advanced_dpi_tips=\ +画像の解像度(DPI)を指定します。
    \ +一般的に数値が大きいほど高品質になりますが、
    \ +グリッドや距離目盛り等が小さく表示されます。
    \ +デフォルトの解像度は 96 DPI で、
    \ +120 DPI の指定でより高品質になります。 set_paper_advanced_overlap=のりしろ set_paper_advanced_overlap_tips=隣接ページとの重ね合わせ部分(のりしろ)のサイスを指定します set_paper_advanced_crop=クロップ -set_paper_advanced_crop_tips=\ -クロップ率を指定します。地図の周辺部が表示されるページにおいて、
    \ +set_paper_advanced_crop_tips=クロップ率を指定します。地図の周辺部が表示されるページにおいて、
    \ ページ面積に対する地図の表示面積がクロップ割合より小さい場合、
    \ このページを地図の構築処理に使用しないようにします。 #Paper Atlas - Actions @@ -535,7 +555,7 @@ msg_add_gpx_polygon_too_many_track=選択された GPX ファイルには複数のトラックが含まれています。\n必要なトラックまたはトラックセグメントを選択してください。 msg_add_gpx_polygon_too_many_segment=選択されたトラックには複数のトラックセグメントが含まれています。\n必要なトラックセグメントを選択してください。 msg_add_gpx_polygon_no_select=GPX トラックが選択されていません -x=最大マップサイズを超えています +msg_add_gpx_polygon_maxsize_title=最大マップサイズの超過 msg_add_gpx_polygon_maxsize=少なくとも一つのマップが最大サイズを超えています。\n\ ポリゴンマップを小さく分割する機能はまだサポートされていません。\n\n構わずに続行しますか? #Convert Atlas @@ -565,7 +585,8 @@ msg_out_of_memory_detail=\nMOBAC に割り当てられたメモリの最大値は %d MB です msg_atlas_download_abort=地図(アトラス)のダウンロードを中断しました msg_too_many_tiles_title=ダウンロードの差し止め -msg_too_many_tiles_msg=膨大な量のタイルがダウンロードされることを Mobile Atlas Creator が検知しました。\n\ +msg_too_many_tiles_msg=膨大な量のタイルがダウンロードされることを \ +Mobile Atlas Creator が検知しました。\n\ 高いズームレベルでの選択エリアを削減してから再試行してください。\n\ 地図(アトラス)に許容されるタイル数の最大値は %d です。\n\ 現在の地図(アトラス)に含まれるタイル数 : %d @@ -584,7 +605,7 @@ 他のアプリケーションによる変更点はすべて失われます! msg_settings_file_can_not_parse=settings.xml ファイルを読み込むことができません。プログラムを終了します。 #Others -msg_atlas_is_empty=地図(アトラス)に選択範囲が追加されていません。 - 少なくとも一つの選択範囲を地図(アトラス)に追加してください +msg_atlas_is_empty=地図(アトラス)の中身がありません。 - 少なくとも一つの選択範囲を地図(アトラス)に追加してください msg_environment_not_support_title=サポート外の環境 msg_environment_not_support=この環境はサポートされていません。
    デスクトップ : %s
    オペレーティングシステム : %s msg_environment_failed_open_output_title=出力フォルダのオープンエラー @@ -592,7 +613,8 @@ msg_environment_use_commond=
    使用コマンド : %s
    msg_environment_commond_param=パラメーター : %d : %s msg_environment_lack_memory_title=警告 : メモリ不足 -msg_environment_lack_memory=警告 : メモリの割り当てが非常に少ない状態で Mobile Atlas Creator が起動されました。
    \ +msg_environment_lack_memory=警告 : メモリの割り当てが\ +非常に少ない状態で Mobile Atlas Creator が起動されました。
    \ 現在 Mobile Atlas Creator が使用できるメモリの最大値は %s です。

    \ 今後 Mobile Atlas Creator を起動する際は、\ Windows では Mobile Atlas Creator.exe から起動するか、
    \ @@ -604,15 +626,16 @@ msg_environment_error_write_file=%s に書き込むことができません。\n %s \n フォルダ\n ファイルのパーミッションを修正してから MOBAC を再度起動してください。 msg_environment_error_create_setting=settings.xml ファイルを作成できませんでした。- プログラムを終了します。 msg_environment_error_init_mapsrc_dir=mapsources フォルダの初期化でエラーが発生しました :\n -msg_environment_error_load_cloudmade=CloudMade のカスタムマップソースを読み込むことができません。openstreetmap のマップソースバンドルが利用可能であることを確認してください。 +msg_environment_error_duplicate_map_source=エラー : 地図データの取得元の名称が重複しています : %s\nファイル : %s\nこれらの地図データは読み込まれません。名称を変更してください。 msg_environment_mapsrc_dir_not_exist=mapsources フォルダが存在しません。 - フォルダパス :\n %s \n\ -MOBAC の zip ファイルがサブフォルダを含めて適切に展開されていることを確認してください! +MOBAC の zip ファイルがサブフォルダを含めて\ +適切に展開されていることを確認してください! msg_environment_unable_to_start=Mobile Atlas Creator を起動できません : \n -msg_environment_jre_bellow=使用中の Java Runtime Environment は最小限の要求を満たしていません。\n\ -Mobile Atlas Creator は少なくとも Java 6 (1.6) またはそれ以上を必要とします。\n\ +msg_environment_jre_below=使用中の Java Runtime Environment は最小限の要求を満たしていません。\n\ +Mobile Atlas Creator は少なくとも Java 7 (1.7) またはそれ以上を必要とします。\n\ Mobile Atlas Creator を起動する前に Java Runtime を更新してください。\n\n\ 検出された Java Runtime のバージョン : %@ -msg_environment_jre_bellow_title=Java Runtime バージョンの問題検出 +msg_environment_jre_below_title=Java Runtime バージョンの問題検出 msg_environment_invalid_source_folder=指定された mapsources フォルダが存在しません :\n地図の名称 : %s\ \nmapources フォルダ: %s msg_environment_invalid_source_folder_zoom=ズームフォルダが見つかりません :\n地図の名称 : %s\ @@ -620,6 +643,8 @@ msg_environment_invalid_source_folder_title=不正な mapsources フォルダ msg_tools_exec_command_ask=実行されるコマンド :
    %s msg_tools_exec_command_ask_title=コマンドの実行 +msg_tools_exec_error_selected_area=選択範囲が必要です。 +msg_map_source_initialization_failed=地図データの取得元(%s)の初期化に失敗しました。\n内部エラーメッセージ : %s msg_custom_map_invalid_source_file_title=不正なソースファイル msg_custom_map_invalid_source_file=データベースファイルが指定されていません。\n地図の名称 : %s \nファイル名 : %s msg_custom_map_invalid_source_zip_title=不正なソース zip ファイル diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/text/localize.properties mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/text/localize.properties --- mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/text/localize.properties 2014-02-06 05:48:12.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/text/localize.properties 2016-04-14 11:47:38.000000000 +0000 @@ -41,6 +41,8 @@ map_ctrl_wgs_grid_density_seconds=Second map_ctrl_wgs_grid_density_second=Seconds map_loading_wait=Please wait - loading map data +map_viewer_zoom_tooltip=Zoom level +map_viewer_zoom_to_tooltip=Zoom to level #---------- Left Panel ------------------------- #coordinate @@ -61,7 +63,16 @@ lp_coords_invalid_text=Invalid coordinate!
    Please enter a number between %s and %s #map source lp_map_source_title=Map Source -lp_map_source_combo_tips=Select map source +lp_map_source_tree_tips=Select map source +lp_map_source_layer_single=single-layer +lp_map_source_layer_multi=multi-layer +lp_map_source_layer_file_based=local file-based +lp_map_source_layer_web_based=web-based +lp_map_source_tooltip_layer_name=Name +lp_map_source_tooltip_inernal_name=Internal Name +lp_map_source_tooltip_type=Type +lp_map_source_tooltip_loaded_from=Loaded from +lp_map_source_tooltip_file_name=Filename #zoom level lp_zoom_title=Zoom Levels lp_zoom_total_tile_count_tips=Total amount of tiles to download @@ -152,8 +163,6 @@ #main button lp_mian_create_btn_title=Create Atlas lp_main_create_btn_tips=Create the atlas -lp_main_setting_button_title=Settings -lp_main_setting_button_tips=Open the preferences dialogue panel #tile store coverage lp_tile_store_title=Map source tile store coverage lp_tile_store_title_tips=Displays the regions for the currently selected map source that has been
    \ @@ -201,15 +210,15 @@ menu_atlas_new=New Atlas menu_atlas_convert_format=Convert Atlas Format menu_atlas_create=Create Atlas -#Maps -menu_maps=Maps -menu_maps_selection=Selection Mode -menu_maps_selection_rect=Rectangle -menu_maps_selection_polygon=Polygon -menu_maps_selection_circle=Circle -menu_maps_selection_add=Add selection -menu_maps_selection_add_around_gpx=Add selection around GPX track -menu_maps_selection_add_by_gpx=Add selection by GPX track +#Selection +menu_selection=Selection +menu_selection_selection=Selection Mode +menu_selection_selection_rect=Rectangle +menu_selection_selection_polygon=Polygon +menu_selection_selection_circle=Circle +menu_selection_selection_add=Add selection +menu_selection_selection_add_around_gpx=Add selection around GPX track +menu_selection_selection_add_by_gpx=Add selection by GPX track #Bookmark menu_bookmark=Bookmarks menu_bookmark_save=Save current view @@ -226,14 +235,18 @@ menu_debug_show_log_file=Show log file menu_debug_log_level=General log level menu_debug_system_report=Generate system report +#tools +menu_tools=Tools +menu_tools_settings=Settings +menu_tools_settings_tips=Open the preferences dialogue panel #help menu_help=Help menu_help_readme=Show Readme menu_help_how_to_preview=How to use preview map menu_help_licenses=Licenses menu_help_about=About -#tools -menu_tool=Tools +#external tools +menu_external_tools=External tools #---------- Dialog ------------------------- #About @@ -264,7 +277,6 @@ dlg_new_atlas_select_format_title=Please select the desired atlas format #Working Progress dlg_progress_title=Progress -dlg_progress_about_btn=About dlg_progress_count=Count: 0 dlg_progress_count_i=Count: %d #Select GPX Track @@ -540,7 +552,7 @@ msg_add_gpx_polygon_too_many_track=The select gpx file contains more than one track.\nPlease select the desired track or track segment. msg_add_gpx_polygon_too_many_segment=The select track contains more than one track segment.\nPlease select the desired track segment. msg_add_gpx_polygon_no_select=No GPX track segment selected -x=Maximum map size violated +msg_add_gpx_polygon_maxsize_title=Maximum map size violated msg_add_gpx_polygon_maxsize=At least one map that has been added violates the maximum map size.\n\ Splitting a polygonal map into smaller pieces is not yet supported.\n\nDo you want to proceed anyway? #Convert Atlas @@ -611,16 +623,10 @@ msg_environment_error_write_file=Unable to write to %s \n %s \n directory\n Please correct file permissions and restart MOBAC. msg_environment_error_create_setting=Could not create file settings.xml - program will exit. msg_environment_error_init_mapsrc_dir=Error on initializing map sources directory:\n -msg_environment_error_load_cloudmade=Unable to load custom CloudMade map source. Please make sure the openstreetmap map source bundle is available. +msg_environment_error_duplicate_map_source=Error: Duplicate map source name found: %s\nin file: %s\nIt will not be loaded. Please change its name manually. msg_environment_mapsrc_dir_not_exist=Map sources directory does not exist - path:\n %s \n\ Please make sure you extracted the release zip file\n\ of MOBAC correctly including all subdirectories! -msg_environment_unable_to_start=Unable to start Mobile Atlas Creator: \n -msg_environment_jre_bellow=The used Java Runtime Environment does not meet the minimum requirements.\n\ -Mobile Atlas Creator requires at least Java 6 (1.6) or higher.\n\ -Please update your Java Runtime before starting Mobile Atlas Creator.\n\n\ -Detected Java Runtime Version: %@ -msg_environment_jre_bellow_title=Java Runtime version problem detected msg_environment_invalid_source_folder=The specified source folder does not exist:\nMap name: %s\ \nSource folder: %s msg_environment_invalid_source_folder_zoom=No zoom directories found:\nMap name: %s\ @@ -629,6 +635,7 @@ msg_tools_exec_command_ask=Command to be executed:
    %s msg_tools_exec_command_ask_title=Do you want to execute the command? msg_tools_exec_error_selected_area=This tool requires an selected area. +msg_map_source_initialization_failed=Initialization of map source %s failed.\nInternal error message: %s msg_custom_map_invalid_source_file_title=Invalid source file msg_custom_map_invalid_source_file=No database file specified.\nMap name: %s \nFilename: %s msg_custom_map_invalid_source_zip_title=Invalid source zip diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/text/localize_zh_CN.properties mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/text/localize_zh_CN.properties --- mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/text/localize_zh_CN.properties 2014-02-06 05:48:12.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/text/localize_zh_CN.properties 2014-09-09 11:50:38.000000000 +0000 @@ -1,4 +1,4 @@ -#---------- Version ------------------------- +#---------- Version ------------------------- mobac_version_subfix=多语言版 mobac_version_subfix_dev= #---------- Basic ------------------------- @@ -61,7 +61,7 @@ lp_coords_invalid_text=无效坐标!
    请输入 %s 到 %s 之间的数字 #map source lp_map_source_title=地图源 -lp_map_source_combo_tips=选择地图源 +lp_map_source_tree_tips=选择地图源 #zoom level lp_zoom_title=缩放比例 lp_zoom_total_tile_count_tips=图片块总数 @@ -152,8 +152,6 @@ #main button lp_mian_create_btn_title=开始下载地图册 lp_main_create_btn_tips=开始下载地图册 -lp_main_setting_button_title=设置 -lp_main_setting_button_tips=打开偏好设置对话框 #tile store coverage lp_tile_store_title=本地缓存 lp_tile_store_title_tips=显示当前地图源的已下载(缓存)区域
    \ @@ -202,14 +200,14 @@ menu_atlas_new=新建地图册 menu_atlas_convert_format=转换地图册类型 menu_atlas_create=开始下载地图册 -#Maps +#Selection menu_maps=地图 -menu_maps_selection=选择区域按 -menu_maps_selection_rect=矩形 -menu_maps_selection_polygon=多边形 -menu_maps_selection_circle=圆 -menu_maps_selection_add=添加选择的区域 -menu_maps_selection_add_by_gpx=添加GPX沿线区域 +menu_selection_selection=选择区域按 +menu_selection_selection_rect=矩形 +menu_selection_selection_polygon=多边形 +menu_selection_selection_circle=圆 +menu_selection_selection_add=添加选择的区域 +menu_selection_selection_add_by_gpx=添加GPX沿线区域 #Bookmark menu_bookmark=书签 menu_bookmark_save=保存当前显示区域 @@ -226,14 +224,18 @@ menu_debug_show_log_file=查看日志文件 menu_debug_log_level=日志级别 menu_debug_system_report=查看系统信息 +#tools +menu_tools=Tools +menu_tools_settings=设置 +menu_tools_settings_tips=打开偏好设置对话� #help menu_help=帮助 menu_help_readme=帮助文档 menu_help_how_to_preview=如何查看地图 menu_help_licenses=版权声明与许可证 menu_help_about=关于 -#tools -menu_tool=工具 +#external tools +menu_external_tools=工具 #---------- Dialog ------------------------- #About @@ -264,7 +266,6 @@ dlg_new_atlas_select_format_title=请选择地图册类型 #Working Progress dlg_progress_title=完成 -dlg_progress_about_btn=关于 dlg_progress_count=已完成: 0 dlg_progress_count_i=已完成: %d #Select GPX Track @@ -617,11 +618,11 @@ 请确保您在解压缩MOBAC的zip包时,\n\ 包含了所有的子文件夹. msg_environment_unable_to_start=无法启动Mobile Atlas Creator: \n -msg_environment_jre_bellow=您电脑上安装的Java环境(Java Runtime Environment)版本过低.\n\ -Mobile Atlas Creator 需要至少Java 6 (1.6) 或更高版本.\n\ +msg_environment_jre_below=您电脑上安装的Java环境(Java Runtime Environment)版本过低.\n\ +Mobile Atlas Creator 需要至少Java 6 (1.7) 或更高版本.\n\ 请升级您的Java运行时环境,再重启Mobile Atlas Creator.\n\n\ 当前检测到的 Java 版本为: %@ -msg_environment_jre_bellow_title=Java运行环境不兼容 +msg_environment_jre_below_title=Java运行环境不兼容 msg_environment_invalid_source_folder=指定的地图源文件夹不存在:\n地图名: %s\ \n地图源目录: %s msg_environment_invalid_source_folder_zoom=无法找到指定缩放等级的目录:\n地图名: %s\ diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/text/localize_zh_TW.properties mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/text/localize_zh_TW.properties --- mobile-atlas-creator-1.9.16+dfsg1/src/main/resources/mobac/resources/text/localize_zh_TW.properties 2014-02-06 05:48:12.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/main/resources/mobac/resources/text/localize_zh_TW.properties 2014-09-09 11:50:38.000000000 +0000 @@ -1,4 +1,4 @@ -#---------- Version ------------------------- +#---------- Version ------------------------- mobac_version_subfix=多語言版 mobac_version_subfix_dev= #---------- Basic ------------------------- @@ -61,7 +61,7 @@ lp_coords_invalid_text=無效坐標!
    請輸入 %s 到 %s 之間的數字 #map source lp_map_source_title=地圖源 -lp_map_source_combo_tips=選擇地圖源 +lp_map_source_tree_tips=選擇地圖源 #zoom level lp_zoom_title=縮放比例 lp_zoom_total_tile_count_tips=圖片塊總數 @@ -152,8 +152,6 @@ #main button lp_mian_create_btn_title=開始下載地圖冊 lp_main_create_btn_tips=開始下載地圖冊 -lp_main_setting_button_title=設置 -lp_main_setting_button_tips=打開偏好設置對話框 #tile store coverage lp_tile_store_title=本地緩存 lp_tile_store_title_tips=顯示當前地圖源的已下載(緩存)區域
    \ @@ -202,14 +200,14 @@ menu_atlas_new=新建地圖冊 menu_atlas_convert_format=轉換地圖冊類型 menu_atlas_create=開始下載地圖冊 -#Maps +#Selection menu_maps=地圖 -menu_maps_selection=選擇區域按 -menu_maps_selection_rect=矩形 -menu_maps_selection_polygon=多邊形 -menu_maps_selection_circle=圓 -menu_maps_selection_add=添加選擇的區域 -menu_maps_selection_add_by_gpx=添加GPX沿線區域 +menu_selection_selection=選擇區域按 +menu_selection_selection_rect=矩形 +menu_selection_selection_polygon=多邊形 +menu_selection_selection_circle=圓 +menu_selection_selection_add=添加選擇的區域 +menu_selection_selection_add_by_gpx=添加GPX沿線區域 #Bookmark menu_bookmark=書簽 menu_bookmark_save=保存當前顯示區域 @@ -226,14 +224,18 @@ menu_debug_show_log_file=查看日誌檔案 menu_debug_log_level=日誌級別 menu_debug_system_report=查看系統信息 +#tools +menu_tools=Tools +menu_tools_settings=設置 +menu_tools_settings_tips=打開偏好設置對話� #help menu_help=幫助 menu_help_readme=幫助文檔 menu_help_how_to_preview=如何查看地圖 menu_help_licenses=版權聲明與許可證 menu_help_about=關於 -#tools -menu_tool=工具 +#external tools +menu_external_tools=工具 #---------- Dialog ------------------------- #About @@ -264,7 +266,6 @@ dlg_new_atlas_select_format_title=請選擇地圖冊類型 #Working Progress dlg_progress_title=完成 -dlg_progress_about_btn=關於 dlg_progress_count=已完成: 0 dlg_progress_count_i=已完成: %d #Select GPX Track @@ -617,11 +618,11 @@ 請確保您在解壓縮MOBAC的zip包時,\n\ 包含了所有的子檔案夾. msg_environment_unable_to_start=無法啟動Mobile Atlas Creator: \n -msg_environment_jre_bellow=您電腦上安裝的Java環境(Java Runtime Environment)版本過低.\n\ -Mobile Atlas Creator 需要至少Java 6 (1.6) 或更高版本.\n\ +msg_environment_jre_below=您電腦上安裝的Java環境(Java Runtime Environment)版本過低.\n\ +Mobile Atlas Creator 需要至少Java 7 (1.7) 或更高版本.\n\ 請升級您的Java運行時環境,再重啟Mobile Atlas Creator.\n\n\ 當前檢測到的 Java 版本為: %@ -msg_environment_jre_bellow_title=Java運行環境不兼容 +msg_environment_jre_below_title=Java運行環境不兼容 msg_environment_invalid_source_folder=指定的地圖源檔案夾不存在:\n地圖名: %s\ \n地圖源檔案夾: %s msg_environment_invalid_source_folder_zoom=無法找到指定縮放等級的檔案夾:\n地圖名: %s\ diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/test/java/mapsources/MapSourceTestCase.java mobile-atlas-creator-2.1.0/src/test/java/mapsources/MapSourceTestCase.java --- mobile-atlas-creator-1.9.16+dfsg1/src/test/java/mapsources/MapSourceTestCase.java 2014-02-06 05:47:54.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/test/java/mapsources/MapSourceTestCase.java 2014-09-24 11:25:40.000000000 +0000 @@ -69,8 +69,9 @@ HttpURLConnection c = mapSource.getTileUrlConnection(zoom, tilex, tiley); c.setReadTimeout(10000); - c.addRequestProperty("User-agent", Settings.getInstance().getUserAgent()); - c.setRequestProperty("Accept", TileDownLoader.ACCEPT); + Settings settings = Settings.getInstance(); + c.addRequestProperty("User-agent", settings.getUserAgent()); + c.setRequestProperty("Accept", settings.getHttpAccept()); c.connect(); try { diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/test/java/mobac/tools/MapSourceCapabilityDetector.java mobile-atlas-creator-2.1.0/src/test/java/mobac/tools/MapSourceCapabilityDetector.java --- mobile-atlas-creator-1.9.16+dfsg1/src/test/java/mobac/tools/MapSourceCapabilityDetector.java 2014-02-06 05:47:54.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/test/java/mobac/tools/MapSourceCapabilityDetector.java 2014-09-24 11:25:40.000000000 +0000 @@ -36,7 +36,6 @@ import mobac.mapsources.mappacks.region_oceania.NzTopoMaps; import mobac.program.Logging; import mobac.program.ProgramInfo; -import mobac.program.download.TileDownLoader; import mobac.program.interfaces.HttpMapSource; import mobac.program.interfaces.MapSource; import mobac.program.interfaces.MapSpace; @@ -158,7 +157,7 @@ log.trace("Connecting..."); c.setReadTimeout(3000); c.setRequestProperty("User-agent", ProgramInfo.getUserAgent()); - c.setRequestProperty("Accept", TileDownLoader.ACCEPT); + c.setRequestProperty("Accept", Settings.getInstance().getHttpAccept()); c.connect(); log.debug("Connection established - response HTTP " + c.getResponseCode()); if (c.getResponseCode() != 200) diff -Nru mobile-atlas-creator-1.9.16+dfsg1/src/test/java/unittests/methods/UtilitiesTests.java mobile-atlas-creator-2.1.0/src/test/java/unittests/methods/UtilitiesTests.java --- mobile-atlas-creator-1.9.16+dfsg1/src/test/java/unittests/methods/UtilitiesTests.java 2014-02-06 05:47:56.000000000 +0000 +++ mobile-atlas-creator-2.1.0/src/test/java/unittests/methods/UtilitiesTests.java 2014-09-05 12:14:26.000000000 +0000 @@ -16,9 +16,13 @@ ******************************************************************************/ package unittests.methods; +import java.io.StringWriter; +import java.lang.reflect.Field; + import junit.framework.TestCase; import junit.textui.TestRunner; import mobac.utilities.Utilities; +import mobac.utilities.tar.TarHeader; public class UtilitiesTests extends TestCase { @@ -32,6 +36,46 @@ assertEquals(-1, Utilities.parseSVNRevision("exported")); } + public void testTarHeader() throws Exception { + + final String str1 = "Test123"; + final String str2 = "abcdefghijklmnopqrstuvwxyz"; + final String str3 = "1234567890"; + StringWriter sw = new StringWriter(110); + for (int i = 0; i < 100; i++) + sw.write('x'); + String str4 = sw.toString(); + + for (int i = 0; i < 101; i++) + sw.write('y'); + String str5 = sw.toString(); + + TarHeader tarHeader = new TarHeader(str1, 12345, false); + assertEquals(str1, tarHeader.getFileName()); + + tarHeader.setFileName(str2); + assertEquals(str2, tarHeader.getFileName()); + + tarHeader.setFileName(str3); + assertEquals(str3, tarHeader.getFileName()); + + tarHeader.setFileName(str4); // max length filename + assertEquals(str4, tarHeader.getFileName()); + + try { + tarHeader.setFileName(str5); + fail("Exception expected"); + } catch (Exception e) { + + } + + Field f = TarHeader.class.getDeclaredField("fileName"); + f.setAccessible(true); + char[] chars = (char[]) f.get(tarHeader); + for (char c : chars) + System.out.print(c == 0 ? " 0" : c); + } + public static void main(String[] args) { TestRunner.run(UtilitiesTests.class); }