Search in sources :

Example 1 with Pins

use of de.neemann.digital.draw.elements.Pins in project Digital by hneemann.

the class GenericShape method createPins.

/**
 * Creates pins
 *
 * @param inputs    the inputs
 * @param outputs   the outputs
 * @param invert    true if invert output
 * @param width     with of symbol
 * @param symmetric true if outputs in the center
 * @param ic        iput inverter configuration
 * @return the pins
 */
private static Pins createPins(PinDescriptions inputs, PinDescriptions outputs, boolean invert, int width, boolean symmetric, InverterConfig ic) {
    Pins pins = new Pins();
    int offs = symmetric ? inputs.size() / 2 * SIZE : 0;
    for (int i = 0; i < inputs.size(); i++) {
        int correct = 0;
        if (symmetric && ((inputs.size() & 1) == 0) && i >= inputs.size() / 2)
            correct = SIZE;
        int dx = 0;
        if (isInverted(inputs.get(i).getName(), ic))
            dx = -SIZE;
        pins.add(new Pin(new Vector(dx, i * SIZE + correct), inputs.get(i)));
    }
    if (invert) {
        for (int i = 0; i < outputs.size(); i++) pins.add(new Pin(new Vector(SIZE * (width + 1), i * SIZE + offs), outputs.get(i)));
    } else {
        for (int i = 0; i < outputs.size(); i++) pins.add(new Pin(new Vector(SIZE * width, i * SIZE + offs), outputs.get(i)));
    }
    return pins;
}
Also used : Pin(de.neemann.digital.draw.elements.Pin) Pins(de.neemann.digital.draw.elements.Pins)

Example 2 with Pins

use of de.neemann.digital.draw.elements.Pins in project Digital by hneemann.

the class DriverShape method getPins.

@Override
public Pins getPins() {
    if (pins == null) {
        pins = new Pins();
        pins.add(new Pin(new Vector(-SIZE, 0), inputs.get(0)));
        pins.add(new Pin(new Vector(0, bottom ? SIZE : -SIZE), inputs.get(1)));
        pins.add(new Pin(new Vector(SIZE, 0), outputs.get(0)));
    }
    return pins;
}
Also used : Pin(de.neemann.digital.draw.elements.Pin) Pins(de.neemann.digital.draw.elements.Pins) Vector(de.neemann.digital.draw.graphics.Vector)

Example 3 with Pins

use of de.neemann.digital.draw.elements.Pins in project Digital by hneemann.

the class SevenSegShape method getPins.

@Override
public Pins getPins() {
    if (pins == null) {
        pins = new Pins();
        pins.add(new Pin(new Vector(0, 0), inputPins.get(0)));
        pins.add(new Pin(new Vector(SIZE, 0), inputPins.get(1)));
        pins.add(new Pin(new Vector(SIZE * 2, 0), inputPins.get(2)));
        pins.add(new Pin(new Vector(SIZE * 3, 0), inputPins.get(3)));
        pins.add(new Pin(new Vector(0, SIZE * HEIGHT), inputPins.get(4)));
        pins.add(new Pin(new Vector(SIZE, SIZE * HEIGHT), inputPins.get(5)));
        pins.add(new Pin(new Vector(SIZE * 2, SIZE * HEIGHT), inputPins.get(6)));
        pins.add(new Pin(new Vector(SIZE * 3, SIZE * HEIGHT), inputPins.get(7)));
        if (commonCatode)
            pins.add(new Pin(new Vector(SIZE * 4, SIZE * HEIGHT), inputPins.get(8)));
    }
    return pins;
}
Also used : Pin(de.neemann.digital.draw.elements.Pin) Pins(de.neemann.digital.draw.elements.Pins) Vector(de.neemann.digital.draw.graphics.Vector)

Example 4 with Pins

use of de.neemann.digital.draw.elements.Pins in project Digital by hneemann.

the class IEEENotShape method getPins.

@Override
public Pins getPins() {
    if (pins == null) {
        pins = new Pins();
        pins.add(new Pin(new Vector(0, 0), inputs.get(0)));
        pins.add(new Pin(new Vector(SIZE * 2, 0), outputs.get(0)));
    }
    return pins;
}
Also used : Pin(de.neemann.digital.draw.elements.Pin) Pins(de.neemann.digital.draw.elements.Pins) Vector(de.neemann.digital.draw.graphics.Vector)

Example 5 with Pins

use of de.neemann.digital.draw.elements.Pins in project Digital by hneemann.

the class MuxerShape method getPins.

@Override
public Pins getPins() {
    if (pins == null) {
        pins = new Pins();
        pins.add(new Pin(new Vector(SIZE, flip ? 0 : inputCount * SIZE), inputs.get(0)));
        if (inputs.size() == 3) {
            pins.add(new Pin(new Vector(0, 0 * SIZE), inputs.get(1)));
            pins.add(new Pin(new Vector(0, 2 * SIZE), inputs.get(2)));
        } else
            for (int i = 0; i < inputCount; i++) {
                pins.add(new Pin(new Vector(0, i * SIZE), inputs.get(i + 1)));
            }
        pins.add(new Pin(new Vector(SIZE * 2, (inputCount / 2) * SIZE), outputs.get(0)));
    }
    return pins;
}
Also used : Pin(de.neemann.digital.draw.elements.Pin) Pins(de.neemann.digital.draw.elements.Pins)

Aggregations

Pin (de.neemann.digital.draw.elements.Pin)7 Pins (de.neemann.digital.draw.elements.Pins)7 Vector (de.neemann.digital.draw.graphics.Vector)3