Search in sources :

Example 1 with Projector

use of de.lmu.ifi.dbs.elki.visualization.projector.Projector in project elki by elki-project.

the class DetailView method visualizationChanged.

@Override
public void visualizationChanged(VisualizationItem current) {
    // Make sure we are affected:
    if (!(current instanceof VisualizationTask)) {
        return;
    }
    final VisualizationTask task = (VisualizationTask) current;
    // Get the layer
    Visualization vis = taskmap.get(task);
    if (vis == null) {
        // Unknown only.
        boolean include = false;
        for (It<Projector> it = context.getVisHierarchy().iterAncestors(current).filter(Projector.class); it.valid(); it.advance()) {
            if ((item.proj != null && item.proj.getProjector() == it.get()) || taskmap.containsKey(it.get())) {
                include = true;
                break;
            }
        }
        if (!include) {
            // Attached to different projection.
            return;
        }
    }
    if (vis == null) {
        // New visualization
        taskmap.put(task, null);
        lazyRefresh();
    } else {
        Element prevlayer = layermap.get(vis);
        Element layer = vis.getLayer();
        if (prevlayer != layer) {
            lazyRefresh();
        } else {
            boolean isVisible = !SVGConstants.CSS_HIDDEN_VALUE.equals(layer.getAttribute(SVGConstants.CSS_VISIBILITY_PROPERTY));
            if (task.isVisible() != isVisible) {
                // Visibility has changed.
                lazyRefresh();
            }
        }
    }
}
Also used : Projector(de.lmu.ifi.dbs.elki.visualization.projector.Projector) Visualization(de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization) VisualizationTask(de.lmu.ifi.dbs.elki.visualization.VisualizationTask) Element(org.w3c.dom.Element)

Example 2 with Projector

use of de.lmu.ifi.dbs.elki.visualization.projector.Projector in project elki by elki-project.

the class ExportVisualizations method processNewResult.

@Override
public void processNewResult(ResultHierarchy hier, Result newResult) {
    if (output.isFile()) {
        throw new AbortException("Output folder cannot be an existing file.");
    }
    if (!output.exists() && !output.mkdirs()) {
        throw new AbortException("Could not create output directory.");
    }
    if (this.baseResult == null) {
        this.baseResult = newResult;
        context = null;
        counter = new HashMap<>();
        LOG.warning("Note: Reusing visualization exporter for more than one result is untested.");
    }
    if (context == null) {
        context = manager.newContext(hier, baseResult);
    }
    // Projected visualizations
    Hierarchy<Object> vistree = context.getVisHierarchy();
    for (It<Projector> iter2 = vistree.iterAll().filter(Projector.class); iter2.valid(); iter2.advance()) {
        // TODO: allow selecting individual projections only.
        Collection<PlotItem> items = iter2.get().arrange(context);
        for (PlotItem item : items) {
            processItem(item);
        }
    }
    for (It<VisualizationTask> iter2 = vistree.iterAll().filter(VisualizationTask.class); iter2.valid(); iter2.advance()) {
        VisualizationTask task = iter2.get();
        if (vistree.iterParents(task).filter(Projector.class).valid()) {
            continue;
        }
        PlotItem pi = new PlotItem(ratio, 1.0, null);
        pi.add(task);
        processItem(pi);
    }
}
Also used : Projector(de.lmu.ifi.dbs.elki.visualization.projector.Projector) VisualizationTask(de.lmu.ifi.dbs.elki.visualization.VisualizationTask) PlotItem(de.lmu.ifi.dbs.elki.visualization.gui.overview.PlotItem) AbortException(de.lmu.ifi.dbs.elki.utilities.exceptions.AbortException)

Aggregations

VisualizationTask (de.lmu.ifi.dbs.elki.visualization.VisualizationTask)2 Projector (de.lmu.ifi.dbs.elki.visualization.projector.Projector)2 AbortException (de.lmu.ifi.dbs.elki.utilities.exceptions.AbortException)1 PlotItem (de.lmu.ifi.dbs.elki.visualization.gui.overview.PlotItem)1 Visualization (de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization)1 Element (org.w3c.dom.Element)1