Revision: 5527 http://sourceforge.net/p/jump-pilot/code/5527 Author: ma15569 Date: 2017-10-24 14:28:19 +0000 (Tue, 24 Oct 2017) Log Message: ----------- Add circle area display to status bar
Modified Paths: -------------- plug-ins/CADExtension/trunk/src/org/openjump/advancedtools/tools/CircleByDiameterTool.java plug-ins/CADExtension/trunk/src/org/openjump/advancedtools/tools/CircleByRadiusTool.java plug-ins/CADExtension/trunk/src/org/openjump/advancedtools/tools/CircleByTangentTool.java plug-ins/CADExtension/trunk/src/org/openjump/advancedtools/utils/CoordinateListMetricsUtils.java Modified: plug-ins/CADExtension/trunk/src/org/openjump/advancedtools/tools/CircleByDiameterTool.java =================================================================== --- plug-ins/CADExtension/trunk/src/org/openjump/advancedtools/tools/CircleByDiameterTool.java 2017-10-24 14:14:02 UTC (rev 5526) +++ plug-ins/CADExtension/trunk/src/org/openjump/advancedtools/tools/CircleByDiameterTool.java 2017-10-24 14:28:19 UTC (rev 5527) @@ -192,9 +192,12 @@ if (getCoordinates().size() > 0) { Coordinate a = (Coordinate) getCoordinates().get(0); Coordinate b = this.tentativeCoordinate; + double radius = a.distance(b) / 2; + double diameter = getCircleDiameter().getLength(); + double area = 2 * Math.PI * radius; - CoordinateListMetricsUtils.setCircleMessage(a.distance(b) / 2, - getCircleDiameter().getLength(), a, b); + CoordinateListMetricsUtils.setCircleMessage(radius, diameter, + area, a, b); } } catch (Throwable t) { Modified: plug-ins/CADExtension/trunk/src/org/openjump/advancedtools/tools/CircleByRadiusTool.java =================================================================== --- plug-ins/CADExtension/trunk/src/org/openjump/advancedtools/tools/CircleByRadiusTool.java 2017-10-24 14:14:02 UTC (rev 5526) +++ plug-ins/CADExtension/trunk/src/org/openjump/advancedtools/tools/CircleByRadiusTool.java 2017-10-24 14:28:19 UTC (rev 5527) @@ -176,9 +176,11 @@ if (getCoordinates().size() > 0) { Coordinate a = (Coordinate) getCoordinates().get(0); Coordinate b = this.tentativeCoordinate; + double radius = a.distance(b); + double area = 2 * Math.PI * radius; CoordinateListMetricsUtils.setCircleMessage(a.distance(b), - getCircleRadius().getLength(), a, b); + getCircleRadius().getLength(), area, a, b); } } catch (Throwable t) { Modified: plug-ins/CADExtension/trunk/src/org/openjump/advancedtools/tools/CircleByTangentTool.java =================================================================== --- plug-ins/CADExtension/trunk/src/org/openjump/advancedtools/tools/CircleByTangentTool.java 2017-10-24 14:14:02 UTC (rev 5526) +++ plug-ins/CADExtension/trunk/src/org/openjump/advancedtools/tools/CircleByTangentTool.java 2017-10-24 14:28:19 UTC (rev 5527) @@ -162,9 +162,11 @@ if (getCoordinates().size() > 0) { Coordinate a = (Coordinate) getCoordinates().get(0); Coordinate b = this.tentativeCoordinate; + double radius = a.distance(b); + double area = 2 * Math.PI * radius; CoordinateListMetricsUtils.setCircleMessage(a.distance(b), - getCircleTangent().getLength(), a, b); + getCircleTangent().getLength(), area, a, b); } } catch (Throwable t) { Modified: plug-ins/CADExtension/trunk/src/org/openjump/advancedtools/utils/CoordinateListMetricsUtils.java =================================================================== --- plug-ins/CADExtension/trunk/src/org/openjump/advancedtools/utils/CoordinateListMetricsUtils.java 2017-10-24 14:14:02 UTC (rev 5526) +++ plug-ins/CADExtension/trunk/src/org/openjump/advancedtools/utils/CoordinateListMetricsUtils.java 2017-10-24 14:28:19 UTC (rev 5527) @@ -5,6 +5,7 @@ import org.openjump.advancedtools.language.I18NPlug; import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jump.I18N; import com.vividsolutions.jump.workbench.JUMPWorkbench; import com.vividsolutions.jump.workbench.ui.HTMLFrame; @@ -30,31 +31,46 @@ public static final String Measure = I18NPlug .getI18N("org.openjump.core.ui.utils.CoordinateListMetrics.Measure"); + /* + * From + * com.vividsolutions.jump.workbench.ui.cursortool.CoordinateListMetrics + */ + public static final String Area = I18N + .get("ui.cursortool.CoordinateListMetrics.Area"); + public static final String Azimuth = I18N + .get("ui.cursortool.CoordinateListMetrics.Azimuth"); + public static final String Angle = I18N + .get("ui.cursortool.CoordinateListMetrics.Angle"); + public static final String Distance = I18N + .get("ui.cursortool.CoordinateListMetrics.Distance"); + public static DecimalFormat df2 = new DecimalFormat("##0.0##"); public static DecimalFormat df1 = new DecimalFormat("##0.#"); - public static String circleString(double a, double b, Coordinate start, - Coordinate target) { + public static String circleString(double a, double b, double c, + Coordinate start, Coordinate target) { String all = Coordinates + " [" + Center + df1.format(start.x) + " ; " + df1.format(start.y) + " - " + Target + df1.format(target.x) + " ; " + df1.format(target.y) + "] " + Radius + df2.format(a) - + " " + Circum + df2.format(b); + + " " + Circum + df2.format(b) + " " + Area + ": " + + df2.format(c); return all; } - public static void setCircleMessage(double a, double b, Coordinate start, - Coordinate target) { + public static void setCircleMessage(double a, double b, double c, + Coordinate start, Coordinate target) { String all = Coordinates + " [" + Center + df1.format(start.x) + " ; " + df1.format(start.y) + " - " + Target + df1.format(target.x) + " ; " + df1.format(target.y) + "] " + Radius + df2.format(a) - + " " + Circum + df2.format(b); + + " " + Circum + df2.format(b) + " " + Area + ": " + + df2.format(c); JUMPWorkbench.getInstance().getFrame().getContext().getLayerViewPanel() .getContext().setStatusMessage(all); } - public static void setCircleHTMLFrame(double a, double b, Coordinate start, - Coordinate target) { + public static void setCircleHTMLFrame(double a, double b, double c, + Coordinate start, Coordinate target) { HTMLFrame out = JUMPWorkbench.getInstance().getContext() .createPlugInContext().getOutputFrame(); out.createNewDocument(); @@ -68,6 +84,7 @@ + "] "); out.addHeader(3, Radius + df2.format(a)); out.addHeader(3, Circum + df2.format(b)); + out.addHeader(3, Area + ": " + df2.format(c)); } public static void setMessage(String aString, double a) { ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel