diff options
Diffstat (limited to 'src/de/lmu/ifi/dbs/elki/visualization/svg')
15 files changed, 41 insertions, 50 deletions
diff --git a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGArrow.java b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGArrow.java index cbae03e2..86ba3cfa 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGArrow.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGArrow.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.svg; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2013 + Copyright (C) 2014 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team diff --git a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGButton.java b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGButton.java index 9b69ab14..dbcb33fc 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGButton.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGButton.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.svg; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2013 + Copyright (C) 2014 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team diff --git a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGCheckbox.java b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGCheckbox.java index dc27b989..2e837ce5 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGCheckbox.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGCheckbox.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.svg; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2013 + Copyright (C) 2014 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team diff --git a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGCloneVisible.java b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGCloneVisible.java index 6397348c..0172b77b 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGCloneVisible.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGCloneVisible.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.svg; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2013 + Copyright (C) 2014 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team diff --git a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGEffects.java b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGEffects.java index 9382e0b6..d3e17abb 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGEffects.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGEffects.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.svg; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2013 + Copyright (C) 2014 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team diff --git a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGHyperCube.java b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGHyperCube.java index 64f5e9be..5ed7ca5a 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGHyperCube.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGHyperCube.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.svg; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2013 + Copyright (C) 2014 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team @@ -70,7 +70,7 @@ public class SVGHyperCube { * @param max Opposite corner * @return path element */ - public static <V extends NumberVector<?>> Element drawFrame(SVGPlot svgp, Projection2D proj, V min, V max) { + public static <V extends NumberVector> Element drawFrame(SVGPlot svgp, Projection2D proj, V min, V max) { SVGPath path = new SVGPath(); ArrayList<double[]> edges = getVisibleEdges(proj, min.getColumnVector().getArrayRef(), max.getColumnVector().getArrayRef()); double[] rv_min = proj.fastProjectDataToRenderSpace(min); @@ -107,7 +107,7 @@ public class SVGHyperCube { * @param max Opposite corner * @return group element */ - public static <V extends NumberVector<?>> Element drawFilled(SVGPlot svgp, String cls, Projection2D proj, V min, V max) { + public static <V extends NumberVector> Element drawFilled(SVGPlot svgp, String cls, Projection2D proj, V min, V max) { Element group = svgp.svgElement(SVGConstants.SVG_G_TAG); ArrayList<double[]> edges = getVisibleEdges(proj, min.getColumnVector().getArrayRef(), max.getColumnVector().getArrayRef()); double[] rv_min = proj.fastProjectDataToRenderSpace(min); diff --git a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGHyperSphere.java b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGHyperSphere.java index 14acc5c3..2a4afa83 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGHyperSphere.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGHyperSphere.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.svg; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2013 + Copyright (C) 2014 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team @@ -28,7 +28,6 @@ import java.util.BitSet; import org.w3c.dom.Element; import de.lmu.ifi.dbs.elki.data.NumberVector; -import de.lmu.ifi.dbs.elki.distance.distancevalue.NumberDistance; import de.lmu.ifi.dbs.elki.visualization.projections.Projection2D; /** @@ -56,7 +55,7 @@ public class SVGHyperSphere { * @param radius radius * @return path element */ - public static Element drawManhattan(SVGPlot svgp, Projection2D proj, NumberVector<?> mid, double radius) { + public static Element drawManhattan(SVGPlot svgp, Projection2D proj, NumberVector mid, double radius) { final double[] v_mid = mid.getColumnVector().getArrayRef(); // a copy final BitSet dims = proj.getVisibleDimensions2D(); @@ -101,7 +100,7 @@ public class SVGHyperSphere { * @param radius radius * @return path element */ - public static Element drawEuclidean(SVGPlot svgp, Projection2D proj, NumberVector<?> mid, double radius) { + public static Element drawEuclidean(SVGPlot svgp, Projection2D proj, NumberVector mid, double radius) { double[] v_mid = mid.getColumnVector().getArrayRef(); // a copy BitSet dims = proj.getVisibleDimensions2D(); @@ -152,7 +151,7 @@ public class SVGHyperSphere { * @param p L_p value * @return path element */ - public static Element drawLp(SVGPlot svgp, Projection2D proj, NumberVector<?> mid, double radius, double p) { + public static Element drawLp(SVGPlot svgp, Projection2D proj, NumberVector mid, double radius, double p) { final double[] v_mid = mid.getColumnVector().getArrayRef(); final BitSet dims = proj.getVisibleDimensions2D(); @@ -260,15 +259,13 @@ public class SVGHyperSphere { /** * Wireframe "cross" hypersphere * - * @param <D> radius * @param svgp SVG Plot * @param proj Visualization projection * @param mid mean vector - * @param rad radius + * @param radius radius * @return path element */ - public static <D extends NumberDistance<?, ?>> Element drawCross(SVGPlot svgp, Projection2D proj, NumberVector<?> mid, D rad) { - final double radius = rad.doubleValue(); + public static Element drawCross(SVGPlot svgp, Projection2D proj, NumberVector mid, double radius) { final double[] v_mid = mid.getColumnVector().getArrayRef(); final BitSet dims = proj.getVisibleDimensions2D(); diff --git a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java index 6937ab3e..4af270b5 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.svg; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2013 + Copyright (C) 2014 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team diff --git a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java index 44ec906b..f87f2443 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.svg; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2013 + Copyright (C) 2014 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team diff --git a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGScoreBar.java b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGScoreBar.java index e421cafa..a481bf05 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGScoreBar.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGScoreBar.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.svg; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2013 + Copyright (C) 2014 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team @@ -28,8 +28,6 @@ import java.text.NumberFormat; import org.apache.batik.util.SVGConstants; import org.w3c.dom.Element; -import de.lmu.ifi.dbs.elki.utilities.FormatUtil; - /** * Draw a score bar. Essentially like a progress bar, left-to-right, displaying * a relative score. @@ -39,14 +37,9 @@ import de.lmu.ifi.dbs.elki.utilities.FormatUtil; // TODO: refactor to get a progress bar? public class SVGScoreBar { /** - * Fill value - */ - protected double fill = 0.0; - - /** - * Total size + * Value, minimum and maximum values */ - protected double size = 1.0; + protected double val, min = 0., max = 1.; /** * Label (on the right) @@ -68,12 +61,14 @@ public class SVGScoreBar { /** * Set the fill of the score bar. * - * @param fill Fill value - * @param size Total size + * @param val Value + * @param min Minimum value + * @param max Maximum value */ - public void setFill(double fill, double size) { - this.fill = fill; - this.size = size; + public void setFill(double val, double min, double max) { + this.val = val; + this.min = min; + this.max = max; } /** @@ -114,8 +109,8 @@ public class SVGScoreBar { bar.setAttribute(SVGConstants.SVG_STROKE_WIDTH_ATTRIBUTE, String.valueOf(height * 0.01)); barchart.appendChild(bar); - if(fill >= 0 && fill <= size + 1) { - double fpos = (fill / size) * (width - (0.04 * height)); + if(val >= min && val <= max && min < max) { + double fpos = (val - min) / (max - min) * (width - (0.04 * height)); Element chart = svgp.svgRect(x + 0.02 * height, y + 0.02 * height, fpos, height - 0.04 * height); chart.setAttribute(SVGConstants.SVG_FILL_ATTRIBUTE, "#d4e4f1"); chart.setAttribute(SVGConstants.SVG_STROKE_ATTRIBUTE, "#a0a0a0"); @@ -125,7 +120,7 @@ public class SVGScoreBar { // Draw the values: if(format != null) { - String num = Double.isNaN(fill) ? "NaN" : FormatUtil.format(fill, format); + String num = Double.isNaN(val) ? "NaN" : format.format(val); Element lbl = svgp.svgText(x + 0.05 * width, y + 0.75 * height, num); lbl.setAttribute(SVGConstants.SVG_STYLE_ATTRIBUTE, "font-size: " + 0.75 * height + "; font-weight: bold"); barchart.appendChild(lbl); diff --git a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGSimpleLinearAxis.java b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGSimpleLinearAxis.java index 3fd28d3d..a50ce8c5 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGSimpleLinearAxis.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGSimpleLinearAxis.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.svg; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2013 + Copyright (C) 2014 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team diff --git a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java index 0e680e12..7749cd09 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.svg; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2013 + Copyright (C) 2014 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team diff --git a/src/de/lmu/ifi/dbs/elki/visualization/svg/UpdateRunner.java b/src/de/lmu/ifi/dbs/elki/visualization/svg/UpdateRunner.java index edf40621..74d943ae 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/svg/UpdateRunner.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/svg/UpdateRunner.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.svg; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2013 + Copyright (C) 2014 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team @@ -125,9 +125,10 @@ public class UpdateRunner { * @param newsync Update synchronizer */ public synchronized void synchronizeWith(UpdateSynchronizer newsync) { - // LoggingUtil.warning("Synchronizing: " + sync + " " + newsync); + // LoggingUtil.warning("Synchronizing: " + sync + " " + newsync, new + // Throwable()); if(synchronizer == newsync) { - LoggingUtil.warning("Double-synced to the same plot!"); + LoggingUtil.warning("Double-synced to the same plot!", new Throwable()); return; } if(synchronizer != null) { @@ -136,7 +137,6 @@ public class UpdateRunner { } synchronizer = newsync; newsync.addUpdateRunner(this); - } /** @@ -147,12 +147,11 @@ public class UpdateRunner { public synchronized void unsynchronizeWith(UpdateSynchronizer oldsync) { if(synchronizer == null) { LoggingUtil.warning("Warning: was not synchronized."); + return; } - else { - if(synchronizer != oldsync) { - LoggingUtil.warning("Warning: was synchronized differently!"); - return; - } + if(synchronizer != oldsync) { + LoggingUtil.warning("Warning: was synchronized differently!"); + return; } // LoggingUtil.warning("Unsynchronizing: " + sync + " " + oldsync); synchronizer = null; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/svg/UpdateSynchronizer.java b/src/de/lmu/ifi/dbs/elki/visualization/svg/UpdateSynchronizer.java index a91fb142..b0b45f2f 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/svg/UpdateSynchronizer.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/svg/UpdateSynchronizer.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.svg; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2013 + Copyright (C) 2014 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team diff --git a/src/de/lmu/ifi/dbs/elki/visualization/svg/VoronoiDraw.java b/src/de/lmu/ifi/dbs/elki/visualization/svg/VoronoiDraw.java index e5824fba..9eb554bd 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/svg/VoronoiDraw.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/svg/VoronoiDraw.java @@ -3,7 +3,7 @@ package de.lmu.ifi.dbs.elki.visualization.svg; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2013 + Copyright (C) 2014 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team |