Search in sources :

Example 31 with Rack

use of org.concord.energy3d.model.Rack in project energy3d by concord-consortium.

the class SetSizeForAllRacksCommand method redo.

@Override
public void redo() throws CannotRedoException {
    super.redo();
    final int n = racks.size();
    for (int i = 0; i < n; i++) {
        final Rack r = racks.get(i);
        r.setRackWidth(newWidths[i]);
        r.setRackHeight(newHeights[i]);
        r.draw();
    }
    SceneManager.getInstance().refresh();
}
Also used : Rack(org.concord.energy3d.model.Rack)

Example 32 with Rack

use of org.concord.energy3d.model.Rack in project energy3d by concord-consortium.

the class SetSizeForRacksOnFoundationCommand method undo.

@Override
public void undo() throws CannotUndoException {
    super.undo();
    final int n = racks.size();
    newWidths = new double[n];
    newHeights = new double[n];
    for (int i = 0; i < n; i++) {
        final Rack r = racks.get(i);
        newWidths[i] = r.getRackWidth();
        newHeights[i] = r.getRackHeight();
        r.setRackWidth(oldWidths[i]);
        r.setRackHeight(oldHeights[i]);
        r.draw();
    }
    SceneManager.getInstance().refresh();
}
Also used : Rack(org.concord.energy3d.model.Rack)

Example 33 with Rack

use of org.concord.energy3d.model.Rack in project energy3d by concord-consortium.

the class SetSizeForRacksOnFoundationCommand method redo.

@Override
public void redo() throws CannotRedoException {
    super.redo();
    final int n = racks.size();
    for (int i = 0; i < n; i++) {
        final Rack r = racks.get(i);
        r.setRackWidth(newWidths[i]);
        r.setRackHeight(newHeights[i]);
        r.draw();
    }
    SceneManager.getInstance().refresh();
}
Also used : Rack(org.concord.energy3d.model.Rack)

Example 34 with Rack

use of org.concord.energy3d.model.Rack in project energy3d by concord-consortium.

the class SetPartSizeCommand method undo.

@Override
public void undo() throws CannotUndoException {
    super.undo();
    if (part instanceof Mirror) {
        final Mirror m = (Mirror) part;
        newWidth = m.getMirrorWidth();
        newHeight = m.getMirrorHeight();
        m.setMirrorWidth(oldWidth);
        m.setMirrorHeight(oldHeight);
    } else if (part instanceof ParabolicTrough) {
        final ParabolicTrough t = (ParabolicTrough) part;
        newWidth = t.getApertureWidth();
        newHeight = t.getTroughLength();
        newModuleLength = t.getModuleLength();
        t.setApertureWidth(oldWidth);
        t.setTroughLength(oldHeight);
        t.setModuleLength(oldModuleLength);
    } else if (part instanceof ParabolicDish) {
        final ParabolicDish d = (ParabolicDish) part;
        newWidth = d.getRimRadius();
        d.setRimRadius(oldWidth);
    } else if (part instanceof FresnelReflector) {
        final FresnelReflector r = (FresnelReflector) part;
        newWidth = r.getModuleWidth();
        newHeight = r.getLength();
        newModuleLength = r.getModuleLength();
        r.setModuleWidth(oldWidth);
        r.setLength(oldHeight);
        r.setModuleLength(oldModuleLength);
    } else if (part instanceof Rack) {
        final Rack r = (Rack) part;
        newWidth = r.getRackWidth();
        newHeight = r.getRackHeight();
        r.setRackWidth(oldWidth);
        r.setRackHeight(oldHeight);
    } else if (part instanceof Window) {
        final Window w = (Window) part;
        newWidth = w.getWindowWidth();
        newHeight = w.getWindowHeight();
        w.setWindowWidth(oldWidth);
        w.setWindowHeight(oldHeight);
        w.getContainer().draw();
    } else if (part instanceof Door) {
        final Door d = (Door) part;
        newWidth = d.getDoorWidth();
        newHeight = d.getDoorHeight();
        d.setDoorWidth(oldWidth);
        d.setDoorHeight(oldHeight);
        d.getContainer().draw();
    }
    part.draw();
    SceneManager.getInstance().refresh();
}
Also used : ParabolicDish(org.concord.energy3d.model.ParabolicDish) Window(org.concord.energy3d.model.Window) Rack(org.concord.energy3d.model.Rack) ParabolicTrough(org.concord.energy3d.model.ParabolicTrough) FresnelReflector(org.concord.energy3d.model.FresnelReflector) Mirror(org.concord.energy3d.model.Mirror) Door(org.concord.energy3d.model.Door)

Example 35 with Rack

use of org.concord.energy3d.model.Rack in project energy3d by concord-consortium.

the class SetSolarCellEfficiencyForRacksOnFoundationCommand method undo.

@Override
public void undo() throws CannotUndoException {
    super.undo();
    final int n = racks.size();
    newValues = new double[n];
    for (int i = 0; i < n; i++) {
        final Rack r = racks.get(i);
        newValues[i] = r.getSolarPanel().getCellEfficiency();
        r.getSolarPanel().setCellEfficiency(oldValues[i]);
    }
}
Also used : Rack(org.concord.energy3d.model.Rack)

Aggregations

Rack (org.concord.energy3d.model.Rack)126 HousePart (org.concord.energy3d.model.HousePart)67 SolarPanel (org.concord.energy3d.model.SolarPanel)66 Foundation (org.concord.energy3d.model.Foundation)45 Window (org.concord.energy3d.model.Window)27 Roof (org.concord.energy3d.model.Roof)25 Wall (org.concord.energy3d.model.Wall)23 Mirror (org.concord.energy3d.model.Mirror)22 Door (org.concord.energy3d.model.Door)20 FresnelReflector (org.concord.energy3d.model.FresnelReflector)16 ParabolicTrough (org.concord.energy3d.model.ParabolicTrough)16 ParabolicDish (org.concord.energy3d.model.ParabolicDish)15 ActionEvent (java.awt.event.ActionEvent)12 ActionListener (java.awt.event.ActionListener)12 Vector3 (com.ardor3d.math.Vector3)10 ReadOnlyVector3 (com.ardor3d.math.type.ReadOnlyVector3)10 JMenuItem (javax.swing.JMenuItem)10 Tree (org.concord.energy3d.model.Tree)10 Floor (org.concord.energy3d.model.Floor)9 ArrayList (java.util.ArrayList)8