[josm-plugins] 02/12: Imported Upstream version 0.0.svn31608+ds1
Sebastiaan Couwenberg
sebastic at moszumanska.debian.org
Fri Oct 9 23:27:26 UTC 2015
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to branch master
in repository josm-plugins.
commit 2bc6a04b8da4010fdf212eff2bad577672a1d2ac
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Sat Oct 10 00:22:55 2015 +0200
Imported Upstream version 0.0.svn31608+ds1
---
build-common.xml | 24 ++++++++++++-----
measurement/build.xml | 1 +
.../plugins/measurement/MeasurementDialog.java | 31 +++++++++++++++++++++-
svn-info.xml | 17 ++++++------
4 files changed, 58 insertions(+), 15 deletions(-)
diff --git a/build-common.xml b/build-common.xml
index e120106..1e252f7 100644
--- a/build-common.xml
+++ b/build-common.xml
@@ -14,7 +14,7 @@
<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.3.jar"/>
+ <property name="groovy.jar" location="../00_core_tools/groovy-all-2.4.5.jar"/>
<property name="plugin.build.dir" location="build"/>
<property name="plugin.test.dir" location="test"/>
<property name="plugin.src.dir" location="src"/>
@@ -143,13 +143,25 @@
</antcall>
<antcall target="additional-manifest" />
<jar destfile="${plugin.jar}" basedir="${plugin.build.dir}" manifest="MANIFEST">
- <zipgroupfileset dir="${plugin.lib.dir}" includes="*.jar" excludes="*-sources.jar, *-javadoc.jar" erroronmissingdir="no"/>
+ <restrict>
+ <not><or>
+ <name name="META-INF/maven/*"/>
+ <name name="META-INF/DEPENDENCIES"/>
+ <name name="META-INF/LICENSE"/>
+ <name name="META-INF/NOTICE"/>
+ </or></not>
+ <archives>
+ <zips>
+ <fileset dir="${plugin.lib.dir}" includes="*.jar" excludes="*-sources.jar, *-javadoc.jar" erroronmissingdir="no"/>
+ </zips>
+ </archives>
+ </restrict>
</jar>
<delete file="MANIFEST" failonerror="no"/>
<antcall target="post-dist" />
</target>
<target name="post-dist">
- <!-- to be overidden by plugins that need to perform additional tasks on resulting jar -->
+ <!-- to be overidden by plugins that need to perform additional tasks on resulting jar -->
</target>
<target name="add-manifest-attribute" depends="check-manifest-attribute" if="have-${property.name}">
<manifest file="MANIFEST" mode="update">
@@ -385,7 +397,7 @@
<target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
</target>
-
+
<path id="test.classpath">
<fileset dir="../00_core_test_lib">
<include name="**/*.jar"/>
@@ -466,7 +478,7 @@
</jacoco:coverage>
</sequential>
</target>
-
+
<target name="runjosm" depends="install">
<java jar="${josm}" fork="true">
</java>
@@ -487,7 +499,7 @@
You can use following targets:
* dist This default target builds the plugin jar file
* clean Cleanup automatical created files
- * test Run unit tests (if any)
+ * test Run unit tests (if any)
* publish Checkin source code, build jar and checkin plugin jar
(requires proper entry for SVN commit message!)
* install Install the plugin in current system
diff --git a/measurement/build.xml b/measurement/build.xml
index ddf6e38..e5ba0c3 100644
--- a/measurement/build.xml
+++ b/measurement/build.xml
@@ -4,6 +4,7 @@
<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="7001"/>
+ <property name="plugin.canloadatruntime" value="true"/>
<!-- Configure these properties (replace "..." accordingly).
See http://josm.openstreetmap.de/wiki/DevelopersGuide/DevelopingPlugins
diff --git a/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementDialog.java b/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementDialog.java
index 18eed7b..861d704 100644
--- a/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementDialog.java
+++ b/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementDialog.java
@@ -69,6 +69,11 @@ public class MeasurementDialog extends ToggleDialog implements SelectionChangedL
protected JLabel selectAreaLabel;
/**
+ * The measurement label for radius if the currently selected loop is a circle.
+ */
+ protected JLabel selectRadiusLabel;
+
+ /**
* The measurement label for the segment angle, actually updated, if 2 nodes are selected
*/
protected JLabel segAngleLabel;
@@ -118,6 +123,11 @@ public class MeasurementDialog extends ToggleDialog implements SelectionChangedL
selectAreaLabel = new JLabel(getAreaText(0));
valuePanel.add(selectAreaLabel);
+ valuePanel.add(new JLabel(tr("Selection Radius")));
+
+ selectRadiusLabel = new JLabel(getRadiusText(0));
+ valuePanel.add(selectRadiusLabel);
+
JLabel angle = new JLabel(tr("Angle"));
angle.setToolTipText(tr("Angle between two selected Nodes"));
valuePanel.add(angle);
@@ -143,6 +153,10 @@ public class MeasurementDialog extends ToggleDialog implements SelectionChangedL
return NavigatableComponent.getSystemOfMeasurement().getAreaText(v, new DecimalFormat("#0.000"), 1e-3);
}
+ protected String getRadiusText(double v) {
+ return NavigatableComponent.getSystemOfMeasurement().getDistText(v, new DecimalFormat("#0.000"), 1e-3);
+ }
+
protected String getAngleText(double v) {
return new DecimalFormat("#0.0").format(v) + " \u00b0";
}
@@ -159,6 +173,7 @@ public class MeasurementDialog extends ToggleDialog implements SelectionChangedL
double length = 0.0;
double segAngle = 0.0;
double area = 0.0;
+ double radius = 0.0;
Node lastNode = null;
// Don't mix up way and nodes computation (fix #6872). Priority given to ways
ways = new SubclassFilteredCollection<>(newSelection, OsmPrimitive.wayPredicate);
@@ -180,9 +195,18 @@ public class MeasurementDialog extends ToggleDialog implements SelectionChangedL
for (Way w : ways) {
Node lastN = null;
double wayArea = 0.0;
+ Double firstSegLength = null;
+ boolean isCircle = true;
for (Node n: w.getNodes()) {
if (lastN != null && lastN.getCoor() != null && n.getCoor() != null) {
- length += lastN.getCoor().greatCircleDistance(n.getCoor());
+ final double segLength = lastN.getCoor().greatCircleDistance(n.getCoor());
+ if (firstSegLength == null) {
+ firstSegLength = segLength;
+ }
+ if (isCircle && Math.abs(firstSegLength - segLength) > 0.000001) {
+ isCircle = false;
+ }
+ 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()));
@@ -196,11 +220,15 @@ public class MeasurementDialog extends ToggleDialog implements SelectionChangedL
wayArea = 0;
area += wayArea;
}
+ if (ways.size() == 1 && area > 0.0) {
+ radius = length / (2 * Math.PI);
+ }
}
final String lengthLabel = getDistText(length);
final String angleLabel = getAngleText(segAngle);
final String areaLabel = getAreaText(area);
+ final String radiusLabel = getRadiusText(radius);
GuiHelper.runInEDT(new Runnable() {
@Override
@@ -208,6 +236,7 @@ public class MeasurementDialog extends ToggleDialog implements SelectionChangedL
selectLengthLabel.setText(lengthLabel);
segAngleLabel.setText(angleLabel);
selectAreaLabel.setText(areaLabel);
+ selectRadiusLabel.setText(radiusLabel);
}
});
diff --git a/svn-info.xml b/svn-info.xml
index b70e48d..2238073 100644
--- a/svn-info.xml
+++ b/svn-info.xml
@@ -1,18 +1,19 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
<info>
<entry
- revision="31107"
kind="dir"
- path="plugins">
-<url>http://svn.openstreetmap.org/applications/editors/josm/plugins</url>
+ path="plugins"
+ revision="31608">
+<url>https://svn.openstreetmap.org/applications/editors/josm/plugins</url>
+<relative-url>^/applications/editors/josm/plugins</relative-url>
<repository>
-<root>http://svn.openstreetmap.org</root>
+<root>https://svn.openstreetmap.org</root>
<uuid>b9d5c4c9-76e1-0310-9c85-f3177eceb1e4</uuid>
</repository>
<commit
- revision="31106">
-<author>nkaragiannakis</author>
-<date>2015-04-27T14:55:45.471816Z</date>
+ revision="31608">
+<author>malcolmh</author>
+<date>2015-10-09T13:24:00.828532Z</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