diff options
Diffstat (limited to 'src/de/lmu/ifi/dbs/elki/visualization')
132 files changed, 5020 insertions, 3773 deletions
diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/VisualizationTask.java b/src/de/lmu/ifi/dbs/elki/visualization/VisualizationTask.java index bb11f96d..c648a9dd 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/VisualizationTask.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/VisualizationTask.java @@ -1,32 +1,34 @@ -package de.lmu.ifi.dbs.elki.visualization.visualizers; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. +package de.lmu.ifi.dbs.elki.visualization; -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import de.lmu.ifi.dbs.elki.database.relation.Relation; import de.lmu.ifi.dbs.elki.result.Result; import de.lmu.ifi.dbs.elki.utilities.datastructures.AnyMap; import de.lmu.ifi.dbs.elki.visualization.projections.Projection; import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot; +import de.lmu.ifi.dbs.elki.visualization.visualizers.VisFactory; /** * Container class, with ugly casts to reduce generics crazyness. @@ -165,17 +167,12 @@ public class VisualizationTask extends AnyMap<String> implements Cloneable, Resu /** * Width */ - double width; + public double width; /** * Height */ - double height; - - /** - * Stack to plot to (e.g. 1D, 2D, OPTICS, ...) - */ - Object stack; + public double height; /** * Visualization task. @@ -184,15 +181,13 @@ public class VisualizationTask extends AnyMap<String> implements Cloneable, Resu * @param result Result * @param relation Relation to use * @param factory Factory - * @param stack Stack */ - public VisualizationTask(String name, Result result, Relation<?> relation, VisFactory factory, Object stack) { + public VisualizationTask(String name, Result result, Relation<?> relation, VisFactory factory) { super(); this.name = name; this.result = result; this.relation = relation; this.factory = factory; - this.stack = stack; } /** @@ -203,19 +198,17 @@ public class VisualizationTask extends AnyMap<String> implements Cloneable, Resu * @param result Result * @param relation Representation * @param factory Factory - * @param stack Stack * @param proj Projection * @param svgp Plot * @param width Width * @param height Height */ - public VisualizationTask(String name, VisualizerContext context, Result result, Relation<?> relation, VisFactory factory, Object stack, Projection proj, SVGPlot svgp, double width, double height) { + public VisualizationTask(String name, VisualizerContext context, Result result, Relation<?> relation, VisFactory factory, Projection proj, SVGPlot svgp, double width, double height) { super(); this.name = name; this.context = context; this.result = result; this.factory = factory; - this.stack = stack; this.proj = proj; this.relation = relation; this.svgp = svgp; @@ -276,7 +269,6 @@ public class VisualizationTask extends AnyMap<String> implements Cloneable, Resu obj.result = result; obj.proj = proj; obj.factory = factory; - obj.stack = stack; obj.svgp = svgp; obj.width = width; obj.height = height; @@ -368,13 +360,4 @@ public class VisualizationTask extends AnyMap<String> implements Cloneable, Resu // Also don't inherit equals based on list contents! return (this == o); } - - /** - * Get the stacking object for visualizers. - * - * @return Type object, supports identity - */ - public Object getVisualizationStack() { - return stack; - } }
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/VisualizerContext.java b/src/de/lmu/ifi/dbs/elki/visualization/VisualizerContext.java index 3116f857..ed30f3a3 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/VisualizerContext.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/VisualizerContext.java @@ -1,29 +1,29 @@ -package de.lmu.ifi.dbs.elki.visualization.visualizers; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. +package de.lmu.ifi.dbs.elki.visualization; -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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.Collection; -import java.util.Iterator; import java.util.List; import java.util.regex.Pattern; @@ -44,9 +44,11 @@ import de.lmu.ifi.dbs.elki.result.ResultUtil; import de.lmu.ifi.dbs.elki.result.SelectionResult; import de.lmu.ifi.dbs.elki.utilities.datastructures.AnyMap; import de.lmu.ifi.dbs.elki.utilities.iterator.IterableIterator; -import de.lmu.ifi.dbs.elki.utilities.iterator.TypeFilterIterator; +import de.lmu.ifi.dbs.elki.visualization.projector.ProjectorFactory; import de.lmu.ifi.dbs.elki.visualization.style.PropertiesBasedStyleLibrary; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; +import de.lmu.ifi.dbs.elki.visualization.visualizers.VisFactory; +import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil; import de.lmu.ifi.dbs.elki.visualization.visualizers.events.ContextChangeListener; import de.lmu.ifi.dbs.elki.visualization.visualizers.events.ContextChangedEvent; @@ -90,6 +92,11 @@ public class VisualizerContext extends AnyMap<String> implements DataStoreListen private StyleLibrary stylelib; /** + * Projectors to use + */ + private Collection<ProjectorFactory> projectors; + + /** * Factories to use */ private Collection<VisFactory> factories; @@ -124,14 +131,17 @@ public class VisualizerContext extends AnyMap<String> implements DataStoreListen * * @param result Result * @param stylelib Style library + * @param projectors Projectors to use * @param factories Visualizer Factories to use * @param hideVisualizers Pattern to hide visualizers */ - public VisualizerContext(HierarchicalResult result, StyleLibrary stylelib, Collection<VisFactory> factories, Pattern hideVisualizers) { + public VisualizerContext(HierarchicalResult result, StyleLibrary stylelib, Collection<ProjectorFactory> projectors, Collection<VisFactory> factories, Pattern hideVisualizers) { super(); this.result = result; this.stylelib = stylelib; + this.projectors = projectors; this.factories = factories; + this.hideVisualizers = hideVisualizers; List<Clustering<? extends Model>> clusterings = ResultUtil.getClusteringResults(result); @@ -149,8 +159,7 @@ public class VisualizerContext extends AnyMap<String> implements DataStoreListen processNewResult(result, result); // For proxying events. - // FIXME: RELEASE4 - // this.database.addDataStoreListener(this); + ResultUtil.findDatabase(result).addDataStoreListener(this); // Add ourselves as RL addResultListener(this); } @@ -253,7 +262,8 @@ public class VisualizerContext extends AnyMap<String> implements DataStoreListen public void setVisualizationVisibility(VisualizationTask task, boolean visibility) { // Hide other tools if(visibility && VisualizerUtil.isTool(task)) { - for(VisualizationTask other : iterVisualizers()) { + final Iterable<VisualizationTask> visualizers = ResultUtil.filteredResults(getResult(), VisualizationTask.class); + for(VisualizationTask other : visualizers) { if(other != task && VisualizerUtil.isTool(other) && VisualizerUtil.isVisible(other)) { other.put(VisualizationTask.META_VISIBLE, false); getHierarchy().resultChanged(other); @@ -331,6 +341,17 @@ public class VisualizerContext extends AnyMap<String> implements DataStoreListen * @param newResult Newly added Result */ private void processNewResult(HierarchicalResult baseResult, Result newResult) { + for(ProjectorFactory p : projectors) { + if(hideVisualizers != null && hideVisualizers.matcher(p.getClass().getName()).find()) { + continue; + } + try { + p.processNewResult(baseResult, newResult); + } + catch(Throwable e) { + logger.warning("ProjectorFactory " + p.getClass().getCanonicalName() + " failed:", e); + } + } // Collect all visualizers. for(VisFactory f : factories) { if(hideVisualizers != null && hideVisualizers.matcher(f.getClass().getName()).find()) { @@ -340,7 +361,7 @@ public class VisualizerContext extends AnyMap<String> implements DataStoreListen f.processNewResult(baseResult, newResult); } catch(Throwable e) { - logger.warning("AlgorithmAdapter " + f.getClass().getCanonicalName() + " failed:", e); + logger.warning("VisFactory " + f.getClass().getCanonicalName() + " failed:", e); } } } @@ -349,90 +370,12 @@ public class VisualizerContext extends AnyMap<String> implements DataStoreListen * Get an iterator over all visualizers. * * @return Iterator - */ - public IterableIterator<VisualizationTask> iterVisualizers() { - return new VisualizerIterator(); - } - - /** - * Iterator doing a depth-first traversal of the tree. * - * @author Erich Schubert - * - * @apiviz.exclude + * @deprecated Odd semantics: contains duplicates! */ - private class VisualizerIterator implements IterableIterator<VisualizationTask> { - /** - * The results iterator. - */ - private Iterator<? extends Result> resultiter = null; - - /** - * Current results visualizers - */ - private Iterator<VisualizationTask> resultvisiter = null; - - /** - * The current result - */ - private Result curResult = null; - - /** - * The next item to return. - */ - private VisualizationTask nextItem = null; - - /** - * Constructor. - */ - public VisualizerIterator() { - super(); - this.resultiter = ResultUtil.filteredResults(getResult(), Result.class); - updateNext(); - } - - /** - * Update the iterator to point to the next element. - */ - private void updateNext() { - nextItem = null; - // try within the current result - if(resultvisiter != null && resultvisiter.hasNext()) { - nextItem = resultvisiter.next(); - return; - } - if(resultiter != null && resultiter.hasNext()) { - // advance to next result, retry. - curResult = resultiter.next(); - final List<Result> children = getHierarchy().getChildren(curResult); - resultvisiter = new TypeFilterIterator<Result, VisualizationTask>(VisualizationTask.class, children); - updateNext(); - return; - } - // This means we have failed - we'll leave nextItem = null - } - - @Override - public boolean hasNext() { - return (nextItem != null); - } - - @Override - public VisualizationTask next() { - VisualizationTask vis = nextItem; - updateNext(); - return vis; - } - - @Override - public void remove() { - throw new UnsupportedOperationException("Removals are not supported."); - } - - @Override - public Iterator<VisualizationTask> iterator() { - return this; - } + @Deprecated + public IterableIterator<VisualizationTask> iterVisualizers() { + return ResultUtil.filteredResults(getResult(), VisualizationTask.class); } /** diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/VisualizerParameterizer.java b/src/de/lmu/ifi/dbs/elki/visualization/VisualizerParameterizer.java index 437e68fc..7f4dc15d 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/VisualizerParameterizer.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/VisualizerParameterizer.java @@ -1,26 +1,27 @@ -package de.lmu.ifi.dbs.elki.visualization.visualizers; +package de.lmu.ifi.dbs.elki.visualization; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.io.File; import java.util.ArrayList; @@ -49,8 +50,10 @@ import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Parameter; import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.PatternParameter; import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.StringParameter; import de.lmu.ifi.dbs.elki.utilities.pairs.Pair; +import de.lmu.ifi.dbs.elki.visualization.projector.ProjectorFactory; import de.lmu.ifi.dbs.elki.visualization.style.PropertiesBasedStyleLibrary; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; +import de.lmu.ifi.dbs.elki.visualization.visualizers.VisFactory; /** * Utility class to determine the visualizers for a result class. @@ -111,15 +114,22 @@ public class VisualizerParameterizer implements Parameterizable { private Pattern hideVisualizers = null; /** + * Projectors to use. + */ + private Collection<ProjectorFactory> projectors; + + /** * Constructor. - * + * * @param stylelib Style library + * @param projectors Projectors * @param factories Factories to use * @param hideVisualizers Visualizer hiding pattern */ - public VisualizerParameterizer(StyleLibrary stylelib, Collection<VisFactory> factories, Pattern hideVisualizers) { + public VisualizerParameterizer(StyleLibrary stylelib, Collection<ProjectorFactory> projectors, Collection<VisFactory> factories, Pattern hideVisualizers) { super(); this.stylelib = stylelib; + this.projectors = projectors; this.factories = factories; this.hideVisualizers = hideVisualizers; } @@ -131,7 +141,7 @@ public class VisualizerParameterizer implements Parameterizable { * @return New context */ public VisualizerContext newContext(HierarchicalResult result) { - VisualizerContext context = new VisualizerContext(result, stylelib, factories, hideVisualizers); + VisualizerContext context = new VisualizerContext(result, stylelib, projectors, factories, hideVisualizers); return context; } @@ -210,6 +220,8 @@ public class VisualizerParameterizer implements Parameterizable { protected Collection<VisFactory> factories = null; + protected Collection<ProjectorFactory> projectors = null; + @Override protected void makeOptions(Parameterization config) { super.makeOptions(config); @@ -230,32 +242,55 @@ public class VisualizerParameterizer implements Parameterizable { } } MergedParameterization merged = new MergedParameterization(config); - factories = collectAlgorithmAdapters(merged); + projectors = collectProjectorFactorys(merged); + factories = collectVisFactorys(merged); + } + + /** + * Collect and instantiate all projector factories. + * + * @param config Parameterization + * @return List of all adapters found. + */ + private static <O> Collection<ProjectorFactory> collectProjectorFactorys(MergedParameterization config) { + ArrayList<ProjectorFactory> factories = new ArrayList<ProjectorFactory>(); + for(Class<?> c : InspectionUtil.cachedFindAllImplementations(ProjectorFactory.class)) { + try { + config.rewind(); + ProjectorFactory a = ClassGenericsUtil.tryInstantiate(ProjectorFactory.class, c, config); + factories.add(a); + } + catch(Throwable e) { + logger.exception("Error instantiating visualization factory " + c.getName(), e); + } + } + return factories; } /** - * Collect and instantiate all adapters. + * Collect and instantiate all visualizer factories. * * @param config Parameterization * @return List of all adapters found. */ - private static <O> Collection<VisFactory> collectAlgorithmAdapters(Parameterization config) { - ArrayList<VisFactory> algorithmAdapters = new ArrayList<VisFactory>(); + private static <O> Collection<VisFactory> collectVisFactorys(MergedParameterization config) { + ArrayList<VisFactory> factories = new ArrayList<VisFactory>(); for(Class<?> c : InspectionUtil.cachedFindAllImplementations(VisFactory.class)) { try { + config.rewind(); VisFactory a = ClassGenericsUtil.tryInstantiate(VisFactory.class, c, config); - algorithmAdapters.add(a); + factories.add(a); } catch(Throwable e) { logger.exception("Error instantiating visualization factory " + c.getName(), e); } } - return algorithmAdapters; + return factories; } @Override protected VisualizerParameterizer makeInstance() { - return new VisualizerParameterizer(stylelib, factories, hideVisualizers); + return new VisualizerParameterizer(stylelib, projectors, factories, hideVisualizers); } } }
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/AddCSSClass.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/AddCSSClass.java index 5188c697..068b538a 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/AddCSSClass.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/AddCSSClass.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.batikutil; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import org.w3c.dom.Element; import org.w3c.dom.events.Event; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/AttributeModifier.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/AttributeModifier.java index d1764339..f1e62754 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/AttributeModifier.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/AttributeModifier.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.batikutil; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import org.w3c.dom.Element; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/BatikUtil.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/BatikUtil.java index 610a5de1..f219a0ba 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/BatikUtil.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/BatikUtil.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.batikutil; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import org.apache.batik.dom.events.DOMMouseEvent; import org.w3c.dom.Element; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/CSSHoverClass.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/CSSHoverClass.java index ab5c24fb..d65256c0 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/CSSHoverClass.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/CSSHoverClass.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.batikutil; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import org.apache.batik.util.SVGConstants; import org.w3c.dom.Element; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/DragableArea.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/DragableArea.java index d3f6a9f3..978aec29 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/DragableArea.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/DragableArea.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.batikutil; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import org.apache.batik.util.SVGConstants; import org.w3c.dom.Element; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/JSVGSynchronizedCanvas.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/JSVGSynchronizedCanvas.java index 1c538bc1..a9e467db 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/JSVGSynchronizedCanvas.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/JSVGSynchronizedCanvas.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.batikutil; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import org.apache.batik.bridge.UpdateManager; import org.apache.batik.swing.JSVGCanvas; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/JSVGUpdateSynchronizer.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/JSVGUpdateSynchronizer.java index 110f3ab2..96d99002 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/JSVGUpdateSynchronizer.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/JSVGUpdateSynchronizer.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.batikutil; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.lang.ref.WeakReference; import java.util.List; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/LazyCanvasResizer.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/LazyCanvasResizer.java index f9bf630c..d11e1b00 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/LazyCanvasResizer.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/LazyCanvasResizer.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.batikutil; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.awt.Component; import java.awt.event.ComponentAdapter; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/NodeAppendChild.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/NodeAppendChild.java index f4638cf7..69282a5a 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/NodeAppendChild.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/NodeAppendChild.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.batikutil; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import org.w3c.dom.Element; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/NodeReplaceChild.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/NodeReplaceChild.java index be0db41c..0b5049cb 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/NodeReplaceChild.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/NodeReplaceChild.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.batikutil; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import org.w3c.dom.Element; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/NodeReplacer.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/NodeReplacer.java index 63a8965e..51b1fec8 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/NodeReplacer.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/NodeReplacer.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.batikutil; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import org.w3c.dom.Element; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/RemoveCSSClass.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/RemoveCSSClass.java index 18cb74db..9c16a2db 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/RemoveCSSClass.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/RemoveCSSClass.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.batikutil; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import org.w3c.dom.Element; import org.w3c.dom.events.Event; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/colors/ColorLibrary.java b/src/de/lmu/ifi/dbs/elki/visualization/colors/ColorLibrary.java index fa2caa62..0741d9b3 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/colors/ColorLibrary.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/colors/ColorLibrary.java @@ -1,26 +1,28 @@ package de.lmu.ifi.dbs.elki.visualization.colors; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. -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 Affero General Public License for more details. + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ /** * Color scheme interface diff --git a/src/de/lmu/ifi/dbs/elki/visualization/colors/ListBasedColorLibrary.java b/src/de/lmu/ifi/dbs/elki/visualization/colors/ListBasedColorLibrary.java index 3b782e7a..4785fb87 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/colors/ListBasedColorLibrary.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/colors/ListBasedColorLibrary.java @@ -1,26 +1,28 @@ package de.lmu.ifi.dbs.elki.visualization.colors; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. -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 Affero General Public License for more details. + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ /** diff --git a/src/de/lmu/ifi/dbs/elki/visualization/css/CSSClass.java b/src/de/lmu/ifi/dbs/elki/visualization/css/CSSClass.java index 196d5f83..33dfe5f4 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/css/CSSClass.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/css/CSSClass.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.css; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.lang.ref.WeakReference; import java.util.ArrayList; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/css/CSSClassManager.java b/src/de/lmu/ifi/dbs/elki/visualization/css/CSSClassManager.java index 9c109a0f..de527e4e 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/css/CSSClassManager.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/css/CSSClassManager.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.css; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.Collection; import java.util.HashMap; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/gui/ResultVisualizer.java b/src/de/lmu/ifi/dbs/elki/visualization/gui/ResultVisualizer.java index 28988d4a..aa5cd2b4 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/gui/ResultVisualizer.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/gui/ResultVisualizer.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.gui; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import javax.swing.JFrame; @@ -32,13 +33,10 @@ import de.lmu.ifi.dbs.elki.result.ResultHandler; import de.lmu.ifi.dbs.elki.result.ResultUtil; import de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizer; import de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionID; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.constraints.GreaterEqualConstraint; import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.IntParameter; import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.StringParameter; -import de.lmu.ifi.dbs.elki.visualization.gui.overview.OverviewPlot; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerContext; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerParameterizer; +import de.lmu.ifi.dbs.elki.visualization.VisualizerContext; +import de.lmu.ifi.dbs.elki.visualization.VisualizerParameterizer; /** * Handler to process and visualize a Result. @@ -69,15 +67,6 @@ public class ResultVisualizer implements ResultHandler { public static final OptionID WINDOW_TITLE_ID = OptionID.getOrCreateOptionID("vis.window.title", "Title to use for visualization window."); /** - * Parameter for the maximum number of dimensions, - * - * <p> - * Code: -vis.maxdim - * </p> - */ - public static final OptionID MAXDIM_ID = OptionID.getOrCreateOptionID("vis.maxdim", "Maximum number of dimensions to display."); - - /** * Stores the set title. */ String title; @@ -88,11 +77,6 @@ public class ResultVisualizer implements ResultHandler { protected final static String DEFAULT_TITLE = "ELKI Result Visualization"; /** - * Stores the maximum number of dimensions to show. - */ - int maxdim = OverviewPlot.MAX_DIMENSIONS_DEFAULT; - - /** * Visualization manager. */ VisualizerParameterizer manager; @@ -101,13 +85,11 @@ public class ResultVisualizer implements ResultHandler { * Constructor. * * @param title - * @param maxdim * @param manager */ - public ResultVisualizer(String title, int maxdim, VisualizerParameterizer manager) { + public ResultVisualizer(String title, VisualizerParameterizer manager) { super(); this.title = title; - this.maxdim = maxdim; this.manager = manager; } @@ -132,10 +114,9 @@ public class ResultVisualizer implements ResultHandler { @Override public void run() { try { - ResultWindow window = new ResultWindow(title, db, top, maxdim, context); + ResultWindow window = new ResultWindow(title, top, context); window.setVisible(true); window.setExtendedState(window.getExtendedState() | JFrame.MAXIMIZED_BOTH); - window.update(); window.showOverview(); } catch(Throwable e) { @@ -159,11 +140,6 @@ public class ResultVisualizer implements ResultHandler { String title; /** - * Stores the maximum number of dimensions to show. - */ - int maxdim = OverviewPlot.MAX_DIMENSIONS_DEFAULT; - - /** * Visualization manager. */ VisualizerParameterizer manager; @@ -176,16 +152,12 @@ public class ResultVisualizer implements ResultHandler { title = titleP.getValue(); } - IntParameter maxdimP = new IntParameter(MAXDIM_ID, new GreaterEqualConstraint(1), OverviewPlot.MAX_DIMENSIONS_DEFAULT); - if(config.grab(maxdimP)) { - maxdim = maxdimP.getValue(); - } manager = config.tryInstantiate(VisualizerParameterizer.class); } @Override protected ResultVisualizer makeInstance() { - return new ResultVisualizer(title, maxdim, manager); + return new ResultVisualizer(title, manager); } } }
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/gui/ResultWindow.java b/src/de/lmu/ifi/dbs/elki/visualization/gui/ResultWindow.java index 4f25a520..a3b8a458 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/gui/ResultWindow.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/gui/ResultWindow.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.gui; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.awt.BorderLayout; import java.awt.Dimension; @@ -31,6 +32,7 @@ import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.event.KeyEvent; +import javax.swing.ImageIcon; import javax.swing.JCheckBoxMenuItem; import javax.swing.JFrame; import javax.swing.JMenu; @@ -40,12 +42,15 @@ import javax.swing.JPanel; import javax.swing.JRadioButtonMenuItem; import javax.swing.SwingUtilities; -import de.lmu.ifi.dbs.elki.database.Database; +import de.lmu.ifi.dbs.elki.KDDTask; import de.lmu.ifi.dbs.elki.logging.Logging; +import de.lmu.ifi.dbs.elki.result.HierarchicalResult; import de.lmu.ifi.dbs.elki.result.Result; import de.lmu.ifi.dbs.elki.result.ResultAdapter; import de.lmu.ifi.dbs.elki.result.ResultHierarchy; import de.lmu.ifi.dbs.elki.result.ResultListener; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; +import de.lmu.ifi.dbs.elki.visualization.VisualizerContext; import de.lmu.ifi.dbs.elki.visualization.batikutil.JSVGSynchronizedCanvas; import de.lmu.ifi.dbs.elki.visualization.batikutil.LazyCanvasResizer; import de.lmu.ifi.dbs.elki.visualization.gui.detail.DetailView; @@ -53,8 +58,6 @@ import de.lmu.ifi.dbs.elki.visualization.gui.overview.DetailViewSelectedEvent; import de.lmu.ifi.dbs.elki.visualization.gui.overview.OverviewPlot; import de.lmu.ifi.dbs.elki.visualization.savedialog.SVGSaveDialog; import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerContext; import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil; /** @@ -128,18 +131,19 @@ public class ResultWindow extends JFrame implements ResultListener { */ private DetailView currentSubplot = null; - private Result result; + /** + * Result to visualize + */ + private HierarchicalResult result; /** * Constructor. * * @param title Window title - * @param db Database * @param result Result to visualize - * @param maxdim Maximal dimensionality to show. * @param context Visualizer context */ - public ResultWindow(String title, Database db, Result result, int maxdim, VisualizerContext context) { + public ResultWindow(String title, HierarchicalResult result, VisualizerContext context) { super(title); this.context = context; this.result = result; @@ -147,6 +151,14 @@ public class ResultWindow extends JFrame implements ResultListener { // close handler this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + // ELKI icon + try { + setIconImage(new ImageIcon(KDDTask.class.getResource("elki-icon.png")).getImage()); + } + catch(Exception e) { + // Ignore - icon not found is not fatal. + } + // setup buttons exportItem = new JMenuItem("Export"); exportItem.setMnemonic(KeyEvent.VK_E); @@ -194,7 +206,8 @@ public class ResultWindow extends JFrame implements ResultListener { filemenu.setMnemonic(KeyEvent.VK_F); filemenu.add(overviewItem); filemenu.add(exportItem); - filemenu.add(editItem); + // FIXME: re-add when it is working again. + // filemenu.add(editItem); filemenu.add(quitItem); menubar.add(filemenu); @@ -209,7 +222,7 @@ public class ResultWindow extends JFrame implements ResultListener { this.getContentPane().add(panel); - this.overview = new OverviewPlot(db, result, maxdim, context); + this.overview = new OverviewPlot(result, context); // when a subplot is clicked, show the selected subplot. overview.addActionListener(new ActionListener() { @Override @@ -339,7 +352,7 @@ public class ResultWindow extends JFrame implements ResultListener { // currentSubplot.redraw(); showPlot(currentSubplot); } - overview.refresh(); + overview.lazyRefresh(); } /** diff --git a/src/de/lmu/ifi/dbs/elki/visualization/gui/SelectionTableWindow.java b/src/de/lmu/ifi/dbs/elki/visualization/gui/SelectionTableWindow.java index 6762205c..c2190e63 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/gui/SelectionTableWindow.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/gui/SelectionTableWindow.java @@ -28,6 +28,7 @@ import java.awt.event.ActionListener; import java.util.Collections;
import java.util.Set;
+import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
@@ -35,12 +36,12 @@ import javax.swing.JScrollPane; import javax.swing.JTable;
import javax.swing.table.AbstractTableModel;
+import de.lmu.ifi.dbs.elki.KDDTask;
import de.lmu.ifi.dbs.elki.data.ClassLabel;
import de.lmu.ifi.dbs.elki.data.SimpleClassLabel;
import de.lmu.ifi.dbs.elki.database.Database;
import de.lmu.ifi.dbs.elki.database.UpdatableDatabase;
import de.lmu.ifi.dbs.elki.database.datastore.DataStoreEvent;
-import de.lmu.ifi.dbs.elki.database.datastore.DataStoreEvent.Type;
import de.lmu.ifi.dbs.elki.database.datastore.DataStoreListener;
import de.lmu.ifi.dbs.elki.database.ids.ArrayModifiableDBIDs;
import de.lmu.ifi.dbs.elki.database.ids.DBID;
@@ -54,7 +55,7 @@ import de.lmu.ifi.dbs.elki.result.ResultListener; import de.lmu.ifi.dbs.elki.result.ResultUtil;
import de.lmu.ifi.dbs.elki.result.SelectionResult;
import de.lmu.ifi.dbs.elki.utilities.exceptions.AbortException;
-import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerContext;
+import de.lmu.ifi.dbs.elki.visualization.VisualizerContext;
/**
* Visualizes selected Objects in a JTable, objects can be selected, changed and
@@ -132,6 +133,14 @@ public class SelectionTableWindow extends JFrame implements DataStoreListener, R */
public SelectionTableWindow(VisualizerContext context) {
super(NAME);
+ // ELKI icon
+ try {
+ setIconImage(new ImageIcon(KDDTask.class.getResource("elki-icon.png")).getImage());
+ }
+ catch(Exception e) {
+ // Ignore - icon not found is not fatal.
+ }
+
this.context = context;
this.database = ResultUtil.findDatabase(context.getResult());
// FIXME: re-add labels
@@ -342,8 +351,9 @@ public class SelectionTableWindow extends JFrame implements DataStoreListener, R @Override
public void contentChanged(DataStoreEvent e) {
- Set<Type> eventTypes = e.getTypes();
- if(eventTypes.size() == 1 && eventTypes.iterator().next().equals(Type.UPDATE)) {
+ // Use fully qualified names to avoid JDK7 bug.
+ Set<de.lmu.ifi.dbs.elki.database.datastore.DataStoreEvent.Type> eventTypes = e.getTypes();
+ if(eventTypes.size() == 1 && eventTypes.iterator().next().equals(de.lmu.ifi.dbs.elki.database.datastore.DataStoreEvent.Type.UPDATE)) {
dotTableModel.fireTableDataChanged();
}
else {
diff --git a/src/de/lmu/ifi/dbs/elki/visualization/gui/SimpleSVGViewer.java b/src/de/lmu/ifi/dbs/elki/visualization/gui/SimpleSVGViewer.java index 2bb6cf5f..e249eed3 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/gui/SimpleSVGViewer.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/gui/SimpleSVGViewer.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.gui; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.awt.BorderLayout; import java.awt.Dimension; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/gui/detail/DetailView.java b/src/de/lmu/ifi/dbs/elki/visualization/gui/detail/DetailView.java index b5513c09..99bbc78d 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/gui/detail/DetailView.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/gui/detail/DetailView.java @@ -1,29 +1,29 @@ package de.lmu.ifi.dbs.elki.visualization.gui.detail; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; @@ -35,6 +35,9 @@ import de.lmu.ifi.dbs.elki.logging.Logging; import de.lmu.ifi.dbs.elki.logging.LoggingUtil; import de.lmu.ifi.dbs.elki.result.Result; import de.lmu.ifi.dbs.elki.result.ResultListener; +import de.lmu.ifi.dbs.elki.utilities.iterator.IterableUtil; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; +import de.lmu.ifi.dbs.elki.visualization.VisualizerContext; import de.lmu.ifi.dbs.elki.visualization.batikutil.AttributeModifier; import de.lmu.ifi.dbs.elki.visualization.css.CSSClass; import de.lmu.ifi.dbs.elki.visualization.gui.overview.PlotItem; @@ -42,8 +45,6 @@ import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot; import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerContext; import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil; /** @@ -99,7 +100,7 @@ public class DetailView extends SVGPlot implements ResultListener { this.visi = vis; this.ratio = ratio; - Collections.sort(this.visi); + this.visi.sort(); // TODO: only do this when there is an interactive visualizer? setDisableInteractions(true); @@ -131,22 +132,15 @@ public class DetailView extends SVGPlot implements ResultListener { getDocument().getRootElement().appendChild(bg); } - // TODO: protected? protected void redraw() { - // TODO: Clear root children - // Warning: do not remove style and similar elements! - // while (getRoot().hasChildNodes()) { - // getRoot().removeChild(getRoot().getFirstChild()); - // } destroyVisualizations(); - // Collections.sort(layers, new VisualizationInfoComparator()); width = getRatio(); height = 1.0; - ArrayList<Visualization> layers = new ArrayList<Visualization>(visi.size()); + ArrayList<Visualization> layers = new ArrayList<Visualization>(); // TODO: center/arrange visualizations? - for(VisualizationTask task : visi) { + for(VisualizationTask task : IterableUtil.fromIterator(visi.visIterator())) { if(VisualizerUtil.isVisible(task)) { try { Visualization v = task.getFactory().makeVisualization(task.clone(this, context, visi.proj, width, height)); @@ -263,9 +257,6 @@ public class DetailView extends SVGPlot implements ResultListener { if(!(current instanceof VisualizationTask)) { return; } - if(!visi.contains(current)) { - return; - } // Get the layer final VisualizationTask task = (VisualizationTask) current; Visualization vis = layermap.get(task); diff --git a/src/de/lmu/ifi/dbs/elki/visualization/gui/overview/DetailViewSelectedEvent.java b/src/de/lmu/ifi/dbs/elki/visualization/gui/overview/DetailViewSelectedEvent.java index 0ea59547..085fc262 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/gui/overview/DetailViewSelectedEvent.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/gui/overview/DetailViewSelectedEvent.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.gui.overview; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.awt.event.ActionEvent; @@ -44,14 +45,9 @@ public class DetailViewSelectedEvent extends ActionEvent { OverviewPlot overview; /** - * X Coordinate - */ - double x; - - /** - * X Coordinate + * Plot item selected */ - double y; + PlotItem it; /** * Constructor. To be called by OverviewPlot only! @@ -60,14 +56,12 @@ public class DetailViewSelectedEvent extends ActionEvent { * @param id ID * @param command command that was invoked * @param modifiers modifiers - * @param x x click - * @param y y click + * @param it Plot item selected */ - public DetailViewSelectedEvent(OverviewPlot source, int id, String command, int modifiers, double x, double y) { + public DetailViewSelectedEvent(OverviewPlot source, int id, String command, int modifiers, PlotItem it) { super(source, id, command, modifiers); this.overview = source; - this.x = x; - this.y = y; + this.it = it; } /** @@ -76,6 +70,6 @@ public class DetailViewSelectedEvent extends ActionEvent { * @return materialized detail plot */ public DetailView makeDetailView() { - return overview.makeDetailView(x, y); + return overview.makeDetailView(it); } }
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/gui/overview/OverviewPlot.java b/src/de/lmu/ifi/dbs/elki/visualization/gui/overview/OverviewPlot.java index 6fd1f0f8..5c8b8d44 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/gui/overview/OverviewPlot.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/gui/overview/OverviewPlot.java @@ -1,32 +1,35 @@ package de.lmu.ifi.dbs.elki.visualization.gui.overview; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; -import java.util.List; +import java.util.Iterator; +import java.util.Map.Entry; import org.apache.batik.util.SVGConstants; import org.w3c.dom.Element; @@ -34,33 +37,24 @@ import org.w3c.dom.events.Event; import org.w3c.dom.events.EventListener; import org.w3c.dom.events.EventTarget; -import de.lmu.ifi.dbs.elki.data.NumberVector; -import de.lmu.ifi.dbs.elki.data.type.TypeUtil; -import de.lmu.ifi.dbs.elki.database.Database; -import de.lmu.ifi.dbs.elki.database.relation.Relation; +import de.lmu.ifi.dbs.elki.logging.Logging; import de.lmu.ifi.dbs.elki.logging.LoggingUtil; -import de.lmu.ifi.dbs.elki.math.linearalgebra.AffineTransformation; +import de.lmu.ifi.dbs.elki.result.HierarchicalResult; import de.lmu.ifi.dbs.elki.result.Result; +import de.lmu.ifi.dbs.elki.result.ResultHierarchy; import de.lmu.ifi.dbs.elki.result.ResultListener; -import de.lmu.ifi.dbs.elki.utilities.DatabaseUtil; +import de.lmu.ifi.dbs.elki.result.ResultUtil; import de.lmu.ifi.dbs.elki.utilities.pairs.Pair; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; +import de.lmu.ifi.dbs.elki.visualization.VisualizerContext; import de.lmu.ifi.dbs.elki.visualization.batikutil.CSSHoverClass; import de.lmu.ifi.dbs.elki.visualization.css.CSSClass; import de.lmu.ifi.dbs.elki.visualization.gui.detail.DetailView; -import de.lmu.ifi.dbs.elki.visualization.projections.AffineProjection; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection1D; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection2D; -import de.lmu.ifi.dbs.elki.visualization.projections.Simple1D; -import de.lmu.ifi.dbs.elki.visualization.projections.Simple2D; -import de.lmu.ifi.dbs.elki.visualization.scales.LinearScale; -import de.lmu.ifi.dbs.elki.visualization.scales.Scales; +import de.lmu.ifi.dbs.elki.visualization.projector.Projector; import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot; import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerContext; import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil; -import de.lmu.ifi.dbs.elki.visualization.visualizers.visunproj.LabelVisFactory; /** * Generate an overview plot for a set of visualizations. @@ -77,16 +71,9 @@ import de.lmu.ifi.dbs.elki.visualization.visualizers.visunproj.LabelVisFactory; */ public class OverviewPlot extends SVGPlot implements ResultListener { /** - * Maximum number of dimensions to visualize. - * - * TODO: Erich: add scrolling function for higher dimensionality! + * Our logging class */ - public static final int MAX_DIMENSIONS_DEFAULT = 10; - - /** - * Stores the maximum number of dimensions to show. - */ - private int maxdim = MAX_DIMENSIONS_DEFAULT; + private static final Logging logger = Logging.getLogger(OverviewPlot.class); /** * Visualizer context @@ -94,20 +81,14 @@ public class OverviewPlot extends SVGPlot implements ResultListener { private VisualizerContext context; /** - * Database we work on. - */ - private Database db; - - /** * Result we work on. Currently unused, but kept for future requirements. */ - @SuppressWarnings("unused") - private Result result; + private HierarchicalResult result; /** * Map of coordinates to plots. */ - protected PlotMap<NumberVector<?, ?>> plotmap; + protected RectangleArranger<PlotItem> plotmap; /** * Action listeners for this plot. @@ -117,15 +98,11 @@ public class OverviewPlot extends SVGPlot implements ResultListener { /** * Constructor. * - * @param db Database * @param result Result to visualize - * @param maxdim Maximum number of dimensions * @param context Visualizer context */ - public OverviewPlot(Database db, Result result, int maxdim, VisualizerContext context) { + public OverviewPlot(HierarchicalResult result, VisualizerContext context) { super(); - this.maxdim = maxdim; - this.db = db; this.result = result; this.context = context; // register context listener @@ -173,105 +150,49 @@ public class OverviewPlot extends SVGPlot implements ResultListener { private double ratio = 1.0; /** + * Pending refresh, for lazy refreshing + */ + Runnable pendingRefresh; + + /** + * Reinitialize on refresh + */ + private boolean reinitOnRefresh = true; + + /** * Recompute the layout of visualizations. */ private void arrangeVisualizations() { - // split the visualizers into three sets. - // FIXME: THIS IS VERY UGLY, and needs to be refactored. - // (This is a remainder of merging adapters and visualizationfactories) - List<VisualizationTask> vis = new ArrayList<VisualizationTask>(); - for(VisualizationTask task : context.iterVisualizers()) { - vis.add(task); - } - // We'll use three regions for now: - // 2D projections starting at 0,0 and going right and down. - // 1D projections starting at 0, -1 and going right - // Other projections starting at -1, min() and going down. - plotmap = new PlotMap<NumberVector<?, ?>>(); - // FIXME: ugly cast used here. - Relation<NumberVector<?, ?>> dvdb = db.getRelation(TypeUtil.DOUBLE_VECTOR_FIELD); - LinearScale[] scales = null; - scales = Scales.calcScales(dvdb); - int dmax = Math.min(DatabaseUtil.dimensionality(dvdb), maxdim); - for(int d1 = 1; d1 <= dmax; d1++) { - for(int d2 = d1 + 1; d2 <= dmax; d2++) { - Projection2D proj = new Simple2D(scales, d1, d2); - - for(VisualizationTask task : vis) { - if(task.getFactory().getProjectionType() == Projection2D.class) { - plotmap.addVis(d1 - 1, d2 - 2, 1., 1., proj, task); - } - } + plotmap = new RectangleArranger<PlotItem>(ratio); + + ArrayList<Projector> projectors = ResultUtil.filterResults(result, Projector.class); + // Rectangle layout + for(Projector p : projectors) { + Collection<PlotItem> projs = p.arrange(); + for(PlotItem it : projs) { + plotmap.put(it.w, it.h, it); } } - if(dmax >= 3) { - AffineTransformation p = AffineProjection.axisProjection(DatabaseUtil.dimensionality(dvdb), 1, 2); - p.addRotation(0, 2, Math.PI / 180 * -10.); - p.addRotation(1, 2, Math.PI / 180 * 15.); - // Wanna try 4d? go ahead: - // p.addRotation(0, 3, Math.PI / 180 * -20.); - // p.addRotation(1, 3, Math.PI / 180 * 30.); - final double sizeh = Math.ceil((dmax - 1) / 2.0); - Projection2D proj = new AffineProjection(scales, p); - for(VisualizationTask task : vis) { - if(task.getFactory().getProjectionType() == Projection2D.class) { - plotmap.addVis(Math.ceil((dmax - 1) / 2.0), 0.0, sizeh, sizeh, proj, task); - } - } - } - // insert column numbers - for(int d1 = 1; d1 <= dmax; d1++) { - VisualizationTask colvi = new VisualizationTask("", context, null, null, new LabelVisFactory(Integer.toString(d1)), null, null, this, 1, .1); - colvi.put(VisualizationTask.META_NODETAIL, true); - plotmap.addVis(d1 - 1, -.1, 1., .1, null, colvi); - } - // insert row numbers - for(int d1 = 2; d1 <= dmax; d1++) { - VisualizationTask colvi = new VisualizationTask("", context, null, null, new LabelVisFactory(Integer.toString(d1)), null, null, this, .1, 1); - colvi.put(VisualizationTask.META_NODETAIL, true); - plotmap.addVis(-.1, d1 - 2, .1, 1., null, colvi); - } - { - int dim = dmax; - for(int d1 = 1; d1 <= dim; d1++) { - Projection1D proj = new Simple1D(scales, d1); - double ypos = -.1; - for(VisualizationTask task : vis) { - if(task.getFactory().getProjectionType() == Projection1D.class) { - // TODO: 1d vis might have a different native scaling. - double height = 0.5; - plotmap.addVis(d1 - 1, ypos - height, 1.0, height, proj, task); - //ypos = ypos - height; - } + + ResultHierarchy hier = result.getHierarchy(); + ArrayList<VisualizationTask> tasks = ResultUtil.filterResults(result, VisualizationTask.class); + for(VisualizationTask task : tasks) { + boolean isprojected = false; + for(Result parent : hier.getParents(task)) { + if(parent instanceof Projector) { + isprojected = true; + break; } } - } - { - HashMap<Object, double[]> stackmap = new HashMap<Object, double[]>(); - // find starting position. - Double pos = plotmap.minmaxy.getMin(); - if(pos == null) { - pos = 0.0; - } - // FIXME: use multiple columns! - for(VisualizationTask task : vis) { - if(task.getFactory().getProjectionType() == Projection1D.class) { - continue; - } - if(task.getFactory().getProjectionType() == Projection2D.class) { - continue; - } - double[] p = null; - if(task.getVisualizationStack() != null) { - p = stackmap.get(task.getVisualizationStack()); + if(!isprojected) { + if(task.getWidth() <= 0.0 || task.getHeight() <= 0.0) { + logger.warning("Task with improper size information: " + task); } - if(p == null) { - p = new double[] { -1.1, pos }; - pos += 1.0; - stackmap.put(task.getVisualizationStack(), p); + else { + PlotItem it = new PlotItem(task.getWidth(), task.getHeight(), null); + it.visualizations.add(task); + plotmap.put(it.w, it.h, it); } - // TODO: might have different scaling preferences - plotmap.addVis(p[0], p[1], 1., 1., null, task); } } } @@ -279,7 +200,7 @@ public class OverviewPlot extends SVGPlot implements ResultListener { /** * Refresh the overview plot. */ - public void reinitialize() { + private void reinitialize() { setupHoverer(); arrangeVisualizations(); recalcViewbox(); @@ -305,32 +226,37 @@ public class OverviewPlot extends SVGPlot implements ResultListener { final int thumbsize = (int) Math.max(screenwidth / plotmap.getWidth(), screenheight / plotmap.getHeight()); // TODO: kill all children in document root except style, defs etc? - for(PlotItem it : plotmap.values()) { - boolean hasDetails = false; - Element g = this.svgElement(SVGConstants.SVG_G_TAG); - SVGUtil.setAtt(g, SVGConstants.SVG_TRANSFORM_ATTRIBUTE, "translate(" + it.x + " " + it.y + ")"); - for(VisualizationTask task : it) { - Element parent = this.svgElement(SVGConstants.SVG_G_TAG); - g.appendChild(parent); - makeThumbnail(thumbsize, it, task, parent); - vistoelem.put(new Pair<PlotItem, VisualizationTask>(it, task), parent); - - if(VisualizerUtil.detailsEnabled(task)) { - hasDetails = true; + for(Entry<PlotItem, double[]> e : plotmap.entrySet()) { + final double basex = e.getValue()[0]; + final double basey = e.getValue()[1]; + for(Iterator<PlotItem> iter = e.getKey().itemIterator(); iter.hasNext();) { + PlotItem it = iter.next(); + boolean hasDetails = false; + Element g = this.svgElement(SVGConstants.SVG_G_TAG); + SVGUtil.setAtt(g, SVGConstants.SVG_TRANSFORM_ATTRIBUTE, "translate(" + (basex + it.x) + " " + (basey + it.y) + ")"); + for(VisualizationTask task : it.visualizations) { + Element parent = this.svgElement(SVGConstants.SVG_G_TAG); + g.appendChild(parent); + makeThumbnail(thumbsize, it, task, parent); + vistoelem.put(new Pair<PlotItem, VisualizationTask>(it, task), parent); + + if(VisualizerUtil.detailsEnabled(task)) { + hasDetails = true; + } + } + plotlayer.appendChild(g); + if(hasDetails) { + Element hover = this.svgRect(basex + it.x, basey + it.y, it.w, it.h); + SVGUtil.addCSSClass(hover, selcss.getName()); + // link hoverer. + EventTarget targ = (EventTarget) hover; + targ.addEventListener(SVGConstants.SVG_MOUSEOVER_EVENT_TYPE, hoverer, false); + targ.addEventListener(SVGConstants.SVG_MOUSEOUT_EVENT_TYPE, hoverer, false); + targ.addEventListener(SVGConstants.SVG_CLICK_EVENT_TYPE, hoverer, false); + targ.addEventListener(SVGConstants.SVG_CLICK_EVENT_TYPE, new SelectPlotEvent(it), false); + + hoverlayer.appendChild(hover); } - } - plotlayer.appendChild(g); - if(hasDetails) { - Element hover = this.svgRect(it.x, it.y, it.w, it.h); - SVGUtil.addCSSClass(hover, selcss.getName()); - // link hoverer. - EventTarget targ = (EventTarget) hover; - targ.addEventListener(SVGConstants.SVG_MOUSEOVER_EVENT_TYPE, hoverer, false); - targ.addEventListener(SVGConstants.SVG_MOUSEOUT_EVENT_TYPE, hoverer, false); - targ.addEventListener(SVGConstants.SVG_CLICK_EVENT_TYPE, hoverer, false); - targ.addEventListener(SVGConstants.SVG_CLICK_EVENT_TYPE, new SelectPlotEvent(it.x, it.y), false); - - hoverlayer.appendChild(hover); } } getRoot().appendChild(plotlayer); @@ -364,38 +290,47 @@ public class OverviewPlot extends SVGPlot implements ResultListener { /** * Do a refresh (when visibilities have changed). */ - public void refresh() { - if(vistoelem == null || plotlayer == null || hoverlayer == null) { + synchronized void refresh() { + logger.debug("Refresh"); + if(vistoelem == null || plotlayer == null || hoverlayer == null || reinitOnRefresh) { reinitialize(); + reinitOnRefresh = false; } else { + boolean refreshcss = false; final int thumbsize = (int) Math.max(screenwidth / plotmap.getWidth(), screenheight / plotmap.getHeight()); - for(PlotItem it : plotmap.values()) { - for(VisualizationTask task : it) { - Element gg = vistoelem.get(new Pair<PlotItem, VisualizationTask>(it, task)); - if(gg == null) { - LoggingUtil.warning("No container element found for " + task); + for(Entry<PlotItem, double[]> ent : plotmap.entrySet()) { + PlotItem it = ent.getKey(); + for(Iterator<VisualizationTask> iter = it.visIterator(); iter.hasNext(); ) { + VisualizationTask task = iter.next(); + Element parent = vistoelem.get(new Pair<PlotItem, VisualizationTask>(it, task)); + if(parent == null) { + LoggingUtil.warning("No container element produced by " + task); continue; } if(VisualizerUtil.thumbnailEnabled(task) && VisualizerUtil.isVisible(task)) { // unhide when hidden. - if(gg.hasAttribute(SVGConstants.CSS_VISIBILITY_PROPERTY)) { - gg.removeAttribute(SVGConstants.CSS_VISIBILITY_PROPERTY); + if(parent.hasAttribute(SVGConstants.CSS_VISIBILITY_PROPERTY)) { + parent.removeAttribute(SVGConstants.CSS_VISIBILITY_PROPERTY); } // if not yet rendered, add a thumbnail - if(!gg.hasChildNodes()) { - makeThumbnail(thumbsize, it, task, gg); + if(!parent.hasChildNodes()) { + makeThumbnail(thumbsize, it, task, parent); + refreshcss = true; } } else { // hide if there is anything to hide. - if(gg != null && gg.hasChildNodes()) { - gg.setAttribute(SVGConstants.CSS_VISIBILITY_PROPERTY, SVGConstants.CSS_HIDDEN_VALUE); + if(parent != null && parent.hasChildNodes()) { + parent.setAttribute(SVGConstants.CSS_VISIBILITY_PROPERTY, SVGConstants.CSS_HIDDEN_VALUE); } // TODO: unqueue pending thumbnails } } } + if(refreshcss) { + updateStyleElement(); + } } } @@ -404,7 +339,7 @@ public class OverviewPlot extends SVGPlot implements ResultListener { */ private void recalcViewbox() { // Recalculate bounding box. - String vb = plotmap.minmaxx.getMin() + " " + plotmap.minmaxy.getMin() + " " + plotmap.getWidth() + " " + plotmap.getHeight(); + String vb = "0 0 " + plotmap.getWidth() + " " + plotmap.getHeight(); // Reset root bounding box. SVGUtil.setAtt(getRoot(), SVGConstants.SVG_WIDTH_ATTRIBUTE, "20cm"); SVGUtil.setAtt(getRoot(), SVGConstants.SVG_HEIGHT_ATTRIBUTE, (20 / plotmap.getWidth() * plotmap.getHeight()) + "cm"); @@ -432,13 +367,11 @@ public class OverviewPlot extends SVGPlot implements ResultListener { /** * Event triggered when a plot was selected. * - * @param x X coordinate - * @param y Y coordinate + * @param it Plot item selected * @return sub plot */ - public DetailView makeDetailView(double x, double y) { - PlotItem layers = plotmap.get(x, y); - return new DetailView(context, layers, ratio); + public DetailView makeDetailView(PlotItem it) { + return new DetailView(context, it, ratio); } /** @@ -453,13 +386,12 @@ public class OverviewPlot extends SVGPlot implements ResultListener { /** * When a subplot was selected, forward the event to listeners. * - * @param x X coordinate - * @param y Y coordinate + * @param it PlotItem selected */ - protected void triggerSubplotSelectEvent(double x, double y) { + protected void triggerSubplotSelectEvent(PlotItem it) { // forward event to all listeners. for(ActionListener actionListener : actionListeners) { - actionListener.actionPerformed(new DetailViewSelectedEvent(this, ActionEvent.ACTION_PERFORMED, null, 0, x, y)); + actionListener.actionPerformed(new DetailViewSelectedEvent(this, ActionEvent.ACTION_PERFORMED, null, 0, it)); } } @@ -472,30 +404,23 @@ public class OverviewPlot extends SVGPlot implements ResultListener { */ public class SelectPlotEvent implements EventListener { /** - * X coordinate of box. - */ - double x; - - /** - * Y coordinate of box. + * Plot item clicked */ - double y; + PlotItem it; /** * Constructor. * - * @param x coordinate - * @param y coordinate + * @param it Item that was clicked */ - public SelectPlotEvent(double x, double y) { + public SelectPlotEvent(PlotItem it) { super(); - this.x = x; - this.y = y; + this.it = it; } @Override public void handleEvent(@SuppressWarnings("unused") Event evt) { - triggerSubplotSelectEvent(x, y); + triggerSubplotSelectEvent(it); } } @@ -522,27 +447,43 @@ public class OverviewPlot extends SVGPlot implements ResultListener { this.ratio = ratio; } + /** + * Trigger a redraw, but avoid excessive redraws. + */ + public final void lazyRefresh() { + Runnable pr = new Runnable() { + @Override + public void run() { + if(OverviewPlot.this.pendingRefresh == this) { + OverviewPlot.this.pendingRefresh = null; + OverviewPlot.this.refresh(); + } + } + }; + pendingRefresh = pr; + scheduleUpdate(pr); + } + @SuppressWarnings("unused") @Override public void resultAdded(Result child, Result parent) { - // TODO: be lazy - if (child instanceof VisualizationTask) { - reinitialize(); + logger.debug("result added: " + child); + if(child instanceof VisualizationTask) { + reinitOnRefresh = true; } - refresh(); + lazyRefresh(); } - @SuppressWarnings("unused") @Override public void resultChanged(Result current) { - // TODO: be lazy - refresh(); + logger.debug("result changed: " + current); + lazyRefresh(); } @SuppressWarnings("unused") @Override public void resultRemoved(Result child, Result parent) { - // TODO: be lazy - refresh(); + logger.debug("result removed: " + child); + lazyRefresh(); } }
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/gui/overview/PlotItem.java b/src/de/lmu/ifi/dbs/elki/visualization/gui/overview/PlotItem.java index 3d58d10d..cd8f5b3e 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/gui/overview/PlotItem.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/gui/overview/PlotItem.java @@ -1,31 +1,36 @@ package de.lmu.ifi.dbs.elki.visualization.gui.overview; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; import java.util.LinkedList; +import java.util.List; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; import de.lmu.ifi.dbs.elki.visualization.projections.Projection; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; /** * Item to collect visualization tasks on a specific position on the plot map. @@ -36,12 +41,7 @@ import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; * * @apiviz.composedOf Projection */ -public class PlotItem extends LinkedList<VisualizationTask> { - /** - * Serial version - */ - private static final long serialVersionUID = 1L; - +public class PlotItem { /** * Position: x */ @@ -66,7 +66,28 @@ public class PlotItem extends LinkedList<VisualizationTask> { * Projection (may be {@code null}!) */ public final Projection proj; - + + /** + * The visualizations at this location + */ + public List<VisualizationTask> visualizations = new LinkedList<VisualizationTask>(); + + /** + * Subitems to plot + */ + public Collection<PlotItem> subitems = new LinkedList<PlotItem>(); + + /** + * Constructor. + * + * @param w Position: w + * @param h Position: h + * @param proj Projection + */ + public PlotItem(double w, double h, Projection proj) { + this(0, 0, w, h, proj); + } + /** * Constructor. * @@ -85,9 +106,130 @@ public class PlotItem extends LinkedList<VisualizationTask> { this.proj = proj; } - @Override - public int hashCode() { - // We can't have our hashcode change with the list contents! - return System.identityHashCode(this); + /** + * Sort all visualizers for their proper drawing order + */ + public void sort() { + Collections.sort(visualizations); + for(PlotItem subitem : subitems) { + subitem.sort(); + } + } + + /** + * Iterate (recursively) over all visualizations. + * + * @return Iterator + */ + public Iterator<VisualizationTask> visIterator() { + return new VisItr(); + } + + /** + * Iterate (recursively) over all plot items, including itself. + * + * @return Iterator + */ + public Iterator<PlotItem> itemIterator() { + return new ItmItr(); + } + + /** + * Recursive iterator + * + * @author Erich Schubert + * + * @apiviz.exclude + */ + private class VisItr implements Iterator<VisualizationTask> { + Iterator<VisualizationTask> cur; + + Iterator<PlotItem> sub; + + /** + * Constructor. + */ + public VisItr() { + super(); + this.cur = visualizations.iterator(); + this.sub = subitems.iterator(); + } + + @Override + public boolean hasNext() { + if(cur.hasNext()) { + return true; + } + if(sub.hasNext()) { + cur = sub.next().visIterator(); + return hasNext(); + } + return false; + } + + @Override + public VisualizationTask next() { + hasNext(); + return cur.next(); + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + } + + /** + * Recursive iterator + * + * @author Erich Schubert + * + * @apiviz.exclude + */ + private class ItmItr implements Iterator<PlotItem> { + PlotItem next; + + Iterator<PlotItem> cur; + + Iterator<PlotItem> sub; + + /** + * Constructor. + */ + public ItmItr() { + super(); + this.next = PlotItem.this; + this.cur = null; + this.sub = subitems.iterator(); + } + + @Override + public boolean hasNext() { + if(next != null) { + return true; + } + if (cur != null && cur.hasNext()) { + next = cur.next(); + return true; + } + if(sub.hasNext()) { + cur = sub.next().itemIterator(); + return hasNext(); + } + return false; + } + + @Override + public PlotItem next() { + hasNext(); + PlotItem ret = next; + next = null; + return ret; + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } } }
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/gui/overview/PlotMap.java b/src/de/lmu/ifi/dbs/elki/visualization/gui/overview/PlotMap.java deleted file mode 100644 index 40d67c06..00000000 --- a/src/de/lmu/ifi/dbs/elki/visualization/gui/overview/PlotMap.java +++ /dev/null @@ -1,124 +0,0 @@ -package de.lmu.ifi.dbs.elki.visualization.gui.overview; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -import java.util.HashMap; - -import de.lmu.ifi.dbs.elki.logging.LoggingUtil; -import de.lmu.ifi.dbs.elki.math.DoubleMinMax; -import de.lmu.ifi.dbs.elki.utilities.pairs.DoubleDoublePair; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; - -/** - * Manage the Overview plot canvas. - * - * @author Erich Schubert - * - * @apiviz.composedOf PlotItem - */ -class PlotMap<NV> extends HashMap<DoubleDoublePair, PlotItem> { - /** - * Serial version - */ - private static final long serialVersionUID = 1L; - - /** - * X coordinates seen - */ - DoubleMinMax minmaxx = new DoubleMinMax(); - - /** - * Y coordinates seen - */ - DoubleMinMax minmaxy = new DoubleMinMax(); - - /** - * Constructor. - */ - PlotMap() { - super(); - } - - /** - * Place a new visualization on the chart. - * - * @param x X coordinate - * @param y Y coordinate - * @param w Width - * @param h Height - * @param v Visualization - */ - void addVis(double x, double y, double w, double h, Projection proj, VisualizationTask v) { - final DoubleDoublePair pos = new DoubleDoublePair(x, y); - PlotItem l = this.get(pos); - if(l == null) { - l = new PlotItem(x, y, w, h, proj); - this.put(pos, l); - } - else { - // Sanity check - if(l.w != w || l.h != h) { - LoggingUtil.warning("Layout error - different object sizes at the same map position!"); - } - if(l.proj != proj) { - LoggingUtil.warning("Layout error - two different projections used at the same map position."); - } - } - l.add(v); - // Update min/max - minmaxx.put(x); - minmaxx.put(x + w); - minmaxy.put(y); - minmaxy.put(y + h); - } - - /** - * Get the visualization on the given coordinates. - * - * @param x First coordinate - * @param y Second coordinate - * @return Visualizations at this position. - */ - PlotItem get(double x, double y) { - return this.get(new DoubleDoublePair(x, y)); - } - - /** - * Get width in plot units - * - * @return width - */ - public double getWidth() { - return minmaxx.getMax() - minmaxx.getMin(); - } - - /** - * Get height in plot units. - * - * @return height - */ - public double getHeight() { - return minmaxy.getMax() - minmaxy.getMin(); - } -}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/gui/overview/RectangleArranger.java b/src/de/lmu/ifi/dbs/elki/visualization/gui/overview/RectangleArranger.java new file mode 100644 index 00000000..ad87c3fc --- /dev/null +++ b/src/de/lmu/ifi/dbs/elki/visualization/gui/overview/RectangleArranger.java @@ -0,0 +1,491 @@ +package de.lmu.ifi.dbs.elki.visualization.gui.overview; + +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.logging.Level; + +import de.lmu.ifi.dbs.elki.logging.Logging; + +/** + * This is a rather naive rectangle arrangement class. It will try to place + * rectangles on a canvas while maintaining the canvas size ratio as good as + * possible. It does not do an exhaustive search for optimizing the layout, but + * a greedy placement strategy, extending the canvas as little as possible. + * + * @author Erich Schubert + * + * @param <T> Key type + */ +public class RectangleArranger<T> { + /** + * Logging class + */ + private static final Logging logger = Logging.getLogger(RectangleArranger.class); + + /** + * Target height/width ratio + */ + private double ratio = 1.0; + + /** + * Width + */ + private double twidth = 1.0; + + /** + * Height + */ + private double theight = 1.0; + + /** + * Column widths + */ + private ArrayList<Double> widths = new ArrayList<Double>(); + + /** + * Column heights + */ + private ArrayList<Double> heights = new ArrayList<Double>(); + + /** + * Bit sets to store usage. ArrayList = y, BitSet = x + */ + private ArrayList<ArrayList<Object>> usage = new ArrayList<ArrayList<Object>>(); + + /** + * Data + */ + private Map<T, double[]> map = new HashMap<T, double[]>(); + + /** + * Constructor. + * + * @param ratio + */ + public RectangleArranger(double ratio) { + this(ratio, 1.0); + } + + /** + * Constructor. + * + * @param width Canvas width + * @param height Canvas height + */ + public RectangleArranger(double width, double height) { + this.ratio = width / height; + this.twidth = width; + this.theight = height; + this.widths.add(width); + this.heights.add(height); + // setup usage matrix + ArrayList<Object> u = new ArrayList<Object>(); + u.add(null); + this.usage.add(u); + assertConsistent(); + } + + /** + * Add a new recangle. + * + * @param w Width + * @param h Height + * @param data Data object to add (key) + */ + public void put(double w, double h, T data) { + logger.finest("Add: " + w + "x" + h); + final int cols = widths.size(); + final int rows = heights.size(); + + int bestsx = -1; + int bestsy = -1; + int bestex = cols - 1; + int bestey = -1; + double bestwi; + double besthi; + double bestinc; + // Baseline: grow by adding to the top or to the right. + { + double i1 = computeIncreaseArea(w, Math.max(0, h - theight)); + double i2 = computeIncreaseArea(Math.max(0, w - twidth), h); + if(i1 < i2) { + bestwi = w; + besthi = Math.max(0, h - theight); + bestinc = i1; + } + else { + bestwi = Math.max(0, w - twidth); + besthi = h; + bestinc = i2; + } + } + // Find position with minimum increase + for(int sy = 0; sy < rows; sy++) { + for(int sx = 0; sx < cols; sx++) { + if(usage.get(sy).get(sx) != null) { + continue; + } + // Start with single cell + double avw = widths.get(sx); + double avh = heights.get(sy); + int ex = sx; + int ey = sy; + while(avw < w || avh < h) { + // Grow width first + if(avw / avh < w / h) { + if(avw < w && ex + 1 < cols) { + boolean ok = true; + // All unused? + for(int y = sy; y <= ey; y++) { + if(usage.get(y).get(ex + 1) != null) { + ok = false; + } + } + if(ok) { + ex += 1; + avw += widths.get(ex); + continue; + } + } + if(avh < h && ey + 1 < rows) { + boolean ok = true; + // All unused? + for(int x = sx; x <= ex; x++) { + if(usage.get(ey + 1).get(x) != null) { + ok = false; + } + } + if(ok) { + ey += 1; + avh += heights.get(ey); + continue; + } + } + } + else { // Grow height first + if(avh < h && ey + 1 < rows) { + boolean ok = true; + // All unused? + for(int x = sx; x <= ex; x++) { + if(usage.get(ey + 1).get(x) != null) { + ok = false; + } + } + if(ok) { + ey += 1; + avh += heights.get(ey); + continue; + } + } + if(avw < w && ex + 1 < cols) { + boolean ok = true; + // All unused? + for(int y = sy; y <= ey; y++) { + if(usage.get(y).get(ex + 1) != null) { + ok = false; + } + } + if(ok) { + ex += 1; + avw += widths.get(ex); + continue; + } + } + } + break; + } + // Good match, or extension possible? + if(avw < w && ex < cols - 1) { + continue; + } + if(avh < h && ey < rows - 1) { + continue; + } + // Compute increase: + double winc = Math.max(0.0, w - avw); + double hinc = Math.max(0.0, h - avh); + double inc = computeIncreaseArea(winc, hinc); + + logger.debugFinest("Candidate: " + sx + "," + sy + " - " + ex + "," + ey + ": " + avw + "x" + avh + " " + inc); + if(inc < bestinc) { + bestinc = inc; + bestsx = sx; + bestsy = sy; + bestex = ex; + bestey = ey; + bestwi = w - avw; + besthi = h - avh; + } + if(inc == 0) { + // Can't find better + // TODO: try to do less splitting maybe? + break; + } + } + assert assertConsistent(); + } + logger.debugFinest("Best: " + bestsx + "," + bestsy + " - " + bestex + "," + bestey + " inc: " + bestwi + "x" + besthi + " " + bestinc); + // Need to split a column. + // TODO: find best column to split. Currently: last + if(bestwi < 0) { + splitCol(bestex, -bestwi); + bestwi = 0.0; + } + // Need to split a row. + // TODO: find best row to split. Currently: last + if(besthi < 0) { + splitRow(bestey, -besthi); + besthi = 0.0; + } + // Need to increase the total area + if(bestinc > 0) { + assert (bestex == cols - 1 || bestey == rows - 1); + double inc = Math.max(bestwi, besthi * ratio); + resize(inc); + + // Resubmit + put(w, h, data); + return; + } + for(int x = bestsx; x <= bestex; x++) { + for(int y = bestsy; y <= bestey; y++) { + usage.get(y).set(x, data); + } + } + double xpos = 0.0; + double ypos = 0.0; + { + for(int x = 0; x < bestsx; x++) { + xpos += widths.get(x); + } + for(int y = 0; y < bestsy; y++) { + ypos += heights.get(y); + } + } + map.put(data, new double[] { xpos, ypos, w, h }); + if(logger.isDebuggingFinest()) { + logSizes(); + } + } + + protected double computeIncreaseArea(double winc, double hinc) { + double inc = Math.max(winc, hinc * ratio); + inc = inc * (hinc + inc / ratio + winc / ratio); + return inc; + } + + protected void splitRow(int bestey, double besthi) { + logger.debugFine("Split row " + bestey); + heights.add(bestey + 1, besthi); + heights.set(bestey, heights.get(bestey) - besthi); + // Update used map + usage.add(bestey + 1, new ArrayList<Object>(usage.get(bestey))); + } + + protected void splitCol(int bestex, double bestwi) { + final int rows = heights.size(); + logger.debugFine("Split column " + bestex); + widths.add(bestex + 1, bestwi); + widths.set(bestex, widths.get(bestex) - bestwi); + // Update used map + for(int y = 0; y < rows; y++) { + usage.get(y).add(bestex + 1, usage.get(y).get(bestex)); + } + assert assertConsistent(); + } + + private void resize(double inc) { + final int cols = widths.size(); + final int rows = heights.size(); + logger.debugFine("Resize by " + inc + "x" + (inc / ratio)); + if(logger.isDebuggingFinest()) { + logSizes(); + } + // TODO: if the last row or column is empty, we can do this simpler + widths.add(inc); + twidth += inc; + heights.add(inc / ratio); + theight += inc / ratio; + // Add column: + for(int y = 0; y < rows; y++) { + usage.get(y).add(null); + } + // Add row: + { + ArrayList<Object> row = new ArrayList<Object>(); + for(int x = 0; x <= cols; x++) { + row.add(null); + } + usage.add(row); + } + assert assertConsistent(); + if(logger.isDebuggingFinest()) { + logSizes(); + } + } + + /** + * Get the position data of the object + * + * @param object Query object + * @return Position information: x,y,w,h + */ + public double[] get(T object) { + double[] v = map.get(object); + if(v == null) { + return null; + } + return v.clone(); + } + + private boolean assertConsistent() { + final int cols = widths.size(); + final int rows = heights.size(); + { + double wsum = 0.0; + for(int x = 0; x < cols; x++) { + assert (widths.get(x) > 0); + wsum += widths.get(x); + } + assert (Math.abs(wsum - twidth) < 1E-10); + } + { + double hsum = 0.0; + for(int y = 0; y < rows; y++) { + assert (heights.get(y) > 0); + hsum += heights.get(y); + } + assert (Math.abs(hsum - theight) < 1E-10); + } + { + assert (usage.size() == rows); + for(int y = 0; y < rows; y++) { + assert (usage.get(y).size() == cols); + } + } + return true; + } + + public void logSizes() { + StringBuffer buf = new StringBuffer(); + final int cols = widths.size(); + final int rows = heights.size(); + { + buf.append("Widths: "); + for(int x = 0; x < cols; x++) { + if(x > 0) { + buf.append(", "); + } + buf.append(widths.get(x)); + } + buf.append("\n"); + } + { + buf.append("Heights: "); + for(int y = 0; y < rows; y++) { + if(y > 0) { + buf.append(", "); + } + buf.append(heights.get(y)); + } + buf.append("\n"); + } + { + for(int y = 0; y < rows; y++) { + for(int x = 0; x < cols; x++) { + buf.append(usage.get(y).get(x) != null ? "X" : "_"); + } + buf.append("|\n"); + } + for(int x = 0; x < cols; x++) { + buf.append("-"); + } + buf.append("+\n"); + } + logger.debug(buf); + } + + /** + * Get the total canvas width + * + * @return Width + */ + public double getWidth() { + return twidth; + } + + /** + * Get the total canvas height + * + * @return Height + */ + public double getHeight() { + return theight; + } + + /** + * The items contained in the map. + * + * @return entry set + */ + public Set<Entry<T, double[]>> entrySet() { + return Collections.unmodifiableSet(map.entrySet()); + } + + /** + * Test method. + * + * @param args + */ + public static void main(String[] args) { + logger.getWrappedLogger().setLevel(Level.FINEST); + RectangleArranger<String> r = new RectangleArranger<String>(1.3); + r.put(4., 1., "Histogram"); + r.put(4., 4., "3D view"); + r.put(1., 1., "Meta 1"); + r.put(1., 1., "Meta 2"); + r.put(1., 1., "Meta 3"); + r.put(2., 2., "Meta 4"); + r.put(2., 2., "Meta 5"); + + r = new RectangleArranger<String>(3., 3.); + r.put(1., 2., "A"); + r.put(2., 1., "B"); + r.put(1., 2., "C"); + r.put(2., 1., "D"); + r.put(2., 2., "E"); + + r = new RectangleArranger<String>(4 - 2.6521739130434785); + r.put(4., .5, "A"); + r.put(4., 3., "B"); + r.put(4., 1., "C"); + r.put(1., .1, "D"); + } +} diff --git a/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSColorAdapter.java b/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSColorAdapter.java index e9f6abc9..5fdad225 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSColorAdapter.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSColorAdapter.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.opticsplot; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import de.lmu.ifi.dbs.elki.result.optics.ClusterOrderEntry; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSColorFromClustering.java b/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSColorFromClustering.java index 511d25e3..c69dabd0 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSColorFromClustering.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSColorFromClustering.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.opticsplot; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.awt.Color; import java.util.HashMap; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSColorStatic.java b/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSColorStatic.java index 0371edfd..359d3062 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSColorStatic.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSColorStatic.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.opticsplot; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import de.lmu.ifi.dbs.elki.result.optics.ClusterOrderEntry; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSCorrelationDimensionalityDistance.java b/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSCorrelationDimensionalityDistance.java index 230b3779..3e8835b1 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSCorrelationDimensionalityDistance.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSCorrelationDimensionalityDistance.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.opticsplot; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import de.lmu.ifi.dbs.elki.distance.distancevalue.CorrelationDistance; import de.lmu.ifi.dbs.elki.result.optics.ClusterOrderEntry; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSCut.java b/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSCut.java index c4297fca..41563087 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSCut.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSCut.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.opticsplot; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.List; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSDistanceAdapter.java b/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSDistanceAdapter.java index 3256050d..3f36209a 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSDistanceAdapter.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSDistanceAdapter.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.opticsplot; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import de.lmu.ifi.dbs.elki.distance.distancevalue.Distance; import de.lmu.ifi.dbs.elki.result.optics.ClusterOrderEntry; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSNumberDistance.java b/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSNumberDistance.java index 06d96ae0..f0b49585 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSNumberDistance.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSNumberDistance.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.opticsplot; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import de.lmu.ifi.dbs.elki.distance.distancevalue.NumberDistance; import de.lmu.ifi.dbs.elki.result.optics.ClusterOrderEntry; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSPlot.java b/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSPlot.java index d01c09ec..7520d2a7 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSPlot.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/opticsplot/OPTICSPlot.java @@ -1,32 +1,32 @@ package de.lmu.ifi.dbs.elki.visualization.opticsplot; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.awt.image.BufferedImage; import java.awt.image.RenderedImage; import java.io.File; import java.io.IOException; -import java.util.ArrayList; import java.util.List; import javax.imageio.ImageIO; @@ -38,13 +38,12 @@ import de.lmu.ifi.dbs.elki.distance.distancevalue.NumberDistance; import de.lmu.ifi.dbs.elki.logging.Logging; import de.lmu.ifi.dbs.elki.math.DoubleMinMax; import de.lmu.ifi.dbs.elki.result.Result; -import de.lmu.ifi.dbs.elki.result.ResultUtil; import de.lmu.ifi.dbs.elki.result.optics.ClusterOrderEntry; import de.lmu.ifi.dbs.elki.result.optics.ClusterOrderResult; +import de.lmu.ifi.dbs.elki.visualization.VisualizerContext; import de.lmu.ifi.dbs.elki.visualization.colors.ColorLibrary; import de.lmu.ifi.dbs.elki.visualization.scales.LinearScale; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerContext; /** * Class to produce an OPTICS plot image. @@ -349,10 +348,10 @@ public class OPTICSPlot<D extends Distance<D>> implements Result { */ public static <D extends Distance<D>> OPTICSPlot<D> plotForClusterOrder(ClusterOrderResult<D> co, VisualizerContext context) { // Check for an existing plot - ArrayList<OPTICSPlot<D>> plots = ResultUtil.filterResults(co, OPTICSPlot.class); - if (plots.size() > 0) { - return plots.get(0); - } + // ArrayList<OPTICSPlot<D>> plots = ResultUtil.filterResults(co, OPTICSPlot.class); + // if (plots.size() > 0) { + // return plots.get(0); + // } // Supported by this class? if (!OPTICSPlot.canPlot(co)) { return null; @@ -362,7 +361,7 @@ public class OPTICSPlot<D extends Distance<D>> implements Result { final OPTICSColorAdapter opcolor = new OPTICSColorFromClustering(colors, refc); OPTICSPlot<D> opticsplot = new OPTICSPlot<D>(co, opcolor); - co.addChildResult(opticsplot); + // co.addChildResult(opticsplot); return opticsplot; } diff --git a/src/de/lmu/ifi/dbs/elki/visualization/projections/AbstractProjection.java b/src/de/lmu/ifi/dbs/elki/visualization/projections/AbstractProjection.java index 196b7bca..fcd7191c 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/projections/AbstractProjection.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/projections/AbstractProjection.java @@ -1,29 +1,31 @@ package de.lmu.ifi.dbs.elki.visualization.projections; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import de.lmu.ifi.dbs.elki.data.NumberVector; import de.lmu.ifi.dbs.elki.math.linearalgebra.Vector; +import de.lmu.ifi.dbs.elki.result.AbstractHierarchicalResult; import de.lmu.ifi.dbs.elki.visualization.scales.LinearScale; /** @@ -31,7 +33,7 @@ import de.lmu.ifi.dbs.elki.visualization.scales.LinearScale; * * @author Erich Schubert */ -public abstract class AbstractProjection implements Projection { +public abstract class AbstractProjection extends AbstractHierarchicalResult implements Projection { /** * Scales in data set */ @@ -46,6 +48,11 @@ public abstract class AbstractProjection implements Projection { super(); this.scales = scales; } + + @Override + public int getInputDimensionality() { + return scales.length; + } /** * Get the scales used, for rendering scales mostly. @@ -249,4 +256,14 @@ public abstract class AbstractProjection implements Projection { } return prototype.newInstance(vec); } + + @Override + public String getLongName() { + return "Projection"; + } + + @Override + public String getShortName() { + return "projection"; + } }
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/projections/AbstractSimpleProjection.java b/src/de/lmu/ifi/dbs/elki/visualization/projections/AbstractSimpleProjection.java index c6fdfc62..778e0bbb 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/projections/AbstractSimpleProjection.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/projections/AbstractSimpleProjection.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.projections; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import de.lmu.ifi.dbs.elki.math.linearalgebra.Vector; import de.lmu.ifi.dbs.elki.visualization.scales.LinearScale; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/projections/AffineProjection.java b/src/de/lmu/ifi/dbs/elki/visualization/projections/AffineProjection.java index 4e6254e8..a139cdc1 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/projections/AffineProjection.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/projections/AffineProjection.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.projections; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.BitSet; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/projections/Projection.java b/src/de/lmu/ifi/dbs/elki/visualization/projections/Projection.java index 6f8f9b4f..fcd6089d 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/projections/Projection.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/projections/Projection.java @@ -1,29 +1,31 @@ package de.lmu.ifi.dbs.elki.visualization.projections; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import de.lmu.ifi.dbs.elki.data.NumberVector; import de.lmu.ifi.dbs.elki.math.linearalgebra.Vector; +import de.lmu.ifi.dbs.elki.result.HierarchicalResult; import de.lmu.ifi.dbs.elki.visualization.scales.LinearScale; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; @@ -41,12 +43,19 @@ import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; * @apiviz.uses NumberVector * @apiviz.uses Vector */ -public interface Projection { +public interface Projection extends HierarchicalResult { /** * Scaling constant. Keep in sync with * {@link de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary#SCALE}. */ public static final double SCALE = StyleLibrary.SCALE; + + /** + * Get the input dimensionality of the projection. + * + * @return Input dimensionality + */ + public int getInputDimensionality(); /** * Get the scale class for a particular dimension. diff --git a/src/de/lmu/ifi/dbs/elki/visualization/projections/Projection1D.java b/src/de/lmu/ifi/dbs/elki/visualization/projections/Projection1D.java index 7e60d3c7..746b3b68 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/projections/Projection1D.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/projections/Projection1D.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.projections; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import de.lmu.ifi.dbs.elki.data.NumberVector; import de.lmu.ifi.dbs.elki.math.linearalgebra.Vector; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/projections/Projection2D.java b/src/de/lmu/ifi/dbs/elki/visualization/projections/Projection2D.java index 7f6fe244..9fcb0b15 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/projections/Projection2D.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/projections/Projection2D.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.projections; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.BitSet; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/projections/Simple1D.java b/src/de/lmu/ifi/dbs/elki/visualization/projections/Simple1D.java index d89ae5ad..e208b34b 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/projections/Simple1D.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/projections/Simple1D.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.projections; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import de.lmu.ifi.dbs.elki.data.NumberVector; import de.lmu.ifi.dbs.elki.math.linearalgebra.Vector; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/projections/Simple2D.java b/src/de/lmu/ifi/dbs/elki/visualization/projections/Simple2D.java index 8661c594..15108853 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/projections/Simple2D.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/projections/Simple2D.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.projections; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.BitSet; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/projector/HistogramFactory.java b/src/de/lmu/ifi/dbs/elki/visualization/projector/HistogramFactory.java new file mode 100644 index 00000000..06e94891 --- /dev/null +++ b/src/de/lmu/ifi/dbs/elki/visualization/projector/HistogramFactory.java @@ -0,0 +1,103 @@ +package de.lmu.ifi.dbs.elki.visualization.projector; + +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +import de.lmu.ifi.dbs.elki.data.NumberVector; +import de.lmu.ifi.dbs.elki.data.type.TypeUtil; +import de.lmu.ifi.dbs.elki.database.Database; +import de.lmu.ifi.dbs.elki.database.relation.Relation; +import de.lmu.ifi.dbs.elki.result.HierarchicalResult; +import de.lmu.ifi.dbs.elki.result.Result; +import de.lmu.ifi.dbs.elki.result.ResultUtil; +import de.lmu.ifi.dbs.elki.utilities.DatabaseUtil; +import de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizer; +import de.lmu.ifi.dbs.elki.utilities.optionhandling.constraints.GreaterEqualConstraint; +import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; +import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.IntParameter; + +/** + * Produce one-dimensional projections. + * + * @author Erich Schubert + */ +// TODO: re-add maxdim option +public class HistogramFactory implements ProjectorFactory { + /** + * Maximum dimensionality + */ + private int maxdim = ScatterPlotFactory.MAX_DIMENSIONS_DEFAULT; + + /** + * Constructor. + * @param maxdim Maximum dimensionality + */ + public HistogramFactory(int maxdim) { + super(); + this.maxdim = maxdim; + } + + @Override + public void processNewResult(HierarchicalResult baseResult, Result newResult) { + Database db = ResultUtil.findDatabase(newResult); + if(db != null) { + for(Relation<?> rel : db.getRelations()) { + if(TypeUtil.NUMBER_VECTOR_FIELD.isAssignableFromType(rel.getDataTypeInformation())) { + @SuppressWarnings("unchecked") + Relation<NumberVector<?, ?>> vrel = (Relation<NumberVector<?, ?>>) rel; + final int dim = DatabaseUtil.dimensionality(vrel); + HistogramProjector<NumberVector<?, ?>> proj = new HistogramProjector<NumberVector<?, ?>>(vrel, Math.min(dim, maxdim)); + baseResult.getHierarchy().add(vrel, proj); + } + } + } + } + + /** + * Parameterization class. + * + * @author Erich Schubert + * + * @apiviz.exclude + */ + public static class Parameterizer extends AbstractParameterizer { + /** + * Stores the maximum number of dimensions to show. + */ + private int maxdim = ScatterPlotFactory.MAX_DIMENSIONS_DEFAULT; + + @Override + protected void makeOptions(Parameterization config) { + super.makeOptions(config); + IntParameter maxdimP = new IntParameter(ScatterPlotFactory.Parameterizer.MAXDIM_ID, new GreaterEqualConstraint(1), ScatterPlotFactory.MAX_DIMENSIONS_DEFAULT); + if(config.grab(maxdimP)) { + maxdim = maxdimP.getValue(); + } + } + + @Override + protected HistogramFactory makeInstance() { + return new HistogramFactory(maxdim); + } + } +}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/projector/HistogramProjector.java b/src/de/lmu/ifi/dbs/elki/visualization/projector/HistogramProjector.java new file mode 100644 index 00000000..5ddc7b32 --- /dev/null +++ b/src/de/lmu/ifi/dbs/elki/visualization/projector/HistogramProjector.java @@ -0,0 +1,125 @@ +package de.lmu.ifi.dbs.elki.visualization.projector; + +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import de.lmu.ifi.dbs.elki.data.NumberVector; +import de.lmu.ifi.dbs.elki.database.relation.Relation; +import de.lmu.ifi.dbs.elki.result.AbstractHierarchicalResult; +import de.lmu.ifi.dbs.elki.result.ResultUtil; +import de.lmu.ifi.dbs.elki.utilities.DatabaseUtil; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; +import de.lmu.ifi.dbs.elki.visualization.gui.overview.PlotItem; +import de.lmu.ifi.dbs.elki.visualization.projections.Projection1D; +import de.lmu.ifi.dbs.elki.visualization.projections.Simple1D; +import de.lmu.ifi.dbs.elki.visualization.scales.LinearScale; +import de.lmu.ifi.dbs.elki.visualization.scales.Scales; +import de.lmu.ifi.dbs.elki.visualization.visualizers.visunproj.LabelVisFactory; + +/** + * ScatterPlotProjector is responsible for producing a set of scatterplot + * visualizations. + * + * @author Erich Schubert + * + * @param <V> Vector type + */ +public class HistogramProjector<V extends NumberVector<?, ?>> extends AbstractHierarchicalResult implements Projector { + /** + * Relation we project + */ + Relation<V> rel; + + /** + * Database dimensionality + */ + int dmax; + + /** + * Axis scales + */ + LinearScale[] scales; + + /** + * Constructor. + * + * @param rel Relation + * @param maxdim Maximum dimension to use + */ + public HistogramProjector(Relation<V> rel, int maxdim) { + super(); + this.rel = rel; + this.dmax = maxdim; + this.scales = Scales.calcScales(rel); + assert (maxdim <= DatabaseUtil.dimensionality(rel)) : "Requested dimensionality larger than data dimensionality?!?"; + } + + @Override + public Collection<PlotItem> arrange() { + List<PlotItem> layout = new ArrayList<PlotItem>(1); + List<VisualizationTask> tasks = ResultUtil.filterResults(this, VisualizationTask.class); + if (tasks.size() > 0){ + PlotItem master = new PlotItem(dmax + .1, .5 + .1, null); + for(int d1 = 1; d1 <= dmax; d1++) { + Projection1D proj = new Simple1D(scales, d1); + final PlotItem it = new PlotItem(d1 - 1 + .1, 0. + .1, 1., .5, proj); + it.visualizations = tasks; + master.subitems.add(it); + } + layout.add(master); + for(int d1 = 1; d1 <= dmax; d1++) { + PlotItem it = new PlotItem(d1 - 1 + .1, 0, 1., .1, null); + final VisualizationTask task = new VisualizationTask("", null, null, new LabelVisFactory(DatabaseUtil.getColumnLabel(rel, d1))); + task.height = .1; + task.width = 1; + task.put(VisualizationTask.META_NODETAIL, true); + it.visualizations.add(task); + master.subitems.add(it); + } + } + return layout; + } + + @Override + public String getLongName() { + return "Axis plot"; + } + + @Override + public String getShortName() { + return "axisplot"; + } + + /** + * Get the relation we project. + * + * @return Relation + */ + public Relation<V> getRelation() { + return rel; + } +}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/projector/OPTICSProjector.java b/src/de/lmu/ifi/dbs/elki/visualization/projector/OPTICSProjector.java new file mode 100644 index 00000000..21b9c227 --- /dev/null +++ b/src/de/lmu/ifi/dbs/elki/visualization/projector/OPTICSProjector.java @@ -0,0 +1,108 @@ +package de.lmu.ifi.dbs.elki.visualization.projector; + +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import de.lmu.ifi.dbs.elki.distance.distancevalue.Distance; +import de.lmu.ifi.dbs.elki.result.AbstractHierarchicalResult; +import de.lmu.ifi.dbs.elki.result.ResultUtil; +import de.lmu.ifi.dbs.elki.result.optics.ClusterOrderResult; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; +import de.lmu.ifi.dbs.elki.visualization.VisualizerContext; +import de.lmu.ifi.dbs.elki.visualization.gui.overview.PlotItem; +import de.lmu.ifi.dbs.elki.visualization.opticsplot.OPTICSPlot; + +/** + * Projection for OPTICS plots. + * + * @author Erich Schubert + */ +public class OPTICSProjector<D extends Distance<D>> extends AbstractHierarchicalResult implements Projector { + /** + * Cluster order result + */ + private ClusterOrderResult<D> clusterOrder; + + /** + * OPTICS plot image + */ + private OPTICSPlot<D> plot = null; + + /** + * Constructor. + * + * @param co Cluster order + */ + public OPTICSProjector(ClusterOrderResult<D> co) { + super(); + this.clusterOrder = co; + } + + @Override + public String getLongName() { + return "OPTICS projection"; + } + + @Override + public String getShortName() { + return "optics"; + } + + @Override + public Collection<PlotItem> arrange() { + List<PlotItem> col = new ArrayList<PlotItem>(1); + List<VisualizationTask> tasks = ResultUtil.filterResults(this, VisualizationTask.class); + if (tasks.size() > 0) { + final PlotItem it = new PlotItem(4., 1., null); + it.visualizations = tasks; + col.add(it); + } + return col; + } + + /** + * Get the cluster order + * + * @return the cluster order + */ + public ClusterOrderResult<D> getResult() { + return clusterOrder; + } + + /** + * Get or produce the actual OPTICS plot. + * + * @param context Context to use + * @return Plot + */ + public OPTICSPlot<D> getOPTICSPlot(VisualizerContext context) { + if(plot == null) { + plot = OPTICSPlot.plotForClusterOrder(clusterOrder, context); + } + return plot; + } +}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/projector/OPTICSProjectorFactory.java b/src/de/lmu/ifi/dbs/elki/visualization/projector/OPTICSProjectorFactory.java new file mode 100644 index 00000000..580eb532 --- /dev/null +++ b/src/de/lmu/ifi/dbs/elki/visualization/projector/OPTICSProjectorFactory.java @@ -0,0 +1,59 @@ +package de.lmu.ifi.dbs.elki.visualization.projector; + +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +import java.util.Collection; + +import de.lmu.ifi.dbs.elki.distance.distancevalue.DoubleDistance; +import de.lmu.ifi.dbs.elki.result.HierarchicalResult; +import de.lmu.ifi.dbs.elki.result.Result; +import de.lmu.ifi.dbs.elki.result.ResultUtil; +import de.lmu.ifi.dbs.elki.result.optics.ClusterOrderResult; +import de.lmu.ifi.dbs.elki.visualization.opticsplot.OPTICSPlot; + +/** + * Produce OPTICS plot projections + * + * @author Erich Schubert + */ +public class OPTICSProjectorFactory implements ProjectorFactory { + /** + * Constructor. + */ + public OPTICSProjectorFactory() { + super(); + } + + @Override + public void processNewResult(HierarchicalResult baseResult, Result newResult) { + Collection<ClusterOrderResult<?>> cos = ResultUtil.filterResults(newResult, ClusterOrderResult.class); + for(ClusterOrderResult<?> co : cos) { + if(OPTICSPlot.canPlot(co)) { + @SuppressWarnings("unchecked") + OPTICSProjector<?> proj = new OPTICSProjector<DoubleDistance>((ClusterOrderResult<DoubleDistance>) co); + baseResult.getHierarchy().add(co, proj); + } + } + } +} diff --git a/src/de/lmu/ifi/dbs/elki/visualization/projector/Projector.java b/src/de/lmu/ifi/dbs/elki/visualization/projector/Projector.java new file mode 100644 index 00000000..646adda5 --- /dev/null +++ b/src/de/lmu/ifi/dbs/elki/visualization/projector/Projector.java @@ -0,0 +1,43 @@ +package de.lmu.ifi.dbs.elki.visualization.projector; + +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +import java.util.Collection; + +import de.lmu.ifi.dbs.elki.result.HierarchicalResult; +import de.lmu.ifi.dbs.elki.visualization.gui.overview.PlotItem; + +/** + * A projector is responsible for adding projections to the visualization. + * + * @author Erich Schubert + */ +public interface Projector extends HierarchicalResult { + /** + * Produce an arrangement of projections. + * + * @return Arrangement. + */ + public Collection<PlotItem> arrange(); +}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/projector/ProjectorFactory.java b/src/de/lmu/ifi/dbs/elki/visualization/projector/ProjectorFactory.java new file mode 100644 index 00000000..d0996822 --- /dev/null +++ b/src/de/lmu/ifi/dbs/elki/visualization/projector/ProjectorFactory.java @@ -0,0 +1,46 @@ +package de.lmu.ifi.dbs.elki.visualization.projector; + +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +import de.lmu.ifi.dbs.elki.result.HierarchicalResult; +import de.lmu.ifi.dbs.elki.result.Result; +import de.lmu.ifi.dbs.elki.result.ResultProcessor; +import de.lmu.ifi.dbs.elki.utilities.optionhandling.Parameterizable; + +/** + * A projector is responsible for adding projections to the visualization by + * detecting appropriate relations in the database. + * + * @author Erich Schubert + */ +public interface ProjectorFactory extends ResultProcessor, Parameterizable { + /** + * Add projections for the given result (tree) to the result tree. + * + * @param baseResult Context to work with + * @param newResult Result to process + */ + @Override + public void processNewResult(HierarchicalResult baseResult, Result newResult); +}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/projector/ScatterPlotFactory.java b/src/de/lmu/ifi/dbs/elki/visualization/projector/ScatterPlotFactory.java new file mode 100644 index 00000000..3d996bdc --- /dev/null +++ b/src/de/lmu/ifi/dbs/elki/visualization/projector/ScatterPlotFactory.java @@ -0,0 +1,121 @@ +package de.lmu.ifi.dbs.elki.visualization.projector; + +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +import de.lmu.ifi.dbs.elki.data.NumberVector; +import de.lmu.ifi.dbs.elki.data.type.TypeUtil; +import de.lmu.ifi.dbs.elki.database.Database; +import de.lmu.ifi.dbs.elki.database.relation.Relation; +import de.lmu.ifi.dbs.elki.result.HierarchicalResult; +import de.lmu.ifi.dbs.elki.result.Result; +import de.lmu.ifi.dbs.elki.result.ResultUtil; +import de.lmu.ifi.dbs.elki.utilities.DatabaseUtil; +import de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizer; +import de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionID; +import de.lmu.ifi.dbs.elki.utilities.optionhandling.constraints.GreaterEqualConstraint; +import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; +import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.IntParameter; + +/** + * Produce scatterplot projections. + * + * @author Erich Schubert + */ +// TODO: re-add maxdim option +public class ScatterPlotFactory implements ProjectorFactory { + /** + * Maximum number of dimensions to visualize. + * + * TODO: Erich: add scrolling function for higher dimensionality! + */ + public static final int MAX_DIMENSIONS_DEFAULT = 10; + + /** + * Stores the maximum number of dimensions to show. + */ + private int maxdim = MAX_DIMENSIONS_DEFAULT; + + /** + * Constructor. + * + * @param maxdim Maximum number of dimensions to show. + */ + public ScatterPlotFactory(int maxdim) { + super(); + this.maxdim = maxdim; + } + + @Override + public void processNewResult(HierarchicalResult baseResult, Result newResult) { + Database db = ResultUtil.findDatabase(newResult); + if(db != null) { + for(Relation<?> rel : db.getRelations()) { + if(TypeUtil.NUMBER_VECTOR_FIELD.isAssignableFromType(rel.getDataTypeInformation())) { + @SuppressWarnings("unchecked") + Relation<NumberVector<?, ?>> vrel = (Relation<NumberVector<?, ?>>) rel; + final int dim = DatabaseUtil.dimensionality(vrel); + ScatterPlotProjector<NumberVector<?, ?>> proj = new ScatterPlotProjector<NumberVector<?, ?>>(vrel, Math.min(maxdim, dim)); + baseResult.getHierarchy().add(vrel, proj); + } + } + } + } + + /** + * Parameterization class. + * + * @author Erich Schubert + * + * @apiviz.exclude + */ + public static class Parameterizer extends AbstractParameterizer { + /** + * Parameter for the maximum number of dimensions, + * + * <p> + * Code: -vis.maxdim + * </p> + */ + public static final OptionID MAXDIM_ID = OptionID.getOrCreateOptionID("vis.maxdim", "Maximum number of dimensions to display."); + + /** + * Stores the maximum number of dimensions to show. + */ + private int maxdim = MAX_DIMENSIONS_DEFAULT; + + @Override + protected void makeOptions(Parameterization config) { + super.makeOptions(config); + IntParameter maxdimP = new IntParameter(MAXDIM_ID, new GreaterEqualConstraint(1), MAX_DIMENSIONS_DEFAULT); + if(config.grab(maxdimP)) { + maxdim = maxdimP.getValue(); + } + } + + @Override + protected Object makeInstance() { + return new ScatterPlotFactory(maxdim); + } + } +}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/projector/ScatterPlotProjector.java b/src/de/lmu/ifi/dbs/elki/visualization/projector/ScatterPlotProjector.java new file mode 100644 index 00000000..ee692531 --- /dev/null +++ b/src/de/lmu/ifi/dbs/elki/visualization/projector/ScatterPlotProjector.java @@ -0,0 +1,189 @@ +package de.lmu.ifi.dbs.elki.visualization.projector; + +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import de.lmu.ifi.dbs.elki.data.NumberVector; +import de.lmu.ifi.dbs.elki.database.relation.Relation; +import de.lmu.ifi.dbs.elki.math.linearalgebra.AffineTransformation; +import de.lmu.ifi.dbs.elki.result.AbstractHierarchicalResult; +import de.lmu.ifi.dbs.elki.result.ResultUtil; +import de.lmu.ifi.dbs.elki.utilities.DatabaseUtil; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; +import de.lmu.ifi.dbs.elki.visualization.gui.overview.PlotItem; +import de.lmu.ifi.dbs.elki.visualization.projections.AffineProjection; +import de.lmu.ifi.dbs.elki.visualization.projections.Projection2D; +import de.lmu.ifi.dbs.elki.visualization.projections.Simple2D; +import de.lmu.ifi.dbs.elki.visualization.scales.LinearScale; +import de.lmu.ifi.dbs.elki.visualization.scales.Scales; +import de.lmu.ifi.dbs.elki.visualization.visualizers.visunproj.LabelVisFactory; + +/** + * ScatterPlotProjector is responsible for producing a set of scatterplot + * visualizations. + * + * @author Erich Schubert + * + * @param <V> Vector type + */ +// FIXME: re-add column labels +public class ScatterPlotProjector<V extends NumberVector<?, ?>> extends AbstractHierarchicalResult implements Projector { + /** + * Relation we project + */ + Relation<V> rel; + + /** + * Database dimensionality + */ + int dmax; + + /** + * Axis scales + */ + LinearScale[] scales; + + /** + * Constructor. + * + * @param rel Relation + * @param maxdim Maximum dimension to use + */ + public ScatterPlotProjector(Relation<V> rel, int maxdim) { + super(); + this.rel = rel; + this.dmax = maxdim; + this.scales = Scales.calcScales(rel); + assert (maxdim <= DatabaseUtil.dimensionality(rel)) : "Requested dimensionality larger than data dimensionality?!?"; + } + + @Override + public Collection<PlotItem> arrange() { + List<PlotItem> layout = new ArrayList<PlotItem>(1); + List<VisualizationTask> tasks = ResultUtil.filterResults(this, VisualizationTask.class); + if(tasks.size() > 0) { + final PlotItem master; + if(dmax == 2) { + // In 2d, make the plot twice as big. + master = new PlotItem(2 + .1, 2 + .1, null); + { + Projection2D proj = new Simple2D(scales, 1, 2); + PlotItem it = new PlotItem(.1, 0, 2., 2., proj); + it.visualizations = tasks; + master.subitems.add(it); + } + // Label at bottom + { + PlotItem it = new PlotItem(.1, 2., 2., .1, null); + final VisualizationTask task = new VisualizationTask("", null, null, new LabelVisFactory(DatabaseUtil.getColumnLabel(rel, 1))); + task.height = .1; + task.width = 2.; + task.put(VisualizationTask.META_NODETAIL, true); + it.visualizations.add(task); + master.subitems.add(it); + } + // Label on left + { + PlotItem it = new PlotItem(0, 0, .1, 2, null); + final VisualizationTask task = new VisualizationTask("", null, null, new LabelVisFactory(DatabaseUtil.getColumnLabel(rel, 2), true)); + task.height = 2.; + task.width = .1; + task.put(VisualizationTask.META_NODETAIL, true); + it.visualizations.add(task); + master.subitems.add(it); + } + } + else { + final double sizeh = Math.ceil((dmax - 1) / 2.0); + master = new PlotItem(sizeh * 2 + .1, dmax - 1 + .1, null); + + for(int d1 = 1; d1 < dmax; d1++) { + for(int d2 = d1 + 1; d2 <= dmax; d2++) { + Projection2D proj = new Simple2D(scales, d1, d2); + PlotItem it = new PlotItem(d1 - 1 + .1, d2 - 2, 1., 1., proj); + it.visualizations = tasks; + master.subitems.add(it); + } + } + if(dmax >= 3) { + AffineTransformation p = AffineProjection.axisProjection(DatabaseUtil.dimensionality(rel), 1, 2); + p.addRotation(0, 2, Math.PI / 180 * -10.); + p.addRotation(1, 2, Math.PI / 180 * 15.); + // Wanna try 4d? go ahead: + // p.addRotation(0, 3, Math.PI / 180 * -20.); + // p.addRotation(1, 3, Math.PI / 180 * 30.); + Projection2D proj = new AffineProjection(scales, p); + PlotItem it = new PlotItem(sizeh + .1, 0, sizeh, sizeh, proj); + it.visualizations = tasks; + master.subitems.add(it); + } + // Labels at bottom + for(int d1 = 1; d1 < dmax; d1++) { + PlotItem it = new PlotItem(d1 - 1 + .1, dmax - 1, 1., .1, null); + final VisualizationTask task = new VisualizationTask("", null, null, new LabelVisFactory(DatabaseUtil.getColumnLabel(rel, d1))); + task.height = .1; + task.width = 1; + task.put(VisualizationTask.META_NODETAIL, true); + it.visualizations.add(task); + master.subitems.add(it); + } + // Labels on left + for(int d2 = 2; d2 <= dmax; d2++) { + PlotItem it = new PlotItem(0, d2 - 2, .1, 1, null); + final VisualizationTask task = new VisualizationTask("", null, null, new LabelVisFactory(DatabaseUtil.getColumnLabel(rel, d2), true)); + task.height = 1; + task.width = .1; + task.put(VisualizationTask.META_NODETAIL, true); + it.visualizations.add(task); + master.subitems.add(it); + } + } + + layout.add(master); + } + return layout; + } + + @Override + public String getLongName() { + return "Scatterplot"; + } + + @Override + public String getShortName() { + return "scatterplot"; + } + + /** + * The relation we project. + * + * @return Relation + */ + public Relation<V> getRelation() { + return rel; + } +}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/projector/package-info.java b/src/de/lmu/ifi/dbs/elki/visualization/projector/package-info.java new file mode 100644 index 00000000..5975089c --- /dev/null +++ b/src/de/lmu/ifi/dbs/elki/visualization/projector/package-info.java @@ -0,0 +1,26 @@ +/** + * <p>Projectors are responsible for finding appropriate projections for data relations.</p> + */ +/* +This file is part of ELKI: +Environment for Developing KDD-Applications Supported by Index-Structures + +Copyright (C) 2011 +Ludwig-Maximilians-Universität München +Lehr- und Forschungseinheit für Datenbanksysteme +ELKI Development Team + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 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 Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ +package de.lmu.ifi.dbs.elki.visualization.projector;
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/savedialog/SVGSaveDialog.java b/src/de/lmu/ifi/dbs/elki/visualization/savedialog/SVGSaveDialog.java index 1dad0c83..0fbf584e 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/savedialog/SVGSaveDialog.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/savedialog/SVGSaveDialog.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.savedialog; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.awt.Component; import java.io.File; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/savedialog/SaveOptionsPanel.java b/src/de/lmu/ifi/dbs/elki/visualization/savedialog/SaveOptionsPanel.java index f7d1d5f8..9a678218 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/savedialog/SaveOptionsPanel.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/savedialog/SaveOptionsPanel.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.savedialog; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/scales/LinearScale.java b/src/de/lmu/ifi/dbs/elki/visualization/scales/LinearScale.java index b5654a35..8ae18fb5 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/scales/LinearScale.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/scales/LinearScale.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.scales; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.text.NumberFormat; import java.util.Locale; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/scales/Scales.java b/src/de/lmu/ifi/dbs/elki/visualization/scales/Scales.java index dcaea902..8f73d617 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/scales/Scales.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/scales/Scales.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.scales; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import de.lmu.ifi.dbs.elki.data.NumberVector; import de.lmu.ifi.dbs.elki.database.ids.DBID; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/style/PropertiesBasedStyleLibrary.java b/src/de/lmu/ifi/dbs/elki/visualization/style/PropertiesBasedStyleLibrary.java index 1889059e..9d60a413 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/style/PropertiesBasedStyleLibrary.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/style/PropertiesBasedStyleLibrary.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.style; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.io.File; import java.io.FileNotFoundException; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/style/StyleLibrary.java b/src/de/lmu/ifi/dbs/elki/visualization/style/StyleLibrary.java index e4076716..5cd721a7 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/style/StyleLibrary.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/style/StyleLibrary.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.style; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import de.lmu.ifi.dbs.elki.visualization.colors.ColorLibrary; import de.lmu.ifi.dbs.elki.visualization.style.lines.LineStyleLibrary; @@ -109,6 +110,11 @@ public interface StyleLibrary { final static String REFERENCE_POINTS = "plot.referencepoints"; /** + * Polygons style + */ + final static String POLYGONS = "plot.polygons"; + + /** * Selection color and opacity */ final static String SELECTION = "plot.selection"; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/style/default.properties b/src/de/lmu/ifi/dbs/elki/visualization/style/default.properties index fc5e751d..2fdb15ed 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/style/default.properties +++ b/src/de/lmu/ifi/dbs/elki/visualization/style/default.properties @@ -11,7 +11,7 @@ text-size=0.02 ## Text color text-color=black ## Default margin (relative) -margin.size=0.15 +margin.size=0.1 ## Named color for the page background page.background-color=white @@ -57,6 +57,9 @@ plot.dot.size=0.002 ## Reference points plot.referencepoints.size=0.003 plot.referencepoints.color=red +## Polygons +plot.polygons.line-width=0.001 +plot.polygons.color=gray ## Curve vis (ROC curves) labels: curve.labels.text-size=0.04 diff --git a/src/de/lmu/ifi/dbs/elki/visualization/style/grayscale.properties b/src/de/lmu/ifi/dbs/elki/visualization/style/grayscale.properties index 35abd93e..dc98d41e 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/style/grayscale.properties +++ b/src/de/lmu/ifi/dbs/elki/visualization/style/grayscale.properties @@ -11,7 +11,7 @@ text-size=0.02 ## Text color text-color=black ## Default margin (relative) -margin.size=0.15 +margin.size=0.10 ## Named color for the page background page.background-color=white @@ -57,6 +57,9 @@ plot.dot.size=0.002 ## Reference points plot.referencepoints.size=0.003 plot.referencepoints.color=black +## Polygons +plot.polygons.line-width=0.001 +plot.polygons.color=dimgray ## Curve vis (ROC curves) labels: curve.labels.text-size=0.04 diff --git a/src/de/lmu/ifi/dbs/elki/visualization/style/lines/DashedLineStyleLibrary.java b/src/de/lmu/ifi/dbs/elki/visualization/style/lines/DashedLineStyleLibrary.java index 1056294b..0a03afce 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/style/lines/DashedLineStyleLibrary.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/style/lines/DashedLineStyleLibrary.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.style.lines; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import org.apache.batik.util.CSSConstants; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/style/lines/LineStyleLibrary.java b/src/de/lmu/ifi/dbs/elki/visualization/style/lines/LineStyleLibrary.java index 9472c70f..7576967a 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/style/lines/LineStyleLibrary.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/style/lines/LineStyleLibrary.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.style.lines; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import de.lmu.ifi.dbs.elki.visualization.css.CSSClass; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/style/lines/SolidLineStyleLibrary.java b/src/de/lmu/ifi/dbs/elki/visualization/style/lines/SolidLineStyleLibrary.java index b39ae7c2..2adcaa3e 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/style/lines/SolidLineStyleLibrary.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/style/lines/SolidLineStyleLibrary.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.style.lines; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import org.apache.batik.util.CSSConstants; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/style/marker/MarkerLibrary.java b/src/de/lmu/ifi/dbs/elki/visualization/style/marker/MarkerLibrary.java index 779d6c2e..c45b9fe4 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/style/marker/MarkerLibrary.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/style/marker/MarkerLibrary.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.style.marker; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import org.w3c.dom.Element; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/style/marker/MinimalMarkers.java b/src/de/lmu/ifi/dbs/elki/visualization/style/marker/MinimalMarkers.java index 518a494b..10ea2afb 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/style/marker/MinimalMarkers.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/style/marker/MinimalMarkers.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.style.marker; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import org.apache.batik.util.SVGConstants; import org.w3c.dom.Element; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/style/marker/PrettyMarkers.java b/src/de/lmu/ifi/dbs/elki/visualization/style/marker/PrettyMarkers.java index 3043a602..2bab0f2c 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/style/marker/PrettyMarkers.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/style/marker/PrettyMarkers.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.style.marker; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import org.apache.batik.util.SVGConstants; import org.w3c.dom.Element; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/style/neon.properties b/src/de/lmu/ifi/dbs/elki/visualization/style/neon.properties index 17ad296c..859cc465 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/style/neon.properties +++ b/src/de/lmu/ifi/dbs/elki/visualization/style/neon.properties @@ -11,7 +11,7 @@ text-size=0.02 ## Text color text-color=white ## Default margin (relative) -margin.size=0.15 +margin.size=0.10 ## Named color for the page background page.background-color=black @@ -57,6 +57,9 @@ plot.dot.size=0.002 ## Reference points plot.referencepoints.size=0.003 plot.referencepoints.color=red +## Polygons +plot.polygons.line-width=0.001 +plot.polygons.color=grey ## Curve vis (ROC curves) labels: curve.labels.text-size=0.04 diff --git a/src/de/lmu/ifi/dbs/elki/visualization/style/presentation.properties b/src/de/lmu/ifi/dbs/elki/visualization/style/presentation.properties index 76ffbe94..dcc35e31 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/style/presentation.properties +++ b/src/de/lmu/ifi/dbs/elki/visualization/style/presentation.properties @@ -11,7 +11,7 @@ text-size=0.03 ## Text color text-color=black ## Default margin (relative) -margin.size=0.15 +margin.size=0.10 ## Named color for the page background page.background-color=white @@ -57,6 +57,9 @@ plot.dot.size=0.004 ## Reference points plot.referencepoints.size=0.006 plot.referencepoints.color=red +## Polygons +plot.polygons.line-width=0.001 +plot.polygons.color=grey ## Curve vis (ROC curves) labels: curve.labels.text-size=0.06 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 9c0db30e..18bbeb06 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGHyperCube.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGHyperCube.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.svg; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.ArrayList; import java.util.BitSet; 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 67aba6d0..169c8698 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGHyperSphere.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGHyperSphere.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.svg; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.BitSet; 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 4802eebd..2be331ca 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java @@ -1,26 +1,27 @@ 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) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import org.apache.batik.util.SVGConstants; import org.w3c.dom.Document; 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 9b887327..14889fb0 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java @@ -1,26 +1,27 @@ 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) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.io.ByteArrayOutputStream; import java.io.File; 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 6e993e4d..c32fef04 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGSimpleLinearAxis.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGSimpleLinearAxis.java @@ -1,26 +1,27 @@ 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) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import org.apache.batik.util.SVGConstants; import org.w3c.dom.Element; 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 74366215..b4e59fda 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java @@ -1,26 +1,27 @@ 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) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.awt.Color; import java.text.NumberFormat; 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 de462446..03bc9d74 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/svg/UpdateRunner.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/svg/UpdateRunner.java @@ -1,26 +1,27 @@ 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) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.Collection; import java.util.Queue; 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 24d041b9..c65ae719 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/svg/UpdateSynchronizer.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/svg/UpdateSynchronizer.java @@ -1,26 +1,28 @@ 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) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + /** * API to synchronize updates diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/AbstractVisFactory.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/AbstractVisFactory.java index cd728a2a..4b017fac 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/AbstractVisFactory.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/AbstractVisFactory.java @@ -1,27 +1,29 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; import de.lmu.ifi.dbs.elki.visualization.visualizers.thumbs.ThumbnailVisualization; /** diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/AbstractVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/AbstractVisualization.java index c91a48e0..8d1b184d 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/AbstractVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/AbstractVisualization.java @@ -1,31 +1,34 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import org.w3c.dom.Element; import de.lmu.ifi.dbs.elki.result.Result; import de.lmu.ifi.dbs.elki.result.ResultListener; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; +import de.lmu.ifi.dbs.elki.visualization.VisualizerContext; import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot; import de.lmu.ifi.dbs.elki.visualization.visualizers.events.ContextChangeListener; import de.lmu.ifi.dbs.elki.visualization.visualizers.events.ContextChangedEvent; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/StaticVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/StaticVisualization.java index 7aebb4c5..cfc653ef 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/StaticVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/StaticVisualization.java @@ -1,29 +1,32 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import org.w3c.dom.Element; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; + /** * Static visualization * diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/VisFactory.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/VisFactory.java index b671aede..b89d1ae0 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/VisFactory.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/VisFactory.java @@ -1,32 +1,33 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import de.lmu.ifi.dbs.elki.result.HierarchicalResult; import de.lmu.ifi.dbs.elki.result.Result; import de.lmu.ifi.dbs.elki.result.ResultProcessor; import de.lmu.ifi.dbs.elki.utilities.optionhandling.Parameterizable; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; /** * Defines the requirements for a visualizer. <br> @@ -65,11 +66,4 @@ public interface VisFactory extends ResultProcessor, Parameterizable { * @return Visualization */ public Visualization makeVisualizationOrThumbnail(VisualizationTask task); - - /** - * Get the projection type. - * - * @return projection type - */ - public Class<? extends Projection> getProjectionType(); }
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/Visualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/Visualization.java index 0d3f36fc..d2dfb687 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/Visualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/Visualization.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import org.w3c.dom.Element; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/VisualizerUtil.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/VisualizerUtil.java index 73810373..14984a5d 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/VisualizerUtil.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/VisualizerUtil.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.Iterator; @@ -33,6 +34,8 @@ import de.lmu.ifi.dbs.elki.result.Result; import de.lmu.ifi.dbs.elki.result.ResultUtil; import de.lmu.ifi.dbs.elki.utilities.iterator.AbstractFilteredIterator; import de.lmu.ifi.dbs.elki.utilities.iterator.IterableIterator; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; +import de.lmu.ifi.dbs.elki.visualization.VisualizerContext; /** * Visualizer utilities. diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/events/ContextChangeListener.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/events/ContextChangeListener.java index 109b1119..2d7d3e91 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/events/ContextChangeListener.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/events/ContextChangeListener.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.events; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.EventListener; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/events/ContextChangedEvent.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/events/ContextChangedEvent.java index b313cb1f..6d3aa24a 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/events/ContextChangedEvent.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/events/ContextChangedEvent.java @@ -1,30 +1,31 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.events; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.EventObject; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerContext; +import de.lmu.ifi.dbs.elki.visualization.VisualizerContext; /** * Event produced when the visualizer context has changed. diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/events/ResizedEvent.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/events/ResizedEvent.java index 203778e9..6eb6cad3 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/events/ResizedEvent.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/events/ResizedEvent.java @@ -1,28 +1,29 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.events; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerContext; +import de.lmu.ifi.dbs.elki.visualization.VisualizerContext; /** * Event triggered when the contexts view was resized. diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/optics/AbstractOPTICSVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/optics/AbstractOPTICSVisualization.java new file mode 100644 index 00000000..9cb95c23 --- /dev/null +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/optics/AbstractOPTICSVisualization.java @@ -0,0 +1,91 @@ +package de.lmu.ifi.dbs.elki.visualization.visualizers.optics; + +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +import java.util.List; + +import org.apache.batik.util.SVGConstants; + +import de.lmu.ifi.dbs.elki.distance.distancevalue.Distance; +import de.lmu.ifi.dbs.elki.result.optics.ClusterOrderEntry; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; +import de.lmu.ifi.dbs.elki.visualization.projector.OPTICSProjector; +import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; +import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; +import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisualization; + +/** + * Abstract base class for OPTICS visualizer + * + * @author Erich Schubert + * + * @param <D> + */ +public abstract class AbstractOPTICSVisualization<D extends Distance<D>> extends AbstractVisualization { + /** + * The plot + */ + final protected OPTICSProjector<D> optics; + + /** + * Width of plot (in display units) + */ + protected double plotwidth; + + /** + * Height of plot (in display units) + */ + protected double plotheight; + + /** + * Constructor. + * + * @param task Visualization task. + */ + public AbstractOPTICSVisualization(VisualizationTask task) { + super(task); + this.optics = task.getResult(); + } + + /** + * Produce a new layer element. + */ + protected void makeLayerElement() { + plotwidth = StyleLibrary.SCALE; + plotheight = StyleLibrary.SCALE / optics.getOPTICSPlot(context).getRatio(); + final double margin = context.getStyleLibrary().getSize(StyleLibrary.MARGIN); + layer = SVGUtil.svgElement(svgp.getDocument(), SVGConstants.SVG_G_TAG); + final String transform = SVGUtil.makeMarginTransform(task.getWidth(), task.getHeight(), plotwidth, plotheight, margin / 2); + SVGUtil.setAtt(layer, SVGConstants.SVG_TRANSFORM_ATTRIBUTE, transform); + } + + /** + * Access the raw cluster order + * + * @return Cluster order + */ + protected List<ClusterOrderEntry<D>> getClusterOrder() { + return optics.getResult().getClusterOrder(); + } +}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/optics/OPTICSClusterVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/optics/OPTICSClusterVisualization.java new file mode 100644 index 00000000..0898d9d0 --- /dev/null +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/optics/OPTICSClusterVisualization.java @@ -0,0 +1,218 @@ +package de.lmu.ifi.dbs.elki.visualization.visualizers.optics; + +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +import java.util.Iterator; +import java.util.List; + +import org.apache.batik.util.SVGConstants; +import org.w3c.dom.Element; + +import de.lmu.ifi.dbs.elki.data.Cluster; +import de.lmu.ifi.dbs.elki.data.Clustering; +import de.lmu.ifi.dbs.elki.data.model.OPTICSModel; +import de.lmu.ifi.dbs.elki.distance.distancevalue.Distance; +import de.lmu.ifi.dbs.elki.distance.distancevalue.DoubleDistance; +import de.lmu.ifi.dbs.elki.logging.Logging; +import de.lmu.ifi.dbs.elki.result.HierarchicalResult; +import de.lmu.ifi.dbs.elki.result.Result; +import de.lmu.ifi.dbs.elki.result.ResultUtil; +import de.lmu.ifi.dbs.elki.utilities.iterator.IterableUtil; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; +import de.lmu.ifi.dbs.elki.visualization.css.CSSClass; +import de.lmu.ifi.dbs.elki.visualization.projector.OPTICSProjector; +import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; +import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; +import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; +import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; + +/** + * Visualize the clusters and cluster hierarchy found by OPTICS on the OPTICS + * Plot. + * + * @author Erich Schubert + * + * @apiviz.uses ClusterOrderResult + * @apiviz.uses OPTICSPlot + * + * @param <D> Distance type (actually unused) + */ +public class OPTICSClusterVisualization<D extends Distance<D>> extends AbstractOPTICSVisualization<D> { + /** + * The logger for this class. + */ + private static final Logging logger = Logging.getLogger(OPTICSClusterVisualization.class); + + /** + * A short name characterizing this Visualizer. + */ + private static final String NAME = "OPTICS Cluster Ranges"; + + /** + * CSS class for markers + */ + protected static final String CSS_BRACKET = "opticsBracket"; + + /** + * Optics clustering we visualize + */ + public static final String CLUSTERING = "OPTICSClustering"; + + /** + * Our clustering + */ + Clustering<OPTICSModel> clus; + + /** + * Constructor. + * + * @param task Visualization task + */ + public OPTICSClusterVisualization(VisualizationTask task) { + super(task); + this.clus = task.getGenerics(CLUSTERING, Clustering.class); + context.addResultListener(this); + incrementalRedraw(); + } + + /** + * Find the first OPTICS clustering child of a result. + * + * @param result Result to start searching at + * @return OPTICS clustering + */ + @SuppressWarnings("unchecked") + protected static Clustering<OPTICSModel> findOPTICSClustering(Result result) { + Iterator<Clustering<?>> cs = ResultUtil.filteredResults(result, Clustering.class); + while (cs.hasNext()) { + Clustering<?> clus = cs.next(); + if(clus.getToplevelClusters().size() == 0) { + continue; + } + try { + Cluster<?> firstcluster = clus.getToplevelClusters().iterator().next(); + if(firstcluster.getModel() instanceof OPTICSModel) { + return (Clustering<OPTICSModel>) clus; + } + } catch(Exception e) { + // Empty clustering? Shouldn't happen. + logger.warning("Clustering with no cluster detected.", e); + } + } + return null; + } + + @Override + protected void redraw() { + makeLayerElement(); + addCSSClasses(); + drawClusters(clus.getToplevelClusters(), 1); + } + + /** + * Recursively draw clusters + * + * @param clusters Current set of clusters + * @param depth Recursion depth + */ + private void drawClusters(List<Cluster<OPTICSModel>> clusters, int depth) { + final double scale = StyleLibrary.SCALE; + for(Cluster<OPTICSModel> cluster : clusters) { + try { + OPTICSModel model = cluster.getModel(); + final double x1 = plotwidth * ((model.getStartIndex() + .25) / this.optics.getResult().getClusterOrder().size()); + final double x2 = plotwidth * ((model.getEndIndex() + .75) / this.optics.getResult().getClusterOrder().size()); + final double y = plotheight + depth * scale * 0.01; + Element e = svgp.svgLine(x1, y, x2, y); + SVGUtil.addCSSClass(e, CSS_BRACKET); + layer.appendChild(e); + } + catch(ClassCastException e) { + logger.warning("Expected OPTICSModel, got: " + cluster.getModel().getClass().getSimpleName()); + } + // Descend + final List<Cluster<OPTICSModel>> children = cluster.getChildren(); + if(children != null) { + drawClusters(children, depth + 1); + } + } + } + + /** + * Adds the required CSS-Classes + */ + private void addCSSClasses() { + // Class for the markers + if(!svgp.getCSSClassManager().contains(CSS_BRACKET)) { + final CSSClass cls = new CSSClass(this, CSS_BRACKET); + cls.setStatement(SVGConstants.CSS_STROKE_PROPERTY, context.getStyleLibrary().getColor(StyleLibrary.PLOT)); + cls.setStatement(SVGConstants.CSS_STROKE_WIDTH_PROPERTY, context.getStyleLibrary().getLineWidth(StyleLibrary.PLOT)); + svgp.addCSSClassOrLogError(cls); + } + } + + /** + * Factory class for OPTICS plot selections. + * + * @author Erich Schubert + * + * @apiviz.stereotype factory + * @apiviz.uses OPTICSPlotSelectionVisualization oneway - - «create» + */ + public static class Factory extends AbstractVisFactory { + /** + * Constructor, adhering to + * {@link de.lmu.ifi.dbs.elki.utilities.optionhandling.Parameterizable} + */ + public Factory() { + super(); + } + + @Override + public void processNewResult(HierarchicalResult baseResult, Result result) { + Iterator<OPTICSProjector<?>> ops = ResultUtil.filteredResults(result, OPTICSProjector.class); + for(OPTICSProjector<?> p : IterableUtil.fromIterator(ops)) { + final Clustering<OPTICSModel> ocl = findOPTICSClustering(baseResult); + if(ocl != null) { + final VisualizationTask task = new VisualizationTask(NAME, p, null, this); + task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_INTERACTIVE); + task.put(CLUSTERING, ocl); + baseResult.getHierarchy().add(p, task); + } + } + // TODO: also run when a new clustering is added, instead of just new projections? + } + + @Override + public Visualization makeVisualization(VisualizationTask task) { + return new OPTICSClusterVisualization<DoubleDistance>(task); + } + + @Override + public boolean allowThumbnails(@SuppressWarnings("unused") VisualizationTask task) { + // Don't use thumbnails + return false; + } + } +}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/OPTICSPlotCutVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/optics/OPTICSPlotCutVisualization.java index 9c44c839..9f2a5734 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/OPTICSPlotCutVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/optics/OPTICSPlotCutVisualization.java @@ -1,28 +1,29 @@ -package de.lmu.ifi.dbs.elki.visualization.visualizers.visunproj;
-/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ -
-import java.util.Collection;
+package de.lmu.ifi.dbs.elki.visualization.visualizers.optics;
+
+/*
+ This file is part of ELKI:
+ Environment for Developing KDD-Applications Supported by Index-Structures +
+ Copyright (C) 2011
+ Ludwig-Maximilians-Universität München
+ Lehr- und Forschungseinheit für Datenbanksysteme
+ ELKI Development Team +
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 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 Affero General Public License for more details. +
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import java.util.Iterator;
import org.apache.batik.util.SVG12Constants;
import org.apache.batik.util.SVGConstants;
@@ -39,17 +40,16 @@ import de.lmu.ifi.dbs.elki.result.Result; import de.lmu.ifi.dbs.elki.result.ResultUtil;
import de.lmu.ifi.dbs.elki.result.optics.ClusterOrderResult;
import de.lmu.ifi.dbs.elki.utilities.FormatUtil;
+import de.lmu.ifi.dbs.elki.utilities.iterator.IterableUtil;
+import de.lmu.ifi.dbs.elki.visualization.VisualizationTask;
import de.lmu.ifi.dbs.elki.visualization.batikutil.DragableArea;
import de.lmu.ifi.dbs.elki.visualization.css.CSSClass;
import de.lmu.ifi.dbs.elki.visualization.opticsplot.OPTICSCut;
-import de.lmu.ifi.dbs.elki.visualization.opticsplot.OPTICSPlot;
-import de.lmu.ifi.dbs.elki.visualization.projections.Projection;
+import de.lmu.ifi.dbs.elki.visualization.projector.OPTICSProjector;
import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary;
import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil;
import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory;
-import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisualization;
import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization;
-import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask;
/**
* Visualizes a cut in an OPTICS Plot to select an Epsilon value and generate a
@@ -62,23 +62,13 @@ import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; *
* @param <D> distance type
*/
-public class OPTICSPlotCutVisualization<D extends Distance<D>> extends AbstractVisualization implements DragableArea.DragListener {
+public class OPTICSPlotCutVisualization<D extends Distance<D>> extends AbstractOPTICSVisualization<D> implements DragableArea.DragListener {
/**
* A short name characterizing this Visualizer.
*/
private static final String NAME = "OPTICS Cut";
/**
- * Our concerned curve
- */
- ClusterOrderResult<D> order;
-
- /**
- * The actual plot
- */
- private OPTICSPlot<D> opticsplot;
-
- /**
* CSS-Styles
*/
protected static final String CSS_LINE = "opticsPlotLine";
@@ -94,11 +84,6 @@ public class OPTICSPlotCutVisualization<D extends Distance<D>> extends AbstractV private double epsilon = 0.0;
/**
- * The height of the plot
- */
- private double plotHeight;
-
- /**
* Sensitive (clickable) area
*/
private DragableArea eventarea = null;
@@ -125,11 +110,6 @@ public class OPTICSPlotCutVisualization<D extends Distance<D>> extends AbstractV */
public OPTICSPlotCutVisualization(VisualizationTask task) {
super(task);
- this.order = task.getResult();
- this.opticsplot = OPTICSPlot.plotForClusterOrder(this.order, context);
- this.plotHeight = StyleLibrary.SCALE / opticsplot.getRatio();
-
- synchronizedRedraw();
}
@Override
@@ -139,24 +119,15 @@ public class OPTICSPlotCutVisualization<D extends Distance<D>> extends AbstractV @Override
protected void incrementalRedraw() {
- addCSSClasses();
-
- final double scale = StyleLibrary.SCALE;
-
if(layer == null) {
- layer = svgp.svgElement(SVGConstants.SVG_G_TAG);
- final double sizex = scale;
- final double sizey = scale * task.getHeight() / task.getWidth();
- final double margin = context.getStyleLibrary().getSize(StyleLibrary.MARGIN);
- final String transform = SVGUtil.makeMarginTransform(task.getWidth(), task.getHeight(), sizex, sizey, margin);
- SVGUtil.setAtt(layer, SVGConstants.SVG_TRANSFORM_ATTRIBUTE, transform);
- SVGUtil.setAtt(layer, SVGConstants.SVG_NAME_ATTRIBUTE, "cut layer");
+ makeLayerElement();
+ addCSSClasses();
}
// TODO make the number of digits configurable
final String label = (epsilon != 0.0) ? FormatUtil.format(epsilon, 4) : "";
// compute absolute y-value of bar
- final double yAct = plotHeight - getYFromEpsilon(epsilon);
+ final double yAct = plotheight - getYFromEpsilon(epsilon);
if(elemText == null) {
elemText = svgp.svgText(StyleLibrary.SCALE * 1.05, yAct, label);
@@ -170,7 +141,7 @@ public class OPTICSPlotCutVisualization<D extends Distance<D>> extends AbstractV // line and handle
if(elementLine == null) {
- elementLine = svgp.svgLine(0, yAct, StyleLibrary.SCALE * 1.05, yAct);
+ elementLine = svgp.svgLine(0, yAct, StyleLibrary.SCALE * 1.04, yAct);
SVGUtil.addCSSClass(elementLine, CSS_LINE);
layer.appendChild(elementLine);
}
@@ -179,7 +150,7 @@ public class OPTICSPlotCutVisualization<D extends Distance<D>> extends AbstractV SVGUtil.setAtt(elementLine, SVG12Constants.SVG_Y2_ATTRIBUTE, yAct);
}
if(elementPoint == null) {
- elementPoint = svgp.svgCircle(StyleLibrary.SCALE * 1.05, yAct, StyleLibrary.SCALE * 0.004);
+ elementPoint = svgp.svgCircle(StyleLibrary.SCALE * 1.04, yAct, StyleLibrary.SCALE * 0.004);
SVGUtil.addCSSClass(elementPoint, CSS_LINE);
layer.appendChild(elementPoint);
}
@@ -188,7 +159,7 @@ public class OPTICSPlotCutVisualization<D extends Distance<D>> extends AbstractV }
if(eventarea == null) {
- eventarea = new DragableArea(svgp, StyleLibrary.SCALE, 0, StyleLibrary.SCALE * 0.1, plotHeight, this);
+ eventarea = new DragableArea(svgp, StyleLibrary.SCALE, 0, StyleLibrary.SCALE * 0.1, plotheight, this);
layer.appendChild(eventarea.getElement());
}
}
@@ -209,10 +180,10 @@ public class OPTICSPlotCutVisualization<D extends Distance<D>> extends AbstractV if(y < 0) {
y = 0;
}
- if(y > plotHeight) {
- y = plotHeight;
+ if(y > plotheight) {
+ y = plotheight;
}
- return opticsplot.getScale().getUnscaled(y / plotHeight);
+ return optics.getOPTICSPlot(context).getScale().getUnscaled(y / plotheight);
}
/**
@@ -222,19 +193,19 @@ public class OPTICSPlotCutVisualization<D extends Distance<D>> extends AbstractV * @return y-Value
*/
protected double getYFromEpsilon(double epsilon) {
- double y = opticsplot.getScale().getScaled(epsilon) * plotHeight;
+ double y = optics.getOPTICSPlot(context).getScale().getScaled(epsilon) * plotheight;
if(y < 0) {
y = 0;
}
- if(y > plotHeight) {
- y = plotHeight;
+ if(y > plotheight) {
+ y = plotheight;
}
return y;
}
@Override
public boolean startDrag(SVGPoint start, @SuppressWarnings("unused") Event evt) {
- epsilon = getEpsilonFromY(plotHeight - start.getY());
+ epsilon = getEpsilonFromY(plotheight - start.getY());
// opvis.unsetEpsilonExcept(this);
synchronizedRedraw();
return true;
@@ -243,7 +214,7 @@ public class OPTICSPlotCutVisualization<D extends Distance<D>> extends AbstractV @Override
public boolean duringDrag(@SuppressWarnings("unused") SVGPoint start, SVGPoint end, @SuppressWarnings("unused") Event evt, boolean inside) {
if(inside) {
- epsilon = getEpsilonFromY(plotHeight - end.getY());
+ epsilon = getEpsilonFromY(plotheight - end.getY());
}
// opvis.unsetEpsilonExcept(this);
synchronizedRedraw();
@@ -253,11 +224,12 @@ public class OPTICSPlotCutVisualization<D extends Distance<D>> extends AbstractV @Override
public boolean endDrag(@SuppressWarnings("unused") SVGPoint start, SVGPoint end, @SuppressWarnings("unused") Event evt, boolean inside) {
if(inside) {
- epsilon = getEpsilonFromY(plotHeight - end.getY());
+ epsilon = getEpsilonFromY(plotheight - end.getY());
// opvis.unsetEpsilonExcept(this);
// FIXME: replace an existing optics cut result!
- Clustering<Model> cl = OPTICSCut.makeOPTICSCut(order, opticsplot.getDistanceAdapter(), epsilon);
+ final ClusterOrderResult<D> order = optics.getResult();
+ Clustering<Model> cl = OPTICSCut.makeOPTICSCut(order, optics.getOPTICSPlot(context).getDistanceAdapter(), epsilon);
order.addChildResult(cl);
}
context.resultChanged(this.task);
@@ -308,12 +280,11 @@ public class OPTICSPlotCutVisualization<D extends Distance<D>> extends AbstractV @Override
public void processNewResult(HierarchicalResult baseResult, Result result) {
- Collection<OPTICSPlot<?>> plots = ResultUtil.filterResults(result, OPTICSPlot.class);
- for(OPTICSPlot<?> plot : plots) {
- ClusterOrderResult<?> co = plot.getClusterOrder();
- final VisualizationTask task = new VisualizationTask(NAME, co, null, this, plot);
+ Iterator<OPTICSProjector<?>> ops = ResultUtil.filteredResults(result, OPTICSProjector.class);
+ for(OPTICSProjector<?> p : IterableUtil.fromIterator(ops)) {
+ final VisualizationTask task = new VisualizationTask(NAME, p, null, this);
task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_INTERACTIVE);
- baseResult.getHierarchy().add(plot, task);
+ baseResult.getHierarchy().add(p, task);
}
}
@@ -323,8 +294,9 @@ public class OPTICSPlotCutVisualization<D extends Distance<D>> extends AbstractV }
@Override
- public Class<? extends Projection> getProjectionType() {
- return null;
+ public boolean allowThumbnails(@SuppressWarnings("unused") VisualizationTask task) {
+ // Don't use thumbnails
+ return false;
}
}
}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/OPTICSPlotSelectionVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/optics/OPTICSPlotSelectionVisualization.java index d5c5a232..b75bd3b5 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/OPTICSPlotSelectionVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/optics/OPTICSPlotSelectionVisualization.java @@ -1,28 +1,29 @@ -package de.lmu.ifi.dbs.elki.visualization.visualizers.visunproj;
-/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ -
-import java.util.Collection;
+package de.lmu.ifi.dbs.elki.visualization.visualizers.optics;
+
+/*
+ This file is part of ELKI:
+ Environment for Developing KDD-Applications Supported by Index-Structures +
+ Copyright (C) 2011
+ Ludwig-Maximilians-Universität München
+ Lehr- und Forschungseinheit für Datenbanksysteme
+ ELKI Development Team +
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 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 Affero General Public License for more details. +
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import java.util.Iterator;
import java.util.List;
import org.apache.batik.dom.events.DOMMouseEvent;
@@ -44,18 +45,14 @@ import de.lmu.ifi.dbs.elki.result.Result; import de.lmu.ifi.dbs.elki.result.ResultUtil;
import de.lmu.ifi.dbs.elki.result.SelectionResult;
import de.lmu.ifi.dbs.elki.result.optics.ClusterOrderEntry;
-import de.lmu.ifi.dbs.elki.result.optics.ClusterOrderResult;
+import de.lmu.ifi.dbs.elki.utilities.iterator.IterableUtil;
+import de.lmu.ifi.dbs.elki.visualization.VisualizationTask;
import de.lmu.ifi.dbs.elki.visualization.batikutil.DragableArea;
import de.lmu.ifi.dbs.elki.visualization.css.CSSClass;
-import de.lmu.ifi.dbs.elki.visualization.opticsplot.OPTICSPlot;
-import de.lmu.ifi.dbs.elki.visualization.projections.Projection;
-import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary;
+import de.lmu.ifi.dbs.elki.visualization.projector.OPTICSProjector;
import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil;
import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory;
-import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisualization;
import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization;
-import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask;
-import de.lmu.ifi.dbs.elki.visualization.visualizers.thumbs.ThumbnailVisualization;
/**
* Handle the marker in an OPTICS plot.
@@ -68,7 +65,7 @@ import de.lmu.ifi.dbs.elki.visualization.visualizers.thumbs.ThumbnailVisualizati *
* @param <D> distance type
*/
-public class OPTICSPlotSelectionVisualization<D extends Distance<D>> extends AbstractVisualization implements DragableArea.DragListener {
+public class OPTICSPlotSelectionVisualization<D extends Distance<D>> extends AbstractOPTICSVisualization<D> implements DragableArea.DragListener {
/**
* The logger for this class.
*/
@@ -100,16 +97,6 @@ public class OPTICSPlotSelectionVisualization<D extends Distance<D>> extends Abs }
/**
- * Our concerned curve
- */
- ClusterOrderResult<D> co;
-
- /**
- * The plot
- */
- private OPTICSPlot<D> opticsplot;
-
- /**
* Element for the events
*/
private Element etag;
@@ -126,33 +113,20 @@ public class OPTICSPlotSelectionVisualization<D extends Distance<D>> extends Abs */
public OPTICSPlotSelectionVisualization(VisualizationTask task) {
super(task);
- this.co = task.getResult();
- this.opticsplot = OPTICSPlot.plotForClusterOrder(this.co, context);
context.addResultListener(this);
incrementalRedraw();
}
@Override
protected void redraw() {
- double scale = StyleLibrary.SCALE;
- final double sizex = scale;
- final double sizey = scale * task.getHeight() / task.getWidth();
- final double margin = context.getStyleLibrary().getSize(StyleLibrary.MARGIN);
- layer = SVGUtil.svgElement(svgp.getDocument(), SVGConstants.SVG_G_TAG);
- final String transform = SVGUtil.makeMarginTransform(task.getWidth(), task.getHeight(), sizex, sizey, margin);
- SVGUtil.setAtt(layer, SVGConstants.SVG_TRANSFORM_ATTRIBUTE, transform);
-
+ makeLayerElement();
addCSSClasses();
- this.etag = svgp.svgElement(SVGConstants.SVG_G_TAG);
- this.mtag = svgp.svgElement(SVGConstants.SVG_G_TAG);
-
- double heightPlot = scale / opticsplot.getRatio();
+ mtag = svgp.svgElement(SVGConstants.SVG_G_TAG);
+ addMarker();
- DragableArea drag = new DragableArea(svgp, 0 - scale * 0.1, 0, scale * 1.1, heightPlot, this);
+ DragableArea drag = new DragableArea(svgp, 0 - plotwidth * 0.1, 0, plotwidth * 1.1, plotheight, this);
etag = drag.getElement();
-
- addMarker();
// mtag first, etag must be the top Element
layer.appendChild(mtag);
layer.appendChild(etag);
@@ -162,13 +136,13 @@ public class OPTICSPlotSelectionVisualization<D extends Distance<D>> extends Abs * Add marker for the selected IDs to mtag
*/
public void addMarker() {
- List<ClusterOrderEntry<D>> order = co.getClusterOrder();
+ List<ClusterOrderEntry<D>> order = getClusterOrder();
// TODO: replace mtag!
DBIDSelection selContext = context.getSelection();
if(selContext != null) {
DBIDs selection = DBIDUtil.ensureSet(selContext.getSelectedIds());
- final double width = StyleLibrary.SCALE / order.size();
+ final double width = plotwidth / order.size();
int begin = -1;
for(int j = 0; j < order.size(); j++) {
DBID id = order.get(j).getID();
@@ -203,16 +177,15 @@ public class OPTICSPlotSelectionVisualization<D extends Distance<D>> extends Abs * @return SVG-Element svg-rectangle
*/
public Element addMarkerRect(double x1, double width) {
- double heightPlot = StyleLibrary.SCALE / opticsplot.getRatio();
- return svgp.svgRect(x1, 0, width, heightPlot);
+ return svgp.svgRect(x1, 0, width, plotheight);
}
@Override
public boolean startDrag(SVGPoint startPoint, @SuppressWarnings("unused") Event evt) {
- List<ClusterOrderEntry<D>> order = co.getClusterOrder();
+ List<ClusterOrderEntry<D>> order = getClusterOrder();
int mouseActIndex = getSelectedIndex(order, startPoint);
if(mouseActIndex >= 0 && mouseActIndex < order.size()) {
- double width = StyleLibrary.SCALE / order.size();
+ double width = plotwidth / order.size();
double x1 = mouseActIndex * width;
Element marker = addMarkerRect(x1, width);
SVGUtil.setCSSClass(marker, CSS_RANGEMARKER);
@@ -224,12 +197,12 @@ public class OPTICSPlotSelectionVisualization<D extends Distance<D>> extends Abs @Override
public boolean duringDrag(SVGPoint startPoint, SVGPoint dragPoint, @SuppressWarnings("unused") Event evt, @SuppressWarnings("unused") boolean inside) {
- List<ClusterOrderEntry<D>> order = co.getClusterOrder();
+ List<ClusterOrderEntry<D>> order = getClusterOrder();
int mouseDownIndex = getSelectedIndex(order, startPoint);
int mouseActIndex = getSelectedIndex(order, dragPoint);
final int begin = Math.max(Math.min(mouseDownIndex, mouseActIndex), 0);
final int end = Math.min(Math.max(mouseDownIndex, mouseActIndex), order.size());
- double width = StyleLibrary.SCALE / order.size();
+ double width = plotwidth / order.size();
double x1 = begin * width;
double x2 = (end * width) + width;
mtag.removeChild(mtag.getLastChild());
@@ -241,7 +214,7 @@ public class OPTICSPlotSelectionVisualization<D extends Distance<D>> extends Abs @Override
public boolean endDrag(SVGPoint startPoint, SVGPoint dragPoint, Event evt, @SuppressWarnings("unused") boolean inside) {
- List<ClusterOrderEntry<D>> order = co.getClusterOrder();
+ List<ClusterOrderEntry<D>> order = getClusterOrder();
int mouseDownIndex = getSelectedIndex(order, startPoint);
int mouseActIndex = getSelectedIndex(order, dragPoint);
Mode mode = getInputMode(evt);
@@ -283,7 +256,7 @@ public class OPTICSPlotSelectionVisualization<D extends Distance<D>> extends Abs * @return Index of the object
*/
private int getSelectedIndex(List<ClusterOrderEntry<D>> order, SVGPoint cPt) {
- int mouseActIndex = (int) ((cPt.getX() / StyleLibrary.SCALE) * order.size());
+ int mouseActIndex = (int) ((cPt.getX() / plotwidth) * order.size());
return mouseActIndex;
}
@@ -295,7 +268,7 @@ public class OPTICSPlotSelectionVisualization<D extends Distance<D>> extends Abs * @param end last index to select
*/
protected void updateSelection(Mode mode, int begin, int end) {
- List<ClusterOrderEntry<D>> order = co.getClusterOrder();
+ List<ClusterOrderEntry<D>> order = getClusterOrder();
if(begin < 0 || begin > end || end >= order.size()) {
logger.warning("Invalid range in updateSelection: " + begin + " .. " + end);
return;
@@ -353,7 +326,7 @@ public class OPTICSPlotSelectionVisualization<D extends Distance<D>> extends Abs @Override
public void resultChanged(Result current) {
- if(current instanceof SelectionResult || current == co || current == opticsplot) {
+ if(current instanceof SelectionResult) {
synchronizedRedraw();
return;
}
@@ -379,12 +352,11 @@ public class OPTICSPlotSelectionVisualization<D extends Distance<D>> extends Abs @Override
public void processNewResult(HierarchicalResult baseResult, Result result) {
- Collection<OPTICSPlot<?>> plots = ResultUtil.filterResults(result, OPTICSPlot.class);
- for(OPTICSPlot<?> plot : plots) {
- ClusterOrderResult<?> co = plot.getClusterOrder();
- final VisualizationTask task = new VisualizationTask(NAME, co, null, this, plot);
+ Iterator<OPTICSProjector<?>> ops = ResultUtil.filteredResults(result, OPTICSProjector.class);
+ for(OPTICSProjector<?> p : IterableUtil.fromIterator(ops)) {
+ final VisualizationTask task = new VisualizationTask(NAME, p, null, this);
task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_INTERACTIVE);
- baseResult.getHierarchy().add(plot, task);
+ baseResult.getHierarchy().add(p, task);
}
}
@@ -394,13 +366,9 @@ public class OPTICSPlotSelectionVisualization<D extends Distance<D>> extends Abs }
@Override
- public Visualization makeVisualizationOrThumbnail(VisualizationTask task) {
- return new ThumbnailVisualization(this, task, ThumbnailVisualization.ON_SELECTION);
- }
-
- @Override
- public Class<? extends Projection> getProjectionType() {
- return null;
+ public boolean allowThumbnails(@SuppressWarnings("unused") VisualizationTask task) {
+ // Don't use thumbnails
+ return false;
}
}
}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/optics/OPTICSPlotVisualizer.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/optics/OPTICSPlotVisualizer.java new file mode 100644 index 00000000..4af5d466 --- /dev/null +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/optics/OPTICSPlotVisualizer.java @@ -0,0 +1,146 @@ +package de.lmu.ifi.dbs.elki.visualization.visualizers.optics; + +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +import java.io.File; +import java.io.IOException; +import java.util.Iterator; + +import org.apache.batik.util.SVGConstants; +import org.w3c.dom.Element; + +import de.lmu.ifi.dbs.elki.distance.distancevalue.Distance; +import de.lmu.ifi.dbs.elki.distance.distancevalue.DoubleDistance; +import de.lmu.ifi.dbs.elki.logging.LoggingUtil; +import de.lmu.ifi.dbs.elki.result.HierarchicalResult; +import de.lmu.ifi.dbs.elki.result.Result; +import de.lmu.ifi.dbs.elki.result.ResultUtil; +import de.lmu.ifi.dbs.elki.utilities.iterator.IterableUtil; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; +import de.lmu.ifi.dbs.elki.visualization.css.CSSClassManager.CSSNamingConflict; +import de.lmu.ifi.dbs.elki.visualization.opticsplot.OPTICSPlot; +import de.lmu.ifi.dbs.elki.visualization.projector.OPTICSProjector; +import de.lmu.ifi.dbs.elki.visualization.svg.SVGSimpleLinearAxis; +import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; +import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; +import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; + +/** + * Visualize an OPTICS result by constructing an OPTICS plot for it. + * + * @author Erich Schubert + * + * @apiviz.has OPTICSPlot oneway - 1 visualizes + * @apiviz.has ClusterOrderResult oneway - 1 visualizes + * + * @param <D> Distance type + */ +public class OPTICSPlotVisualizer<D extends Distance<D>> extends AbstractOPTICSVisualization<D> { + /** + * Name for this visualizer. + */ + private static final String NAME = "OPTICS Plot"; + + /** + * Constructor. + * + * @param task Visualization task + */ + public OPTICSPlotVisualizer(VisualizationTask task) { + super(task); + } + + @Override + protected void redraw() { + makeLayerElement(); + // addCSSClasses(); + + OPTICSPlot<D> opticsplot = optics.getOPTICSPlot(context); + File imgfile = null; + try { + imgfile = opticsplot.getAsTempFile(); + } + catch(IOException e) { + LoggingUtil.exception("Could not generate OPTICS plot.", e); + } + + Element itag = svgp.svgElement(SVGConstants.SVG_IMAGE_TAG); + SVGUtil.setAtt(itag, SVGConstants.SVG_IMAGE_RENDERING_ATTRIBUTE, SVGConstants.SVG_OPTIMIZE_SPEED_VALUE); + SVGUtil.setAtt(itag, SVGConstants.SVG_X_ATTRIBUTE, 0); + SVGUtil.setAtt(itag, SVGConstants.SVG_Y_ATTRIBUTE, 0); + SVGUtil.setAtt(itag, SVGConstants.SVG_WIDTH_ATTRIBUTE, plotwidth); + SVGUtil.setAtt(itag, SVGConstants.SVG_HEIGHT_ATTRIBUTE, plotheight); + itag.setAttributeNS(SVGConstants.XLINK_NAMESPACE_URI, SVGConstants.XLINK_HREF_QNAME, imgfile.toURI().toString()); + + layer.appendChild(itag); + + try { + SVGSimpleLinearAxis.drawAxis(svgp, layer, opticsplot.getScale(), 0, plotheight, 0, 0, true, false, context.getStyleLibrary()); + SVGSimpleLinearAxis.drawAxis(svgp, layer, opticsplot.getScale(), plotwidth, plotheight, plotwidth, 0, true, true, context.getStyleLibrary()); + } + catch(CSSNamingConflict e) { + LoggingUtil.exception("CSS naming conflict for axes on OPTICS plot", e); + } + } + + /** + * Factory class for OPTICS plot. + * + * @author Erich Schubert + * + * @apiviz.stereotype factory + * @apiviz.uses OPTICSPlotVisualizer oneway - - «create» + */ + public static class Factory extends AbstractVisFactory { + /** + * Constructor, adhering to + * {@link de.lmu.ifi.dbs.elki.utilities.optionhandling.Parameterizable} + */ + public Factory() { + super(); + } + + @Override + public void processNewResult(HierarchicalResult baseResult, Result result) { + Iterator<OPTICSProjector<?>> ops = ResultUtil.filteredResults(result, OPTICSProjector.class); + for(OPTICSProjector<?> p : IterableUtil.fromIterator(ops)) { + // Add plots, attach visualizer + final VisualizationTask task = new VisualizationTask(NAME, p, null, this); + task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_STATIC); + baseResult.getHierarchy().add(p, task); + } + } + + @Override + public Visualization makeVisualization(VisualizationTask task) { + return new OPTICSPlotVisualizer<DoubleDistance>(task); + } + + @Override + public boolean allowThumbnails(@SuppressWarnings("unused") VisualizationTask task) { + // Don't use thumbnails + return false; + } + } +}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/OPTICSSteepAreaVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/optics/OPTICSSteepAreaVisualization.java index eb2f2ba1..f9430145 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/OPTICSSteepAreaVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/optics/OPTICSSteepAreaVisualization.java @@ -1,29 +1,31 @@ -package de.lmu.ifi.dbs.elki.visualization.visualizers.visunproj; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. +package de.lmu.ifi.dbs.elki.visualization.visualizers.optics; -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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.awt.Color; -import java.util.Collection; +import java.util.Iterator; +import java.util.List; import org.apache.batik.util.SVGConstants; import org.w3c.dom.Element; @@ -36,17 +38,19 @@ import de.lmu.ifi.dbs.elki.result.HierarchicalResult; import de.lmu.ifi.dbs.elki.result.Result; import de.lmu.ifi.dbs.elki.result.ResultUtil; import de.lmu.ifi.dbs.elki.result.SelectionResult; +import de.lmu.ifi.dbs.elki.result.optics.ClusterOrderEntry; import de.lmu.ifi.dbs.elki.result.optics.ClusterOrderResult; +import de.lmu.ifi.dbs.elki.utilities.iterator.IterableUtil; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; import de.lmu.ifi.dbs.elki.visualization.css.CSSClass; import de.lmu.ifi.dbs.elki.visualization.opticsplot.OPTICSDistanceAdapter; import de.lmu.ifi.dbs.elki.visualization.opticsplot.OPTICSPlot; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection; +import de.lmu.ifi.dbs.elki.visualization.projector.OPTICSProjector; +import de.lmu.ifi.dbs.elki.visualization.scales.LinearScale; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; -import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisualization; import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; /** * Visualize the steep areas found in an OPTICS plot @@ -56,7 +60,7 @@ import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; * @apiviz.uses * de.lmu.ifi.dbs.elki.algorithm.clustering.OPTICSXi.SteepAreaResult */ -public class OPTICSSteepAreaVisualization<D extends Distance<D>> extends AbstractVisualization { +public class OPTICSSteepAreaVisualization<D extends Distance<D>> extends AbstractOPTICSVisualization<D> { /** * A short name characterizing this Visualizer. */ @@ -73,30 +77,18 @@ public class OPTICSSteepAreaVisualization<D extends Distance<D>> extends Abstrac protected static final String CSS_STEEP_DOWN = "opticsSteepDown"; /** - * Our cluster order - */ - private ClusterOrderResult<D> co; - - /** * Our clustering */ OPTICSXi.SteepAreaResult areas; /** - * The plot - */ - private OPTICSPlot<D> opticsplot; - - /** * Constructor. * * @param task Visualization task */ public OPTICSSteepAreaVisualization(VisualizationTask task) { super(task); - this.co = task.getResult(); - this.areas = findSteepAreaResult(this.co); - this.opticsplot = OPTICSPlot.plotForClusterOrder(this.co, context); + this.areas = findSteepAreaResult(this.optics.getResult()); context.addResultListener(this); incrementalRedraw(); } @@ -118,30 +110,24 @@ public class OPTICSSteepAreaVisualization<D extends Distance<D>> extends Abstrac @Override protected void redraw() { - final double scale = StyleLibrary.SCALE; - final double sizex = scale; - final double sizey = scale * task.getHeight() / task.getWidth(); - final double margin = context.getStyleLibrary().getSize(StyleLibrary.MARGIN); - layer = SVGUtil.svgElement(svgp.getDocument(), SVGConstants.SVG_G_TAG); - final String transform = SVGUtil.makeMarginTransform(task.getWidth(), task.getHeight(), sizex, sizey, margin); - SVGUtil.setAtt(layer, SVGConstants.SVG_TRANSFORM_ATTRIBUTE, transform); - + makeLayerElement(); addCSSClasses(); - - final double plotwidth = scale; - final double plotheight = scale / opticsplot.getRatio(); - - OPTICSDistanceAdapter<D> adapter = opticsplot.getDistanceAdapter(); + + final OPTICSPlot<D> opticsplot = optics.getOPTICSPlot(context); + final List<ClusterOrderEntry<D>> co = getClusterOrder(); + final OPTICSDistanceAdapter<D> adapter = opticsplot.getDistanceAdapter(); + final LinearScale scale = opticsplot.getScale(); + for(OPTICSXi.SteepArea area : areas) { final int st = area.getStartIndex(); final int en = area.getEndIndex(); // Note: make sure we are using doubles! - final double x1 = (st + .25) / this.co.getClusterOrder().size(); - final double x2 = (en + .75) / this.co.getClusterOrder().size(); - final double d1 = adapter.getDoubleForEntry(this.co.getClusterOrder().get(st)); - final double d2 = adapter.getDoubleForEntry(this.co.getClusterOrder().get(en)); - final double y1 = (!Double.isInfinite(d1) && !Double.isNaN(d1)) ? (1. - opticsplot.getScale().getScaled(d1)) : 0.; - final double y2 = (!Double.isInfinite(d2) && !Double.isNaN(d2)) ? (1. - opticsplot.getScale().getScaled(d2)) : 0.; + final double x1 = (st + .25) / co.size(); + final double x2 = (en + .75) / co.size(); + final double d1 = adapter.getDoubleForEntry(co.get(st)); + final double d2 = adapter.getDoubleForEntry(co.get(en)); + final double y1 = (!Double.isInfinite(d1) && !Double.isNaN(d1)) ? (1. - scale.getScaled(d1)) : 0.; + final double y2 = (!Double.isInfinite(d2) && !Double.isNaN(d2)) ? (1. - scale.getScaled(d2)) : 0.; Element e = svgp.svgLine(plotwidth * x1, plotheight * y1, plotwidth * x2, plotheight * y2); if(area instanceof OPTICSXi.SteepDownArea) { SVGUtil.addCSSClass(e, CSS_STEEP_DOWN); @@ -184,7 +170,7 @@ public class OPTICSSteepAreaVisualization<D extends Distance<D>> extends Abstrac @Override public void resultChanged(Result current) { - if(current instanceof SelectionResult || current == co || current == opticsplot) { + if(current instanceof SelectionResult) { synchronizedRedraw(); return; } @@ -210,14 +196,14 @@ public class OPTICSSteepAreaVisualization<D extends Distance<D>> extends Abstrac @Override public void processNewResult(HierarchicalResult baseResult, Result result) { - Collection<OPTICSPlot<?>> plots = ResultUtil.filterResults(result, OPTICSPlot.class); - for(OPTICSPlot<?> plot : plots) { - ClusterOrderResult<?> co = plot.getClusterOrder(); - final SteepAreaResult steep = findSteepAreaResult(co); + Iterator<OPTICSProjector<?>> ops = ResultUtil.filteredResults(result, OPTICSProjector.class); + for(OPTICSProjector<?> p : IterableUtil.fromIterator(ops)) { + final SteepAreaResult steep = findSteepAreaResult(p.getResult()); if(steep != null) { - final VisualizationTask task = new VisualizationTask(NAME, co, null, this, plot); + final VisualizationTask task = new VisualizationTask(NAME, p, null, this); task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_INTERACTIVE); task.put(VisualizationTask.META_VISIBLE_DEFAULT, false); + baseResult.getHierarchy().add(p, task); baseResult.getHierarchy().add(steep, task); } } @@ -233,10 +219,5 @@ public class OPTICSSteepAreaVisualization<D extends Distance<D>> extends Abstrac // Don't use thumbnails return false; } - - @Override - public Class<? extends Projection> getProjectionType() { - return null; - } } }
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/optics/package-info.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/optics/package-info.java new file mode 100644 index 00000000..05b02142 --- /dev/null +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/optics/package-info.java @@ -0,0 +1,26 @@ +/** + * <p>Visualizers that do work on OPTICS plots</p> + */ +/* +This file is part of ELKI: +Environment for Developing KDD-Applications Supported by Index-Structures + +Copyright (C) 2011 +Ludwig-Maximilians-Universität München +Lehr- und Forschungseinheit für Datenbanksysteme +ELKI Development Team + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 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 Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ +package de.lmu.ifi.dbs.elki.visualization.visualizers.optics;
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/thumbs/ThumbnailThread.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/thumbs/ThumbnailThread.java index 133c798c..5d79a986 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/thumbs/ThumbnailThread.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/thumbs/ThumbnailThread.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.thumbs; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/thumbs/ThumbnailVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/thumbs/ThumbnailVisualization.java index 0b29ea58..e352d599 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/thumbs/ThumbnailVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/thumbs/ThumbnailVisualization.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.thumbs; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.io.File; @@ -33,12 +34,12 @@ import de.lmu.ifi.dbs.elki.logging.Logging; import de.lmu.ifi.dbs.elki.logging.LoggingUtil; import de.lmu.ifi.dbs.elki.result.Result; import de.lmu.ifi.dbs.elki.result.SelectionResult; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot; import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisualization; import de.lmu.ifi.dbs.elki.visualization.visualizers.VisFactory; import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; import de.lmu.ifi.dbs.elki.visualization.visualizers.events.ContextChangedEvent; import de.lmu.ifi.dbs.elki.visualization.visualizers.events.ResizedEvent; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/thumbs/Thumbnailer.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/thumbs/Thumbnailer.java index 334eeb6a..1909821a 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/thumbs/Thumbnailer.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/thumbs/Thumbnailer.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.thumbs; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.io.File; import java.io.IOException; diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis1d/P1DHistogramVisualizer.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis1d/P1DHistogramVisualizer.java index 39966319..7aee8108 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis1d/P1DHistogramVisualizer.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis1d/P1DHistogramVisualizer.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.vis1d; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.ArrayList; import java.util.Iterator; @@ -52,11 +53,12 @@ import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameteriz import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Flag; import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.IntParameter; import de.lmu.ifi.dbs.elki.utilities.pairs.Pair; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; import de.lmu.ifi.dbs.elki.visualization.colors.ColorLibrary; import de.lmu.ifi.dbs.elki.visualization.css.CSSClass; import de.lmu.ifi.dbs.elki.visualization.css.CSSClassManager.CSSNamingConflict; import de.lmu.ifi.dbs.elki.visualization.projections.Projection; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection1D; +import de.lmu.ifi.dbs.elki.visualization.projector.HistogramProjector; import de.lmu.ifi.dbs.elki.visualization.scales.LinearScale; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; import de.lmu.ifi.dbs.elki.visualization.svg.SVGPath; @@ -65,8 +67,6 @@ import de.lmu.ifi.dbs.elki.visualization.svg.SVGSimpleLinearAxis; import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil; /** * Generates a SVG-Element containing a histogram representing the distribution @@ -84,17 +84,17 @@ public class P1DHistogramVisualizer<NV extends NumberVector<NV, ?>> extends P1DV /** * Name for this visualizer. */ - private static final String NAME = "Projection Histograms"; + private static final String NAME = "Histogram"; /** - * Generic tag to indicate the type of element. Used in IDs, CSS-Classes etc. + * Name for this visualizer. */ - public static final String BIN = "bin"; + private static final String CNAME = "Cluster Histograms"; /** - * The clustering we use for colorization + * Generic tag to indicate the type of element. Used in IDs, CSS-Classes etc. */ - protected static final String KEY_CLUSTERING = "clustering"; + public static final String BIN = "bin"; /** * Internal storage of the curves flag. @@ -128,7 +128,7 @@ public class P1DHistogramVisualizer<NV extends NumberVector<NV, ?>> extends P1DV this.curves = curves; this.bins = bins; this.relation = task.getRelation(); - this.clustering = task.getGenerics(KEY_CLUSTERING, Clustering.class); + this.clustering = task.getResult(); } @Override @@ -377,37 +377,40 @@ public class P1DHistogramVisualizer<NV extends NumberVector<NV, ?>> extends P1DV @Override public void processNewResult(HierarchicalResult baseResult, Result result) { - Iterator<Relation<? extends NumberVector<?, ?>>> rels = VisualizerUtil.iterateVectorFieldRepresentations(result); - for(Relation<? extends NumberVector<?, ?>> rel : IterableUtil.fromIterator(rels)) { - // register self - final VisualizationTask task = new VisualizationTask(NAME, rel, rel, this, P1DHistogramVisualizer.class); - task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_DATA); - baseResult.getHierarchy().add(rel, task); - } + // Cluster histograms ArrayList<Clustering<?>> clusterings = ResultUtil.filterResults(result, Clustering.class); for(Clustering<?> c : clusterings) { - Iterator<Relation<? extends NumberVector<?, ?>>> rels2 = VisualizerUtil.iterateVectorFieldRepresentations(baseResult); - for(Relation<? extends NumberVector<?, ?>> rel2 : IterableUtil.fromIterator(rels2)) { + Iterator<HistogramProjector<?>> ps = ResultUtil.filteredResults(baseResult, HistogramProjector.class); + for(HistogramProjector<?> p : IterableUtil.fromIterator(ps)) { // register self - final VisualizationTask task = new VisualizationTask(NAME, rel2, rel2, this, P1DHistogramVisualizer.class); + final VisualizationTask task = new VisualizationTask(CNAME, c, p.getRelation(), this); task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_DATA); - task.put(KEY_CLUSTERING, c); baseResult.getHierarchy().add(c, task); + baseResult.getHierarchy().add(p, task); + } + } + // General data distribution + { + Iterator<HistogramProjector<?>> ps = ResultUtil.filteredResults(result, HistogramProjector.class); + for(HistogramProjector<?> p : IterableUtil.fromIterator(ps)) { + // register self + final VisualizationTask task = new VisualizationTask(NAME, null, p.getRelation(), this); + task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_DATA); + if(clusterings.size() > 0) { + task.put(VisualizationTask.META_VISIBLE_DEFAULT, false); + } + // baseResult.getHierarchy().add(p.getRelation(), task); + baseResult.getHierarchy().add(p, task); } } } @Override - public boolean allowThumbnails(@SuppressWarnings("unused") VisualizationTask task) { + public boolean allowThumbnails(VisualizationTask task) { // Don't use thumbnails return false; } - @Override - public Class<? extends Projection> getProjectionType() { - return Projection1D.class; - } - /** * Parameterization class. * diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis1d/P1DVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis1d/P1DVisualization.java index b62afd5c..721d3432 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis1d/P1DVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis1d/P1DVisualization.java @@ -1,30 +1,31 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.vis1d; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; import de.lmu.ifi.dbs.elki.visualization.projections.Projection1D; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; /** * One-dimensional projected visualization. diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/TooltipVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/AbstractTooltipVisualization.java index b490e836..9b8d19b6 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/TooltipVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/AbstractTooltipVisualization.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import org.apache.batik.util.SVGConstants; import org.w3c.dom.Element; @@ -34,10 +35,10 @@ import de.lmu.ifi.dbs.elki.database.datastore.DataStoreEvent; import de.lmu.ifi.dbs.elki.database.datastore.DataStoreListener; import de.lmu.ifi.dbs.elki.database.ids.DBID; import de.lmu.ifi.dbs.elki.logging.LoggingUtil; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot; import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; /** * General base class for a tooltip visualizer. @@ -47,7 +48,7 @@ import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; * @param <NV> Number Vector */ // TODO: can we improve performance by not adding as many hovers? -public abstract class TooltipVisualization<NV extends NumberVector<NV, ?>> extends P2DVisualization<NV> implements DataStoreListener { +public abstract class AbstractTooltipVisualization<NV extends NumberVector<NV, ?>> extends P2DVisualization<NV> implements DataStoreListener { /** * Generic tag to indicate the type of element. Used in IDs, CSS-Classes etc. */ @@ -68,7 +69,7 @@ public abstract class TooltipVisualization<NV extends NumberVector<NV, ?>> exten */ public static final String TOOLTIP_AREA = "tooltip_area"; - public TooltipVisualization(VisualizationTask task) { + public AbstractTooltipVisualization(VisualizationTask task) { super(task); context.addDataStoreListener(this); } @@ -92,8 +93,8 @@ public abstract class TooltipVisualization<NV extends NumberVector<NV, ?>> exten } }; - for(DBID id : rep.iterDBIDs()) { - double[] v = proj.fastProjectDataToRenderSpace(rep.get(id)); + for(DBID id : rel.iterDBIDs()) { + double[] v = proj.fastProjectDataToRenderSpace(rel.get(id)); Element tooltip = makeTooltip(id, v[0], v[1], dotsize); SVGUtil.addCSSClass(tooltip, TOOLTIP_HIDDEN); diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/AxisVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/AxisVisualization.java index cd95fb67..4e927ace 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/AxisVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/AxisVisualization.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.Iterator; @@ -28,23 +29,22 @@ import org.apache.batik.util.SVGConstants; import org.w3c.dom.Element; import de.lmu.ifi.dbs.elki.data.NumberVector; -import de.lmu.ifi.dbs.elki.database.relation.Relation; import de.lmu.ifi.dbs.elki.math.linearalgebra.Vector; import de.lmu.ifi.dbs.elki.result.HierarchicalResult; import de.lmu.ifi.dbs.elki.result.Result; +import de.lmu.ifi.dbs.elki.result.ResultUtil; import de.lmu.ifi.dbs.elki.utilities.DatabaseUtil; import de.lmu.ifi.dbs.elki.utilities.iterator.IterableUtil; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; import de.lmu.ifi.dbs.elki.visualization.css.CSSClass; import de.lmu.ifi.dbs.elki.visualization.css.CSSClassManager.CSSNamingConflict; import de.lmu.ifi.dbs.elki.visualization.projections.Projection; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection2D; +import de.lmu.ifi.dbs.elki.visualization.projector.ScatterPlotProjector; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; import de.lmu.ifi.dbs.elki.visualization.svg.SVGSimpleLinearAxis; import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil; /** * Generates a SVG-Element containing axes, including labeling. @@ -68,7 +68,7 @@ public class AxisVisualization<NV extends NumberVector<NV, ?>> extends P2DVisual @Override protected void redraw() { - int dim = DatabaseUtil.dimensionality(rep); + int dim = DatabaseUtil.dimensionality(rel); // origin double[] orig = proj.fastProjectScaledToRender(new Vector(dim)); @@ -106,7 +106,7 @@ public class AxisVisualization<NV extends NumberVector<NV, ?>> extends P2DVisual // TODO: move axis labeling into drawAxis function. double offx = (righthand ? 1 : -1) * 0.02 * Projection.SCALE; double offy = (righthand ? 1 : -1) * 0.02 * Projection.SCALE; - Element label = svgp.svgText(ax[0] + offx, ax[1] + offy, "Dim. " + SVGUtil.fmt(d + 1)); + Element label = svgp.svgText(ax[0] + offx, ax[1] + offy, DatabaseUtil.getColumnLabel(rel, d + 1)); SVGUtil.setAtt(label, SVGConstants.SVG_STYLE_ATTRIBUTE, alcls.inlineCSS()); SVGUtil.setAtt(label, SVGConstants.SVG_TEXT_ANCHOR_ATTRIBUTE, righthand ? SVGConstants.SVG_START_VALUE : SVGConstants.SVG_END_VALUE); layer.appendChild(label); @@ -149,11 +149,11 @@ public class AxisVisualization<NV extends NumberVector<NV, ?>> extends P2DVisual @Override public void processNewResult(HierarchicalResult baseResult, Result result) { - Iterator<Relation<? extends NumberVector<?, ?>>> reps = VisualizerUtil.iterateVectorFieldRepresentations(result); - for(Relation<? extends NumberVector<?, ?>> rel : IterableUtil.fromIterator(reps)) { - final VisualizationTask task = new VisualizationTask(NAME, rel, rel, this, P2DVisualization.class); + Iterator<ScatterPlotProjector<?>> ps = ResultUtil.filteredResults(result, ScatterPlotProjector.class); + for(ScatterPlotProjector<?> p : IterableUtil.fromIterator(ps)) { + final VisualizationTask task = new VisualizationTask(NAME, p, p.getRelation(), this); task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_BACKGROUND); - baseResult.getHierarchy().add(rel, task); + baseResult.getHierarchy().add(p, task); } } @@ -162,10 +162,5 @@ public class AxisVisualization<NV extends NumberVector<NV, ?>> extends P2DVisual // Don't use thumbnails return false; } - - @Override - public Class<? extends Projection> getProjectionType() { - return Projection2D.class; - } } }
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/BubbleVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/BubbleVisualization.java index 843dd39e..3d183a88 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/BubbleVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/BubbleVisualization.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.Iterator; import java.util.List; @@ -35,7 +36,6 @@ import de.lmu.ifi.dbs.elki.data.model.Model; import de.lmu.ifi.dbs.elki.database.datastore.DataStoreEvent; import de.lmu.ifi.dbs.elki.database.datastore.DataStoreListener; import de.lmu.ifi.dbs.elki.database.ids.DBID; -import de.lmu.ifi.dbs.elki.database.relation.Relation; import de.lmu.ifi.dbs.elki.result.HierarchicalResult; import de.lmu.ifi.dbs.elki.result.Result; import de.lmu.ifi.dbs.elki.result.ResultUtil; @@ -49,17 +49,15 @@ import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Flag; import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.ObjectParameter; import de.lmu.ifi.dbs.elki.utilities.scaling.ScalingFunction; import de.lmu.ifi.dbs.elki.utilities.scaling.outlier.OutlierScalingFunction; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; import de.lmu.ifi.dbs.elki.visualization.colors.ColorLibrary; import de.lmu.ifi.dbs.elki.visualization.css.CSSClass; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection2D; +import de.lmu.ifi.dbs.elki.visualization.projector.ScatterPlotProjector; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot; import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil; /** * Generates a SVG-Element containing bubbles. A Bubble is a circle visualizing @@ -133,7 +131,7 @@ public class BubbleVisualization<NV extends NumberVector<NV, ?>> extends P2DVisu for(DBID objId : clus.getIDs()) { final Double radius = getScaledForId(objId); if(radius > 0.01) { - final NV vec = rep.get(objId); + final NV vec = rel.get(objId); if(vec != null) { double[] v = proj.fastProjectDataToRenderSpace(vec); Element circle = svgp.svgCircle(v[0], v[1], radius * bubble_size); @@ -146,7 +144,7 @@ public class BubbleVisualization<NV extends NumberVector<NV, ?>> extends P2DVisu } @Override - public void contentChanged(@SuppressWarnings("unused") DataStoreEvent e) { + public void contentChanged(DataStoreEvent e) { synchronizedRedraw(); } @@ -273,22 +271,30 @@ public class BubbleVisualization<NV extends NumberVector<NV, ?>> extends P2DVisu @Override public void processNewResult(HierarchicalResult baseResult, Result result) { - Iterator<Relation<? extends NumberVector<?, ?>>> reps = VisualizerUtil.iterateVectorFieldRepresentations(baseResult); - for(Relation<? extends NumberVector<?, ?>> rep : IterableUtil.fromIterator(reps)) { - List<OutlierResult> ors = ResultUtil.filterResults(result, OutlierResult.class); - for(OutlierResult o : ors) { - final VisualizationTask task = new VisualizationTask(NAME, o, rep, this, P2DVisualization.class); + List<OutlierResult> ors = ResultUtil.filterResults(result, OutlierResult.class); + for(OutlierResult o : ors) { + Iterator<ScatterPlotProjector<?>> ps = ResultUtil.filteredResults(baseResult, ScatterPlotProjector.class); + boolean vis = true; + // Quick and dirty hack: hide if parent result is also an outlier result + // Since that probably is already visible and we're redundant. + for(Result r : o.getHierarchy().getParents(o)) { + if(r instanceof OutlierResult) { + vis = false; + break; + } + } + for(ScatterPlotProjector<?> p : IterableUtil.fromIterator(ps)) { + final VisualizationTask task = new VisualizationTask(NAME, o, p.getRelation(), this); task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_DATA); + if(!vis) { + task.put(VisualizationTask.META_VISIBLE_DEFAULT, false); + } baseResult.getHierarchy().add(o, task); + baseResult.getHierarchy().add(p, task); } } } - @Override - public Class<? extends Projection> getProjectionType() { - return Projection2D.class; - } - /** * Parameterization class. * diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/ClusterConvexHullVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/ClusterConvexHullVisualization.java index f310c4be..0b97986b 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/ClusterConvexHullVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/ClusterConvexHullVisualization.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d;
-/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +
+/*
+ This file is part of ELKI:
+ Environment for Developing KDD-Applications Supported by Index-Structures +
+ Copyright (C) 2011
+ Ludwig-Maximilians-Universität München
+ Lehr- und Forschungseinheit für Datenbanksysteme
+ ELKI Development Team +
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 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 Affero General Public License for more details. +
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
import java.util.Collection;
import java.util.Iterator;
@@ -36,7 +37,6 @@ import de.lmu.ifi.dbs.elki.data.spatial.Polygon; import de.lmu.ifi.dbs.elki.data.spatial.SpatialUtil;
import de.lmu.ifi.dbs.elki.database.ids.DBID;
import de.lmu.ifi.dbs.elki.database.ids.DBIDs;
-import de.lmu.ifi.dbs.elki.database.relation.Relation;
import de.lmu.ifi.dbs.elki.math.ConvexHull2D;
import de.lmu.ifi.dbs.elki.math.DoubleMinMax;
import de.lmu.ifi.dbs.elki.math.linearalgebra.Vector;
@@ -45,18 +45,16 @@ import de.lmu.ifi.dbs.elki.result.Result; import de.lmu.ifi.dbs.elki.result.ResultUtil;
import de.lmu.ifi.dbs.elki.utilities.iterator.IterableUtil;
import de.lmu.ifi.dbs.elki.utilities.pairs.Pair;
+import de.lmu.ifi.dbs.elki.visualization.VisualizationTask;
import de.lmu.ifi.dbs.elki.visualization.colors.ColorLibrary;
import de.lmu.ifi.dbs.elki.visualization.css.CSSClass;
-import de.lmu.ifi.dbs.elki.visualization.projections.Projection;
-import de.lmu.ifi.dbs.elki.visualization.projections.Projection2D;
+import de.lmu.ifi.dbs.elki.visualization.projector.ScatterPlotProjector;
import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary;
import de.lmu.ifi.dbs.elki.visualization.svg.SVGPath;
import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot;
import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil;
import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory;
import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization;
-import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask;
-import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil;
/**
* Visualizer for generating an SVG-Element containing the convex hull of each
@@ -119,7 +117,7 @@ public class ClusterConvexHullVisualization<NV extends NumberVector<NV, ?>> exte ConvexHull2D hull = new ConvexHull2D();
for(DBID clpnum : ids) {
- double[] projP = proj.fastProjectDataToRenderSpace(rep.get(clpnum).getColumnVector());
+ double[] projP = proj.fastProjectDataToRenderSpace(rel.get(clpnum).getColumnVector());
hull.add(new Vector(projP));
}
Polygon chres = hull.getHull();
@@ -130,7 +128,7 @@ public class ClusterConvexHullVisualization<NV extends NumberVector<NV, ?>> exte // Approximate area (using bounding box)
double hullarea = SpatialUtil.volume(chres);
final double relativeArea = (projarea - hullarea) / projarea;
- final double relativeSize = (double) ids.size() / rep.size();
+ final double relativeSize = (double) ids.size() / rel.size();
opacity = Math.sqrt(relativeSize * relativeArea);
hulls = path.makeElement(svgp);
@@ -192,22 +190,18 @@ public class ClusterConvexHullVisualization<NV extends NumberVector<NV, ?>> exte @Override
public void processNewResult(HierarchicalResult baseResult, Result result) {
- Iterator<Relation<? extends NumberVector<?, ?>>> reps = VisualizerUtil.iterateVectorFieldRepresentations(baseResult);
- for(Relation<? extends NumberVector<?, ?>> rep : IterableUtil.fromIterator(reps)) {
- // Find clusterings we can visualize:
- Collection<Clustering<?>> clusterings = ResultUtil.filterResults(result, Clustering.class);
- for(Clustering<?> c : clusterings) {
- final VisualizationTask task = new VisualizationTask(NAME, c, rep, this, P2DVisualization.class);
+ // Find clusterings we can visualize:
+ Collection<Clustering<?>> clusterings = ResultUtil.filterResults(result, Clustering.class);
+ for(Clustering<?> c : clusterings) {
+ Iterator<ScatterPlotProjector<?>> ps = ResultUtil.filteredResults(baseResult, ScatterPlotProjector.class);
+ for(ScatterPlotProjector<?> p : IterableUtil.fromIterator(ps)) {
+ final VisualizationTask task = new VisualizationTask(NAME, c, p.getRelation(), this);
task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_DATA - 1);
task.put(VisualizationTask.META_VISIBLE_DEFAULT, false);
baseResult.getHierarchy().add(c, task);
+ baseResult.getHierarchy().add(p, task);
}
}
}
-
- @Override
- public Class<? extends Projection> getProjectionType() {
- return Projection2D.class;
- }
}
}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/ClusterMeanVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/ClusterMeanVisualization.java index 0f00dca3..d1f1712d 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/ClusterMeanVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/ClusterMeanVisualization.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d;
-/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +
+/*
+ This file is part of ELKI:
+ Environment for Developing KDD-Applications Supported by Index-Structures +
+ Copyright (C) 2011
+ Ludwig-Maximilians-Universität München
+ Lehr- und Forschungseinheit für Datenbanksysteme
+ ELKI Development Team +
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 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 Affero General Public License for more details. +
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
import java.util.Collection;
import java.util.Iterator;
@@ -32,22 +33,19 @@ import de.lmu.ifi.dbs.elki.data.Cluster; import de.lmu.ifi.dbs.elki.data.Clustering;
import de.lmu.ifi.dbs.elki.data.NumberVector;
import de.lmu.ifi.dbs.elki.data.model.MeanModel;
-import de.lmu.ifi.dbs.elki.database.relation.Relation;
import de.lmu.ifi.dbs.elki.result.HierarchicalResult;
import de.lmu.ifi.dbs.elki.result.Result;
import de.lmu.ifi.dbs.elki.result.ResultUtil;
import de.lmu.ifi.dbs.elki.utilities.iterator.IterableUtil;
+import de.lmu.ifi.dbs.elki.visualization.VisualizationTask;
import de.lmu.ifi.dbs.elki.visualization.css.CSSClass;
-import de.lmu.ifi.dbs.elki.visualization.projections.Projection;
-import de.lmu.ifi.dbs.elki.visualization.projections.Projection2D;
+import de.lmu.ifi.dbs.elki.visualization.projector.ScatterPlotProjector;
import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary;
import de.lmu.ifi.dbs.elki.visualization.style.marker.MarkerLibrary;
import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot;
import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil;
import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory;
import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization;
-import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask;
-import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil;
/**
* Visualize the mean of a KMeans-Clustering
@@ -158,18 +156,19 @@ public class ClusterMeanVisualization<NV extends NumberVector<NV, ?>> extends P2 @Override
public void processNewResult(HierarchicalResult baseResult, Result result) {
- Iterator<Relation<? extends NumberVector<?, ?>>> reps = VisualizerUtil.iterateVectorFieldRepresentations(baseResult);
- for(Relation<? extends NumberVector<?, ?>> rep : IterableUtil.fromIterator(reps)) {
- // Find clusterings we can visualize:
- Collection<Clustering<?>> clusterings = ResultUtil.filterResults(result, Clustering.class);
- for(Clustering<?> c : clusterings) {
- if(c.getAllClusters().size() > 0) {
- // Does the cluster have a model with cluster means?
- Clustering<MeanModel<NV>> mcls = findMeanModel(c);
- if(mcls != null) {
- final VisualizationTask task = new VisualizationTask(NAME, c, rep, this, P2DVisualization.class);
+ // Find clusterings we can visualize:
+ Collection<Clustering<?>> clusterings = ResultUtil.filterResults(result, Clustering.class);
+ for(Clustering<?> c : clusterings) {
+ if(c.getAllClusters().size() > 0) {
+ // Does the cluster have a model with cluster means?
+ Clustering<MeanModel<NV>> mcls = findMeanModel(c);
+ if(mcls != null) {
+ Iterator<ScatterPlotProjector<?>> ps = ResultUtil.filteredResults(baseResult, ScatterPlotProjector.class);
+ for(ScatterPlotProjector<?> p : IterableUtil.fromIterator(ps)) {
+ final VisualizationTask task = new VisualizationTask(NAME, c, p.getRelation(), this);
task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_DATA + 1);
baseResult.getHierarchy().add(c, task);
+ baseResult.getHierarchy().add(p, task);
}
}
}
@@ -190,10 +189,5 @@ public class ClusterMeanVisualization<NV extends NumberVector<NV, ?>> extends P2 }
return null;
}
-
- @Override
- public Class<? extends Projection> getProjectionType() {
- return Projection2D.class;
- }
}
}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/ClusterOrderVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/ClusterOrderVisualization.java index 05a2d1f3..644083f9 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/ClusterOrderVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/ClusterOrderVisualization.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.Collection; import java.util.Iterator; @@ -31,7 +32,6 @@ import de.lmu.ifi.dbs.elki.data.NumberVector; import de.lmu.ifi.dbs.elki.database.datastore.DataStoreEvent; import de.lmu.ifi.dbs.elki.database.datastore.DataStoreListener; import de.lmu.ifi.dbs.elki.database.ids.DBID; -import de.lmu.ifi.dbs.elki.database.relation.Relation; import de.lmu.ifi.dbs.elki.distance.distancevalue.DoubleDistance; import de.lmu.ifi.dbs.elki.result.HierarchicalResult; import de.lmu.ifi.dbs.elki.result.Result; @@ -39,15 +39,13 @@ import de.lmu.ifi.dbs.elki.result.ResultUtil; import de.lmu.ifi.dbs.elki.result.optics.ClusterOrderEntry; import de.lmu.ifi.dbs.elki.result.optics.ClusterOrderResult; import de.lmu.ifi.dbs.elki.utilities.iterator.IterableUtil; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; import de.lmu.ifi.dbs.elki.visualization.css.CSSClass; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection2D; +import de.lmu.ifi.dbs.elki.visualization.projector.ScatterPlotProjector; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil; /** * Cluster order visualizer. @@ -99,8 +97,8 @@ public class ClusterOrderVisualization<NV extends NumberVector<NV, ?>> extends P if(thisId == null || prevId == null) { continue; } - double[] thisVec = proj.fastProjectDataToRenderSpace(rep.get(thisId)); - double[] prevVec = proj.fastProjectDataToRenderSpace(rep.get(prevId)); + double[] thisVec = proj.fastProjectDataToRenderSpace(rel.get(thisId)); + double[] prevVec = proj.fastProjectDataToRenderSpace(rel.get(prevId)); Element arrow = svgp.svgLine(prevVec[0], prevVec[1], thisVec[0], thisVec[1]); SVGUtil.setCSSClass(arrow, cls.getName()); @@ -140,21 +138,17 @@ public class ClusterOrderVisualization<NV extends NumberVector<NV, ?>> extends P @Override public void processNewResult(HierarchicalResult baseResult, Result result) { - Iterator<Relation<? extends NumberVector<?, ?>>> reps = VisualizerUtil.iterateVectorFieldRepresentations(baseResult); - for(Relation<? extends NumberVector<?, ?>> rep : IterableUtil.fromIterator(reps)) { - Collection<ClusterOrderResult<DoubleDistance>> cos = ResultUtil.filterResults(result, ClusterOrderResult.class); - for(ClusterOrderResult<DoubleDistance> co : cos) { - final VisualizationTask task = new VisualizationTask(NAME, co, rep, this, P2DVisualization.class); + Collection<ClusterOrderResult<DoubleDistance>> cos = ResultUtil.filterResults(result, ClusterOrderResult.class); + for(ClusterOrderResult<DoubleDistance> co : cos) { + Iterator<ScatterPlotProjector<?>> ps = ResultUtil.filteredResults(baseResult, ScatterPlotProjector.class); + for(ScatterPlotProjector<?> p : IterableUtil.fromIterator(ps)) { + final VisualizationTask task = new VisualizationTask(NAME, co, p.getRelation(), this); task.put(VisualizationTask.META_VISIBLE_DEFAULT, false); task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_DATA - 1); baseResult.getHierarchy().add(co, task); + baseResult.getHierarchy().add(p, task); } } } - - @Override - public Class<? extends Projection> getProjectionType() { - return Projection2D.class; - } } }
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/ClusteringVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/ClusteringVisualization.java index 7f487418..58f71ef3 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/ClusteringVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/ClusteringVisualization.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.Collection; import java.util.Iterator; @@ -32,20 +33,17 @@ import de.lmu.ifi.dbs.elki.data.model.Model; import de.lmu.ifi.dbs.elki.database.datastore.DataStoreEvent; import de.lmu.ifi.dbs.elki.database.datastore.DataStoreListener; import de.lmu.ifi.dbs.elki.database.ids.DBID; -import de.lmu.ifi.dbs.elki.database.relation.Relation; import de.lmu.ifi.dbs.elki.result.HierarchicalResult; import de.lmu.ifi.dbs.elki.result.Result; import de.lmu.ifi.dbs.elki.result.ResultUtil; import de.lmu.ifi.dbs.elki.utilities.exceptions.ObjectNotFoundException; import de.lmu.ifi.dbs.elki.utilities.iterator.IterableUtil; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection2D; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; +import de.lmu.ifi.dbs.elki.visualization.projector.ScatterPlotProjector; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; import de.lmu.ifi.dbs.elki.visualization.style.marker.MarkerLibrary; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil; /** * Visualize a clustering using different markers for different clusters. @@ -91,7 +89,7 @@ public class ClusteringVisualization<NV extends NumberVector<NV, ?>> extends P2D Cluster<?> clus = ci.next(); for(DBID objId : clus.getIDs()) { try { - final NV vec = rep.get(objId); + final NV vec = rel.get(objId); double[] v = proj.fastProjectDataToRenderSpace(vec); ml.useMarker(svgp, layer, v[0], v[1], cnum, marker_size); } @@ -138,23 +136,19 @@ public class ClusteringVisualization<NV extends NumberVector<NV, ?>> extends P2D @Override public void processNewResult(HierarchicalResult baseResult, Result result) { - Iterator<Relation<? extends NumberVector<?, ?>>> reps = VisualizerUtil.iterateVectorFieldRepresentations(baseResult); - for(Relation<? extends NumberVector<?, ?>> rep : IterableUtil.fromIterator(reps)) { - // Find clusterings we can visualize: - Collection<Clustering<?>> clusterings = ResultUtil.filterResults(result, Clustering.class); - for(Clustering<?> c : clusterings) { - if(c.getAllClusters().size() > 0) { - final VisualizationTask task = new VisualizationTask(NAME, c, rep, this, P2DVisualization.class); + // Find clusterings we can visualize: + Collection<Clustering<?>> clusterings = ResultUtil.filterResults(result, Clustering.class); + for(Clustering<?> c : clusterings) { + if(c.getAllClusters().size() > 0) { + Iterator<ScatterPlotProjector<?>> ps = ResultUtil.filteredResults(baseResult, ScatterPlotProjector.class); + for(ScatterPlotProjector<?> p : IterableUtil.fromIterator(ps)) { + final VisualizationTask task = new VisualizationTask(NAME, c, p.getRelation(), this); task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_DATA); baseResult.getHierarchy().add(c, task); + baseResult.getHierarchy().add(p, task); } } } } - - @Override - public Class<? extends Projection> getProjectionType() { - return Projection2D.class; - } } }
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/DotVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/DotVisualization.java index 69f6a381..3cfd5a48 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/DotVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/DotVisualization.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.ArrayList; import java.util.Iterator; @@ -32,20 +33,17 @@ import de.lmu.ifi.dbs.elki.data.NumberVector; import de.lmu.ifi.dbs.elki.database.datastore.DataStoreEvent; import de.lmu.ifi.dbs.elki.database.datastore.DataStoreListener; import de.lmu.ifi.dbs.elki.database.ids.DBID; -import de.lmu.ifi.dbs.elki.database.relation.Relation; import de.lmu.ifi.dbs.elki.result.HierarchicalResult; import de.lmu.ifi.dbs.elki.result.Result; import de.lmu.ifi.dbs.elki.result.ResultUtil; import de.lmu.ifi.dbs.elki.utilities.exceptions.ObjectNotFoundException; import de.lmu.ifi.dbs.elki.utilities.iterator.IterableUtil; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection2D; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; +import de.lmu.ifi.dbs.elki.visualization.projector.ScatterPlotProjector; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil; /** * Generates a SVG-Element containing "dots" as markers representing the @@ -89,9 +87,9 @@ public class DotVisualization<NV extends NumberVector<NV, ?>> extends P2DVisuali public void redraw() { // draw data double dot_size = context.getStyleLibrary().getSize(StyleLibrary.DOTPLOT); - for(DBID id : rep.iterDBIDs()) { + for(DBID id : rel.iterDBIDs()) { try { - double[] v = proj.fastProjectDataToRenderSpace(rep.get(id)); + double[] v = proj.fastProjectDataToRenderSpace(rel.get(id)); Element dot = svgp.svgCircle(v[0], v[1], dot_size); SVGUtil.addCSSClass(dot, MARKER); layer.appendChild(dot); @@ -104,7 +102,7 @@ public class DotVisualization<NV extends NumberVector<NV, ?>> extends P2DVisuali } @Override - public void contentChanged(@SuppressWarnings("unused") DataStoreEvent e) { + public void contentChanged(DataStoreEvent e) { synchronizedRedraw(); } @@ -137,20 +135,16 @@ public class DotVisualization<NV extends NumberVector<NV, ?>> extends P2DVisuali ArrayList<Clustering<?>> cs = ResultUtil.filterResults(result, Clustering.class); boolean hasClustering = (cs.size() > 0); - Iterator<Relation<? extends NumberVector<?, ?>>> reps = VisualizerUtil.iterateVectorFieldRepresentations(result); - for(Relation<? extends NumberVector<?, ?>> rep : IterableUtil.fromIterator(reps)) { - final VisualizationTask task = new VisualizationTask(NAME, rep, rep, this, P2DVisualization.class); + Iterator<ScatterPlotProjector<?>> ps = ResultUtil.filteredResults(result, ScatterPlotProjector.class); + for(ScatterPlotProjector<?> p : IterableUtil.fromIterator(ps)) { + final VisualizationTask task = new VisualizationTask(NAME, p.getRelation(), p.getRelation(), this); task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_DATA + 1); if(hasClustering) { task.put(VisualizationTask.META_VISIBLE_DEFAULT, false); } - baseResult.getHierarchy().add(rep, task); + // baseResult.getHierarchy().add(p.getRelation(), task); + baseResult.getHierarchy().add(p, task); } } - - @Override - public Class<? extends Projection> getProjectionType() { - return Projection2D.class; - } } }
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/EMClusterVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/EMClusterVisualization.java index ee022c8b..f62ff1a6 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/EMClusterVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/EMClusterVisualization.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.ArrayList; import java.util.Collection; @@ -37,7 +38,6 @@ import de.lmu.ifi.dbs.elki.data.model.MeanModel; import de.lmu.ifi.dbs.elki.data.model.Model; import de.lmu.ifi.dbs.elki.data.spatial.Polygon; import de.lmu.ifi.dbs.elki.database.ids.DBIDs; -import de.lmu.ifi.dbs.elki.database.relation.Relation; import de.lmu.ifi.dbs.elki.logging.LoggingUtil; import de.lmu.ifi.dbs.elki.math.ConvexHull2D; import de.lmu.ifi.dbs.elki.math.MathUtil; @@ -52,18 +52,16 @@ import de.lmu.ifi.dbs.elki.result.ResultUtil; import de.lmu.ifi.dbs.elki.utilities.ClassGenericsUtil; import de.lmu.ifi.dbs.elki.utilities.iterator.IterableUtil; import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.EmptyParameterization; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; import de.lmu.ifi.dbs.elki.visualization.colors.ColorLibrary; import de.lmu.ifi.dbs.elki.visualization.css.CSSClass; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection2D; +import de.lmu.ifi.dbs.elki.visualization.projector.ScatterPlotProjector; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; import de.lmu.ifi.dbs.elki.visualization.svg.SVGHyperSphere; import de.lmu.ifi.dbs.elki.visualization.svg.SVGPath; import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot; import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil; /** * Visualizer for generating SVG-Elements containing ellipses for first, second @@ -184,7 +182,7 @@ public class EMClusterVisualization<NV extends NumberVector<NV, ?>> extends P2DV SVGUtil.addCSSClass(ellipse, EMBORDER + cnum); if(opacStyle == 1) { CSSClass cls = new CSSClass(null, "temp"); - double s = (i > 1 && i <= sigma.length) ? sigma[i - 1] : 0.0; + double s = (i >= 1 && i <= sigma.length) ? sigma[i - 1] : 0.0; cls.setStatement(SVGConstants.CSS_FILL_OPACITY_PROPERTY, s); SVGUtil.setAtt(ellipse, SVGConstants.SVG_STYLE_ATTRIBUTE, cls.inlineCSS()); } @@ -206,7 +204,7 @@ public class EMClusterVisualization<NV extends NumberVector<NV, ?>> extends P2DV SVGUtil.addCSSClass(ellipse, EMBORDER + cnum); if(opacStyle == 1) { CSSClass cls = new CSSClass(null, "temp"); - double s = (i > 1 && i <= sigma.length) ? sigma[i - 1] : 0.0; + double s = (i >= 1 && i <= sigma.length) ? sigma[i - 1] : 0.0; cls.setStatement(SVGConstants.CSS_FILL_OPACITY_PROPERTY, s); SVGUtil.setAtt(ellipse, SVGConstants.SVG_STYLE_ATTRIBUTE, cls.inlineCSS()); } @@ -309,7 +307,7 @@ public class EMClusterVisualization<NV extends NumberVector<NV, ?>> extends P2DV SVGUtil.addCSSClass(ellipse, EMBORDER + cnum); if(opacStyle == 1) { CSSClass cls = new CSSClass(null, "temp"); - double s = (i > 1 && i <= sigma.length) ? sigma[i - 1] : 0.0; + double s = (i >= 1 && i <= sigma.length) ? sigma[i - 1] : 0.0; cls.setStatement(SVGConstants.CSS_FILL_OPACITY_PROPERTY, s); SVGUtil.setAtt(ellipse, SVGConstants.SVG_STYLE_ATTRIBUTE, cls.inlineCSS()); } @@ -435,18 +433,19 @@ public class EMClusterVisualization<NV extends NumberVector<NV, ?>> extends P2DV @Override public void processNewResult(HierarchicalResult baseResult, Result result) { - Iterator<Relation<? extends NumberVector<?, ?>>> reps = VisualizerUtil.iterateVectorFieldRepresentations(baseResult); - for(Relation<? extends NumberVector<?, ?>> rep : IterableUtil.fromIterator(reps)) { - // Find clusterings we can visualize: - Collection<Clustering<?>> clusterings = ResultUtil.filterResults(result, Clustering.class); - for(Clustering<?> c : clusterings) { - if(c.getAllClusters().size() > 0) { - // Does the cluster have a model with cluster means? - Clustering<MeanModel<NV>> mcls = findMeanModel(c); - if(mcls != null) { - final VisualizationTask task = new VisualizationTask(NAME, c, rep, this, P2DVisualization.class); + // Find clusterings we can visualize: + Collection<Clustering<?>> clusterings = ResultUtil.filterResults(result, Clustering.class); + for(Clustering<?> c : clusterings) { + if(c.getAllClusters().size() > 0) { + // Does the cluster have a model with cluster means? + Clustering<MeanModel<NV>> mcls = findMeanModel(c); + if(mcls != null) { + Iterator<ScatterPlotProjector<?>> ps = ResultUtil.filteredResults(baseResult, ScatterPlotProjector.class); + for(ScatterPlotProjector<?> p : IterableUtil.fromIterator(ps)) { + final VisualizationTask task = new VisualizationTask(NAME, c, p.getRelation(), this); task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_DATA + 3); baseResult.getHierarchy().add(c, task); + baseResult.getHierarchy().add(p, task); } } } @@ -468,10 +467,5 @@ public class EMClusterVisualization<NV extends NumberVector<NV, ?>> extends P2DV } return null; } - - @Override - public Class<? extends Projection> getProjectionType() { - return Projection2D.class; - } } } diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/MoveObjectsToolVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/MoveObjectsToolVisualization.java index 2a77c656..66b442f9 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/MoveObjectsToolVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/MoveObjectsToolVisualization.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d;
-/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +
+/*
+ This file is part of ELKI:
+ Environment for Developing KDD-Applications Supported by Index-Structures +
+ Copyright (C) 2011
+ Ludwig-Maximilians-Universität München
+ Lehr- und Forschungseinheit für Datenbanksysteme
+ ELKI Development Team +
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 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 Affero General Public License for more details. +
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
import java.util.Iterator;
@@ -32,25 +33,22 @@ import org.w3c.dom.svg.SVGPoint; import de.lmu.ifi.dbs.elki.data.NumberVector;
import de.lmu.ifi.dbs.elki.database.UpdatableDatabase;
import de.lmu.ifi.dbs.elki.database.ids.DBIDs;
-import de.lmu.ifi.dbs.elki.database.relation.Relation;
import de.lmu.ifi.dbs.elki.math.linearalgebra.Vector;
import de.lmu.ifi.dbs.elki.result.HierarchicalResult;
import de.lmu.ifi.dbs.elki.result.Result;
import de.lmu.ifi.dbs.elki.result.ResultUtil;
import de.lmu.ifi.dbs.elki.utilities.exceptions.AbortException;
import de.lmu.ifi.dbs.elki.utilities.iterator.IterableUtil;
+import de.lmu.ifi.dbs.elki.visualization.VisualizationTask;
import de.lmu.ifi.dbs.elki.visualization.batikutil.DragableArea;
import de.lmu.ifi.dbs.elki.visualization.batikutil.DragableArea.DragListener;
import de.lmu.ifi.dbs.elki.visualization.css.CSSClass;
-import de.lmu.ifi.dbs.elki.visualization.projections.Projection;
-import de.lmu.ifi.dbs.elki.visualization.projections.Projection2D;
+import de.lmu.ifi.dbs.elki.visualization.projector.ScatterPlotProjector;
import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary;
import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot;
import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil;
import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory;
import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization;
-import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask;
-import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil;
import de.lmu.ifi.dbs.elki.visualization.visualizers.events.ContextChangedEvent;
/**
@@ -220,24 +218,20 @@ public class MoveObjectsToolVisualization<NV extends NumberVector<NV, ?>> extend @Override
public void processNewResult(HierarchicalResult baseResult, Result result) {
- Iterator<UpdatableDatabase> dbs = ResultUtil.filteredResults(baseResult, UpdatableDatabase.class);
+ Iterator<UpdatableDatabase> dbs = ResultUtil.filteredResults(result, UpdatableDatabase.class);
if(!dbs.hasNext()) {
return;
}
- Iterator<Relation<? extends NumberVector<?, ?>>> reps = VisualizerUtil.iterateVectorFieldRepresentations(result);
- for(Relation<? extends NumberVector<?, ?>> rep : IterableUtil.fromIterator(reps)) {
- final VisualizationTask task = new VisualizationTask(NAME, rep, rep, this, P2DVisualization.class);
+ Iterator<ScatterPlotProjector<?>> ps = ResultUtil.filteredResults(baseResult, ScatterPlotProjector.class);
+ for(ScatterPlotProjector<?> p : IterableUtil.fromIterator(ps)) {
+ final VisualizationTask task = new VisualizationTask(NAME, p.getRelation(), p.getRelation(), this);
task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_INTERACTIVE);
task.put(VisualizationTask.META_TOOL, true);
task.put(VisualizationTask.META_NOTHUMB, true);
task.put(VisualizationTask.META_NOEXPORT, true);
- baseResult.getHierarchy().add(rep, task);
+ // baseResult.getHierarchy().add(p.getRelation(), task);
+ baseResult.getHierarchy().add(p, task);
}
}
-
- @Override
- public Class<? extends Projection> getProjectionType() {
- return Projection2D.class;
- }
}
}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/P2DVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/P2DVisualization.java index d0ae559a..b6b4b418 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/P2DVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/P2DVisualization.java @@ -1,38 +1,39 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import org.apache.batik.util.SVGConstants; import org.w3c.dom.Element; import de.lmu.ifi.dbs.elki.data.NumberVector; import de.lmu.ifi.dbs.elki.database.relation.Relation; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; import de.lmu.ifi.dbs.elki.visualization.projections.Projection2D; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot; import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; /** * Default class to handle 2D projected visualizations. @@ -51,7 +52,7 @@ public abstract class P2DVisualization<NV extends NumberVector<?, ?>> extends Ab /** * The representation we visualize */ - final protected Relation<NV> rep; + final protected Relation<NV> rel; /** * Constructor. @@ -61,7 +62,7 @@ public abstract class P2DVisualization<NV extends NumberVector<?, ?>> extends Ab public P2DVisualization(VisualizationTask task) { super(task); this.proj = task.getProj(); - this.rep = task.getRelation(); + this.rel = task.getRelation(); final double margin = context.getStyleLibrary().getSize(StyleLibrary.MARGIN); this.layer = setupCanvas(svgp, proj, margin, task.getWidth(), task.getHeight()); } diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/PolygonVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/PolygonVisualization.java index 026a7729..b0f18666 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/PolygonVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/PolygonVisualization.java @@ -1,28 +1,30 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.ArrayList; +import java.util.Iterator; import org.apache.batik.util.SVGConstants; import org.w3c.dom.Element; @@ -40,16 +42,18 @@ import de.lmu.ifi.dbs.elki.math.linearalgebra.Vector; import de.lmu.ifi.dbs.elki.result.HierarchicalResult; import de.lmu.ifi.dbs.elki.result.Result; import de.lmu.ifi.dbs.elki.result.ResultUtil; +import de.lmu.ifi.dbs.elki.utilities.DatabaseUtil; import de.lmu.ifi.dbs.elki.utilities.exceptions.ObjectNotFoundException; +import de.lmu.ifi.dbs.elki.utilities.iterator.IterableUtil; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; import de.lmu.ifi.dbs.elki.visualization.css.CSSClass; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection; import de.lmu.ifi.dbs.elki.visualization.projections.Projection2D; +import de.lmu.ifi.dbs.elki.visualization.projector.ScatterPlotProjector; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; import de.lmu.ifi.dbs.elki.visualization.svg.SVGPath; import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; /** * Renders PolygonsObject in the data set. @@ -67,7 +71,7 @@ public class PolygonVisualization<V extends NumberVector<?, ?>> extends P2DVisua /** * Generic tag to indicate the type of element. Used in IDs, CSS-Classes etc. */ - public static final String MARKER = "polys"; + public static final String POLYS = "polys"; /** * The current projection @@ -87,7 +91,7 @@ public class PolygonVisualization<V extends NumberVector<?, ?>> extends P2DVisua public PolygonVisualization(VisualizationTask task) { super(task); this.proj = task.getProj(); - this.rep = task.getRelation(); + this.rep = task.getResult(); // Note: relation was used for projection context.addDataStoreListener(this); incrementalRedraw(); } @@ -100,9 +104,11 @@ public class PolygonVisualization<V extends NumberVector<?, ?>> extends P2DVisua @Override public void redraw() { - CSSClass css = new CSSClass(svgp, MARKER); - css.setStatement(SVGConstants.CSS_STROKE_WIDTH_PROPERTY, context.getStyleLibrary().getLineWidth(StyleLibrary.PLOT)); - css.setStatement(SVGConstants.CSS_STROKE_PROPERTY, context.getStyleLibrary().getColor(StyleLibrary.PLOT)); + CSSClass css = new CSSClass(svgp, POLYS); + // TODO: separate fill and line colors? + css.setStatement(SVGConstants.CSS_STROKE_WIDTH_PROPERTY, context.getStyleLibrary().getLineWidth(StyleLibrary.POLYGONS)); + css.setStatement(SVGConstants.CSS_STROKE_PROPERTY, context.getStyleLibrary().getColor(StyleLibrary.POLYGONS)); + css.setStatement(SVGConstants.CSS_FILL_PROPERTY, SVGConstants.CSS_NONE_VALUE); svgp.addCSSClassOrLogError(css); svgp.updateStyleElement(); @@ -129,7 +135,7 @@ public class PolygonVisualization<V extends NumberVector<?, ?>> extends P2DVisua path.drawTo(f[0], f[1]); } Element e = path.makeElement(svgp); - SVGUtil.addCSSClass(e, MARKER); + SVGUtil.addCSSClass(e, POLYS); layer.appendChild(e); } catch(ObjectNotFoundException e) { @@ -139,7 +145,7 @@ public class PolygonVisualization<V extends NumberVector<?, ?>> extends P2DVisua } @Override - public void contentChanged(@SuppressWarnings("unused") DataStoreEvent e) { + public void contentChanged(DataStoreEvent e) { synchronizedRedraw(); } @@ -169,16 +175,18 @@ public class PolygonVisualization<V extends NumberVector<?, ?>> extends P2DVisua ArrayList<Relation<?>> results = ResultUtil.filterResults(result, Relation.class); for(Relation<?> rel : results) { if(TypeUtil.POLYGON_TYPE.isAssignableFromType(rel.getDataTypeInformation())) { - final VisualizationTask task = new VisualizationTask(NAME, rel, rel, this, P2DVisualization.class); - task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_DATA); - baseResult.getHierarchy().add(rel, task); + // Assume that a 2d projector is using the same coordinates as the polygons. + Iterator<ScatterPlotProjector<?>> ps = ResultUtil.filteredResults(baseResult, ScatterPlotProjector.class); + for(ScatterPlotProjector<?> p : IterableUtil.fromIterator(ps)) { + if(DatabaseUtil.dimensionality(p.getRelation()) == 2) { + final VisualizationTask task = new VisualizationTask(NAME, rel, p.getRelation(), this); + task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_DATA - 10); + baseResult.getHierarchy().add(rel, task); + baseResult.getHierarchy().add(p, task); + } + } } } } - - @Override - public Class<? extends Projection> getProjectionType() { - return Projection2D.class; - } } }
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/ReferencePointsVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/ReferencePointsVisualization.java index e61154d3..df1aac20 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/ReferencePointsVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/ReferencePointsVisualization.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.Collection; import java.util.Iterator; @@ -29,22 +30,19 @@ import org.apache.batik.util.SVGConstants; import org.w3c.dom.Element; import de.lmu.ifi.dbs.elki.data.NumberVector; -import de.lmu.ifi.dbs.elki.database.relation.Relation; import de.lmu.ifi.dbs.elki.result.HierarchicalResult; import de.lmu.ifi.dbs.elki.result.ReferencePointsResult; import de.lmu.ifi.dbs.elki.result.Result; import de.lmu.ifi.dbs.elki.result.ResultUtil; import de.lmu.ifi.dbs.elki.utilities.iterator.IterableUtil; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; import de.lmu.ifi.dbs.elki.visualization.css.CSSClass; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection2D; +import de.lmu.ifi.dbs.elki.visualization.projector.ScatterPlotProjector; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot; import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil; /** * The actual visualization instance, for a single projection @@ -128,13 +126,14 @@ public class ReferencePointsVisualization<NV extends NumberVector<NV, ?>> extend @Override public void processNewResult(HierarchicalResult baseResult, Result result) { - Iterator<Relation<? extends NumberVector<?, ?>>> reps = VisualizerUtil.iterateVectorFieldRepresentations(baseResult); - for(Relation<? extends NumberVector<?, ?>> rep : IterableUtil.fromIterator(reps)) { - Collection<ReferencePointsResult<NV>> rps = ResultUtil.filterResults(result, ReferencePointsResult.class); - for(ReferencePointsResult<NV> rp : rps) { - final VisualizationTask task = new VisualizationTask(NAME, rp, rep, this, P2DVisualization.class); + Collection<ReferencePointsResult<NV>> rps = ResultUtil.filterResults(result, ReferencePointsResult.class); + for(ReferencePointsResult<NV> rp : rps) { + Iterator<ScatterPlotProjector<?>> ps = ResultUtil.filteredResults(baseResult, ScatterPlotProjector.class); + for(ScatterPlotProjector<?> p : IterableUtil.fromIterator(ps)) { + final VisualizationTask task = new VisualizationTask(NAME, rp, p.getRelation(), this); task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_DATA); baseResult.getHierarchy().add(rp, task); + baseResult.getHierarchy().add(p, task); } } } @@ -143,10 +142,5 @@ public class ReferencePointsVisualization<NV extends NumberVector<NV, ?>> extend public Visualization makeVisualization(VisualizationTask task) { return new ReferencePointsVisualization<NV>(task); } - - @Override - public Class<? extends Projection> getProjectionType() { - return Projection2D.class; - } } }
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/SelectionConvexHullVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/SelectionConvexHullVisualization.java index 5ce3575c..9e70ffd8 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/SelectionConvexHullVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/SelectionConvexHullVisualization.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d;
-/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +
+/*
+ This file is part of ELKI:
+ Environment for Developing KDD-Applications Supported by Index-Structures +
+ Copyright (C) 2011
+ Ludwig-Maximilians-Universität München
+ Lehr- und Forschungseinheit für Datenbanksysteme
+ ELKI Development Team +
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 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 Affero General Public License for more details. +
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
import java.util.ArrayList;
import java.util.Iterator;
@@ -34,7 +35,6 @@ import de.lmu.ifi.dbs.elki.database.datastore.DataStoreEvent; import de.lmu.ifi.dbs.elki.database.datastore.DataStoreListener;
import de.lmu.ifi.dbs.elki.database.ids.DBID;
import de.lmu.ifi.dbs.elki.database.ids.DBIDs;
-import de.lmu.ifi.dbs.elki.database.relation.Relation;
import de.lmu.ifi.dbs.elki.math.ConvexHull2D;
import de.lmu.ifi.dbs.elki.math.linearalgebra.Vector;
import de.lmu.ifi.dbs.elki.result.DBIDSelection;
@@ -44,17 +44,15 @@ import de.lmu.ifi.dbs.elki.result.ResultUtil; import de.lmu.ifi.dbs.elki.result.SelectionResult;
import de.lmu.ifi.dbs.elki.utilities.exceptions.ObjectNotFoundException;
import de.lmu.ifi.dbs.elki.utilities.iterator.IterableUtil;
+import de.lmu.ifi.dbs.elki.visualization.VisualizationTask;
import de.lmu.ifi.dbs.elki.visualization.css.CSSClass;
-import de.lmu.ifi.dbs.elki.visualization.projections.Projection;
-import de.lmu.ifi.dbs.elki.visualization.projections.Projection2D;
+import de.lmu.ifi.dbs.elki.visualization.projector.ScatterPlotProjector;
import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary;
import de.lmu.ifi.dbs.elki.visualization.svg.SVGPath;
import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot;
import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil;
import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory;
import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization;
-import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask;
-import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil;
import de.lmu.ifi.dbs.elki.visualization.visualizers.events.ContextChangeListener;
import de.lmu.ifi.dbs.elki.visualization.visualizers.thumbs.ThumbnailVisualization;
@@ -103,7 +101,7 @@ public class SelectionConvexHullVisualization<NV extends NumberVector<NV, ?>> ex ConvexHull2D hull = new ConvexHull2D();
for(DBID i : selection) {
try {
- hull.add(new Vector(proj.fastProjectDataToRenderSpace(rep.get(i))));
+ hull.add(new Vector(proj.fastProjectDataToRenderSpace(rel.get(i))));
}
catch(ObjectNotFoundException e) {
// ignore
@@ -177,20 +175,16 @@ public class SelectionConvexHullVisualization<NV extends NumberVector<NV, ?>> ex @Override
public void processNewResult(HierarchicalResult baseResult, Result result) {
- Iterator<Relation<? extends NumberVector<?, ?>>> reps = VisualizerUtil.iterateVectorFieldRepresentations(baseResult);
- for(Relation<? extends NumberVector<?, ?>> rep : IterableUtil.fromIterator(reps)) {
- final ArrayList<SelectionResult> selectionResults = ResultUtil.filterResults(result, SelectionResult.class);
- for(SelectionResult selres : selectionResults) {
- final VisualizationTask task = new VisualizationTask(NAME, selres, rep, this, P2DVisualization.class);
+ final ArrayList<SelectionResult> selectionResults = ResultUtil.filterResults(result, SelectionResult.class);
+ for(SelectionResult selres : selectionResults) {
+ Iterator<ScatterPlotProjector<?>> ps = ResultUtil.filteredResults(baseResult, ScatterPlotProjector.class);
+ for(ScatterPlotProjector<?> p : IterableUtil.fromIterator(ps)) {
+ final VisualizationTask task = new VisualizationTask(NAME, selres, p.getRelation(), this);
task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_DATA - 2);
baseResult.getHierarchy().add(selres, task);
+ baseResult.getHierarchy().add(p, task);
}
}
}
-
- @Override
- public Class<? extends Projection> getProjectionType() {
- return Projection2D.class;
- }
}
}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/SelectionCubeVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/SelectionCubeVisualization.java index a425dc16..7f6d9c04 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/SelectionCubeVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/SelectionCubeVisualization.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d;
-/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +
+/*
+ This file is part of ELKI:
+ Environment for Developing KDD-Applications Supported by Index-Structures +
+ Copyright (C) 2011
+ Ludwig-Maximilians-Universität München
+ Lehr- und Forschungseinheit für Datenbanksysteme
+ ELKI Development Team +
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 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 Affero General Public License for more details. +
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
import java.util.ArrayList;
import java.util.Iterator;
@@ -29,7 +30,6 @@ import org.apache.batik.util.SVGConstants; import org.w3c.dom.Element;
import de.lmu.ifi.dbs.elki.data.NumberVector;
-import de.lmu.ifi.dbs.elki.database.relation.Relation;
import de.lmu.ifi.dbs.elki.math.linearalgebra.Vector;
import de.lmu.ifi.dbs.elki.result.DBIDSelection;
import de.lmu.ifi.dbs.elki.result.HierarchicalResult;
@@ -44,17 +44,16 @@ import de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionID; import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization;
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Flag;
import de.lmu.ifi.dbs.elki.utilities.pairs.DoubleDoublePair;
+import de.lmu.ifi.dbs.elki.visualization.VisualizationTask;
import de.lmu.ifi.dbs.elki.visualization.css.CSSClass;
-import de.lmu.ifi.dbs.elki.visualization.projections.Projection;
import de.lmu.ifi.dbs.elki.visualization.projections.Projection2D;
+import de.lmu.ifi.dbs.elki.visualization.projector.ScatterPlotProjector;
import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary;
import de.lmu.ifi.dbs.elki.visualization.svg.SVGHyperCube;
import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot;
import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil;
import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory;
import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization;
-import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask;
-import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil;
import de.lmu.ifi.dbs.elki.visualization.visualizers.events.ContextChangeListener;
import de.lmu.ifi.dbs.elki.visualization.visualizers.thumbs.ThumbnailVisualization;
@@ -157,7 +156,7 @@ public class SelectionCubeVisualization<NV extends NumberVector<NV, ?>> extends DBIDSelection selContext = context.getSelection();
if(selContext instanceof RangeSelection) {
DoubleDoublePair[] ranges = ((RangeSelection) selContext).getRanges();
- int dim = DatabaseUtil.dimensionality(rep);
+ int dim = DatabaseUtil.dimensionality(rel);
double[] min = new double[dim];
double[] max = new double[dim];
@@ -235,13 +234,14 @@ public class SelectionCubeVisualization<NV extends NumberVector<NV, ?>> extends @Override
public void processNewResult(HierarchicalResult baseResult, Result result) {
- Iterator<Relation<? extends NumberVector<?, ?>>> reps = VisualizerUtil.iterateVectorFieldRepresentations(baseResult);
- for(Relation<? extends NumberVector<?, ?>> rep : IterableUtil.fromIterator(reps)) {
- final ArrayList<SelectionResult> selectionResults = ResultUtil.filterResults(result, SelectionResult.class);
- for(SelectionResult selres : selectionResults) {
- final VisualizationTask task = new VisualizationTask(NAME, selres, rep, this, P2DVisualization.class);
+ final ArrayList<SelectionResult> selectionResults = ResultUtil.filterResults(result, SelectionResult.class);
+ for(SelectionResult selres : selectionResults) {
+ Iterator<ScatterPlotProjector<?>> ps = ResultUtil.filteredResults(baseResult, ScatterPlotProjector.class);
+ for(ScatterPlotProjector<?> p : IterableUtil.fromIterator(ps)) {
+ final VisualizationTask task = new VisualizationTask(NAME, selres, p.getRelation(), this);
task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_DATA - 2);
baseResult.getHierarchy().add(selres, task);
+ baseResult.getHierarchy().add(p, task);
}
}
}
@@ -251,11 +251,6 @@ public class SelectionCubeVisualization<NV extends NumberVector<NV, ?>> extends return new ThumbnailVisualization(this, task, ThumbnailVisualization.ON_DATA | ThumbnailVisualization.ON_SELECTION);
}
- @Override
- public Class<? extends Projection> getProjectionType() {
- return Projection2D.class;
- }
-
/**
* Parameterization class.
*
diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/SelectionDotVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/SelectionDotVisualization.java index cfa2daad..283eafaa 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/SelectionDotVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/SelectionDotVisualization.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d;
-/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +
+/*
+ This file is part of ELKI:
+ Environment for Developing KDD-Applications Supported by Index-Structures +
+ Copyright (C) 2011
+ Ludwig-Maximilians-Universität München
+ Lehr- und Forschungseinheit für Datenbanksysteme
+ ELKI Development Team +
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 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 Affero General Public License for more details. +
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
import java.util.ArrayList;
import java.util.Iterator;
@@ -33,7 +34,6 @@ import de.lmu.ifi.dbs.elki.database.datastore.DataStoreEvent; import de.lmu.ifi.dbs.elki.database.datastore.DataStoreListener;
import de.lmu.ifi.dbs.elki.database.ids.DBID;
import de.lmu.ifi.dbs.elki.database.ids.DBIDs;
-import de.lmu.ifi.dbs.elki.database.relation.Relation;
import de.lmu.ifi.dbs.elki.result.DBIDSelection;
import de.lmu.ifi.dbs.elki.result.HierarchicalResult;
import de.lmu.ifi.dbs.elki.result.Result;
@@ -41,16 +41,14 @@ import de.lmu.ifi.dbs.elki.result.ResultUtil; import de.lmu.ifi.dbs.elki.result.SelectionResult;
import de.lmu.ifi.dbs.elki.utilities.exceptions.ObjectNotFoundException;
import de.lmu.ifi.dbs.elki.utilities.iterator.IterableUtil;
+import de.lmu.ifi.dbs.elki.visualization.VisualizationTask;
import de.lmu.ifi.dbs.elki.visualization.css.CSSClass;
-import de.lmu.ifi.dbs.elki.visualization.projections.Projection;
-import de.lmu.ifi.dbs.elki.visualization.projections.Projection2D;
+import de.lmu.ifi.dbs.elki.visualization.projector.ScatterPlotProjector;
import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary;
import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot;
import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil;
import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory;
import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization;
-import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask;
-import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil;
import de.lmu.ifi.dbs.elki.visualization.visualizers.events.ContextChangeListener;
import de.lmu.ifi.dbs.elki.visualization.visualizers.thumbs.ThumbnailVisualization;
@@ -104,7 +102,7 @@ public class SelectionDotVisualization<NV extends NumberVector<NV, ?>> extends P DBIDs selection = selContext.getSelectedIds();
for(DBID i : selection) {
try {
- double[] v = proj.fastProjectDataToRenderSpace(rep.get(i));
+ double[] v = proj.fastProjectDataToRenderSpace(rel.get(i));
Element dot = svgp.svgCircle(v[0], v[1], size);
SVGUtil.addCSSClass(dot, MARKER);
layer.appendChild(dot);
@@ -168,20 +166,16 @@ public class SelectionDotVisualization<NV extends NumberVector<NV, ?>> extends P @Override
public void processNewResult(HierarchicalResult baseResult, Result result) {
- Iterator<Relation<? extends NumberVector<?, ?>>> reps = VisualizerUtil.iterateVectorFieldRepresentations(baseResult);
- for(Relation<? extends NumberVector<?, ?>> rep : IterableUtil.fromIterator(reps)) {
- final ArrayList<SelectionResult> selectionResults = ResultUtil.filterResults(result, SelectionResult.class);
- for(SelectionResult selres : selectionResults) {
- final VisualizationTask task = new VisualizationTask(NAME, selres, rep, this, P2DVisualization.class);
+ final ArrayList<SelectionResult> selectionResults = ResultUtil.filterResults(result, SelectionResult.class);
+ for(SelectionResult selres : selectionResults) {
+ Iterator<ScatterPlotProjector<?>> ps = ResultUtil.filteredResults(baseResult, ScatterPlotProjector.class);
+ for(ScatterPlotProjector<?> p : IterableUtil.fromIterator(ps)) {
+ final VisualizationTask task = new VisualizationTask(NAME, selres, p.getRelation(), this);
task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_DATA - 1);
baseResult.getHierarchy().add(selres, task);
+ baseResult.getHierarchy().add(p, task);
}
}
}
-
- @Override
- public Class<? extends Projection> getProjectionType() {
- return Projection2D.class;
- }
}
}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/SelectionToolCubeVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/SelectionToolCubeVisualization.java index c5f1b3f9..fc2af9da 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/SelectionToolCubeVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/SelectionToolCubeVisualization.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d;
-/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +
+/*
+ This file is part of ELKI:
+ Environment for Developing KDD-Applications Supported by Index-Structures +
+ Copyright (C) 2011
+ Ludwig-Maximilians-Universität München
+ Lehr- und Forschungseinheit für Datenbanksysteme
+ ELKI Development Team +
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 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 Affero General Public License for more details. +
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
import java.util.ArrayList;
import java.util.BitSet;
@@ -35,7 +36,6 @@ import de.lmu.ifi.dbs.elki.data.NumberVector; import de.lmu.ifi.dbs.elki.database.ids.DBID;
import de.lmu.ifi.dbs.elki.database.ids.DBIDUtil;
import de.lmu.ifi.dbs.elki.database.ids.ModifiableDBIDs;
-import de.lmu.ifi.dbs.elki.database.relation.Relation;
import de.lmu.ifi.dbs.elki.logging.Logging;
import de.lmu.ifi.dbs.elki.math.linearalgebra.Vector;
import de.lmu.ifi.dbs.elki.result.DBIDSelection;
@@ -47,17 +47,16 @@ import de.lmu.ifi.dbs.elki.result.SelectionResult; import de.lmu.ifi.dbs.elki.utilities.DatabaseUtil;
import de.lmu.ifi.dbs.elki.utilities.iterator.IterableUtil;
import de.lmu.ifi.dbs.elki.utilities.pairs.DoubleDoublePair;
+import de.lmu.ifi.dbs.elki.visualization.VisualizationTask;
import de.lmu.ifi.dbs.elki.visualization.batikutil.DragableArea;
import de.lmu.ifi.dbs.elki.visualization.css.CSSClass;
import de.lmu.ifi.dbs.elki.visualization.projections.Projection;
-import de.lmu.ifi.dbs.elki.visualization.projections.Projection2D;
+import de.lmu.ifi.dbs.elki.visualization.projector.ScatterPlotProjector;
import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary;
import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot;
import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil;
import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory;
import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization;
-import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask;
-import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil;
import de.lmu.ifi.dbs.elki.visualization.visualizers.events.ContextChangedEvent;
/**
@@ -114,7 +113,7 @@ public class SelectionToolCubeVisualization<NV extends NumberVector<NV, ?>> exte public SelectionToolCubeVisualization(VisualizationTask task) {
super(task);
this.result = task.getResult();
- this.dim = DatabaseUtil.dimensionality(rep);
+ this.dim = DatabaseUtil.dimensionality(rel);
context.addContextChangeListener(this);
incrementalRedraw();
}
@@ -174,7 +173,7 @@ public class SelectionToolCubeVisualization<NV extends NumberVector<NV, ?>> exte v2.set(0, x2);
v2.set(1, y2);
- NV factory = DatabaseUtil.assumeVectorField(rep).getFactory();
+ NV factory = DatabaseUtil.assumeVectorField(rel).getFactory();
NV nv1 = proj.projectRenderToDataSpace(v1, factory);
NV nv2 = proj.projectRenderToDataSpace(v2, factory);
@@ -246,8 +245,8 @@ public class SelectionToolCubeVisualization<NV extends NumberVector<NV, ?>> exte selection.clear();
boolean idIn = true;
- for(DBID id : rep.iterDBIDs()) {
- NV dbTupel = rep.get(id);
+ for(DBID id : rel.iterDBIDs()) {
+ NV dbTupel = rel.get(id);
idIn = true;
for(int i = 0; i < dim; i++) {
if(ranges != null && ranges[i] != null) {
@@ -308,23 +307,19 @@ public class SelectionToolCubeVisualization<NV extends NumberVector<NV, ?>> exte @Override
public void processNewResult(HierarchicalResult baseResult, Result result) {
- Iterator<Relation<? extends NumberVector<?, ?>>> reps = VisualizerUtil.iterateVectorFieldRepresentations(baseResult);
- for(Relation<? extends NumberVector<?, ?>> rep : IterableUtil.fromIterator(reps)) {
- final ArrayList<SelectionResult> selectionResults = ResultUtil.filterResults(result, SelectionResult.class);
- for(SelectionResult selres : selectionResults) {
- final VisualizationTask task = new VisualizationTask(NAME, selres, rep, this, P2DVisualization.class);
+ final ArrayList<SelectionResult> selectionResults = ResultUtil.filterResults(result, SelectionResult.class);
+ for(SelectionResult selres : selectionResults) {
+ Iterator<ScatterPlotProjector<?>> ps = ResultUtil.filteredResults(baseResult, ScatterPlotProjector.class);
+ for(ScatterPlotProjector<?> p : IterableUtil.fromIterator(ps)) {
+ final VisualizationTask task = new VisualizationTask(NAME, selres, p.getRelation(), this);
task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_INTERACTIVE);
task.put(VisualizationTask.META_TOOL, true);
task.put(VisualizationTask.META_NOTHUMB, true);
task.put(VisualizationTask.META_NOEXPORT, true);
baseResult.getHierarchy().add(selres, task);
+ baseResult.getHierarchy().add(p, task);
}
}
}
-
- @Override
- public Class<? extends Projection> getProjectionType() {
- return Projection2D.class;
- }
}
}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/SelectionToolDotVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/SelectionToolDotVisualization.java index 52cc77e7..a50a6cbb 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/SelectionToolDotVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/SelectionToolDotVisualization.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d;
-/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +
+/*
+ This file is part of ELKI:
+ Environment for Developing KDD-Applications Supported by Index-Structures +
+ Copyright (C) 2011
+ Ludwig-Maximilians-Universität München
+ Lehr- und Forschungseinheit für Datenbanksysteme
+ ELKI Development Team +
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 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 Affero General Public License for more details. +
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
import java.util.ArrayList;
import java.util.Iterator;
@@ -35,24 +36,22 @@ import de.lmu.ifi.dbs.elki.data.NumberVector; import de.lmu.ifi.dbs.elki.database.ids.DBID;
import de.lmu.ifi.dbs.elki.database.ids.DBIDUtil;
import de.lmu.ifi.dbs.elki.database.ids.HashSetModifiableDBIDs;
-import de.lmu.ifi.dbs.elki.database.relation.Relation;
import de.lmu.ifi.dbs.elki.result.DBIDSelection;
import de.lmu.ifi.dbs.elki.result.HierarchicalResult;
import de.lmu.ifi.dbs.elki.result.Result;
import de.lmu.ifi.dbs.elki.result.ResultUtil;
import de.lmu.ifi.dbs.elki.result.SelectionResult;
import de.lmu.ifi.dbs.elki.utilities.iterator.IterableUtil;
+import de.lmu.ifi.dbs.elki.visualization.VisualizationTask;
import de.lmu.ifi.dbs.elki.visualization.batikutil.DragableArea;
import de.lmu.ifi.dbs.elki.visualization.css.CSSClass;
-import de.lmu.ifi.dbs.elki.visualization.projections.Projection;
import de.lmu.ifi.dbs.elki.visualization.projections.Projection2D;
+import de.lmu.ifi.dbs.elki.visualization.projector.ScatterPlotProjector;
import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary;
import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot;
import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil;
import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory;
import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization;
-import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask;
-import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil;
import de.lmu.ifi.dbs.elki.visualization.visualizers.events.ContextChangedEvent;
/**
@@ -217,8 +216,8 @@ public class SelectionToolDotVisualization<NV extends NumberVector<NV, ?>> exten else {
selection = DBIDUtil.newHashSet(selContext.getSelectedIds());
}
- for(DBID id : rep.iterDBIDs()) {
- double[] vec = proj.fastProjectDataToRenderSpace(rep.get(id));
+ for(DBID id : rel.iterDBIDs()) {
+ double[] vec = proj.fastProjectDataToRenderSpace(rel.get(id));
if(vec[0] >= Math.min(p1.getX(), p2.getX()) && vec[0] <= Math.max(p1.getX(), p2.getX()) && vec[1] >= Math.min(p1.getY(), p2.getY()) && vec[1] <= Math.max(p1.getY(), p2.getY())) {
if(mode == Mode.INVERT) {
if(!selection.contains(id)) {
@@ -281,23 +280,19 @@ public class SelectionToolDotVisualization<NV extends NumberVector<NV, ?>> exten @Override
public void processNewResult(HierarchicalResult baseResult, Result result) {
- Iterator<Relation<? extends NumberVector<?, ?>>> reps = VisualizerUtil.iterateVectorFieldRepresentations(baseResult);
- for(Relation<? extends NumberVector<?, ?>> rep : IterableUtil.fromIterator(reps)) {
- final ArrayList<SelectionResult> selectionResults = ResultUtil.filterResults(result, SelectionResult.class);
- for(SelectionResult selres : selectionResults) {
- final VisualizationTask task = new VisualizationTask(NAME, selres, rep, this, P2DVisualization.class);
+ final ArrayList<SelectionResult> selectionResults = ResultUtil.filterResults(result, SelectionResult.class);
+ for(SelectionResult selres : selectionResults) {
+ Iterator<ScatterPlotProjector<?>> ps = ResultUtil.filteredResults(baseResult, ScatterPlotProjector.class);
+ for(ScatterPlotProjector<?> p : IterableUtil.fromIterator(ps)) {
+ final VisualizationTask task = new VisualizationTask(NAME, selres, p.getRelation(), this);
task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_INTERACTIVE);
task.put(VisualizationTask.META_TOOL, true);
task.put(VisualizationTask.META_NOTHUMB, true);
task.put(VisualizationTask.META_NOEXPORT, true);
baseResult.getHierarchy().add(selres, task);
+ baseResult.getHierarchy().add(p, task);
}
}
}
-
- @Override
- public Class<? extends Projection> getProjectionType() {
- return Projection2D.class;
- }
}
}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/ToolBox2DVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/ToolBox2DVisualization.java index c72b53e6..ba91975c 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/ToolBox2DVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/ToolBox2DVisualization.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d;
-/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +
+/*
+ This file is part of ELKI:
+ Environment for Developing KDD-Applications Supported by Index-Structures +
+ Copyright (C) 2011
+ Ludwig-Maximilians-Universität München
+ Lehr- und Forschungseinheit für Datenbanksysteme
+ ELKI Development Team +
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 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 Affero General Public License for more details. +
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
import java.util.ArrayList;
import java.util.Iterator;
@@ -33,23 +34,22 @@ import org.w3c.dom.events.EventListener; import org.w3c.dom.events.EventTarget;
import de.lmu.ifi.dbs.elki.data.NumberVector;
-import de.lmu.ifi.dbs.elki.database.relation.Relation;
import de.lmu.ifi.dbs.elki.logging.Logging;
import de.lmu.ifi.dbs.elki.math.DoubleMinMax;
import de.lmu.ifi.dbs.elki.result.HierarchicalResult;
import de.lmu.ifi.dbs.elki.result.Result;
+import de.lmu.ifi.dbs.elki.result.ResultUtil;
import de.lmu.ifi.dbs.elki.utilities.FormatUtil;
import de.lmu.ifi.dbs.elki.utilities.iterator.IterableUtil;
import de.lmu.ifi.dbs.elki.utilities.pairs.Pair;
+import de.lmu.ifi.dbs.elki.visualization.VisualizationTask;
import de.lmu.ifi.dbs.elki.visualization.css.CSSClass;
-import de.lmu.ifi.dbs.elki.visualization.projections.Projection;
-import de.lmu.ifi.dbs.elki.visualization.projections.Projection2D;
+import de.lmu.ifi.dbs.elki.visualization.projector.ScatterPlotProjector;
import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary;
import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot;
import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil;
import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory;
import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization;
-import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask;
import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil;
import de.lmu.ifi.dbs.elki.visualization.visualizers.events.ContextChangedEvent;
@@ -131,15 +131,16 @@ public class ToolBox2DVisualization<NV extends NumberVector<NV, ?>> extends P2DV }
/**
- * Sets the toolbox
+ * Build the toolbox
*/
private void buildToolBox() {
double scale = StyleLibrary.SCALE;
deleteChildren(container);
ArrayList<VisualizationTask> vis = new ArrayList<VisualizationTask>();
- for(VisualizationTask task : context.iterVisualizers()) {
- if(VisualizerUtil.isTool(task)) {
+ final Iterable<VisualizationTask> visualizers = ResultUtil.filteredResults(task.getResult(), VisualizationTask.class);
+ for(VisualizationTask task : visualizers) {
+ if(VisualizerUtil.isTool(task) && !vis.contains(task)) {
vis.add(task);
}
}
@@ -305,19 +306,14 @@ public class ToolBox2DVisualization<NV extends NumberVector<NV, ?>> extends P2DV @Override
public void processNewResult(HierarchicalResult baseResult, Result result) {
- Iterator<Relation<? extends NumberVector<?, ?>>> reps = VisualizerUtil.iterateVectorFieldRepresentations(result);
- for(Relation<? extends NumberVector<?, ?>> rep : IterableUtil.fromIterator(reps)) {
- final VisualizationTask task = new VisualizationTask(NAME, rep, rep, this, P2DVisualization.class);
+ Iterator<ScatterPlotProjector<?>> ps = ResultUtil.filteredResults(result, ScatterPlotProjector.class);
+ for(ScatterPlotProjector<?> p : IterableUtil.fromIterator(ps)) {
+ final VisualizationTask task = new VisualizationTask(NAME, p, p.getRelation(), this);
task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_INTERACTIVE);
task.put(VisualizationTask.META_NOTHUMB, true);
task.put(VisualizationTask.META_NOEXPORT, true);
- baseResult.getHierarchy().add(rep, task);
+ baseResult.getHierarchy().add(p, task);
}
}
-
- @Override
- public Class<? extends Projection> getProjectionType() {
- return Projection2D.class;
- }
}
}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/TooltipScoreVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/TooltipScoreVisualization.java index 160fad55..309cc9c7 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/TooltipScoreVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/TooltipScoreVisualization.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.text.NumberFormat; import java.util.Iterator; @@ -43,15 +44,13 @@ import de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionID; import de.lmu.ifi.dbs.elki.utilities.optionhandling.constraints.GreaterEqualConstraint; import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.IntParameter; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; import de.lmu.ifi.dbs.elki.visualization.css.CSSClass; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection2D; +import de.lmu.ifi.dbs.elki.visualization.projector.ScatterPlotProjector; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil; /** * Generates a SVG-Element containing Tooltips. Tooltips remain invisible until @@ -60,7 +59,7 @@ import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil; * * @author Remigius Wojdanowski */ -public class TooltipScoreVisualization<NV extends NumberVector<NV, ?>> extends TooltipVisualization<NV> { +public class TooltipScoreVisualization<NV extends NumberVector<NV, ?>> extends AbstractTooltipVisualization<NV> { /** * A short name characterizing this Visualizer. */ @@ -184,23 +183,19 @@ public class TooltipScoreVisualization<NV extends NumberVector<NV, ?>> extends T @Override public void processNewResult(HierarchicalResult baseResult, Result result) { - Iterator<Relation<? extends NumberVector<?, ?>>> reps = VisualizerUtil.iterateVectorFieldRepresentations(baseResult); - for(Relation<? extends NumberVector<?, ?>> rep : IterableUtil.fromIterator(reps)) { - // TODO: we can also visualize other scores! - List<OutlierResult> ors = ResultUtil.filterResults(result, OutlierResult.class); - for(OutlierResult o : ors) { - final VisualizationTask task = new VisualizationTask(NAME, o.getScores(), rep, this, P2DVisualization.class); + // TODO: we can also visualize other scores! + List<OutlierResult> ors = ResultUtil.filterResults(result, OutlierResult.class); + for(OutlierResult o : ors) { + Iterator<ScatterPlotProjector<?>> ps = ResultUtil.filteredResults(baseResult, ScatterPlotProjector.class); + for(ScatterPlotProjector<?> p : IterableUtil.fromIterator(ps)) { + final VisualizationTask task = new VisualizationTask(NAME, o.getScores(), p.getRelation(), this); task.put(VisualizationTask.META_TOOL, true); baseResult.getHierarchy().add(o.getScores(), task); + baseResult.getHierarchy().add(p, task); } } } - @Override - public Class<? extends Projection> getProjectionType() { - return Projection2D.class; - } - /** * Parameterization class. * diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/TooltipStringVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/TooltipStringVisualization.java index 2cc34edf..044dc66f 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/TooltipStringVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/TooltipStringVisualization.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.ArrayList; import java.util.Iterator; @@ -29,6 +30,7 @@ import org.apache.batik.util.SVGConstants; import org.w3c.dom.Element; import de.lmu.ifi.dbs.elki.data.ClassLabel; +import de.lmu.ifi.dbs.elki.data.ExternalID; import de.lmu.ifi.dbs.elki.data.LabelList; import de.lmu.ifi.dbs.elki.data.NumberVector; import de.lmu.ifi.dbs.elki.database.ids.DBID; @@ -37,15 +39,13 @@ import de.lmu.ifi.dbs.elki.result.HierarchicalResult; import de.lmu.ifi.dbs.elki.result.Result; import de.lmu.ifi.dbs.elki.result.ResultUtil; import de.lmu.ifi.dbs.elki.utilities.iterator.IterableUtil; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; import de.lmu.ifi.dbs.elki.visualization.css.CSSClass; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection2D; +import de.lmu.ifi.dbs.elki.visualization.projector.ScatterPlotProjector; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil; /** * Generates a SVG-Element containing Tooltips. Tooltips remain invisible until @@ -59,7 +59,7 @@ import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil; * * @param <NV> Data type visualized. */ -public class TooltipStringVisualization<NV extends NumberVector<NV, ?>> extends TooltipVisualization<NV> { +public class TooltipStringVisualization<NV extends NumberVector<NV, ?>> extends AbstractTooltipVisualization<NV> { /** * A short name characterizing this Visualizer. */ @@ -180,33 +180,45 @@ public class TooltipStringVisualization<NV extends NumberVector<NV, ?>> extends @Override public void processNewResult(HierarchicalResult baseResult, Result result) { - Iterator<Relation<? extends NumberVector<?, ?>>> vreps = VisualizerUtil.iterateVectorFieldRepresentations(baseResult); - for(Relation<? extends NumberVector<?, ?>> vrep : IterableUtil.fromIterator(vreps)) { - ArrayList<Relation<?>> reps = ResultUtil.filterResults(result, Relation.class); - for(Relation<?> rep : reps) { - if (DBID.class.isAssignableFrom(rep.getDataTypeInformation().getRestrictionClass())) { - final VisualizationTask task = new VisualizationTask(NAME_ID, rep, vrep, this, P2DVisualization.class); + ArrayList<Relation<?>> reps = ResultUtil.filterResults(result, Relation.class); + for(Relation<?> rep : reps) { + if(DBID.class.isAssignableFrom(rep.getDataTypeInformation().getRestrictionClass())) { + Iterator<ScatterPlotProjector<?>> ps = ResultUtil.filteredResults(baseResult, ScatterPlotProjector.class); + for(ScatterPlotProjector<?> p : IterableUtil.fromIterator(ps)) { + final VisualizationTask task = new VisualizationTask(NAME_ID, rep, p.getRelation(), this); task.put(VisualizationTask.META_TOOL, true); baseResult.getHierarchy().add(rep, task); + baseResult.getHierarchy().add(p, task); } - if (ClassLabel.class.isAssignableFrom(rep.getDataTypeInformation().getRestrictionClass())) { - final VisualizationTask task = new VisualizationTask(NAME_CLASS, rep, vrep, this, P2DVisualization.class); + } + if(ClassLabel.class.isAssignableFrom(rep.getDataTypeInformation().getRestrictionClass())) { + Iterator<ScatterPlotProjector<?>> ps = ResultUtil.filteredResults(baseResult, ScatterPlotProjector.class); + for(ScatterPlotProjector<?> p : IterableUtil.fromIterator(ps)) { + final VisualizationTask task = new VisualizationTask(NAME_CLASS, rep, p.getRelation(), this); task.put(VisualizationTask.META_TOOL, true); baseResult.getHierarchy().add(rep, task); + baseResult.getHierarchy().add(p, task); } - if (LabelList.class.isAssignableFrom(rep.getDataTypeInformation().getRestrictionClass())) { - final VisualizationTask task = new VisualizationTask(NAME_LABEL, rep, vrep, this, P2DVisualization.class); + } + if(LabelList.class.isAssignableFrom(rep.getDataTypeInformation().getRestrictionClass())) { + Iterator<ScatterPlotProjector<?>> ps = ResultUtil.filteredResults(baseResult, ScatterPlotProjector.class); + for(ScatterPlotProjector<?> p : IterableUtil.fromIterator(ps)) { + final VisualizationTask task = new VisualizationTask(NAME_LABEL, rep, p.getRelation(), this); task.put(VisualizationTask.META_TOOL, true); baseResult.getHierarchy().add(rep, task); + baseResult.getHierarchy().add(p, task); + } + } + if(ExternalID.class.isAssignableFrom(rep.getDataTypeInformation().getRestrictionClass())) { + Iterator<ScatterPlotProjector<?>> ps = ResultUtil.filteredResults(baseResult, ScatterPlotProjector.class); + for(ScatterPlotProjector<?> p : IterableUtil.fromIterator(ps)) { + final VisualizationTask task = new VisualizationTask(NAME_EID, rep, p.getRelation(), this); + task.put(VisualizationTask.META_TOOL, true); + baseResult.getHierarchy().add(rep, task); + baseResult.getHierarchy().add(p, task); } - // TODO: external IDs separate? } } } - - @Override - public Class<? extends Projection> getProjectionType() { - return Projection2D.class; - } } }
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/TreeMBRVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/TreeMBRVisualization.java index 3d254764..5fe6aac2 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/TreeMBRVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/TreeMBRVisualization.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.ArrayList; import java.util.Iterator; @@ -33,7 +34,6 @@ import de.lmu.ifi.dbs.elki.data.spatial.SpatialComparable; import de.lmu.ifi.dbs.elki.data.spatial.SpatialUtil; import de.lmu.ifi.dbs.elki.database.datastore.DataStoreEvent; import de.lmu.ifi.dbs.elki.database.datastore.DataStoreListener; -import de.lmu.ifi.dbs.elki.database.relation.Relation; import de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialEntry; import de.lmu.ifi.dbs.elki.index.tree.spatial.rstarvariants.AbstractRStarTree; import de.lmu.ifi.dbs.elki.index.tree.spatial.rstarvariants.AbstractRStarTreeNode; @@ -47,18 +47,17 @@ import de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizer; import de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionID; import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Flag; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; import de.lmu.ifi.dbs.elki.visualization.colors.ColorLibrary; import de.lmu.ifi.dbs.elki.visualization.css.CSSClass; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection; import de.lmu.ifi.dbs.elki.visualization.projections.Projection2D; +import de.lmu.ifi.dbs.elki.visualization.projector.ScatterPlotProjector; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; import de.lmu.ifi.dbs.elki.visualization.svg.SVGHyperCube; import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot; import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil; /** * Visualize the bounding rectangles of an R-Tree based index. @@ -226,24 +225,20 @@ public class TreeMBRVisualization<NV extends NumberVector<NV, ?>, N extends Abst @Override public void processNewResult(HierarchicalResult baseResult, Result result) { - Iterator<Relation<? extends NumberVector<?, ?>>> reps = VisualizerUtil.iterateVectorFieldRepresentations(baseResult); - for(Relation<? extends NumberVector<?, ?>> rep : IterableUtil.fromIterator(reps)) { - ArrayList<AbstractRStarTree<RStarTreeNode, SpatialEntry>> trees = ResultUtil.filterResults(result, AbstractRStarTree.class); - for(AbstractRStarTree<RStarTreeNode, SpatialEntry> tree : trees) { - if(tree instanceof Result) { - final VisualizationTask task = new VisualizationTask(NAME, (Result) tree, rep, this, P2DVisualization.class); + ArrayList<AbstractRStarTree<RStarTreeNode, SpatialEntry>> trees = ResultUtil.filterResults(result, AbstractRStarTree.class); + for(AbstractRStarTree<RStarTreeNode, SpatialEntry> tree : trees) { + if(tree instanceof Result) { + Iterator<ScatterPlotProjector<?>> ps = ResultUtil.filteredResults(baseResult, ScatterPlotProjector.class); + for(ScatterPlotProjector<?> p : IterableUtil.fromIterator(ps)) { + final VisualizationTask task = new VisualizationTask(NAME, (Result) tree, p.getRelation(), this); task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_BACKGROUND + 1); baseResult.getHierarchy().add((Result) tree, task); + baseResult.getHierarchy().add(p, task); } } } } - @Override - public Class<? extends Projection> getProjectionType() { - return Projection2D.class; - } - /** * Parameterization class. * diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/TreeSphereVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/TreeSphereVisualization.java index 2d0a20af..1aec1ead 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/TreeSphereVisualization.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/vis2d/TreeSphereVisualization.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.ArrayList; import java.util.Iterator; @@ -32,7 +33,6 @@ import de.lmu.ifi.dbs.elki.data.NumberVector; import de.lmu.ifi.dbs.elki.database.datastore.DataStoreEvent; import de.lmu.ifi.dbs.elki.database.datastore.DataStoreListener; import de.lmu.ifi.dbs.elki.database.ids.DBID; -import de.lmu.ifi.dbs.elki.database.relation.Relation; import de.lmu.ifi.dbs.elki.distance.distancefunction.DistanceFunction; import de.lmu.ifi.dbs.elki.distance.distancefunction.EuclideanDistanceFunction; import de.lmu.ifi.dbs.elki.distance.distancefunction.LPNormDistanceFunction; @@ -50,18 +50,17 @@ import de.lmu.ifi.dbs.elki.utilities.iterator.IterableUtil; import de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizer; import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Flag; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; import de.lmu.ifi.dbs.elki.visualization.colors.ColorLibrary; import de.lmu.ifi.dbs.elki.visualization.css.CSSClass; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection; import de.lmu.ifi.dbs.elki.visualization.projections.Projection2D; +import de.lmu.ifi.dbs.elki.visualization.projector.ScatterPlotProjector; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; import de.lmu.ifi.dbs.elki.visualization.svg.SVGHyperSphere; import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot; import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil; /** * Visualize the bounding sphere of a metric index. @@ -212,7 +211,7 @@ public class TreeSphereVisualization<NV extends NumberVector<NV, ?>, D extends N private void visualizeMTreeEntry(SVGPlot svgp, Element layer, Projection2D proj, AbstractMTree<NV, D, N, E> mtree, E entry, int depth) { DBID roid = entry.getRoutingObjectID(); if(roid != null) { - NV ro = rep.get(roid); + NV ro = rel.get(roid); D rad = entry.getCoveringRadius(); final Element r; @@ -281,14 +280,15 @@ public class TreeSphereVisualization<NV extends NumberVector<NV, ?>, D extends N @Override public void processNewResult(HierarchicalResult baseResult, Result result) { - Iterator<Relation<? extends NumberVector<?, ?>>> reps = VisualizerUtil.iterateVectorFieldRepresentations(baseResult); - for(Relation<? extends NumberVector<?, ?>> rep : IterableUtil.fromIterator(reps)) { + Iterator<ScatterPlotProjector<?>> ps = ResultUtil.filteredResults(baseResult, ScatterPlotProjector.class); + for(ScatterPlotProjector<?> p : IterableUtil.fromIterator(ps)) { ArrayList<AbstractMTree<NV, DoubleDistance, ?, ?>> trees = ResultUtil.filterResults(result, AbstractMTree.class); for(AbstractMTree<NV, DoubleDistance, ?, ?> tree : trees) { if(canVisualize(tree) && tree instanceof Result) { - final VisualizationTask task = new VisualizationTask(NAME, (Result) tree, rep, this, P2DVisualization.class); + final VisualizationTask task = new VisualizationTask(NAME, (Result) tree, p.getRelation(), this); task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_BACKGROUND + 1); baseResult.getHierarchy().add((Result) tree, task); + baseResult.getHierarchy().add(p, task); } } } @@ -299,11 +299,6 @@ public class TreeSphereVisualization<NV extends NumberVector<NV, ?>, D extends N return new TreeSphereVisualization<NV, DoubleDistance, MTreeNode<NV, DoubleDistance>, MTreeEntry<DoubleDistance>>(task, fill); } - @Override - public Class<? extends Projection> getProjectionType() { - return Projection2D.class; - } - /** * Parameterization class. * diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/ClusterEvaluationVisFactory.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/ClusterEvaluationVisFactory.java index a5146dd5..469d6db5 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/ClusterEvaluationVisFactory.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/ClusterEvaluationVisFactory.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.visunproj; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.ArrayList; @@ -33,14 +34,13 @@ import de.lmu.ifi.dbs.elki.result.HierarchicalResult; import de.lmu.ifi.dbs.elki.result.Result; import de.lmu.ifi.dbs.elki.result.ResultUtil; import de.lmu.ifi.dbs.elki.utilities.FormatUtil; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot; import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; import de.lmu.ifi.dbs.elki.visualization.visualizers.StaticVisualization; import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; /** * Pseudo-Visualizer, that lists the cluster evaluation results found. @@ -68,7 +68,9 @@ public class ClusterEvaluationVisFactory extends AbstractVisFactory { public void processNewResult(HierarchicalResult baseResult, Result newResult) { final ArrayList<EvaluatePairCountingFMeasure.ScoreResult> srs = ResultUtil.filterResults(newResult, EvaluatePairCountingFMeasure.ScoreResult.class); for(EvaluatePairCountingFMeasure.ScoreResult sr : srs) { - final VisualizationTask task = new VisualizationTask(NAME, sr, null, this, null); + final VisualizationTask task = new VisualizationTask(NAME, sr, null, this); + task.width = 1.0; + task.height = 0.5; task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_STATIC); baseResult.getHierarchy().add(sr, task); } @@ -119,9 +121,10 @@ public class ClusterEvaluationVisFactory extends AbstractVisFactory { return new StaticVisualization(task, layer); } - + @Override - public Class<? extends Projection> getProjectionType() { - return null; + public boolean allowThumbnails(@SuppressWarnings("unused") VisualizationTask task) { + // Don't use thumbnails + return false; } }
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/CurveVisFactory.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/CurveVisFactory.java index e71ffe73..a45f2007 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/CurveVisFactory.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/CurveVisFactory.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.visunproj; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.Collection; import java.util.Iterator; @@ -40,9 +41,10 @@ import de.lmu.ifi.dbs.elki.utilities.FormatUtil; import de.lmu.ifi.dbs.elki.utilities.iterator.AbstractFilteredIterator; import de.lmu.ifi.dbs.elki.utilities.iterator.IterableIterator; import de.lmu.ifi.dbs.elki.utilities.pairs.DoubleDoublePair; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; +import de.lmu.ifi.dbs.elki.visualization.VisualizerContext; import de.lmu.ifi.dbs.elki.visualization.css.CSSClass; import de.lmu.ifi.dbs.elki.visualization.css.CSSClassManager.CSSNamingConflict; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection; import de.lmu.ifi.dbs.elki.visualization.scales.LinearScale; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; import de.lmu.ifi.dbs.elki.visualization.svg.SVGPath; @@ -52,8 +54,6 @@ import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; import de.lmu.ifi.dbs.elki.visualization.visualizers.StaticVisualization; import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerContext; /** * Visualizer to render a simple 2D curve such as a ROC curve. @@ -226,7 +226,9 @@ public class CurveVisFactory extends AbstractVisFactory { final IterableIterator<IterableResult<?>> iterableResults = ResultUtil.filteredResults(result, IterableResult.class); final IterableIterator<IterableResult<DoubleDoublePair>> curves = new CurveFilter(iterableResults); for (IterableResult<DoubleDoublePair> curve : curves) { - final VisualizationTask task = new VisualizationTask(NAME, curve, null, this, null); + final VisualizationTask task = new VisualizationTask(NAME, curve, null, this); + task.width = 1.0; + task.height = 1.0; task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_STATIC); baseResult.getHierarchy().add(curve, task); } @@ -237,9 +239,4 @@ public class CurveVisFactory extends AbstractVisFactory { // TODO: depending on the curve complexity? return false; } - - @Override - public Class<? extends Projection> getProjectionType() { - return null; - } }
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/HistogramVisFactory.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/HistogramVisFactory.java index 3d328b58..c8dfe0c8 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/HistogramVisFactory.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/HistogramVisFactory.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.visunproj; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.List; @@ -34,10 +35,11 @@ import de.lmu.ifi.dbs.elki.result.HierarchicalResult; import de.lmu.ifi.dbs.elki.result.HistogramResult; import de.lmu.ifi.dbs.elki.result.Result; import de.lmu.ifi.dbs.elki.result.ResultUtil; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; +import de.lmu.ifi.dbs.elki.visualization.VisualizerContext; import de.lmu.ifi.dbs.elki.visualization.colors.ColorLibrary; import de.lmu.ifi.dbs.elki.visualization.css.CSSClass; import de.lmu.ifi.dbs.elki.visualization.css.CSSClassManager.CSSNamingConflict; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection; import de.lmu.ifi.dbs.elki.visualization.scales.LinearScale; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; import de.lmu.ifi.dbs.elki.visualization.svg.SVGPath; @@ -47,8 +49,6 @@ import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; import de.lmu.ifi.dbs.elki.visualization.visualizers.StaticVisualization; import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerContext; /** * Visualizer to draw histograms. @@ -168,7 +168,9 @@ public class HistogramVisFactory extends AbstractVisFactory { public void processNewResult(HierarchicalResult baseResult, Result newResult) { List<HistogramResult<? extends NumberVector<?, ?>>> histograms = ResultUtil.filterResults(newResult, HistogramResult.class); for(HistogramResult<? extends NumberVector<?, ?>> histogram : histograms) { - final VisualizationTask task = new VisualizationTask(NAME, histogram, null, this, null); + final VisualizationTask task = new VisualizationTask(NAME, histogram, null, this); + task.width = 2.0; + task.height = 1.0; task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_STATIC); baseResult.getHierarchy().add(histogram, task); } @@ -179,9 +181,4 @@ public class HistogramVisFactory extends AbstractVisFactory { // TODO: depending on the histogram complexity? return false; } - - @Override - public Class<? extends Projection> getProjectionType() { - return null; - } }
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/KeyVisFactory.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/KeyVisFactory.java index 26462faf..69813d99 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/KeyVisFactory.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/KeyVisFactory.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.visunproj; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.Collection; import java.util.List; @@ -34,7 +35,8 @@ import de.lmu.ifi.dbs.elki.data.model.Model; import de.lmu.ifi.dbs.elki.result.HierarchicalResult; import de.lmu.ifi.dbs.elki.result.Result; import de.lmu.ifi.dbs.elki.result.ResultUtil; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; +import de.lmu.ifi.dbs.elki.visualization.VisualizerContext; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; import de.lmu.ifi.dbs.elki.visualization.style.marker.MarkerLibrary; import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot; @@ -42,8 +44,6 @@ import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; import de.lmu.ifi.dbs.elki.visualization.visualizers.StaticVisualization; import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerContext; /** * Pseudo-Visualizer, that gives the key for a clustering. @@ -106,7 +106,9 @@ public class KeyVisFactory extends AbstractVisFactory { Collection<Clustering<?>> clusterings = ResultUtil.filterResults(newResult, Clustering.class); for(Clustering<?> c : clusterings) { if(c.getAllClusters().size() > 0) { - final VisualizationTask task = new VisualizationTask(NAME, c, null, this, null); + final VisualizationTask task = new VisualizationTask(NAME, c, null, this); + task.width = 1.0; + task.height = 1.0; task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_STATIC); baseResult.getHierarchy().add(c, task); } @@ -117,9 +119,4 @@ public class KeyVisFactory extends AbstractVisFactory { public boolean allowThumbnails(@SuppressWarnings("unused") VisualizationTask task) { return false; } - - @Override - public Class<? extends Projection> getProjectionType() { - return null; - } }
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/LabelVisFactory.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/LabelVisFactory.java index a10b1b09..6145b7a8 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/LabelVisFactory.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/LabelVisFactory.java @@ -1,46 +1,46 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.visunproj; + /* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + 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 Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import org.apache.batik.util.SVGConstants; import org.w3c.dom.Element; import de.lmu.ifi.dbs.elki.result.HierarchicalResult; import de.lmu.ifi.dbs.elki.result.Result; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; +import de.lmu.ifi.dbs.elki.visualization.VisualizerContext; import de.lmu.ifi.dbs.elki.visualization.css.CSSClass; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot; import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; import de.lmu.ifi.dbs.elki.visualization.visualizers.StaticVisualization; import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerContext; /** - * Trivial "visualizer" that displays a static label. - * The visualizer is meant to be used for dimension labels in the overview. + * Trivial "visualizer" that displays a static label. The visualizer is meant to + * be used for dimension labels in the overview. * * @author Erich Schubert * @@ -54,7 +54,12 @@ public class LabelVisFactory extends AbstractVisFactory { private String label = "undefined"; /** - * Formal constructor, to satisfy Parameterizable API + * Flag to indicate rotated labels (90 deg to the left) + */ + private boolean rotated = false; + + /** + * Constructor. Solely for API purposes (Parameterizable!) */ public LabelVisFactory() { super(); @@ -66,11 +71,21 @@ public class LabelVisFactory extends AbstractVisFactory { * @param label Label to use */ public LabelVisFactory(String label) { - this(); + this(label, false); + } + + /** + * Constructor. + * + * @param label Label to use + * @param rotated Rotated 90 deg to the left + */ + public LabelVisFactory(String label, boolean rotated) { + super(); this.label = label; + this.rotated = rotated; } - @SuppressWarnings("unused") @Override public void processNewResult(HierarchicalResult baseResult, Result newResult) { // No auto discovery supported. @@ -87,19 +102,23 @@ public class LabelVisFactory extends AbstractVisFactory { cls.setStatement(SVGConstants.CSS_FILL_PROPERTY, style.getTextColor("overview.labels")); cls.setStatement(SVGConstants.CSS_FONT_FAMILY_PROPERTY, style.getFontFamily("overview.labels")); - Element layer = svgp.svgText(task.getWidth() / 2, task.getHeight() / 2 + .35 * fontsize, this.label); - SVGUtil.setAtt(layer, SVGConstants.SVG_STYLE_ATTRIBUTE, cls.inlineCSS()); - SVGUtil.setAtt(layer, SVGConstants.SVG_TEXT_ANCHOR_ATTRIBUTE, SVGConstants.SVG_MIDDLE_VALUE); + Element layer; + if(!rotated) { + layer = svgp.svgText(task.getWidth() / 2, task.getHeight() / 2 + .35 * fontsize, this.label); + SVGUtil.setAtt(layer, SVGConstants.SVG_STYLE_ATTRIBUTE, cls.inlineCSS()); + SVGUtil.setAtt(layer, SVGConstants.SVG_TEXT_ANCHOR_ATTRIBUTE, SVGConstants.SVG_MIDDLE_VALUE); + } + else { + layer = svgp.svgText(- task.getHeight() / 2, task.getWidth() / 2 + .35 * fontsize, this.label); + SVGUtil.setAtt(layer, SVGConstants.SVG_STYLE_ATTRIBUTE, cls.inlineCSS()); + SVGUtil.setAtt(layer, SVGConstants.SVG_TEXT_ANCHOR_ATTRIBUTE, SVGConstants.SVG_MIDDLE_VALUE); + SVGUtil.setAtt(layer, SVGConstants.SVG_TRANSFORM_ATTRIBUTE, "rotate(-90)"); + } return new StaticVisualization(task, layer); } @Override - public boolean allowThumbnails(@SuppressWarnings("unused") VisualizationTask task) { + public boolean allowThumbnails(VisualizationTask task) { return false; } - - @Override - public Class<? extends Projection> getProjectionType() { - return null; - } }
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/OPTICSClusterVisualization.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/OPTICSClusterVisualization.java deleted file mode 100644 index 666d4518..00000000 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/OPTICSClusterVisualization.java +++ /dev/null @@ -1,240 +0,0 @@ -package de.lmu.ifi.dbs.elki.visualization.visualizers.visunproj; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -import java.util.Collection; -import java.util.List; - -import org.apache.batik.util.SVGConstants; -import org.w3c.dom.Element; - -import de.lmu.ifi.dbs.elki.data.Cluster; -import de.lmu.ifi.dbs.elki.data.Clustering; -import de.lmu.ifi.dbs.elki.data.model.OPTICSModel; -import de.lmu.ifi.dbs.elki.logging.Logging; -import de.lmu.ifi.dbs.elki.result.HierarchicalResult; -import de.lmu.ifi.dbs.elki.result.Result; -import de.lmu.ifi.dbs.elki.result.ResultUtil; -import de.lmu.ifi.dbs.elki.result.SelectionResult; -import de.lmu.ifi.dbs.elki.result.optics.ClusterOrderResult; -import de.lmu.ifi.dbs.elki.visualization.css.CSSClass; -import de.lmu.ifi.dbs.elki.visualization.opticsplot.OPTICSPlot; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection; -import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; -import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; -import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; -import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; - -/** - * Visualize the clusters and cluster hierarchy found by OPTICS on the OPTICS - * Plot. - * - * @author Erich Schubert - * - * @apiviz.uses ClusterOrderResult - * @apiviz.uses OPTICSPlot - */ -public class OPTICSClusterVisualization extends AbstractVisualization { - /** - * The logger for this class. - */ - private static final Logging logger = Logging.getLogger(OPTICSClusterVisualization.class); - - /** - * A short name characterizing this Visualizer. - */ - private static final String NAME = "OPTICS Cluster Range"; - - /** - * CSS class for markers - */ - protected static final String CSS_BRACKET = "opticsBracket"; - - /** - * Our cluster order - */ - private ClusterOrderResult<?> co; - - /** - * Our clustering - */ - Clustering<OPTICSModel> clus; - - /** - * The plot - */ - private OPTICSPlot<?> opticsplot; - - /** - * Constructor. - * - * @param task Visualization task - */ - public OPTICSClusterVisualization(VisualizationTask task) { - super(task); - this.co = task.getResult(); - this.clus = findOPTICSClustering(this.co); - this.opticsplot = OPTICSPlot.plotForClusterOrder(this.co, context); - context.addResultListener(this); - incrementalRedraw(); - } - - /** - * Find the OPTICS clustering child of a cluster order. - * - * @param co Cluster order - * @return OPTICS clustering - */ - @SuppressWarnings("unchecked") - protected static Clustering<OPTICSModel> findOPTICSClustering(ClusterOrderResult<?> co) { - for(Result r : co.getHierarchy().getChildren(co)) { - if(!Clustering.class.isInstance(r)) { - continue; - } - Clustering<?> clus = (Clustering<?>) r; - if(clus.getToplevelClusters().size() == 0) { - continue; - } - Cluster<?> firstcluster = clus.getToplevelClusters().iterator().next(); - if(firstcluster.getModel() instanceof OPTICSModel) { - return (Clustering<OPTICSModel>) clus; - } - } - return null; - } - - @Override - protected void redraw() { - final double scale = StyleLibrary.SCALE; - final double sizex = scale; - final double sizey = scale * task.getHeight() / task.getWidth(); - final double margin = context.getStyleLibrary().getSize(StyleLibrary.MARGIN); - layer = SVGUtil.svgElement(svgp.getDocument(), SVGConstants.SVG_G_TAG); - final String transform = SVGUtil.makeMarginTransform(task.getWidth(), task.getHeight(), sizex, sizey, margin); - SVGUtil.setAtt(layer, SVGConstants.SVG_TRANSFORM_ATTRIBUTE, transform); - - addCSSClasses(); - - drawClusters(scale, scale / opticsplot.getRatio(), clus.getToplevelClusters(), 1); - } - - /** - * Recursively draw clusters - * - * @param sizex Width - * @param sizey Height of optics plot - * @param clusters Current set of clusters - * @param depth Recursion depth - */ - private void drawClusters(double sizex, double sizey, List<Cluster<OPTICSModel>> clusters, int depth) { - final double scale = StyleLibrary.SCALE; - for(Cluster<OPTICSModel> cluster : clusters) { - try { - OPTICSModel model = cluster.getModel(); - final double x1 = sizex * ((model.getStartIndex() + .25) / this.co.getClusterOrder().size()); - final double x2 = sizex * ((model.getEndIndex() + .75) / this.co.getClusterOrder().size()); - final double y = sizey + depth * scale * 0.01; - Element e = svgp.svgLine(x1, y, x2, y); - SVGUtil.addCSSClass(e, CSS_BRACKET); - layer.appendChild(e); - } - catch(ClassCastException e) { - logger.warning("Expected OPTICSModel, got: " + cluster.getModel().getClass().getSimpleName()); - } - // Descend - final List<Cluster<OPTICSModel>> children = cluster.getChildren(); - if(children != null) { - drawClusters(sizex, sizey, children, depth + 1); - } - } - } - - /** - * Adds the required CSS-Classes - */ - private void addCSSClasses() { - // Class for the markers - if(!svgp.getCSSClassManager().contains(CSS_BRACKET)) { - final CSSClass cls = new CSSClass(this, CSS_BRACKET); - cls.setStatement(SVGConstants.CSS_STROKE_PROPERTY, context.getStyleLibrary().getColor(StyleLibrary.PLOT)); - cls.setStatement(SVGConstants.CSS_STROKE_WIDTH_PROPERTY, context.getStyleLibrary().getLineWidth(StyleLibrary.PLOT)); - svgp.addCSSClassOrLogError(cls); - } - } - - @Override - public void resultChanged(Result current) { - if(current instanceof SelectionResult || current == co || current == opticsplot) { - synchronizedRedraw(); - return; - } - super.resultChanged(current); - } - - /** - * Factory class for OPTICS plot selections. - * - * @author Erich Schubert - * - * @apiviz.stereotype factory - * @apiviz.uses OPTICSPlotSelectionVisualization oneway - - «create» - */ - public static class Factory extends AbstractVisFactory { - /** - * Constructor, adhering to - * {@link de.lmu.ifi.dbs.elki.utilities.optionhandling.Parameterizable} - */ - public Factory() { - super(); - } - - @Override - public void processNewResult(HierarchicalResult baseResult, Result result) { - Collection<OPTICSPlot<?>> plots = ResultUtil.filterResults(result, OPTICSPlot.class); - for(OPTICSPlot<?> plot : plots) { - ClusterOrderResult<?> co = plot.getClusterOrder(); - final VisualizationTask task = new VisualizationTask(NAME, co, null, this, plot); - task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_INTERACTIVE); - baseResult.getHierarchy().add(plot, task); - } - } - - @Override - public Visualization makeVisualization(VisualizationTask task) { - return new OPTICSClusterVisualization(task); - } - - @Override - public boolean allowThumbnails(@SuppressWarnings("unused") VisualizationTask task) { - // Don't use thumbnails - return false; - } - - @Override - public Class<? extends Projection> getProjectionType() { - return null; - } - } -}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/OPTICSPlotVisualizer.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/OPTICSPlotVisualizer.java deleted file mode 100644 index d1bbddfb..00000000 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/OPTICSPlotVisualizer.java +++ /dev/null @@ -1,170 +0,0 @@ -package de.lmu.ifi.dbs.elki.visualization.visualizers.visunproj; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -import java.io.File; -import java.io.IOException; -import java.util.Collection; - -import org.apache.batik.util.SVGConstants; -import org.w3c.dom.Element; - -import de.lmu.ifi.dbs.elki.distance.distancevalue.Distance; -import de.lmu.ifi.dbs.elki.distance.distancevalue.DoubleDistance; -import de.lmu.ifi.dbs.elki.logging.LoggingUtil; -import de.lmu.ifi.dbs.elki.result.HierarchicalResult; -import de.lmu.ifi.dbs.elki.result.Result; -import de.lmu.ifi.dbs.elki.result.ResultUtil; -import de.lmu.ifi.dbs.elki.result.optics.ClusterOrderResult; -import de.lmu.ifi.dbs.elki.visualization.css.CSSClassManager.CSSNamingConflict; -import de.lmu.ifi.dbs.elki.visualization.opticsplot.OPTICSPlot; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection; -import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; -import de.lmu.ifi.dbs.elki.visualization.svg.SVGSimpleLinearAxis; -import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; -import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; -import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerContext; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerUtil; - -/** - * Visualize an OPTICS result by constructing an OPTICS plot for it. - * - * @author Erich Schubert - * - * @apiviz.has OPTICSPlot oneway - 1 visualizes - * @apiviz.has ClusterOrderResult oneway - 1 visualizes - * - * @param <D> Distance type - */ -public class OPTICSPlotVisualizer<D extends Distance<D>> extends AbstractVisualization { - /** - * Name for this visualizer. - */ - private static final String NAME = "OPTICS Plot"; - - /** - * The actual plot object. - */ - private OPTICSPlot<D> opticsplot; - - /** - * The image we generated. - */ - private File imgfile; - - public OPTICSPlotVisualizer(VisualizationTask task) { - super(task); - this.opticsplot = task.getResult(); - } - - @Override - protected void redraw() { - // TODO: Use width, height, imgratio, number of OPTICS plots! - double scale = StyleLibrary.SCALE; - final double sizex = scale; - final double sizey = scale * task.getHeight() / task.getWidth(); - final double margin = context.getStyleLibrary().getSize(StyleLibrary.MARGIN); - layer = SVGUtil.svgElement(svgp.getDocument(), SVGConstants.SVG_G_TAG); - final String transform = SVGUtil.makeMarginTransform(task.getWidth(), task.getHeight(), sizex, sizey, margin); - SVGUtil.setAtt(layer, SVGConstants.SVG_TRANSFORM_ATTRIBUTE, transform); - - if(imgfile == null) { - try { - imgfile = opticsplot.getAsTempFile(); - } - catch(IOException e) { - LoggingUtil.exception("Could not generate OPTICS plot.", e); - } - } - - Element itag = svgp.svgElement(SVGConstants.SVG_IMAGE_TAG); - SVGUtil.setAtt(itag, SVGConstants.SVG_IMAGE_RENDERING_ATTRIBUTE, SVGConstants.SVG_OPTIMIZE_SPEED_VALUE); - SVGUtil.setAtt(itag, SVGConstants.SVG_X_ATTRIBUTE, 0); - SVGUtil.setAtt(itag, SVGConstants.SVG_Y_ATTRIBUTE, 0); - SVGUtil.setAtt(itag, SVGConstants.SVG_WIDTH_ATTRIBUTE, scale); - SVGUtil.setAtt(itag, SVGConstants.SVG_HEIGHT_ATTRIBUTE, scale / opticsplot.getRatio()); - itag.setAttributeNS(SVGConstants.XLINK_NAMESPACE_URI, SVGConstants.XLINK_HREF_QNAME, imgfile.toURI().toString()); - - layer.appendChild(itag); - - try { - SVGSimpleLinearAxis.drawAxis(svgp, layer, opticsplot.getScale(), 0, scale / opticsplot.getRatio(), 0, 0, true, false, context.getStyleLibrary()); - SVGSimpleLinearAxis.drawAxis(svgp, layer, opticsplot.getScale(), scale, scale / opticsplot.getRatio(), scale, 0, true, true, context.getStyleLibrary()); - } - catch(CSSNamingConflict e) { - LoggingUtil.exception("CSS naming conflict for axes on OPTICS plot", e); - } - } - - /** - * Factory class for OPTICS plot. - * - * @author Erich Schubert - * - * @apiviz.stereotype factory - * @apiviz.uses OPTICSPlotVisualizer oneway - - «create» - */ - public static class Factory extends AbstractVisFactory { - /** - * Constructor, adhering to - * {@link de.lmu.ifi.dbs.elki.utilities.optionhandling.Parameterizable} - */ - public Factory() { - super(); - } - - @Override - public void processNewResult(HierarchicalResult baseResult, Result result) { - VisualizerContext context = VisualizerUtil.getContext(baseResult); - Collection<ClusterOrderResult<?>> cos = ResultUtil.filterResults(result, ClusterOrderResult.class); - for(ClusterOrderResult<?> co : cos) { - // Add plots, attach visualizer - OPTICSPlot<?> plot = OPTICSPlot.plotForClusterOrder(co, context); - if(plot != null) { - final VisualizationTask task = new VisualizationTask(NAME, plot, null, this, plot); - task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_STATIC); - baseResult.getHierarchy().add(plot, task); - } - } - } - - @Override - public Visualization makeVisualization(VisualizationTask task) { - return new OPTICSPlotVisualizer<DoubleDistance>(task); - } - - @Override - public boolean allowThumbnails(@SuppressWarnings("unused") VisualizationTask task) { - // Don't use thumbnails - return false; - } - - @Override - public Class<? extends Projection> getProjectionType() { - return null; - } - } -}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/PixmapVisualizer.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/PixmapVisualizer.java index 8667c2d4..06268dac 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/PixmapVisualizer.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/PixmapVisualizer.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.visunproj; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.awt.image.RenderedImage; import java.util.Collection; @@ -32,13 +33,12 @@ import de.lmu.ifi.dbs.elki.result.HierarchicalResult; import de.lmu.ifi.dbs.elki.result.PixmapResult; import de.lmu.ifi.dbs.elki.result.Result; import de.lmu.ifi.dbs.elki.result.ResultUtil; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisualization; import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; /** * Visualize an arbitrary pixmap result. @@ -121,7 +121,9 @@ public class PixmapVisualizer extends AbstractVisualization { Collection<PixmapResult> prs = ResultUtil.filterResults(result, PixmapResult.class); for(PixmapResult pr : prs) { // Add plots, attach visualizer - final VisualizationTask task = new VisualizationTask(NAME, pr, null, this, null); + final VisualizationTask task = new VisualizationTask(NAME, pr, null, this); + task.width = pr.getImage().getWidth() / pr.getImage().getHeight(); + task.height = 1.0; task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_STATIC); baseResult.getHierarchy().add(pr, task); } @@ -137,10 +139,5 @@ public class PixmapVisualizer extends AbstractVisualization { // Don't use thumbnails return false; } - - @Override - public Class<? extends Projection> getProjectionType() { - return null; - } } }
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/SettingsVisFactory.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/SettingsVisFactory.java index 9a62001e..9be580f7 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/SettingsVisFactory.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/SettingsVisFactory.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.visunproj; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.util.Collection; @@ -35,15 +36,14 @@ import de.lmu.ifi.dbs.elki.utilities.iterator.IterableIterator; import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.ClassParameter; import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Parameter; import de.lmu.ifi.dbs.elki.utilities.pairs.Pair; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; +import de.lmu.ifi.dbs.elki.visualization.VisualizerContext; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; import de.lmu.ifi.dbs.elki.visualization.svg.SVGPlot; import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; import de.lmu.ifi.dbs.elki.visualization.visualizers.StaticVisualization; import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizerContext; /** * Pseudo-Visualizer, that lists the settings of the algorithm- @@ -140,7 +140,9 @@ public class SettingsVisFactory extends AbstractVisFactory { public void processNewResult(HierarchicalResult baseResult, Result newResult) { final IterableIterator<SettingsResult> settingsResults = ResultUtil.filteredResults(newResult, SettingsResult.class); for(SettingsResult sr : settingsResults) { - final VisualizationTask task = new VisualizationTask(NAME, sr, null, this, null); + final VisualizationTask task = new VisualizationTask(NAME, sr, null, this); + task.width = 1.0; + task.height = 1.0; task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_STATIC); baseResult.getHierarchy().add(sr, task); } @@ -150,9 +152,4 @@ public class SettingsVisFactory extends AbstractVisFactory { public boolean allowThumbnails(@SuppressWarnings("unused") VisualizationTask task) { return false; } - - @Override - public Class<? extends Projection> getProjectionType() { - return null; - } }
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/SimilarityMatrixVisualizer.java b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/SimilarityMatrixVisualizer.java index c7a64d54..f9b1ef52 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/SimilarityMatrixVisualizer.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/SimilarityMatrixVisualizer.java @@ -1,26 +1,27 @@ package de.lmu.ifi.dbs.elki.visualization.visualizers.visunproj; -/* -This file is part of ELKI: -Environment for Developing KDD-Applications Supported by Index-Structures - -Copyright (C) 2011 -Ludwig-Maximilians-Universität München -Lehr- und Forschungseinheit für Datenbanksysteme -ELKI Development Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ import java.awt.image.RenderedImage; import java.util.Collection; @@ -36,13 +37,12 @@ import de.lmu.ifi.dbs.elki.result.HierarchicalResult; import de.lmu.ifi.dbs.elki.result.Result; import de.lmu.ifi.dbs.elki.result.ResultUtil; import de.lmu.ifi.dbs.elki.utilities.DatabaseUtil; -import de.lmu.ifi.dbs.elki.visualization.projections.Projection; +import de.lmu.ifi.dbs.elki.visualization.VisualizationTask; import de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary; import de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisFactory; import de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisualization; import de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization; -import de.lmu.ifi.dbs.elki.visualization.visualizers.VisualizationTask; /** * Visualize a similarity matrix with object labels @@ -149,7 +149,9 @@ public class SimilarityMatrixVisualizer extends AbstractVisualization { Collection<ComputeSimilarityMatrixImage.SimilarityMatrix> prs = ResultUtil.filterResults(result, ComputeSimilarityMatrixImage.SimilarityMatrix.class); for(ComputeSimilarityMatrixImage.SimilarityMatrix pr : prs) { // Add plots, attach visualizer - final VisualizationTask task = new VisualizationTask(NAME, pr, null, this, null); + final VisualizationTask task = new VisualizationTask(NAME, pr, null, this); + task.width = 1.0; + task.height = 1.0; task.put(VisualizationTask.META_LEVEL, VisualizationTask.LEVEL_STATIC); baseResult.getHierarchy().add(pr, task); } @@ -165,10 +167,5 @@ public class SimilarityMatrixVisualizer extends AbstractVisualization { // Don't use thumbnails return false; } - - @Override - public Class<? extends Projection> getProjectionType() { - return null; - } } }
\ No newline at end of file |