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

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


      ClassStylingPolicy csp = (ClassStylingPolicy) sp;
      for(int c = csp.getMinStyle(); c < csp.getMaxStyle(); c++) {
        String key = DATALINE + "_" + c;
        for(Iterator<DBID> iter = csp.iterateClass(c); iter.hasNext();) {
          DBID id = iter.next();
          SVGPath path = new SVGPath();
          double[] yPos = proj.fastProjectDataToRenderSpace(relation.get(id));
          for(int i = 0; i < yPos.length; i++) {
            path.drawTo(getVisibleAxisX(i), yPos[i]);
          }
          Element line = path.makeElement(svgp);
          SVGUtil.addCSSClass(line, key);
          layer.appendChild(line);
        }
      }
    }
    else {
      while(ids.hasNext()) {
        DBID id = ids.next();
        SVGPath path = new SVGPath();
        double[] yPos = proj.fastProjectDataToRenderSpace(relation.get(id));
        for(int i = 0; i < yPos.length; i++) {
          path.drawTo(getVisibleAxisX(i), yPos[i]);
        }
        Element line = path.makeElement(svgp);
        SVGUtil.addCSSClass(line, DATALINE);
        // assign color
        line.setAttribute(SVGConstants.SVG_STYLE_ATTRIBUTE, SVGConstants.CSS_STROKE_PROPERTY + ":" + SVGUtil.colorToString(sp.getColorForDBID(id)));
        layer.appendChild(line);
      }
View Full Code Here


        continue;
      }

      double[] pmean = proj.fastProjectDataToRenderSpace(mean);

      SVGPath path = new SVGPath();
      for(int i = 0; i < pmean.length; i++) {
        path.drawTo(getVisibleAxisX(i), pmean[i]);
      }

      Element meanline = path.makeElement(svgp);
      SVGUtil.addCSSClass(meanline, CLUSTERMEAN + cnum);
      layer.appendChild(meanline);
    }
  }
View Full Code Here

  private void visualizeRTreeEntry(SVGPlot svgp, Element layer, ProjectionParallel proj, AbstractRStarTree<? extends N, E> rtree, E entry, int depth, int step) {
    final int dim = proj.getVisibleDimensions();
    double[] min = proj.fastProjectDataToRenderSpace(SpatialUtil.getMin(entry));
    double[] max = proj.fastProjectDataToRenderSpace(SpatialUtil.getMax(entry));
    assert (min.length == dim && max.length == dim);
    SVGPath path = new SVGPath();
    for(int i = 0; i < dim; i++) {
      path.drawTo(getVisibleAxisX(i), Math.max(min[i], max[i]));
    }
    for(int i = dim - 1; i >= 0; i--) {
      path.drawTo(getVisibleAxisX(i), Math.min(min[i], max[i]));
    }
    path.close();

    Element intervals = path.makeElement(svgp);

    SVGUtil.addCSSClass(intervals, INDEX + depth);
    layer.appendChild(intervals);

    if(!entry.isLeafEntry()) {
View Full Code Here

            midmm[i - 1].put((yPos[i] + yPos[i - 1]) / 2.);
          }
        }
      }

      SVGPath path = new SVGPath();
      if(!rounded) {
        // Straight lines
        for(int i = 0; i < dim; i++) {
          path.drawTo(getVisibleAxisX(i), mms[i].getMax());
          if(i < dim - 1) {
            path.drawTo(getVisibleAxisX(i + .5), midmm[i].getMax());
          }
        }
        for(int i = dim - 1; i >= 0; i--) {
          if(i < dim - 1) {
            path.drawTo(getVisibleAxisX(i + .5), midmm[i].getMin());
          }
          path.drawTo(getVisibleAxisX(i), mms[i].getMin());
        }
        path.close();
      }
      else {
        // Maxima
        path.drawTo(getVisibleAxisX(0), mms[0].getMax());
        for(int i = 1; i < dim; i++) {
          path.quadTo(getVisibleAxisX(i - .5), midmm[i - 1].getMax(), getVisibleAxisX(i), mms[i].getMax());
        }
        // Minima
        path.drawTo(getVisibleAxisX(dim - 1), mms[dim - 1].getMin());
        for(int i = dim - 1; i > 0; i--) {
          path.quadTo(getVisibleAxisX(i - .5), midmm[i - 1].getMin(), getVisibleAxisX(i - 1), mms[i - 1].getMin());
        }
        path.close();
      }

      Element intervals = path.makeElement(svgp);
      SVGUtil.addCSSClass(intervals, CLUSTERAREA + cnum);
      layer.appendChild(intervals);
    }
  }
View Full Code Here

      DBIDs selection = selContext.getSelectedIds();

      for(DBID objId : selection) {
        double[] yPos = proj.fastProjectDataToRenderSpace(relation.get(objId));

        SVGPath path = new SVGPath();
        for(int i = 0; i < proj.getVisibleDimensions(); i++) {
          path.drawTo(getVisibleAxisX(i), yPos[i]);
        }
        Element marker = path.makeElement(svgp);
        SVGUtil.addCSSClass(marker, MARKER);
        layer.appendChild(marker);
      }
    }
  }
View Full Code Here

          // ignore
        }
      }
      Polygon chres = hull.getHull();
      if(chres != null && chres.size() >= 3) {
        SVGPath path = new SVGPath(chres);

        Element selHull = path.makeElement(svgp);
        SVGUtil.addCSSClass(selHull, SELECTEDHULL);
        // TODO: use relative selection size for opacity?
        layer.appendChild(selHull);
      }
    }
View Full Code Here

      }
      Polygon chres = hull.getHull();

      // Plot the convex hull:
      if(chres != null) {
        SVGPath path = new SVGPath(chres);
        // Approximate area (using bounding box)
        double hullarea = SpatialUtil.volume(chres);
        final double relativeArea = (projarea - hullarea) / projarea;
        final double relativeSize = (double) ids.size() / rel.size();
        opacity = Math.sqrt(relativeSize * relativeArea);

        hulls = path.makeElement(svgp);
        addCSSClasses(svgp, cnum, opacity);
        SVGUtil.addCSSClass(hulls, CONVEXHULL + cnum);
        layer.appendChild(hulls);
      }
    }
View Full Code Here

      double step = 1.0;
      if(resolution < dim) {
        step = (double) dim / (double) resolution;
      }

      SVGPath path = new SVGPath();
      for(double id = 0; id < dim; id += step) {
        int i = (int) Math.floor(id);
        path.drawTo(StyleLibrary.SCALE * ratio * (((double) i) / (dim - 1)), StyleLibrary.SCALE * (1.0 - s.getScaled(series.doubleValue(i + 1))));
      }
      Element p = path.makeElement(plot);
      return p;
    }
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, scalex, 0, sizey, sizex, sizey, true, true, context.getStyleLibrary());
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

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.