Package com.cburch.logisim.data

Examples of com.cburch.logisim.data.Direction


    return ret;
  }
 
  public SearchNode next(Direction moveDir, boolean crossing) {
    int newDist = dist;
    Direction connDir = conn.getDirection();
    Location nextLoc = loc.translate(moveDir, 10);
    boolean exWire = extendsWire && moveDir == connDir;
    if (exWire) {
      newDist += 9;
    } else {
View Full Code Here


          }
          Collections.reverse(wirePath);
          wirePathStart = cur;
        }
       
        Direction dir = null;
        if (lastOnPath != null) {
          Location other = lastOnPath.getOtherEnd(loc);
          int dx = loc.getX() - other.getX();
          int dy = loc.getY() - other.getY();
          if (Math.abs(dx) > Math.abs(dy)) {
View Full Code Here

  SplitterParameters(SplitterAttributes attrs) {
   
    Object appear = attrs.appear;
    int fanout = attrs.fanout;
    Direction facing = attrs.facing;
   
    int justify;
    if (appear == SplitterAttributes.APPEAR_CENTER || appear == SplitterAttributes.APPEAR_LEGACY) {
      justify = 0;
    } else if (appear == SplitterAttributes.APPEAR_RIGHT) {
View Full Code Here

    Selection sel = canvas.getSelection();
    int n = sel.getSelected().size();
    List<CanvasObject> select = new ArrayList<CanvasObject>(n);
    List<CanvasObject> remove = new ArrayList<CanvasObject>(n);
    Location anchorLocation = null;
    Direction anchorFacing = null;
    for (CanvasObject o : sel.getSelected()) {
      if (o.canRemove()) {
        remove.add(o);
      } else {
        select.add(o);
View Full Code Here

    this.remove = remove;
    this.canvas = canvas;
    this.canvasModel = canvas.getModel();
   
    ArrayList<CanvasObject> contents = new ArrayList<CanvasObject>();
    Direction anchorFacing = null;
    Location anchorLocation = null;
    ArrayList<CanvasObject> aff = new ArrayList<CanvasObject>();
    for (CanvasObject o : canvas.getSelection().getSelected()) {
      if (o.canRemove()) {
        aff.add(o);
View Full Code Here

  private void drawInstance(InstancePainter painter, boolean isGhost) {
    Graphics2D g = (Graphics2D) painter.getGraphics().create();
    Location loc = painter.getLocation();
    g.translate(loc.getX(), loc.getY());

    Direction from = painter.getAttributeValue(StdAttr.FACING);
    int degrees = Direction.EAST.toDegrees() - from.toDegrees();
    double radians = Math.toRadians((degrees + 360) % 360);
    g.rotate(radians);

    GraphicsUtil.switchToWidth(g, Wire.WIDTH);
    if (!isGhost && painter.getShowState()) {
View Full Code Here

      instance.fireInvalidated();
    }
  }

  private void updatePorts(Instance instance) {
    Direction facing = instance.getAttributeValue(StdAttr.FACING);
    int dx = 0;
    int dy = 0;
    if (facing == Direction.NORTH) {
      dy = 1;
    } else if (facing == Direction.EAST) {
View Full Code Here

    instance.setPorts(ports);
  }

  @Override
  public Bounds getOffsetBounds(AttributeSet attrs) {
    Direction facing = attrs.getValue(StdAttr.FACING);
    Object gateLoc = attrs.getValue(Wiring.ATTR_GATE);
    int delta = gateLoc == Wiring.GATE_TOP_LEFT ? -20 : 0;
    if (facing == Direction.NORTH) {
      return Bounds.create(delta, 0, 20, 40);
    } else if (facing == Direction.SOUTH) {
View Full Code Here

  }
 
  @Override
  public boolean contains(Location loc, AttributeSet attrs) {
    if (super.contains(loc, attrs)) {
      Direction facing = attrs.getValue(StdAttr.FACING);
      Location center = Location.create(0, 0).translate(facing, -20);
      return center.manhattanDistanceTo(loc) < 24;
    } else {
      return false;
    }
View Full Code Here

  }

  private void drawInstance(InstancePainter painter, boolean isGhost) {
    Object type = painter.getAttributeValue(ATTR_TYPE);
    Object powerLoc = painter.getAttributeValue(Wiring.ATTR_GATE);
    Direction from = painter.getAttributeValue(StdAttr.FACING);
    Direction facing = painter.getAttributeValue(StdAttr.FACING);
    boolean flip = (facing == Direction.SOUTH || facing == Direction.WEST)
      == (powerLoc == Wiring.GATE_TOP_LEFT);

    int degrees = Direction.EAST.toDegrees() - from.toDegrees();
    double radians = Math.toRadians((degrees + 360) % 360);
View Full Code Here

TOP

Related Classes of com.cburch.logisim.data.Direction

Copyright © 2018 www.massapicom. 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.