Examples of DBIDSelection


Examples of de.lmu.ifi.dbs.elki.result.DBIDSelection

  @Override
  protected void redraw() {
    addCSSClasses(svgp);
    final double size = context.getStyleLibrary().getSize(StyleLibrary.SELECTION);
    DBIDSelection selContext = context.getSelection();
    if(selContext != null) {
      DBIDs selection = selContext.getSelectedIds();
      for(DBID i : selection) {
        try {
          double[] v = proj.fastProjectDataToRenderSpace(rel.get(i));
          Element dot = svgp.svgCircle(v[0], v[1], size);
          SVGUtil.addCSSClass(dot, MARKER);
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.result.DBIDSelection

   * @param proj
   * @param p1 first point of the selected rectangle
   * @param p2 second point of the selected rectangle
   */
  private void updateSelection(Mode mode, Projection2D proj, SVGPoint p1, SVGPoint p2) {
    DBIDSelection selContext = context.getSelection();
    // Note: we rely on SET semantics below!
    HashSetModifiableDBIDs selection;
    if(selContext == null || mode == Mode.REPLACE) {
      selection = DBIDUtil.newHashSet();
    }
    else {
      selection = DBIDUtil.newHashSet(selContext.getSelectedIds());
    }
    for(DBID id : rel.iterDBIDs()) {
      double[] vec = proj.fastProjectDataToRenderSpace(rel.get(id));
      if(vec[0] >= Math.min(p1.getX(), p2.getX()) && vec[0] <= Math.max(p1.getX(), p2.getX()) && vec[1] >= Math.min(p1.getY(), p2.getY()) && vec[1] <= Math.max(p1.getY(), p2.getY())) {
        if(mode == Mode.INVERT) {
          if(!selection.contains(id)) {
            selection.add(id);
          }
          else {
            selection.remove(id);
          }
        }
        else {
          // In REPLACE and ADD, add objects.
          // The difference was done before by not re-using the selection.
          // Since we are using a set, we can just add in any case.
          selection.add(id);
        }
      }
    }
    context.setSelection(new DBIDSelection(selection));
  }
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.result.DBIDSelection

   *
   * @param svgp The plot
   * @param proj The projection
   */
  private void setSVGRect(SVGPlot svgp, Projection2D proj) {
    DBIDSelection selContext = context.getSelection();
    if(selContext instanceof RangeSelection) {
      DoubleDoublePair[] ranges = ((RangeSelection) selContext).getRanges();
      int dim = DatabaseUtil.dimensionality(rel);

      double[] min = new double[dim];
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.result.DBIDSelection

    }
  }

  @Override
  protected void redraw() {
    DBIDSelection selContext = context.getSelection();
    if(selContext != null && selContext instanceof RangeSelection) {
      setSVGRect(svgp, proj);
    }
  }
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.result.DBIDSelection

   * Add marker for the selected IDs to mtag
   */
  public void addMarker() {
    List<ClusterOrderEntry<D>> order = getClusterOrder();
    // TODO: replace mtag!
    DBIDSelection selContext = context.getSelection();
    if(selContext != null) {
      DBIDs selection = DBIDUtil.ensureSet(selContext.getSelectedIds());

      final double width = plotwidth / order.size();
      int begin = -1;
      for(int j = 0; j < order.size(); j++) {
        DBID id = order.get(j).getID();
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.result.DBIDSelection

    if(begin < 0 || begin > end || end >= order.size()) {
      logger.warning("Invalid range in updateSelection: " + begin + " .. " + end);
      return;
    }

    DBIDSelection selContext = context.getSelection();
    HashSetModifiableDBIDs selection;
    if(selContext == null || mode == Mode.REPLACE) {
      selection = DBIDUtil.newHashSet();
    }
    else {
      selection = DBIDUtil.newHashSet(selContext.getSelectedIds());
    }

    for(int i = begin; i <= end; i++) {
      DBID id = order.get(i).getID();
      if(mode == Mode.INVERT) {
        if(!selection.contains(id)) {
          selection.add(id);
        }
        else {
          selection.remove(id);
        }
      }
      else {
        // In REPLACE and ADD, add objects.
        // The difference was done before by not re-using the selection.
        // Since we are using a set, we can just add in any case.
        selection.add(id);
      }
    }
    context.setSelection(new DBIDSelection(selection));
  }
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.result.DBIDSelection

   * @param proj The projection
   * @param p1 First Point of the selected rectangle
   * @param p2 Second Point of the selected rectangle
   */
  private void updateSelection(Projection proj, SVGPoint p1, SVGPoint p2) {
    DBIDSelection selContext = context.getSelection();
    ModifiableDBIDs selection;
    if(selContext != null) {
      selection = DBIDUtil.newHashSet(selContext.getSelectedIds());
    }
    else {
      selection = DBIDUtil.newHashSet();
    }
    DoubleDoublePair[] ranges;
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.result.DBIDSelection

  @Override
  protected void redraw() {
    addCSSClasses(svgp);
    final double size = context.getStyleLibrary().getSize(StyleLibrary.SELECTION);
    DBIDSelection selContext = context.getSelection();
    if(selContext != null) {
      DBIDs selection = selContext.getSelectedIds();
      for(DBID i : selection) {
        try {
          double[] v = proj.fastProjectDataToRenderSpace(rel.get(i));
          Element dot = svgp.svgCircle(v[0], v[1], size);
          SVGUtil.addCSSClass(dot, MARKER);
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.result.DBIDSelection

   * @param proj
   * @param p1 first point of the selected rectangle
   * @param p2 second point of the selected rectangle
   */
  private void updateSelection(Mode mode, Projection2D proj, SVGPoint p1, SVGPoint p2) {
    DBIDSelection selContext = context.getSelection();
    // Note: we rely on SET semantics below!
    HashSetModifiableDBIDs selection;
    if(selContext == null || mode == Mode.REPLACE) {
      selection = DBIDUtil.newHashSet();
    }
    else {
      selection = DBIDUtil.newHashSet(selContext.getSelectedIds());
    }
    for(DBID id : rel.iterDBIDs()) {
      double[] vec = proj.fastProjectDataToRenderSpace(rel.get(id));
      if(vec[0] >= Math.min(p1.getX(), p2.getX()) && vec[0] <= Math.max(p1.getX(), p2.getX()) && vec[1] >= Math.min(p1.getY(), p2.getY()) && vec[1] <= Math.max(p1.getY(), p2.getY())) {
        if(mode == Mode.INVERT) {
          if(!selection.contains(id)) {
            selection.add(id);
          }
          else {
            selection.remove(id);
          }
        }
        else {
          // In REPLACE and ADD, add objects.
          // The difference was done before by not re-using the selection.
          // Since we are using a set, we can just add in any case.
          selection.add(id);
        }
      }
    }
    context.setSelection(new DBIDSelection(selection));
  }
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.result.DBIDSelection

   *
   * @param svgp The plot
   * @param proj The projection
   */
  private void setSVGRect(SVGPlot svgp, Projection2D proj) {
    DBIDSelection selContext = context.getSelection();
    if(selContext instanceof RangeSelection) {
      DoubleDoublePair[] ranges = ((RangeSelection) selContext).getRanges();
      int dim = DatabaseUtil.dimensionality(rel);

      double[] min = new double[dim];
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.