Package de.lmu.ifi.dbs.elki.visualization.svg

Examples of de.lmu.ifi.dbs.elki.visualization.svg.SVGPath


        Element path = VoronoiDraw.drawFakeVoronoi(proj, means).makeElement(svgp);
        SVGUtil.addCSSClass(path, KMEANSBORDER);
        layer.appendChild(path);
      }
      if(mode == Mode.DELAUNAY || mode == Mode.V_AND_D) {
        Element path = new SVGPath(proj.fastProjectDataToRenderSpace(means.get(0))).drawTo(proj.fastProjectDataToRenderSpace(means.get(1))).makeElement(svgp);
        SVGUtil.addCSSClass(path, KMEANSBORDER);
        layer.appendChild(path);
      }
    }
    else {
View Full Code Here


  protected void drawSphere2D(int cnum, Vector cent, Vector[] pc) {
    for(int dim1 = 0; dim1 < pc.length - 1; dim1++) {
      for(int dim2 = dim1 + 1; dim2 < pc.length; dim2++) {
        for(int i = 1; i <= times; i++) {
          SVGPath path = new SVGPath();

          Vector direction1 = pc[dim1].times(KAPPA * i);
          Vector direction2 = pc[dim2].times(KAPPA * i);

          Vector p1 = cent.plusTimes(pc[dim1], i);
          Vector p2 = cent.plusTimes(pc[dim2], i);
          Vector p3 = cent.minusTimes(pc[dim1], i);
          Vector p4 = cent.minusTimes(pc[dim2], i);

          path.moveTo(p1);
          path.cubicTo(p1.plus(direction2), p2.plus(direction1), p2);
          path.cubicTo(p2.minus(direction1), p3.plus(direction2), p3);
          path.cubicTo(p3.minus(direction2), p4.minus(direction1), p4);
          path.cubicTo(p4.plus(direction1), p1.minus(direction2), p1);
          path.close();

          Element ellipse = path.makeElement(svgp);
          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;
            cls.setStatement(SVGConstants.CSS_FILL_OPACITY_PROPERTY, s);
View Full Code Here

  }

  protected void drawHullLines(int cnum, Vector cent, Polygon chres) {
    if(chres.size() > 1) {
      for(int i = 1; i <= times; i++) {
        SVGPath path = new SVGPath();
        for(int p = 0; p < chres.size(); p++) {
          Vector cur = cent.plusTimes(chres.get(p), i);
          path.drawTo(cur);
        }
        path.close();
        Element ellipse = path.makeElement(svgp);
        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;
          cls.setStatement(SVGConstants.CSS_FILL_OPACITY_PROPERTY, s);
View Full Code Here

    return chres;
  }

  protected void drawHullArc(int cnum, Vector cent, Polygon chres) {
    for(int i = 1; i <= times; i++) {
      SVGPath path = new SVGPath();

      ArrayList<Vector> delta = new ArrayList<Vector>(chres.size());
      for(int p = 0; p < chres.size(); p++) {
        Vector prev = chres.get((p - 1 + chres.size()) % chres.size());
        Vector curr = chres.get(p);
        Vector next = chres.get((p + 1) % chres.size());
        Vector d1 = next.minus(curr).normalize();
        Vector d2 = curr.minus(prev).normalize();
        delta.add(d1.plus(d2));
        // delta.add(next.minus(prev));
      }

      for(int p = 0; p < chres.size(); p++) {
        Vector cur = cent.plus(chres.get(p));
        Vector nex = cent.plus(chres.get((p + 1) % chres.size()));
        Vector dcur = delta.get(p);
        Vector dnex = delta.get((p + 1) % chres.size());
        drawArc(path, cent, cur, nex, dcur, dnex, i);
      }
      path.close();

      Element ellipse = path.makeElement(svgp);

      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;
View Full Code Here

      double right = left;

      SVGPath[] paths = new SVGPath[cols];
      double[] lasty = new double[cols];
      for(int i = 0; i < cols; i++) {
        paths[i] = new SVGPath(xsize * left, ysize * 1);
        lasty[i] = 0;
      }

      // draw histogram lines
      for(DoubleObjPair<double[]> bin : histogram) {
View Full Code Here

      minmaxy.put(pair.second);
    }
    LinearScale scalex = new LinearScale(minmaxx.getMin(), minmaxx.getMax());
    LinearScale scaley = new LinearScale(minmaxy.getMin(), minmaxy.getMax());
    // plot the line
    SVGPath path = new SVGPath();
    for(DoubleDoublePair pair : curve) {
      final double x = scalex.getScaled(pair.first);
      final double y = 1 - scaley.getScaled(pair.second);
      path.drawTo(sizex * x, sizey * y);
    }
    Element line = path.makeElement(svgp);
    line.setAttribute(SVGConstants.SVG_CLASS_ATTRIBUTE, SERIESID);

    // add axes
    try {
      SVGSimpleLinearAxis.drawAxis(svgp, layer, scaley, 0, sizey, 0, 0, SVGSimpleLinearAxis.LabelStyle.LEFTHAND, context.getStyleLibrary());
View Full Code Here

      try {
        PolygonsObject poly = rep.get(id);
        if(poly == null) {
          continue;
        }
        SVGPath path = new SVGPath();
        for(Polygon ppoly : poly.getPolygons()) {
          Vector first = ppoly.get(0);
          double[] f = proj.fastProjectDataToRenderSpace(first);
          path.moveTo(f[0], f[1]);
          for(Vector v : ppoly) {
            if(v == first) {
              continue;
            }
            double[] p = proj.fastProjectDataToRenderSpace(v);
            path.drawTo(p[0], p[1]);
          }
          // close path.
          path.drawTo(f[0], f[1]);
        }
        Element e = path.makeElement(svgp);
        SVGUtil.addCSSClass(e, POLYS);
        layer.appendChild(e);
      }
      catch(ObjectNotFoundException e) {
        // ignore.
View Full Code Here

    LinearScale xscale = new LinearScale(xminmax.getMin() - binwidth / 2, xminmax.getMax() + binwidth / 2);
    LinearScale yscale = new LinearScale(yminmax.getMin(), yminmax.getMax());

    SVGPath[] path = new SVGPath[dim];
    for(int i = 0; i < dim; i++) {
      path[i] = new SVGPath(sizex * xscale.getScaled(xminmax.getMin() - binwidth / 2), sizey);
    }

    // draw curves.
    for(NumberVector<?, ?> vec : curve) {
      for(int d = 0; d < dim; d++) {
View Full Code Here

      try {
        PolygonsObject poly = rep.get(id);
        if(poly == null) {
          continue;
        }
        SVGPath path = new SVGPath();
        for(Polygon ppoly : poly.getPolygons()) {
          Vector first = ppoly.get(0);
          double[] f = proj.fastProjectDataToRenderSpace(first.getArrayRef());
          path.moveTo(f[0], f[1]);
          for(Vector v : ppoly) {
            if(v == first) {
              continue;
            }
            double[] p = proj.fastProjectDataToRenderSpace(v.getArrayRef());
            path.drawTo(p[0], p[1]);
          }
          // close path.
          path.drawTo(f[0], f[1]);
        }
        Element e = path.makeElement(svgp);
        SVGUtil.addCSSClass(e, POLYS);
        layer.appendChild(e);
      }
      catch(ObjectNotFoundException e) {
        // ignore.
View Full Code Here

      layer.appendChild(meanMarkerCenter);
      layer.appendChild(meanMarkerCenter2);

      if(stars) {
        SVGPath star = new SVGPath();
        for(DBID id : clus.getIDs()) {
          double[] obj = proj.fastProjectDataToRenderSpace(rel.get(id));
          star.moveTo(mean);
          star.drawTo(obj);
        }
        Element stare = star.makeElement(svgp);
        SVGUtil.setCSSClass(stare, CSS_MEAN_STAR + "_" + cnum);
        layer.appendChild(stare);
      }
    }
  }
View Full Code Here

TOP

Related Classes of de.lmu.ifi.dbs.elki.visualization.svg.SVGPath

Copyright © 2018 www.massapicom. 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.