Package com.cburch.logisim.data

Examples of com.cburch.logisim.data.Location


  public void draw(ComponentDrawContext context) {
    SplitterAttributes attrs = (SplitterAttributes) getAttributeSet();
    if (attrs.appear == SplitterAttributes.APPEAR_LEGACY) {
      SplitterPainter.drawLegacy(context, attrs, getLocation());
    } else {
      Location loc = getLocation();
      SplitterPainter.drawLines(context, attrs, loc);
      SplitterPainter.drawLabels(context, attrs, loc);
      context.drawPins(this);
    }
  }
View Full Code Here


    return Strings.get("circuitAnchor");
  }
 
  @Override
  public Element toSvgElement(Document doc) {
    Location loc = getLocation();
    Element ret = doc.createElement("circ-anchor");
    ret.setAttribute("x", "" + (loc.getX() - RADIUS));
    ret.setAttribute("y", "" + (loc.getY() - RADIUS));
    ret.setAttribute("width", "" + 2 * RADIUS);
    ret.setAttribute("height", "" + 2 * RADIUS);
    ret.setAttribute("facing", facing.toString());
    return ret;
  }
View Full Code Here

    }
  }

  @Override
  public void paint(Graphics g, HandleGesture gesture) {
    Location location = getLocation();
    int x = location.getX();
    int y = location.getY();
    g.setColor(SYMBOL_COLOR);
    g.drawOval(x - RADIUS, y - RADIUS, 2 * RADIUS, 2 * RADIUS);
    Location e0 = location.translate(facing, RADIUS);
    Location e1 = location.translate(facing, RADIUS + INDICATOR_LENGTH);
    g.drawLine(e0.getX(), e0.getY(), e1.getX(), e1.getY());
  }
View Full Code Here

  }
 
  @Override
  public Bounds getBounds() {
    Bounds bds = super.getBounds(RADIUS);
    Location center = getLocation();
    Location end = center.translate(facing, RADIUS + INDICATOR_LENGTH);
    return bds.add(end);
  }
View Full Code Here

  @Override
  public boolean contains(Location loc, boolean assumeFilled) {
    if (super.isInCircle(loc, RADIUS)) {
      return true;
    } else {
      Location center = getLocation();
      Location end = center.translate(facing, RADIUS + INDICATOR_LENGTH);
      if (facing == Direction.EAST || facing == Direction.WEST) {
        return Math.abs(loc.getY() - center.getY()) < 2
          && (loc.getX() < center.getX()) != (loc.getX() < end.getX());
      } else {
        return Math.abs(loc.getX() - center.getX()) < 2
          && (loc.getY() < center.getY()) != (loc.getY() < end.getY());
      }
    }
  }
View Full Code Here

    }
  }
 
  @Override
  public List<Handle> getHandles(HandleGesture gesture) {
    Location c = getLocation();
    Location end = c.translate(facing, RADIUS + INDICATOR_LENGTH);
    return UnmodifiableList.create(new Handle[] { new Handle(this, c),
        new Handle(this, end) });
  }
View Full Code Here

  public boolean hasNext() {
    return !destReturned;
  }
 
  public Location next() {
    Location ret = Location.create(curX, curY);
    destReturned |= curX == destX && curY == destY;
    curX += deltaX;
    curY += deltaY;
    return ret;
  }
View Full Code Here

    return Strings.get("circuitPort");
  }
 
  @Override
  public Element toSvgElement(Document doc) {
    Location loc = getLocation();
    Location pinLoc = pin.getLocation();
    Element ret = doc.createElement("circ-port");
    int r = isInput() ? INPUT_RADIUS : OUTPUT_RADIUS;
    ret.setAttribute("x", "" + (loc.getX() - r));
    ret.setAttribute("y", "" + (loc.getY() - r));
    ret.setAttribute("width", "" + 2 * r);
    ret.setAttribute("height", "" + 2 * r);
    ret.setAttribute("pin", "" + pinLoc.getX() + "," + pinLoc.getY());
    return ret;
  }
View Full Code Here

    }
  }

  @Override
  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

        new Handle(this, loc.translate(-r, r)) });
  }

  @Override
  public void paint(Graphics g, HandleGesture gesture) {
    Location location = getLocation();
    int x = location.getX();
    int y = location.getY();
    g.setColor(COLOR);
    if (isInput()) {
      int r = INPUT_RADIUS;
      g.drawRect(x - r, y - r, 2 * r, 2 * r);
    } else {
View Full Code Here

TOP

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

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.