private void removePoint(GeoPoint oldPoint) {

    // remove dependent algorithms (e.g. segments) from update sets of
    // objects further up (e.g. polygon) the tree
    ArrayList algoList = oldPoint.getAlgorithmList();
    for (int k = 0; k < algoList.size(); k++) {
      AlgoElement algo = (AlgoElement) algoList.get(k);
      for (int j = 0; j < input.length; j++) input[j].removeFromUpdateSets(algo);
    }

    // remove old point
    oldPoint.setParentAlgorithm(null);

    // remove dependent segment algorithm that are part of this polygon
    // to make sure we don't remove the polygon as well
    for (int k = 0; k < algoList.size(); k++) {
      AlgoElement algo = (AlgoElement) algoList.get(k);
      // make sure we don't remove the polygon as well
      if (algo instanceof AlgoJoinPointsSegment
          && ((AlgoJoinPointsSegment) algo).getPoly() == poly) {
      } else {
        algo.remove();
      }
    }

    algoList.clear();
    // remove point
    oldPoint.doRemove();
  }
Example #2
0
  @Override
  protected void setInputOutput() {
    input = new GeoElement[1];
    input[0] = text;

    super.setOutputLength(1);
    super.setOutput(0, length);
    setDependencies(); // done by AlgoElement
  }
  @Override
  protected void setInputOutput() {
    input = new GeoElement[1];
    input[0] = polygon;

    super.setOutputLength(1);
    super.setOutput(0, circum);
    setDependencies();
  }
Example #4
0
  // for AlgoElement
  @Override
  protected void setInputOutput() {
    input = new GeoElement[3];
    input[0] = (GeoElement) A;
    input[1] = (GeoElement) B;
    input[2] = (GeoElement) C;

    super.setOutputLength(1);
    super.setOutput(0, circle);
    setDependencies(); // done by AlgoElement
  }
Example #5
0
  @Override
  protected void setInputOutput() {

    if (n != null) {
      input = new GeoElement[3];
      input[2] = n;
    } else {
      input = new GeoElement[2];
    }
    input[0] = inputText;
    input[1] = m;
    super.setOutputLength(1);
    super.setOutput(0, outputText);
    setDependencies(); // done by AlgoElement
  }
  /**
   * Removes only one single output element if possible. If this is not possible the whole algorithm
   * is removed.
   */
  void remove(GeoElement output) {
    // only single undefined points may be removed
    for (int i = 0; i < points.length; i++) {
      if (points[i] == output && !points[i].isDefined()) {
        removeRootPoint(i);
        return;
      }
    }

    // if we get here removing output was not possible
    // so we remove the whole algorithm
    super.remove();
  }
  /**
   * Sets value of the local loop variable of the sequence and updates all it's dependencies until
   * we reach the sequence algo.
   */
  private void updateLocalVar(double varVal) {
    // set local variable to given value
    var.setValue(varVal);

    // update var's algorithms until we reach expression
    if (expressionParentAlgo != null) {
      // update all dependent algorithms of the local variable var
      this.setStopUpdateCascade(true);
      var.getAlgoUpdateSet().updateAllUntil(expressionParentAlgo);
      this.setStopUpdateCascade(false);
      expressionParentAlgo.update();
    }
  }
 /** Only removes this segment and does not remove parent polygon (if poly != null) */
 void removeSegmentOnly() {
   super.remove();
 }
 public void remove() {
   super.remove();
   if (poly != null) poly.remove();
 }
Example #10
0
 @Override
 public void remove() {
   if (algoAnglePoly != null) algoAnglePoly.remove();
   else super.remove();
 }