[josm-plugins] 01/07: Imported Upstream version 0.0.svn32805+ds
Bas Couwenberg
sebastic at debian.org
Fri Aug 12 14:30:58 UTC 2016
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to branch master
in repository josm-plugins.
commit 16a0685e0a34f150ba81d83d2c1bc95cad684853
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Fri Aug 12 13:35:44 2016 +0200
Imported Upstream version 0.0.svn32805+ds
---
DirectUpload/.classpath | 2 +-
DirectUpload/.settings/org.eclipse.jdt.core.prefs | 6 +-
DirectUpload/build.xml | 2 +-
build-common.xml | 22 ++-
colorscheme/.classpath | 2 +-
colorscheme/.settings/org.eclipse.jdt.core.prefs | 6 +-
colorscheme/build.xml | 2 +-
editgpx/.classpath | 2 +-
editgpx/.settings/org.eclipse.jdt.core.prefs | 6 +-
editgpx/build.xml | 2 +-
lakewalker/.checkstyle | 18 ++
lakewalker/.classpath | 2 +-
lakewalker/.project | 6 +
lakewalker/.settings/org.eclipse.jdt.core.prefs | 6 +-
lakewalker/build.xml | 2 +-
lakewalker/nbproject/project.xml | 2 +-
.../josm/plugins/lakewalker/BooleanConfigurer.java | 27 +--
.../josm/plugins/lakewalker/Configurer.java | 19 +-
.../josm/plugins/lakewalker/DoubleConfigurer.java | 22 +--
.../josm/plugins/lakewalker/IntConfigurer.java | 27 +--
.../josm/plugins/lakewalker/Lakewalker.java | 195 ++++++++++-----------
.../josm/plugins/lakewalker/LakewalkerAction.java | 46 ++---
.../plugins/lakewalker/LakewalkerException.java | 5 +-
.../josm/plugins/lakewalker/LakewalkerPlugin.java | 3 +-
.../plugins/lakewalker/LakewalkerPreferences.java | 5 +-
.../josm/plugins/lakewalker/LakewalkerWMS.java | 83 ++++-----
.../josm/plugins/lakewalker/StringConfigurer.java | 22 +--
.../plugins/lakewalker/StringEnumConfigurer.java | 46 ++---
measurement/.classpath | 2 +-
measurement/.settings/org.eclipse.jdt.core.prefs | 6 +-
measurement/build.xml | 2 +-
.../plugins/measurement/MeasurementDialog.java | 10 +-
openvisible/.classpath | 2 +-
openvisible/.settings/org.eclipse.jdt.core.prefs | 6 +-
openvisible/build.xml | 2 +-
openvisible/nbproject/project.xml | 2 +-
routing/.checkstyle | 18 ++
routing/.classpath | 2 +-
routing/.project | 6 +
routing/.settings/org.eclipse.jdt.core.prefs | 6 +-
routing/build.xml | 2 +-
.../com/innovant/josm/jrt/core/EdgeIterator.java | 5 +-
.../com/innovant/josm/jrt/core/RoutingEdge.java | 21 +--
.../com/innovant/josm/jrt/core/RoutingGraph.java | 118 +++++--------
.../josm/jrt/core/RoutingGraphDelegator.java | 13 +-
.../com/innovant/josm/jrt/core/RoutingProfile.java | 18 +-
.../innovant/josm/jrt/gtfs/GTFSTransportModes.java | 7 +-
routing/src/com/innovant/josm/jrt/osm/OsmEdge.java | 132 ++++++--------
.../src/com/innovant/josm/jrt/osm/OsmWayTypes.java | 88 ++++------
.../innovant/josm/plugin/routing/RoutingLayer.java | 147 +++++++---------
.../innovant/josm/plugin/routing/RoutingModel.java | 63 ++-----
.../josm/plugin/routing/RoutingPlugin.java | 36 +---
.../plugin/routing/actions/AddRouteNodeAction.java | 35 +---
.../routing/actions/MoveRouteNodeAction.java | 45 +----
.../routing/actions/RemoveRouteNodeAction.java | 32 +---
.../josm/plugin/routing/gui/RoutingDialog.java | 34 +---
.../josm/plugin/routing/gui/RoutingMenu.java | 48 ++---
.../routing/gui/RoutingPreferenceDialog.java | 52 ++----
svn-info.xml | 10 +-
59 files changed, 596 insertions(+), 962 deletions(-)
diff --git a/DirectUpload/.classpath b/DirectUpload/.classpath
index 16b39f1..ff10fb7 100644
--- a/DirectUpload/.classpath
+++ b/DirectUpload/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/DirectUpload/.settings/org.eclipse.jdt.core.prefs b/DirectUpload/.settings/org.eclipse.jdt.core.prefs
index f4e5715..4b11014 100644
--- a/DirectUpload/.settings/org.eclipse.jdt.core.prefs
+++ b/DirectUpload/.settings/org.eclipse.jdt.core.prefs
@@ -6,8 +6,8 @@ org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annota
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
@@ -92,4 +92,4 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/DirectUpload/build.xml b/DirectUpload/build.xml
index b3e7e35..3b2a7ed 100644
--- a/DirectUpload/build.xml
+++ b/DirectUpload/build.xml
@@ -4,7 +4,7 @@
<!-- enter the SVN commit message -->
<property name="commit.message" value="applied JOSM Ticket 4498 (patch by ax) - oauth support for gpx upload (I accidentally committed parts of the path in [24236])"/>
<!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
- <property name="plugin.main.version" value="10279"/>
+ <property name="plugin.main.version" value="10580"/>
<!-- Configure these properties (replace "..." accordingly).
See https://josm.openstreetmap.de/wiki/DevelopersGuide/DevelopingPlugins
diff --git a/build-common.xml b/build-common.xml
index 446fdd9..5e3e2e7 100644
--- a/build-common.xml
+++ b/build-common.xml
@@ -15,7 +15,8 @@
<property name="josm" location="../../core/dist/josm-custom.jar"/>
<property name="josm.test.build.dir" location="../../core/test/build"/>
<property name="groovy.jar" location="../00_core_tools/groovy-all-2.4.7.jar"/>
- <property name="checkstyle.jar" location="../00_core_tools/checkstyle/checkstyle-7.0-all.jar"/>
+ <property name="error_prone_ant.jar" location="../00_core_tools/error_prone_ant-2.0.11.jar"/>
+ <property name="checkstyle.jar" location="../00_core_tools/checkstyle/checkstyle-7.1-all.jar"/>
<property name="findbugs-ant.jar" location="../00_core_tools/findbugs/findbugs-ant.jar"/>
<property name="annotations.jar" location="../00_core_tools/findbugs/annotations.jar"/>
<property name="plugin.build.dir" location="build"/>
@@ -24,9 +25,10 @@
<property name="plugin.lib.dir" location="lib"/>
<!-- this is the directory where the plugin jar is copied to -->
<property name="plugin.dist.dir" location="../../dist"/>
- <property name="ant.build.javac.target" value="1.7"/>
- <property name="ant.build.javac.source" value="1.7"/>
+ <property name="ant.build.javac.target" value="1.8"/>
+ <property name="ant.build.javac.source" value="1.8"/>
<property name="plugin.jar" location="${plugin.dist.dir}/${ant.project.name}.jar"/>
+ <property name="javac.compiler" value="com.google.errorprone.ErrorProneAntCompilerAdapter" />
<!-- For Windows-specific stuff -->
<condition property="isWindows">
@@ -70,9 +72,14 @@
</target>
<target name="compile" depends="init, pre-compile" unless="skip-compile">
<echo message="compiling sources for ${plugin.jar} ..."/>
- <javac srcdir="src" debug="true" destdir="${plugin.build.dir}" includeantruntime="false" encoding="UTF-8">
+ <javac compiler="${javac.compiler}" srcdir="src" debug="true" destdir="${plugin.build.dir}" includeantruntime="false" encoding="UTF-8">
+ <compilerclasspath>
+ <pathelement location="${error_prone_ant.jar}"/>
+ </compilerclasspath>
<compilerarg value="-Xlint:deprecation"/>
<compilerarg value="-Xlint:unchecked"/>
+ <compilerarg value="-Xep:ReferenceEquality:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
+ <compilerarg line="-Xmaxwarns 1000"/>
<classpath refid="plugin.classpath"/>
</javac>
</target>
@@ -506,8 +513,11 @@
org/kaintoch/**/*.java,
org/marvinproject/**/*.java,
org/netbeans/**/*.java,
- org/openstreetmap/josm/plugins/ohe/parser/**/*.java
- org/osgeo/**/*.java"/>
+ org/openstreetmap/josm/plugins/ohe/parser/**/*.java,
+ org/openstreetmap/josm/plugins/roadsigns/javacc/**/*.java,
+ org/osgeo/**/*.java,
+ pdfimport/pdfbox/operators/**/*.java
+ "/>
<fileset dir="${basedir}/test" includes="**/*.java" erroronmissingdir="false"/>
<formatter type="xml" toFile="checkstyle-josm-${ant.project.name}.xml"/>
</checkstyle>
diff --git a/colorscheme/.classpath b/colorscheme/.classpath
index 5cde81c..ce92e34 100644
--- a/colorscheme/.classpath
+++ b/colorscheme/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
<classpathentry kind="output" path="build"/>
</classpath>
diff --git a/colorscheme/.settings/org.eclipse.jdt.core.prefs b/colorscheme/.settings/org.eclipse.jdt.core.prefs
index cd2388b..5fc4f2a 100644
--- a/colorscheme/.settings/org.eclipse.jdt.core.prefs
+++ b/colorscheme/.settings/org.eclipse.jdt.core.prefs
@@ -6,8 +6,8 @@ org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annota
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
@@ -92,4 +92,4 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/colorscheme/build.xml b/colorscheme/build.xml
index b9e94e2..0b7a4c8 100644
--- a/colorscheme/build.xml
+++ b/colorscheme/build.xml
@@ -4,7 +4,7 @@
<!-- enter the SVN commit message -->
<property name="commit.message" value="Uses new constructor for Plugin"/>
<!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
- <property name="plugin.main.version" value="7001"/>
+ <property name="plugin.main.version" value="10580"/>
<property name="plugin.author" value="Christof Dallermassl"/>
<property name="plugin.class" value="at.dallermassl.josm.plugin.colorscheme.ColorSchemePlugin"/>
diff --git a/editgpx/.classpath b/editgpx/.classpath
index f1b0bb5..ec7bd9d 100644
--- a/editgpx/.classpath
+++ b/editgpx/.classpath
@@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry excluding="src/" including="images/" kind="src" path=""/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/editgpx/.settings/org.eclipse.jdt.core.prefs b/editgpx/.settings/org.eclipse.jdt.core.prefs
index 741304c..6fecbe3 100644
--- a/editgpx/.settings/org.eclipse.jdt.core.prefs
+++ b/editgpx/.settings/org.eclipse.jdt.core.prefs
@@ -6,8 +6,8 @@ org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annota
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
@@ -93,7 +93,7 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
diff --git a/editgpx/build.xml b/editgpx/build.xml
index 7210979..6e750f1 100644
--- a/editgpx/build.xml
+++ b/editgpx/build.xml
@@ -3,7 +3,7 @@
<!-- enter the SVN commit message -->
<property name="commit.message" value="Changed constructor signature of plugin main class"/>
<!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
- <property name="plugin.main.version" value="10282"/>
+ <property name="plugin.main.version" value="10580"/>
<!-- Configure these properties (replace "..." accordingly).
See https://josm.openstreetmap.de/wiki/DevelopersGuide/DevelopingPlugins
diff --git a/lakewalker/.checkstyle b/lakewalker/.checkstyle
new file mode 100644
index 0000000..8a65e17
--- /dev/null
+++ b/lakewalker/.checkstyle
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
+ <local-check-config name="JOSM" location="/JOSM/tools/checkstyle/josm_checks.xml" type="project" description="">
+ <additional-data name="protect-config-file" value="false"/>
+ </local-check-config>
+ <fileset name="all" enabled="true" check-config-name="JOSM" local="true">
+ <file-match-pattern match-pattern="." include-pattern="true"/>
+ </fileset>
+ <filter name="DerivedFiles" enabled="true"/>
+ <filter name="FilesFromPackage" enabled="true">
+ <filter-data value="data"/>
+ <filter-data value="images"/>
+ <filter-data value="styles"/>
+ <filter-data value="resources"/>
+ <filter-data value="scripts"/>
+ </filter>
+</fileset-config>
diff --git a/lakewalker/.classpath b/lakewalker/.classpath
index 5cde81c..ce92e34 100644
--- a/lakewalker/.classpath
+++ b/lakewalker/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
<classpathentry kind="output" path="build"/>
</classpath>
diff --git a/lakewalker/.project b/lakewalker/.project
index caa4c0b..fe42109 100644
--- a/lakewalker/.project
+++ b/lakewalker/.project
@@ -15,8 +15,14 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
</natures>
</projectDescription>
diff --git a/lakewalker/.settings/org.eclipse.jdt.core.prefs b/lakewalker/.settings/org.eclipse.jdt.core.prefs
index f4e5715..4b11014 100644
--- a/lakewalker/.settings/org.eclipse.jdt.core.prefs
+++ b/lakewalker/.settings/org.eclipse.jdt.core.prefs
@@ -6,8 +6,8 @@ org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annota
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
@@ -92,4 +92,4 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/lakewalker/build.xml b/lakewalker/build.xml
index e9ddcf7..9ba8e7c 100644
--- a/lakewalker/build.xml
+++ b/lakewalker/build.xml
@@ -4,7 +4,7 @@
<!-- enter the SVN commit message -->
<property name="commit.message" value="Changed the constructor signature of the plugin main class"/>
<!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
- <property name="plugin.main.version" value="10353"/>
+ <property name="plugin.main.version" value="10580"/>
<!-- Configure these properties (replace "..." accordingly).
See https://josm.openstreetmap.de/wiki/DevelopersGuide/DevelopingPlugins
diff --git a/lakewalker/nbproject/project.xml b/lakewalker/nbproject/project.xml
index 9c0fdcc..09b75f8 100644
--- a/lakewalker/nbproject/project.xml
+++ b/lakewalker/nbproject/project.xml
@@ -59,7 +59,7 @@
<compilation-unit>
<package-root>src</package-root>
<classpath mode="compile">../../core/src</classpath>
- <source-level>1.7</source-level>
+ <source-level>1.8</source-level>
</compilation-unit>
</java-data>
</configuration>
diff --git a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/BooleanConfigurer.java b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/BooleanConfigurer.java
index cde5e24..e6d3a65 100644
--- a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/BooleanConfigurer.java
+++ b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/BooleanConfigurer.java
@@ -1,28 +1,15 @@
-/*
- * $Id: BooleanConfigurer.java 705 2005-09-15 13:24:50 +0000 (Thu, 15 Sep 2005) rodneykinney $
- *
- * Copyright (c) 2000-2007 by Rodney Kinney, Brent Easton
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License (LGPL) as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, copies are available
- * at http://www.opensource.org.
- */
+// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.lakewalker;
+import java.awt.Component;
+
+import javax.swing.JCheckBox;
+
/**
* Configurer for Boolean values
*/
public class BooleanConfigurer extends Configurer {
- private javax.swing.JCheckBox box;
+ private JCheckBox box;
public BooleanConfigurer() {
this(false);
@@ -72,7 +59,7 @@ public class BooleanConfigurer extends Configurer {
}
@Override
- public java.awt.Component getControls() {
+ public Component getControls() {
if (box == null) {
box = new javax.swing.JCheckBox(getName());
box.setSelected(booleanValue().booleanValue());
diff --git a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Configurer.java b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Configurer.java
index 6e5f3da..958e971 100644
--- a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Configurer.java
+++ b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Configurer.java
@@ -1,21 +1,4 @@
-/*
- * $Id: Configurer.java 2175 2007-06-04 04:19:59 +0000 (Mon, 04 Jun 2007) rodneykinney $
- *
- * Copyright (c) 2000-2007 by Rodney Kinney, Brent Easton
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License (LGPL) as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, copies are available
- * at http://www.opensource.org.
- */
+// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.lakewalker;
import java.beans.PropertyChangeListener;
diff --git a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/DoubleConfigurer.java b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/DoubleConfigurer.java
index 329cfed..327127f 100644
--- a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/DoubleConfigurer.java
+++ b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/DoubleConfigurer.java
@@ -1,21 +1,4 @@
-/*
- * $Id: DoubleConfigurer.java 5 2003-10-02 15:11:38 +0000 (Thu, 02 Oct 2003) rodneykinney $
- *
- * Copyright (c) 2000-2007 by Rodney Kinney, Brent Easton
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License (LGPL) as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, copies are available
- * at http://www.opensource.org.
- */
+// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.lakewalker;
/**
@@ -40,8 +23,7 @@ public class DoubleConfigurer extends StringConfigurer {
Double d = null;
try {
d = Double.valueOf(s);
- }
- catch (NumberFormatException e) {
+ } catch (NumberFormatException e) {
d = null;
}
if (d != null)
diff --git a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/IntConfigurer.java b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/IntConfigurer.java
index 4ff1cbd..224297b 100644
--- a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/IntConfigurer.java
+++ b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/IntConfigurer.java
@@ -1,21 +1,4 @@
-/*
- * $Id: IntConfigurer.java 874 2006-03-15 14:20:56 +0000 (Wed, 15 Mar 2006) rodneykinney $
- *
- * Copyright (c) 2000-2007 by Rodney Kinney, Brent Easton
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License (LGPL) as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, copies are available
- * at http://www.opensource.org.
- */
+// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.lakewalker;
/**
@@ -43,8 +26,7 @@ public class IntConfigurer extends StringConfigurer {
Integer i = null;
try {
i = Integer.valueOf(s);
- }
- catch (NumberFormatException e) {
+ } catch (NumberFormatException e) {
i = null;
}
if (i != null) {
@@ -54,9 +36,8 @@ public class IntConfigurer extends StringConfigurer {
public int getIntValue(int defaultValue) {
if (getValue() instanceof Integer) {
- return ((Integer)getValue()).intValue();
- }
- else {
+ return ((Integer) getValue()).intValue();
+ } else {
return defaultValue;
}
}
diff --git a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Lakewalker.java b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Lakewalker.java
index 1d9e825..9a52ccd 100644
--- a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Lakewalker.java
+++ b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Lakewalker.java
@@ -1,3 +1,4 @@
+// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.lakewalker;
import static org.openstreetmap.josm.tools.I18n.tr;
@@ -17,13 +18,13 @@ public class Lakewalker {
private String startdir;
private String wmslayer;
- private int[] dirslat = new int[] {0,1,1,1,0,-1,-1,-1};
- private int[] dirslon = new int[] {1,1,0,-1,-1,-1,0,1};
+ private int[] dirslat = new int[] {0, 1, 1, 1, 0, -1, -1, -1};
+ private int[] dirslon = new int[] {1, 1, 0, -1, -1, -1, 0, 1};
double start_radius_big = 0.001;
double start_radius_small = 0.0002;
- public Lakewalker(int waylen, int maxnode, int threshold, double epsilon, int resolution, int tilesize, String startdir, String wmslayer){
+ public Lakewalker(int waylen, int maxnode, int threshold, double epsilon, int resolution, int tilesize, String startdir, String wmslayer) {
this.maxnode = maxnode;
this.threshold = threshold;
this.resolution = resolution;
@@ -42,56 +43,50 @@ public class Lakewalker {
* south = 6
* southeast = 7
*/
- private int getDirectionIndex(String direction) throws ArrayIndexOutOfBoundsException{
- int i=0;
- if(direction.equals("East") || direction.equals("east")){
+ private int getDirectionIndex(String direction) throws ArrayIndexOutOfBoundsException {
+ int i = 0;
+ if (direction.equals("East") || direction.equals("east")) {
i = 0;
- } else if(direction.equals("Northeast") || direction.equals("northeast")){
- i = 1;
- } else if(direction.equals("North") || direction.equals("north")){
- i = 2;
- } else if(direction.equals("Northwest") || direction.equals("northwest")){
- i = 3;
- } else if(direction.equals("West") || direction.equals("west")){
- i = 4;
- } else if(direction.equals("Southwest") || direction.equals("southwest")){
- i = 5;
- } else if(direction.equals("South") || direction.equals("south")){
- i = 6;
- } else if(direction.equals("Southeast") || direction.equals("southeast")){
- i = 7;
+ } else if (direction.equals("Northeast") || direction.equals("northeast")) {
+ i = 1;
+ } else if (direction.equals("North") || direction.equals("north")) {
+ i = 2;
+ } else if (direction.equals("Northwest") || direction.equals("northwest")) {
+ i = 3;
+ } else if (direction.equals("West") || direction.equals("west")) {
+ i = 4;
+ } else if (direction.equals("Southwest") || direction.equals("southwest")) {
+ i = 5;
+ } else if (direction.equals("South") || direction.equals("south")) {
+ i = 6;
+ } else if (direction.equals("Southeast") || direction.equals("southeast")) {
+ i = 7;
} else {
- throw new ArrayIndexOutOfBoundsException(tr("Direction index ''{0}'' not found",direction));
+ throw new ArrayIndexOutOfBoundsException(tr("Direction index ''{0}'' not found", direction));
}
return i;
}
/**
* Do a trace
- *
- * @param lat
- * @param lon
- * @param tl_lon
- * @param br_lon
- * @param tl_lat
- * @param br_lat
*/
- public ArrayList<double[]> trace(double lat, double lon, double tl_lon, double br_lon, double tl_lat, double br_lat, ProgressMonitor progressMonitor) throws LakewalkerException {
+ public ArrayList<double[]> trace(double lat, double lon, double tl_lon, double br_lon, double tl_lat, double br_lat,
+ ProgressMonitor progressMonitor) throws LakewalkerException {
progressMonitor.beginTask(null);
try {
LakewalkerWMS wms = new LakewalkerWMS(this.resolution, this.tilesize, this.wmslayer);
- LakewalkerBBox bbox = new LakewalkerBBox(tl_lat,tl_lon,br_lat,br_lon);
+ LakewalkerBBox bbox = new LakewalkerBBox(tl_lat, tl_lon, br_lat, br_lon);
Boolean detect_loop = false;
ArrayList<double[]> nodelist = new ArrayList<>();
- int[] xy = geo_to_xy(lat,lon,this.resolution);
+ int[] xy = geo_to_xy(lat, lon, this.resolution);
- if(!bbox.contains(lat, lon)){
+ if (!bbox.contains(lat, lon)) {
throw new LakewalkerException(tr("The starting location was not within the bbox"));
}
@@ -99,14 +94,14 @@ public class Lakewalker {
progressMonitor.indeterminateSubTask(tr("Looking for shoreline..."));
- while(true){
- double[] geo = xy_to_geo(xy[0],xy[1],this.resolution);
- if(bbox.contains(geo[0],geo[1])==false){
+ while (true) {
+ double[] geo = xy_to_geo(xy[0], xy[1], this.resolution);
+ if (bbox.contains(geo[0], geo[1]) == false) {
break;
}
v = wms.getPixel(xy[0], xy[1], progressMonitor.createSubTaskMonitor(0, false));
- if(v > this.threshold){
+ if (v > this.threshold) {
break;
}
@@ -115,32 +110,31 @@ public class Lakewalker {
xy[0] = xy[0]+delta_lon;
xy[1] = xy[1]+delta_lat;
-
}
int[] startxy = new int[] {xy[0], xy[1]};
- double[] startgeo = xy_to_geo(xy[0],xy[1],this.resolution);
+ double[] startgeo = xy_to_geo(xy[0], xy[1], this.resolution);
//System.out.printf("Found shore at lat %.4f lon %.4f\n",lat,lon);
int last_dir = this.getDirectionIndex(this.startdir);
- for(int i = 0; i < this.maxnode; i++){
+ for (int i = 0; i < this.maxnode; i++) {
// Print a counter
- if(i % 250 == 0){
- progressMonitor.indeterminateSubTask(tr("{0} nodes so far...",i));
+ if (i % 250 == 0) {
+ progressMonitor.indeterminateSubTask(tr("{0} nodes so far...", i));
//System.out.println(i+" nodes so far...");
}
// Some variables we need
int d;
- int test_x=0;
- int test_y=0;
+ int test_x = 0;
+ int test_y = 0;
int new_dir = 0;
// Loop through all the directions we can go
- for(d = 1; d <= this.dirslat.length; d++){
+ for (d = 1; d <= this.dirslat.length; d++) {
// Decide which direction we want to look at from this pixel
new_dir = (last_dir + d + 4) % 8;
@@ -148,19 +142,19 @@ public class Lakewalker {
test_x = xy[0] + this.dirslon[new_dir];
test_y = xy[1] + this.dirslat[new_dir];
- double[] geo = xy_to_geo(test_x,test_y,this.resolution);
+ double[] geo = xy_to_geo(test_x, test_y, this.resolution);
- if(!bbox.contains(geo[0], geo[1])){
+ if (!bbox.contains(geo[0], geo[1])) {
System.out.println("Outside bbox");
break;
}
v = wms.getPixel(test_x, test_y, progressMonitor.createSubTaskMonitor(0, false));
- if(v > this.threshold){
+ if (v > this.threshold) {
break;
}
- if(d == this.dirslat.length-1){
+ if (d == this.dirslat.length-1) {
System.out.println("Got stuck");
break;
}
@@ -174,25 +168,25 @@ public class Lakewalker {
xy[1] = test_y;
// Break the loop if we managed to get back to our starting point
- if(xy[0] == startxy[0] && xy[1] == startxy[1]){
+ if (xy[0] == startxy[0] && xy[1] == startxy[1]) {
break;
}
// Store this node
- double[] geo = xy_to_geo(xy[0],xy[1],this.resolution);
+ double[] geo = xy_to_geo(xy[0], xy[1], this.resolution);
nodelist.add(geo);
//System.out.println("Adding node at "+xy[0]+","+xy[1]+" ("+geo[1]+","+geo[0]+")");
// Check if we got stuck in a loop
- double start_proximity = Math.pow((geo[0] - startgeo[0]),2) + Math.pow((geo[1] - startgeo[1]),2);
+ double start_proximity = Math.pow((geo[0] - startgeo[0]), 2) + Math.pow((geo[1] - startgeo[1]), 2);
- if(detect_loop){
- if(start_proximity < Math.pow(start_radius_small,2)){
+ if (detect_loop) {
+ if (start_proximity < Math.pow(start_radius_small, 2)) {
System.out.println("Detected loop");
break;
}
- }else{
- if(start_proximity > Math.pow(start_radius_big,2)){
+ } else {
+ if (start_proximity > Math.pow(start_radius_big, 2)) {
detect_loop = true;
}
}
@@ -206,22 +200,19 @@ public class Lakewalker {
/**
* Remove duplicate nodes from the list
- *
- * @param nodes
- * @return
*/
- public ArrayList<double[]> duplicateNodeRemove(ArrayList<double[]> nodes){
+ public ArrayList<double[]> duplicateNodeRemove(ArrayList<double[]> nodes) {
- if(nodes.size() <= 1){
+ if (nodes.size() <= 1) {
return nodes;
}
- double lastnode[] = new double[] {nodes.get(0)[0], nodes.get(0)[1]};
+ double[] lastnode = new double[] {nodes.get(0)[0], nodes.get(0)[1]};
- for(int i = 1; i < nodes.size(); i++){
+ for (int i = 1; i < nodes.size(); i++) {
double[] thisnode = new double[] {nodes.get(i)[0], nodes.get(i)[1]};
- if(thisnode[0] == lastnode[0] && thisnode[1] == lastnode[1]){
+ if (thisnode[0] == lastnode[0] && thisnode[1] == lastnode[1]) {
// Remove the node
nodes.remove(i);
@@ -236,15 +227,11 @@ public class Lakewalker {
/**
* Reduce the number of vertices based on their proximity to each other
- *
- * @param nodes
- * @param proximity
- * @return
*/
- public ArrayList<double[]> vertexReduce(ArrayList<double[]> nodes, double proximity){
+ public ArrayList<double[]> vertexReduce(ArrayList<double[]> nodes, double proximity) {
// Check if node list is empty
- if(nodes.size()<=1){
+ if (nodes.size() <= 1) {
return nodes;
}
@@ -253,8 +240,8 @@ public class Lakewalker {
double prox_sq = Math.pow(proximity, 2);
- for(int v = 0; v < nodes.size(); v++){
- if(Math.pow(nodes.get(v)[0] - test_v[0],2) + Math.pow(nodes.get(v)[1] - test_v[1],2) > prox_sq){
+ for (int v = 0; v < nodes.size(); v++) {
+ if (Math.pow(nodes.get(v)[0] - test_v[0], 2) + Math.pow(nodes.get(v)[1] - test_v[1], 2) > prox_sq) {
reducednodes.add(nodes.get(v));
test_v = nodes.get(v);
}
@@ -263,7 +250,7 @@ public class Lakewalker {
return reducednodes;
}
- public double pointLineDistance(double[] p1, double[] p2, double[] p3){
+ public double pointLineDistance(double[] p1, double[] p2, double[] p3) {
double x0 = p1[0];
double y0 = p1[1];
@@ -272,35 +259,35 @@ public class Lakewalker {
double x2 = p3[0];
double y2 = p3[1];
- if(x2 == x1 && y2 == y1){
- return Math.sqrt(Math.pow(x1-x0,2) + Math.pow(y1-y0,2));
+ if (x2 == x1 && y2 == y1) {
+ return Math.sqrt(Math.pow(x1-x0, 2) + Math.pow(y1-y0, 2));
} else {
- return Math.abs((x2-x1)*(y1-y0) - (x1-x0)*(y2-y1)) / Math.sqrt(Math.pow(x2-x1,2) + Math.pow(y2-y1,2));
+ return Math.abs((x2-x1)*(y1-y0) - (x1-x0)*(y2-y1)) / Math.sqrt(Math.pow(x2-x1, 2) + Math.pow(y2-y1, 2));
}
}
/*
- public ArrayList<double[]> douglasPeuckerNR(ArrayList<double[]> nodes, double epsilon){
+ public ArrayList<double[]> douglasPeuckerNR(ArrayList<double[]> nodes, double epsilon) {
command_stack = [(0, len(nodes) - 1)]
Vector result_stack = new Vector();
- while(command_stack.size() > 0){
+ while (command_stack.size() > 0) {
cmd = command_stack.pop();
- if(type(cmd) == tuple){
+ if (type(cmd) == tuple) {
(start, end) = cmd
(node, dist) = dp_findpoint(nodes, start, end)
- if(dist > epsilon){
+ if (dist > epsilon) {
command_stack.append("+")
command_stack.append((start, node))
command_stack.append((node, end))
} else {
result_stack.append((start, end))
}
- } elseif(cmd == "+"){
+ } elseif (cmd == "+") {
first = result_stack.pop()
second = result_stack.pop()
- if(first[-1] == second[0]){
+ if (first[-1] == second[0]) {
result_stack.append(first + second[1:])
//print "Added %s and %s; result is %s" % (first, second, result_stack[-1])
}else {
@@ -313,7 +300,7 @@ public class Lakewalker {
error("ERROR: Can't understand command \"%s\"" % (cmd,))
return
- if(len(result_stack) == 1){
+ if (len(result_stack) == 1) {
return [nodes[x] for x in result_stack[0]];
} else {
error("ERROR: Command stack is empty but result stack has %d nodes!" % len(result_stack));
@@ -325,14 +312,14 @@ public class Lakewalker {
first = nodes[0]
last = nodes[-1]
- for(i in xrange(1, len(nodes) - 1){
+ for (i in xrange(1, len(nodes) - 1) {
d = point_line_distance(nodes[i], first, last)
- if(d > farthest_dist){
+ if (d > farthest_dist) {
farthest_dist = d
farthest_node = i
}
}
- if(farthest_dist > epsilon){
+ if (farthest_dist > epsilon) {
seg_a = douglas_peucker(nodes[0:farthest_node+1], epsilon)
seg_b = douglas_peucker(nodes[farthest_node:-1], epsilon)
//print "Minimized %d nodes to %d + %d nodes" % (len(nodes), len(seg_a), len(seg_b))
@@ -344,10 +331,10 @@ public class Lakewalker {
}
*/
- public ArrayList<double[]> douglasPeucker(ArrayList<double[]> nodes, double epsilon, int depth){
+ public ArrayList<double[]> douglasPeucker(ArrayList<double[]> nodes, double epsilon, int depth) {
// Check if node list is empty
- if(nodes.size()<=1 || depth > 500){
+ if (nodes.size() <= 1 || depth > 500) {
return nodes;
}
@@ -360,9 +347,9 @@ public class Lakewalker {
double d = 0;
- for(int i = 1; i < nodes.size(); i++){
- d = pointLineDistance(nodes.get(i),first,last);
- if(d>farthest_dist){
+ for (int i = 1; i < nodes.size(); i++) {
+ d = pointLineDistance(nodes.get(i), first, last);
+ if (d > farthest_dist) {
farthest_dist = d;
farthest_node = i;
}
@@ -371,9 +358,9 @@ public class Lakewalker {
List<double[]> seg_a;
List<double[]> seg_b;
- if(farthest_dist > epsilon){
- seg_a = douglasPeucker(sublist(nodes,0,farthest_node+1),epsilon, depth+1);
- seg_b = douglasPeucker(sublist(nodes,farthest_node,nodes.size()-1),epsilon,depth+1);
+ if (farthest_dist > epsilon) {
+ seg_a = douglasPeucker(sublist(nodes, 0, farthest_node+1), epsilon, depth+1);
+ seg_b = douglasPeucker(sublist(nodes, farthest_node, nodes.size()-1), epsilon, depth+1);
new_nodes.addAll(seg_a);
new_nodes.addAll(seg_b);
@@ -387,28 +374,28 @@ public class Lakewalker {
private ArrayList<double[]> sublist(ArrayList<double[]> l, int i, int f) throws ArrayIndexOutOfBoundsException {
ArrayList<double[]> sub = new ArrayList<>();
- if(f<i || i < 0 || f < 0 || f > l.size()){
+ if (f < i || i < 0 || f < 0 || f > l.size()) {
throw new ArrayIndexOutOfBoundsException();
}
- for(int j = i; j < f; j++){
+ for (int j = i; j < f; j++) {
sub.add(l.get(j));
}
return sub;
}
- public double[] xy_to_geo(int x, int y, double resolution){
+ public double[] xy_to_geo(int x, int y, double resolution) {
double[] geo = new double[2];
geo[0] = y / resolution;
geo[1] = x / resolution;
return geo;
}
- public int[] geo_to_xy(double lat, double lon, double resolution){
+ public int[] geo_to_xy(double lat, double lon, double resolution) {
int[] xy = new int[2];
- xy[0] = (int)Math.floor(lon * resolution + 0.5);
- xy[1] = (int)Math.floor(lat * resolution + 0.5);
+ xy[0] = (int) Math.floor(lon * resolution + 0.5);
+ xy[1] = (int) Math.floor(lat * resolution + 0.5);
return xy;
}
@@ -432,21 +419,21 @@ public class Lakewalker {
private double bottom = -90;
private double right = 180;
- protected LakewalkerBBox(double top, double left, double bottom, double right){
+ protected LakewalkerBBox(double top, double left, double bottom, double right) {
this.left = left;
this.right = right;
this.top = top;
this.bottom = bottom;
}
- protected Boolean contains(double lat, double lon){
- if(lat >= this.top || lat <= this.bottom){
+ protected Boolean contains(double lat, double lon) {
+ if (lat >= this.top || lat <= this.bottom) {
return false;
}
- if(lon >= this.right || lon <= this.left){
+ if (lon >= this.right || lon <= this.left) {
return false;
}
- if((this.right - this.left) % 360 == 0){
+ if ((this.right - this.left) % 360 == 0) {
return true;
}
return (lon - this.left) % 360 <= (this.right - this.left) % 360;
diff --git a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java
index 12aa882..760e441 100644
--- a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java
+++ b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java
@@ -1,3 +1,4 @@
+// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.lakewalker;
import static org.openstreetmap.josm.tools.I18n.tr;
@@ -48,7 +49,7 @@ class LakewalkerAction extends JosmAction implements MouseListener {
protected Collection<Command> commands = new LinkedList<>();
protected Collection<Way> ways = new ArrayList<>();
- public LakewalkerAction(String name) {
+ LakewalkerAction(String name) {
super(name, "lakewalker-sml", tr("Lake Walker."),
Shortcut.registerShortcut("tools:lakewalker", tr("Tool: {0}", tr("Lake Walker")),
KeyEvent.VK_L, Shortcut.ALT_CTRL_SHIFT), true);
@@ -57,7 +58,7 @@ class LakewalkerAction extends JosmAction implements MouseListener {
}
public void actionPerformed(ActionEvent e) {
- if(Main.map == null || Main.map.mapView == null || active)
+ if (Main.map == null || Main.map.mapView == null || active)
return;
active = true;
@@ -78,12 +79,12 @@ class LakewalkerAction extends JosmAction implements MouseListener {
File wmsCacheDir = new File(LakewalkerPlugin.getLakewalkerCacheDir(), wmsFolder);
if (wmsCacheDir.exists() && wmsCacheDir.isDirectory()) {
- File wmsCache[] = wmsCacheDir.listFiles();
+ File[] wmsCache = wmsCacheDir.listFiles();
// sort files by date (most recent first)
Arrays.sort(wmsCache, new Comparator<File>() {
public int compare(File f1, File f2) {
- return (int)(f2.lastModified()-f1.lastModified());
+ return (int) (f2.lastModified()-f1.lastModified());
}
});
@@ -109,13 +110,13 @@ class LakewalkerAction extends JosmAction implements MouseListener {
// create cache directory
if (!wmsCacheDir.mkdirs()) {
JOptionPane.showMessageDialog(Main.parent,
- tr("Error creating cache directory: {0}", wmsCacheDir.getPath()));
+ tr("Error creating cache directory: {0}", wmsCacheDir.getPath()));
}
}
}
}
- protected void lakewalk(Point clickPoint){
+ protected void lakewalk(Point clickPoint) {
// Positional data
final LatLon pos = Main.map.mapView.getLatLon(clickPoint.x, clickPoint.y);
final LatLon topLeft = Main.map.mapView.getLatLon(0, 0);
@@ -135,14 +136,15 @@ class LakewalkerAction extends JosmAction implements MouseListener {
final String wmslayer = Main.pref.get(LakewalkerPreferences.PREF_WMS, "IR1");
try {
- PleaseWaitRunnable lakewalkerTask = new PleaseWaitRunnable(tr("Tracing")){
+ PleaseWaitRunnable lakewalkerTask = new PleaseWaitRunnable(tr("Tracing")) {
@Override protected void realRun() throws SAXException {
progressMonitor.subTask(tr("checking cache..."));
cleanupCache();
processnodelist(pos, topLeft, botRight, waylen, maxnode, threshold,
- epsilon,resolution,tilesize,startdir,wmslayer,
+ epsilon, resolution, tilesize, startdir, wmslayer,
progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false));
}
+
@Override protected void finish() {
}
@@ -152,23 +154,22 @@ class LakewalkerAction extends JosmAction implements MouseListener {
};
Thread executeThread = new Thread(lakewalkerTask);
executeThread.start();
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
System.out.println("Exception caught: " + ex.getMessage());
}
}
private void processnodelist(LatLon pos, LatLon topLeft, LatLon botRight, int waylen, int maxnode, int threshold,
- double epsilon, int resolution, int tilesize, String startdir, String wmslayer, ProgressMonitor progressMonitor){
+ double epsilon, int resolution, int tilesize, String startdir, String wmslayer, ProgressMonitor progressMonitor) {
progressMonitor.beginTask(null, 3);
try {
ArrayList<double[]> nodelist = new ArrayList<>();
- Lakewalker lw = new Lakewalker(waylen,maxnode,threshold,epsilon,resolution,tilesize,startdir,wmslayer);
+ Lakewalker lw = new Lakewalker(waylen, maxnode, threshold, epsilon, resolution, tilesize, startdir, wmslayer);
try {
- nodelist = lw.trace(pos.lat(),pos.lon(),topLeft.lon(),botRight.lon(),topLeft.lat(),botRight.lat(),
+ nodelist = lw.trace(pos.lat(), pos.lon(), topLeft.lon(), botRight.lon(), topLeft.lat(), botRight.lat(),
progressMonitor.createSubTaskMonitor(1, false));
- } catch(LakewalkerException e){
+ } catch (LakewalkerException e) {
System.out.println(e.getMessage());
}
@@ -225,7 +226,7 @@ class LakewalkerAction extends JosmAction implements MouseListener {
int nodesinway = 0;
- for(int i = 0; i< nodelist.size(); i++){
+ for (int i = 0; i < nodelist.size(); i++) {
if (cancel) {
return;
}
@@ -233,7 +234,7 @@ class LakewalkerAction extends JosmAction implements MouseListener {
try {
LatLon ll = new LatLon(nodelist.get(i)[0]+northOffset, nodelist.get(i)[1]+eastOffset);
n = new Node(ll);
- if(fn==null){
+ if (fn == null) {
fn = n;
}
commands.add(new AddCommand(n));
@@ -244,11 +245,11 @@ class LakewalkerAction extends JosmAction implements MouseListener {
way.addNode(n);
- if(nodesinway > Main.pref.getInteger(LakewalkerPreferences.PREF_MAX_SEG, 500)){
+ if (nodesinway > Main.pref.getInteger(LakewalkerPreferences.PREF_MAX_SEG, 500)) {
String waytype = Main.pref.get(LakewalkerPreferences.PREF_WAYTYPE, "water");
- if(!waytype.equals("none")){
- way.put("natural",waytype);
+ if (!waytype.equals("none")) {
+ way.put("natural", waytype);
}
way.put("source", Main.pref.get(LakewalkerPreferences.PREF_SOURCE, "Landsat"));
@@ -266,8 +267,8 @@ class LakewalkerAction extends JosmAction implements MouseListener {
String waytype = Main.pref.get(LakewalkerPreferences.PREF_WAYTYPE, "water");
- if(!waytype.equals("none")){
- way.put("natural",waytype);
+ if (!waytype.equals("none")) {
+ way.put("natural", waytype);
}
way.put("source", Main.pref.get(LakewalkerPreferences.PREF_SOURCE, "Landsat"));
@@ -295,8 +296,7 @@ class LakewalkerAction extends JosmAction implements MouseListener {
}
public void mouseClicked(MouseEvent e) {
- if(active)
- {
+ if (active) {
active = false;
Main.map.mapView.removeMouseListener(this);
Main.map.mapView.setCursor(oldCursor);
diff --git a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerException.java b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerException.java
index 6f4bb08..7aa3bfd 100644
--- a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerException.java
+++ b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerException.java
@@ -1,13 +1,14 @@
+// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.lakewalker;
import static org.openstreetmap.josm.tools.I18n.tr;
class LakewalkerException extends Exception {
- public LakewalkerException(){
+ LakewalkerException() {
super(tr("An unknown error has occurred"));
}
- public LakewalkerException(String err){
+ LakewalkerException(String err) {
super(err);
}
}
diff --git a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPlugin.java b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPlugin.java
index ddc152b..fbfc4be 100644
--- a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPlugin.java
+++ b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPlugin.java
@@ -1,3 +1,4 @@
+// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.lakewalker;
import static org.openstreetmap.josm.tools.I18n.tr;
@@ -27,6 +28,6 @@ public class LakewalkerPlugin extends Plugin {
}
public static File getLakewalkerCacheDir() {
- return new File(Main.pref.getCacheDirectory(), "lakewalkerwms");
+ return new File(Main.pref.getCacheDirectory(), "lakewalkerwms");
}
}
diff --git a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPreferences.java b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPreferences.java
index 3ebde4e..3555d52 100644
--- a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPreferences.java
+++ b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPreferences.java
@@ -1,3 +1,4 @@
+// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.lakewalker;
import static org.openstreetmap.josm.tools.I18n.marktr;
@@ -108,8 +109,8 @@ public class LakewalkerPreferences extends DefaultTabPreferenceSetting {
}
public void buildPreferences(JPanel prefPanel) {
- GBC labelConstraints = GBC.std().insets(10,5,5,0);
- GBC dataConstraints = GBC.eol().insets(0,5,0,0).fill(GridBagConstraints.HORIZONTAL);
+ GBC labelConstraints = GBC.std().insets(10, 5, 5, 0);
+ GBC dataConstraints = GBC.eol().insets(0, 5, 0, 0).fill(GridBagConstraints.HORIZONTAL);
prefPanel.add(maxSegsLabel, labelConstraints);
prefPanel.add(maxSegsConfig.getControls(), dataConstraints);
diff --git a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerWMS.java b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerWMS.java
index ae71738..e504575 100644
--- a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerWMS.java
+++ b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerWMS.java
@@ -1,3 +1,4 @@
+// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.lakewalker;
import static org.openstreetmap.josm.tools.I18n.tr;
@@ -30,14 +31,14 @@ public class LakewalkerWMS {
// Vector to cache images in memory
private List<BufferedImage> images = new Vector<>();
// Hashmap to hold the mapping of cached images
- private Map<String,Integer> imageindex = new HashMap<>();
+ private Map<String, Integer> imageindex = new HashMap<>();
private int resolution;
private int tilesize;
private String wmslayer;
- public LakewalkerWMS(int resolution, int tilesize, String wmslayer){
+ public LakewalkerWMS(int resolution, int tilesize, String wmslayer) {
this.resolution = resolution;
this.tilesize = tilesize;
this.wmslayer = wmslayer;
@@ -49,15 +50,15 @@ public class LakewalkerWMS {
String layer = "global_mosaic_base";
int[] bottom_left_xy = new int[2];
- bottom_left_xy[0] = floor(x,this.tilesize);
- bottom_left_xy[1] = floor(y,this.tilesize);
+ bottom_left_xy[0] = floor(x, this.tilesize);
+ bottom_left_xy[1] = floor(y, this.tilesize);
int[] top_right_xy = new int[2];
top_right_xy[0] = bottom_left_xy[0] + this.tilesize;
top_right_xy[1] = bottom_left_xy[1] + this.tilesize;
- double[] topright_geo = xy_to_geo(top_right_xy[0],top_right_xy[1],this.resolution);
- double[] bottomleft_geo = xy_to_geo(bottom_left_xy[0],bottom_left_xy[1],this.resolution);
+ double[] topright_geo = xy_to_geo(top_right_xy[0], top_right_xy[1], this.resolution);
+ double[] bottomleft_geo = xy_to_geo(bottom_left_xy[0], bottom_left_xy[1], this.resolution);
String filename = this.wmslayer+"/landsat_"+this.resolution+"_"+this.tilesize+
"_xy_"+bottom_left_xy[0]+"_"+bottom_left_xy[1]+".png";
@@ -65,7 +66,7 @@ public class LakewalkerWMS {
// The WMS server only understands decimal points using periods, so we need
// to convert to a locale that uses that to build the proper URL
NumberFormat nf = NumberFormat.getInstance(Locale.ENGLISH);
- DecimalFormat df = (DecimalFormat)nf;
+ DecimalFormat df = (DecimalFormat) nf;
df.applyLocalizedPattern("0.000000");
String urlloc = "http://onearth.jpl.nasa.gov/wms.cgi?request=GetMap&layers="+layer+
@@ -80,11 +81,11 @@ public class LakewalkerWMS {
String hashkey = Integer.toString(bottom_left_xy[0])+":"+Integer.toString(bottom_left_xy[1]);
// See if this image is already loaded
- if(this.image != null){
- if(this.imagex != bottom_left_xy[0] || this.imagey != bottom_left_xy[1]){
+ if (this.image != null) {
+ if (this.imagex != bottom_left_xy[0] || this.imagey != bottom_left_xy[1]) {
// Check if this image exists in the hashmap
- if(this.imageindex.containsKey(hashkey)){
+ if (this.imageindex.containsKey(hashkey)) {
// Store which image we have
this.imagex = bottom_left_xy[0];
this.imagey = bottom_left_xy[1];
@@ -107,17 +108,17 @@ public class LakewalkerWMS {
this.image = ImageIO.read(file);
this.images.add(this.image);
- this.imageindex.put(hashkey,this.images.size()-1);
+ this.imageindex.put(hashkey, this.images.size()-1);
- } catch(FileNotFoundException e){
+ } catch (FileNotFoundException e) {
System.out.println("Could not find cached image, downloading.");
- } catch(IOException e){
+ } catch (IOException e) {
System.out.println(e.getMessage());
- } catch(Exception e){
+ } catch (Exception e) {
System.out.println(e.getMessage());
}
- if(this.image == null){
+ if (this.image == null) {
/**
* Try downloading the image
*/
@@ -127,26 +128,26 @@ public class LakewalkerWMS {
// Read from a URL
URL url = new URL(urlloc);
this.image = ImageIO.read(url); // this can return null!
- } catch(MalformedURLException e){
+ } catch (MalformedURLException e) {
System.out.println(e.getMessage());
- } catch(IOException e){
+ } catch (IOException e) {
System.out.println(e.getMessage());
- } catch(Exception e){
+ } catch (Exception e) {
System.out.println(e.getMessage());
}
if (this.image != null) {
this.images.add(this.image);
- this.imageindex.put(hashkey,this.images.size()-1);
+ this.imageindex.put(hashkey, this.images.size()-1);
- this.saveimage(file,this.image);
+ this.saveimage(file, this.image);
}
}
this.imagex = bottom_left_xy[0];
this.imagey = bottom_left_xy[1];
- if(this.image == null){
+ if (this.image == null) {
throw new LakewalkerException(tr("Could not acquire image"));
}
@@ -156,77 +157,77 @@ public class LakewalkerWMS {
}
}
- public void saveimage(File file, BufferedImage image){
+ public void saveimage(File file, BufferedImage image) {
/**
* Save the image to the cache
*/
try {
ImageIO.write(image, "png", file);
System.out.println("Saved image to cache");
- } catch(Exception e){
+ } catch (Exception e) {
System.out.println(e.getMessage());
}
}
- public int getPixel(int x, int y, ProgressMonitor progressMonitor) throws LakewalkerException{
+ public int getPixel(int x, int y, ProgressMonitor progressMonitor) throws LakewalkerException {
// Get the previously shown text
BufferedImage image = null;
try {
- image = this.getTile(x,y, progressMonitor);
- } catch(LakewalkerException e){
+ image = this.getTile(x, y, progressMonitor);
+ } catch (LakewalkerException e) {
System.out.println(e.getMessage());
throw e;
}
- int tx = floor(x,this.tilesize);
- int ty = floor(y,this.tilesize);
+ int tx = floor(x, this.tilesize);
+ int ty = floor(y, this.tilesize);
int pixel_x = (x-tx);
int pixel_y = (this.tilesize-1)-(y-ty);
//System.out.println("("+x+","+y+") maps to ("+pixel_x+","+pixel_y+") by ("+tx+", "+ty+")");
- int rgb = image.getRGB(pixel_x,pixel_y);
+ int rgb = image.getRGB(pixel_x, pixel_y);
int pixel;
int r = (rgb >> 16) & 0xff;
- int g = (rgb >> 8) & 0xff;
- int b = (rgb >> 0) & 0xff;
+ int g = (rgb >> 8) & 0xff;
+ int b = (rgb >> 0) & 0xff;
- pixel = (int)((0.30 * r) + (0.59 * b) + (0.11 * g));
+ pixel = (int) ((0.30 * r) + (0.59 * b) + (0.11 * g));
return pixel;
}
- public int floor(int num, int precision){
- double dnum = num/(double)precision;
- BigDecimal val = new BigDecimal(dnum) ;
+ public int floor(int num, int precision) {
+ double dnum = num/(double) precision;
+ BigDecimal val = new BigDecimal(dnum);
val = val.setScale(0, BigDecimal.ROUND_FLOOR);
return val.intValue()*precision;
}
public double floor(double num) {
- BigDecimal val = new BigDecimal(num) ;
+ BigDecimal val = new BigDecimal(num);
val = val.setScale(0, BigDecimal.ROUND_FLOOR);
- return val.doubleValue() ;
+ return val.doubleValue();
}
- public double[] xy_to_geo(int x, int y, double resolution){
+ public double[] xy_to_geo(int x, int y, double resolution) {
double[] geo = new double[2];
geo[0] = y / resolution;
geo[1] = x / resolution;
return geo;
}
- public int[] geo_to_xy(double lat, double lon, double resolution){
+ public int[] geo_to_xy(double lat, double lon, double resolution) {
int[] xy = new int[2];
- xy[0] = (int)Math.floor(lon * resolution + 0.5);
- xy[1] = (int)Math.floor(lat * resolution + 0.5);
+ xy[0] = (int) Math.floor(lon * resolution + 0.5);
+ xy[1] = (int) Math.floor(lat * resolution + 0.5);
return xy;
}
diff --git a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringConfigurer.java b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringConfigurer.java
index 0b24e7a..ec6f807 100644
--- a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringConfigurer.java
+++ b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringConfigurer.java
@@ -1,21 +1,4 @@
-/*
- * $Id: StringConfigurer.java 2073 2007-05-10 14:34:31 +0000 (Thu, 10 May 2007) rodneykinney $
- *
- * Copyright (c) 2000-2007 by Rodney Kinney, Brent Easton
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License (LGPL) as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, copies are available
- * at http://www.opensource.org.
- */
+// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.lakewalker;
import javax.swing.BoxLayout;
@@ -65,8 +48,7 @@ public java.awt.Component getControls() {
p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
p.add(new JLabel(getName()));
- nameField.setMaximumSize
- (new java.awt.Dimension(nameField.getMaximumSize().width,
+ nameField.setMaximumSize(new java.awt.Dimension(nameField.getMaximumSize().width,
nameField.getPreferredSize().height));
nameField.setText(getValueString());
p.add(nameField);
diff --git a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringEnumConfigurer.java b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringEnumConfigurer.java
index ffe6d99..30f421e 100644
--- a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringEnumConfigurer.java
+++ b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringEnumConfigurer.java
@@ -1,29 +1,4 @@
-/*
- * $Id: StringEnumConfigurer.java 2472 2007-10-01 04:10:19 +0000 (Mon, 01 Oct 2007) rodneykinney $
- *
- * Copyright (c) 2000-2007 by Rodney Kinney, Brent Easton
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License (LGPL) as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, copies are available
- * at http://www.opensource.org.
- */
-/*
- * Created by IntelliJ IDEA.
- * User: rkinney
- * Date: Jul 20, 2002
- * Time: 3:52:36 AM
- * To change template for new class use
- * Code Style | Class Templates options (Tools | IDE Options).
- */
+// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.lakewalker;
import static org.openstreetmap.josm.tools.I18n.tr;
@@ -51,8 +26,9 @@ public class StringEnumConfigurer extends Configurer {
super(key, name);
this.validValues = validValues;
transValues = new String[validValues.length];
- for(int i = 0; i < validValues.length; ++i)
+ for (int i = 0; i < validValues.length; ++i) {
transValues[i] = tr(validValues[i]);
+ }
}
public StringEnumConfigurer(String[] validValues) {
@@ -62,6 +38,7 @@ public class StringEnumConfigurer extends Configurer {
public void setToolTipText(String s) {
tooltipText = s;
}
+
@Override
public Component getControls() {
if (panel == null) {
@@ -69,7 +46,7 @@ public class StringEnumConfigurer extends Configurer {
panel.add(new JLabel(name));
box = new JComboBox<>(transValues);
box.setToolTipText(tooltipText);
- box.setMaximumSize(new Dimension(box.getMaximumSize().width,box.getPreferredSize().height));
+ box.setMaximumSize(new Dimension(box.getMaximumSize().width, box.getPreferredSize().height));
setValue(value);
box.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
@@ -85,19 +62,18 @@ public class StringEnumConfigurer extends Configurer {
@Override
public void setValue(Object o) {
- if(o == null)
+ if (o == null)
o = 0;
super.setValue(o);
- if(!noUpdate && box != null)
- box.setSelectedIndex((Integer)o);
+ if (!noUpdate && box != null)
+ box.setSelectedIndex((Integer) o);
}
@Override
public void setValue(String s) {
Integer n = 0;
- for (int i = 0; i < transValues.length; ++i)
- {
- if (transValues[i].equals(s) || validValues[i].equals(s)){
+ for (int i = 0; i < transValues.length; ++i) {
+ if (transValues[i].equals(s) || validValues[i].equals(s)) {
n = i;
break;
}
@@ -107,6 +83,6 @@ public class StringEnumConfigurer extends Configurer {
@Override
public String getValueString() {
- return validValues[(Integer)value];
+ return validValues[(Integer) value];
}
}
diff --git a/measurement/.classpath b/measurement/.classpath
index d31e11e..c4a791c 100644
--- a/measurement/.classpath
+++ b/measurement/.classpath
@@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry including="images/" kind="src" path=""/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
<classpathentry kind="output" path="build"/>
</classpath>
diff --git a/measurement/.settings/org.eclipse.jdt.core.prefs b/measurement/.settings/org.eclipse.jdt.core.prefs
index 27108f1..8aaf659 100644
--- a/measurement/.settings/org.eclipse.jdt.core.prefs
+++ b/measurement/.settings/org.eclipse.jdt.core.prefs
@@ -6,9 +6,9 @@ org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annota
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -96,4 +96,4 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/measurement/build.xml b/measurement/build.xml
index ccb206c..fc388bc 100644
--- a/measurement/build.xml
+++ b/measurement/build.xml
@@ -3,7 +3,7 @@
<!-- enter the SVN commit message -->
<property name="commit.message" value="recompile dure to core change"/>
<!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
- <property name="plugin.main.version" value="10369"/>
+ <property name="plugin.main.version" value="10580"/>
<property name="plugin.canloadatruntime" value="true"/>
<!-- Configure these properties (replace "..." accordingly).
diff --git a/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementDialog.java b/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementDialog.java
index 1a7c445..9d42b55 100644
--- a/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementDialog.java
+++ b/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementDialog.java
@@ -89,8 +89,8 @@ public class MeasurementDialog extends ToggleDialog implements SelectionChangedL
public MeasurementDialog()
{
super(tr("Measured values"), "measure", tr("Open the measurement window."),
- Shortcut.registerShortcut("subwindow:measurement", tr("Toggle: {0}", tr("Measured values")),
- KeyEvent.VK_U, Shortcut.CTRL_SHIFT), 150);
+ Shortcut.registerShortcut("subwindow:measurement", tr("Toggle: {0}", tr("Measured values")),
+ KeyEvent.VK_U, Shortcut.CTRL_SHIFT), 150);
resetButton = new SideButton(new AbstractAction() {
{
@@ -138,7 +138,7 @@ public class MeasurementDialog extends ToggleDialog implements SelectionChangedL
this.setPreferredSize(new Dimension(0, 92));
createLayout(valuePanel, false, Arrays.asList(new SideButton[] {
- resetButton
+ resetButton
}));
DataSet.addSelectionListener(this);
@@ -209,12 +209,12 @@ public class MeasurementDialog extends ToggleDialog implements SelectionChangedL
length += segLength;
//http://local.wasp.uwa.edu.au/~pbourke/geometry/polyarea/
wayArea += (MeasurementLayer.calcX(n.getCoor()) * MeasurementLayer.calcY(lastN.getCoor()))
- - (MeasurementLayer.calcY(n.getCoor()) * MeasurementLayer.calcX(lastN.getCoor()));
+ - (MeasurementLayer.calcY(n.getCoor()) * MeasurementLayer.calcX(lastN.getCoor()));
segAngle = MeasurementLayer.angleBetween(lastN.getCoor(), n.getCoor());
}
lastN = n;
}
- if (lastN != null && lastN == w.getNodes().iterator().next())
+ if (lastN != null && lastN.equals(w.getNodes().iterator().next()))
wayArea = Math.abs(wayArea / 2);
else
wayArea = 0;
diff --git a/openvisible/.classpath b/openvisible/.classpath
index 16b39f1..ff10fb7 100644
--- a/openvisible/.classpath
+++ b/openvisible/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/openvisible/.settings/org.eclipse.jdt.core.prefs b/openvisible/.settings/org.eclipse.jdt.core.prefs
index f4e5715..4b11014 100644
--- a/openvisible/.settings/org.eclipse.jdt.core.prefs
+++ b/openvisible/.settings/org.eclipse.jdt.core.prefs
@@ -6,8 +6,8 @@ org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annota
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
@@ -92,4 +92,4 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/openvisible/build.xml b/openvisible/build.xml
index 65bbda1..7bd1478 100644
--- a/openvisible/build.xml
+++ b/openvisible/build.xml
@@ -4,7 +4,7 @@
<!-- enter the SVN commit message -->
<property name="commit.message" value="Changed the constructor signature of the plugin main class; updated build.xml"/>
<!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
- <property name="plugin.main.version" value="10279"/>
+ <property name="plugin.main.version" value="10580"/>
<!-- Configure these properties (replace "..." accordingly).
See https://josm.openstreetmap.de/wiki/DevelopersGuide/DevelopingPlugins
diff --git a/openvisible/nbproject/project.xml b/openvisible/nbproject/project.xml
index de95a81..1d6e68d 100644
--- a/openvisible/nbproject/project.xml
+++ b/openvisible/nbproject/project.xml
@@ -59,7 +59,7 @@
<compilation-unit>
<package-root>src</package-root>
<classpath mode="compile">../../core/src</classpath>
- <source-level>1.7</source-level>
+ <source-level>1.8</source-level>
</compilation-unit>
</java-data>
</configuration>
diff --git a/routing/.checkstyle b/routing/.checkstyle
new file mode 100644
index 0000000..8a65e17
--- /dev/null
+++ b/routing/.checkstyle
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
+ <local-check-config name="JOSM" location="/JOSM/tools/checkstyle/josm_checks.xml" type="project" description="">
+ <additional-data name="protect-config-file" value="false"/>
+ </local-check-config>
+ <fileset name="all" enabled="true" check-config-name="JOSM" local="true">
+ <file-match-pattern match-pattern="." include-pattern="true"/>
+ </fileset>
+ <filter name="DerivedFiles" enabled="true"/>
+ <filter name="FilesFromPackage" enabled="true">
+ <filter-data value="data"/>
+ <filter-data value="images"/>
+ <filter-data value="styles"/>
+ <filter-data value="resources"/>
+ <filter-data value="scripts"/>
+ </filter>
+</fileset-config>
diff --git a/routing/.classpath b/routing/.classpath
index 873bf46..5d6a2c6 100644
--- a/routing/.classpath
+++ b/routing/.classpath
@@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="lib/jgrapht-jdk1.5.jar"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
<classpathentry combineaccessrules="false" kind="src" path="/JOSM-log4j"/>
<classpathentry kind="output" path="build"/>
diff --git a/routing/.project b/routing/.project
index e758683..e24deea 100644
--- a/routing/.project
+++ b/routing/.project
@@ -15,8 +15,14 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
</natures>
</projectDescription>
diff --git a/routing/.settings/org.eclipse.jdt.core.prefs b/routing/.settings/org.eclipse.jdt.core.prefs
index 27108f1..8aaf659 100644
--- a/routing/.settings/org.eclipse.jdt.core.prefs
+++ b/routing/.settings/org.eclipse.jdt.core.prefs
@@ -6,9 +6,9 @@ org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annota
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -96,4 +96,4 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/routing/build.xml b/routing/build.xml
index b12c736..07470d8 100644
--- a/routing/build.xml
+++ b/routing/build.xml
@@ -4,7 +4,7 @@
<!-- enter the SVN commit message -->
<property name="commit.message" value="added one-way support in roundabouts"/>
<!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
- <property name="plugin.main.version" value="10279"/>
+ <property name="plugin.main.version" value="10580"/>
<!--
**********************************************************
diff --git a/routing/src/com/innovant/josm/jrt/core/EdgeIterator.java b/routing/src/com/innovant/josm/jrt/core/EdgeIterator.java
index 778797b..da545e8 100644
--- a/routing/src/com/innovant/josm/jrt/core/EdgeIterator.java
+++ b/routing/src/com/innovant/josm/jrt/core/EdgeIterator.java
@@ -1,9 +1,10 @@
+// License: GPL. For details, see LICENSE file.
package com.innovant.josm.jrt.core;
public interface EdgeIterator {
- public boolean hasNext();
+ boolean hasNext();
- public RoutingEdge next();
+ RoutingEdge next();
}
diff --git a/routing/src/com/innovant/josm/jrt/core/RoutingEdge.java b/routing/src/com/innovant/josm/jrt/core/RoutingEdge.java
index ba9fd7d..82080c9 100644
--- a/routing/src/com/innovant/josm/jrt/core/RoutingEdge.java
+++ b/routing/src/com/innovant/josm/jrt/core/RoutingEdge.java
@@ -1,27 +1,28 @@
+// License: GPL. For details, see LICENSE file.
package com.innovant.josm.jrt.core;
import org.openstreetmap.josm.data.coor.LatLon;
public interface RoutingEdge {
- public LatLon fromLatLon();
+ LatLon fromLatLon();
- public LatLon toLatLon();
+ LatLon toLatLon();
- public Object fromV();
+ Object fromV();
- public Object toV();
+ Object toV();
- public double getLength();
+ double getLength();
- public void setLength(double length);
+ void setLength(double length);
- public double getSpeed();
+ double getSpeed();
- public void setSpeed(double speed);
+ void setSpeed(double speed);
- public boolean isOneway();
+ boolean isOneway();
- public void setOneway(boolean isOneway);
+ void setOneway(boolean isOneway);
}
diff --git a/routing/src/com/innovant/josm/jrt/core/RoutingGraph.java b/routing/src/com/innovant/josm/jrt/core/RoutingGraph.java
index 3b060a0..2a99efe 100644
--- a/routing/src/com/innovant/josm/jrt/core/RoutingGraph.java
+++ b/routing/src/com/innovant/josm/jrt/core/RoutingGraph.java
@@ -1,30 +1,4 @@
-/*
- * Copyright (C) 2008 Innovant
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
- *
- * For more information, please contact:
- *
- * Innovant
- * juangui at gmail.com
- * vidalfree at gmail.com
- *
- * http://public.grupoinnovant.com/blog
- *
- */
-
+// License: GPL. For details, see LICENSE file.
package com.innovant.josm.jrt.core;
import java.util.ArrayList;
@@ -67,12 +41,15 @@ public class RoutingGraph {
*/
public enum Algorithm {
ROUTING_ALG_DIJKSTRA, ROUTING_ALG_BELLMANFORD
- };
+ }
/**
* Search criteria for the route.
*/
- public enum RouteType {FASTEST,SHORTEST};
+ public enum RouteType {
+ FASTEST,
+ SHORTEST
+ }
/**
*
@@ -90,10 +67,10 @@ public class RoutingGraph {
static Logger logger = Logger.getLogger(RoutingGraph.class);
private static Collection<String> excludedHighwayValues = Arrays.asList(new String[]{
- "bus_stop", "traffic_signals", "street_lamp", "stop", "construction",
- "platform", "give_way", "proposed", "milestone", "speed_camera", "abandoned"
+ "bus_stop", "traffic_signals", "street_lamp", "stop", "construction",
+ "platform", "give_way", "proposed", "milestone", "speed_camera", "abandoned"
});
-
+
/**
* Graph state
* <code>true</code> Graph in memory.
@@ -107,35 +84,33 @@ public class RoutingGraph {
// private DirectedWeightedMultigraph<Node, OsmEdge> graph;
// private WeightedMultigraph<Node, OsmEdge> graph;
private Graph<Node, OsmEdge> graph;
- private RoutingGraphDelegator rgDelegator=null;
+ private RoutingGraphDelegator rgDelegator = null;
/**
* Graph getter
*/
- public Graph<Node, OsmEdge> getGraph(){
+ public Graph<Node, OsmEdge> getGraph() {
return graph;
-
}
-
- private void addEdgeBidirectional( Way way, Node from, Node to){
- addEdge(way,from,to);
- addEdge(way,to,from);
+ private void addEdgeBidirectional(Way way, Node from, Node to) {
+ addEdge(way, from, to);
+ addEdge(way, to, from);
}
- private void addEdgeReverseOneway( Way way, Node from, Node to){
- addEdge(way,to,from);
+ private void addEdgeReverseOneway(Way way, Node from, Node to) {
+ addEdge(way, to, from);
}
- private void addEdgeNormalOneway( Way way, Node from, Node to){
- addEdge(way,from,to);
+ private void addEdgeNormalOneway(Way way, Node from, Node to) {
+ addEdge(way, from, to);
}
/**
* Speeds
*/
- private Map<String,Double> waySpeeds;
+ private Map<String, Double> waySpeeds;
/**
* Default Constructor.
@@ -144,8 +119,8 @@ public class RoutingGraph {
// this.graphState = false;
this.graph = null;
this.data = data;
- routeType=RouteType.SHORTEST;
- routingProfile=new RoutingProfile("default");
+ routeType = RouteType.SHORTEST;
+ routingProfile = new RoutingProfile("default");
routingProfile.setOnewayUse(true); // Don't ignore oneways by default
this.setWaySpeeds(routingProfile.getWaySpeeds());
logger.debug("Created RoutingGraph");
@@ -153,14 +128,12 @@ public class RoutingGraph {
/**
* Create OSM graph for routing
- *
- * @return
*/
public void createGraph() {
logger.debug("Creating Graph...");
graph = new DirectedWeightedMultigraph<>(OsmEdge.class);
- rgDelegator=new RoutingGraphDelegator(graph);
+ rgDelegator = new RoutingGraphDelegator(graph);
rgDelegator.setRouteType(this.routeType);
// iterate all ways and segments for all nodes:
for (Way way : data.getWays()) {
@@ -177,20 +150,20 @@ public class RoutingGraph {
/*
* Assume node is A B C D E. The procedure should be
- *
+ *
* case 1 - bidirectional ways:
* 1) Add vertex A B C D E
* 2) Link A<->B, B<->C, C<->D, D<->E as Edges
- *
+ *
* case 2 - oneway reverse:
* 1) Add vertex A B C D E
* 2) Link B->A,C->B,D->C,E->D as Edges. result: A<-B<-C<-D<-E
- *
+ *
* case 3 - oneway normal:
* 1) Add vertex A B C D E
* 2) Link A->B, B->C, C->D, D->E as Edges. result: A->B->C->D->E
- *
- *
+ *
+ *
*/
String oneway_val = way.get("oneway"); /* get (oneway=?) tag for this way. */
@@ -243,11 +216,8 @@ public class RoutingGraph {
/**
* Compute weight and add edge to the graph
- * @param way
- * @param from
- * @param to
*/
- private void addEdge(Way way,Node from, Node to) {
+ private void addEdge(Way way, Node from, Node to) {
LatLon fromLL = from.getCoor();
LatLon toLL = from.getCoor();
if (fromLL == null || toLL == null) {
@@ -262,9 +232,9 @@ public class RoutingGraph {
double weight = getWeight(way, length);
setWeight(edge, length);
logger.debug("edge for way " + way.getId()
- + "(from node " + from.getId() + " to node "
- + to.getId() + ") has weight: " + weight);
- ((DirectedWeightedMultigraph<Node,OsmEdge>)graph).setEdgeWeight(edge, weight);
+ + "(from node " + from.getId() + " to node "
+ + to.getId() + ") has weight: " + weight);
+ ((DirectedWeightedMultigraph<Node, OsmEdge>) graph).setEdgeWeight(edge, weight);
}
/**
@@ -274,7 +244,6 @@ public class RoutingGraph {
*
* @param way
* the way.
- * @return
*/
private void setWeight(OsmEdge osmedge, double length) {
@@ -291,7 +260,6 @@ public class RoutingGraph {
*
* @param way
* the way.
- * @return
*/
private double getWeight(Way way, double length) {
// Default speed if no setting is found
@@ -301,12 +269,12 @@ public class RoutingGraph {
case SHORTEST:
// Same speed for all types of ways
if (this.waySpeeds.containsKey("residential"))
- speed=this.waySpeeds.get("residential");
+ speed = this.waySpeeds.get("residential");
break;
case FASTEST:
// Each type of way may have a different speed
if (this.waySpeeds.containsKey(way.get("highway")))
- speed=this.waySpeeds.get(way.get("highway"));
+ speed = this.waySpeeds.get(way.get("highway"));
logger.debug("Speed="+speed);
break;
default:
@@ -326,7 +294,7 @@ public class RoutingGraph {
public boolean isvalidWay(Way way) {
//if (!way.isTagged()) <---not needed me thinks
// return false;
-
+
String highway = way.get("highway");
return (highway != null && !excludedHighwayValues.contains(highway)) || way.get("junction") != null
@@ -347,9 +315,9 @@ public class RoutingGraph {
*/
public List<OsmEdge> applyAlgorithm(List<Node> nodes, Algorithm algorithm) {
List<OsmEdge> path = new ArrayList<>();
- Graph<Node,OsmEdge> g;
+ Graph<Node, OsmEdge> g;
double totalWeight = 0;
- RoutingLayer layer = (RoutingLayer)Main.getLayerManager().getActiveLayer();
+ RoutingLayer layer = (RoutingLayer) Main.getLayerManager().getActiveLayer();
RoutingModel routingModel = layer.getRoutingModel();
if (graph == null || routingModel.getOnewayChanged())
@@ -404,9 +372,9 @@ public class RoutingGraph {
* Return the number of vertices.
* @return the number of vertices.
*/
- public int getVertexCount(){
- int value=0;
- if (graph!=null) value=graph.vertexSet().size();
+ public int getVertexCount() {
+ int value = 0;
+ if (graph != null) value = graph.vertexSet().size();
return value;
}
@@ -414,9 +382,9 @@ public class RoutingGraph {
* Return the number of edges.
* @return the number of edges.
*/
- public int getEdgeCount(){
- int value=0;
- if (graph!=null) value=graph.edgeSet().size();
+ public int getEdgeCount() {
+ int value = 0;
+ if (graph != null) value = graph.edgeSet().size();
return value;
}
@@ -444,7 +412,7 @@ public class RoutingGraph {
}
public void resetGraph() {
- graph=null;
+ graph = null;
}
public RoutingProfile getRoutingProfile() {
diff --git a/routing/src/com/innovant/josm/jrt/core/RoutingGraphDelegator.java b/routing/src/com/innovant/josm/jrt/core/RoutingGraphDelegator.java
index e9e5135..c03ac8e 100644
--- a/routing/src/com/innovant/josm/jrt/core/RoutingGraphDelegator.java
+++ b/routing/src/com/innovant/josm/jrt/core/RoutingGraphDelegator.java
@@ -1,6 +1,4 @@
-/**
- *
- */
+// License: GPL. For details, see LICENSE file.
package com.innovant.josm.jrt.core;
import org.apache.log4j.Logger;
@@ -8,7 +6,6 @@ import org.jgrapht.Graph;
import org.jgrapht.graph.GraphDelegator;
import org.openstreetmap.josm.data.osm.Node;
-import com.innovant.josm.jrt.core.RoutingGraphDelegator;
import com.innovant.josm.jrt.core.RoutingGraph.RouteType;
import com.innovant.josm.jrt.osm.OsmEdge;
@@ -32,7 +29,6 @@ public class RoutingGraphDelegator extends GraphDelegator<Node, OsmEdge> {
super(arg0);
}
-
public RouteType getRouteType() {
return routeType;
}
@@ -41,7 +37,6 @@ public class RoutingGraphDelegator extends GraphDelegator<Node, OsmEdge> {
this.routeType = routeType;
}
-
/**
*
*/
@@ -49,10 +44,10 @@ public class RoutingGraphDelegator extends GraphDelegator<Node, OsmEdge> {
@Override
public double getEdgeWeight(OsmEdge edge) {
- double weight=Double.MAX_VALUE;
+ double weight = Double.MAX_VALUE;
- if (routeType==RouteType.SHORTEST) weight=edge.getLength();
- if (routeType==RouteType.FASTEST) weight=edge.getLength() / edge.getSpeed();
+ if (routeType == RouteType.SHORTEST) weight = edge.getLength();
+ if (routeType == RouteType.FASTEST) weight = edge.getLength() / edge.getSpeed();
// Return the time spent to traverse the way
return weight;
}
diff --git a/routing/src/com/innovant/josm/jrt/core/RoutingProfile.java b/routing/src/com/innovant/josm/jrt/core/RoutingProfile.java
index 23d71d1..0543993 100644
--- a/routing/src/com/innovant/josm/jrt/core/RoutingProfile.java
+++ b/routing/src/com/innovant/josm/jrt/core/RoutingProfile.java
@@ -1,3 +1,4 @@
+// License: GPL. For details, see LICENSE file.
package com.innovant.josm.jrt.core;
import java.util.HashMap;
@@ -56,14 +57,14 @@ public class RoutingProfile {
* Holds traverse speed for each type of way, using the type as key.
* A speed of zero means that this type of way cannot be traversed.
*/
- private Map<String,Double> waySpeeds;
+ private Map<String, Double> waySpeeds;
/**
* Holds permission of use for each type of transport mode, using the mode as key.
*/
- private Map<String,Boolean> allowedModes;
+ private Map<String, Boolean> allowedModes;
/**
* Constructor
@@ -74,13 +75,14 @@ public class RoutingProfile {
public RoutingProfile(String name) {
logger.debug("Init RoutingProfile with name: "+name);
this.name = name;
- waySpeeds=new HashMap<>();
- Map<String,String> prefs=Main.pref.getAllPrefix("routing.profile."+name+".speed");
- for(String key:prefs.keySet()){
+ waySpeeds = new HashMap<>();
+ Map<String, String> prefs = Main.pref.getAllPrefix("routing.profile."+name+".speed");
+ for (String key:prefs.keySet()) {
waySpeeds.put((key.split("\\.")[4]), Double.valueOf(prefs.get(key)));
}
- for (String key:waySpeeds.keySet())
+ for (String key:waySpeeds.keySet()) {
logger.debug(key+ "-- speed: "+waySpeeds.get(key));
+ }
logger.debug("End init RoutingProfile with name: "+name);
}
@@ -146,8 +148,8 @@ public class RoutingProfile {
return allowedModes.get(mode);
}
- public double getSpeed(String key){
- if(!waySpeeds.containsKey(key)) return 0.0;
+ public double getSpeed(String key) {
+ if (!waySpeeds.containsKey(key)) return 0.0;
return waySpeeds.get(key);
}
diff --git a/routing/src/com/innovant/josm/jrt/gtfs/GTFSTransportModes.java b/routing/src/com/innovant/josm/jrt/gtfs/GTFSTransportModes.java
index b9c5581..6ffc3ba 100644
--- a/routing/src/com/innovant/josm/jrt/gtfs/GTFSTransportModes.java
+++ b/routing/src/com/innovant/josm/jrt/gtfs/GTFSTransportModes.java
@@ -1,3 +1,4 @@
+// License: GPL. For details, see LICENSE file.
package com.innovant.josm.jrt.gtfs;
/**
@@ -6,7 +7,11 @@ package com.innovant.josm.jrt.gtfs;
* TODO Using integers is suitable to parse gtfs feeds but
* Routing Profile keys should be Strings
*/
-public class GTFSTransportModes {
+public final class GTFSTransportModes {
+
+ private GTFSTransportModes() {
+
+ }
/**
* 0 - Tram, Streetcar, Light rail. Any light rail or street level system within
diff --git a/routing/src/com/innovant/josm/jrt/osm/OsmEdge.java b/routing/src/com/innovant/josm/jrt/osm/OsmEdge.java
index 34c96c5..b5a0af5 100644
--- a/routing/src/com/innovant/josm/jrt/osm/OsmEdge.java
+++ b/routing/src/com/innovant/josm/jrt/osm/OsmEdge.java
@@ -1,29 +1,4 @@
-/*
- * Copyright (C) 2008 Innovant
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
- *
- * For more information, please contact:
- *
- * Innovant
- * juangui at gmail.com
- * vidalfree at gmail.com
- *
- * http://public.grupoinnovant.com/blog
- *
- */
+// License: GPL. For details, see LICENSE file.
package com.innovant.josm.jrt.osm;
import org.jgrapht.graph.DefaultWeightedEdge;
@@ -36,73 +11,70 @@ import org.openstreetmap.josm.data.osm.Way;
* @author jose
*/
public class OsmEdge extends DefaultWeightedEdge {
- /**
- * Serial
- */
- private static final long serialVersionUID = 1L;
- /**
- * Way associated
- */
- private Way way;
- /**
- * Nodes in the edge
- */
- private Node from, to;
- /**
- * Length edge
- */
- private double length;
- /**
- * Speed edge.
- */
- private double speed;
-
+ /**
+ * Serial
+ */
+ private static final long serialVersionUID = 1L;
+ /**
+ * Way associated
+ */
+ private Way way;
+ /**
+ * Nodes in the edge
+ */
+ private Node from, to;
+ /**
+ * Length edge
+ */
+ private double length;
+ /**
+ * Speed edge.
+ */
+ private double speed;
-/**
- * Constructor
- * @param way
- * @param length
- */
- public OsmEdge(Way way, Node from, Node to) {
+ /**
+ * Constructor
+ */
+ public OsmEdge(Way way, Node from, Node to) {
super();
this.way = way;
this.from = from;
this.to = to;
this.length = from.getCoor().greatCircleDistance(to.getCoor());
- }
+ }
- /**
- * @return the way
- */
- public Way getWay() {
- return this.way;
- }
+ /**
+ * @return the way
+ */
+ public Way getWay() {
+ return this.way;
+ }
- public EastNorth fromEastNorth() {
- return this.from.getEastNorth();
- }
+ public EastNorth fromEastNorth() {
+ return this.from.getEastNorth();
+ }
- public EastNorth toEastNorth() {
- return this.to.getEastNorth();
- }
+ public EastNorth toEastNorth() {
+ return this.to.getEastNorth();
+ }
- /**
- * Returns length of segment in meters
- * @return length of segment in meters.
- */
- public double getLength() {
- return length;
- }
+ /**
+ * Returns length of segment in meters
+ * @return length of segment in meters.
+ */
+ public double getLength() {
+ return length;
+ }
- public void setLength(double length) {
- this.length = length;
-}
+ public void setLength(double length) {
+ this.length = length;
+ }
-public double getSpeed() {
+ public double getSpeed() {
return speed;
- }
+ }
- public void setSpeed(double speed) {
+ public void setSpeed(double speed) {
this.speed = speed;
- }
+ }
}
diff --git a/routing/src/com/innovant/josm/jrt/osm/OsmWayTypes.java b/routing/src/com/innovant/josm/jrt/osm/OsmWayTypes.java
index 0a110ce..8073d38 100644
--- a/routing/src/com/innovant/josm/jrt/osm/OsmWayTypes.java
+++ b/routing/src/com/innovant/josm/jrt/osm/OsmWayTypes.java
@@ -1,31 +1,4 @@
-/*
- *
- * Copyright (C) 2008 Innovant
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
- *
- * For more information, please contact:
- *
- * Innovant
- * juangui at gmail.com
- * vidalfree at gmail.com
- *
- * http://public.grupoinnovant.com/blog
- *
- */
-
+// License: GPL. For details, see LICENSE file.
package com.innovant.josm.jrt.osm;
/**
@@ -33,34 +6,33 @@ package com.innovant.josm.jrt.osm;
*
*/
public enum OsmWayTypes {
- MOTORWAY ("motorway",120),
- MOTORWAY_LINK ("motorway_link",120),
- TRUNK ("trunk",120),
- TRUNK_LINK ("trunk_link",120),
- PRIMARY ("primary",100),
- PRIMARY_LINK ("primary_link",100),
- SECONDARY ("secondary",90),
- TERTIARY ("tertiary",90),
- UNCLASSIFIED ("unclassified",50),
- ROAD ("road",100),
- RESIDENTIAL ("residential",50),
- LIVING_STREET ("living_street",30),
- SERVICE ("service",30),
- TRACK ("track",50),
- PEDESTRIAN ("pedestrian",30),
- BUS_GUIDEWAY ("bus_guideway",50),
- PATH ("path",40),
- CYCLEWAY ("cycleway",40),
- FOOTWAY ("footway",20),
- BRIDLEWAY ("bridleway",40),
- BYWAY ("byway",50),
- STEPS ("steps",10);
+ MOTORWAY("motorway", 120),
+ MOTORWAY_LINK("motorway_link", 120),
+ TRUNK("trunk", 120),
+ TRUNK_LINK("trunk_link", 120),
+ PRIMARY("primary", 100),
+ PRIMARY_LINK("primary_link", 100),
+ SECONDARY("secondary", 90),
+ TERTIARY("tertiary", 90),
+ UNCLASSIFIED("unclassified", 50),
+ ROAD("road", 100),
+ RESIDENTIAL("residential", 50),
+ LIVING_STREET("living_street", 30),
+ SERVICE("service", 30),
+ TRACK("track", 50),
+ PEDESTRIAN("pedestrian", 30),
+ BUS_GUIDEWAY("bus_guideway", 50),
+ PATH("path", 40),
+ CYCLEWAY("cycleway", 40),
+ FOOTWAY("footway", 20),
+ BRIDLEWAY("bridleway", 40),
+ BYWAY("byway", 50),
+ STEPS("steps", 10);
/**
* Default Constructor
- * @param tag
*/
- OsmWayTypes(String tag,int speed) {
+ OsmWayTypes(String tag, int speed) {
this.tag = tag;
this.speed = speed;
}
@@ -71,9 +43,11 @@ public enum OsmWayTypes {
private final String tag;
private final int speed;
- /**
- * @return
- */
- public String getTag() {return tag;};
- public int getSpeed() {return speed;};
+ public String getTag() {
+ return tag;
+ }
+
+ public int getSpeed() {
+ return speed;
+ }
}
diff --git a/routing/src/com/innovant/josm/plugin/routing/RoutingLayer.java b/routing/src/com/innovant/josm/plugin/routing/RoutingLayer.java
index f8f0190..42600e3 100644
--- a/routing/src/com/innovant/josm/plugin/routing/RoutingLayer.java
+++ b/routing/src/com/innovant/josm/plugin/routing/RoutingLayer.java
@@ -1,30 +1,4 @@
-/*
- * Copyright (C) 2008 Innovant
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
- *
- * For more information, please contact:
- *
- * Innovant
- * juangui at gmail.com
- * vidalfree at gmail.com
- *
- * http://public.grupoinnovant.com/blog
- *
- */
-
+// License: GPL. For details, see LICENSE file.
package com.innovant.josm.plugin.routing;
import static org.openstreetmap.josm.tools.I18n.marktr;
@@ -71,17 +45,19 @@ import com.innovant.josm.jrt.osm.OsmEdge;
public class RoutingLayer extends Layer {
public enum PreferencesKeys {
- KEY_ACTIVE_ROUTE_COLOR (marktr("routing active route")),
- KEY_INACTIVE_ROUTE_COLOR (marktr("routing inactive route")),
- KEY_ROUTE_WIDTH ("routing.route.width"),
- KEY_ROUTE_SELECT ("routing.route.select");
+ KEY_ACTIVE_ROUTE_COLOR(marktr("routing active route")),
+ KEY_INACTIVE_ROUTE_COLOR(marktr("routing inactive route")),
+ KEY_ROUTE_WIDTH("routing.route.width"),
+ KEY_ROUTE_SELECT("routing.route.select");
public final String key;
- PreferencesKeys (String key) {
- this.key=key;
+ PreferencesKeys(String key) {
+ this.key = key;
}
- public String getKey() {return key;};
+ public String getKey() {
+ return key;
+ }
}
/**
@@ -102,7 +78,7 @@ public class RoutingLayer extends Layer {
/**
* Start, Middle and End icons
*/
- private Icon startIcon,middleIcon,endIcon;
+ private Icon startIcon, middleIcon, endIcon;
/**
* Associated OSM layer
@@ -116,13 +92,13 @@ public class RoutingLayer extends Layer {
public RoutingLayer(String name, OsmDataLayer dataLayer) {
super(name);
logger.debug("Creating Routing Layer...");
- if(startIcon == null) startIcon = ImageProvider.get("routing", "startflag");
- if(middleIcon == null) middleIcon = ImageProvider.get("routing", "middleflag");
- if(endIcon == null) endIcon = ImageProvider.get("routing", "endflag");
+ if (startIcon == null) startIcon = ImageProvider.get("routing", "startflag");
+ if (middleIcon == null) middleIcon = ImageProvider.get("routing", "middleflag");
+ if (endIcon == null) endIcon = ImageProvider.get("routing", "endflag");
this.dataLayer = dataLayer;
this.routingModel = new RoutingModel(dataLayer.data);
logger.debug("Routing Layer created.");
-
+
this.routingModel.routingGraph.createGraph(); /* construct the graph right after we we create the layer */
Main.map.repaint(); /* update MapView */
@@ -154,7 +130,7 @@ public class RoutingLayer extends Layer {
int snapDistance = NavigatableComponent.PROP_SNAP_DISTANCE.get();
double minDist = 0;
for (Way w : dataLayer.data.getWays()) {
- if (w.isDeleted() || w.isIncomplete() || w.get("highway")==null) continue;
+ if (w.isDeleted() || w.isIncomplete() || w.get("highway") == null) continue;
for (Node n : w.getNodes()) {
if (n.isDeleted() || n.isIncomplete()) continue;
@@ -180,11 +156,11 @@ public class RoutingLayer extends Layer {
@Override
public Object getInfoComponent() {
String info = "<html>"
- + "<body>"
- +"Graph Vertex: "+this.routingModel.routingGraph.getVertexCount()+"<br/>"
- +"Graph Edges: "+this.routingModel.routingGraph.getEdgeCount()+"<br/>"
- + "</body>"
- + "</html>";
+ + "<body>"
+ +"Graph Vertex: "+this.routingModel.routingGraph.getVertexCount()+"<br/>"
+ +"Graph Edges: "+this.routingModel.routingGraph.getEdgeCount()+"<br/>"
+ + "</body>"
+ + "</html>";
return info;
}
@@ -192,7 +168,7 @@ public class RoutingLayer extends Layer {
public Action[] getMenuEntries() {
Collection<Action> components = new ArrayList<>();
components.add(LayerListDialog.getInstance().createShowHideLayerAction());
-// components.add(new JMenuItem(new LayerListDialog.ShowHideMarkerText(this)));
+ // components.add(new JMenuItem(new LayerListDialog.ShowHideMarkerText(this)));
components.add(LayerListDialog.getInstance().createDeleteLayerAction());
components.add(SeparatorLayerAction.INSTANCE);
components.add(new RenameLayerAction(getAssociatedFile(), this));
@@ -240,33 +216,33 @@ public class RoutingLayer extends Layer {
// FIXME add after good width is found: Main.pref.put(KEY_ROUTE_WIDTH, widthString);
}
int width = Integer.parseInt(widthString);
-
-
+
+
// draw our graph
if (isActiveLayer) {
- if(routingModel != null) {
- if(routingModel.routingGraph != null && routingModel.routingGraph.getGraph() != null) {
- Set<OsmEdge> graphEdges = routingModel.routingGraph.getGraph().edgeSet();
+ if (routingModel != null) {
+ if (routingModel.routingGraph != null && routingModel.routingGraph.getGraph() != null) {
+ Set<OsmEdge> graphEdges = routingModel.routingGraph.getGraph().edgeSet();
if (!graphEdges.isEmpty()) {
Color color2 = ColorHelper.html2color("#00ff00"); /* just green for now */
OsmEdge firstedge = (OsmEdge) graphEdges.toArray()[0];
Point from = mv.getPoint(firstedge.fromEastNorth());
g.drawRect(from.x-4, from.y+4, from.x+4, from.y-4);
- for(OsmEdge edge : graphEdges) {
+ for (OsmEdge edge : graphEdges) {
drawGraph(g, mv, edge, color2, width);
}
}
- }
- }
+ }
+ }
}
-
-
- if(nodes == null || nodes.size() == 0) return;
-
+
+
+ if (nodes == null || nodes.size() == 0) return;
+
// Paint routing path
List<OsmEdge> routeEdges = routingModel.getRouteEdges();
- if(routeEdges != null) {
- for(OsmEdge edge : routeEdges) {
+ if (routeEdges != null) {
+ for (OsmEdge edge : routeEdges) {
drawEdge(g, mv, edge, color, width, true);
}
}
@@ -278,14 +254,14 @@ public class RoutingLayer extends Layer {
screen.y - startIcon.getIconHeight());
// paint middle icons
- for(int index = 1; index < nodes.size() - 1; ++index) {
+ for (int index = 1; index < nodes.size() - 1; ++index) {
node = nodes.get(index);
screen = mv.getPoint(node);
middleIcon.paintIcon(mv, g, screen.x - startIcon.getIconWidth()/2,
screen.y - middleIcon.getIconHeight());
}
// paint end icon
- if(nodes.size() > 1) {
+ if (nodes.size() > 1) {
node = nodes.get(nodes.size() - 1);
screen = mv.getPoint(node);
endIcon.paintIcon(mv, g, screen.x - startIcon.getIconWidth()/2,
@@ -303,7 +279,7 @@ public class RoutingLayer extends Layer {
@Override
public void destroy() {
routingModel.reset();
-// layerAdded = false;
+ // layerAdded = false;
}
/**
@@ -317,33 +293,34 @@ public class RoutingLayer extends Layer {
from = mv.getPoint(edge.fromEastNorth());
to = mv.getPoint(edge.toEastNorth());
- Graphics2D g2d = (Graphics2D)g;
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // Anti-alias!
- Stroke oldStroke = g2d.getStroke();
- g2d.setStroke(new BasicStroke(width)); // thickness
- g2d.drawLine(from.x, from.y, to.x, to.y);
- if (showDirection) {
- double t = Math.atan2(to.y-from.y, to.x-from.x) + Math.PI;
- g.drawLine(to.x,to.y, (int)(to.x + 10*Math.cos(t-ARROW_PHI)), (int)(to.y + 10*Math.sin(t-ARROW_PHI)));
- g.drawLine(to.x,to.y, (int)(to.x + 10*Math.cos(t+ARROW_PHI)), (int)(to.y + 10*Math.sin(t+ARROW_PHI)));
- }
- g2d.setStroke(oldStroke);
+ Graphics2D g2d = (Graphics2D) g;
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // Anti-alias!
+ Stroke oldStroke = g2d.getStroke();
+ g2d.setStroke(new BasicStroke(width)); // thickness
+ g2d.drawLine(from.x, from.y, to.x, to.y);
+ if (showDirection) {
+ double t = Math.atan2(to.y-from.y, to.x-from.x) + Math.PI;
+ g.drawLine(to.x, to.y, (int) (to.x + 10*Math.cos(t-ARROW_PHI)), (int) (to.y + 10*Math.sin(t-ARROW_PHI)));
+ g.drawLine(to.x, to.y, (int) (to.x + 10*Math.cos(t+ARROW_PHI)), (int) (to.y + 10*Math.sin(t+ARROW_PHI)));
+ }
+ g2d.setStroke(oldStroke);
}
+
private void drawGraph(Graphics g, MapView mv, OsmEdge edge, Color col, int width) {
g.setColor(col);
Point from;
Point to;
from = mv.getPoint(edge.fromEastNorth());
to = mv.getPoint(edge.toEastNorth());
-
- Graphics2D g2d = (Graphics2D)g;
- Stroke oldStroke = g2d.getStroke();
- g2d.setStroke(new BasicStroke(width)); // thickness
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON); // Anti-alias!
- g2d.drawLine(from.x, from.y, to.x, to.y);
- g2d.drawRect(to.x- 4, to.y+4, 4, 4);
-
- g2d.setStroke(oldStroke);
- }
-
+
+ Graphics2D g2d = (Graphics2D) g;
+ Stroke oldStroke = g2d.getStroke();
+ g2d.setStroke(new BasicStroke(width)); // thickness
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // Anti-alias!
+ g2d.drawLine(from.x, from.y, to.x, to.y);
+ g2d.drawRect(to.x- 4, to.y+4, 4, 4);
+
+ g2d.setStroke(oldStroke);
+ }
+
}
diff --git a/routing/src/com/innovant/josm/plugin/routing/RoutingModel.java b/routing/src/com/innovant/josm/plugin/routing/RoutingModel.java
index 349ce0e..73124c8 100644
--- a/routing/src/com/innovant/josm/plugin/routing/RoutingModel.java
+++ b/routing/src/com/innovant/josm/plugin/routing/RoutingModel.java
@@ -1,30 +1,4 @@
-/*
- * Copyright (C) 2008 Innovant
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
- *
- * For more information, please contact:
- *
- * Innovant
- * juangui at gmail.com
- * vidalfree at gmail.com
- *
- * http://public.grupoinnovant.com/blog
- *
- */
-
+// License: GPL. For details, see LICENSE file.
package com.innovant.josm.plugin.routing;
import java.util.ArrayList;
@@ -55,24 +29,24 @@ public class RoutingModel {
/**
* Graph to calculate route
*/
- public RoutingGraph routingGraph=null;
+ public RoutingGraph routingGraph = null;
/**
* List of nodes that the route has to traverse
*/
- private List<Node> nodes=null;
+ private List<Node> nodes = null;
- private List<OsmEdge> path=null;
+ private List<OsmEdge> path = null;
/**
* Flag to advise about changes in the selected nodes.
*/
- private boolean changeNodes=false;
+ private boolean changeNodes = false;
/**
* Flag to advise about changes in ways.
*/
- private boolean changeOneway=false;
+ private boolean changeOneway = false;
/**
* Default Constructor.
@@ -97,7 +71,7 @@ public class RoutingModel {
*/
public void addNode(Node node) {
nodes.add(node);
- this.changeNodes=true;
+ this.changeNodes = true;
}
/**
@@ -105,9 +79,9 @@ public class RoutingModel {
* @param index the index of the node to remove.
*/
public void removeNode(int index) {
- if (nodes.size()>index) {
+ if (nodes.size() > index) {
nodes.remove(index);
- this.changeNodes=true;
+ this.changeNodes = true;
}
}
@@ -117,9 +91,9 @@ public class RoutingModel {
* @param node the node to be inserted
*/
public void insertNode(int index, Node node) {
- if (nodes.size()>=index) {
+ if (nodes.size() >= index) {
nodes.add(index, node);
- this.changeNodes=true;
+ this.changeNodes = true;
}
}
@@ -129,10 +103,10 @@ public class RoutingModel {
public void reverseNodes() {
List<Node> aux = new ArrayList<>();
for (Node n : nodes) {
- aux.add(0,n);
+ aux.add(0, n);
}
nodes = aux;
- this.changeNodes=true;
+ this.changeNodes = true;
}
/**
@@ -140,11 +114,10 @@ public class RoutingModel {
* @return A list of edges forming the shortest path
*/
public List<OsmEdge> getRouteEdges() {
- if (this.changeNodes || path==null)
- {
- path=this.routingGraph.applyAlgorithm(nodes, Algorithm.ROUTING_ALG_DIJKSTRA);
- this.changeNodes=false;
- this.changeOneway=false;
+ if (this.changeNodes || path == null) {
+ path = this.routingGraph.applyAlgorithm(nodes, Algorithm.ROUTING_ALG_DIJKSTRA);
+ this.changeNodes = false;
+ this.changeOneway = false;
}
return path;
}
@@ -175,7 +148,7 @@ public class RoutingModel {
*/
public void reset() {
nodes.clear();
- this.changeNodes=true;
+ this.changeNodes = true;
}
}
diff --git a/routing/src/com/innovant/josm/plugin/routing/RoutingPlugin.java b/routing/src/com/innovant/josm/plugin/routing/RoutingPlugin.java
index cc99b2a..5f0d84e 100644
--- a/routing/src/com/innovant/josm/plugin/routing/RoutingPlugin.java
+++ b/routing/src/com/innovant/josm/plugin/routing/RoutingPlugin.java
@@ -1,30 +1,4 @@
-/*
- * Copyright (C) 2008 Innovant
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
- *
- * For more information, please contact:
- *
- * Innovant
- * juangui at gmail.com
- * vidalfree at gmail.com
- *
- * http://public.grupoinnovant.com/blog
- *
- */
-
+// License: GPL. For details, see LICENSE file.
package com.innovant.josm.plugin.routing;
import static org.openstreetmap.josm.tools.I18n.tr;
@@ -147,7 +121,7 @@ public class RoutingPlugin extends Plugin implements LayerChangeListener, DataSe
System.err.println("Routing plugin warning: log4j configuration not found");
}
logger.debug("Loading routing plugin...");
- preferenceSettings=new RoutingPreferenceDialog();
+ preferenceSettings = new RoutingPreferenceDialog();
// Initialize layers list
layers = new ArrayList<>();
// Add menu
@@ -221,7 +195,7 @@ public class RoutingPlugin extends Plugin implements LayerChangeListener, DataSe
routingDialog.showDialog();
routingDialog.refresh();
}
- }else{ /* hide Routing toolbar and dialog window */
+ } else { /* hide Routing toolbar and dialog window */
menu.disableRestOfItems();
if (routingDialog != null) {
routingDialog.hideDialog();
@@ -249,7 +223,7 @@ public class RoutingPlugin extends Plugin implements LayerChangeListener, DataSe
@Override
public void layerRemoving(LayerRemoveEvent evt) {
Layer oldLayer = evt.getRemovedLayer();
- if ((oldLayer instanceof RoutingLayer) & (layers.size()==1)) {
+ if ((oldLayer instanceof RoutingLayer) & (layers.size() == 1)) {
// Remove button(s) from the tool bar when the last routing layer is removed
addRouteNodeButton.setVisible(false);
removeRouteNodeButton.setVisible(false);
@@ -262,7 +236,7 @@ public class RoutingPlugin extends Plugin implements LayerChangeListener, DataSe
// Convert to Array to prevent ConcurrentModificationException when removing layers from ArrayList
// FIXME: can't remove associated routing layers without triggering exceptions in some cases
RoutingLayer[] layersArray = layers.toArray(new RoutingLayer[0]);
- for (int i=0;i<layersArray.length;i++) {
+ for (int i = 0; i < layersArray.length; i++) {
if (layersArray[i].getDataLayer().equals(oldLayer)) {
try {
// Remove layer
diff --git a/routing/src/com/innovant/josm/plugin/routing/actions/AddRouteNodeAction.java b/routing/src/com/innovant/josm/plugin/routing/actions/AddRouteNodeAction.java
index acdb4b5..45b8455 100644
--- a/routing/src/com/innovant/josm/plugin/routing/actions/AddRouteNodeAction.java
+++ b/routing/src/com/innovant/josm/plugin/routing/actions/AddRouteNodeAction.java
@@ -1,30 +1,4 @@
-/*
- * Copyright (C) 2008 Innovant
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
- *
- * For more information, please contact:
- *
- * Innovant
- * juangui at gmail.com
- * vidalfree at gmail.com
- *
- * http://public.grupoinnovant.com/blog
- *
- */
-
+// License: GPL. For details, see LICENSE file.
package com.innovant.josm.plugin.routing.actions;
import static org.openstreetmap.josm.tools.I18n.tr;
@@ -58,7 +32,7 @@ public class AddRouteNodeAction extends MapMode {
/**
* Constructor
- * @param mapFrame
+ * @param mapFrame map frame
*/
public AddRouteNodeAction(MapFrame mapFrame) {
// TODO Use constructor with shortcut
@@ -83,9 +57,9 @@ public class AddRouteNodeAction extends MapMode {
// Search for nearest highway node
Node node = null;
if (Main.getLayerManager().getActiveLayer() instanceof RoutingLayer) {
- RoutingLayer layer = (RoutingLayer)Main.getLayerManager().getActiveLayer();
+ RoutingLayer layer = (RoutingLayer) Main.getLayerManager().getActiveLayer();
node = layer.getNearestHighwayNode(e.getPoint());
- if(node == null) {
+ if (node == null) {
logger.debug("no selected node");
return;
}
@@ -96,6 +70,7 @@ public class AddRouteNodeAction extends MapMode {
}
Main.map.repaint();
}
+
@Override public boolean layerIsSupported(Layer l) {
return l instanceof RoutingLayer;
}
diff --git a/routing/src/com/innovant/josm/plugin/routing/actions/MoveRouteNodeAction.java b/routing/src/com/innovant/josm/plugin/routing/actions/MoveRouteNodeAction.java
index 55aabd6..ecd0f67 100644
--- a/routing/src/com/innovant/josm/plugin/routing/actions/MoveRouteNodeAction.java
+++ b/routing/src/com/innovant/josm/plugin/routing/actions/MoveRouteNodeAction.java
@@ -1,30 +1,4 @@
-/*
- * Copyright (C) 2008 Innovant
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
- *
- * For more information, please contact:
- *
- * Innovant
- * juangui at gmail.com
- * vidalfree at gmail.com
- *
- * http://public.grupoinnovant.com/blog
- *
- */
-
+// License: GPL. For details, see LICENSE file.
package com.innovant.josm.plugin.routing.actions;
import static org.openstreetmap.josm.tools.I18n.tr;
@@ -38,9 +12,8 @@ import org.openstreetmap.josm.Main;
import org.openstreetmap.josm.actions.mapmode.MapMode;
import org.openstreetmap.josm.data.osm.Node;
import org.openstreetmap.josm.gui.MapFrame;
-import org.openstreetmap.josm.tools.ImageProvider;
-
import org.openstreetmap.josm.gui.layer.Layer;
+import org.openstreetmap.josm.tools.ImageProvider;
import com.innovant.josm.plugin.routing.RoutingLayer;
import com.innovant.josm.plugin.routing.RoutingModel;
@@ -73,7 +46,7 @@ public class MoveRouteNodeAction extends MapMode {
/**
* Constructor
- * @param mapFrame
+ * @param mapFrame map frame
*/
public MoveRouteNodeAction(MapFrame mapFrame) {
// TODO Use constructor with shortcut
@@ -97,13 +70,13 @@ public class MoveRouteNodeAction extends MapMode {
if (e.getButton() == MouseEvent.BUTTON1) {
if (Main.getLayerManager().getActiveLayer() instanceof RoutingLayer) {
requestFocusInMapView();
- RoutingLayer layer = (RoutingLayer)Main.getLayerManager().getActiveLayer();
+ RoutingLayer layer = (RoutingLayer) Main.getLayerManager().getActiveLayer();
RoutingModel routingModel = layer.getRoutingModel();
// Search for the nearest node in the list
List<Node> nl = routingModel.getSelectedNodes();
index = -1;
double dmax = DRAG_SQR_RADIUS; // maximum distance, in pixels
- for (int i=0;i<nl.size();i++) {
+ for (int i = 0; i < nl.size(); i++) {
Node node = nl.get(i);
double d = Main.map.mapView.getPoint(node).distanceSq(e.getPoint());
if (d < dmax) {
@@ -111,7 +84,7 @@ public class MoveRouteNodeAction extends MapMode {
index = i;
}
}
- if (index>=0)
+ if (index >= 0)
logger.debug("Moved from node " + nl.get(index));
}
}
@@ -119,7 +92,7 @@ public class MoveRouteNodeAction extends MapMode {
@Override public void mouseReleased(MouseEvent e) {
// If left button is released and a route node is being dragged
- if ((e.getButton() == MouseEvent.BUTTON1) && (index>=0)) {
+ if ((e.getButton() == MouseEvent.BUTTON1) && (index >= 0)) {
searchAndReplaceNode(e.getPoint());
}
}
@@ -129,7 +102,7 @@ public class MoveRouteNodeAction extends MapMode {
private void searchAndReplaceNode(Point point) {
if (Main.getLayerManager().getActiveLayer() instanceof RoutingLayer) {
- RoutingLayer layer = (RoutingLayer)Main.getLayerManager().getActiveLayer();
+ RoutingLayer layer = (RoutingLayer) Main.getLayerManager().getActiveLayer();
RoutingModel routingModel = layer.getRoutingModel();
RoutingDialog routingDialog = RoutingPlugin.getInstance().getRoutingDialog();
// Search for nearest highway node
@@ -147,8 +120,8 @@ public class MoveRouteNodeAction extends MapMode {
Main.map.repaint();
}
}
+
@Override public boolean layerIsSupported(Layer l) {
return l instanceof RoutingLayer;
}
-
}
diff --git a/routing/src/com/innovant/josm/plugin/routing/actions/RemoveRouteNodeAction.java b/routing/src/com/innovant/josm/plugin/routing/actions/RemoveRouteNodeAction.java
index 50bb001..20a8612 100644
--- a/routing/src/com/innovant/josm/plugin/routing/actions/RemoveRouteNodeAction.java
+++ b/routing/src/com/innovant/josm/plugin/routing/actions/RemoveRouteNodeAction.java
@@ -1,30 +1,4 @@
-/*
- * Copyright (C) 2008 Innovant
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
- *
- * For more information, please contact:
- *
- * Innovant
- * juangui at gmail.com
- * vidalfree at gmail.com
- *
- * http://public.grupoinnovant.com/blog
- *
- */
-
+// License: GPL. For details, see LICENSE file.
package com.innovant.josm.plugin.routing.actions;
import static org.openstreetmap.josm.tools.I18n.tr;
@@ -84,13 +58,13 @@ public class RemoveRouteNodeAction extends MapMode {
// If left button is clicked
if (e.getButton() == MouseEvent.BUTTON1) {
if (Main.getLayerManager().getActiveLayer() instanceof RoutingLayer) {
- RoutingLayer layer = (RoutingLayer)Main.getLayerManager().getActiveLayer();
+ RoutingLayer layer = (RoutingLayer) Main.getLayerManager().getActiveLayer();
RoutingModel routingModel = layer.getRoutingModel();
// Search for the nearest node in the list
List<Node> nl = routingModel.getSelectedNodes();
int index = -1;
double dmax = REMOVE_SQR_RADIUS; // maximum distance, in pixels
- for (int i=0;i<nl.size();i++) {
+ for (int i = 0; i < nl.size(); i++) {
Node node = nl.get(i);
double d = Main.map.mapView.getPoint(node).distanceSq(e.getPoint());
if (d < dmax) {
diff --git a/routing/src/com/innovant/josm/plugin/routing/gui/RoutingDialog.java b/routing/src/com/innovant/josm/plugin/routing/gui/RoutingDialog.java
index 2782823..96a0c49 100644
--- a/routing/src/com/innovant/josm/plugin/routing/gui/RoutingDialog.java
+++ b/routing/src/com/innovant/josm/plugin/routing/gui/RoutingDialog.java
@@ -1,30 +1,4 @@
-/*
- * Copyright (C) 2008 Innovant
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
- *
- * For more information, please contact:
- *
- * Innovant
- * juangui at gmail.com
- * vidalfree at gmail.com
- *
- * http://public.grupoinnovant.com/blog
- *
- */
-
+// License: GPL. For details, see LICENSE file.
package com.innovant.josm.plugin.routing.gui;
import static org.openstreetmap.josm.tools.I18n.tr;
@@ -98,7 +72,6 @@ public class RoutingDialog extends ToggleDialog {
/**
* Remove item from the list of nodes
- * @param index
*/
public void removeNode(int index) {
model.remove(index);
@@ -106,7 +79,6 @@ public class RoutingDialog extends ToggleDialog {
/**
* Add item to the list of nodes
- * @param obj
*/
public void addNode(Node n) {
model.addElement(n.getId()+" ["+n.getCoor().toDisplayString()+"]");
@@ -114,8 +86,6 @@ public class RoutingDialog extends ToggleDialog {
/**
* Insert item to the list of nodes
- * @param index
- * @param obj
*/
public void insertNode(int index, Node n) {
model.insertElementAt(n.getId()+" ["+n.getCoor().toDisplayString()+"]", index);
@@ -131,7 +101,7 @@ public class RoutingDialog extends ToggleDialog {
public void refresh() {
clearNodes();
if (Main.getLayerManager().getActiveLayer() instanceof RoutingLayer) {
- RoutingLayer routingLayer = (RoutingLayer)Main.getLayerManager().getActiveLayer();
+ RoutingLayer routingLayer = (RoutingLayer) Main.getLayerManager().getActiveLayer();
RoutingModel routingModel = routingLayer.getRoutingModel();
for (Node n : routingModel.getSelectedNodes()) {
addNode(n);
diff --git a/routing/src/com/innovant/josm/plugin/routing/gui/RoutingMenu.java b/routing/src/com/innovant/josm/plugin/routing/gui/RoutingMenu.java
index 9bd84cd..1d1a8a1 100644
--- a/routing/src/com/innovant/josm/plugin/routing/gui/RoutingMenu.java
+++ b/routing/src/com/innovant/josm/plugin/routing/gui/RoutingMenu.java
@@ -1,30 +1,4 @@
-/*
- * Copyright (C) 2008 Innovant
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
- *
- * For more information, please contact:
- *
- * Innovant
- * juangui at gmail.com
- * vidalfree at gmail.com
- *
- * http://public.grupoinnovant.com/blog
- *
- */
-
+// License: GPL. For details, see LICENSE file.
package com.innovant.josm.plugin.routing.gui;
import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
@@ -77,6 +51,7 @@ public class RoutingMenu extends JMenu {
startMI = new JMenuItem(tr("Add routing layer"));
startMI.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
RoutingPlugin.getInstance().addLayer();
}
@@ -91,11 +66,12 @@ public class RoutingMenu extends JMenu {
JRadioButtonMenuItem rshorter = new JRadioButtonMenuItem(tr("Shortest"));
rshorter.setSelected(true);
rshorter.addItemListener(new ItemListener() {
+ @Override
public void itemStateChanged(ItemEvent e) {
if (Main.getLayerManager().getActiveLayer() instanceof RoutingLayer) {
- RoutingLayer layer = (RoutingLayer)Main.getLayerManager().getActiveLayer();
+ RoutingLayer layer = (RoutingLayer) Main.getLayerManager().getActiveLayer();
RoutingModel routingModel = layer.getRoutingModel();
- if (e.getStateChange()==ItemEvent.SELECTED) {
+ if (e.getStateChange() == ItemEvent.SELECTED) {
routingModel.routingGraph.setTypeRoute(RouteType.SHORTEST);
} else {
routingModel.routingGraph.setTypeRoute(RouteType.FASTEST);
@@ -120,11 +96,12 @@ public class RoutingMenu extends JMenu {
criteriaM.addSeparator();
JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem(tr("Ignore oneways"));
cbmi.addItemListener(new ItemListener() {
+ @Override
public void itemStateChanged(ItemEvent e) {
if (Main.getLayerManager().getActiveLayer() instanceof RoutingLayer) {
- RoutingLayer layer = (RoutingLayer)Main.getLayerManager().getActiveLayer();
+ RoutingLayer layer = (RoutingLayer) Main.getLayerManager().getActiveLayer();
RoutingModel routingModel = layer.getRoutingModel();
- if (e.getStateChange()==ItemEvent.SELECTED)
+ if (e.getStateChange() == ItemEvent.SELECTED)
routingModel.routingGraph.getRoutingProfile().setOnewayUse(false);
else
routingModel.routingGraph.getRoutingProfile().setOnewayUse(true);
@@ -140,9 +117,10 @@ public class RoutingMenu extends JMenu {
menu.addSeparator();
reverseMI = new JMenuItem(tr("Reverse route"));
reverseMI.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
if (Main.getLayerManager().getActiveLayer() instanceof RoutingLayer) {
- RoutingLayer layer = (RoutingLayer)Main.getLayerManager().getActiveLayer();
+ RoutingLayer layer = (RoutingLayer) Main.getLayerManager().getActiveLayer();
RoutingModel routingModel = layer.getRoutingModel();
routingModel.reverseNodes();
Main.map.repaint();
@@ -153,9 +131,10 @@ public class RoutingMenu extends JMenu {
clearMI = new JMenuItem(tr("Clear route"));
clearMI.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
if (Main.getLayerManager().getActiveLayer() instanceof RoutingLayer) {
- RoutingLayer layer = (RoutingLayer)Main.getLayerManager().getActiveLayer();
+ RoutingLayer layer = (RoutingLayer) Main.getLayerManager().getActiveLayer();
RoutingModel routingModel = layer.getRoutingModel();
// Reset routing nodes and paths
routingModel.reset();
@@ -168,10 +147,11 @@ public class RoutingMenu extends JMenu {
regraphMI = new JMenuItem(tr("Reconstruct Graph"));
regraphMI.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
if (Main.getLayerManager().getActiveLayer() instanceof RoutingLayer) {
- RoutingLayer layer = (RoutingLayer)Main.getLayerManager().getActiveLayer();
+ RoutingLayer layer = (RoutingLayer) Main.getLayerManager().getActiveLayer();
RoutingModel routingModel = layer.getRoutingModel();
routingModel.routingGraph.resetGraph();
routingModel.routingGraph.createGraph();
diff --git a/routing/src/com/innovant/josm/plugin/routing/gui/RoutingPreferenceDialog.java b/routing/src/com/innovant/josm/plugin/routing/gui/RoutingPreferenceDialog.java
index f13e374..ee438ca 100644
--- a/routing/src/com/innovant/josm/plugin/routing/gui/RoutingPreferenceDialog.java
+++ b/routing/src/com/innovant/josm/plugin/routing/gui/RoutingPreferenceDialog.java
@@ -1,31 +1,4 @@
-/*
- *
- * Copyright (C) 2008 Innovant
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
- *
- * For more information, please contact:
- *
- * Innovant
- * juangui at gmail.com
- * vidalfree at gmail.com
- *
- * http://public.grupoinnovant.com/blog
- *
- */
-
+// License: GPL. For details, see LICENSE file.
package com.innovant.josm.plugin.routing.gui;
import static org.openstreetmap.josm.tools.I18n.tr;
@@ -78,6 +51,7 @@ public class RoutingPreferenceDialog extends DefaultTabPreferenceSetting {
readPreferences();
}
+ @Override
public void addGui(final PreferenceTabbedPane gui) {
JPanel principal = gui.createPreferenceTab(this);
@@ -85,7 +59,7 @@ public class RoutingPreferenceDialog extends DefaultTabPreferenceSetting {
JPanel p = new JPanel();
p.setLayout(new GridBagLayout());
- model = new DefaultTableModel(new String[] { tr("Highway type"),
+ model = new DefaultTableModel(new String[] {tr("Highway type"),
tr("Speed (Km/h)") }, 0) {
private static final long serialVersionUID = 4253339034781567453L;
@@ -106,12 +80,14 @@ public class RoutingPreferenceDialog extends DefaultTabPreferenceSetting {
p.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL));
p.add(add, GBC.std().insets(0, 5, 0, 0));
add.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
JPanel p = new JPanel(new GridBagLayout());
p.add(new JLabel(tr("Weight")), GBC.std().insets(0, 0, 5, 0));
JComboBox<String> key = new JComboBox<>();
- for (OsmWayTypes pk : OsmWayTypes.values())
+ for (OsmWayTypes pk : OsmWayTypes.values()) {
key.addItem(pk.getTag());
+ }
JTextField value = new JTextField(10);
p.add(key, GBC.eop().insets(5, 0, 0, 0).fill(GBC.HORIZONTAL));
p.add(new JLabel(tr("Value")), GBC.std().insets(0, 0, 5, 0));
@@ -131,14 +107,16 @@ public class RoutingPreferenceDialog extends DefaultTabPreferenceSetting {
JButton delete = new JButton(tr("Delete"));
p.add(delete, GBC.std().insets(0, 5, 0, 0));
delete.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
if (list.getSelectedRow() == -1)
JOptionPane.showMessageDialog(gui,
tr("Please select the row to delete."));
else {
Integer i;
- while ((i = list.getSelectedRow()) != -1)
+ while ((i = list.getSelectedRow()) != -1) {
model.removeRow(i);
+ }
}
}
});
@@ -146,6 +124,7 @@ public class RoutingPreferenceDialog extends DefaultTabPreferenceSetting {
JButton edit = new JButton(tr("Edit"));
p.add(edit, GBC.std().insets(5, 5, 5, 0));
edit.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
edit(gui, list);
}
@@ -157,7 +136,7 @@ public class RoutingPreferenceDialog extends DefaultTabPreferenceSetting {
Opciones.addTab("Profile", null, p, null);
// Opciones.addTab("Preferences", new JPanel());
- list.addMouseListener(new MouseAdapter(){
+ list.addMouseListener(new MouseAdapter() {
@Override public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2)
edit(gui, list);
@@ -168,6 +147,7 @@ public class RoutingPreferenceDialog extends DefaultTabPreferenceSetting {
}
+ @Override
public boolean ok() {
for (int i = 0; i < model.getRowCount(); ++i) {
String value = model.getValueAt(i, 1).toString();
@@ -179,8 +159,9 @@ public class RoutingPreferenceDialog extends DefaultTabPreferenceSetting {
orig.remove(key); // processed.
}
}
- for (Entry<String, String> e : orig.entrySet())
+ for (Entry<String, String> e : orig.entrySet()) {
Main.pref.put(e.getKey(), null);
+ }
return false;
}
@@ -202,7 +183,7 @@ public class RoutingPreferenceDialog extends DefaultTabPreferenceSetting {
readPreferences();
// Put these values in the model
for (String tag : orig.keySet()) {
- model.addRow(new String[] { tag, orig.get(tag) });
+ model.addRow(new String[] {tag, orig.get(tag)});
}
}
@@ -215,8 +196,7 @@ public class RoutingPreferenceDialog extends DefaultTabPreferenceSetting {
+ owt.getTag(), owt.getSpeed());
}
orig = Main.pref.getAllPrefix("routing.profile.default.speed");
- }
- else logger.debug("Default preferences already exist.");
+ } else logger.debug("Default preferences already exist.");
}
/*
private String getKeyTag(String tag) {
diff --git a/svn-info.xml b/svn-info.xml
index f7fa8d3..187e889 100644
--- a/svn-info.xml
+++ b/svn-info.xml
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<info>
<entry
+ kind="dir"
path="plugins"
- revision="32641"
- kind="dir">
+ revision="32805">
<url>https://svn.openstreetmap.org/applications/editors/josm/plugins</url>
<relative-url>^/applications/editors/josm/plugins</relative-url>
<repository>
@@ -11,9 +11,9 @@
<uuid>b9d5c4c9-76e1-0310-9c85-f3177eceb1e4</uuid>
</repository>
<commit
- revision="32639">
-<author>donvip</author>
-<date>2016-07-11T21:08:37.032440Z</date>
+ revision="32804">
+<author>darya</author>
+<date>2016-08-12T11:14:04.855337Z</date>
</commit>
</entry>
</info>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/josm-plugins.git
More information about the Pkg-grass-devel
mailing list