Examples of StylingPolicy


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

    }
  }

  @Override
  protected void redraw() {
    StylingPolicy sp = context.getStyleResult().getStylingPolicy();
    addCSSClasses(svgp, sp);

    Iterator<DBID> ids = sample.getSample().iterator();
    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]);
          }
          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

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

  @Override
  public void redraw() {
    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);
          }
          catch(ObjectNotFoundException e) {
            // ignore.
          }
        }
      }
    }
    else {
      final String FILL = SVGConstants.CSS_FILL_PROPERTY + ":";
      // Color-based styling. Fall back to dots
      for(DBID id : sample.getSample()) {
        try {
          double[] v = proj.fastProjectDataToRenderSpace(rel.get(id));
          Element dot = svgp.svgCircle(v[0], v[1], marker_size);
          SVGUtil.addCSSClass(dot, DOTMARKER);
          int col = spol.getColorForDBID(id);
          SVGUtil.setAtt(dot, SVGConstants.SVG_STYLE_ATTRIBUTE, FILL + SVGUtil.colorToString(col));
          layer.appendChild(dot);
        }
        catch(ObjectNotFoundException e) {
          // ignore.
View Full Code Here

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

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

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

      i++;
    }

    // Add a button to set style policy
    {
      StylingPolicy sp = context.getStyleResult().getStylingPolicy();
      if(sp instanceof ClusterStylingPolicy && ((ClusterStylingPolicy) sp).getClustering() == clustering) {
        // Don't show the button when active. May confuse people more than the disappearing button
       
        // SVGButton button = new SVGButton(.1, i + 1.1, 3.8, .7, .2);
        // button.setTitle("Active style", "darkgray");
View Full Code Here

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

    context.removeDataStoreListener(this);
  }

  @Override
  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);
          }
        }
      }
    }
    else {
      // 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);
            int color = stylepolicy.getColorForDBID(objId);
            final StringBuffer style = new StringBuffer();
            if(fill) {
              style.append(SVGConstants.CSS_FILL_PROPERTY + ":").append(SVGUtil.colorToString(color));
              style.append(SVGConstants.CSS_FILL_OPACITY_PROPERTY + ":0.5");
            }
View Full Code Here

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

    // }
    // Supported by this class?
    if(!OPTICSPlot.canPlot(co)) {
      return null;
    }
    final StylingPolicy policy = context.getStyleResult().getStylingPolicy();
    final OPTICSColorAdapter opcolor = new OPTICSColorFromStylingPolicy(policy);

    OPTICSPlot<D> opticsplot = new OPTICSPlot<D>(co, opcolor);
    // co.addChildResult(opticsplot);
    return opticsplot;
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.