Examples of CanvasSize


Examples of de.lmu.ifi.dbs.elki.visualization.projections.CanvasSize

   * @param width Width
   * @param height Height
   * @return wrapper element with appropriate view box.
   */
  public static Element setupCanvas(SVGPlot svgp, Projection2D proj, double margin, double width, double height) {
    final CanvasSize canvas = proj.estimateViewport();
    final double sizex = canvas.getDiffX();
    final double sizey = canvas.getDiffY();
    String transform = SVGUtil.makeMarginTransform(width, height, sizex, sizey, margin) + " translate(" + SVGUtil.fmt(sizex / 2) + " " + SVGUtil.fmt(sizey / 2) + ")";

    final Element layer = SVGUtil.svgElement(svgp.getDocument(), SVGConstants.SVG_G_TAG);
    SVGUtil.setAtt(layer, SVGConstants.SVG_TRANSFORM_ATTRIBUTE, transform);
    return layer;
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.visualization.projections.CanvasSize

   * @param means Cluster means
   * @return SVG path
   */
  public static SVGPath drawVoronoi(Projection2D proj, List<SweepHullDelaunay2D.Triangle> delaunay, List<double[]> means) {
    final SVGPath path = new SVGPath();
    CanvasSize viewport = proj.estimateViewport();
    for(int i = 0; i < delaunay.size(); i++) {
      SweepHullDelaunay2D.Triangle del = delaunay.get(i);
      final double[] projcx = proj.fastProjectDataToRenderSpace(del.m.getArrayRef());
      if(del.ab > i) {
        Triangle oth = delaunay.get(del.ab);
        path.moveTo(projcx);
        path.drawTo(proj.fastProjectDataToRenderSpace(oth.m.getArrayRef()));
      }
      else if(del.ab < 0) {
        double[] dirv = VMath.minus(means.get(del.a), means.get(del.b));
        VMath.rotate90Equals(dirv);
        double[] dir = proj.fastProjectRelativeDataToRenderSpace(dirv);
        final double factor = viewport.continueToMargin(projcx, dir);
        if(factor > 0) {
          path.moveTo(projcx);
          path.relativeLineTo(factor * dir[0], factor * dir[1]);
        }
      }

      if(del.bc > i) {
        Triangle oth = delaunay.get(del.bc);
        path.moveTo(projcx);
        path.drawTo(proj.fastProjectDataToRenderSpace(oth.m.getArrayRef()));
      }
      else if(del.bc < 0) {
        double[] dirv = VMath.minus(means.get(del.b), means.get(del.c));
        VMath.rotate90Equals(dirv);
        double[] dir = proj.fastProjectRelativeDataToRenderSpace(dirv);
        final double factor = viewport.continueToMargin(projcx, dir);
        if(factor > 0) {
          path.moveTo(projcx);
          path.relativeLineTo(factor * dir[0], factor * dir[1]);
        }
      }

      if(del.ca > i) {
        Triangle oth = delaunay.get(del.ca);
        path.moveTo(projcx);
        path.drawTo(proj.fastProjectDataToRenderSpace(oth.m.getArrayRef()));
      }
      else if(del.ca < 0) {
        double[] dirv = VMath.minus(means.get(del.c), means.get(del.a));
        VMath.rotate90Equals(dirv);
        double[] dir = proj.fastProjectRelativeDataToRenderSpace(dirv);
        final double factor = viewport.continueToMargin(projcx, dir);
        if(factor > 0) {
          path.moveTo(projcx);
          path.relativeLineTo(factor * dir[0], factor * dir[1]);
        }
      }
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.visualization.projections.CanvasSize

   * @param proj Projection
   * @param means Mean vectors
   * @return SVG path
   */
  public static SVGPath drawFakeVoronoi(Projection2D proj, List<double[]> means) {
    CanvasSize viewport = proj.estimateViewport();
    final SVGPath path = new SVGPath();
    // Difference
    final double[] dirv = VMath.minus(means.get(1), means.get(0));
    VMath.rotate90Equals(dirv);
    double[] dir = proj.fastProjectRelativeDataToRenderSpace(dirv);
    // Mean
    final double[] mean = VMath.plus(means.get(0), means.get(1));
    VMath.timesEquals(mean, 0.5);
    double[] projmean = proj.fastProjectDataToRenderSpace(mean);

    double factor = viewport.continueToMargin(projmean, dir);
    path.moveTo(projmean[0] + factor * dir[0], projmean[1] + factor * dir[1]);
    // Inverse direction:
    dir[0] *= -1;
    dir[1] *= -1;
    factor = viewport.continueToMargin(projmean, dir);
    path.drawTo(projmean[0] + factor * dir[0], projmean[1] + factor * dir[1]);
    return path;
  }
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.visualization.projections.CanvasSize

  protected void redraw() {
    if(img == null) {
      renderImage();
    }

    CanvasSize canvas = proj.estimateViewport();
    String imguri = ThumbnailRegistryEntry.INTERNAL_PREFIX + ThumbnailRegistryEntry.registerImage(img);
    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, canvas.minx);
    SVGUtil.setAtt(itag, SVGConstants.SVG_Y_ATTRIBUTE, canvas.miny);
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.visualization.projections.CanvasSize

      }
    };
    // TODO: choose comparator order based on smaller bandwidth?
    Arrays.sort(data, comp0);

    CanvasSize canvas = proj.estimateViewport();
    double min0 = canvas.minx, max0 = canvas.maxx, ste0 = (max0 - min0) / resolution;
    double min1 = canvas.miny, max1 = canvas.maxy, ste1 = (max1 - min1) / resolution;

    double kernf = 9. / (16 * bandwidth[0] * bandwidth[1]);
    double maxdens = 0.0;
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.visualization.projections.CanvasSize

        vis.add(task);
      }
    }

    // calculate the position of the first tool
    CanvasSize viewport = proj.estimateViewport();
    double x = viewport.getMinX() - 0.17 * scale;
    double width = 0.07 * scale;
    double height = 0.06 * scale;
    double miny = viewport.getMinY();
    double maxy = viewport.getMaxY();
    double y = (miny + maxy) / 2 - (vis.size() * height * 1.4) / 2;
    if(y < miny) {
      logger.warning("Too many Tools");
    }

View Full Code Here

Examples of de.lmu.ifi.dbs.elki.visualization.projections.CanvasSize

  }

  @Override
  protected void redraw() {
    // Viewport size, for "relative size" computations
    final CanvasSize viewp = proj.estimateViewport();
    double projarea = viewp.getDiffX() * viewp.getDiffY();

    double opacity = 0.25;

    Iterator<Cluster<Model>> ci = clustering.getAllClusters().iterator();

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.