Package com.cburch.logisim.data

Examples of com.cburch.logisim.data.Location.translate()


        dx = isFirst ? -10 : 10;
        dy = 0;
      }
      Location loc = others.get(neighbor).getLocation();
      do {
        loc = loc.translate(dx, dy);
      } while (usedLocs.contains(loc));
      if (loc.getX() >= 0 && loc.getY() >= 0) {
        return loc;
      }
      do {
View Full Code Here


      } while (usedLocs.contains(loc));
      if (loc.getX() >= 0 && loc.getY() >= 0) {
        return loc;
      }
      do {
        loc = loc.translate(-dx, -dy);
      } while (usedLocs.contains(loc));
      return loc;
    }
   
    // otherwise place it on the boundary of the bounding rectangle
View Full Code Here

    }
    x = (x + 9) / 10 * 10; // round coordinates up to ensure they're on grid
    y = (y + 9) / 10 * 10;
    Location loc = Location.create(x, y);
    while (usedLocs.contains(loc)) {
      loc = loc.translate(dx, dy);
    }
    return loc;
  }
}
View Full Code Here

  public List<Handle> getHandles(HandleGesture gesture) {
    Location loc = getLocation();
   
    int r = isInput() ? INPUT_RADIUS : OUTPUT_RADIUS;
    return UnmodifiableList.create(new Handle[] {
        new Handle(this, loc.translate(-r, -r)),
        new Handle(this, loc.translate(r, -r)),
        new Handle(this, loc.translate(r, r)),
        new Handle(this, loc.translate(-r, r)) });
  }
View Full Code Here

    Location loc = getLocation();
   
    int r = isInput() ? INPUT_RADIUS : OUTPUT_RADIUS;
    return UnmodifiableList.create(new Handle[] {
        new Handle(this, loc.translate(-r, -r)),
        new Handle(this, loc.translate(r, -r)),
        new Handle(this, loc.translate(r, r)),
        new Handle(this, loc.translate(-r, r)) });
  }

  @Override
View Full Code Here

   
    int r = isInput() ? INPUT_RADIUS : OUTPUT_RADIUS;
    return UnmodifiableList.create(new Handle[] {
        new Handle(this, loc.translate(-r, -r)),
        new Handle(this, loc.translate(r, -r)),
        new Handle(this, loc.translate(r, r)),
        new Handle(this, loc.translate(-r, r)) });
  }

  @Override
  public void paint(Graphics g, HandleGesture gesture) {
View Full Code Here

    int r = isInput() ? INPUT_RADIUS : OUTPUT_RADIUS;
    return UnmodifiableList.create(new Handle[] {
        new Handle(this, loc.translate(-r, -r)),
        new Handle(this, loc.translate(r, -r)),
        new Handle(this, loc.translate(r, r)),
        new Handle(this, loc.translate(-r, r)) });
  }

  @Override
  public void paint(Graphics g, HandleGesture gesture) {
    Location location = getLocation();
View Full Code Here

    SortedMap<Location, Instance> ret = new TreeMap<Location, Instance>();
    for (AppearancePort port : ports) {
      Location loc = port.getLocation();
      if (anchor != null) {
        loc = loc.translate(-anchor.getX(), -anchor.getY());
      }
      if (facing != defaultFacing) {
        loc = loc.rotate(defaultFacing, facing, 0, 0);
      }
      ret.put(loc, port.getPin());
View Full Code Here

      Location ret = getRandomBoundaryPoint(bds, rand);
      int w = getStrokeWidth();
      if (w > 1) {
        int dx = rand.nextInt(w) - w / 2;
        int dy = rand.nextInt(w) - w / 2;
        ret = ret.translate(dx, dy);
      }
      return ret;
    } else {
      return super.getRandomPoint(bds, rand);
    }
View Full Code Here

      dx += 10;
    }
   
    Location anchorLocation = clip.getAnchorLocation();
    if (anchorLocation != null && dx != 0) {
      anchorLocation = anchorLocation.translate(dx, dx);
    }
     
    canvas.getProject().doAction(new SelectionAction(canvas,
        Strings.getter("pasteClipboardAction"), null, add, add,
        anchorLocation, clip.getAnchorFacing()));
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.