This commit is contained in:
parent
72697b9ba3
commit
dfa586ac2b
|
@ -0,0 +1,4 @@
|
|||
increased tile limit to 1 million
|
||||
added the default open street map server
|
||||
included sqlite driver by default
|
||||
removed some broken mapsources
|
251
LICENSE
251
LICENSE
|
@ -1,251 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 1, February 1989
|
||||
|
||||
Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor,
|
||||
Boston, MA 02110-1301 USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The license agreements of most software companies try to keep users at the
|
||||
mercy of those companies. By contrast, our General Public License is intended
|
||||
to guarantee your freedom to share and change free software--to make sure
|
||||
the software is free for all its users. The General Public License applies
|
||||
to the Free Software Foundation's software and to any other program whose
|
||||
authors commit to using it. You can use it for your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Specifically,
|
||||
the General Public License is designed to make sure that you have the freedom
|
||||
to give away or sell copies of free software, that you receive source code
|
||||
or can get it if you want it, that you can change the software or use pieces
|
||||
of it in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid anyone to
|
||||
deny you these rights or to ask you to surrender the rights. These restrictions
|
||||
translate to certain responsibilities for you if you distribute copies of
|
||||
the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of a such a program, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that you have. You
|
||||
must make sure that they, too, receive or can get the source code. And you
|
||||
must tell them their rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and (2)
|
||||
offer you this license which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain that
|
||||
everyone understands that there is no warranty for this free software. If
|
||||
the software is modified by someone else and passed on, we want its recipients
|
||||
to know that what they have is not the original, so that any problems introduced
|
||||
by others will not reflect on the original authors' reputations.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification
|
||||
follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION
|
||||
AND MODIFICATION
|
||||
|
||||
|
||||
|
||||
0. This License Agreement applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed under
|
||||
the terms of this General Public License. The "Program", below, refers to
|
||||
any such program or work, and a "work based on the Program" means either the
|
||||
Program or any work containing the Program or a portion of it, either verbatim
|
||||
or with modifications. Each licensee is addressed as "you".
|
||||
|
||||
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's source code
|
||||
as you receive it, in any medium, provided that you conspicuously and appropriately
|
||||
publish on each copy an appropriate copyright notice and disclaimer of warranty;
|
||||
keep intact all the notices that refer to this General Public License and
|
||||
to the absence of any warranty; and give any other recipients of the Program
|
||||
a copy of this General Public License along with the Program. You may charge
|
||||
a fee for the physical act of transferring a copy.
|
||||
|
||||
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion of it,
|
||||
and copy and distribute such modifications under the terms of Paragraph 1
|
||||
above, provided that you also do the following:
|
||||
|
||||
a) cause the modified files to carry prominent notices stating that you changed
|
||||
the files and the date of any change; and
|
||||
|
||||
b) cause the whole of any work that you distribute or publish, that in whole
|
||||
or in part contains the Program or any part thereof, either with or without
|
||||
modifications, to be licensed at no charge to all third parties under the
|
||||
terms of this General Public License (except that you may choose to grant
|
||||
warranty protection to some or all third parties, at your option).
|
||||
|
||||
c) If the modified program normally reads commands interactively when run,
|
||||
you must cause it, when started running for such interactive use in the simplest
|
||||
and most usual way, to print or display an announcement including an appropriate
|
||||
copyright notice and a notice that there is no warranty (or else, saying that
|
||||
you provide a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this General
|
||||
Public License.
|
||||
|
||||
d) You may charge a fee for the physical act of transferring a copy, and you
|
||||
may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
Mere aggregation of another independent work with the Program (or its derivative)
|
||||
on a volume of a storage or distribution medium does not bring the other work
|
||||
under the scope of these terms.
|
||||
|
||||
|
||||
|
||||
3. You may copy and distribute the Program (or a portion or derivative of
|
||||
it, under Paragraph 2) in object code or executable form under the terms of
|
||||
Paragraphs 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) accompany it with the complete corresponding machine-readable source code,
|
||||
which must be distributed under the terms of Paragraphs 1 and 2 above; or,
|
||||
|
||||
b) accompany it with a written offer, valid for at least three years, to give
|
||||
any third party free (except for a nominal charge for the cost of distribution)
|
||||
a complete machine-readable copy of the corresponding source code, to be distributed
|
||||
under the terms of Paragraphs 1 and 2 above; or,
|
||||
|
||||
c) accompany it with the information you received as to where the corresponding
|
||||
source code may be obtained. (This alternative is allowed only for noncommercial
|
||||
distribution and only if you received the program in object code or executable
|
||||
form alone.)
|
||||
|
||||
Source code for a work means the preferred form of the work for making modifications
|
||||
to it. For an executable file, complete source code means all the source code
|
||||
for all modules it contains; but, as a special exception, it need not include
|
||||
source code for modules which are standard libraries that accompany the operating
|
||||
system on which the executable file runs, or for standard header files or
|
||||
definitions files that accompany that operating system.
|
||||
|
||||
|
||||
|
||||
4. You may not copy, modify, sublicense, distribute or transfer the Program
|
||||
except as expressly provided under this General Public License. Any attempt
|
||||
otherwise to copy, modify, sublicense, distribute or transfer the Program
|
||||
is void, and will automatically terminate your rights to use the Program under
|
||||
this License. However, parties who have received copies, or rights to use
|
||||
copies, from you under this General Public License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
|
||||
|
||||
5. By copying, distributing or modifying the Program (or any work based on
|
||||
the Program) you indicate your acceptance of this license to do so, and all
|
||||
its terms and conditions.
|
||||
|
||||
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the Program),
|
||||
the recipient automatically receives a license from the original licensor
|
||||
to copy, distribute or modify the Program subject to these terms and conditions.
|
||||
You may not impose any further restrictions on the recipients' exercise of
|
||||
the rights granted herein.
|
||||
|
||||
|
||||
|
||||
7. The Free Software Foundation may publish revised and/or new versions of
|
||||
the General Public License from time to time. Such new versions will be similar
|
||||
in spirit to the present version, but may differ in detail to address new
|
||||
problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program specifies
|
||||
a version number of the license which applies to it and "any later version",
|
||||
you have the option of following the terms and conditions either of that version
|
||||
or of any later version published by the Free Software Foundation. If the
|
||||
Program does not specify a version number of the license, you may choose any
|
||||
version ever published by the Free Software Foundation.
|
||||
|
||||
|
||||
|
||||
8. If you wish to incorporate parts of the Program into other free programs
|
||||
whose distribution conditions are different, write to the author to ask for
|
||||
permission. For software which is copyrighted by the Free Software Foundation,
|
||||
write to the Free Software Foundation; we sometimes make exceptions for this.
|
||||
Our decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing and reuse
|
||||
of software generally.
|
||||
|
||||
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
|
||||
THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
|
||||
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM
|
||||
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
|
||||
OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
|
||||
|
||||
10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
|
||||
OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
|
||||
OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES
|
||||
OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH
|
||||
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest possible
|
||||
use to humanity, the best way to achieve this is to make it free software
|
||||
which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach
|
||||
them to the start of each source file to most effectively convey the exclusion
|
||||
of warranty; and each file should have at least the "copyright" line and a
|
||||
pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.> Copyright
|
||||
(C) 19yy <name of author>
|
||||
|
||||
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 1, 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, write to the Free Software Foundation, Inc., 675 Mass
|
||||
Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this when
|
||||
it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes
|
||||
with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software,
|
||||
and you are welcome to redistribute it under certain conditions; type `show
|
||||
c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may be
|
||||
called something other than `show w' and `show c'; they could even be mouse-clicks
|
||||
or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary. Here
|
||||
a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision'
|
||||
(a program to direct compilers to make passes at assemblers) written by James
|
||||
Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989 Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
Binary file not shown.
|
@ -0,0 +1,374 @@
|
|||
<project default="all"
|
||||
name="Compile and build java classes plus jar archives">
|
||||
|
||||
<property file="src/main/resources/mobac/mobac.properties" />
|
||||
|
||||
<property name="rev.prop.file" value="src/main/resources/mobac/mobac-rev.properties" />
|
||||
<property name="jar.name" value="Mobile_Atlas_Creator.jar" />
|
||||
<property name="zip.name" value="Mobile Atlas Creator ${mobac.version}.zip" />
|
||||
<property name="zip_src.name" value="Mobile Atlas Creator ${mobac.version} src.zip" />
|
||||
<property name="main.class" value="mobac.StartMOBAC" />
|
||||
|
||||
<property name="rtlibraryjar.non_osx" value="${java.home}/lib/rt.jar" />
|
||||
<property name="rtlibraryjar.osx" value="${java.home}/../Classes/classes.jar" />
|
||||
<available property="rtlibraryjar.osx.present" file="${rtlibraryjar.osx}" />
|
||||
|
||||
<tstamp>
|
||||
<format property="build.date" pattern="yyyy-MM-dd HH:mm:ss" />
|
||||
</tstamp>
|
||||
|
||||
<property name="je-version" value="3.3.93" />
|
||||
<property name="sqlite-version" value="3.34.0" />
|
||||
|
||||
<!-- Java target version -->
|
||||
<property name="java-target" value="1.6" />
|
||||
|
||||
<path id="maincp">
|
||||
<fileset dir="lib" includes="log*.jar" />
|
||||
<fileset dir="lib" includes="jai*.jar" />
|
||||
<fileset dir="lib" includes="bsh-2.0b4.jar" />
|
||||
<fileset dir="lib" includes="Tidy.jar" />
|
||||
<fileset dir="lib" includes="javapng-2.0.jar" />
|
||||
<fileset dir="lib" includes="itextpdf-5.1.0.jar" />
|
||||
<fileset dir="lib" includes="commons-codec-1.4.jar" />
|
||||
<fileset dir="lib" includes="commons-io-2.0.jar" />
|
||||
<fileset dir="lib" includes="commons-lang3-3.1.jar" />
|
||||
<fileset dir="lib" includes="je-${je-version}.jar" />
|
||||
</path>
|
||||
|
||||
<target name="all"
|
||||
depends="clean_build,svnversion,build,build_mapsources,sign_mapsources,create_jar,shrink,create_release,create_release_src" />
|
||||
|
||||
<target name="update_mapsources" depends="build_mapsources,sign_mapsources" />
|
||||
|
||||
<target name="clean_workspace"
|
||||
description="Deletes the work directories ozi, atlases, atlasestared">
|
||||
<delete includeemptydirs="true" failonerror="false">
|
||||
<fileset dir="atlases" includes="**/*" />
|
||||
<fileset dir="build" includes="**/*" />
|
||||
<fileset dir="tilestore" includes="**/*" />
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<target name="clean_build">
|
||||
<delete includeEmptyDirs="true" failonerror="false">
|
||||
<fileset dir="build" includes="**/*" />
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<target name="delete_build" description="Deleted the entire build folder">
|
||||
<delete failonerror="yes" dir="build" />
|
||||
</target>
|
||||
|
||||
<target name="build">
|
||||
<mkdir dir="build/mobac" />
|
||||
<!-- Compile the starter class for Java 1.5 (shows an verbose -->
|
||||
<!-- error if the JRE requirements are not met -->
|
||||
<javac srcdir="src/main/java" destdir="build/mobac" target="1.5"
|
||||
source="1.5" debug="true" includeantruntime="false" encoding="UTF-8">
|
||||
<classpath refid="maincp" />
|
||||
<include name="mobac/StartMOBAC.java" />
|
||||
</javac>
|
||||
<!-- Compile the other classes for Java 1.6 -->
|
||||
<javac srcdir="src/main/java" destdir="build/mobac" target="${java-target}"
|
||||
source="${java-target}" debug="true" includeantruntime="false"
|
||||
encoding="UTF-8">
|
||||
<classpath refid="maincp" />
|
||||
<exclude name="mobac/StartMOBAC.java" />
|
||||
<exclude name="mobac/mapsources/mappacks/**" />
|
||||
<include name="mobac/**" />
|
||||
</javac>
|
||||
<copy todir="build/mobac" overwrite="true">
|
||||
<fileset dir="src/main/resources" excludes="**/mapsources.properties" />
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="build_mapsources" depends="clean_build,build,svnversion"
|
||||
description="Build all map packs and generate the new mappacks-md5.txt">
|
||||
<property name="mappack.srcbasedir" value="src/main/java/mobac/mapsources/mappacks" />
|
||||
<property file="keys/keystore.properties" />
|
||||
<taskdef name="for" classname="net.sf.antcontrib.logic.ForTask">
|
||||
<classpath>
|
||||
<pathelement location="lib/ant-contrib-for.jar" />
|
||||
</classpath>
|
||||
</taskdef>
|
||||
<delete dir="mapsources" includes="mp-*.jar" />
|
||||
<dirset id="mappacks" dir="${mappack.srcbasedir}/" includes="*" />
|
||||
<pathconvert pathsep=";" property="mappacklist" refid="mappacks">
|
||||
<mapper type="flatten" />
|
||||
</pathconvert>
|
||||
<mkdir dir="mapsources" />
|
||||
<echo file="mapsources/mappacks-md5.txt" append="false" message="" />
|
||||
<for list="${mappacklist}" param="mappack" delimiter=";">
|
||||
<sequential>
|
||||
<echo message="@{mappack}" />
|
||||
<mkdir dir="build/mp-@{mappack}" />
|
||||
<uptodate property="@{mappack}.newer" targetfile="mapsources/mp-@{mappack}.jar">
|
||||
<srcfiles dir="src/main/java/mobac/mapsources/mappacks/@{mappack}" />
|
||||
</uptodate>
|
||||
<echo message="No changes in map pack detected: @{mappack}" />
|
||||
<javac srcdir="src/main/java" destdir="build/mp-@{mappack}"
|
||||
defaultexcludes="true" debug="true" target="${java-target}" source="${java-target}"
|
||||
includeantruntime="false" encoding="UTF-8">
|
||||
<include name="mobac/mapsources/mappacks/@{mappack}/**.java" />
|
||||
<classpath>
|
||||
<path refid="maincp" />
|
||||
<path path="build/mobac" />
|
||||
</classpath>
|
||||
</javac>
|
||||
<delete file="mapsources/mp-@{mappack}.jar" failonerror="false" />
|
||||
<fileset dir="build/mp-@{mappack}" defaultexcludes="true"
|
||||
id="fileset-@{mappack}">
|
||||
<include name="mobac/mapsources/mappacks/@{mappack}/**.class" />
|
||||
</fileset>
|
||||
|
||||
<jar destfile="mapsources/mp-@{mappack}.jar">
|
||||
<manifest>
|
||||
<attribute name="MapPackVersion" value="${mobac.mappackversion}" />
|
||||
<attribute name="MapPackName" value="@{mappack}" />
|
||||
<attribute name="MapPackBuild-Date" value="${build.date}" />
|
||||
<attribute name="MapPackRevision" value="${mobac.revision.new}" />
|
||||
</manifest>
|
||||
<fileset refid="fileset-@{mappack}" />
|
||||
<zipfileset dir="${mappack.srcbasedir}/@{mappack}/"
|
||||
includes="mapsources.list" fullpath="META-INF/services/mobac.program.interfaces.MapSource" />
|
||||
</jar>
|
||||
<checksum algorithm="MD5" totalproperty="MD5-@{mappack}">
|
||||
<fileset refid="fileset-@{mappack}" />
|
||||
</checksum>
|
||||
<echo file="mapsources/mappacks-md5.txt" append="true"
|
||||
message="${MD5-@{mappack}} mp-@{mappack}.jar " />
|
||||
</sequential>
|
||||
</for>
|
||||
</target>
|
||||
|
||||
<target name="check_keystore"
|
||||
description="Checks if the key store for signing the map packs is present">
|
||||
<available file="keys/keystore.jks" property="keystore.present" />
|
||||
</target>
|
||||
|
||||
<!-- This task is only executed if a java key store is present in the keys
|
||||
directory -->
|
||||
<target name="sign_mapsources" depends="build_mapsources,check_keystore"
|
||||
if="keystore.present">
|
||||
<!-- The required key stores are not available in SVN and releases! -->
|
||||
<echo message="Signing map packs using password: ${keystore.password}" />
|
||||
<for list="${mappacklist}" param="mappack" delimiter=";">
|
||||
<sequential>
|
||||
<signjar keystore="keys/keystore.jks" storepass="${keystore.password}"
|
||||
alias="MapPack" jar="mapsources/mp-@{mappack}.jar" verbose="false" />
|
||||
</sequential>
|
||||
</for>
|
||||
</target>
|
||||
|
||||
<target name="create_jar">
|
||||
<delete file="${jar.name}" />
|
||||
<jar destfile="${jar.name}" filesetmanifest="mergewithoutmain">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="${main.class}" />
|
||||
<attribute name="Class-Path"
|
||||
value="./ sqlite-jdbc-${sqlite-version}.jar sqlite.jar jai_core.jar jai_codec.jar lib/jai_core.jar lib/jai_codec.jar jai_*.jar lib/jai_*.jar" />
|
||||
</manifest>
|
||||
<zipfileset src="lib/log4j-1.2.15.jar" includes="org/apache/log4j/**" />
|
||||
<zipfileset src="lib/je-${je-version}.jar" />
|
||||
<zipfileset src="lib/bsh-2.0b4.jar" includes="**/*.class" />
|
||||
<zipfileset src="lib/commons-codec-1.4.jar" includes="**/*.class" />
|
||||
<zipfileset src="lib/commons-io-2.0.jar" includes="**/*.class" />
|
||||
<zipfileset src="lib/commons-lang3-3.1.jar" includes="**/*.class" />
|
||||
<zipfileset src="lib/javapng-2.0.jar" includes="**/*.class" />
|
||||
<zipfileset src="lib/Tidy.jar" includes="org/w3c/tidy/**" />
|
||||
<zipfileset src="lib/itextpdf-5.1.0.jar" includes="com/**" />
|
||||
<fileset dir="build/mobac">
|
||||
<exclude name="**/unittest/**" />
|
||||
<exclude name="mobac/mapsources/mapapcks/**" />
|
||||
<exclude name="**/*.java" />
|
||||
</fileset>
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
<target name="shrink_libraryjars" unless="rtlibraryjar.osx.present">
|
||||
<property name="rtlibraryjar" value="${rtlibraryjar.non_osx}" />
|
||||
</target>
|
||||
|
||||
<target name="shrink_libraryjars_osx" if="rtlibraryjar.osx.present">
|
||||
<property name="rtlibraryjar" value="${rtlibraryjar.osx}" />
|
||||
</target>
|
||||
|
||||
<target name="shrink"
|
||||
depends="create_jar,shrink_libraryjars,shrink_libraryjars_osx"
|
||||
description="Removes unused classes from compiled jar">
|
||||
<taskdef resource="proguard/ant/task.properties" classpath="lib/proguard-ant-7.0.0.jar:lib/proguard-base-7.0.0.jar:lib/proguard-core-7.0.0.jar" />
|
||||
<proguard>
|
||||
-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
|
||||
</proguard>
|
||||
<move file="build/temp.jar" tofile="${jar.name}" overwrite="true" />
|
||||
</target>
|
||||
|
||||
<target name="svnversion"
|
||||
description="Updates the revision information in src/mobac/mobac.properties"
|
||||
depends="svnversion_svn">
|
||||
</target>
|
||||
|
||||
<target name="svnversion_svn">
|
||||
<delete file="${rev.prop.file}" />
|
||||
<exec executable="svnversion" outputproperty="mobac.revision.new"
|
||||
searchpath="true" failifexecutionfails="false" />
|
||||
<property name="mobac.revision.new" value="exported" />
|
||||
<condition property="mobac.revision.exported">
|
||||
<equals arg1="${mobac.revision.new}" arg2="exported" />
|
||||
</condition>
|
||||
<echo message="MOBAC revision: ${mobac.revision.new}" />
|
||||
<antcall target="svnversion_write_property_file" />
|
||||
</target>
|
||||
|
||||
<target name="svnversion_write_property_file" unless="mobac.revision.exported">
|
||||
<propertyfile file="${rev.prop.file}">
|
||||
<entry key="mobac.revision" value="${mobac.revision.new}" />
|
||||
</propertyfile>
|
||||
</target>
|
||||
|
||||
<target name="create_release"
|
||||
description="Packs all necessary files for the binary release into one zip archive">
|
||||
<zip destfile="${zip.name}" update="false">
|
||||
<fileset dir="./">
|
||||
<include name="${jar.name}" />
|
||||
<include name="gpl.txt" />
|
||||
<include name="start.jar" />
|
||||
<include name="README.HTM" />
|
||||
<include name="ReleaseNotes.txt" />
|
||||
<include name="CHANGELOG.txt" />
|
||||
<include name="start.*" />
|
||||
<include name="Mobile Atlas Creator.exe" />
|
||||
<include name="mapsources/mp-*.jar" />
|
||||
</fileset>
|
||||
<fileset dir="./misc">
|
||||
<include name="mobac.icns" />
|
||||
</fileset>
|
||||
<fileset dir="lib" includes="sqlite-jdbc-${sqlite-version}.jar" />
|
||||
</zip>
|
||||
</target>
|
||||
|
||||
<target name="create_release_src"
|
||||
description="Packs all necessary files for the source code release into one zip archive">
|
||||
<zip destfile="${zip_src.name}" update="false">
|
||||
<fileset dir="./">
|
||||
<include name="src/**" />
|
||||
<exclude name="src/mobac/tools/**" />
|
||||
<include name="log4j.xml" />
|
||||
<include name="build.xml" />
|
||||
<include name="gpl.txt" />
|
||||
<include name="start.jar" />
|
||||
<include name="README.HTM" />
|
||||
<include name="README-DEV.HTM" />
|
||||
<include name="CHANGELOG.txt" />
|
||||
<include name="start.sh" />
|
||||
<include name=".classpath" />
|
||||
<include name=".project" />
|
||||
<include name="Mobile Atlas Creator.exe" />
|
||||
<include name="misc/launch4j.xml" />
|
||||
<include name="misc/mobac.ico" />
|
||||
<include name="lib/*.jar" />
|
||||
</fileset>
|
||||
</zip>
|
||||
</target>
|
||||
</project>
|
|
@ -0,0 +1,339 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
|
@ -0,0 +1,35 @@
|
|||
<launch4jConfig>
|
||||
<dontWrapJar>true</dontWrapJar>
|
||||
<headerType>gui</headerType>
|
||||
<jar>Mobile_Atlas_Creator.jar</jar>
|
||||
<outfile>..\Mobile Atlas Creator.exe</outfile>
|
||||
<errTitle></errTitle>
|
||||
<cmdLine></cmdLine>
|
||||
<chdir></chdir>
|
||||
<priority>normal</priority>
|
||||
<downloadUrl>http://java.com/download</downloadUrl>
|
||||
<supportUrl></supportUrl>
|
||||
<customProcName>false</customProcName>
|
||||
<stayAlive>false</stayAlive>
|
||||
<manifest></manifest>
|
||||
<icon>mobac.ico</icon>
|
||||
<jre>
|
||||
<path></path>
|
||||
<minVersion>1.6.0_14</minVersion>
|
||||
<maxVersion></maxVersion>
|
||||
<jdkPreference>preferJre</jdkPreference>
|
||||
<maxHeapSize>1024</maxHeapSize>
|
||||
</jre>
|
||||
<versionInfo>
|
||||
<fileVersion>1.0.0.0</fileVersion>
|
||||
<txtFileVersion>-</txtFileVersion>
|
||||
<fileDescription>Mobile Atlas Creator Windows Launcher</fileDescription>
|
||||
<copyright>MOBAC developers</copyright>
|
||||
<productVersion>1.0.0.0</productVersion>
|
||||
<txtProductVersion>-</txtProductVersion>
|
||||
<productName>Mobile Atlas Creator</productName>
|
||||
<companyName></companyName>
|
||||
<internalName>Mobile Atlas Creator 1024MB max Heap</internalName>
|
||||
<originalFilename>Mobile Atlas Creator.exe</originalFilename>
|
||||
</versionInfo>
|
||||
</launch4jConfig>
|
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
|
@ -0,0 +1,116 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<settings>
|
||||
<atlasFormatSpecificSettings>
|
||||
<garminCustomMaxMapCount>100</garminCustomMaxMapCount>
|
||||
</atlasFormatSpecificSettings>
|
||||
<bandwidthLimit>0</bandwidthLimit>
|
||||
<coordinateNumberFormat>DEG_LOCAL</coordinateNumberFormat>
|
||||
<customProxyHost></customProxyHost>
|
||||
<customProxyPassword></customProxyPassword>
|
||||
<customProxyPort></customProxyPort>
|
||||
<customProxyUserName></customProxyUserName>
|
||||
<customTileSize>false</customTileSize>
|
||||
<devMode>false</devMode>
|
||||
<directories/>
|
||||
<downloadRetryCount>1</downloadRetryCount>
|
||||
<downloadThreadCount>4</downloadThreadCount>
|
||||
<elementName>Layer</elementName>
|
||||
<googleLanguage>en</googleLanguage>
|
||||
<gpxFileChooserDir></gpxFileChooserDir>
|
||||
<httpConnectionTimeout>10</httpConnectionTimeout>
|
||||
<httpReadTimeout>10</httpReadTimeout>
|
||||
<ignoreDlErrors>false</ignoreDlErrors>
|
||||
<localeCountry></localeCountry>
|
||||
<localeLanguage>en</localeLanguage>
|
||||
<mainWindow>
|
||||
<size>1900/990</size>
|
||||
<position>1024/54</position>
|
||||
<maximized>true</maximized>
|
||||
<leftPanelVisible>true</leftPanelVisible>
|
||||
<rightPanelVisible>true</rightPanelVisible>
|
||||
<collapsedPanels>
|
||||
<collapsedPanel>Coordinates</collapsedPanel>
|
||||
</collapsedPanels>
|
||||
</mainWindow>
|
||||
<mapOverlapTiles>0</mapOverlapTiles>
|
||||
<mapSourcesDisabled>
|
||||
<mapSource>FreemapSlovakia</mapSource>
|
||||
<mapSource>FreemapSlovakiaCyclo</mapSource>
|
||||
<mapSource>FreemapSlovakiaHiking</mapSource>
|
||||
<mapSource>MoldovaPointMd</mapSource>
|
||||
<mapSource>OSMapaTopo</mapSource>
|
||||
<mapSource>OSMapaTopoContours</mapSource>
|
||||
<mapSource>OpenPisteMapBCL</mapSource>
|
||||
<mapSource>MapQuest</mapSource>
|
||||
<mapSource>Mapnik</mapSource>
|
||||
<mapSource>WanderreitkarteAbo</mapSource>
|
||||
<mapSource>Turaterkep256</mapSource>
|
||||
<mapSource>UMP-pcPL</mapSource>
|
||||
<mapSource>New Zealand Topographic Maps</mapSource>
|
||||
</mapSourcesDisabled>
|
||||
<mapSourcesEnabled>
|
||||
<mapSource>OSMPublicTransport</mapSource>
|
||||
<mapSource>OpenSeaMap</mapSource>
|
||||
<mapSource>OpenStreetMap Hikebikemap.de</mapSource>
|
||||
<mapSource>OpenStreetMap Standard Tile Layer</mapSource>
|
||||
<mapSource>USGS National Map Topo</mapSource>
|
||||
<mapSource>cb-enra</mapSource>
|
||||
<mapSource>cb-enrh</mapSource>
|
||||
<mapSource>cb-enrl</mapSource>
|
||||
<mapSource>cb-sec</mapSource>
|
||||
<mapSource>cb-tac</mapSource>
|
||||
<mapSource>cb-wac</mapSource>
|
||||
<mapSource>USGS National Map Imagery</mapSource>
|
||||
<mapSource>USGS National Map Imagery Topo</mapSource>
|
||||
</mapSourcesEnabled>
|
||||
<MapSourcesUpdate>
|
||||
<etag>"0-52575d5ec7c80"</etag>
|
||||
</MapSourcesUpdate>
|
||||
<mapviewCenterCoordinate lat="-4.565473550710278" lon="11.25"/>
|
||||
<mapviewGridZoom>-1</mapviewGridZoom>
|
||||
<mapviewMapSource>USGS National Map Topo</mapviewMapSource>
|
||||
<mapviewSelectionMax>217710592/422510592</mapviewSelectionMax>
|
||||
<mapviewSelectionMin>217710592/422510592</mapviewSelectionMin>
|
||||
<mapviewZoom>2</mapviewZoom>
|
||||
<maxMapSize>65536</maxMapSize>
|
||||
<osmHikingTicket></osmHikingTicket>
|
||||
<paperAtlas>
|
||||
<compression>6</compression>
|
||||
<crop>15</crop>
|
||||
<dpi>96</dpi>
|
||||
<marginBottom>22.6</marginBottom>
|
||||
<marginLeft>22.6</marginLeft>
|
||||
<marginRight>22.6</marginRight>
|
||||
<marginTop>22.6</marginTop>
|
||||
<overlap>28.2</overlap>
|
||||
<compass>true</compass>
|
||||
<pageNumbers>true</pageNumbers>
|
||||
<scaleBar>true</scaleBar>
|
||||
<wgsEnabled>true</wgsEnabled>
|
||||
<paperSize>A4</paperSize>
|
||||
<wgsDensity>SECOND_1</wgsDensity>
|
||||
</paperAtlas>
|
||||
<placeBookmarks/>
|
||||
<proxyType>CUSTOM</proxyType>
|
||||
<selectedZoomLevels>
|
||||
<zoomLevel>11</zoomLevel>
|
||||
<zoomLevel>12</zoomLevel>
|
||||
</selectedZoomLevels>
|
||||
<tileDefaultExpirationTime>2543562845</tileDefaultExpirationTime>
|
||||
<tileImageFormat>PNG</tileImageFormat>
|
||||
<tileMaxExpirationTime>33367857650</tileMaxExpirationTime>
|
||||
<tileMinExpirationTime>451300934</tileMinExpirationTime>
|
||||
<tileSize>256/256</tileSize>
|
||||
<tileStoreEnabled>true</tileStoreEnabled>
|
||||
<unitSystem>Metric</unitSystem>
|
||||
<userAgent>MOBAC/1.9.16</userAgent>
|
||||
<version>1.9.16</version>
|
||||
<wgsGrid>
|
||||
<color>#0000ff</color>
|
||||
<compressLabels>false</compressLabels>
|
||||
<density>SECOND_1</density>
|
||||
<enabled>false</enabled>
|
||||
<font>SansSerif-PLAIN-12</font>
|
||||
<width>1.0</width>
|
||||
</wgsGrid>
|
||||
</settings>
|
|
@ -0,0 +1,110 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.gui.SplashFrame;
|
||||
import mobac.mapsources.DefaultMapSourcesManager;
|
||||
import mobac.program.DirectoryManager;
|
||||
import mobac.program.EnvironmentSetup;
|
||||
import mobac.program.Logging;
|
||||
import mobac.program.ProgramInfo;
|
||||
import mobac.program.commandline.CommandLineEmpty;
|
||||
import mobac.program.commandline.CreateAtlas;
|
||||
import mobac.program.interfaces.CommandLineAction;
|
||||
import mobac.program.model.Settings;
|
||||
import mobac.program.tilestore.TileStore;
|
||||
import mobac.utilities.GUIExceptionHandler;
|
||||
|
||||
/**
|
||||
* Java 6 version of the main starter class
|
||||
*/
|
||||
public class Main {
|
||||
|
||||
protected CommandLineAction cmdAction = new CommandLineEmpty();
|
||||
|
||||
public Main() {
|
||||
try {
|
||||
parseCommandLine();
|
||||
if (cmdAction.showSplashScreen())
|
||||
SplashFrame.showFrame();
|
||||
|
||||
DirectoryManager.initialize();
|
||||
Logging.configureLogging();
|
||||
|
||||
// MySocketImplFactory.install();
|
||||
ProgramInfo.initialize(); // Load revision info
|
||||
Logging.logSystemInfo();
|
||||
GUIExceptionHandler.installToolkitEventQueueProxy();
|
||||
// Logging.logSystemProperties();
|
||||
ImageIO.setUseCache(false);
|
||||
|
||||
EnvironmentSetup.checkFileSetup();
|
||||
Settings.loadOrQuit();
|
||||
EnvironmentSetup.checkMemory();
|
||||
|
||||
EnvironmentSetup.copyMapPacks();
|
||||
DefaultMapSourcesManager.initialize();
|
||||
EnvironmentSetup.createDefaultAtlases();
|
||||
TileStore.initialize();
|
||||
EnvironmentSetup.upgrade();
|
||||
cmdAction.runBeforeMainGUI();
|
||||
if (cmdAction.showMainGUI()) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
Logging.LOG.debug("Starting GUI");
|
||||
MainGUI.createMainGui();
|
||||
SplashFrame.hideFrame();
|
||||
cmdAction.runMainGUI();
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
GUIExceptionHandler.processException(t);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
protected void parseCommandLine() {
|
||||
String[] args = StartMOBAC.ARGS;
|
||||
if (args.length >= 2) {
|
||||
if ("create".equalsIgnoreCase(args[0])) {
|
||||
if (args.length > 2)
|
||||
cmdAction = new CreateAtlas(args[1], args[2]);
|
||||
else
|
||||
cmdAction = new CreateAtlas(args[1]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Start MOBAC without Java Runtime version check
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
new Main();
|
||||
} catch (Throwable t) {
|
||||
GUIExceptionHandler.processException(t);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import mobac.utilities.I18nUtils;
|
||||
|
||||
/**
|
||||
* Main class for starting Mobile Atlas Creator.
|
||||
*
|
||||
* This class performs the Java Runtime version check and if the correct version is installed it creates a new instance
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
public class StartMOBAC {
|
||||
|
||||
public static final String MAIN_CLASS = "mobac.Main";
|
||||
|
||||
public static String[] ARGS;
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
ARGS = args;
|
||||
setLookAndFeel();
|
||||
checkVersion();
|
||||
try {
|
||||
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.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setLookAndFeel() {
|
||||
try {
|
||||
if (System.getProperty("swing.defaultlaf") != null)
|
||||
return;
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
//MainGUI.setDefaultFontOfAllUIComponents(MainGUI.customFont());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
protected static void checkVersion() {
|
||||
String ver = System.getProperty("java.specification.version");
|
||||
if (ver == null)
|
||||
ver = "Unknown";
|
||||
String[] v = ver.split("\\.");
|
||||
int major = 0;
|
||||
int minor = 0;
|
||||
try {
|
||||
major = Integer.parseInt(v[0]);
|
||||
minor = Integer.parseInt(v[1]);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
int version = (major * 1000) + minor;
|
||||
// 1.5 -> 1005; 1.6 -> 1006; 1.7 -> 1007
|
||||
if (version < 1006) {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
String.format(I18nUtils.localizedStringForKey("msg_environment_jre_bellow"), ver),
|
||||
I18nUtils.localizedStringForKey("msg_environment_jre_bellow_title"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.data.gpx;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Marshaller;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
import javax.xml.bind.util.JAXBResult;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
|
||||
import mobac.data.gpx.gpx11.Gpx;
|
||||
import mobac.program.Logging;
|
||||
import mobac.utilities.Utilities;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
public class GPXUtils {
|
||||
|
||||
public static boolean checkJAXBVersion() {
|
||||
boolean res = Utilities.checkJAXBVersion();
|
||||
if (!res)
|
||||
JOptionPane.showMessageDialog(null,
|
||||
"Outdated Java Runtime Environment and JAXB version",
|
||||
"Mobile Atlas Creator has detected that your used "
|
||||
+ "Java Runtime Environment is too old.\n Please update "
|
||||
+ "the Java Runtime Environment to at least \nversion "
|
||||
+ "1.6.0_14 and restart Mobile Atlas Creator.",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Gpx loadGpxFile(File f) throws JAXBException {
|
||||
// Create GPX 1.1 JAXB context
|
||||
JAXBContext context = JAXBContext.newInstance(Gpx.class);
|
||||
|
||||
Unmarshaller unmarshaller = context.createUnmarshaller();
|
||||
InputStream is = null;
|
||||
try {
|
||||
is = new FileInputStream(f);
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
factory.setNamespaceAware(true);
|
||||
DocumentBuilder loader = factory.newDocumentBuilder();
|
||||
Document document = loader.parse(is);
|
||||
String namespace = document.getDocumentElement().getNamespaceURI();
|
||||
if ("http://www.topografix.com/GPX/1/1".equals(namespace)) {
|
||||
return (Gpx) unmarshaller.unmarshal(document);
|
||||
}
|
||||
if ("http://www.topografix.com/GPX/1/0".equals(namespace)) {
|
||||
Source xmlSource = new javax.xml.transform.dom.DOMSource(document);
|
||||
Source xsltSource = new StreamSource(Utilities
|
||||
.loadResourceAsStream("xsl/gpx10to11.xsl"));
|
||||
JAXBResult result = new JAXBResult(unmarshaller);
|
||||
TransformerFactory transFact = TransformerFactory.newInstance();
|
||||
Transformer trans = transFact.newTransformer(xsltSource);
|
||||
trans.transform(xmlSource, result);
|
||||
return (Gpx) result.getResult();
|
||||
}
|
||||
throw new JAXBException("Expected GPX 1.0 or GPX1.1 namespace but found \n\""
|
||||
+ namespace + "\"");
|
||||
} catch (JAXBException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw new JAXBException(e);
|
||||
} finally {
|
||||
Utilities.closeStream(is);
|
||||
}
|
||||
}
|
||||
|
||||
public static void saveGpxFile(Gpx gpx, File f) throws JAXBException {
|
||||
// Create GPX 1.1 JAXB context
|
||||
JAXBContext context = JAXBContext.newInstance(Gpx.class);
|
||||
|
||||
Marshaller marshaller = context.createMarshaller();
|
||||
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
|
||||
OutputStream os = null;
|
||||
try {
|
||||
os = new FileOutputStream(f);
|
||||
marshaller.marshal(gpx, os);
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new JAXBException(e);
|
||||
} finally {
|
||||
Utilities.closeStream(os);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Logging.configureConsoleLogging();
|
||||
try {
|
||||
loadGpxFile(new File("misc/samples/gpx/gpx11 wpt.gpx"));
|
||||
loadGpxFile(new File("misc/samples/gpx/gpx10 wpt.gpx"));
|
||||
} catch (JAXBException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,150 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.data.gpx.gpx11;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/**
|
||||
*
|
||||
* Two lat/lon pairs defining the extent of an element.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Java class for boundsType complex type.
|
||||
*
|
||||
* <p>
|
||||
* The following schema fragment specifies the expected content contained within
|
||||
* this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="boundsType">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <attribute name="minlat" use="required" type="{http://www.topografix.com/GPX/1/1}latitudeType" />
|
||||
* <attribute name="minlon" use="required" type="{http://www.topografix.com/GPX/1/1}longitudeType" />
|
||||
* <attribute name="maxlat" use="required" type="{http://www.topografix.com/GPX/1/1}latitudeType" />
|
||||
* <attribute name="maxlon" use="required" type="{http://www.topografix.com/GPX/1/1}longitudeType" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "boundsType")
|
||||
public class BoundsType {
|
||||
|
||||
@XmlAttribute(required = true)
|
||||
protected BigDecimal minlat;
|
||||
@XmlAttribute(required = true)
|
||||
protected BigDecimal minlon;
|
||||
@XmlAttribute(required = true)
|
||||
protected BigDecimal maxlat;
|
||||
@XmlAttribute(required = true)
|
||||
protected BigDecimal maxlon;
|
||||
|
||||
/**
|
||||
* Gets the value of the minlat property.
|
||||
*
|
||||
* @return possible object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public BigDecimal getMinlat() {
|
||||
return minlat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the minlat property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public void setMinlat(BigDecimal value) {
|
||||
this.minlat = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the minlon property.
|
||||
*
|
||||
* @return possible object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public BigDecimal getMinlon() {
|
||||
return minlon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the minlon property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public void setMinlon(BigDecimal value) {
|
||||
this.minlon = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the maxlat property.
|
||||
*
|
||||
* @return possible object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public BigDecimal getMaxlat() {
|
||||
return maxlat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the maxlat property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public void setMaxlat(BigDecimal value) {
|
||||
this.maxlat = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the maxlon property.
|
||||
*
|
||||
* @return possible object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public BigDecimal getMaxlon() {
|
||||
return maxlon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the maxlon property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public void setMaxlon(BigDecimal value) {
|
||||
this.maxlon = value;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,147 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2009.08.04 at 03:45:03 PM MESZ
|
||||
//
|
||||
|
||||
|
||||
package mobac.data.gpx.gpx11;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlSchemaType;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Information about the copyright holder and any license governing use of this file. By linking to an appropriate license,
|
||||
* you may place your data into the public domain or grant additional usage rights.
|
||||
*
|
||||
*
|
||||
* <p>Java class for copyrightType complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="copyrightType">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="year" type="{http://www.w3.org/2001/XMLSchema}gYear" minOccurs="0"/>
|
||||
* <element name="license" type="{http://www.w3.org/2001/XMLSchema}anyURI" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* <attribute name="author" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "copyrightType", propOrder = {
|
||||
"year",
|
||||
"license"
|
||||
})
|
||||
public class CopyrightType {
|
||||
|
||||
@XmlSchemaType(name = "gYear")
|
||||
protected XMLGregorianCalendar year;
|
||||
@XmlSchemaType(name = "anyURI")
|
||||
protected String license;
|
||||
@XmlAttribute(required = true)
|
||||
protected String author;
|
||||
|
||||
/**
|
||||
* Gets the value of the year property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public XMLGregorianCalendar getYear() {
|
||||
return year;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the year property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public void setYear(XMLGregorianCalendar value) {
|
||||
this.year = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the license property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getLicense() {
|
||||
return license;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the license property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setLicense(String value) {
|
||||
this.license = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the author property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the author property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setAuthor(String value) {
|
||||
this.author = value;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2009.08.04 at 03:45:03 PM MESZ
|
||||
//
|
||||
|
||||
|
||||
package mobac.data.gpx.gpx11;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* An email address. Broken into two parts (id and domain) to help prevent email harvesting.
|
||||
*
|
||||
*
|
||||
* <p>Java class for emailType complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="emailType">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <attribute name="id" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* <attribute name="domain" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "emailType")
|
||||
public class EmailType {
|
||||
|
||||
@XmlAttribute(required = true)
|
||||
protected String id;
|
||||
@XmlAttribute(required = true)
|
||||
protected String domain;
|
||||
|
||||
/**
|
||||
* Gets the value of the id property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the id property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setId(String value) {
|
||||
this.id = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the domain property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getDomain() {
|
||||
return domain;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the domain property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setDomain(String value) {
|
||||
this.domain = value;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2009.08.04 at 03:45:03 PM MESZ
|
||||
//
|
||||
|
||||
|
||||
package mobac.data.gpx.gpx11;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAnyElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* You can add extend GPX by adding your own elements from another schema here.
|
||||
*
|
||||
*
|
||||
* <p>Java class for extensionsType complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="extensionsType">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <any/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "extensionsType", propOrder = {
|
||||
"any"
|
||||
})
|
||||
public class ExtensionsType {
|
||||
|
||||
@XmlAnyElement(lax = true)
|
||||
protected List<Object> any;
|
||||
|
||||
/**
|
||||
* Gets the value of the any property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the any property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getAny().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link Object }
|
||||
* {@link Element }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<Object> getAny() {
|
||||
if (any == null) {
|
||||
any = new ArrayList<Object>();
|
||||
}
|
||||
return this.any;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,272 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2009.08.04 at 03:45:03 PM MESZ
|
||||
//
|
||||
|
||||
package mobac.data.gpx.gpx11;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
import mobac.program.ProgramInfo;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* GPX documents contain a metadata header, followed by waypoints, routes, and
|
||||
* tracks. You can add your own elements to the extensions section of the GPX
|
||||
* document.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Java class for anonymous complex type.
|
||||
*
|
||||
* <p>
|
||||
* The following schema fragment specifies the expected content contained within
|
||||
* this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="metadata" type="{http://www.topografix.com/GPX/1/1}metadataType" minOccurs="0"/>
|
||||
* <element name="wpt" type="{http://www.topografix.com/GPX/1/1}wptType" maxOccurs="unbounded" minOccurs="0"/>
|
||||
* <element name="rte" type="{http://www.topografix.com/GPX/1/1}rteType" maxOccurs="unbounded" minOccurs="0"/>
|
||||
* <element name="trk" type="{http://www.topografix.com/GPX/1/1}trkType" maxOccurs="unbounded" minOccurs="0"/>
|
||||
* <element name="extensions" type="{http://www.topografix.com/GPX/1/1}extensionsType" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* <attribute name="version" use="required" type="{http://www.w3.org/2001/XMLSchema}string" fixed="1.1" />
|
||||
* <attribute name="creator" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = { "metadata", "wpt", "rte", "trk", "extensions" })
|
||||
@XmlRootElement(name = "gpx")
|
||||
public class Gpx {
|
||||
|
||||
protected MetadataType metadata;
|
||||
protected List<WptType> wpt;
|
||||
protected List<RteType> rte;
|
||||
protected List<TrkType> trk;
|
||||
protected ExtensionsType extensions;
|
||||
@XmlAttribute(required = true)
|
||||
protected String version;
|
||||
@XmlAttribute(required = true)
|
||||
protected String creator;
|
||||
|
||||
public static Gpx createGpx() {
|
||||
Gpx gpx = new Gpx();
|
||||
gpx.setVersion("1.1");
|
||||
gpx.setCreator(ProgramInfo.getVersionTitle());
|
||||
return gpx;
|
||||
}
|
||||
|
||||
protected Gpx() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the metadata property.
|
||||
*
|
||||
* @return possible object is {@link MetadataType }
|
||||
*
|
||||
*/
|
||||
public MetadataType getMetadata() {
|
||||
return metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the metadata property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link MetadataType }
|
||||
*
|
||||
*/
|
||||
public void setMetadata(MetadataType value) {
|
||||
this.metadata = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the wpt property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list, not a
|
||||
* snapshot. Therefore any modification you make to the returned list will
|
||||
* be present inside the JAXB object. This is why there is not a
|
||||
* <CODE>set</CODE> method for the wpt property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
*
|
||||
* <pre>
|
||||
* getWpt().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list {@link WptType }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<WptType> getWpt() {
|
||||
if (wpt == null) {
|
||||
wpt = new ArrayList<WptType>();
|
||||
}
|
||||
return this.wpt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the rte property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list, not a
|
||||
* snapshot. Therefore any modification you make to the returned list will
|
||||
* be present inside the JAXB object. This is why there is not a
|
||||
* <CODE>set</CODE> method for the rte property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
*
|
||||
* <pre>
|
||||
* getRte().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list {@link RteType }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<RteType> getRte() {
|
||||
if (rte == null) {
|
||||
rte = new ArrayList<RteType>();
|
||||
}
|
||||
return this.rte;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the trk property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list, not a
|
||||
* snapshot. Therefore any modification you make to the returned list will
|
||||
* be present inside the JAXB object. This is why there is not a
|
||||
* <CODE>set</CODE> method for the trk property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
*
|
||||
* <pre>
|
||||
* getTrk().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list {@link TrkType }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<TrkType> getTrk() {
|
||||
if (trk == null) {
|
||||
trk = new ArrayList<TrkType>();
|
||||
}
|
||||
return this.trk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the extensions property.
|
||||
*
|
||||
* @return possible object is {@link ExtensionsType }
|
||||
*
|
||||
*/
|
||||
public ExtensionsType getExtensions() {
|
||||
return extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the extensions property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link ExtensionsType }
|
||||
*
|
||||
*/
|
||||
public void setExtensions(ExtensionsType value) {
|
||||
this.extensions = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the version property.
|
||||
*
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getVersion() {
|
||||
if (version == null) {
|
||||
return "1.1";
|
||||
} else {
|
||||
return version;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the version property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setVersion(String value) {
|
||||
this.version = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the creator property.
|
||||
*
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the creator property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setCreator(String value) {
|
||||
this.creator = value;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2009.08.04 at 03:45:03 PM MESZ
|
||||
//
|
||||
|
||||
|
||||
package mobac.data.gpx.gpx11;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlSchemaType;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* A link to an external resource (Web page, digital photo, video clip, etc) with additional information.
|
||||
*
|
||||
*
|
||||
* <p>Java class for linkType complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="linkType">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="text" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="type" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* <attribute name="href" use="required" type="{http://www.w3.org/2001/XMLSchema}anyURI" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "linkType", propOrder = {
|
||||
"text",
|
||||
"type"
|
||||
})
|
||||
public class LinkType {
|
||||
|
||||
protected String text;
|
||||
protected String type;
|
||||
@XmlAttribute(required = true)
|
||||
@XmlSchemaType(name = "anyURI")
|
||||
protected String href;
|
||||
|
||||
/**
|
||||
* Gets the value of the text property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the text property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setText(String value) {
|
||||
this.text = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the type property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the type property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setType(String value) {
|
||||
this.type = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the href property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getHref() {
|
||||
return href;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the href property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setHref(String value) {
|
||||
this.href = value;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,314 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2009.08.04 at 03:45:03 PM MESZ
|
||||
//
|
||||
|
||||
|
||||
package mobac.data.gpx.gpx11;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Information about the GPX file, author, and copyright restrictions goes in the metadata section. Providing rich,
|
||||
* meaningful information about your GPX files allows others to search for and use your GPS data.
|
||||
*
|
||||
*
|
||||
* <p>Java class for metadataType complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="metadataType">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="desc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="author" type="{http://www.topografix.com/GPX/1/1}personType" minOccurs="0"/>
|
||||
* <element name="copyright" type="{http://www.topografix.com/GPX/1/1}copyrightType" minOccurs="0"/>
|
||||
* <element name="link" type="{http://www.topografix.com/GPX/1/1}linkType" maxOccurs="unbounded" minOccurs="0"/>
|
||||
* <element name="time" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
|
||||
* <element name="keywords" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="bounds" type="{http://www.topografix.com/GPX/1/1}boundsType" minOccurs="0"/>
|
||||
* <element name="extensions" type="{http://www.topografix.com/GPX/1/1}extensionsType" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "metadataType", propOrder = {
|
||||
"name",
|
||||
"desc",
|
||||
"author",
|
||||
"copyright",
|
||||
"link",
|
||||
"time",
|
||||
"keywords",
|
||||
"bounds",
|
||||
"extensions"
|
||||
})
|
||||
public class MetadataType {
|
||||
|
||||
protected String name;
|
||||
protected String desc;
|
||||
protected PersonType author;
|
||||
protected CopyrightType copyright;
|
||||
protected List<LinkType> link;
|
||||
protected XMLGregorianCalendar time;
|
||||
protected String keywords;
|
||||
protected BoundsType bounds;
|
||||
protected ExtensionsType extensions;
|
||||
|
||||
/**
|
||||
* Gets the value of the name property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the name property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setName(String value) {
|
||||
this.name = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the desc property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the desc property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setDesc(String value) {
|
||||
this.desc = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the author property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link PersonType }
|
||||
*
|
||||
*/
|
||||
public PersonType getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the author property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link PersonType }
|
||||
*
|
||||
*/
|
||||
public void setAuthor(PersonType value) {
|
||||
this.author = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the copyright property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link CopyrightType }
|
||||
*
|
||||
*/
|
||||
public CopyrightType getCopyright() {
|
||||
return copyright;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the copyright property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link CopyrightType }
|
||||
*
|
||||
*/
|
||||
public void setCopyright(CopyrightType value) {
|
||||
this.copyright = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the link property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the link property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getLink().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link LinkType }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<LinkType> getLink() {
|
||||
if (link == null) {
|
||||
link = new ArrayList<LinkType>();
|
||||
}
|
||||
return this.link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the time property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public XMLGregorianCalendar getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the time property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public void setTime(XMLGregorianCalendar value) {
|
||||
this.time = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the keywords property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getKeywords() {
|
||||
return keywords;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the keywords property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setKeywords(String value) {
|
||||
this.keywords = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the bounds property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link BoundsType }
|
||||
*
|
||||
*/
|
||||
public BoundsType getBounds() {
|
||||
return bounds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the bounds property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link BoundsType }
|
||||
*
|
||||
*/
|
||||
public void setBounds(BoundsType value) {
|
||||
this.bounds = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the extensions property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link ExtensionsType }
|
||||
*
|
||||
*/
|
||||
public ExtensionsType getExtensions() {
|
||||
return extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the extensions property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link ExtensionsType }
|
||||
*
|
||||
*/
|
||||
public void setExtensions(ExtensionsType value) {
|
||||
this.extensions = value;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,141 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2009.08.04 at 03:45:03 PM MESZ
|
||||
//
|
||||
|
||||
|
||||
package mobac.data.gpx.gpx11;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* A person or organization.
|
||||
*
|
||||
*
|
||||
* <p>Java class for personType complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="personType">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="email" type="{http://www.topografix.com/GPX/1/1}emailType" minOccurs="0"/>
|
||||
* <element name="link" type="{http://www.topografix.com/GPX/1/1}linkType" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "personType", propOrder = {
|
||||
"name",
|
||||
"email",
|
||||
"link"
|
||||
})
|
||||
public class PersonType {
|
||||
|
||||
protected String name;
|
||||
protected EmailType email;
|
||||
protected LinkType link;
|
||||
|
||||
/**
|
||||
* Gets the value of the name property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the name property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setName(String value) {
|
||||
this.name = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the email property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link EmailType }
|
||||
*
|
||||
*/
|
||||
public EmailType getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the email property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link EmailType }
|
||||
*
|
||||
*/
|
||||
public void setEmail(EmailType value) {
|
||||
this.email = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the link property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link LinkType }
|
||||
*
|
||||
*/
|
||||
public LinkType getLink() {
|
||||
return link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the link property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link LinkType }
|
||||
*
|
||||
*/
|
||||
public void setLink(LinkType value) {
|
||||
this.link = value;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,161 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2009.08.04 at 03:45:03 PM MESZ
|
||||
//
|
||||
|
||||
package mobac.data.gpx.gpx11;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
|
||||
import mobac.data.gpx.interfaces.GpxPoint;
|
||||
|
||||
/**
|
||||
*
|
||||
* A geographic point with optional elevation and time. Available for use by
|
||||
* other schemas.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Java class for ptType complex type.
|
||||
*
|
||||
* <p>
|
||||
* The following schema fragment specifies the expected content contained within
|
||||
* this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="ptType">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="ele" type="{http://www.w3.org/2001/XMLSchema}decimal" minOccurs="0"/>
|
||||
* <element name="time" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* <attribute name="lat" use="required" type="{http://www.topografix.com/GPX/1/1}latitudeType" />
|
||||
* <attribute name="lon" use="required" type="{http://www.topografix.com/GPX/1/1}longitudeType" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "ptType", propOrder = { "ele", "time" })
|
||||
public class PtType implements GpxPoint {
|
||||
|
||||
protected BigDecimal ele;
|
||||
protected XMLGregorianCalendar time;
|
||||
@XmlAttribute(required = true)
|
||||
protected BigDecimal lat;
|
||||
@XmlAttribute(required = true)
|
||||
protected BigDecimal lon;
|
||||
|
||||
/**
|
||||
* Gets the value of the ele property.
|
||||
*
|
||||
* @return possible object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public BigDecimal getEle() {
|
||||
return ele;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the ele property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public void setEle(BigDecimal value) {
|
||||
this.ele = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the time property.
|
||||
*
|
||||
* @return possible object is {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public XMLGregorianCalendar getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the time property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public void setTime(XMLGregorianCalendar value) {
|
||||
this.time = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the lat property.
|
||||
*
|
||||
* @return possible object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public BigDecimal getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the lat property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public void setLat(BigDecimal value) {
|
||||
this.lat = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the lon property.
|
||||
*
|
||||
* @return possible object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public BigDecimal getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the lon property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public void setLon(BigDecimal value) {
|
||||
this.lon = value;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2009.08.04 at 03:45:03 PM MESZ
|
||||
//
|
||||
|
||||
|
||||
package mobac.data.gpx.gpx11;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* An ordered sequence of points. (for polygons or polylines, e.g.)
|
||||
*
|
||||
*
|
||||
* <p>Java class for ptsegType complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="ptsegType">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="pt" type="{http://www.topografix.com/GPX/1/1}ptType" maxOccurs="unbounded" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "ptsegType", propOrder = {
|
||||
"pt"
|
||||
})
|
||||
public class PtsegType {
|
||||
|
||||
protected List<PtType> pt;
|
||||
|
||||
/**
|
||||
* Gets the value of the pt property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the pt property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getPt().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link PtType }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<PtType> getPt() {
|
||||
if (pt == null) {
|
||||
pt = new ArrayList<PtType>();
|
||||
}
|
||||
return this.pt;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,318 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2009.08.04 at 03:45:03 PM MESZ
|
||||
//
|
||||
|
||||
|
||||
package mobac.data.gpx.gpx11;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlSchemaType;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* rte represents route - an ordered list of waypoints representing a series of turn points leading to a destination.
|
||||
*
|
||||
*
|
||||
* <p>Java class for rteType complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="rteType">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="cmt" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="desc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="src" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="link" type="{http://www.topografix.com/GPX/1/1}linkType" maxOccurs="unbounded" minOccurs="0"/>
|
||||
* <element name="number" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger" minOccurs="0"/>
|
||||
* <element name="type" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="extensions" type="{http://www.topografix.com/GPX/1/1}extensionsType" minOccurs="0"/>
|
||||
* <element name="rtept" type="{http://www.topografix.com/GPX/1/1}wptType" maxOccurs="unbounded" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "rteType", propOrder = {
|
||||
"name",
|
||||
"cmt",
|
||||
"desc",
|
||||
"src",
|
||||
"link",
|
||||
"number",
|
||||
"type",
|
||||
"extensions",
|
||||
"rtept"
|
||||
})
|
||||
public class RteType {
|
||||
|
||||
protected String name;
|
||||
protected String cmt;
|
||||
protected String desc;
|
||||
protected String src;
|
||||
protected List<LinkType> link;
|
||||
@XmlSchemaType(name = "nonNegativeInteger")
|
||||
protected BigInteger number;
|
||||
protected String type;
|
||||
protected ExtensionsType extensions;
|
||||
protected List<WptType> rtept;
|
||||
|
||||
/**
|
||||
* Gets the value of the name property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the name property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setName(String value) {
|
||||
this.name = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the cmt property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getCmt() {
|
||||
return cmt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the cmt property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setCmt(String value) {
|
||||
this.cmt = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the desc property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the desc property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setDesc(String value) {
|
||||
this.desc = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the src property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getSrc() {
|
||||
return src;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the src property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setSrc(String value) {
|
||||
this.src = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the link property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the link property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getLink().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link LinkType }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<LinkType> getLink() {
|
||||
if (link == null) {
|
||||
link = new ArrayList<LinkType>();
|
||||
}
|
||||
return this.link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the number property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link BigInteger }
|
||||
*
|
||||
*/
|
||||
public BigInteger getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the number property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link BigInteger }
|
||||
*
|
||||
*/
|
||||
public void setNumber(BigInteger value) {
|
||||
this.number = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the type property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the type property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setType(String value) {
|
||||
this.type = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the extensions property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link ExtensionsType }
|
||||
*
|
||||
*/
|
||||
public ExtensionsType getExtensions() {
|
||||
return extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the extensions property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link ExtensionsType }
|
||||
*
|
||||
*/
|
||||
public void setExtensions(ExtensionsType value) {
|
||||
this.extensions = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the rtept property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the rtept property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getRtept().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link WptType }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<WptType> getRtept() {
|
||||
if (rtept == null) {
|
||||
rtept = new ArrayList<WptType>();
|
||||
}
|
||||
return this.rtept;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,318 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2009.08.04 at 03:45:03 PM MESZ
|
||||
//
|
||||
|
||||
|
||||
package mobac.data.gpx.gpx11;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlSchemaType;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* trk represents a track - an ordered list of points describing a path.
|
||||
*
|
||||
*
|
||||
* <p>Java class for trkType complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="trkType">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="cmt" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="desc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="src" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="link" type="{http://www.topografix.com/GPX/1/1}linkType" maxOccurs="unbounded" minOccurs="0"/>
|
||||
* <element name="number" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger" minOccurs="0"/>
|
||||
* <element name="type" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="extensions" type="{http://www.topografix.com/GPX/1/1}extensionsType" minOccurs="0"/>
|
||||
* <element name="trkseg" type="{http://www.topografix.com/GPX/1/1}trksegType" maxOccurs="unbounded" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "trkType", propOrder = {
|
||||
"name",
|
||||
"cmt",
|
||||
"desc",
|
||||
"src",
|
||||
"link",
|
||||
"number",
|
||||
"type",
|
||||
"extensions",
|
||||
"trkseg"
|
||||
})
|
||||
public class TrkType {
|
||||
|
||||
protected String name;
|
||||
protected String cmt;
|
||||
protected String desc;
|
||||
protected String src;
|
||||
protected List<LinkType> link;
|
||||
@XmlSchemaType(name = "nonNegativeInteger")
|
||||
protected BigInteger number;
|
||||
protected String type;
|
||||
protected ExtensionsType extensions;
|
||||
protected List<TrksegType> trkseg;
|
||||
|
||||
/**
|
||||
* Gets the value of the name property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the name property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setName(String value) {
|
||||
this.name = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the cmt property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getCmt() {
|
||||
return cmt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the cmt property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setCmt(String value) {
|
||||
this.cmt = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the desc property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the desc property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setDesc(String value) {
|
||||
this.desc = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the src property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getSrc() {
|
||||
return src;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the src property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setSrc(String value) {
|
||||
this.src = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the link property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the link property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getLink().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link LinkType }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<LinkType> getLink() {
|
||||
if (link == null) {
|
||||
link = new ArrayList<LinkType>();
|
||||
}
|
||||
return this.link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the number property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link BigInteger }
|
||||
*
|
||||
*/
|
||||
public BigInteger getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the number property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link BigInteger }
|
||||
*
|
||||
*/
|
||||
public void setNumber(BigInteger value) {
|
||||
this.number = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the type property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the type property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setType(String value) {
|
||||
this.type = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the extensions property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link ExtensionsType }
|
||||
*
|
||||
*/
|
||||
public ExtensionsType getExtensions() {
|
||||
return extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the extensions property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link ExtensionsType }
|
||||
*
|
||||
*/
|
||||
public void setExtensions(ExtensionsType value) {
|
||||
this.extensions = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the trkseg property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the trkseg property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getTrkseg().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link TrksegType }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<TrksegType> getTrkseg() {
|
||||
if (trkseg == null) {
|
||||
trkseg = new ArrayList<TrksegType>();
|
||||
}
|
||||
return this.trkseg;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2009.08.04 at 03:45:03 PM MESZ
|
||||
//
|
||||
|
||||
|
||||
package mobac.data.gpx.gpx11;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* A Track Segment holds a list of Track Points which are logically connected in order. To represent a single GPS track where GPS reception was lost, or the GPS receiver was turned off, start a new Track Segment for each continuous span of track data.
|
||||
*
|
||||
*
|
||||
* <p>Java class for trksegType complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="trksegType">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="trkpt" type="{http://www.topografix.com/GPX/1/1}wptType" maxOccurs="unbounded" minOccurs="0"/>
|
||||
* <element name="extensions" type="{http://www.topografix.com/GPX/1/1}extensionsType" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "trksegType", propOrder = {
|
||||
"trkpt",
|
||||
"extensions"
|
||||
})
|
||||
public class TrksegType {
|
||||
|
||||
protected List<WptType> trkpt;
|
||||
protected ExtensionsType extensions;
|
||||
|
||||
/**
|
||||
* Gets the value of the trkpt property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the trkpt property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getTrkpt().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link WptType }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<WptType> getTrkpt() {
|
||||
if (trkpt == null) {
|
||||
trkpt = new ArrayList<WptType>();
|
||||
}
|
||||
return this.trkpt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the extensions property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link ExtensionsType }
|
||||
*
|
||||
*/
|
||||
public ExtensionsType getExtensions() {
|
||||
return extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the extensions property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link ExtensionsType }
|
||||
*
|
||||
*/
|
||||
public void setExtensions(ExtensionsType value) {
|
||||
this.extensions = value;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,566 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2009.08.04 at 03:45:03 PM MESZ
|
||||
//
|
||||
|
||||
package mobac.data.gpx.gpx11;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlSchemaType;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
|
||||
import mobac.data.gpx.interfaces.GpxPoint;
|
||||
|
||||
/**
|
||||
*
|
||||
* wpt represents a waypoint, point of interest, or named feature on a map.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Java class for wptType complex type.
|
||||
*
|
||||
* <p>
|
||||
* The following schema fragment specifies the expected content contained within
|
||||
* this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="wptType">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="ele" type="{http://www.w3.org/2001/XMLSchema}decimal" minOccurs="0"/>
|
||||
* <element name="time" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
|
||||
* <element name="magvar" type="{http://www.topografix.com/GPX/1/1}degreesType" minOccurs="0"/>
|
||||
* <element name="geoidheight" type="{http://www.w3.org/2001/XMLSchema}decimal" minOccurs="0"/>
|
||||
* <element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="cmt" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="desc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="src" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="link" type="{http://www.topografix.com/GPX/1/1}linkType" maxOccurs="unbounded" minOccurs="0"/>
|
||||
* <element name="sym" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="type" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="fix" type="{http://www.topografix.com/GPX/1/1}fixType" minOccurs="0"/>
|
||||
* <element name="sat" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger" minOccurs="0"/>
|
||||
* <element name="hdop" type="{http://www.w3.org/2001/XMLSchema}decimal" minOccurs="0"/>
|
||||
* <element name="vdop" type="{http://www.w3.org/2001/XMLSchema}decimal" minOccurs="0"/>
|
||||
* <element name="pdop" type="{http://www.w3.org/2001/XMLSchema}decimal" minOccurs="0"/>
|
||||
* <element name="ageofdgpsdata" type="{http://www.w3.org/2001/XMLSchema}decimal" minOccurs="0"/>
|
||||
* <element name="dgpsid" type="{http://www.topografix.com/GPX/1/1}dgpsStationType" minOccurs="0"/>
|
||||
* <element name="extensions" type="{http://www.topografix.com/GPX/1/1}extensionsType" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* <attribute name="lat" use="required" type="{http://www.topografix.com/GPX/1/1}latitudeType" />
|
||||
* <attribute name="lon" use="required" type="{http://www.topografix.com/GPX/1/1}longitudeType" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "wptType", propOrder = { "ele", "time", "magvar", "geoidheight", "name", "cmt",
|
||||
"desc", "src", "link", "sym", "type", "fix", "sat", "hdop", "vdop", "pdop",
|
||||
"ageofdgpsdata", "dgpsid", "extensions" })
|
||||
public class WptType implements GpxPoint {
|
||||
|
||||
protected BigDecimal ele;
|
||||
protected XMLGregorianCalendar time;
|
||||
protected BigDecimal magvar;
|
||||
protected BigDecimal geoidheight;
|
||||
protected String name;
|
||||
protected String cmt;
|
||||
protected String desc;
|
||||
protected String src;
|
||||
protected List<LinkType> link;
|
||||
protected String sym;
|
||||
protected String type;
|
||||
protected String fix;
|
||||
@XmlSchemaType(name = "nonNegativeInteger")
|
||||
protected BigInteger sat;
|
||||
protected BigDecimal hdop;
|
||||
protected BigDecimal vdop;
|
||||
protected BigDecimal pdop;
|
||||
protected BigDecimal ageofdgpsdata;
|
||||
protected Integer dgpsid;
|
||||
protected ExtensionsType extensions;
|
||||
@XmlAttribute(required = true)
|
||||
protected BigDecimal lat;
|
||||
@XmlAttribute(required = true)
|
||||
protected BigDecimal lon;
|
||||
|
||||
/**
|
||||
* Gets the value of the ele property.
|
||||
*
|
||||
* @return possible object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public BigDecimal getEle() {
|
||||
return ele;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the ele property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public void setEle(BigDecimal value) {
|
||||
this.ele = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the time property.
|
||||
*
|
||||
* @return possible object is {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public XMLGregorianCalendar getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the time property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public void setTime(XMLGregorianCalendar value) {
|
||||
this.time = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the magvar property.
|
||||
*
|
||||
* @return possible object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public BigDecimal getMagvar() {
|
||||
return magvar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the magvar property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public void setMagvar(BigDecimal value) {
|
||||
this.magvar = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the geoidheight property.
|
||||
*
|
||||
* @return possible object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public BigDecimal getGeoidheight() {
|
||||
return geoidheight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the geoidheight property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public void setGeoidheight(BigDecimal value) {
|
||||
this.geoidheight = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the name property.
|
||||
*
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the name property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setName(String value) {
|
||||
this.name = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the cmt property.
|
||||
*
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getCmt() {
|
||||
return cmt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the cmt property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setCmt(String value) {
|
||||
this.cmt = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the desc property.
|
||||
*
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the desc property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setDesc(String value) {
|
||||
this.desc = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the src property.
|
||||
*
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getSrc() {
|
||||
return src;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the src property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setSrc(String value) {
|
||||
this.src = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the link property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list, not a
|
||||
* snapshot. Therefore any modification you make to the returned list will
|
||||
* be present inside the JAXB object. This is why there is not a
|
||||
* <CODE>set</CODE> method for the link property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
*
|
||||
* <pre>
|
||||
* getLink().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list {@link LinkType }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<LinkType> getLink() {
|
||||
if (link == null) {
|
||||
link = new ArrayList<LinkType>();
|
||||
}
|
||||
return this.link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the sym property.
|
||||
*
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getSym() {
|
||||
return sym;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the sym property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setSym(String value) {
|
||||
this.sym = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the type property.
|
||||
*
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the type property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setType(String value) {
|
||||
this.type = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the fix property.
|
||||
*
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getFix() {
|
||||
return fix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the fix property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setFix(String value) {
|
||||
this.fix = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the sat property.
|
||||
*
|
||||
* @return possible object is {@link BigInteger }
|
||||
*
|
||||
*/
|
||||
public BigInteger getSat() {
|
||||
return sat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the sat property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link BigInteger }
|
||||
*
|
||||
*/
|
||||
public void setSat(BigInteger value) {
|
||||
this.sat = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the hdop property.
|
||||
*
|
||||
* @return possible object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public BigDecimal getHdop() {
|
||||
return hdop;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the hdop property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public void setHdop(BigDecimal value) {
|
||||
this.hdop = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the vdop property.
|
||||
*
|
||||
* @return possible object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public BigDecimal getVdop() {
|
||||
return vdop;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the vdop property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public void setVdop(BigDecimal value) {
|
||||
this.vdop = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the pdop property.
|
||||
*
|
||||
* @return possible object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public BigDecimal getPdop() {
|
||||
return pdop;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the pdop property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public void setPdop(BigDecimal value) {
|
||||
this.pdop = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the ageofdgpsdata property.
|
||||
*
|
||||
* @return possible object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public BigDecimal getAgeofdgpsdata() {
|
||||
return ageofdgpsdata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the ageofdgpsdata property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public void setAgeofdgpsdata(BigDecimal value) {
|
||||
this.ageofdgpsdata = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the dgpsid property.
|
||||
*
|
||||
* @return possible object is {@link Integer }
|
||||
*
|
||||
*/
|
||||
public Integer getDgpsid() {
|
||||
return dgpsid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the dgpsid property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link Integer }
|
||||
*
|
||||
*/
|
||||
public void setDgpsid(Integer value) {
|
||||
this.dgpsid = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the extensions property.
|
||||
*
|
||||
* @return possible object is {@link ExtensionsType }
|
||||
*
|
||||
*/
|
||||
public ExtensionsType getExtensions() {
|
||||
return extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the extensions property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link ExtensionsType }
|
||||
*
|
||||
*/
|
||||
public void setExtensions(ExtensionsType value) {
|
||||
this.extensions = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the lat property.
|
||||
*
|
||||
* @return possible object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public BigDecimal getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the lat property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public void setLat(BigDecimal value) {
|
||||
this.lat = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the lon property.
|
||||
*
|
||||
* @return possible object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public BigDecimal getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the lon property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link BigDecimal }
|
||||
*
|
||||
*/
|
||||
public void setLon(BigDecimal value) {
|
||||
this.lon = value;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2009.08.04 at 03:45:03 PM MESZ
|
||||
//
|
||||
|
||||
@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.topografix.com/GPX/1/1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
|
||||
@XmlJavaTypeAdapters({ @XmlJavaTypeAdapter(value = BigDecimalAdapter.class, type = BigDecimal.class) })
|
||||
package mobac.data.gpx.gpx11;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters;
|
||||
|
||||
import mobac.program.jaxb.BigDecimalAdapter;
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.data.gpx.interfaces;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public interface GpxPoint {
|
||||
|
||||
public BigDecimal getLat();
|
||||
|
||||
public BigDecimal getLon();
|
||||
|
||||
public BigDecimal getEle();
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.exceptions;
|
||||
|
||||
import mobac.program.interfaces.LayerInterface;
|
||||
import mobac.program.interfaces.MapInterface;
|
||||
|
||||
public class AtlasTestException extends Exception {
|
||||
|
||||
public AtlasTestException(String message, MapInterface map) {
|
||||
super(message + "\nError caused by map \"" + map.getName() + "\" on layer \""
|
||||
+ map.getLayer().getName() + "\"");
|
||||
}
|
||||
|
||||
public AtlasTestException(String message, LayerInterface layer) {
|
||||
super(message + "\nError caused by layer \"" + layer.getName() + "\"");
|
||||
}
|
||||
|
||||
public AtlasTestException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public AtlasTestException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public AtlasTestException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.exceptions;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
|
||||
public class DownloadFailedException extends IOException {
|
||||
|
||||
private final int httpResponseCode;
|
||||
private HttpURLConnection connection;
|
||||
|
||||
public DownloadFailedException(HttpURLConnection connection, int httpResponseCode)
|
||||
throws IOException {
|
||||
super("Invaild HTTP response: " + httpResponseCode);
|
||||
this.connection = connection;
|
||||
this.httpResponseCode = httpResponseCode;
|
||||
}
|
||||
|
||||
public int getHttpResponseCode() {
|
||||
return httpResponseCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return super.getMessage() + "\n" + connection.getURL();
|
||||
}
|
||||
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.exceptions;
|
||||
|
||||
public class InvalidNameException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public InvalidNameException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.exceptions;
|
||||
|
||||
import mobac.utilities.Utilities;
|
||||
|
||||
public class MOBACOutOfMemoryException extends RuntimeException {
|
||||
|
||||
long requiredMemory;
|
||||
long heapAvailable;
|
||||
|
||||
public MOBACOutOfMemoryException(long requiredMemory, String message) {
|
||||
super(message);
|
||||
Runtime r = Runtime.getRuntime();
|
||||
heapAvailable = r.maxMemory() - r.totalMemory() + r.freeMemory();
|
||||
this.requiredMemory = requiredMemory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return super.getMessage() + "\nRequired memory: " + getFormattedRequiredMemory() + "\nAvailable free memory: "
|
||||
+ Utilities.formatBytes(heapAvailable);
|
||||
}
|
||||
|
||||
public long getRequiredMemory() {
|
||||
return requiredMemory;
|
||||
}
|
||||
|
||||
public String getFormattedRequiredMemory() {
|
||||
return Utilities.formatBytes(requiredMemory);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.exceptions;
|
||||
|
||||
import java.io.StringWriter;
|
||||
|
||||
import mobac.program.interfaces.ExceptionExtendedInfo;
|
||||
import mobac.program.interfaces.MapInterface;
|
||||
import mobac.program.interfaces.MapSource;
|
||||
import mobac.program.model.MapSourceLoaderInfo;
|
||||
|
||||
public class MapCreationException extends Exception implements ExceptionExtendedInfo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private MapInterface map;
|
||||
|
||||
public MapCreationException(String message, MapInterface map, Throwable cause) {
|
||||
super(message, cause);
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
public MapCreationException(String message, MapInterface map) {
|
||||
super(message);
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
public MapCreationException(MapInterface map, Throwable cause) {
|
||||
super(cause);
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
public String getExtendedInfo() {
|
||||
StringWriter sw = new StringWriter();
|
||||
if (map != null) {
|
||||
sw.append(map.getInfoText());
|
||||
MapSource mapSource = map.getMapSource();
|
||||
if (mapSource != null) {
|
||||
MapSourceLoaderInfo loaderInfo = map.getMapSource().getLoaderInfo();
|
||||
if (loaderInfo != null) {
|
||||
sw.append("\nMap type: " + loaderInfo.getLoaderType());
|
||||
if (loaderInfo.getSourceFile() != null)
|
||||
sw.append("\nMap implementation: " + loaderInfo.getSourceFile().getName());
|
||||
sw.append("\nMap revision: " + loaderInfo.getRevision());
|
||||
}
|
||||
}
|
||||
}
|
||||
return sw.toString();
|
||||
}
|
||||
|
||||
public MapInterface getMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.exceptions;
|
||||
|
||||
import mobac.program.AtlasThread;
|
||||
|
||||
/**
|
||||
* Thrown in {@link AtlasThread#createMap(mobac.program.interfaces.MapInterface)}
|
||||
* if the user chose to skip that map because of download problems.
|
||||
*/
|
||||
public class MapDownloadSkippedException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public MapDownloadSkippedException() {
|
||||
super();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.exceptions;
|
||||
|
||||
public class MapSourceCreateException extends Exception {
|
||||
|
||||
public MapSourceCreateException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public MapSourceCreateException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.exceptions;
|
||||
|
||||
public class MapSourceInitializationException extends Exception {
|
||||
|
||||
public MapSourceInitializationException() {
|
||||
}
|
||||
|
||||
public MapSourceInitializationException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public MapSourceInitializationException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public MapSourceInitializationException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.exceptions;
|
||||
|
||||
import mobac.mapsources.MapSourcesManager;
|
||||
|
||||
/**
|
||||
* Encapsulates several other exceptions that may occur while performing an
|
||||
* mapsources online update.
|
||||
*
|
||||
* @see MapSourcesManager#mapsourcesOnlineUpdate()
|
||||
*/
|
||||
public class MapSourcesUpdateException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public MapSourcesUpdateException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public MapSourcesUpdateException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.exceptions;
|
||||
|
||||
public class StopAllDownloadsException extends TileException {
|
||||
|
||||
public StopAllDownloadsException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public StopAllDownloadsException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.exceptions;
|
||||
|
||||
public class TileException extends Exception {
|
||||
|
||||
public TileException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public TileException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.exceptions;
|
||||
|
||||
import com.sleepycat.je.DatabaseException;
|
||||
|
||||
public class TileStoreException extends DatabaseException {
|
||||
|
||||
public TileStoreException(Throwable t) {
|
||||
super(t);
|
||||
}
|
||||
|
||||
public TileStoreException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public TileStoreException(String message, Throwable t) {
|
||||
super(message, t);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.exceptions;
|
||||
|
||||
/**
|
||||
* An {@link UnrecoverableDownloadException} indicates that there has been a
|
||||
* problem on client side that made it impossible to download a certain file
|
||||
* (usually a map tile image). Therefore the error is independent of the network
|
||||
* connection between client and server and the server itself.
|
||||
*/
|
||||
public class UnrecoverableDownloadException extends TileException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static int ERROR_CODE_NORMAL = 0;
|
||||
public static int ERROR_CODE_CONTENT_TYPE = 1;
|
||||
|
||||
private int errorCode = ERROR_CODE_NORMAL;
|
||||
|
||||
public UnrecoverableDownloadException(String message) {
|
||||
super(message);
|
||||
errorCode = ERROR_CODE_NORMAL;
|
||||
}
|
||||
|
||||
public UnrecoverableDownloadException(String message, int errorCode) {
|
||||
super(message);
|
||||
this.errorCode = errorCode;
|
||||
}
|
||||
|
||||
public int getErrorCode()
|
||||
{
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.exceptions;
|
||||
|
||||
public class UpdateFailedException extends Exception {
|
||||
|
||||
public UpdateFailedException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public UpdateFailedException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.externaltools;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.xml.bind.annotation.XmlList;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.program.model.MapSelection;
|
||||
import mobac.utilities.GUIExceptionHandler;
|
||||
import mobac.utilities.I18nUtils;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@XmlRootElement(name = "ExternalTool")
|
||||
public class ExternalToolDef implements ActionListener {
|
||||
|
||||
private static final Logger log = Logger.getLogger(ExternalToolDef.class);
|
||||
|
||||
/**
|
||||
* Name used for the menu entry in MOBAC
|
||||
*/
|
||||
public String name;
|
||||
|
||||
/**
|
||||
* For starting a commandline-script on Windows use <code>cmd /c start mybatch.cmd</code>
|
||||
*/
|
||||
public String command;
|
||||
|
||||
public boolean debug = false;
|
||||
|
||||
@XmlList
|
||||
public List<ToolParameters> parameters = new ArrayList<ToolParameters>();
|
||||
|
||||
private boolean mapSelNull(MapSelection mapSel) {
|
||||
if (mapSel != null)
|
||||
return false;
|
||||
JOptionPane.showMessageDialog(MainGUI.getMainGUI(),
|
||||
I18nUtils.localizedStringForKey("msg_tools_exec_error_selected_area"),
|
||||
I18nUtils.localizedStringForKey("Error"), JOptionPane.ERROR_MESSAGE);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
|
||||
String executeCommand = command;
|
||||
MainGUI gui = MainGUI.getMainGUI();
|
||||
MapSelection mapSel = gui.getMapSelectionCoordinates();
|
||||
int[] zooms = gui.getSelectedZoomLevels().getZoomLevels();
|
||||
for (ToolParameters param : parameters) {
|
||||
String add = "";
|
||||
switch (param) {
|
||||
case MAX_LAT:
|
||||
if (mapSelNull(mapSel))
|
||||
return;
|
||||
add = Double.toString(mapSel.getMax().lat);
|
||||
break;
|
||||
case MIN_LAT:
|
||||
if (mapSelNull(mapSel))
|
||||
return;
|
||||
add = Double.toString(mapSel.getMin().lat);
|
||||
break;
|
||||
case MAX_LON:
|
||||
if (mapSelNull(mapSel))
|
||||
return;
|
||||
add = Double.toString(mapSel.getMax().lon);
|
||||
break;
|
||||
case MIN_LON:
|
||||
if (mapSelNull(mapSel))
|
||||
return;
|
||||
add = Double.toString(mapSel.getMin().lon);
|
||||
break;
|
||||
case MAX_ZOOM:
|
||||
if (zooms.length == 0) {
|
||||
JOptionPane.showMessageDialog(gui,
|
||||
I18nUtils.localizedStringForKey("msg_no_zoom_level_selected"),
|
||||
I18nUtils.localizedStringForKey("Error"), JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
add = Integer.toString(zooms[zooms.length - 1]);
|
||||
break;
|
||||
case MIN_ZOOM:
|
||||
if (zooms.length == 0) {
|
||||
JOptionPane.showMessageDialog(gui,
|
||||
I18nUtils.localizedStringForKey("msg_no_zoom_level_selected"),
|
||||
I18nUtils.localizedStringForKey("Error"), JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
add = Integer.toString(zooms[0]);
|
||||
break;
|
||||
case MAPSOURCE_NAME:
|
||||
add = gui.previewMap.getMapSource().getName();
|
||||
break;
|
||||
case MAPSOURCE_DISPLAYNAME:
|
||||
add = gui.previewMap.getMapSource().toString();
|
||||
break;
|
||||
case NAME_EDITBOX:
|
||||
add = gui.getUserText();
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported parameter type: " + param);
|
||||
}
|
||||
if (add.indexOf(' ') >= 0)
|
||||
add = "\"" + add + "\"";
|
||||
executeCommand += " " + add;
|
||||
}
|
||||
if (debug) {
|
||||
int r = JOptionPane.showConfirmDialog(gui,
|
||||
String.format(I18nUtils.localizedStringForKey("msg_tools_exec_command_ask"), executeCommand),
|
||||
I18nUtils.localizedStringForKey("msg_tools_exec_command_ask_title"),
|
||||
JOptionPane.OK_CANCEL_OPTION);
|
||||
if (r != JOptionPane.OK_OPTION)
|
||||
return;
|
||||
}
|
||||
log.debug("Executing " + executeCommand);
|
||||
Runtime.getRuntime().exec(executeCommand);
|
||||
} catch (Exception e1) {
|
||||
GUIExceptionHandler.processException(e1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,116 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.externaltools;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Marshaller;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import mobac.program.DirectoryManager;
|
||||
import mobac.utilities.GUIExceptionHandler;
|
||||
import mobac.utilities.Utilities;
|
||||
import mobac.utilities.file.FileExtFilter;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
public class ExternalToolsLoader {
|
||||
|
||||
public static List<ExternalToolDef> tools = null;
|
||||
|
||||
static {
|
||||
load();
|
||||
}
|
||||
|
||||
public static boolean load() {
|
||||
try {
|
||||
File dir = DirectoryManager.toolsDir;
|
||||
if (!dir.isDirectory())
|
||||
return false;
|
||||
File[] files = dir.listFiles(new FileExtFilter(".xml"));
|
||||
tools = new LinkedList<ExternalToolDef>();
|
||||
for (File f : files) {
|
||||
tools.add(loadFile(f));
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
GUIExceptionHandler.showExceptionDialog("Failed to load external tools definition", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static ExternalToolDef loadFile(File f) throws JAXBException {
|
||||
JAXBContext context = JAXBContext.newInstance(ExternalToolDef.class);
|
||||
Unmarshaller unmarshaller = context.createUnmarshaller();
|
||||
InputStream is = null;
|
||||
try {
|
||||
is = new FileInputStream(f);
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
factory.setNamespaceAware(true);
|
||||
DocumentBuilder loader = factory.newDocumentBuilder();
|
||||
Document document = loader.parse(is);
|
||||
return (ExternalToolDef) unmarshaller.unmarshal(document);
|
||||
} catch (JAXBException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw new JAXBException(e);
|
||||
} finally {
|
||||
Utilities.closeStream(is);
|
||||
}
|
||||
}
|
||||
|
||||
public static void save(ExternalToolDef toolsDef, File f) throws JAXBException {
|
||||
JAXBContext context = JAXBContext.newInstance(ExternalToolDef.class);
|
||||
Marshaller marshaller = context.createMarshaller();
|
||||
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
|
||||
OutputStream os = null;
|
||||
try {
|
||||
os = new FileOutputStream(f);
|
||||
marshaller.marshal(toolsDef, os);
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new JAXBException(e);
|
||||
} finally {
|
||||
Utilities.closeStream(os);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void main(String[] args) {
|
||||
try {
|
||||
ExternalToolDef t = new ExternalToolDef();
|
||||
t.command = "command";
|
||||
t.name = "test";
|
||||
t.parameters.add(ToolParameters.MAX_LAT);
|
||||
t.parameters.add(ToolParameters.MAX_LON);
|
||||
t.parameters.add(ToolParameters.MIN_LAT);
|
||||
t.parameters.add(ToolParameters.MIN_LON);
|
||||
save(t, new File("tools/test.xml"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.externaltools;
|
||||
|
||||
public enum ToolParameters {
|
||||
|
||||
MAX_LAT, MIN_LAT, MAX_LON, MIN_LON, //
|
||||
MIN_ZOOM, MAX_ZOOM, // minimum and maximum of selected zoom levels check-boxes
|
||||
MAPSOURCE_NAME, MAPSOURCE_DISPLAYNAME, // Currently select map source internal or display name
|
||||
NAME_EDITBOX // content of the edit box "Name" in the side panel "Atlas Content"
|
||||
|
||||
}
|
|
@ -0,0 +1,751 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui;
|
||||
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import javax.swing.Box;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.ToolTipManager;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import mobac.program.AtlasThread;
|
||||
import mobac.program.Logging;
|
||||
import mobac.program.interfaces.AtlasInterface;
|
||||
import mobac.program.interfaces.LayerInterface;
|
||||
import mobac.program.interfaces.MapInterface;
|
||||
import mobac.program.interfaces.MapSourceListener;
|
||||
import mobac.program.model.AtlasOutputFormat;
|
||||
import mobac.program.model.Settings;
|
||||
import mobac.utilities.GBC;
|
||||
import mobac.utilities.GUIExceptionHandler;
|
||||
import mobac.utilities.I18nUtils;
|
||||
import mobac.utilities.OSUtilities;
|
||||
import mobac.utilities.Utilities;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* A window showing the progress while {@link AtlasThread} downloads and processes the map tiles.
|
||||
*
|
||||
*/
|
||||
public class AtlasProgress extends JFrame implements ActionListener, MapSourceListener {
|
||||
|
||||
private static Logger log = Logger.getLogger(AtlasProgress.class);
|
||||
|
||||
private static final long serialVersionUID = -1L;
|
||||
|
||||
private static final Timer TIMER = new Timer(true);
|
||||
|
||||
private JProgressBar atlasProgressBar;
|
||||
private JProgressBar mapDownloadProgressBar;
|
||||
private JProgressBar mapCreationProgressBar;
|
||||
|
||||
private Container background;
|
||||
|
||||
private long initialTotalTime;
|
||||
private long initialMapDownloadTime;
|
||||
|
||||
private static class Data {
|
||||
AtlasInterface atlasInterface;
|
||||
MapInterface map;
|
||||
MapInfo mapInfo;
|
||||
long numberOfDownloadedBytes = 0;
|
||||
long numberOfBytesLoadedFromCache = 0;
|
||||
int totalNumberOfTiles = 0;
|
||||
int totalNumberOfMaps = 0;
|
||||
int totalProgress = 0;
|
||||
int totalProgressTenthPercent = -1;
|
||||
int currentMapNumber = 0;
|
||||
int mapDownloadProgress = 0;
|
||||
int mapDownloadNumberOfTiles = 0;
|
||||
int mapCreationProgress = 0;
|
||||
int mapCreationMax = 0;
|
||||
int mapRetryErrors = 0;
|
||||
int mapPermanentErrors = 0;
|
||||
int prevMapsRetryErrors = 0;
|
||||
int prevMapsPermanentErrors = 0;
|
||||
boolean paused = false;
|
||||
}
|
||||
|
||||
private final Data data = new Data();
|
||||
|
||||
private boolean aborted = false;
|
||||
private boolean finished = false;
|
||||
|
||||
private JLabel windowTitle;
|
||||
|
||||
private JLabel title;
|
||||
private JLabel mapInfoLabel;
|
||||
private JLabel mapDownloadTitle;
|
||||
private JLabel atlasPercent;
|
||||
private JLabel mapDownloadPercent;
|
||||
private JLabel atlasMapsDone;
|
||||
private JLabel mapDownloadElementsDone;
|
||||
private JLabel atlasTimeLeft;
|
||||
private JLabel mapDownloadTimeLeft;
|
||||
private JLabel mapCreation;
|
||||
private JLabel nrOfDownloadedBytes;
|
||||
private JLabel nrOfDownloadedBytesValue;
|
||||
private JLabel nrOfDownloadedBytesPerSecond;
|
||||
private JLabel nrOfDownloadedBytesPerSecondValue;
|
||||
private JLabel nrOfCacheBytes;
|
||||
private JLabel nrOfCacheBytesValue;
|
||||
private JLabel activeDownloads;
|
||||
private JLabel activeDownloadsValue;
|
||||
private JLabel retryableDownloadErrors;
|
||||
private JLabel retryableDownloadErrorsValue;
|
||||
private JLabel permanentDownloadErrors;
|
||||
private JLabel permanentDownloadErrorsValue;
|
||||
private JLabel totalDownloadTime;
|
||||
private JLabel totalDownloadTimeValue;
|
||||
|
||||
private JCheckBox ignoreDlErrors;
|
||||
private JLabel statusLabel;
|
||||
|
||||
private JButton dismissWindowButton;
|
||||
private JButton openProgramFolderButton;
|
||||
private JButton abortAtlasCreationButton;
|
||||
private JButton pauseResumeDownloadButton;
|
||||
|
||||
private AtlasCreationController downloadControlListener = null;
|
||||
|
||||
private UpdateTask updateTask = null;
|
||||
private GUIUpdater guiUpdater = null;
|
||||
|
||||
private AtlasThread atlasThread;
|
||||
|
||||
private ArrayList<MapInfo> mapInfos = null;
|
||||
|
||||
private static String TEXT_MAP_DOWNLOAD = I18nUtils.localizedStringForKey("dlg_download_zoom_level_progress");
|
||||
private static String TEXT_PERCENT = I18nUtils.localizedStringForKey("dlg_download_done_percent");
|
||||
private static String TEXT_TENTHPERCENT = I18nUtils.localizedStringForKey("dlg_download_done_tenthpercent");
|
||||
|
||||
public AtlasProgress(AtlasThread atlasThread) {
|
||||
super(I18nUtils.localizedStringForKey("dlg_download_title"));
|
||||
this.atlasThread = atlasThread;
|
||||
ToolTipManager.sharedInstance().setDismissDelay(12000);
|
||||
if (MainGUI.getMainGUI() == null) // Atlas creation started via command-line, no MainGUi available
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
else
|
||||
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
|
||||
setIconImages(MainGUI.MOBAC_ICONS);
|
||||
setLayout(new GridBagLayout());
|
||||
updateTask = new UpdateTask();
|
||||
guiUpdater = new GUIUpdater();
|
||||
|
||||
createComponents();
|
||||
// Initialize the layout in respect to the layout (font size ...)
|
||||
pack();
|
||||
|
||||
guiUpdater.run();
|
||||
|
||||
// The layout is now initialized - we disable it because we don't want
|
||||
// want to the labels to jump around if the content changes.
|
||||
background.setLayout(null);
|
||||
setResizable(false);
|
||||
|
||||
Dimension dScreen = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
Dimension dContent = getSize();
|
||||
setLocation((dScreen.width - dContent.width) / 2, (dScreen.height - dContent.height) / 2);
|
||||
|
||||
initialTotalTime = System.currentTimeMillis();
|
||||
initialMapDownloadTime = System.currentTimeMillis();
|
||||
|
||||
addWindowListener(new CloseListener());
|
||||
}
|
||||
|
||||
private void createComponents() {
|
||||
background = new JPanel(new GridBagLayout());
|
||||
|
||||
windowTitle = new JLabel(I18nUtils.localizedStringForKey("dlg_download_window_title"));
|
||||
|
||||
title = new JLabel(I18nUtils.localizedStringForKey("dlg_download_map_progress"));
|
||||
|
||||
mapInfoLabel = new JLabel();
|
||||
|
||||
atlasMapsDone = new JLabel(I18nUtils.localizedStringForKey("dlg_download_map_done_count_default"));
|
||||
atlasPercent = new JLabel(String.format(TEXT_TENTHPERCENT, 100.0));
|
||||
atlasTimeLeft = new JLabel(I18nUtils.localizedStringForKey("dlg_download_remain_time_default"), JLabel.RIGHT);
|
||||
atlasProgressBar = new JProgressBar();
|
||||
|
||||
mapDownloadTitle = new JLabel(TEXT_MAP_DOWNLOAD + "000");
|
||||
mapDownloadElementsDone = new JLabel(I18nUtils.localizedStringForKey("dlg_download_tile_done_count_default"));
|
||||
mapDownloadPercent = new JLabel(String.format(TEXT_PERCENT, 100));
|
||||
mapDownloadTimeLeft = new JLabel(I18nUtils.localizedStringForKey("dlg_download_remain_time_default"),
|
||||
JLabel.RIGHT);
|
||||
mapDownloadProgressBar = new JProgressBar();
|
||||
|
||||
mapCreation = new JLabel(I18nUtils.localizedStringForKey("dlg_download_map_create_title"));
|
||||
mapCreationProgressBar = new JProgressBar();
|
||||
|
||||
nrOfDownloadedBytesPerSecond = new JLabel(I18nUtils.localizedStringForKey("dlg_download_avg_speed"));
|
||||
nrOfDownloadedBytesPerSecondValue = new JLabel();
|
||||
nrOfDownloadedBytes = new JLabel(I18nUtils.localizedStringForKey("dlg_download_total_bytes"));
|
||||
nrOfDownloadedBytesValue = new JLabel();
|
||||
nrOfCacheBytes = new JLabel(I18nUtils.localizedStringForKey("dlg_download_bytes_from_cache"));
|
||||
nrOfCacheBytesValue = new JLabel();
|
||||
|
||||
activeDownloads = new JLabel(I18nUtils.localizedStringForKey("dlg_download_thread_count"));
|
||||
activeDownloadsValue = new JLabel();
|
||||
retryableDownloadErrors = new JLabel(I18nUtils.localizedStringForKey("dlg_download_retry_count"));
|
||||
retryableDownloadErrors.setToolTipText(I18nUtils.localizedStringForKey("dlg_download_error_tips"));
|
||||
retryableDownloadErrorsValue = new JLabel();
|
||||
retryableDownloadErrorsValue.setToolTipText(retryableDownloadErrors.getToolTipText());
|
||||
permanentDownloadErrors = new JLabel(I18nUtils.localizedStringForKey("dlg_download_failed_count"));
|
||||
permanentDownloadErrors.setToolTipText(I18nUtils.localizedStringForKey("dlg_download_error_tips"));
|
||||
permanentDownloadErrorsValue = new JLabel();
|
||||
permanentDownloadErrorsValue.setToolTipText(permanentDownloadErrors.getToolTipText());
|
||||
totalDownloadTime = new JLabel(I18nUtils.localizedStringForKey("dlg_download_total_time"));
|
||||
totalDownloadTimeValue = new JLabel();
|
||||
|
||||
ignoreDlErrors = new JCheckBox(I18nUtils.localizedStringForKey("dlg_download_checkbox_ignore_error"),
|
||||
Settings.getInstance().ignoreDlErrors);
|
||||
statusLabel = new JLabel(I18nUtils.localizedStringForKey("dlg_download_status_title"));
|
||||
Font f = statusLabel.getFont();
|
||||
statusLabel.setFont(f.deriveFont(Font.BOLD));
|
||||
abortAtlasCreationButton = new JButton(I18nUtils.localizedStringForKey("dlg_download_btn_abort"));
|
||||
abortAtlasCreationButton.setToolTipText(I18nUtils.localizedStringForKey("dlg_download_btn_abort_tips"));
|
||||
dismissWindowButton = new JButton(I18nUtils.localizedStringForKey("dlg_download_btn_close_win"));
|
||||
dismissWindowButton.setToolTipText(I18nUtils.localizedStringForKey("dlg_download_btn_close_win_tips_disable"));
|
||||
dismissWindowButton.setVisible(false);
|
||||
openProgramFolderButton = new JButton(I18nUtils.localizedStringForKey("dlg_download_btn_open_folder"));
|
||||
openProgramFolderButton.setToolTipText(I18nUtils
|
||||
.localizedStringForKey("dlg_download_btn_open_folder_tips_disabled"));
|
||||
openProgramFolderButton.setEnabled(false);
|
||||
pauseResumeDownloadButton = new JButton(I18nUtils.localizedStringForKey("dlg_download_btn_pause_resume"));
|
||||
|
||||
GBC gbcRIF = GBC.std().insets(0, 0, 20, 0).fill(GBC.HORIZONTAL);
|
||||
GBC gbcEol = GBC.eol();
|
||||
GBC gbcEolFill = GBC.eol().fill(GBC.HORIZONTAL);
|
||||
GBC gbcEolFillI = GBC.eol().fill(GBC.HORIZONTAL).insets(0, 5, 0, 0);
|
||||
|
||||
// background.add(windowTitle, gbcEolFill);
|
||||
// background.add(Box.createVerticalStrut(10), gbcEol);
|
||||
|
||||
background.add(mapInfoLabel, gbcEolFill);
|
||||
background.add(Box.createVerticalStrut(20), gbcEol);
|
||||
|
||||
background.add(title, gbcRIF);
|
||||
background.add(atlasMapsDone, gbcRIF);
|
||||
background.add(atlasPercent, gbcRIF);
|
||||
background.add(atlasTimeLeft, gbcEolFill);
|
||||
background.add(atlasProgressBar, gbcEolFillI);
|
||||
background.add(Box.createVerticalStrut(20), gbcEol);
|
||||
|
||||
background.add(mapDownloadTitle, gbcRIF);
|
||||
background.add(mapDownloadElementsDone, gbcRIF);
|
||||
background.add(mapDownloadPercent, gbcRIF);
|
||||
background.add(mapDownloadTimeLeft, gbcEolFill);
|
||||
background.add(mapDownloadProgressBar, gbcEolFillI);
|
||||
background.add(Box.createVerticalStrut(20), gbcEol);
|
||||
|
||||
background.add(mapCreation, gbcEol);
|
||||
background.add(mapCreationProgressBar, gbcEolFillI);
|
||||
background.add(Box.createVerticalStrut(10), gbcEol);
|
||||
|
||||
JPanel infoPanel = new JPanel(new GridBagLayout());
|
||||
GBC gbci = GBC.std().insets(0, 3, 3, 3);
|
||||
infoPanel.add(nrOfDownloadedBytes, gbci);
|
||||
infoPanel.add(nrOfDownloadedBytesValue, gbci.toggleEol());
|
||||
infoPanel.add(nrOfCacheBytes, gbci.toggleEol());
|
||||
infoPanel.add(nrOfCacheBytesValue, gbci.toggleEol());
|
||||
infoPanel.add(nrOfDownloadedBytesPerSecond, gbci.toggleEol());
|
||||
infoPanel.add(nrOfDownloadedBytesPerSecondValue, gbci.toggleEol());
|
||||
infoPanel.add(activeDownloads, gbci.toggleEol());
|
||||
infoPanel.add(activeDownloadsValue, gbci.toggleEol());
|
||||
infoPanel.add(retryableDownloadErrors, gbci.toggleEol());
|
||||
infoPanel.add(retryableDownloadErrorsValue, gbci.toggleEol());
|
||||
infoPanel.add(permanentDownloadErrors, gbci.toggleEol());
|
||||
infoPanel.add(permanentDownloadErrorsValue, gbci.toggleEol());
|
||||
infoPanel.add(totalDownloadTime, gbci.toggleEol());
|
||||
infoPanel.add(totalDownloadTimeValue, gbci.toggleEol());
|
||||
|
||||
JPanel bottomPanel = new JPanel(new GridBagLayout());
|
||||
bottomPanel.add(infoPanel, GBC.std().gridheight(2).fillH());
|
||||
bottomPanel.add(ignoreDlErrors, GBC.eol().anchor(GBC.EAST));
|
||||
|
||||
bottomPanel.add(statusLabel, GBC.eol().anchor(GBC.CENTER));
|
||||
|
||||
GBC gbcRight = GBC.std().anchor(GBC.SOUTHEAST).insets(5, 0, 0, 0);
|
||||
bottomPanel.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL));
|
||||
bottomPanel.add(abortAtlasCreationButton, gbcRight);
|
||||
bottomPanel.add(dismissWindowButton, gbcRight);
|
||||
bottomPanel.add(pauseResumeDownloadButton, gbcRight);
|
||||
bottomPanel.add(openProgramFolderButton, gbcRight);
|
||||
|
||||
background.add(bottomPanel, gbcEolFillI);
|
||||
|
||||
JPanel borderPanel = new JPanel(new GridBagLayout());
|
||||
borderPanel.add(background, GBC.std().insets(10, 10, 10, 10).fill());
|
||||
|
||||
add(borderPanel, GBC.std().fill());
|
||||
|
||||
abortAtlasCreationButton.addActionListener(this);
|
||||
dismissWindowButton.addActionListener(this);
|
||||
openProgramFolderButton.addActionListener(this);
|
||||
pauseResumeDownloadButton.addActionListener(this);
|
||||
}
|
||||
|
||||
public void initAtlas(AtlasInterface atlasInterface) {
|
||||
data.atlasInterface = atlasInterface;
|
||||
if (atlasInterface.getOutputFormat().equals(AtlasOutputFormat.TILESTORE))
|
||||
data.totalNumberOfTiles = (int) atlasInterface.calculateTilesToDownload();
|
||||
else
|
||||
data.totalNumberOfTiles = (int) atlasInterface.calculateTilesToDownload() * 2;
|
||||
int mapCount = 0;
|
||||
int tileCount = 0;
|
||||
mapInfos = new ArrayList<MapInfo>(100);
|
||||
for (LayerInterface layer : atlasInterface) {
|
||||
mapCount += layer.getMapCount();
|
||||
for (MapInterface map : layer) {
|
||||
int before = tileCount;
|
||||
int mapTiles = (int) map.calculateTilesToDownload();
|
||||
tileCount += mapTiles + mapTiles;
|
||||
mapInfos.add(new MapInfo(map, before, tileCount));
|
||||
}
|
||||
}
|
||||
mapInfos.trimToSize();
|
||||
data.totalNumberOfMaps = mapCount;
|
||||
|
||||
initialTotalTime = System.currentTimeMillis();
|
||||
initialMapDownloadTime = -1;
|
||||
updateGUI();
|
||||
setVisible(true);
|
||||
TIMER.schedule(updateTask, 0, 500);
|
||||
}
|
||||
|
||||
public void initMapDownload(MapInterface map) {
|
||||
int index = mapInfos.indexOf(new MapInfo(map, 0, 0));
|
||||
data.mapInfo = mapInfos.get(index);
|
||||
data.totalProgress = data.mapInfo.tileCountOnStart;
|
||||
data.map = map;
|
||||
data.mapDownloadNumberOfTiles = (int) map.calculateTilesToDownload();
|
||||
initialMapDownloadTime = System.currentTimeMillis();
|
||||
data.prevMapsPermanentErrors += data.mapPermanentErrors;
|
||||
data.prevMapsRetryErrors += data.mapRetryErrors;
|
||||
data.mapCreationProgress = 0;
|
||||
data.mapDownloadProgress = 0;
|
||||
data.currentMapNumber = index + 1;
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the GUI progress bars
|
||||
*
|
||||
* @param maxTilesToProcess
|
||||
*/
|
||||
public void initMapCreation(int maxTilesToProcess) {
|
||||
data.mapCreationProgress = 0;
|
||||
data.mapCreationMax = maxTilesToProcess;
|
||||
initialMapDownloadTime = -1;
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
public void setErrorCounter(int retryErrors, int permanentErrors) {
|
||||
data.mapRetryErrors = retryErrors;
|
||||
data.mapPermanentErrors = permanentErrors;
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
public void incMapDownloadProgress() {
|
||||
data.mapDownloadProgress++;
|
||||
data.totalProgress++;
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
public void incMapCreationProgress() {
|
||||
setMapCreationProgress(data.mapCreationProgress + 1);
|
||||
}
|
||||
|
||||
public void incMapCreationProgress(int stepSize) {
|
||||
setMapCreationProgress(data.mapCreationProgress + stepSize);
|
||||
}
|
||||
|
||||
public void setMapCreationProgress(int progress) {
|
||||
data.mapCreationProgress = progress;
|
||||
data.totalProgress = data.mapInfo.tileCountOnStart + data.mapInfo.mapTiles
|
||||
+ (int) (((long) data.mapInfo.mapTiles) * data.mapCreationProgress / data.mapCreationMax);
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
public boolean ignoreDownloadErrors() {
|
||||
return ignoreDlErrors.isSelected();
|
||||
}
|
||||
|
||||
public void tileDownloaded(int size) {
|
||||
synchronized (data) {
|
||||
data.numberOfDownloadedBytes += size;
|
||||
}
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
public void tileLoadedFromCache(int size) {
|
||||
synchronized (data) {
|
||||
data.numberOfBytesLoadedFromCache += size;
|
||||
}
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
private String formatTime(long longSeconds) {
|
||||
String timeString = "";
|
||||
|
||||
if (longSeconds < 0) {
|
||||
timeString = I18nUtils.localizedStringForKey("dlg_download_time_unknown");
|
||||
} else {
|
||||
int minutes = (int) (longSeconds / 60);
|
||||
int seconds = (int) (longSeconds % 60);
|
||||
if (minutes > 0)
|
||||
timeString += Integer.toString(minutes)
|
||||
+ " "
|
||||
+ (minutes == 1 ? I18nUtils.localizedStringForKey("minute") : I18nUtils
|
||||
.localizedStringForKey("minutes")) + " ";
|
||||
timeString += Integer.toString(seconds)
|
||||
+ " "
|
||||
+ (seconds == 1 ? I18nUtils.localizedStringForKey("second") : I18nUtils
|
||||
.localizedStringForKey("seconds"));
|
||||
}
|
||||
return timeString;
|
||||
}
|
||||
|
||||
public void setZoomLevel(int theZoomLevel) {
|
||||
mapDownloadTitle.setText(TEXT_MAP_DOWNLOAD + Integer.toString(theZoomLevel));
|
||||
}
|
||||
|
||||
public void atlasCreationFinished() {
|
||||
finished = true;
|
||||
stopUpdateTask();
|
||||
forceUpdateGUI();
|
||||
downloadControlListener = null;
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
abortAtlasCreationButton.setEnabled(false);
|
||||
|
||||
if (aborted) {
|
||||
windowTitle.setText(I18nUtils.localizedStringForKey("dlg_download_abort_window_title"));
|
||||
setTitle(I18nUtils.localizedStringForKey("dlg_download_abort_title"));
|
||||
} else {
|
||||
windowTitle.setText(I18nUtils.localizedStringForKey("dlg_download_succeed_window_title"));
|
||||
setTitle(I18nUtils.localizedStringForKey("dlg_download_succeed_title"));
|
||||
}
|
||||
// mapInfoLabel.setText("");
|
||||
atlasMapsDone.setText(String.format(I18nUtils.localizedStringForKey("dlg_download_map_done_count"),
|
||||
data.currentMapNumber, data.totalNumberOfMaps));
|
||||
|
||||
abortAtlasCreationButton.setVisible(false);
|
||||
|
||||
dismissWindowButton.setToolTipText(I18nUtils
|
||||
.localizedStringForKey("dlg_download_btn_close_win_tips_enable"));
|
||||
dismissWindowButton.setVisible(true);
|
||||
|
||||
if (!aborted) {
|
||||
openProgramFolderButton.setToolTipText(I18nUtils
|
||||
.localizedStringForKey("dlg_download_btn_open_folder_tips_enabled"));
|
||||
openProgramFolderButton.setEnabled(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private synchronized void stopUpdateTask() {
|
||||
try {
|
||||
updateTask.cancel();
|
||||
updateTask = null;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
public void closeWindow() {
|
||||
try {
|
||||
stopUpdateTask();
|
||||
downloadControlListener = null;
|
||||
setVisible(false);
|
||||
} finally {
|
||||
dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public AtlasCreationController getDownloadControlListener() {
|
||||
return downloadControlListener;
|
||||
}
|
||||
|
||||
public void setDownloadControlerListener(AtlasCreationController threadControlListener) {
|
||||
this.downloadControlListener = threadControlListener;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
Object source = event.getSource();
|
||||
File atlasFolder = Settings.getInstance().getAtlasOutputDirectory();
|
||||
if (openProgramFolderButton.equals(source)) {
|
||||
try {
|
||||
OSUtilities.openFolderBrowser(atlasFolder);
|
||||
} catch (Exception e) {
|
||||
log.error("", e);
|
||||
}
|
||||
} else if (dismissWindowButton.equals(source)) {
|
||||
downloadControlListener = null;
|
||||
closeWindow();
|
||||
} else if (abortAtlasCreationButton.equals(source)) {
|
||||
aborted = true;
|
||||
stopUpdateTask();
|
||||
if (downloadControlListener != null)
|
||||
downloadControlListener.abortAtlasCreation();
|
||||
else
|
||||
closeWindow();
|
||||
} else if (pauseResumeDownloadButton.equals(source)) {
|
||||
if (downloadControlListener != null)
|
||||
downloadControlListener.pauseResumeAtlasCreation();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateGUI() {
|
||||
guiUpdater.updateAsynchronously();
|
||||
}
|
||||
|
||||
public void forceUpdateGUI() {
|
||||
SwingUtilities.invokeLater(guiUpdater);
|
||||
}
|
||||
|
||||
private class GUIUpdater implements Runnable {
|
||||
|
||||
int scheduledCounter = 0;
|
||||
|
||||
public void updateAsynchronously() {
|
||||
// If there is still at least one scheduled update request to be
|
||||
// executed we don't have add another one as this can result in an
|
||||
// to overloaded swing invocation queue.
|
||||
synchronized (this) {
|
||||
if (scheduledCounter > 0)
|
||||
return;
|
||||
scheduledCounter++;
|
||||
}
|
||||
SwingUtilities.invokeLater(this);
|
||||
}
|
||||
|
||||
public void run() {
|
||||
synchronized (this) {
|
||||
scheduledCounter--;
|
||||
}
|
||||
|
||||
if (data.map != null) {
|
||||
String text = String.format(I18nUtils.localizedStringForKey("dlg_download_map_info_label"),
|
||||
data.map.getName(), data.map.getLayer().getName(), data.map.getMapSource().toString());
|
||||
mapInfoLabel.setText(text);
|
||||
}
|
||||
|
||||
// atlas progress
|
||||
atlasProgressBar.setMaximum(data.totalNumberOfTiles);
|
||||
atlasProgressBar.setValue(data.totalProgress);
|
||||
|
||||
int newTenthPercent = (int) (data.totalProgress * 1000d / (double) data.totalNumberOfTiles);
|
||||
try {
|
||||
boolean pauseState = atlasThread.isPaused();
|
||||
String statusText = I18nUtils.localizedStringForKey("dlg_download_status_running");
|
||||
if (aborted)
|
||||
statusText = I18nUtils.localizedStringForKey("dlg_download_status_aborted");
|
||||
else if (finished)
|
||||
statusText = I18nUtils.localizedStringForKey("dlg_download_status_finished");
|
||||
else if (pauseState)
|
||||
statusText = I18nUtils.localizedStringForKey("dlg_download_status_paused");
|
||||
else
|
||||
statusText = I18nUtils.localizedStringForKey("dlg_download_status_running");
|
||||
statusLabel.setText(I18nUtils.localizedStringForKey("dlg_download_status_title") + " " + statusText);
|
||||
|
||||
if (data.totalProgressTenthPercent != newTenthPercent || pauseState != data.paused) {
|
||||
data.totalProgressTenthPercent = newTenthPercent;
|
||||
atlasPercent.setText(String.format(TEXT_TENTHPERCENT, data.totalProgressTenthPercent / 10.0));
|
||||
if (data.atlasInterface != null) {
|
||||
String text = String.format(I18nUtils.localizedStringForKey("dlg_download_atlas_progress"),
|
||||
data.totalProgressTenthPercent / 10, data.atlasInterface.getName(),
|
||||
data.atlasInterface.getOutputFormat());
|
||||
if (pauseState)
|
||||
text += " [" + I18nUtils.localizedStringForKey("dlg_download_status_paused") + "]";
|
||||
AtlasProgress.this.setTitle(text);
|
||||
}
|
||||
}
|
||||
data.paused = pauseState;
|
||||
} catch (NullPointerException e) {
|
||||
}
|
||||
|
||||
long seconds = -1;
|
||||
int totalProgress = data.totalProgress;
|
||||
if (totalProgress != 0) {
|
||||
// Avoid for a possible division by zero
|
||||
int totalTilesRemaining = data.totalNumberOfTiles - totalProgress;
|
||||
long totalElapsedTime = System.currentTimeMillis() - initialTotalTime;
|
||||
seconds = (totalElapsedTime * totalTilesRemaining / (1000L * totalProgress));
|
||||
}
|
||||
atlasTimeLeft.setText(String.format(I18nUtils.localizedStringForKey("dlg_download_remain_time"),
|
||||
formatTime(seconds)));
|
||||
|
||||
// layer progress
|
||||
mapDownloadProgressBar.setMaximum(data.mapDownloadNumberOfTiles);
|
||||
mapDownloadProgressBar.setValue(data.mapDownloadProgress);
|
||||
|
||||
mapDownloadPercent.setText(String.format(TEXT_PERCENT,
|
||||
(int) (mapDownloadProgressBar.getPercentComplete() * 100)));
|
||||
|
||||
mapDownloadElementsDone.setText(String.format(
|
||||
I18nUtils.localizedStringForKey("dlg_download_tile_done_count"), data.mapDownloadProgress,
|
||||
data.mapDownloadNumberOfTiles));
|
||||
|
||||
seconds = -1;
|
||||
int mapDlProgress = data.mapDownloadProgress;
|
||||
if (mapDlProgress != 0 && initialMapDownloadTime > 0)
|
||||
seconds = ((System.currentTimeMillis() - initialMapDownloadTime)
|
||||
* (data.mapDownloadNumberOfTiles - mapDlProgress) / (1000L * mapDlProgress));
|
||||
mapDownloadTimeLeft.setText(String.format(I18nUtils.localizedStringForKey("dlg_download_remain_time"),
|
||||
formatTime(seconds)));
|
||||
|
||||
// map progress
|
||||
mapCreation.setText(I18nUtils.localizedStringForKey("dlg_download_map_create_title"));
|
||||
mapCreationProgressBar.setValue(data.mapCreationProgress);
|
||||
mapCreationProgressBar.setMaximum(data.mapCreationMax);
|
||||
atlasMapsDone.setText(String.format(I18nUtils.localizedStringForKey("dlg_download_map_done_count"),
|
||||
(data.currentMapNumber - 1), data.totalNumberOfMaps));
|
||||
|
||||
// bytes per second
|
||||
long rate = data.numberOfDownloadedBytes * 1000;
|
||||
long time = System.currentTimeMillis() - initialMapDownloadTime;
|
||||
if (data.mapCreationProgress == 0 && initialMapDownloadTime > 0) {
|
||||
if (time == 0) {
|
||||
nrOfDownloadedBytesPerSecondValue.setText("??");
|
||||
} else {
|
||||
rate = rate / time;
|
||||
nrOfDownloadedBytesPerSecondValue.setText(String.format(
|
||||
I18nUtils.localizedStringForKey("dlg_download_avg_speed_value"),
|
||||
Utilities.formatBytes(rate)));
|
||||
}
|
||||
}
|
||||
|
||||
// downloaded bytes
|
||||
nrOfDownloadedBytesValue.setText(": " + Utilities.formatBytes(data.numberOfDownloadedBytes));
|
||||
nrOfCacheBytesValue.setText(": " + Utilities.formatBytes(data.numberOfBytesLoadedFromCache));
|
||||
|
||||
// total creation time
|
||||
long totalSeconds = (System.currentTimeMillis() - initialTotalTime) / 1000;
|
||||
totalDownloadTimeValue.setText(": " + formatTime(totalSeconds));
|
||||
totalDownloadTimeValue.repaint();
|
||||
|
||||
// active downloads
|
||||
int activeDownloads = (atlasThread == null) ? 0 : atlasThread.getActiveDownloads();
|
||||
activeDownloadsValue.setText(": " + activeDownloads);
|
||||
activeDownloadsValue.repaint();
|
||||
|
||||
int totalRetryableErrors = data.prevMapsRetryErrors + data.mapRetryErrors;
|
||||
retryableDownloadErrorsValue.setText(String.format(
|
||||
I18nUtils.localizedStringForKey("dlg_download_retry_count_value"), data.mapRetryErrors,
|
||||
totalRetryableErrors));
|
||||
retryableDownloadErrorsValue.repaint();
|
||||
int totalPermanentErrors = data.prevMapsPermanentErrors + data.mapPermanentErrors;
|
||||
permanentDownloadErrorsValue.setText(String.format(
|
||||
I18nUtils.localizedStringForKey("dlg_download_failed_count_value"), data.mapPermanentErrors,
|
||||
totalPermanentErrors));
|
||||
permanentDownloadErrorsValue.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
private class UpdateTask extends TimerTask {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
updateGUI();
|
||||
}
|
||||
}
|
||||
|
||||
private class CloseListener extends WindowAdapter {
|
||||
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
log.debug("Closing event detected for atlas progress window");
|
||||
AtlasCreationController listener = AtlasProgress.this.downloadControlListener;
|
||||
if (listener != null)
|
||||
listener.abortAtlasCreation();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected static class MapInfo {
|
||||
|
||||
final MapInterface map;
|
||||
final int tileCountOnStart;
|
||||
final int tileCountOnEnd;
|
||||
final int mapTiles;
|
||||
|
||||
public MapInfo(MapInterface map, int tileCountOnStart, int tileCountOnEnd) {
|
||||
super();
|
||||
this.map = map;
|
||||
this.tileCountOnStart = tileCountOnStart;
|
||||
this.tileCountOnEnd = tileCountOnEnd;
|
||||
this.mapTiles = (int) map.calculateTilesToDownload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return map.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof MapInfo))
|
||||
return false;
|
||||
return map.equals(((MapInfo) obj).map);
|
||||
}
|
||||
}
|
||||
|
||||
public static interface AtlasCreationController {
|
||||
|
||||
public void abortAtlasCreation();
|
||||
|
||||
public void pauseResumeAtlasCreation();
|
||||
|
||||
public boolean isPaused();
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Logging.configureLogging();
|
||||
GUIExceptionHandler.installToolkitEventQueueProxy();
|
||||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
} catch (Exception e) {
|
||||
log.error("The selection of look and feel failed!", e);
|
||||
}
|
||||
AtlasProgress ap = new AtlasProgress(null);
|
||||
ap.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
ap.setVisible(true);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,65 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.HeadlessException;
|
||||
import java.awt.Toolkit;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
|
||||
import mobac.utilities.Utilities;
|
||||
|
||||
public class SplashFrame extends JFrame {
|
||||
|
||||
private static SplashFrame startupFrame;
|
||||
|
||||
public static void showFrame() {
|
||||
startupFrame = new SplashFrame();
|
||||
}
|
||||
|
||||
public SplashFrame() throws HeadlessException {
|
||||
//super(MainGUI.localizedStringForKey("splash_title"));
|
||||
super("MOBAC");
|
||||
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
setUndecorated(true);
|
||||
setIconImages(MainGUI.MOBAC_ICONS);
|
||||
JLabel image = new JLabel(Utilities.loadResourceImageIcon("Splash.jpg"));
|
||||
image.setBorder(BorderFactory.createEtchedBorder());
|
||||
add(image);
|
||||
pack();
|
||||
setFocusable(false);
|
||||
Dimension dScreen = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
setLocation((dScreen.width - getWidth()) / 2, (dScreen.height - getHeight()) / 2);
|
||||
setSize(getMinimumSize());
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
public static void hideFrame() {
|
||||
if (startupFrame == null)
|
||||
return;
|
||||
startupFrame.setVisible(false);
|
||||
startupFrame.dispose();
|
||||
startupFrame = null;
|
||||
}
|
||||
|
||||
public static void main(String[] arg) {
|
||||
new SplashFrame();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,164 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.Polygon;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import mobac.data.gpx.gpx11.TrkType;
|
||||
import mobac.data.gpx.gpx11.TrksegType;
|
||||
import mobac.data.gpx.interfaces.GpxPoint;
|
||||
import mobac.exceptions.InvalidNameException;
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.gui.atlastree.JAtlasTree;
|
||||
import mobac.gui.gpxtree.GpxEntry;
|
||||
import mobac.gui.gpxtree.GpxRootEntry;
|
||||
import mobac.gui.gpxtree.TrkEntry;
|
||||
import mobac.gui.gpxtree.TrksegEntry;
|
||||
import mobac.program.interfaces.AtlasInterface;
|
||||
import mobac.program.interfaces.MapInterface;
|
||||
import mobac.program.interfaces.MapSource;
|
||||
import mobac.program.interfaces.MapSpace;
|
||||
import mobac.program.model.EastNorthCoordinate;
|
||||
import mobac.program.model.Layer;
|
||||
import mobac.program.model.MapPolygon;
|
||||
import mobac.program.model.SelectedZoomLevels;
|
||||
import mobac.program.model.Settings;
|
||||
import mobac.program.model.TileImageParameters;
|
||||
import mobac.utilities.I18nUtils;
|
||||
|
||||
public class AddGpxTrackAreaPolygonMap implements ActionListener {
|
||||
|
||||
public static final AddGpxTrackAreaPolygonMap INSTANCE = new AddGpxTrackAreaPolygonMap();
|
||||
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
MainGUI mg = MainGUI.getMainGUI();
|
||||
GpxEntry entry = mg.gpxPanel.getSelectedEntry();
|
||||
|
||||
if (entry == null)
|
||||
return;
|
||||
|
||||
TrksegType trk = null;
|
||||
TrkType t = null;
|
||||
if (entry instanceof TrksegEntry) {
|
||||
trk = ((TrksegEntry) entry).getTrkSeg();
|
||||
} else if (entry instanceof GpxRootEntry) {
|
||||
GpxRootEntry re = (GpxRootEntry) entry;
|
||||
List<TrkType> tlist = re.getLayer().getGpx().getTrk();
|
||||
if (tlist.size() > 1) {
|
||||
JOptionPane
|
||||
.showMessageDialog(mg, I18nUtils.localizedStringForKey("msg_add_gpx_polygon_too_many_track"));
|
||||
return;
|
||||
} else if (tlist.size() == 1)
|
||||
t = tlist.get(0);
|
||||
}
|
||||
if (entry instanceof TrkEntry)
|
||||
t = ((TrkEntry) entry).getTrk();
|
||||
if (t != null) {
|
||||
if (t.getTrkseg().size() > 1) {
|
||||
JOptionPane.showMessageDialog(mg,
|
||||
I18nUtils.localizedStringForKey("msg_add_gpx_polygon_too_many_segment"));
|
||||
return;
|
||||
} else if (t.getTrkseg().size() == 1)
|
||||
trk = t.getTrkseg().get(0);
|
||||
}
|
||||
if (trk == null) {
|
||||
JOptionPane.showMessageDialog(mg, I18nUtils.localizedStringForKey("msg_add_gpx_polygon_no_select"),
|
||||
I18nUtils.localizedStringForKey("Error"), JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
JAtlasTree jAtlasTree = mg.jAtlasTree;
|
||||
final String mapNameFmt = "%s %02d";
|
||||
AtlasInterface atlasInterface = jAtlasTree.getAtlas();
|
||||
String name = mg.getUserText();
|
||||
MapSource mapSource = mg.getSelectedMapSource();
|
||||
SelectedZoomLevels sZL = mg.getSelectedZoomLevels();
|
||||
int[] zoomLevels = sZL.getZoomLevels();
|
||||
if (zoomLevels.length == 0) {
|
||||
JOptionPane.showMessageDialog(mg, I18nUtils.localizedStringForKey("msg_no_zoom_level_selected"));
|
||||
return;
|
||||
}
|
||||
List<? extends GpxPoint> points = trk.getTrkpt();
|
||||
EastNorthCoordinate[] trackPoints = new EastNorthCoordinate[points.size()];
|
||||
EastNorthCoordinate minCoordinate = new EastNorthCoordinate(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
|
||||
EastNorthCoordinate maxCoordinate = new EastNorthCoordinate(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY);
|
||||
for (int i = 0; i < trackPoints.length; i++) {
|
||||
GpxPoint gpxPoint = points.get(i);
|
||||
EastNorthCoordinate c = new EastNorthCoordinate(gpxPoint.getLat().doubleValue(), gpxPoint.getLon()
|
||||
.doubleValue());
|
||||
minCoordinate.lat = Math.min(minCoordinate.lat, c.lat);
|
||||
minCoordinate.lon = Math.min(minCoordinate.lon, c.lon);
|
||||
maxCoordinate.lat = Math.max(maxCoordinate.lat, c.lat);
|
||||
maxCoordinate.lon = Math.max(maxCoordinate.lon, c.lon);
|
||||
trackPoints[i] = c;
|
||||
}
|
||||
|
||||
final int maxZoom = zoomLevels[zoomLevels.length - 1];
|
||||
final MapSpace mapSpace = mapSource.getMapSpace();
|
||||
|
||||
String layerName = name;
|
||||
int c = 1;
|
||||
Layer layer = null;
|
||||
boolean success = false;
|
||||
do {
|
||||
try {
|
||||
layer = new Layer(atlasInterface, layerName);
|
||||
success = true;
|
||||
} catch (InvalidNameException e) {
|
||||
layerName = name + "_" + Integer.toString(c++);
|
||||
}
|
||||
} while (!success);
|
||||
|
||||
TileImageParameters customTileParameters = mg.getSelectedTileImageParameters();
|
||||
|
||||
int[] xPoints = new int[trackPoints.length];
|
||||
int[] yPoints = new int[trackPoints.length];
|
||||
for (int i = 0; i < trackPoints.length; i++) {
|
||||
EastNorthCoordinate coord = trackPoints[i];
|
||||
xPoints[i] = mapSpace.cLonToX(coord.lon, maxZoom);
|
||||
yPoints[i] = mapSpace.cLatToY(coord.lat, maxZoom);
|
||||
}
|
||||
|
||||
Polygon p = new Polygon(xPoints, yPoints, xPoints.length);
|
||||
MapPolygon maxZoomMap = new MapPolygon(null, "Dummy", mapSource, maxZoom, p, customTileParameters);
|
||||
|
||||
int width = maxZoomMap.getMaxTileCoordinate().x - maxZoomMap.getMinTileCoordinate().x;
|
||||
int height = maxZoomMap.getMaxTileCoordinate().y - maxZoomMap.getMinTileCoordinate().y;
|
||||
if (Math.max(width, height) > Settings.getInstance().maxMapSize) {
|
||||
String msg = I18nUtils.localizedStringForKey("msg_add_gpx_polygon_maxsize");
|
||||
int result = JOptionPane.showConfirmDialog(mg, msg,
|
||||
I18nUtils.localizedStringForKey("msg_add_gpx_polygon_maxsize_title"), JOptionPane.YES_NO_OPTION,
|
||||
JOptionPane.QUESTION_MESSAGE);
|
||||
if (result != JOptionPane.YES_OPTION)
|
||||
return;
|
||||
}
|
||||
|
||||
for (int zoom : zoomLevels) {
|
||||
String mapName = String.format(mapNameFmt, new Object[] { layerName, zoom });
|
||||
MapInterface map = MapPolygon.createFromMapPolygon(layer, mapName, zoom, maxZoomMap);
|
||||
layer.addMap(map);
|
||||
}
|
||||
atlasInterface.addLayer(layer);
|
||||
mg.jAtlasTree.getTreeModel().notifyNodeInsert(layer);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,226 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Point;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import mobac.data.gpx.gpx11.TrkType;
|
||||
import mobac.data.gpx.gpx11.TrksegType;
|
||||
import mobac.data.gpx.interfaces.GpxPoint;
|
||||
import mobac.exceptions.InvalidNameException;
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.gui.atlastree.JAtlasTree;
|
||||
import mobac.gui.components.JDistanceSlider;
|
||||
import mobac.gui.gpxtree.GpxEntry;
|
||||
import mobac.gui.gpxtree.GpxRootEntry;
|
||||
import mobac.gui.gpxtree.TrkEntry;
|
||||
import mobac.gui.gpxtree.TrksegEntry;
|
||||
import mobac.gui.mapview.layer.MapAreaHighlightingLayer;
|
||||
import mobac.program.interfaces.AtlasInterface;
|
||||
import mobac.program.interfaces.MapInterface;
|
||||
import mobac.program.interfaces.MapSource;
|
||||
import mobac.program.interfaces.MapSpace;
|
||||
import mobac.program.model.EastNorthCoordinate;
|
||||
import mobac.program.model.Layer;
|
||||
import mobac.program.model.MapPolygon;
|
||||
import mobac.program.model.SelectedZoomLevels;
|
||||
import mobac.program.model.Settings;
|
||||
import mobac.program.model.TileImageParameters;
|
||||
import mobac.program.model.UnitSystem;
|
||||
import mobac.utilities.I18nUtils;
|
||||
|
||||
public class AddGpxTrackPolygonMap implements ActionListener {
|
||||
|
||||
public static final AddGpxTrackPolygonMap INSTANCE = new AddGpxTrackPolygonMap();
|
||||
|
||||
private MapAreaHighlightingLayer msl = null;
|
||||
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
final MainGUI mg = MainGUI.getMainGUI();
|
||||
GpxEntry entry = mg.gpxPanel.getSelectedEntry();
|
||||
|
||||
if (entry == null)
|
||||
return;
|
||||
|
||||
TrksegType trk = null;
|
||||
TrkType t = null;
|
||||
if (entry instanceof TrksegEntry) {
|
||||
trk = ((TrksegEntry) entry).getTrkSeg();
|
||||
} else if (entry instanceof GpxRootEntry) {
|
||||
GpxRootEntry re = (GpxRootEntry) entry;
|
||||
List<TrkType> tlist = re.getLayer().getGpx().getTrk();
|
||||
if (tlist.size() > 1) {
|
||||
JOptionPane
|
||||
.showMessageDialog(mg, I18nUtils.localizedStringForKey("msg_add_gpx_polygon_too_many_track"));
|
||||
return;
|
||||
} else if (tlist.size() == 1)
|
||||
t = tlist.get(0);
|
||||
}
|
||||
if (entry instanceof TrkEntry)
|
||||
t = ((TrkEntry) entry).getTrk();
|
||||
if (t != null) {
|
||||
if (t.getTrkseg().size() > 1) {
|
||||
JOptionPane.showMessageDialog(mg,
|
||||
I18nUtils.localizedStringForKey("msg_add_gpx_polygon_too_many_segment"));
|
||||
return;
|
||||
} else if (t.getTrkseg().size() == 1)
|
||||
trk = t.getTrkseg().get(0);
|
||||
}
|
||||
if (trk == null) {
|
||||
JOptionPane.showMessageDialog(mg, I18nUtils.localizedStringForKey("msg_add_gpx_polygon_no_select"),
|
||||
I18nUtils.localizedStringForKey("Error"), JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
JAtlasTree jAtlasTree = mg.jAtlasTree;
|
||||
final String mapNameFmt = "%s %02d";
|
||||
AtlasInterface atlasInterface = jAtlasTree.getAtlas();
|
||||
String name = mg.getUserText();
|
||||
final MapSource mapSource = mg.getSelectedMapSource();
|
||||
SelectedZoomLevels sZL = mg.getSelectedZoomLevels();
|
||||
int[] zoomLevels = sZL.getZoomLevels();
|
||||
if (zoomLevels.length == 0) {
|
||||
JOptionPane.showMessageDialog(mg, I18nUtils.localizedStringForKey("msg_no_zoom_level_selected"));
|
||||
return;
|
||||
}
|
||||
List<? extends GpxPoint> points = trk.getTrkpt();
|
||||
final EastNorthCoordinate[] trackPoints = new EastNorthCoordinate[points.size()];
|
||||
EastNorthCoordinate minCoordinate = new EastNorthCoordinate(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
|
||||
EastNorthCoordinate maxCoordinate = new EastNorthCoordinate(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY);
|
||||
for (int i = 0; i < trackPoints.length; i++) {
|
||||
GpxPoint gpxPoint = points.get(i);
|
||||
EastNorthCoordinate c = new EastNorthCoordinate(gpxPoint.getLat().doubleValue(), gpxPoint.getLon()
|
||||
.doubleValue());
|
||||
minCoordinate.lat = Math.min(minCoordinate.lat, c.lat);
|
||||
minCoordinate.lon = Math.min(minCoordinate.lon, c.lon);
|
||||
maxCoordinate.lat = Math.max(maxCoordinate.lat, c.lat);
|
||||
maxCoordinate.lon = Math.max(maxCoordinate.lon, c.lon);
|
||||
trackPoints[i] = c;
|
||||
}
|
||||
|
||||
final int maxZoom = zoomLevels[zoomLevels.length - 1];
|
||||
final MapSpace mapSpace = mapSource.getMapSpace();
|
||||
Point p1 = maxCoordinate.toTileCoordinate(mapSpace, maxZoom);
|
||||
Point p2 = minCoordinate.toTileCoordinate(mapSpace, maxZoom);
|
||||
|
||||
final int centerY = p1.y + ((p1.y - p2.y) / 2);
|
||||
|
||||
final UnitSystem unitSystem = Settings.getInstance().getUnitSystem();
|
||||
|
||||
final TileImageParameters customTileParameters = mg.getSelectedTileImageParameters();
|
||||
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
panel.setPreferredSize(new Dimension(300, 100));
|
||||
final JLabel label = new JLabel("");
|
||||
final JDistanceSlider slider = new JDistanceSlider(mapSource.getMapSpace(), maxZoom, centerY, unitSystem, 5,
|
||||
500);
|
||||
ChangeListener cl = new ChangeListener() {
|
||||
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
double d = mapSpace.horizontalDistance(maxZoom, centerY, slider.getValue());
|
||||
d *= unitSystem.earthRadius * unitSystem.unitFactor;
|
||||
String unitName = unitSystem.unitSmall;
|
||||
if (d > unitSystem.unitFactor) {
|
||||
d /= unitSystem.unitFactor;
|
||||
unitName = unitSystem.unitLarge;
|
||||
}
|
||||
label.setText(String.format(I18nUtils.localizedStringForKey("dlg_gpx_track_select_distance"),
|
||||
((int) d), unitName));
|
||||
}
|
||||
};
|
||||
final JButton previewButton = new JButton(I18nUtils.localizedStringForKey("dlg_gpx_track_select_preview"));
|
||||
previewButton.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
int distance = slider.getValue();
|
||||
MapPolygon maxZoomMap = MapPolygon.createTrackEnclosure(null, "Dummy", mapSource, maxZoom, trackPoints,
|
||||
distance, customTileParameters);
|
||||
if (msl != null)
|
||||
msl.setObject(maxZoomMap);
|
||||
msl = new MapAreaHighlightingLayer(maxZoomMap);
|
||||
mg.previewMap.repaint();
|
||||
}
|
||||
});
|
||||
|
||||
cl.stateChanged(null);
|
||||
slider.addChangeListener(cl);
|
||||
panel.add(label, BorderLayout.NORTH);
|
||||
panel.add(slider, BorderLayout.CENTER);
|
||||
panel.add(previewButton, BorderLayout.SOUTH);
|
||||
|
||||
int result = JOptionPane.showConfirmDialog(mg, panel,
|
||||
I18nUtils.localizedStringForKey("dlg_gpx_track_select_title"), JOptionPane.OK_CANCEL_OPTION);
|
||||
|
||||
if (msl != null) {
|
||||
mg.previewMap.mapLayers.remove(msl);
|
||||
msl.setObject(null);
|
||||
}
|
||||
|
||||
if (result != JOptionPane.OK_OPTION)
|
||||
return;
|
||||
|
||||
int distance = slider.getValue();
|
||||
MapPolygon maxZoomMap = MapPolygon.createTrackEnclosure(null, "Dummy", mapSource, maxZoom, trackPoints,
|
||||
distance, customTileParameters);
|
||||
|
||||
String layerName = name;
|
||||
int c = 1;
|
||||
Layer layer = null;
|
||||
boolean success = false;
|
||||
do {
|
||||
try {
|
||||
layer = new Layer(atlasInterface, layerName);
|
||||
success = true;
|
||||
} catch (InvalidNameException e) {
|
||||
layerName = name + "_" + Integer.toString(c++);
|
||||
}
|
||||
} while (!success);
|
||||
|
||||
int width = maxZoomMap.getMaxTileCoordinate().x - maxZoomMap.getMinTileCoordinate().x;
|
||||
int height = maxZoomMap.getMaxTileCoordinate().y - maxZoomMap.getMinTileCoordinate().y;
|
||||
if (Math.max(width, height) > Settings.getInstance().maxMapSize) {
|
||||
String msg = I18nUtils.localizedStringForKey("msg_add_gpx_polygon_maxsize");
|
||||
result = JOptionPane.showConfirmDialog(mg, msg,
|
||||
I18nUtils.localizedStringForKey("msg_add_gpx_polygon_maxsize_title"), JOptionPane.YES_NO_OPTION,
|
||||
JOptionPane.QUESTION_MESSAGE);
|
||||
if (result != JOptionPane.YES_OPTION)
|
||||
return;
|
||||
}
|
||||
|
||||
for (int zoom : zoomLevels) {
|
||||
String mapName = String.format(mapNameFmt, new Object[] { layerName, zoom });
|
||||
MapInterface map = MapPolygon.createFromMapPolygon(layer, mapName, zoom, maxZoomMap);
|
||||
layer.addMap(map);
|
||||
}
|
||||
atlasInterface.addLayer(layer);
|
||||
mg.jAtlasTree.getTreeModel().notifyNodeInsert(layer);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.gui.mapview.controller.AbstractPolygonSelectionMapController;
|
||||
import mobac.gui.mapview.controller.JMapController;
|
||||
import mobac.gui.mapview.controller.RectangleSelectionMapController;
|
||||
|
||||
public class AddMapLayer implements ActionListener {
|
||||
|
||||
public static final AddMapLayer INSTANCE = new AddMapLayer();
|
||||
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
JMapController msc = MainGUI.getMainGUI().previewMap.getMapSelectionController();
|
||||
if (msc instanceof RectangleSelectionMapController)
|
||||
new AddRectangleMapAutocut().actionPerformed(event);
|
||||
else if (msc instanceof AbstractPolygonSelectionMapController)
|
||||
new AddPolygonMapLayer().actionPerformed(event);
|
||||
else
|
||||
throw new RuntimeException("Unknown mapSelectionController type");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Polygon;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import mobac.exceptions.InvalidNameException;
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.gui.atlastree.JAtlasTree;
|
||||
import mobac.gui.mapview.JMapViewer;
|
||||
import mobac.gui.mapview.controller.AbstractPolygonSelectionMapController;
|
||||
import mobac.program.interfaces.AtlasInterface;
|
||||
import mobac.program.interfaces.MapSource;
|
||||
import mobac.program.interfaces.MapSpace;
|
||||
import mobac.program.model.Layer;
|
||||
import mobac.program.model.MapPolygon;
|
||||
import mobac.program.model.SelectedZoomLevels;
|
||||
import mobac.program.model.TileImageParameters;
|
||||
import mobac.utilities.I18nUtils;
|
||||
|
||||
public class AddPolygonMapLayer implements ActionListener {
|
||||
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
MainGUI mg = MainGUI.getMainGUI();
|
||||
|
||||
AbstractPolygonSelectionMapController msc = (AbstractPolygonSelectionMapController) mg.previewMap
|
||||
.getMapSelectionController();
|
||||
|
||||
JAtlasTree jAtlasTree = mg.jAtlasTree;
|
||||
final String mapNameFmt = "%s %02d";
|
||||
AtlasInterface atlasInterface = jAtlasTree.getAtlas();
|
||||
String name = mg.getUserText();
|
||||
MapSource mapSource = mg.getSelectedMapSource();
|
||||
MapSpace mapSpace = mapSource.getMapSpace();
|
||||
SelectedZoomLevels sZL = mg.getSelectedZoomLevels();
|
||||
|
||||
int[] zoomLevels = sZL.getZoomLevels();
|
||||
if (zoomLevels.length == 0) {
|
||||
JOptionPane.showMessageDialog(mg, I18nUtils.localizedStringForKey("msg_no_zoom_level_selected"));
|
||||
return;
|
||||
}
|
||||
|
||||
String layerName = name;
|
||||
Layer layer = null;
|
||||
int c = 1;
|
||||
boolean success = false;
|
||||
do {
|
||||
try {
|
||||
layer = new Layer(atlasInterface, layerName);
|
||||
success = true;
|
||||
} catch (InvalidNameException e) {
|
||||
layerName = name + "_" + Integer.toString(c++);
|
||||
}
|
||||
} while (!success);
|
||||
List<Point> polygonPoints = msc.getPolygonPoints();
|
||||
|
||||
for (int zoom : zoomLevels) {
|
||||
int xpoints[] = new int[polygonPoints.size()];
|
||||
int ypoints[] = new int[polygonPoints.size()];
|
||||
|
||||
for (int i = 0; i < xpoints.length; i++) {
|
||||
Point p = mapSpace.changeZoom(polygonPoints.get(i), JMapViewer.MAX_ZOOM, zoom);
|
||||
xpoints[i] = p.x;
|
||||
ypoints[i] = p.y;
|
||||
}
|
||||
TileImageParameters customTileParameters = mg.getSelectedTileImageParameters();
|
||||
Polygon polygon = new Polygon(xpoints, ypoints, xpoints.length);
|
||||
// Rectangle bounds = polygon.getBounds();
|
||||
// int maxMapSize = Settings.getInstance().maxMapSize;
|
||||
// System.out.println(bounds.height + " " + bounds.width);
|
||||
|
||||
String mapName = String.format(mapNameFmt, new Object[] { layerName, zoom });
|
||||
MapPolygon map = new MapPolygon(layer, mapName, mapSource, zoom, polygon, customTileParameters);
|
||||
layer.addMap(map);
|
||||
}
|
||||
atlasInterface.addLayer(layer);
|
||||
jAtlasTree.getTreeModel().notifyNodeInsert(layer);
|
||||
|
||||
msc.finishPolygon();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import mobac.exceptions.InvalidNameException;
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.gui.atlastree.JAtlasTree;
|
||||
import mobac.program.Logging;
|
||||
import mobac.program.interfaces.AtlasInterface;
|
||||
import mobac.program.interfaces.MapSource;
|
||||
import mobac.program.model.Layer;
|
||||
import mobac.program.model.MapSelection;
|
||||
import mobac.program.model.SelectedZoomLevels;
|
||||
import mobac.program.model.Settings;
|
||||
import mobac.program.model.TileImageParameters;
|
||||
import mobac.utilities.I18nUtils;
|
||||
|
||||
public class AddRectangleMapAutocut implements ActionListener {
|
||||
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
MainGUI mg = MainGUI.getMainGUI();
|
||||
JAtlasTree jAtlasTree = mg.jAtlasTree;
|
||||
final String mapNameFmt = "%s %02d";
|
||||
AtlasInterface atlasInterface = jAtlasTree.getAtlas();
|
||||
String name = mg.getUserText();
|
||||
MapSource mapSource = mg.getSelectedMapSource();
|
||||
SelectedZoomLevels sZL = mg.getSelectedZoomLevels();
|
||||
MapSelection ms = mg.getMapSelectionCoordinates();
|
||||
if (ms == null) {
|
||||
JOptionPane.showMessageDialog(mg, I18nUtils.localizedStringForKey("msg_no_select_area"));
|
||||
return;
|
||||
}
|
||||
Settings settings = Settings.getInstance();
|
||||
// String errorText = mg.validateInput();
|
||||
// if (errorText.length() > 0) {
|
||||
// JOptionPane.showMessageDialog(mg, errorText, "Errors", JOptionPane.ERROR_MESSAGE);
|
||||
// return;
|
||||
// }
|
||||
|
||||
int[] zoomLevels = sZL.getZoomLevels();
|
||||
if (zoomLevels.length == 0) {
|
||||
JOptionPane.showMessageDialog(mg, I18nUtils.localizedStringForKey("msg_no_zoom_level_selected"));
|
||||
return;
|
||||
}
|
||||
|
||||
String layerName = name;
|
||||
Layer layer = null;
|
||||
int c = 1;
|
||||
boolean success = false;
|
||||
do {
|
||||
try {
|
||||
layer = new Layer(atlasInterface, layerName);
|
||||
success = true;
|
||||
} catch (InvalidNameException e) {
|
||||
layerName = name + "_" + Integer.toString(c++);
|
||||
}
|
||||
} while (!success);
|
||||
for (int zoom : zoomLevels) {
|
||||
Point tl = ms.getTopLeftPixelCoordinate(zoom);
|
||||
Point br = ms.getBottomRightPixelCoordinate(zoom);
|
||||
TileImageParameters customTileParameters = mg.getSelectedTileImageParameters();
|
||||
try {
|
||||
String mapName = String.format(mapNameFmt, new Object[] { layerName, zoom });
|
||||
layer.addMapsAutocut(mapName, mapSource, tl, br, zoom, customTileParameters, settings.maxMapSize, settings.mapOverlapTiles);
|
||||
} catch (InvalidNameException e) {
|
||||
Logging.LOG.error("", e);
|
||||
}
|
||||
}
|
||||
atlasInterface.addLayer(layer);
|
||||
jAtlasTree.getTreeModel().notifyNodeInsert(layer);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.ListSelectionModel;
|
||||
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.program.model.AtlasOutputFormat;
|
||||
import mobac.utilities.I18nUtils;
|
||||
|
||||
public class AtlasConvert implements ActionListener {
|
||||
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
MainGUI mg = MainGUI.getMainGUI();
|
||||
JPanel panel = new JPanel();
|
||||
BorderLayout layout = new BorderLayout();
|
||||
layout.setVgap(4);
|
||||
panel.setLayout(layout);
|
||||
|
||||
JPanel formatPanel = new JPanel(new BorderLayout());
|
||||
|
||||
formatPanel.setPreferredSize(new Dimension(250, 300));
|
||||
|
||||
formatPanel.add(new JLabel(I18nUtils.localizedStringForKey("dlg_new_atlas_select_format_title")), BorderLayout.NORTH);
|
||||
JList atlasFormatList = new JList(AtlasOutputFormat.getFormatsAsVector());
|
||||
atlasFormatList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
JScrollPane scroller = new JScrollPane(atlasFormatList);
|
||||
scroller.setPreferredSize(new Dimension(100, 200));
|
||||
formatPanel.add(scroller, BorderLayout.CENTER);
|
||||
|
||||
panel.add(formatPanel, BorderLayout.CENTER);
|
||||
AtlasOutputFormat currentAOF = null;
|
||||
try {
|
||||
currentAOF = mg.getAtlas().getOutputFormat();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if (currentAOF != null)
|
||||
atlasFormatList.setSelectedValue(currentAOF, true);
|
||||
else
|
||||
atlasFormatList.setSelectedIndex(1);
|
||||
int result = JOptionPane.showConfirmDialog(MainGUI.getMainGUI(), panel, I18nUtils.localizedStringForKey("msg_convert_atlas_format"),
|
||||
JOptionPane.OK_CANCEL_OPTION);
|
||||
if (result != JOptionPane.OK_OPTION)
|
||||
return;
|
||||
|
||||
AtlasOutputFormat format = (AtlasOutputFormat) atlasFormatList.getSelectedValue();
|
||||
mg.jAtlasTree.convertAtlas(format);
|
||||
mg.getParametersPanel().atlasFormatChanged(format);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import mobac.exceptions.AtlasTestException;
|
||||
import mobac.gui.atlastree.JAtlasTree;
|
||||
import mobac.program.AtlasThread;
|
||||
import mobac.program.interfaces.AtlasInterface;
|
||||
import mobac.utilities.I18nUtils;
|
||||
|
||||
public class AtlasCreate implements ActionListener {
|
||||
|
||||
private JAtlasTree jAtlasTree;
|
||||
|
||||
public AtlasCreate(JAtlasTree jAtlasTree) {
|
||||
this.jAtlasTree = jAtlasTree;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
if (!jAtlasTree.testAtlasContentValid())
|
||||
return;
|
||||
try {
|
||||
// We have to work on a deep clone otherwise the user would be
|
||||
// able to modify settings of maps, layers and the atlas itself
|
||||
// while the AtlasThread works on that atlas reference
|
||||
AtlasInterface atlasToCreate = jAtlasTree.getAtlas().deepClone();
|
||||
Thread atlasThread = new AtlasThread(atlasToCreate);
|
||||
atlasThread.start();
|
||||
} catch (AtlasTestException e) {
|
||||
JOptionPane.showMessageDialog(null, "<html>" + e.getMessage() + "</html>",
|
||||
I18nUtils.localizedStringForKey("msg_convert_incompatible_format"), JOptionPane.ERROR_MESSAGE);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.ListSelectionModel;
|
||||
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.program.model.AtlasOutputFormat;
|
||||
import mobac.utilities.I18nUtils;
|
||||
|
||||
public class AtlasNew implements ActionListener {
|
||||
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
MainGUI mg = MainGUI.getMainGUI();
|
||||
JPanel panel = new JPanel();
|
||||
BorderLayout layout = new BorderLayout();
|
||||
layout.setVgap(4);
|
||||
panel.setLayout(layout);
|
||||
|
||||
JPanel formatPanel = new JPanel(new BorderLayout());
|
||||
|
||||
formatPanel.add(new JLabel(I18nUtils.localizedStringForKey("dlg_new_atlas_select_format_title")), BorderLayout.NORTH);
|
||||
JList atlasFormatList = new JList(AtlasOutputFormat.getFormatsAsVector());
|
||||
atlasFormatList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
JScrollPane scroller = new JScrollPane(atlasFormatList);
|
||||
scroller.setPreferredSize(new Dimension(140, 200));
|
||||
formatPanel.add(scroller, BorderLayout.CENTER);
|
||||
|
||||
JPanel namePanel = new JPanel(new BorderLayout());
|
||||
namePanel.add(new JLabel(I18nUtils.localizedStringForKey("dlg_new_atlas_name_title")), BorderLayout.NORTH);
|
||||
JTextField atlasName = new JTextField(I18nUtils.localizedStringForKey("dlg_new_atlas_default_atlas_name"));
|
||||
namePanel.add(atlasName, BorderLayout.SOUTH);
|
||||
|
||||
panel.add(namePanel, BorderLayout.NORTH);
|
||||
panel.add(formatPanel, BorderLayout.CENTER);
|
||||
panel.setPreferredSize(new Dimension(300, 300));
|
||||
AtlasOutputFormat currentAOF = null;
|
||||
try {
|
||||
currentAOF = mg.getAtlas().getOutputFormat();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if (currentAOF != null)
|
||||
atlasFormatList.setSelectedValue(currentAOF, true);
|
||||
else
|
||||
atlasFormatList.setSelectedIndex(1);
|
||||
int result = JOptionPane.showConfirmDialog(MainGUI.getMainGUI(), panel, I18nUtils.localizedStringForKey("dlg_new_atlas_title"),
|
||||
JOptionPane.OK_CANCEL_OPTION);
|
||||
if (result != JOptionPane.OK_OPTION)
|
||||
return;
|
||||
|
||||
AtlasOutputFormat format = (AtlasOutputFormat) atlasFormatList.getSelectedValue();
|
||||
mg.jAtlasTree.newAtlas(atlasName.getText(), format);
|
||||
mg.getParametersPanel().atlasFormatChanged(format);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.gui.mapview.PreviewMap;
|
||||
import mobac.program.model.Bookmark;
|
||||
import mobac.program.model.Settings;
|
||||
import mobac.utilities.I18nUtils;
|
||||
|
||||
public class BookmarkAdd implements ActionListener {
|
||||
|
||||
private final PreviewMap previewMap;
|
||||
|
||||
public BookmarkAdd(PreviewMap previewMap) {
|
||||
this.previewMap = previewMap;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
Bookmark bm = previewMap.getPositionBookmark();
|
||||
String name = JOptionPane.showInputDialog(I18nUtils.localizedStringForKey("dlg_add_bookmark_msg"), bm.toString());
|
||||
if (name == null)
|
||||
return;
|
||||
bm.setName(name);
|
||||
Settings.getInstance().placeBookmarks.add(bm);
|
||||
MainGUI.getMainGUI().updateBookmarksMenu();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.gui.dialogs.ManageBookmarks;
|
||||
|
||||
public class BookmarkManage implements ActionListener {
|
||||
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
ManageBookmarks mb = new ManageBookmarks(MainGUI.getMainGUI());
|
||||
mb.setModal(true);
|
||||
mb.setVisible(true);
|
||||
MainGUI.getMainGUI().updateBookmarksMenu();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
|
||||
import mobac.gui.MainGUI;
|
||||
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class DebugSetLogLevel implements ActionListener {
|
||||
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
Logger log = Logger.getRootLogger();
|
||||
JMenuItem menuItem = (JMenuItem) event.getSource();
|
||||
log.setLevel(Level.toLevel(menuItem.getName()));
|
||||
JMenu menu = MainGUI.getMainGUI().logLevelMenu;
|
||||
Component[] c = menu.getMenuComponents();
|
||||
for (int i = 0; i < c.length; i++) {
|
||||
((JMenuItem) c[i]).setSelected(c[i] == menuItem);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.Desktop;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.program.Logging;
|
||||
import mobac.utilities.GUIExceptionHandler;
|
||||
import mobac.utilities.I18nUtils;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class DebugShowLogFile implements ActionListener {
|
||||
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
Logger log = Logger.getLogger(DebugShowLogFile.class);
|
||||
String logFile = Logging.getLogFile();
|
||||
if (logFile == null) {
|
||||
log.error("No file logger configured");
|
||||
JOptionPane.showMessageDialog(MainGUI.getMainGUI(),
|
||||
I18nUtils.localizedStringForKey("msg_no_log_file_config"),
|
||||
I18nUtils.localizedStringForKey("Error"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
File f = new File(logFile);
|
||||
if (!f.isFile()) {
|
||||
log.error("Log file does not exists: " + f.getAbsolutePath());
|
||||
JOptionPane.showMessageDialog(MainGUI.getMainGUI(),
|
||||
String.format(I18nUtils.localizedStringForKey("msg_no_log_file"), f.getAbsolutePath()),
|
||||
I18nUtils.localizedStringForKey("Error"), JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Desktop.getDesktop().open(f);
|
||||
} catch (IOException e) {
|
||||
GUIExceptionHandler.processException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,130 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.mapsources.MapSourcesManager;
|
||||
import mobac.program.interfaces.MapSource;
|
||||
import mobac.program.model.MapSourceLoaderInfo;
|
||||
import mobac.utilities.I18nUtils;
|
||||
|
||||
public class DebugShowMapSourceNames implements ActionListener {
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ArrayList<MapSource> mapSources = new ArrayList<MapSource>(MapSourcesManager.getInstance()
|
||||
.getAllAvailableMapSources());
|
||||
|
||||
Collections.sort(mapSources, new Comparator<MapSource>() {
|
||||
|
||||
public int compare(MapSource o1, MapSource o2) {
|
||||
return o1.getName().compareTo(o2.getName());
|
||||
}
|
||||
|
||||
});
|
||||
JFrame dialog = new JFrame(I18nUtils.localizedStringForKey("dlg_show_source_title"));
|
||||
dialog.setLocationRelativeTo(MainGUI.getMainGUI());
|
||||
dialog.setLocation(100, 40);
|
||||
Dimension dScreen = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
dScreen.height -= 200;
|
||||
dScreen.width = Math.min(dScreen.width - 100, 700);
|
||||
dialog.setSize(dScreen);
|
||||
dialog.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
JTable mapSourcesTable = new JTable(new MapSourcesTableModel(mapSources));
|
||||
JScrollPane scroller = new JScrollPane(mapSourcesTable);
|
||||
|
||||
mapSourcesTable.getColumnModel().getColumn(2).setMaxWidth(100);
|
||||
dialog.add(scroller);
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
|
||||
static class MapSourcesTableModel extends AbstractTableModel {
|
||||
|
||||
List<MapSource> mapSources;
|
||||
|
||||
public MapSourcesTableModel(List<MapSource> mapSources) {
|
||||
super();
|
||||
this.mapSources = mapSources;
|
||||
}
|
||||
|
||||
public int getRowCount() {
|
||||
return mapSources.size();
|
||||
}
|
||||
|
||||
public int getColumnCount() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName(int column) {
|
||||
switch (column) {
|
||||
case 0:
|
||||
return I18nUtils.localizedStringForKey("dlg_show_source_column_name");
|
||||
case 1:
|
||||
return I18nUtils.localizedStringForKey("dlg_show_source_column_display_text");
|
||||
case 2:
|
||||
return I18nUtils.localizedStringForKey("dlg_show_source_column_rev");
|
||||
case 3:
|
||||
return I18nUtils.localizedStringForKey("dlg_show_source_column_type");
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
MapSource ms = mapSources.get(rowIndex);
|
||||
MapSourceLoaderInfo li;
|
||||
switch (columnIndex) {
|
||||
case 0:
|
||||
return ms.getName();
|
||||
case 1:
|
||||
return ms.toString();
|
||||
case 2:
|
||||
li = ms.getLoaderInfo();
|
||||
if (li == null)
|
||||
return null;
|
||||
return li.getRevision();
|
||||
case 3:
|
||||
li = ms.getLoaderInfo();
|
||||
if (li == null)
|
||||
return null;
|
||||
String s = "";
|
||||
File f = li.getSourceFile();
|
||||
if (f != null)
|
||||
s += f.getName() + " / ";
|
||||
return s + li.getLoaderType();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.gui.mapview.PreviewMap;
|
||||
|
||||
public class DebugShowMapTileGrid implements ActionListener {
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PreviewMap previewMap = MainGUI.getMainGUI().previewMap;
|
||||
previewMap.setTileGridVisible(!previewMap.isTileGridVisible());
|
||||
if (e.getSource() instanceof JCheckBoxMenuItem) {
|
||||
JCheckBoxMenuItem m = (JCheckBoxMenuItem) e.getSource();
|
||||
m.setSelected(previewMap.isTileGridVisible());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import mobac.utilities.GUIExceptionHandler;
|
||||
|
||||
public class DebugShowReport implements ActionListener {
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
GUIExceptionHandler.processException(null, null);
|
||||
// throw new RuntimeException("Test");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.gui.gpxtree.GpxEntry;
|
||||
import mobac.gui.mapview.PreviewMap;
|
||||
import mobac.gui.mapview.controller.GpxMapController;
|
||||
import mobac.gui.panels.JGpxPanel;
|
||||
import mobac.utilities.I18nUtils;
|
||||
|
||||
|
||||
|
||||
public class GpxAddPoint implements ActionListener {
|
||||
|
||||
JGpxPanel panel;
|
||||
|
||||
private GpxMapController mapController = null;
|
||||
|
||||
public GpxAddPoint(JGpxPanel panel) {
|
||||
super();
|
||||
this.panel = panel;
|
||||
}
|
||||
|
||||
public synchronized void actionPerformed(ActionEvent event) {
|
||||
GpxEntry entry = panel.getSelectedEntry();
|
||||
if (entry == null) {
|
||||
int answer = JOptionPane.showConfirmDialog(null,
|
||||
I18nUtils.localizedStringForKey("rp_gpx_msg_ask_create_new"),
|
||||
I18nUtils.localizedStringForKey("rp_gpx_msg_ask_create_new_title"),
|
||||
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
|
||||
if (answer != JOptionPane.YES_OPTION)
|
||||
return;
|
||||
entry = new GpxNew(panel).newGpx();
|
||||
}
|
||||
|
||||
if (!entry.isWaypointParent()) {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
I18nUtils.localizedStringForKey("rp_gpx_msg_add_point_failed"),
|
||||
I18nUtils.localizedStringForKey("Error"),
|
||||
JOptionPane.INFORMATION_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
PreviewMap map = MainGUI.getMainGUI().previewMap;
|
||||
map.getMapSelectionController().disable();
|
||||
if (mapController == null)
|
||||
mapController = new GpxMapController(map, panel, false);
|
||||
mapController.enable();
|
||||
}
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Iterator;
|
||||
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.gui.mapview.interfaces.MapLayer;
|
||||
import mobac.gui.mapview.layer.GpxLayer;
|
||||
import mobac.gui.panels.JGpxPanel;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Deletes all loaded {@link GpxLayer}s from the main map viewer.
|
||||
*
|
||||
*/
|
||||
public class GpxClear implements ActionListener {
|
||||
|
||||
JGpxPanel panel;
|
||||
|
||||
public GpxClear(JGpxPanel panel) {
|
||||
super();
|
||||
this.panel = panel;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Iterator<MapLayer> mapLayers = MainGUI.getMainGUI().previewMap.mapLayers.iterator();
|
||||
while (mapLayers.hasNext()) {
|
||||
if (mapLayers.next() instanceof GpxLayer)
|
||||
mapLayers.remove();
|
||||
}
|
||||
panel.resetModel();
|
||||
MainGUI.getMainGUI().previewMap.repaint();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,131 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
|
||||
import mobac.data.gpx.gpx11.Gpx;
|
||||
import mobac.data.gpx.gpx11.RteType;
|
||||
import mobac.data.gpx.gpx11.TrkType;
|
||||
import mobac.data.gpx.gpx11.TrksegType;
|
||||
import mobac.data.gpx.gpx11.WptType;
|
||||
import mobac.gui.gpxtree.GpxEntry;
|
||||
import mobac.gui.gpxtree.RteEntry;
|
||||
import mobac.gui.gpxtree.TrkEntry;
|
||||
import mobac.gui.gpxtree.TrksegEntry;
|
||||
|
||||
/**
|
||||
* Encapsulates all functionality regarding edits of loaded gpx files.
|
||||
*
|
||||
* @author lhoeppner
|
||||
*
|
||||
*/
|
||||
public class GpxEditor {
|
||||
private static GpxEditor editor = null;
|
||||
|
||||
public static GpxEditor getInstance() {
|
||||
if (editor == null) {
|
||||
editor = new GpxEditor();
|
||||
}
|
||||
return editor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a wpt to the selected route.
|
||||
*
|
||||
* @param entry
|
||||
* @param wpt
|
||||
*/
|
||||
public void findRteAndAdd(RteEntry entry, WptType wpt) {
|
||||
List<RteType> rtes = entry.getLayer().getGpx().getRte();
|
||||
RteType rteParent = (entry).getRte();
|
||||
for (RteType rte : rtes) {
|
||||
if (rte.equals(rteParent)) {
|
||||
rte.getRtept().add(wpt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a wpt to the selected track segment.
|
||||
*
|
||||
* @param entry
|
||||
* @param wpt
|
||||
*/
|
||||
public void findTrksegAndAdd(TrksegEntry entry, WptType wpt) {
|
||||
// get the track the selected track segment belongs to
|
||||
DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) entry.getNode().getParent();
|
||||
TrkEntry trkParent = (TrkEntry) parentNode.getUserObject();
|
||||
|
||||
// get the selected track segment
|
||||
TrksegType trksegParent = entry.getTrkSeg();
|
||||
List<TrksegType> trksegs = trkParent.getTrk().getTrkseg();
|
||||
|
||||
for (TrksegType trkseg : trksegs) {
|
||||
if (trkseg.equals(trksegParent)) {
|
||||
trkseg.getTrkpt().add(wpt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a waypoint from the Gpx assigned to the layer.
|
||||
*
|
||||
* @param wpt
|
||||
* - the node to be removed
|
||||
* @return - true if wpt found and deleted, false otherwise
|
||||
*/
|
||||
public boolean findWptAndDelete(WptType wpt, GpxEntry gpxEntry) {
|
||||
Gpx gpx = gpxEntry.getLayer().getGpx();
|
||||
// wpts
|
||||
List<WptType> wpts = gpx.getWpt();
|
||||
for (WptType currentWpt : wpts) {
|
||||
if (currentWpt.equals(wpt)) {
|
||||
wpts.remove(currentWpt);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// trks
|
||||
List<TrkType> trks = gpx.getTrk();
|
||||
for (TrkType currentTrk : trks) {
|
||||
List<TrksegType> trksegs = currentTrk.getTrkseg();
|
||||
for (TrksegType currentTrkseg : trksegs) {
|
||||
wpts = currentTrkseg.getTrkpt();
|
||||
for (WptType currentWpt : wpts) {
|
||||
if (currentWpt.equals(wpt)) {
|
||||
wpts.remove(currentWpt);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// rtes
|
||||
List<RteType> rtes = gpx.getRte();
|
||||
for (RteType currentRte : rtes) {
|
||||
wpts = currentRte.getRtept();
|
||||
for (WptType currentWpt : wpts) {
|
||||
if (currentWpt.equals(wpt)) {
|
||||
wpts.remove(currentWpt);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false; // if the node wasn't found
|
||||
}
|
||||
}
|
|
@ -0,0 +1,169 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import mobac.data.gpx.gpx11.WptType;
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.gui.gpxtree.GpxEntry;
|
||||
import mobac.gui.gpxtree.GpxRootEntry;
|
||||
import mobac.gui.gpxtree.RteEntry;
|
||||
import mobac.gui.gpxtree.TrkEntry;
|
||||
import mobac.gui.gpxtree.TrksegEntry;
|
||||
import mobac.gui.gpxtree.WptEntry;
|
||||
import mobac.gui.mapview.PreviewMap;
|
||||
import mobac.gui.mapview.controller.GpxMapController;
|
||||
import mobac.utilities.I18nUtils;
|
||||
|
||||
/**
|
||||
* Listener for the gpx editor tree elements.
|
||||
*
|
||||
* @author lhoeppner
|
||||
* @author r_x
|
||||
*
|
||||
*/
|
||||
public class GpxElementListener implements MouseListener {
|
||||
|
||||
public static final String MENU_NAME_RENAME = I18nUtils.localizedStringForKey("rp_gpx_menu_rename");
|
||||
public static final String MENU_NAME_DELETE = I18nUtils.localizedStringForKey("rp_gpx_menu_delete");
|
||||
|
||||
private final GpxEntry gpxEntry;
|
||||
|
||||
private GpxMapController mapController = null;
|
||||
private GpxEditor editor = GpxEditor.getInstance();
|
||||
|
||||
public GpxElementListener(GpxEntry gpxEntry) {
|
||||
this.gpxEntry = gpxEntry;
|
||||
}
|
||||
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
}
|
||||
|
||||
public void mouseExited(MouseEvent e) {
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
handleClick(e);
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
handleClick(e);
|
||||
}
|
||||
|
||||
private void handleClick(MouseEvent e) {
|
||||
JMenuItem item = (JMenuItem) e.getSource();
|
||||
if (item == null)
|
||||
return;
|
||||
if (MENU_NAME_RENAME.equals(item.getName())) {
|
||||
renameEntry();
|
||||
} else if (MENU_NAME_DELETE.equals(item.getName())) {
|
||||
removeEntry();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an entry (wpt, trk, trkseg, rte) from a gpx file (and the displayed layer) Currently only works for
|
||||
* waypoints.
|
||||
*
|
||||
*/
|
||||
private void removeEntry() {
|
||||
int answer = JOptionPane.showConfirmDialog(null,
|
||||
I18nUtils.localizedStringForKey("rp_gpx_msg_confim_delete"),
|
||||
I18nUtils.localizedStringForKey("rp_gpx_msg_confim_delete_title"),
|
||||
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
|
||||
if (answer == JOptionPane.YES_OPTION) {
|
||||
PreviewMap map = MainGUI.getMainGUI().previewMap;
|
||||
map.getMapSelectionController().disable();
|
||||
if (mapController == null)
|
||||
mapController = new GpxMapController(map, gpxEntry.getLayer().getPanel(), false);
|
||||
mapController.enable();
|
||||
|
||||
if (gpxEntry.getClass().equals(RteEntry.class)) {
|
||||
// RteEntry rte = (RteEntry) gpxEntry;
|
||||
|
||||
} else if (gpxEntry.getClass().equals(TrkEntry.class)) {
|
||||
// TrkEntry trk = (TrkEntry) gpxEntry;
|
||||
|
||||
} else if (gpxEntry.getClass().equals(WptEntry.class)) {
|
||||
WptEntry wptEntry = (WptEntry) gpxEntry;
|
||||
WptType wpt = wptEntry.getWpt();
|
||||
editor.findWptAndDelete(wpt, gpxEntry);
|
||||
wptEntry.getLayer().getPanel().removeWpt(wptEntry);
|
||||
mapController.repaint();
|
||||
} else if (gpxEntry.getClass().equals(GpxRootEntry.class)) {
|
||||
// GpxRootEntry root = (GpxRootEntry) gpxEntry;
|
||||
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renames (if possible) the entry according to user input.
|
||||
*
|
||||
*/
|
||||
private void renameEntry() {
|
||||
if (gpxEntry.getClass().equals(TrksegEntry.class)) {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
I18nUtils.localizedStringForKey("rp_gpx_msg_can_not_rename_track"),
|
||||
I18nUtils.localizedStringForKey("Error"),
|
||||
JOptionPane.INFORMATION_MESSAGE);
|
||||
return;
|
||||
} else {
|
||||
if (gpxEntry.getClass().equals(RteEntry.class)) {
|
||||
RteEntry rte = (RteEntry) gpxEntry;
|
||||
String name = JOptionPane.showInputDialog(null, I18nUtils.localizedStringForKey("rp_gpx_rename_element_title"),
|
||||
rte.getRte().getName());
|
||||
if (name == null) {
|
||||
return;
|
||||
}
|
||||
rte.getRte().setName(name);
|
||||
} else if (gpxEntry.getClass().equals(TrkEntry.class)) {
|
||||
TrkEntry trk = (TrkEntry) gpxEntry;
|
||||
String name = JOptionPane.showInputDialog(null, I18nUtils.localizedStringForKey("rp_gpx_rename_element_title"), trk.getTrk().getName());
|
||||
if (name == null) {
|
||||
return;
|
||||
}
|
||||
trk.getTrk().setName(name);
|
||||
} else if (gpxEntry.getClass().equals(WptEntry.class)) {
|
||||
WptEntry wpt = (WptEntry) gpxEntry;
|
||||
String name = JOptionPane.showInputDialog(null, I18nUtils.localizedStringForKey("rp_gpx_rename_element_title"), wpt.getWpt().getName());
|
||||
if (name == null) {
|
||||
return;
|
||||
}
|
||||
wpt.getWpt().setName(name);
|
||||
} else if (gpxEntry.getClass().equals(GpxRootEntry.class)) {
|
||||
GpxRootEntry root = (GpxRootEntry) gpxEntry;
|
||||
String initialValue = root.getMetaDataName();
|
||||
String name = JOptionPane.showInputDialog(null, I18nUtils.localizedStringForKey("rp_gpx_rename_element_title"), initialValue);
|
||||
if (name == null) {
|
||||
return;
|
||||
}
|
||||
root.setMetaDataName(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,173 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.WindowConstants;
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import mobac.data.gpx.GPXUtils;
|
||||
import mobac.data.gpx.gpx11.Gpx;
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.gui.mapview.layer.GpxLayer;
|
||||
import mobac.gui.panels.JGpxPanel;
|
||||
import mobac.program.model.Settings;
|
||||
import mobac.utilities.I18nUtils;
|
||||
import mobac.utilities.file.GpxFileFilter;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class GpxLoad implements ActionListener {
|
||||
|
||||
private Logger log = Logger.getLogger(GpxLoad.class);
|
||||
|
||||
JGpxPanel panel;
|
||||
|
||||
public GpxLoad(JGpxPanel panel) {
|
||||
super();
|
||||
this.panel = panel;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
if (!GPXUtils.checkJAXBVersion())
|
||||
return;
|
||||
JFileChooser fc = new JFileChooser();
|
||||
try {
|
||||
File dir = new File(Settings.getInstance().gpxFileChooserDir);
|
||||
fc.setCurrentDirectory(dir); // restore the saved directory
|
||||
} catch (Exception e) {
|
||||
}
|
||||
fc.setMultiSelectionEnabled(true);
|
||||
fc.addChoosableFileFilter(new GpxFileFilter(false));
|
||||
final MainGUI mainGUI = MainGUI.getMainGUI();
|
||||
int returnVal = fc.showOpenDialog(mainGUI);
|
||||
if (returnVal != JFileChooser.APPROVE_OPTION)
|
||||
return;
|
||||
Settings.getInstance().gpxFileChooserDir = fc.getCurrentDirectory().getAbsolutePath();
|
||||
|
||||
File[] f = fc.getSelectedFiles();
|
||||
|
||||
// check already opened gpx files
|
||||
boolean duplicates = false;
|
||||
for (File selectedFile : f) {
|
||||
duplicates = panel.isFileOpen(selectedFile.getAbsolutePath());
|
||||
if (duplicates)
|
||||
break;
|
||||
}
|
||||
if (duplicates) {
|
||||
int answer = JOptionPane
|
||||
.showConfirmDialog(mainGUI, I18nUtils.localizedStringForKey("rp_gpx_msg_confirm_reopen_file"),
|
||||
I18nUtils.localizedStringForKey("Warning"), JOptionPane.YES_NO_OPTION,
|
||||
JOptionPane.QUESTION_MESSAGE);
|
||||
if (answer != JOptionPane.YES_OPTION)
|
||||
return;
|
||||
}
|
||||
|
||||
// process
|
||||
if (f.length > 1) {
|
||||
doMultiLoad(f, mainGUI);
|
||||
} else if (f.length == 1) {
|
||||
doLoad(f[0], mainGUI);
|
||||
}
|
||||
mainGUI.previewMap.refreshMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param f
|
||||
*/
|
||||
private void doLoad(File f, Component parent) {
|
||||
try {
|
||||
Gpx gpx = GPXUtils.loadGpxFile(f);
|
||||
GpxLayer gpxLayer = new GpxLayer(gpx);
|
||||
gpxLayer.setFile(f);
|
||||
panel.addGpxLayer(gpxLayer);
|
||||
} catch (JAXBException e) {
|
||||
JOptionPane.showMessageDialog(parent, "<html>Unable to load the GPX file <br><i>" + f.getAbsolutePath()
|
||||
+ "</i><br><br><b>Please make sure the file is a valid GPX v1.1 file.</b><br>"
|
||||
+ "<br>Internal error message:<br>" + e.getMessage() + "</html>", "GPX loading failed",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void doMultiLoad(final File[] files, final MainGUI mainGUI) {
|
||||
final JDialog progressDialog = new JDialog(mainGUI);
|
||||
// prepare progress dialog
|
||||
progressDialog.setSize(400, 50);
|
||||
progressDialog.setResizable(false);
|
||||
progressDialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
||||
progressDialog.setLocation(
|
||||
Math.max(0, (int) (mainGUI.getLocation().getX() + mainGUI.getSize().getWidth() / 2 - 200)),
|
||||
Math.max(0, (int) (mainGUI.getLocation().getY() + mainGUI.getSize().getHeight() / 2 - 25)));
|
||||
final JProgressBar progressBar = new JProgressBar(0, files.length);
|
||||
progressDialog.add(progressBar);
|
||||
|
||||
mainGUI.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
mainGUI.setEnabled(false);
|
||||
progressDialog.setVisible(true);
|
||||
|
||||
Thread job = new Thread() {
|
||||
|
||||
private int counter = 0;
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
// iterate over files to load
|
||||
for (final File file : files) {
|
||||
counter++;
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
progressBar.setValue(counter);
|
||||
progressDialog.setTitle("Processing " + counter + " of " + files.length + " <"
|
||||
+ file.getName() + ">");
|
||||
}
|
||||
});
|
||||
doLoad(file, progressDialog);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
} finally {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
// close progress dialog
|
||||
mainGUI.previewMap.repaint();
|
||||
mainGUI.setCursor(Cursor.getDefaultCursor());
|
||||
if (progressDialog != null) {
|
||||
progressDialog.setVisible(false);
|
||||
progressDialog.dispose();
|
||||
}
|
||||
mainGUI.setEnabled(true);
|
||||
mainGUI.toFront();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
job.start();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import mobac.data.gpx.GPXUtils;
|
||||
import mobac.data.gpx.gpx11.Gpx;
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.gui.gpxtree.GpxRootEntry;
|
||||
import mobac.gui.mapview.layer.GpxLayer;
|
||||
import mobac.gui.panels.JGpxPanel;
|
||||
//import mobac.gui.panels.JGpxPanel.ListModelEntry;
|
||||
|
||||
|
||||
public class GpxNew implements ActionListener {
|
||||
|
||||
JGpxPanel panel;
|
||||
|
||||
public GpxNew(JGpxPanel panel) {
|
||||
super();
|
||||
this.panel = panel;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
if (!GPXUtils.checkJAXBVersion())
|
||||
return;
|
||||
newGpx();
|
||||
MainGUI.getMainGUI().previewMap.repaint();
|
||||
}
|
||||
|
||||
public GpxRootEntry newGpx() {
|
||||
Gpx gpx = Gpx.createGpx();
|
||||
GpxLayer gpxLayer = new GpxLayer(gpx);
|
||||
return panel.addGpxLayer(gpxLayer);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import mobac.data.gpx.GPXUtils;
|
||||
import mobac.data.gpx.gpx11.Gpx;
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.gui.gpxtree.GpxEntry;
|
||||
import mobac.gui.panels.JGpxPanel;
|
||||
import mobac.program.model.Settings;
|
||||
import mobac.utilities.I18nUtils;
|
||||
import mobac.utilities.file.GpxFileFilter;
|
||||
|
||||
|
||||
public class GpxSave implements ActionListener {
|
||||
|
||||
private JGpxPanel panel;
|
||||
private boolean saveAs;
|
||||
|
||||
public GpxSave(JGpxPanel panel) {
|
||||
this(panel, false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param panel
|
||||
* @param saveAs
|
||||
* if true a file chooser dialog is displayed where the user can
|
||||
* change the filename
|
||||
*/
|
||||
public GpxSave(JGpxPanel panel, boolean saveAs) {
|
||||
super();
|
||||
this.panel = panel;
|
||||
this.saveAs = saveAs;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
|
||||
GpxEntry entry = panel.getSelectedEntry();
|
||||
if (entry == null) {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
I18nUtils.localizedStringForKey("rp_gpx_msg_error_save_gpx_file"),
|
||||
I18nUtils.localizedStringForKey("rp_gpx_msg_no_select_file"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
if (!GPXUtils.checkJAXBVersion())
|
||||
return;
|
||||
|
||||
Gpx gpx = entry.getLayer().getGpx();
|
||||
|
||||
try {
|
||||
File f = entry.getLayer().getFile();
|
||||
if (saveAs || f == null)
|
||||
f = selectFile(f);
|
||||
if (f == null)
|
||||
return;
|
||||
if (!f.getName().toLowerCase().endsWith(".gpx"))
|
||||
f = new File(f.getAbsolutePath() + ".gpx");
|
||||
entry.getLayer().setFile(f);
|
||||
GPXUtils.saveGpxFile(gpx, f);
|
||||
} catch (JAXBException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
MainGUI.getMainGUI().previewMap.repaint();
|
||||
}
|
||||
|
||||
private File selectFile(File f) {
|
||||
JFileChooser fc = new JFileChooser();
|
||||
try {
|
||||
File dir = new File(Settings.getInstance().gpxFileChooserDir);
|
||||
if (f == null)
|
||||
fc.setCurrentDirectory(dir); // restore the saved directory
|
||||
else
|
||||
fc.setSelectedFile(f);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
fc.addChoosableFileFilter(new GpxFileFilter(true));
|
||||
int returnVal = fc.showSaveDialog(MainGUI.getMainGUI());
|
||||
if (returnVal != JFileChooser.APPROVE_OPTION)
|
||||
return null;
|
||||
Settings.getInstance().gpxFileChooserDir = fc.getCurrentDirectory().getAbsolutePath();
|
||||
return fc.getSelectedFile();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import mobac.gui.dialogs.LicensesDialog;
|
||||
|
||||
public class HelpLicenses implements ActionListener {
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
new LicensesDialog().setVisible(true);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.Desktop;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
import mobac.program.Logging;
|
||||
|
||||
public class OpenInWebbrowser implements ActionListener, MouseListener {
|
||||
|
||||
URI uri;
|
||||
|
||||
public OpenInWebbrowser(URI uri) {
|
||||
super();
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public OpenInWebbrowser(String uri) throws URISyntaxException {
|
||||
super();
|
||||
this.uri = new URI(uri);
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
if (Desktop.isDesktopSupported()) {
|
||||
Desktop desktop = Desktop.getDesktop();
|
||||
try {
|
||||
desktop.browse(uri);
|
||||
} catch (IOException e) {
|
||||
Logging.LOG.error("Failed to open web browser",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
actionPerformed(null);
|
||||
}
|
||||
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
}
|
||||
|
||||
public void mouseExited(MouseEvent e) {
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
public class PanelShowHide implements ActionListener {
|
||||
|
||||
private JPanel panel;
|
||||
|
||||
public PanelShowHide(JPanel panel) {
|
||||
super();
|
||||
this.panel = panel;
|
||||
}
|
||||
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
panel.setVisible(!panel.isVisible());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.mapsources.MapSourcesManager;
|
||||
import mobac.program.interfaces.FileBasedMapSource;
|
||||
import mobac.program.interfaces.MapSource;
|
||||
import mobac.utilities.I18nUtils;
|
||||
|
||||
public class RefreshCustomMapsources implements ActionListener {
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
MapSourcesManager manager = MapSourcesManager.getInstance();
|
||||
MainGUI gui = MainGUI.getMainGUI();
|
||||
MapSource selectedMapSource = gui.getSelectedMapSource();
|
||||
boolean updateGui = false;
|
||||
int count = 0;
|
||||
for (MapSource mapSource : manager.getAllAvailableMapSources()) {
|
||||
if (mapSource instanceof FileBasedMapSource) {
|
||||
FileBasedMapSource fbms = (FileBasedMapSource) mapSource;
|
||||
fbms.reinitialize();
|
||||
count++;
|
||||
if (mapSource.equals(selectedMapSource))
|
||||
updateGui = true;
|
||||
}
|
||||
}
|
||||
if (updateGui) {
|
||||
/*
|
||||
* The currently selected map source was updated - we have to force an GUI update in case the available zoom
|
||||
* levels has been changed
|
||||
*/
|
||||
gui.mapSourceChanged(selectedMapSource);
|
||||
}
|
||||
JOptionPane.showMessageDialog(gui, String.format(I18nUtils.localizedStringForKey("msg_refresh_all_map_source_done"), count));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.gui.mapview.PreviewMap;
|
||||
import mobac.gui.mapview.controller.PolygonCircleSelectionMapController;
|
||||
|
||||
public class SelectionModeCircle implements ActionListener {
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PreviewMap previewMap = MainGUI.getMainGUI().previewMap;
|
||||
previewMap.setMapSelectionController(new PolygonCircleSelectionMapController(previewMap));
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.gui.mapview.PreviewMap;
|
||||
import mobac.gui.mapview.controller.PolygonSelectionMapController;
|
||||
|
||||
public class SelectionModePolygon implements ActionListener {
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PreviewMap previewMap = MainGUI.getMainGUI().previewMap;
|
||||
previewMap.setMapSelectionController(new PolygonSelectionMapController(previewMap));
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.gui.mapview.PreviewMap;
|
||||
import mobac.gui.mapview.controller.RectangleSelectionMapController;
|
||||
|
||||
public class SelectionModeRectangle implements ActionListener {
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PreviewMap previewMap = MainGUI.getMainGUI().previewMap;
|
||||
previewMap.setMapSelectionController(new RectangleSelectionMapController(previewMap));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import mobac.gui.dialogs.AboutDialog;
|
||||
|
||||
public class ShowAboutDialog implements ActionListener {
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
new AboutDialog().setVisible(true);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import mobac.gui.dialogs.Help;
|
||||
|
||||
|
||||
public class ShowHelpAction implements ActionListener {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
Help.showHelp();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.actions;
|
||||
|
||||
import java.awt.Desktop;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.program.DirectoryManager;
|
||||
import mobac.utilities.GUIExceptionHandler;
|
||||
import mobac.utilities.I18nUtils;
|
||||
|
||||
public class ShowReadme implements ActionListener {
|
||||
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
File readme = new File(DirectoryManager.programDir, "README.HTM");
|
||||
if (!readme.isFile()) {
|
||||
JOptionPane.showMessageDialog(MainGUI.getMainGUI(),
|
||||
I18nUtils.localizedStringForKey("msg_no_found_readme_file"),
|
||||
I18nUtils.localizedStringForKey("Error"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Desktop.getDesktop().browse(readme.toURI());
|
||||
} catch (IOException e) {
|
||||
GUIExceptionHandler.processException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,217 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.atlastree;
|
||||
|
||||
import java.awt.HeadlessException;
|
||||
import java.awt.Point;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.awt.dnd.DnDConstants;
|
||||
import java.awt.dnd.DragGestureEvent;
|
||||
import java.awt.dnd.DragGestureListener;
|
||||
import java.awt.dnd.DragGestureRecognizer;
|
||||
import java.awt.dnd.DragSource;
|
||||
import java.awt.dnd.DragSourceDragEvent;
|
||||
import java.awt.dnd.DragSourceDropEvent;
|
||||
import java.awt.dnd.DragSourceEvent;
|
||||
import java.awt.dnd.DragSourceListener;
|
||||
import java.awt.dnd.DropTarget;
|
||||
import java.awt.dnd.DropTargetContext;
|
||||
import java.awt.dnd.DropTargetDragEvent;
|
||||
import java.awt.dnd.DropTargetDropEvent;
|
||||
import java.awt.dnd.DropTargetEvent;
|
||||
import java.awt.dnd.DropTargetListener;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.tree.TreeNode;
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
import mobac.exceptions.InvalidNameException;
|
||||
import mobac.program.interfaces.LayerInterface;
|
||||
import mobac.program.interfaces.MapInterface;
|
||||
import mobac.program.model.AtlasTreeModel;
|
||||
import mobac.utilities.I18nUtils;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
||||
public class DragDropController {
|
||||
|
||||
static Logger log = Logger.getLogger(DragDropController.class);
|
||||
|
||||
public DragDropController(JAtlasTree atlasTree) {
|
||||
super();
|
||||
this.atlasTree = atlasTree;
|
||||
new AtlasDragSource();
|
||||
new AtlasDropTarget();
|
||||
}
|
||||
|
||||
JAtlasTree atlasTree;
|
||||
|
||||
protected class AtlasDragSource implements DragSourceListener, DragGestureListener {
|
||||
|
||||
final DragGestureRecognizer recognizer;
|
||||
final DragSource source;
|
||||
|
||||
public AtlasDragSource() {
|
||||
source = new DragSource();
|
||||
recognizer = source.createDefaultDragGestureRecognizer(atlasTree,
|
||||
DnDConstants.ACTION_MOVE, this);
|
||||
}
|
||||
|
||||
public void dragGestureRecognized(DragGestureEvent dge) {
|
||||
TreePath path = atlasTree.getSelectionPath();
|
||||
if ((path == null) || (path.getPathCount() <= 1))
|
||||
// We can't move the root node or an empty selection
|
||||
return;
|
||||
TreeNode oldNode = (TreeNode) path.getLastPathComponent();
|
||||
if (!(oldNode instanceof LayerInterface || oldNode instanceof MapInterface))
|
||||
return;
|
||||
Transferable transferable = new NodeTransferWrapper(oldNode);
|
||||
source.startDrag(dge, DragSource.DefaultMoveNoDrop, transferable, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called whenever the drop target changes and it has bee accepted (
|
||||
*/
|
||||
public void dragEnter(DragSourceDragEvent dsde) {
|
||||
dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveDrop);
|
||||
}
|
||||
|
||||
public void dragOver(DragSourceDragEvent dsde) {
|
||||
}
|
||||
|
||||
public void dragDropEnd(DragSourceDropEvent dsde) {
|
||||
}
|
||||
|
||||
public void dragExit(DragSourceEvent dse) {
|
||||
dse.getDragSourceContext().setCursor(DragSource.DefaultMoveNoDrop);
|
||||
}
|
||||
|
||||
public void dropActionChanged(DragSourceDragEvent dsde) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected class AtlasDropTarget implements DropTargetListener {
|
||||
|
||||
final DropTarget target;
|
||||
|
||||
public AtlasDropTarget() throws HeadlessException {
|
||||
super();
|
||||
target = new DropTarget(atlasTree, this);
|
||||
}
|
||||
|
||||
public synchronized void dragEnter(DropTargetDragEvent dtde) {
|
||||
}
|
||||
|
||||
public synchronized void dragExit(DropTargetEvent dte) {
|
||||
}
|
||||
|
||||
public synchronized void dragOver(DropTargetDragEvent dtde) {
|
||||
try {
|
||||
Transferable t = dtde.getTransferable();
|
||||
Object o = t.getTransferData(NodeTransferWrapper.ATLAS_OBJECT_FLAVOR);
|
||||
TreeNode node = getNodeForEvent(dtde);
|
||||
if (o instanceof LayerInterface && node instanceof LayerInterface) {
|
||||
dtde.acceptDrag(dtde.getDropAction());
|
||||
return;
|
||||
}
|
||||
if (o instanceof MapInterface && node instanceof LayerInterface
|
||||
|| node instanceof MapInterface) {
|
||||
dtde.acceptDrag(dtde.getDropAction());
|
||||
return;
|
||||
}
|
||||
dtde.rejectDrag();
|
||||
} catch (Exception e) {
|
||||
log.error("", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void dropActionChanged(DropTargetDragEvent dtde) {
|
||||
}
|
||||
|
||||
public synchronized void drop(DropTargetDropEvent dtde) {
|
||||
try {
|
||||
TreeNode sourceNode = (TreeNode) dtde.getTransferable().getTransferData(
|
||||
NodeTransferWrapper.ATLAS_OBJECT_FLAVOR);
|
||||
|
||||
Point pt = dtde.getLocation();
|
||||
DropTargetContext dtc = dtde.getDropTargetContext();
|
||||
JTree tree = (JTree) dtc.getComponent();
|
||||
TreePath parentpath = tree.getClosestPathForLocation(pt.x, pt.y);
|
||||
TreeNode targetNode = (TreeNode) parentpath.getLastPathComponent();
|
||||
|
||||
if (targetNode.equals(sourceNode) || targetNode.getParent().equals(sourceNode)) {
|
||||
dtde.rejectDrop();
|
||||
return;
|
||||
}
|
||||
AtlasTreeModel atlasTreeModel = (AtlasTreeModel) atlasTree.getModel();
|
||||
if (sourceNode instanceof LayerInterface && targetNode instanceof LayerInterface)
|
||||
mergeLayers(atlasTreeModel, (LayerInterface) sourceNode,
|
||||
(LayerInterface) targetNode);
|
||||
|
||||
if (targetNode instanceof MapInterface)
|
||||
// We can not make a map child of another map
|
||||
// -> use it's layer instead
|
||||
targetNode = targetNode.getParent();
|
||||
|
||||
if (sourceNode instanceof MapInterface && targetNode instanceof LayerInterface)
|
||||
moveMap(atlasTreeModel, (MapInterface) sourceNode, (LayerInterface) targetNode);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("", e);
|
||||
atlasTree.getTreeModel().notifyStructureChanged();
|
||||
dtde.rejectDrop();
|
||||
}
|
||||
}
|
||||
|
||||
protected void mergeLayers(AtlasTreeModel atlasTreeModel, LayerInterface sourceLayer,
|
||||
LayerInterface targetLayer) throws InvalidNameException {
|
||||
int answer = JOptionPane.showConfirmDialog(null,
|
||||
String.format(I18nUtils.localizedStringForKey("msg_confirm_merge_layer"),
|
||||
sourceLayer.getName(), targetLayer.getName()),
|
||||
I18nUtils.localizedStringForKey("msg_confirm_merge_layer_title"),
|
||||
JOptionPane.YES_NO_OPTION);
|
||||
if (answer != JOptionPane.YES_OPTION)
|
||||
return;
|
||||
try {
|
||||
atlasTreeModel.mergeLayers(sourceLayer, targetLayer);
|
||||
} catch (InvalidNameException e) {
|
||||
JOptionPane.showMessageDialog(null, e.getMessage(),
|
||||
I18nUtils.localizedStringForKey("msg_merge_layer_failed"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
protected void moveMap(AtlasTreeModel atlasTreeModel, MapInterface map,
|
||||
LayerInterface targetLayer) throws InvalidNameException {
|
||||
atlasTreeModel.moveMap(map, targetLayer);
|
||||
}
|
||||
|
||||
private TreeNode getNodeForEvent(DropTargetDragEvent dtde) {
|
||||
Point p = dtde.getLocation();
|
||||
DropTargetContext dtc = dtde.getDropTargetContext();
|
||||
JTree tree = (JTree) dtc.getComponent();
|
||||
TreePath path = tree.getClosestPathForLocation(p.x, p.y);
|
||||
return (TreeNode) path.getLastPathComponent();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,412 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.atlastree;
|
||||
|
||||
import java.awt.Insets;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.dnd.Autoscroll;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.ActionMap;
|
||||
import javax.swing.InputMap;
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.KeyStroke;
|
||||
import javax.swing.tree.TreeNode;
|
||||
import javax.swing.tree.TreePath;
|
||||
import javax.swing.tree.TreeSelectionModel;
|
||||
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.gui.mapview.PreviewMap;
|
||||
import mobac.gui.mapview.layer.MapAreaHighlightingLayer;
|
||||
import mobac.program.interfaces.AtlasInterface;
|
||||
import mobac.program.interfaces.AtlasObject;
|
||||
import mobac.program.interfaces.CapabilityDeletable;
|
||||
import mobac.program.interfaces.LayerInterface;
|
||||
import mobac.program.interfaces.MapInterface;
|
||||
import mobac.program.interfaces.RequiresSQLite;
|
||||
import mobac.program.interfaces.ToolTipProvider;
|
||||
import mobac.program.model.Atlas;
|
||||
import mobac.program.model.AtlasOutputFormat;
|
||||
import mobac.program.model.AtlasTreeModel;
|
||||
import mobac.program.model.EastNorthCoordinate;
|
||||
import mobac.program.model.MapSelection;
|
||||
import mobac.program.model.Profile;
|
||||
import mobac.program.model.TileImageParameters;
|
||||
import mobac.utilities.GUIExceptionHandler;
|
||||
import mobac.utilities.I18nUtils;
|
||||
import mobac.utilities.jdbc.SQLiteLoader;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class JAtlasTree extends JTree implements Autoscroll {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final int margin = 12;
|
||||
|
||||
private static final String MSG_ATLAS_VERSION_MISMATCH = I18nUtils.localizedStringForKey("msg_atlas_version_mismatch");
|
||||
|
||||
private static final String MSG_ATLAS_DATA_CHECK_FAILED = I18nUtils.localizedStringForKey("msg_atlas_data_check_failed");
|
||||
|
||||
private static final String MSG_ATLAS_EMPTY = I18nUtils.localizedStringForKey("msg_atlas_is_empty");
|
||||
|
||||
private static final String ACTION_DELETE_NODE = "DELETE_NODE";
|
||||
|
||||
private static final Logger log = Logger.getLogger(JAtlasTree.class);
|
||||
|
||||
private AtlasTreeModel treeModel;
|
||||
|
||||
private PreviewMap mapView;
|
||||
|
||||
protected NodeRenderer nodeRenderer;
|
||||
|
||||
protected String defaultToolTiptext;
|
||||
|
||||
protected KeyStroke deleteNodeKS;
|
||||
|
||||
protected DragDropController ddc;
|
||||
|
||||
protected boolean displaySelectedMapArea = false;
|
||||
|
||||
public JAtlasTree(PreviewMap mapView) {
|
||||
super(new AtlasTreeModel());
|
||||
if (mapView == null)
|
||||
throw new NullPointerException("MapView parameter is null");
|
||||
this.mapView = mapView;
|
||||
getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
|
||||
ddc = new DragDropController(this);
|
||||
treeModel = (AtlasTreeModel) getModel();
|
||||
// setRootVisible(false);
|
||||
setShowsRootHandles(true);
|
||||
nodeRenderer = new NodeRenderer();
|
||||
setCellRenderer(nodeRenderer);
|
||||
setCellEditor(new NodeEditor(this));
|
||||
setToolTipText("");
|
||||
defaultToolTiptext = I18nUtils.localizedStringForKey("lp_atlas_default_tip");
|
||||
setAutoscrolls(true);
|
||||
addMouseListener(new MouseController(this));
|
||||
|
||||
InputMap inputMap = getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
|
||||
ActionMap actionMap = getActionMap();
|
||||
|
||||
// map moving
|
||||
inputMap.put(deleteNodeKS = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), ACTION_DELETE_NODE);
|
||||
actionMap.put(ACTION_DELETE_NODE, new AbstractAction(I18nUtils.localizedStringForKey("lp_atlas_pop_menu_delete_node")) {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
deleteSelectedNode();
|
||||
JAtlasTree.this.mapView.repaint();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public boolean testAtlasContentValid() {
|
||||
AtlasInterface atlas = getAtlas();
|
||||
if (RequiresSQLite.class.isAssignableFrom(atlas.getOutputFormat().getMapCreatorClass())) {
|
||||
if (!SQLiteLoader.loadSQLiteOrShowError())
|
||||
return false;
|
||||
}
|
||||
if (atlas.calculateTilesToDownload() == 0) {
|
||||
JOptionPane.showMessageDialog(null, "<html>" + MSG_ATLAS_EMPTY + "</html>", "Error - atlas has no content",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToolTipText(MouseEvent event) {
|
||||
if (getRowForLocation(event.getX(), event.getY()) == -1)
|
||||
return defaultToolTiptext;
|
||||
TreePath curPath = getPathForLocation(event.getX(), event.getY());
|
||||
Object o = curPath.getLastPathComponent();
|
||||
if (o == null || !(o instanceof ToolTipProvider))
|
||||
return null;
|
||||
return ((ToolTipProvider) o).getToolTip();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPathEditable(TreePath path) {
|
||||
return super.isPathEditable(path) && (path.getLastPathComponent() instanceof AtlasObject);
|
||||
}
|
||||
|
||||
public AtlasTreeModel getTreeModel() {
|
||||
return treeModel;
|
||||
}
|
||||
|
||||
public void newAtlas(String name, AtlasOutputFormat format) {
|
||||
log.debug("Creating new atlas");
|
||||
Atlas newAtlas = Atlas.newInstance();
|
||||
newAtlas.setOutputFormat(format);
|
||||
newAtlas.setName(name);
|
||||
treeModel.setAtlas(newAtlas);
|
||||
mapView.repaint();
|
||||
}
|
||||
|
||||
public void newAtlas() {
|
||||
log.debug("Resetting atlas tree model");
|
||||
Atlas newAtlas = Atlas.newInstance();
|
||||
newAtlas.setName(MainGUI.getMainGUI().getUserText());
|
||||
treeModel.setAtlas(newAtlas);
|
||||
mapView.repaint();
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the atlas format
|
||||
*/
|
||||
public void convertAtlas(AtlasOutputFormat format) {
|
||||
log.debug("Converting the atlas format to " + format);
|
||||
treeModel.getAtlas().setOutputFormat(format);
|
||||
}
|
||||
|
||||
public void deleteSelectedNode() {
|
||||
TreePath path = getSelectionPath();
|
||||
if (path == null)
|
||||
return;
|
||||
TreeNode selected = (TreeNode) path.getLastPathComponent();
|
||||
int[] selectedRows = getSelectionRows();
|
||||
|
||||
if (!(selected instanceof CapabilityDeletable))
|
||||
return;
|
||||
treeModel.notifyNodeDelete(selected);
|
||||
((CapabilityDeletable) selected).delete();
|
||||
|
||||
int selRow = Math.min(selectedRows[0], getRowCount() - 1);
|
||||
TreePath path1 = path.getParentPath();
|
||||
TreePath path2 = getPathForRow(selRow).getParentPath();
|
||||
if (path1 != path2) {
|
||||
// next row belongs to different parent node -> we select parent
|
||||
// node instead
|
||||
setSelectionPath(path1);
|
||||
} else {
|
||||
setSelectionRow(selRow);
|
||||
scrollRowToVisible(selRow);
|
||||
}
|
||||
}
|
||||
|
||||
public AtlasInterface getAtlas() {
|
||||
return treeModel.getAtlas();
|
||||
}
|
||||
|
||||
public boolean load(Profile profile) {
|
||||
log.debug("Loading profile " + profile);
|
||||
try {
|
||||
treeModel.load(profile);
|
||||
if (treeModel.getAtlas() instanceof Atlas) {
|
||||
Atlas atlas = (Atlas) treeModel.getAtlas();
|
||||
if (atlas.getVersion() < Atlas.CURRENT_ATLAS_VERSION) {
|
||||
JOptionPane.showMessageDialog(null, MSG_ATLAS_VERSION_MISMATCH, "Outdated atlas version",
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
boolean problemsDetected = Profile.checkAtlas(treeModel.getAtlas());
|
||||
if (problemsDetected) {
|
||||
JOptionPane.showMessageDialog(null, MSG_ATLAS_DATA_CHECK_FAILED, "Atlas loading problem",
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
GUIExceptionHandler.processException(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean save(Profile profile) {
|
||||
try {
|
||||
treeModel.save(profile);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
GUIExceptionHandler.processException(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected void showNodePopupMenu(MouseEvent event) {
|
||||
JPopupMenu pm = new JPopupMenu();
|
||||
final TreePath selPath = getPathForLocation(event.getX(), event.getY());
|
||||
setSelectionPath(selPath);
|
||||
JMenuItem mi = null;
|
||||
if (selPath != null) {
|
||||
// not clicked on empty area
|
||||
final Object o = selPath.getLastPathComponent();
|
||||
if (o == null)
|
||||
return;
|
||||
if (o instanceof ToolTipProvider) {
|
||||
mi = new JMenuItem(I18nUtils.localizedStringForKey("lp_atlas_pop_menu_show_detail"));
|
||||
mi.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ToolTipProvider ttp = (ToolTipProvider) o;
|
||||
JOptionPane.showMessageDialog(MainGUI.getMainGUI(), ttp.getToolTip());
|
||||
}
|
||||
});
|
||||
pm.add(mi);
|
||||
}
|
||||
if (o instanceof AtlasObject) {
|
||||
final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem(I18nUtils.localizedStringForKey("lp_atlas_pop_menu_display_select_area"));
|
||||
final MapAreaHighlightingLayer msl = new MapAreaHighlightingLayer(this);
|
||||
cbmi.setSelected(displaySelectedMapArea);
|
||||
cbmi.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (displaySelectedMapArea) {
|
||||
MapAreaHighlightingLayer.removeHighlightingLayers();
|
||||
} else {
|
||||
mapView.setSelectionByTileCoordinate(null, null, false);
|
||||
MapAreaHighlightingLayer.removeHighlightingLayers();
|
||||
mapView.mapLayers.add(msl);
|
||||
}
|
||||
displaySelectedMapArea = !displaySelectedMapArea;
|
||||
mapView.repaint();
|
||||
}
|
||||
});
|
||||
pm.add(cbmi);
|
||||
}
|
||||
if (o instanceof MapInterface) {
|
||||
mi = new JMenuItem(I18nUtils.localizedStringForKey("lp_atlas_pop_menu_select_map_box"));
|
||||
mi.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
MapInterface map = (MapInterface) o;
|
||||
mapView.setMapSource(map.getMapSource());
|
||||
mapView.setSelectionByTileCoordinate(map.getZoom(), map.getMinTileCoordinate(), map
|
||||
.getMaxTileCoordinate(), true);
|
||||
}
|
||||
});
|
||||
pm.add(mi);
|
||||
mi = new JMenuItem(I18nUtils.localizedStringForKey("lp_atlas_pop_menu_zoom_to_map_box"));
|
||||
mi.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
MapInterface map = (MapInterface) o;
|
||||
MapSelection ms = new MapSelection(map);
|
||||
mapView.setMapSource(map.getMapSource());
|
||||
mapView.setSelectionAndZoomTo(ms, true);
|
||||
mapView.setSelectionByTileCoordinate(map.getZoom(), map.getMinTileCoordinate(), map
|
||||
.getMaxTileCoordinate(), true);
|
||||
}
|
||||
});
|
||||
pm.add(mi);
|
||||
}
|
||||
if (o instanceof LayerInterface) {
|
||||
mi = new JMenuItem(I18nUtils.localizedStringForKey("lp_atlas_pop_menu_zoom_to"));
|
||||
mi.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
LayerInterface layer = (LayerInterface) o;
|
||||
EastNorthCoordinate max = new EastNorthCoordinate(Double.NEGATIVE_INFINITY,
|
||||
Double.NEGATIVE_INFINITY);
|
||||
EastNorthCoordinate min = new EastNorthCoordinate(Double.POSITIVE_INFINITY,
|
||||
Double.POSITIVE_INFINITY);
|
||||
for (MapInterface map : layer) {
|
||||
MapSelection ms = new MapSelection(map);
|
||||
EastNorthCoordinate mapMax = ms.getMax();
|
||||
EastNorthCoordinate mapMin = ms.getMin();
|
||||
max.lat = Math.max(max.lat, mapMax.lat);
|
||||
max.lon = Math.max(max.lon, mapMax.lon);
|
||||
min.lat = Math.min(min.lat, mapMin.lat);
|
||||
min.lon = Math.min(min.lon, mapMin.lon);
|
||||
}
|
||||
MapSelection ms = new MapSelection(mapView.getMapSource(), max, min);
|
||||
mapView.zoomTo(ms);
|
||||
}
|
||||
});
|
||||
pm.add(mi);
|
||||
}
|
||||
if (o instanceof AtlasObject) {
|
||||
mi = new JMenuItem(I18nUtils.localizedStringForKey("lp_atlas_pop_menu_rename"));
|
||||
mi.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JAtlasTree.this.startEditingAtPath(selPath);
|
||||
}
|
||||
});
|
||||
pm.add(mi);
|
||||
mi = new JMenuItem(I18nUtils.localizedStringForKey("lp_atlas_pop_menu_apply_tile_process"));
|
||||
mi.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
AtlasObject atlasObject = (AtlasObject) o;
|
||||
TileImageParameters p = MainGUI.getMainGUI().getSelectedTileImageParameters();
|
||||
applyTileImageParameters(atlasObject, p);
|
||||
}
|
||||
});
|
||||
pm.add(mi);
|
||||
}
|
||||
if (o instanceof CapabilityDeletable) {
|
||||
pm.addSeparator();
|
||||
mi = new JMenuItem(getActionMap().get(ACTION_DELETE_NODE));
|
||||
mi.setAccelerator(deleteNodeKS);
|
||||
pm.add(mi);
|
||||
}
|
||||
}
|
||||
if (pm.getComponentCount() > 0)
|
||||
pm.addSeparator();
|
||||
mi = new JMenuItem(I18nUtils.localizedStringForKey("lp_atlas_pop_menu_clear_atals"));
|
||||
mi.addActionListener(new ActionListener() {
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
newAtlas();
|
||||
}
|
||||
});
|
||||
pm.add(mi);
|
||||
pm.show(this, event.getX(), event.getY());
|
||||
}
|
||||
|
||||
protected void applyTileImageParameters(Object o, TileImageParameters p) {
|
||||
if (o instanceof Iterable<?>) {
|
||||
Iterable<?> it = (Iterable<?>) o;
|
||||
for (Object ao : it) {
|
||||
applyTileImageParameters(ao, p);
|
||||
}
|
||||
} else if (o instanceof MapInterface) {
|
||||
((MapInterface) o).setParameters(p);
|
||||
}
|
||||
}
|
||||
|
||||
protected void selectElementOnMap(Object o) {
|
||||
if (o instanceof MapInterface) {
|
||||
MapInterface map = (MapInterface) o;
|
||||
mapView.setMapSource(map.getMapSource());
|
||||
mapView.setSelectionByTileCoordinate(map.getZoom(), map.getMinTileCoordinate(), map.getMaxTileCoordinate(),
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
public void autoscroll(Point cursorLocn) {
|
||||
int realrow = getRowForLocation(cursorLocn.x, cursorLocn.y);
|
||||
Rectangle outer = getBounds();
|
||||
realrow = (cursorLocn.y + outer.y <= margin ? realrow < 1 ? 0 : realrow - 1
|
||||
: realrow < getRowCount() - 1 ? realrow + 1 : realrow);
|
||||
scrollRowToVisible(realrow);
|
||||
}
|
||||
|
||||
public Insets getAutoscrollInsets() {
|
||||
Rectangle outer = getBounds();
|
||||
Rectangle inner = getParent().getBounds();
|
||||
return new Insets(inner.y - outer.y + margin, inner.x - outer.x + margin, outer.height - inner.height - inner.y
|
||||
+ outer.y + margin, outer.width - inner.width - inner.x + outer.x + margin);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.atlastree;
|
||||
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
public class MouseController extends MouseAdapter {
|
||||
|
||||
JAtlasTree atlasTree;
|
||||
|
||||
public MouseController(JAtlasTree atlasTree) {
|
||||
super();
|
||||
this.atlasTree = atlasTree;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if (e.getButton() != MouseEvent.BUTTON1 || e.getClickCount() != 2)
|
||||
return;
|
||||
TreePath selPath = atlasTree.getSelectionPath();
|
||||
if (selPath == null)
|
||||
return; // clicked on empty area
|
||||
atlasTree.selectElementOnMap(selPath.getLastPathComponent());
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
if (e.isPopupTrigger()) {
|
||||
atlasTree.showNodePopupMenu(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
if (e.isPopupTrigger()) {
|
||||
atlasTree.showNodePopupMenu(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.atlastree;
|
||||
|
||||
import java.awt.Component;
|
||||
|
||||
import javax.swing.DefaultCellEditor;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.tree.DefaultTreeCellEditor;
|
||||
import javax.swing.tree.DefaultTreeCellRenderer;
|
||||
import javax.swing.tree.TreeCellEditor;
|
||||
import javax.swing.tree.TreeCellRenderer;
|
||||
|
||||
import mobac.gui.components.JAtlasNameField;
|
||||
|
||||
|
||||
public class NodeEditor extends DefaultTreeCellEditor {
|
||||
|
||||
public NodeEditor(JAtlasTree atlasTree) {
|
||||
super(atlasTree, null);
|
||||
atlasTree.setEditable(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected,
|
||||
boolean expanded, boolean leaf, int row) {
|
||||
// Each node type has it's own TreeCellRenderer implementation
|
||||
// this not covered by DefaultTreeCellEditor - therefore we have to
|
||||
// correct the renderer each time an editorComponent is requested
|
||||
TreeCellRenderer tcr = tree.getCellRenderer();
|
||||
renderer = (DefaultTreeCellRenderer) tcr.getTreeCellRendererComponent(tree, value,
|
||||
isSelected, expanded, leaf, row, true);
|
||||
return super.getTreeCellEditorComponent(tree, value, isSelected, expanded, leaf, row);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TreeCellEditor createTreeCellEditor() {
|
||||
return new DefaultCellEditor(new JAtlasNameField());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.atlastree;
|
||||
|
||||
import java.awt.Component;
|
||||
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.tree.DefaultTreeCellRenderer;
|
||||
import javax.swing.tree.TreeCellRenderer;
|
||||
|
||||
import mobac.program.interfaces.AtlasInterface;
|
||||
import mobac.program.interfaces.LayerInterface;
|
||||
import mobac.utilities.Utilities;
|
||||
|
||||
|
||||
public class NodeRenderer implements TreeCellRenderer {
|
||||
|
||||
private static ImageIcon atlasIcon = new ImageIcon();
|
||||
private static ImageIcon layerIcon = new ImageIcon();
|
||||
private static ImageIcon mapIcon = new ImageIcon();
|
||||
|
||||
static {
|
||||
atlasIcon = Utilities.loadResourceImageIcon("atlas.png");
|
||||
layerIcon = Utilities.loadResourceImageIcon("layer.png");
|
||||
mapIcon = Utilities.loadResourceImageIcon("map.png");
|
||||
}
|
||||
|
||||
DefaultTreeCellRenderer atlasRenderer;
|
||||
DefaultTreeCellRenderer layerRenderer;
|
||||
DefaultTreeCellRenderer mapRenderer;
|
||||
|
||||
public NodeRenderer() {
|
||||
atlasRenderer = new SimpleTreeCellRenderer(atlasIcon);
|
||||
layerRenderer = new SimpleTreeCellRenderer(layerIcon);
|
||||
mapRenderer = new SimpleTreeCellRenderer(mapIcon);
|
||||
}
|
||||
|
||||
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected,
|
||||
boolean expanded, boolean leaf, int row, boolean hasFocus) {
|
||||
TreeCellRenderer tcr;
|
||||
if (value instanceof AtlasInterface) {
|
||||
tcr = atlasRenderer;
|
||||
} else if (value instanceof LayerInterface)
|
||||
tcr = layerRenderer;
|
||||
else
|
||||
tcr = mapRenderer;
|
||||
return tcr.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row,
|
||||
hasFocus);
|
||||
}
|
||||
|
||||
protected static class SimpleTreeCellRenderer extends DefaultTreeCellRenderer {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public SimpleTreeCellRenderer(Icon icon) {
|
||||
super();
|
||||
setIcon(icon);
|
||||
setOpenIcon(icon);
|
||||
setClosedIcon(icon);
|
||||
setLeafIcon(icon);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.atlastree;
|
||||
|
||||
import java.awt.datatransfer.DataFlavor;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.awt.datatransfer.UnsupportedFlavorException;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.swing.tree.TreeNode;
|
||||
|
||||
import mobac.program.interfaces.AtlasObject;
|
||||
|
||||
|
||||
public class NodeTransferWrapper implements Transferable {
|
||||
|
||||
public static final DataFlavor ATLAS_OBJECT_FLAVOR = new DataFlavor(AtlasObject.class, "AtlasObject");
|
||||
public static final DataFlavor[] FLAVORS = new DataFlavor[] { ATLAS_OBJECT_FLAVOR };
|
||||
|
||||
private TreeNode node;
|
||||
|
||||
public NodeTransferWrapper(TreeNode node) {
|
||||
this.node = node;
|
||||
}
|
||||
|
||||
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
|
||||
if (!ATLAS_OBJECT_FLAVOR.equals(flavor))
|
||||
throw new UnsupportedFlavorException(flavor);
|
||||
return node;
|
||||
}
|
||||
|
||||
public DataFlavor[] getTransferDataFlavors() {
|
||||
return FLAVORS;
|
||||
}
|
||||
|
||||
public boolean isDataFlavorSupported(DataFlavor flavor) {
|
||||
return ATLAS_OBJECT_FLAVOR.equals(flavor);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.components;
|
||||
|
||||
import java.awt.Component;
|
||||
|
||||
import javax.swing.JLayeredPane;
|
||||
|
||||
public class FilledLayeredPane extends JLayeredPane {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Layout each of the components in this JLayeredPane so that they all fill
|
||||
* the entire extents of the layered pane -- from (0,0) to (getWidth(),
|
||||
* getHeight())
|
||||
*/
|
||||
@Override
|
||||
public void doLayout() {
|
||||
// Synchronizing on getTreeLock, because I see other layouts doing
|
||||
// that.
|
||||
// see BorderLayout::layoutContainer(Container)
|
||||
synchronized (getTreeLock()) {
|
||||
int w = getWidth();
|
||||
int h = getHeight();
|
||||
for (Component c : getComponents()) {
|
||||
c.setBounds(0, 0, w, h);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.components;
|
||||
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import mobac.program.model.Profile;
|
||||
|
||||
|
||||
/**
|
||||
* A {@link JTextField} that only accepts ASCII characters, numbers and spaces.
|
||||
*
|
||||
*/
|
||||
public class JAtlasNameField extends JRegexTextField {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public JAtlasNameField() {
|
||||
super(Profile.PROFILE_NAME_REGEX, 40);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.components;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
|
||||
import mobac.gui.MainGUI;
|
||||
import mobac.program.model.Bookmark;
|
||||
|
||||
public class JBookmarkMenuItem extends JMenuItem implements ActionListener {
|
||||
|
||||
private final Bookmark bookmark;
|
||||
|
||||
public JBookmarkMenuItem(Bookmark bookmark) {
|
||||
super(bookmark.toString());
|
||||
this.bookmark = bookmark;
|
||||
addActionListener(this);
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent paramActionEvent) {
|
||||
MainGUI.getMainGUI().previewMap.gotoPositionBookmark(bookmark);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,343 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.components;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.LayoutManager;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.Border;
|
||||
|
||||
import mobac.utilities.GBC;
|
||||
import mobac.utilities.Utilities;
|
||||
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
public class JCollapsiblePanel extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected static final int DEFAULT_TITLE_PADDING = 3;
|
||||
protected static final Color DEFAULT_TITLE_BACKGROUND_COLOR = Color.LIGHT_GRAY;
|
||||
protected static final Color DEFAULT_TITLE_COLOR = Color.BLACK;
|
||||
|
||||
private static ImageIcon arrowClosed;
|
||||
private static ImageIcon arrowOpen;
|
||||
|
||||
static {
|
||||
try {
|
||||
arrowClosed = Utilities.loadResourceImageIcon("arrow_closed.png");
|
||||
arrowOpen = Utilities.loadResourceImageIcon("arrow_open.png");
|
||||
} catch (Exception e) {
|
||||
arrowClosed = new ImageIcon();
|
||||
arrowOpen = new ImageIcon();
|
||||
}
|
||||
}
|
||||
|
||||
// title
|
||||
protected final JLabel titleIcon;
|
||||
protected final JLabel titleLabel;
|
||||
protected final JPanel titlePanel;
|
||||
|
||||
// main component
|
||||
protected Container contentContainer;
|
||||
|
||||
// collapsing
|
||||
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);
|
||||
}
|
||||
|
||||
public JCollapsiblePanel(String title, LayoutManager layout) {
|
||||
this(new JPanel(layout), title);
|
||||
setName(title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a {@code TitleContainer} that wraps the specified component
|
||||
* and has the specified title.
|
||||
*
|
||||
* @param container
|
||||
* the main container
|
||||
* @param title
|
||||
* the title
|
||||
*/
|
||||
public JCollapsiblePanel(Container container, String title) {
|
||||
super();
|
||||
setName(title);
|
||||
titleIcon = new JLabel(arrowOpen);
|
||||
titleLabel = new JLabel(title);
|
||||
titlePanel = new JPanel(new GridBagLayout());
|
||||
// mainComponentPanel = new JPanel(new GridBagLayout());
|
||||
collapsingMouseListener = new CollapsingMouseListener();
|
||||
|
||||
titleIcon.setMinimumSize(new Dimension(40, 40));
|
||||
titleIcon.setPreferredSize(titleIcon.getPreferredSize());
|
||||
|
||||
// set collapse behavior
|
||||
titlePanel.addMouseListener(collapsingMouseListener);
|
||||
|
||||
// look and feel
|
||||
setTitleBackgroundColor(DEFAULT_TITLE_BACKGROUND_COLOR);
|
||||
setTitleColor(DEFAULT_TITLE_COLOR);
|
||||
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());
|
||||
setLayout(new BorderLayout());
|
||||
add(titlePanel, BorderLayout.NORTH);
|
||||
add(container, BorderLayout.CENTER);
|
||||
setContentContainer(container);
|
||||
setBorder(BorderFactory.createEtchedBorder());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method provides a programmatic way to collapse the container.
|
||||
*
|
||||
* @param collapsed
|
||||
* whether the container should be collapsed or shown
|
||||
*/
|
||||
public void setCollapsed(boolean collapsed) {
|
||||
if (isCollapsed == collapsed) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (collapsed) {
|
||||
titleIcon.setIcon(arrowClosed);
|
||||
|
||||
// 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));
|
||||
} else {
|
||||
titleIcon.setIcon(arrowOpen);
|
||||
}
|
||||
contentContainer.setVisible(!collapsed);
|
||||
|
||||
isCollapsed = collapsed;
|
||||
revalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether the container is collapsed or not.
|
||||
*
|
||||
* @return whether the container is collapsed or not
|
||||
*/
|
||||
public boolean isCollapsed() {
|
||||
return isCollapsed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the title of this container.
|
||||
*
|
||||
* @param title
|
||||
* the title
|
||||
*/
|
||||
public void setTitle(String title) {
|
||||
if (title != null) {
|
||||
titleLabel.setText(title);
|
||||
} else {
|
||||
titleLabel.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the this container's title.
|
||||
*
|
||||
* @return the title
|
||||
*/
|
||||
public String getTitle() {
|
||||
return titleLabel.getText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the main content container for this container.
|
||||
*
|
||||
* @param container
|
||||
* the main content container
|
||||
*/
|
||||
public void setContentContainer(Container container) {
|
||||
// don't need to do anything if the main component hasn't changed
|
||||
if (container == this.contentContainer) {
|
||||
return;
|
||||
}
|
||||
|
||||
// remove the main component
|
||||
if (this.contentContainer != null) {
|
||||
remove(this.contentContainer);
|
||||
}
|
||||
|
||||
// replace the main component
|
||||
this.contentContainer = container;
|
||||
add(container, BorderLayout.CENTER);
|
||||
|
||||
// repaint main component
|
||||
revalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the main content container for this container.
|
||||
*
|
||||
* @return the main container
|
||||
*/
|
||||
public Container getContentContainer() {
|
||||
return contentContainer;
|
||||
}
|
||||
|
||||
public void addContent(Component comp, Object constraints) {
|
||||
contentContainer.add(comp, constraints);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the title font.
|
||||
*
|
||||
* @param font
|
||||
* the title font
|
||||
*/
|
||||
public void setTitleFont(Font font) {
|
||||
super.setFont(font);
|
||||
if (titleLabel != null) {
|
||||
titleLabel.setFont(font);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the background color of the title bar.
|
||||
*
|
||||
* @param color
|
||||
* the color
|
||||
*/
|
||||
public void setTitleBackgroundColor(Color color) {
|
||||
this.titlePanel.setBackground(color);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the title text color.
|
||||
*
|
||||
* @param color
|
||||
* the color
|
||||
*/
|
||||
public void setTitleColor(Color color) {
|
||||
this.titleLabel.setForeground(color);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the title bar padding in pixels.
|
||||
*
|
||||
* @param padding
|
||||
* the title bar padding in pixels
|
||||
*/
|
||||
public void setTitleBarPadding(int padding) {
|
||||
Border border = BorderFactory.createEmptyBorder(padding, padding, padding, padding);
|
||||
this.titlePanel.setBorder(border);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public void setTitleBarVisible(boolean visible) {
|
||||
this.titlePanel.setVisible(visible);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the visibility of the title bar.
|
||||
*
|
||||
* @return true if the title bar is visible, false otherwise
|
||||
*/
|
||||
public boolean isTitleBarVisible() {
|
||||
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.
|
||||
*/
|
||||
private class CollapsingMouseListener extends MouseAdapter {
|
||||
private final Cursor CLICK_ME_CURSOR = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
|
||||
|
||||
/**
|
||||
* Collapses or shows the titled component.
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void mousePressed(MouseEvent e) {
|
||||
setCollapsed(!JCollapsiblePanel.this.isCollapsed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the cursor to indicate clickability.
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
titlePanel.setCursor(CLICK_ME_CURSOR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the cursor back to the default.
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void mouseExited(MouseEvent e) {
|
||||
titlePanel.setCursor(Cursor.getDefaultCursor());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,185 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.components;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Point;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.text.NumberFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.ParsePosition;
|
||||
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
|
||||
import mobac.utilities.I18nUtils;
|
||||
import mobac.utilities.Utilities;
|
||||
import mobac.utilities.geo.CoordinateDms2Format;
|
||||
|
||||
public class JCoordinateField extends JTextField {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Color ERROR_COLOR = new Color(255, 100, 100);
|
||||
|
||||
private static final String INVALID_TEXT = I18nUtils.localizedStringForKey("lp_coords_invalid_text");
|
||||
|
||||
private JCoordinateListener coordinateListener;
|
||||
private boolean inputIsValid = true;
|
||||
|
||||
private NumberFormat numberFormat;
|
||||
|
||||
private final double min;
|
||||
private final double max;
|
||||
|
||||
public JCoordinateField(double min, double max) {
|
||||
super(10);
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
numberFormat = new CoordinateDms2Format(new DecimalFormatSymbols());
|
||||
coordinateListener = new JCoordinateListener();
|
||||
coordinateListener.checkCoordinate(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getToolTipLocation(MouseEvent event) {
|
||||
if (getToolTipText().length() > 0)
|
||||
return super.getToolTipLocation(event);
|
||||
else
|
||||
// We don't want a tool tip but Java does not allow to disable it?
|
||||
// -> show it at a point where no user will ever see it
|
||||
return new Point(Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
public void setCoordinate(double value) {
|
||||
try {
|
||||
// We know that the number is valid, therefore we can skip the check
|
||||
// -> saves CPU power while selecting via preview map
|
||||
boolean newValid = true;
|
||||
coordinateListener.setEnabled(false);
|
||||
if (Double.isNaN(value)) {
|
||||
super.setText("");
|
||||
newValid = false;
|
||||
} else {
|
||||
super.setText(numberFormat.format(value));
|
||||
}
|
||||
if (newValid != inputIsValid)
|
||||
coordinateListener.changeValidMode(true);
|
||||
} finally {
|
||||
coordinateListener.setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
public double getCoordinate() throws ParseException {
|
||||
ParsePosition pos = new ParsePosition(0);
|
||||
String text = JCoordinateField.this.getText();
|
||||
Number num = numberFormat.parse(text, pos);
|
||||
if (num == null || pos.getErrorIndex() >= 0 || Double.isNaN(num.doubleValue()))
|
||||
throw new ParseException(text, pos.getErrorIndex());
|
||||
return num.doubleValue();
|
||||
}
|
||||
|
||||
public double getCoordinateOrNaN() {
|
||||
ParsePosition pos = new ParsePosition(0);
|
||||
String text = JCoordinateField.this.getText();
|
||||
Number num = numberFormat.parse(text, pos);
|
||||
if (num == null || pos.getErrorIndex() >= 0)
|
||||
return Double.NaN;
|
||||
return num.doubleValue();
|
||||
}
|
||||
|
||||
public boolean isInputValid() {
|
||||
return inputIsValid;
|
||||
}
|
||||
|
||||
public NumberFormat getNumberFormat() {
|
||||
return numberFormat;
|
||||
}
|
||||
|
||||
public void setNumberFormat(NumberFormat numberFormat) {
|
||||
double coord = getCoordinateOrNaN();
|
||||
this.numberFormat = numberFormat;
|
||||
setCoordinate(coord);
|
||||
}
|
||||
|
||||
protected class JCoordinateListener implements DocumentListener {
|
||||
|
||||
private Color defaultColor;
|
||||
|
||||
private boolean enabled;
|
||||
|
||||
private JCoordinateListener() {
|
||||
enabled = true;
|
||||
defaultColor = JCoordinateField.this.getBackground();
|
||||
JCoordinateField.this.getDocument().addDocumentListener(this);
|
||||
}
|
||||
|
||||
private void checkCoordinate(DocumentEvent de) {
|
||||
if (!enabled)
|
||||
return;
|
||||
boolean valid = false;
|
||||
try {
|
||||
ParsePosition pos = new ParsePosition(0);
|
||||
String text = JCoordinateField.this.getText();
|
||||
Number num = numberFormat.parse(text, pos);
|
||||
if (num == null) {
|
||||
valid = false;
|
||||
return;
|
||||
}
|
||||
double d = num.doubleValue();
|
||||
valid = (!Double.isNaN(d)) && (d >= min) && (d <= max);
|
||||
} catch (Exception e) {
|
||||
valid = false;
|
||||
}
|
||||
if (valid != inputIsValid)
|
||||
changeValidMode(valid);
|
||||
}
|
||||
|
||||
private void changeValidMode(boolean valid) {
|
||||
Color newC = valid ? defaultColor : ERROR_COLOR;
|
||||
JCoordinateField.this.setBackground(newC);
|
||||
String toolTip = valid ? "" : String.format(INVALID_TEXT, numberFormat.format(min),
|
||||
numberFormat.format(max));
|
||||
JCoordinateField.this.setToolTipText(toolTip);
|
||||
if (toolTip.length() > 0)
|
||||
Utilities.showTooltipNow(JCoordinateField.this);
|
||||
inputIsValid = valid;
|
||||
}
|
||||
|
||||
public void changedUpdate(DocumentEvent e) {
|
||||
checkCoordinate(e);
|
||||
}
|
||||
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
checkCoordinate(e);
|
||||
}
|
||||
|
||||
public void removeUpdate(DocumentEvent e) {
|
||||
checkCoordinate(e);
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.components;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
|
||||
import mobac.utilities.I18nUtils;
|
||||
|
||||
public class JDirectoryChooser extends JFileChooser {
|
||||
|
||||
private static final long serialVersionUID = -1954689476383812988L;
|
||||
|
||||
public JDirectoryChooser() {
|
||||
super();
|
||||
setDialogType(CUSTOM_DIALOG);
|
||||
setDialogTitle(I18nUtils.localizedStringForKey("dlg_select_dir_title"));
|
||||
//setApproveButtonText("Select Directory");
|
||||
setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||
setAcceptAllFileFilterUsed(false);
|
||||
addChoosableFileFilter(new FileFilter() {
|
||||
|
||||
@Override
|
||||
public boolean accept(File f) {
|
||||
return f.isDirectory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return I18nUtils.localizedStringForKey("dlg_select_dir_description");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void approveSelection() {
|
||||
if (!this.getFileFilter().accept(this.getSelectedFile()))
|
||||
return;
|
||||
super.approveSelection();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.components;
|
||||
|
||||
import java.util.Hashtable;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JSlider;
|
||||
|
||||
import mobac.program.interfaces.MapSpace;
|
||||
import mobac.program.model.UnitSystem;
|
||||
|
||||
public class JDistanceSlider extends JSlider {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final Hashtable<Integer, JLabel> labelTable;
|
||||
|
||||
public JDistanceSlider(MapSpace mapSpace, int zoom, int y, UnitSystem unit, int pixelMin, int pixelMax) {
|
||||
super(pixelMin, pixelMax);
|
||||
labelTable = new Hashtable<Integer, JLabel>();
|
||||
|
||||
int diff4 = (pixelMax - pixelMin) / 4;
|
||||
int[] labelvalues = new int[] { pixelMin, pixelMin + diff4, pixelMin + 2 * diff4, pixelMin + 3 * diff4,
|
||||
pixelMax };
|
||||
|
||||
for (int i : labelvalues) {
|
||||
double distance = mapSpace.horizontalDistance(zoom, y, i) * unit.earthRadius * unit.unitFactor;
|
||||
String label;
|
||||
if (distance > unit.unitFactor) {
|
||||
distance /= unit.unitFactor;
|
||||
label = String.format("%2.0f %s", distance, unit.unitLarge);
|
||||
} else
|
||||
label = String.format("%2.0f %s", distance, unit.unitSmall);
|
||||
labelTable.put(new Integer(i), new JLabel(label));
|
||||
}
|
||||
setPaintTicks(true);
|
||||
setMajorTickSpacing(diff4);
|
||||
setLabelTable(labelTable);
|
||||
setPaintLabels(true);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.components;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.Action;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.plaf.basic.BasicArrowButton;
|
||||
|
||||
public class JDropDownButton extends JButton {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private BasicArrowButton arrowButton;
|
||||
private JPopupMenu buttonPopupMenu;
|
||||
|
||||
public JDropDownButton(String text) {
|
||||
super(text);
|
||||
buttonPopupMenu = new JPopupMenu();
|
||||
arrowButton = new BasicArrowButton(SwingConstants.SOUTH, null, null, Color.BLACK, null);
|
||||
arrowButton.setBorder(BorderFactory.createEmptyBorder());
|
||||
arrowButton.setFocusable(false);
|
||||
setHorizontalAlignment(SwingConstants.LEFT);
|
||||
setLayout(new BorderLayout());
|
||||
add(arrowButton, BorderLayout.EAST);
|
||||
arrowButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Rectangle r = getBounds();
|
||||
buttonPopupMenu.show(JDropDownButton.this, r.x, r.y + r.height);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void addDropDownItem(String text, ActionListener l) {
|
||||
JMenuItem item = new JMenuItem(text);
|
||||
item.addActionListener(l);
|
||||
buttonPopupMenu.add(item);
|
||||
}
|
||||
|
||||
public void addDropDownItem(String text, Action a) {
|
||||
JMenuItem item = new JMenuItem(text);
|
||||
item.setAction(a);
|
||||
buttonPopupMenu.add(item);
|
||||
}
|
||||
|
||||
public void addDropDownItem(JMenuItem item) {
|
||||
buttonPopupMenu.add(item);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.components;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.ComboBoxEditor;
|
||||
import javax.swing.JComboBox;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class JIntCombo extends JComboBox {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
static Logger log = Logger.getLogger(JIntCombo.class);
|
||||
|
||||
protected JIntField editorComponent;
|
||||
protected Integer defaultValue;
|
||||
|
||||
public JIntCombo(Vector<Integer> values, Integer defaultValue) {
|
||||
super(values);
|
||||
this.defaultValue = defaultValue;
|
||||
|
||||
createEditorComponent();
|
||||
setEditable(true);
|
||||
setEditor(new Editor());
|
||||
setMaximumRowCount(values.size());
|
||||
setSelectedItem(defaultValue);
|
||||
}
|
||||
|
||||
protected void createEditorComponent() {
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
try {
|
||||
return editorComponent.getValue();
|
||||
} catch (NumberFormatException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
public void setValue(int newValue) {
|
||||
setSelectedIndex(-1);
|
||||
editorComponent.setValue(newValue, true);
|
||||
}
|
||||
|
||||
public boolean isValueValid() {
|
||||
return editorComponent.isInputValid();
|
||||
}
|
||||
|
||||
protected class Editor implements ComboBoxEditor {
|
||||
|
||||
public Editor() {
|
||||
super();
|
||||
}
|
||||
|
||||
public void addActionListener(ActionListener l) {
|
||||
editorComponent.addActionListener(l);
|
||||
}
|
||||
|
||||
public Component getEditorComponent() {
|
||||
return editorComponent;
|
||||
}
|
||||
|
||||
public Object getItem() {
|
||||
try {
|
||||
return editorComponent.getValue();
|
||||
} catch (NumberFormatException e) {
|
||||
return getValue();
|
||||
}
|
||||
}
|
||||
|
||||
public void removeActionListener(ActionListener l) {
|
||||
editorComponent.removeActionListener(l);
|
||||
}
|
||||
|
||||
public void selectAll() {
|
||||
editorComponent.selectAll();
|
||||
}
|
||||
|
||||
public void setItem(Object entry) {
|
||||
if (entry == null)
|
||||
return;
|
||||
editorComponent.setValue(((Integer) entry).intValue(), true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,135 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.components;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
|
||||
import mobac.program.model.NumericDocument;
|
||||
import mobac.utilities.Utilities;
|
||||
|
||||
|
||||
public class JIntField extends JTextField {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected Color errorColor = new Color(255, 100, 100);
|
||||
|
||||
public int min = 0;
|
||||
|
||||
public int max = 0;
|
||||
|
||||
private String errorText;
|
||||
|
||||
private InputListener listener;
|
||||
private boolean inputIsValid = true;
|
||||
|
||||
public JIntField(int min, int max, int columns, String errorText) {
|
||||
super(columns);
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.errorText = errorText;
|
||||
setDocument(new NumericDocument());
|
||||
listener = new InputListener();
|
||||
listener.checkInput(null);
|
||||
setBorder(new EmptyBorder(2, 2, 2, 0));
|
||||
}
|
||||
|
||||
public void setErrorColor(Color c) {
|
||||
errorColor = c;
|
||||
}
|
||||
|
||||
public int getValue() throws NumberFormatException {
|
||||
return Integer.parseInt(getText());
|
||||
}
|
||||
|
||||
public void setValue(int newValue, boolean check) {
|
||||
if (newValue <= 0)
|
||||
super.setText("");
|
||||
else
|
||||
super.setText(Integer.toString(newValue));
|
||||
if (check)
|
||||
listener.checkInput(null);
|
||||
}
|
||||
|
||||
public void setText(String t) {
|
||||
throw new RuntimeException("Calling setText() is not allowed!");
|
||||
}
|
||||
|
||||
public boolean isInputValid() {
|
||||
return testInputValid();
|
||||
}
|
||||
|
||||
private boolean testInputValid() {
|
||||
try {
|
||||
int i = Integer.parseInt(getText());
|
||||
return (i >= min) && (i <= max);
|
||||
} catch (NumberFormatException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected class InputListener implements DocumentListener {
|
||||
|
||||
private Color defaultColor;
|
||||
|
||||
private InputListener() {
|
||||
defaultColor = JIntField.this.getBackground();
|
||||
JIntField.this.getDocument().addDocumentListener(this);
|
||||
}
|
||||
|
||||
private void checkInput(DocumentEvent de) {
|
||||
boolean valid = false;
|
||||
try {
|
||||
valid = testInputValid();
|
||||
} catch (Exception e) {
|
||||
valid = false;
|
||||
}
|
||||
if (valid != inputIsValid)
|
||||
setDisplayedValidMode(valid);
|
||||
inputIsValid = valid;
|
||||
}
|
||||
|
||||
private void setDisplayedValidMode(boolean valid) {
|
||||
Color newC = valid ? defaultColor : errorColor;
|
||||
JIntField.this.setBackground(newC);
|
||||
String toolTip = valid ? "" : String.format(errorText, new Object[] { min, max });
|
||||
JIntField.this.setToolTipText(toolTip);
|
||||
if (toolTip.length() > 0)
|
||||
Utilities.showTooltipNow(JIntField.this);
|
||||
}
|
||||
|
||||
public void changedUpdate(DocumentEvent e) {
|
||||
checkInput(e);
|
||||
}
|
||||
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
checkInput(e);
|
||||
}
|
||||
|
||||
public void removeUpdate(DocumentEvent e) {
|
||||
checkInput(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.components;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class JMapSizeCombo extends JIntCombo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static final int MIN = 10;
|
||||
|
||||
public static final int MAX = Integer.MAX_VALUE;
|
||||
|
||||
static Vector<Integer> MAP_SIZE_VALUES;
|
||||
|
||||
static Integer DEFAULT;
|
||||
|
||||
static Logger log = Logger.getLogger(JMapSizeCombo.class);
|
||||
|
||||
static {
|
||||
// Sizes from 1024 to 32768
|
||||
MAP_SIZE_VALUES = new Vector<Integer>(11);
|
||||
MAP_SIZE_VALUES.addElement(new Integer(128000));
|
||||
MAP_SIZE_VALUES.addElement(new Integer(1048575));
|
||||
MAP_SIZE_VALUES.addElement(new Integer(65536));
|
||||
MAP_SIZE_VALUES.addElement(DEFAULT = new Integer(32767));
|
||||
MAP_SIZE_VALUES.addElement(new Integer(30000));
|
||||
MAP_SIZE_VALUES.addElement(new Integer(25000));
|
||||
MAP_SIZE_VALUES.addElement(new Integer(20000));
|
||||
MAP_SIZE_VALUES.addElement(new Integer(15000));
|
||||
MAP_SIZE_VALUES.addElement(new Integer(10000));
|
||||
MAP_SIZE_VALUES.addElement(new Integer(2048));
|
||||
MAP_SIZE_VALUES.addElement(new Integer(1024));
|
||||
}
|
||||
|
||||
public JMapSizeCombo() {
|
||||
super(MAP_SIZE_VALUES, DEFAULT);
|
||||
setEditable(true);
|
||||
setEditor(new Editor());
|
||||
setMaximumRowCount(MAP_SIZE_VALUES.size());
|
||||
setSelectedItem(DEFAULT);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createEditorComponent() {
|
||||
editorComponent = new JIntField(MIN, MAX, 4, "");
|
||||
editorComponent.setErrorColor(Color.ORANGE);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.components;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
|
||||
public class JMenuItem2 extends JMenuItem implements ActionListener {
|
||||
|
||||
private Class<? extends ActionListener> actionClass;
|
||||
|
||||
public JMenuItem2(String text, int mnemonic, Class<? extends ActionListener> actionClass) {
|
||||
super(text, mnemonic);
|
||||
this.actionClass = actionClass;
|
||||
addActionListener(this);
|
||||
}
|
||||
|
||||
public JMenuItem2(String text, Class<? extends ActionListener> actionClass) {
|
||||
super(text);
|
||||
this.actionClass = actionClass;
|
||||
addActionListener(this);
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
ActionListener al;
|
||||
try {
|
||||
al = actionClass.newInstance();
|
||||
al.actionPerformed(event);
|
||||
} catch (InstantiationException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.components;
|
||||
|
||||
import javax.swing.Action;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JCheckBox;
|
||||
|
||||
/**
|
||||
* An extended {@link JCheckBox} implementation that allows to link one user
|
||||
* object to the checkbox.
|
||||
*
|
||||
* @param <E>
|
||||
* type of the user object linked/stored with the checkbox
|
||||
*/
|
||||
public class JObjectCheckBox<E> extends JCheckBox {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private E object;
|
||||
|
||||
public JObjectCheckBox(Icon icon) {
|
||||
super(icon);
|
||||
}
|
||||
|
||||
public JObjectCheckBox(String text) {
|
||||
super(text);
|
||||
}
|
||||
|
||||
public JObjectCheckBox(Action a) {
|
||||
super(a);
|
||||
}
|
||||
|
||||
public JObjectCheckBox(Icon icon, boolean selected) {
|
||||
super(icon, selected);
|
||||
}
|
||||
|
||||
public JObjectCheckBox(String text, boolean selected) {
|
||||
super(text, selected);
|
||||
}
|
||||
|
||||
public JObjectCheckBox(String text, Icon icon) {
|
||||
super(text, icon);
|
||||
}
|
||||
|
||||
public JObjectCheckBox(String text, Icon icon, boolean selected) {
|
||||
super(text, icon, selected);
|
||||
}
|
||||
|
||||
public E getObject() {
|
||||
return object;
|
||||
}
|
||||
|
||||
public void setObject(E object) {
|
||||
this.object = object;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.components;
|
||||
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.plaf.basic.BasicComboBoxEditor;
|
||||
|
||||
import mobac.program.model.Profile;
|
||||
|
||||
/**
|
||||
* An editable {@link JComboBox} for displaying the saved atlases profiles.
|
||||
*/
|
||||
public class JProfilesComboBox extends JComboBox {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public JProfilesComboBox() {
|
||||
super();
|
||||
setEditable(true);
|
||||
setEditor(new ProfilesComboBoxEditor());
|
||||
}
|
||||
|
||||
public void loadProfilesList() {
|
||||
setModel(new DefaultComboBoxModel(Profile.getProfiles()));
|
||||
setSelectedIndex(-1);
|
||||
}
|
||||
|
||||
public boolean deleteSelectedProfile() {
|
||||
Profile profile = (Profile) getSelectedItem();
|
||||
if (profile == null)
|
||||
return false;
|
||||
profile.delete();
|
||||
setSelectedIndex(-1);
|
||||
removeItem(profile);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the selected profile or <code>null</code> if no profile is
|
||||
* selected or a new unsaved profile is selected
|
||||
*/
|
||||
public Profile getSelectedProfile() {
|
||||
Object selItem = getSelectedItem();
|
||||
if (selItem instanceof Profile)
|
||||
return (Profile) selItem;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
protected static class ProfilesComboBoxEditor extends BasicComboBoxEditor {
|
||||
@Override
|
||||
protected JTextField createEditorComponent() {
|
||||
JAtlasNameField field = new JAtlasNameField();
|
||||
field.setBorder(new EmptyBorder(2, 2, 2, 0));
|
||||
return field;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package mobac.gui.components;
|
||||
|
||||
import java.awt.Toolkit;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.text.AttributeSet;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.PlainDocument;
|
||||
|
||||
public class JRegexTextField extends JTextField {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public JRegexTextField(String regex, int maxLength) {
|
||||
super();
|
||||
setDocument(new AtlasNameDocument(regex, maxLength));
|
||||
}
|
||||
|
||||
public class AtlasNameDocument extends PlainDocument {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Pattern pattern;
|
||||
public int maxLength;
|
||||
|
||||
public AtlasNameDocument(String regex, int maxLength) {
|
||||
super();
|
||||
pattern = Pattern.compile(regex);
|
||||
this.maxLength = maxLength;
|
||||
}
|
||||
|
||||
public void insertString(int offset, String str, AttributeSet attr)
|
||||
throws BadLocationException {
|
||||
|
||||
if (str == null)
|
||||
return;
|
||||
|
||||
if (!pattern.matcher(str).matches()) {
|
||||
Toolkit.getDefaultToolkit().beep();
|
||||
return;
|
||||
}
|
||||
|
||||
String oldText = JRegexTextField.this.getText();
|
||||
|
||||
super.insertString(offset, str, attr);
|
||||
|
||||
// Maximum length exceeded?
|
||||
if (JRegexTextField.this.getText().length() > maxLength) {
|
||||
JRegexTextField.this.setText(oldText);
|
||||
Toolkit.getDefaultToolkit().beep();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue