Package com.cburch.logisim.data

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


    boolean translated = dx != 0 || dy != 0;
    Location loc0 = w.getEnd0();
    Location loc1 = w.getEnd1();
    if (translated) {
      loc0 = loc0.translate(dx, dy);
      loc1 = loc1.translate(dx, dy);
    }
    avoid.put(loc0, Connector.ALLOW_NEITHER);
    avoid.put(loc1, Connector.ALLOW_NEITHER);
    int x0 = loc0.getX();
    int y0 = loc0.getY();
View Full Code Here


        boolean translated = dx != 0 || dy != 0;
        Location loc0 = w.getEnd0();
        Location loc1 = w.getEnd1();
        if (translated) {
            loc0 = loc0.translate(dx, dy);
            loc1 = loc1.translate(dx, dy);
        }
        avoid.put(loc0, Connector.ALLOW_NEITHER);
        avoid.put(loc1, Connector.ALLOW_NEITHER);
        int x0 = loc0.getX();
        int y0 = loc0.getY();
View Full Code Here

                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

        // round coordinates up to ensure they're on grid
        x = (x + 9) / 10 * 10;
        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.decorate(Arrays.asList(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.decorate(Arrays.asList(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.decorate(Arrays.asList(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.decorate(Arrays.asList(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

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.