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

Examples of de.lmu.ifi.dbs.elki.visualization.style.ClassStylingPolicy


    if(ids == null || !ids.hasNext()) {
      ids = relation.iterDBIDs();
    }
    if(sp instanceof ClassStylingPolicy) {
      // FIXME: doesn't use sampling yet.
      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]);
View Full Code Here


  private void addCSSClasses(SVGPlot svgp, StylingPolicy sp) {
    final StyleLibrary style = context.getStyleLibrary();
    final LineStyleLibrary lines = style.lines();
    final double width = .5 * style.getLineWidth(StyleLibrary.PLOT);
    if(sp instanceof ClassStylingPolicy) {
      ClassStylingPolicy csp = (ClassStylingPolicy) sp;
      for(int i = csp.getMinStyle(); i < csp.getMaxStyle(); i++) {
        String key = DATALINE + "_" + i;
        if(!svgp.getCSSClassManager().contains(key)) {
          CSSClass cls = new CSSClass(this, key);
          cls.setStatement(SVGConstants.CSS_STROKE_LINECAP_PROPERTY, SVGConstants.CSS_ROUND_VALUE);
          cls.setStatement(SVGConstants.CSS_STROKE_LINEJOIN_PROPERTY, SVGConstants.CSS_ROUND_VALUE);
View Full Code Here

    final MarkerLibrary ml = context.getStyleLibrary().markers();
    final double marker_size = context.getStyleLibrary().getSize(StyleLibrary.MARKERPLOT);
    final StylingPolicy spol = style.getStylingPolicy();

    if(spol instanceof ClassStylingPolicy) {
      ClassStylingPolicy cspol = (ClassStylingPolicy) spol;
      for(int cnum = cspol.getMinStyle(); cnum < cspol.getMaxStyle(); cnum++) {
        for(Iterator<DBID> iter = cspol.iterateClass(cnum); iter.hasNext();) {
          DBID cur = iter.next();
          try {
            final NumberVector<?, ?> vec = rel.get(cur);
            double[] v = proj.fastProjectDataToRenderSpace(vec);
            ml.useMarker(svgp, layer, v[0], v[1], cnum, marker_size);
View Full Code Here

    final String transform = SVGUtil.makeMarginTransform(task.getWidth(), task.getHeight(), xsize, ysize, margin);
    SVGUtil.setAtt(layer, SVGConstants.SVG_TRANSFORM_ATTRIBUTE, transform);

    // Styling policy
    final StylingPolicy spol = style.getStylingPolicy();
    final ClassStylingPolicy cspol;
    if(spol instanceof ClassStylingPolicy) {
      cspol = (ClassStylingPolicy) spol;
    }
    else {
      cspol = null;
    }
    // TODO also use min style?
    setupCSS(svgp, (cspol != null) ? cspol.getMaxStyle() : 0);

    // Create histograms
    final int off = (cspol != null) ? cspol.getMinStyle() : 0;
    final int numc = (cspol != null) ? (cspol.getMaxStyle() - cspol.getMinStyle()) : 0;
    DoubleMinMax minmax = new DoubleMinMax();
    final double frac = 1. / relation.size(); // TODO: sampling?
    final int cols = numc + 1;
    AggregatingHistogram<double[], double[]> histogram = new AggregatingHistogram<double[], double[]>(bins, -.5, .5, new AggregatingHistogram.Adapter<double[], double[]>() {
      @Override
      public double[] aggregate(double[] existing, double[] data) {
        for(int i = 0; i < existing.length; i++) {
          existing[i] += data[i];
        }
        return existing;
      }

      @Override
      public double[] make() {
        return new double[cols];
      }
    });

    if(cspol != null) {
      for(int snum = 0; snum < numc; snum++) {
        double[] inc = new double[cols];
        inc[0] = frac;
        inc[snum + 1] = frac;
        for(Iterator<DBID> iter = cspol.iterateClass(snum + off); iter.hasNext();) {
          DBID id = iter.next();
          try {
            double pos = proj.fastProjectDataToRenderSpace(relation.get(id)) / Projection.SCALE;
            histogram.aggregate(pos, inc);
          }
View Full Code Here

  public void redraw() {
    StylingPolicy stylepolicy = context.getStyleResult().getStylingPolicy();
    // bubble size
    final double bubble_size = context.getStyleLibrary().getSize(StyleLibrary.BUBBLEPLOT);
    if(stylepolicy instanceof ClassStylingPolicy) {
      ClassStylingPolicy colors = (ClassStylingPolicy) stylepolicy;
      setupCSS(svgp, colors);
      // draw data
      for(DBID objId : sample.getSample()) {
        final Double radius = getScaledForId(objId);
        if(radius > 0.01 && !Double.isInfinite(radius)) {
          final NumberVector<?, ?> vec = rel.get(objId);
          if(vec != null) {
            double[] v = proj.fastProjectDataToRenderSpace(vec);
            Element circle = svgp.svgCircle(v[0], v[1], radius * bubble_size);
            SVGUtil.addCSSClass(circle, BUBBLE + colors.getStyleForDBID(objId));
            layer.appendChild(circle);
          }
        }
      }
    }
View Full Code Here

TOP

Related Classes of de.lmu.ifi.dbs.elki.visualization.style.ClassStylingPolicy

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.