Exemplo n.º 1
0
 public void clear() {
   for (Marker m : trail) {
     m.setVisible(false);
     m.flagForRemoval();
   }
   trail.clear();
   counter = 0;
 }
Exemplo n.º 2
0
  /**
   * ******************************************************************************* addMarker
   *
   * <p>This method is responsible for adding crumbs to the handler and determining when crumbs
   * should become invisible. Right now, crumbs are removed once there are more than 20 markers in
   * the handler. Crumbs are removed according to when they were placed on the manifold by the user.
   * *******************************************************************************
   */
  public void addMarker(ManifoldPosition mp) {
    ManifoldPosition pos = new ManifoldPosition(mp);
    Vector vec = new Vector(pos.getDirectionForward());
    vec.scale(-.25);
    pos.move(vec);
    Marker m = new Marker(pos, crumb, Marker.MarkerType.FIXED);
    trail.add(m);
    markers.addMarker(m);
    counter++;

    int numMarkers = trail.size() - 1;
    if (numMarkers >= 5) {
      Marker toRemove = trail.poll();
      toRemove.flagForRemoval();
    }
  }