Search in sources :

Example 16 with Mirror

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

the class ChangeFoundationHeliostatTargetCommand method redo.

@Override
public void redo() throws CannotRedoException {
    super.redo();
    final int n = mirrors.size();
    for (int i = 0; i < n; i++) {
        final Mirror m = mirrors.get(i);
        m.setReceiver(newValues[i]);
        m.draw();
        if (oldValues[i] != null) {
            oldValues[i].drawSolarReceiver();
        }
        if (newValues[i] != null) {
            newValues[i].drawSolarReceiver();
        }
    }
    SceneManager.getInstance().refresh();
}
Also used : Mirror(org.concord.energy3d.model.Mirror)

Example 17 with Mirror

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

the class SetSizeForHeliostatsOnFoundationCommand method undo.

@Override
public void undo() throws CannotUndoException {
    super.undo();
    final int n = mirrors.size();
    newWidths = new double[n];
    newHeights = new double[n];
    for (int i = 0; i < n; i++) {
        final Mirror m = mirrors.get(i);
        newWidths[i] = m.getMirrorWidth();
        newHeights[i] = m.getMirrorHeight();
        m.setMirrorWidth(oldWidths[i]);
        m.setMirrorHeight(oldHeights[i]);
        m.draw();
    }
    SceneManager.getInstance().refresh();
}
Also used : Mirror(org.concord.energy3d.model.Mirror)

Example 18 with Mirror

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

the class SetSizeForHeliostatsOnFoundationCommand method redo.

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

Example 19 with Mirror

use of org.concord.energy3d.model.Mirror 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 20 with Mirror

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

the class MovePartCommand method move.

private void move(final Vector3 v) {
    SceneManager.getInstance().setSelectedPart(part);
    SceneManager.getTaskManager().update(new Callable<Object>() {

        @Override
        public Object call() throws Exception {
            if (part == null) {
                for (final HousePart p : Scene.getInstance().getParts()) {
                    if (p instanceof Foundation) {
                        ((Foundation) p).move(v, p.getGridSize());
                    }
                }
            } else if (part instanceof Foundation) {
                final Foundation f = (Foundation) part;
                if (f.isGroupMaster()) {
                    final List<Foundation> g = Scene.getInstance().getFoundationGroup(f);
                    for (final Foundation x : g) {
                        x.move(v, part.getGridSize());
                    }
                } else {
                    f.move(v, part.getGridSize());
                }
            } else if (part instanceof Window) {
                final Window w = (Window) part;
                w.move(v);
                w.draw();
            } else if (part instanceof SolarPanel) {
                final SolarPanel s = (SolarPanel) part;
                s.move(v, part.getGridSize());
                s.draw();
            } else if (part instanceof Rack) {
                final Rack r = (Rack) part;
                r.move(v, part.getGridSize());
                r.draw();
            } else if (part instanceof Mirror) {
                final Mirror m = (Mirror) part;
                m.move(v, part.getGridSize());
                m.draw();
            } else if (part instanceof ParabolicTrough) {
                final ParabolicTrough t = (ParabolicTrough) part;
                t.move(v, part.getGridSize());
                t.draw();
            } else if (part instanceof ParabolicDish) {
                final ParabolicDish d = (ParabolicDish) part;
                d.move(v, part.getGridSize());
                d.draw();
            } else if (part instanceof FresnelReflector) {
                final FresnelReflector f = (FresnelReflector) part;
                f.move(v, part.getGridSize());
                f.draw();
            }
            return null;
        }
    });
}
Also used : Window(org.concord.energy3d.model.Window) ParabolicTrough(org.concord.energy3d.model.ParabolicTrough) FresnelReflector(org.concord.energy3d.model.FresnelReflector) CannotUndoException(javax.swing.undo.CannotUndoException) CannotRedoException(javax.swing.undo.CannotRedoException) ParabolicDish(org.concord.energy3d.model.ParabolicDish) Rack(org.concord.energy3d.model.Rack) SolarPanel(org.concord.energy3d.model.SolarPanel) Foundation(org.concord.energy3d.model.Foundation) Mirror(org.concord.energy3d.model.Mirror) HousePart(org.concord.energy3d.model.HousePart)

Aggregations

Mirror (org.concord.energy3d.model.Mirror)55 HousePart (org.concord.energy3d.model.HousePart)35 Foundation (org.concord.energy3d.model.Foundation)29 FresnelReflector (org.concord.energy3d.model.FresnelReflector)21 Rack (org.concord.energy3d.model.Rack)21 SolarPanel (org.concord.energy3d.model.SolarPanel)19 ParabolicDish (org.concord.energy3d.model.ParabolicDish)17 ParabolicTrough (org.concord.energy3d.model.ParabolicTrough)17 Window (org.concord.energy3d.model.Window)16 Wall (org.concord.energy3d.model.Wall)14 Door (org.concord.energy3d.model.Door)11 Roof (org.concord.energy3d.model.Roof)11 ArrayList (java.util.ArrayList)10 Calendar (java.util.Calendar)5 List (java.util.List)5 JDialog (javax.swing.JDialog)5 Human (org.concord.energy3d.model.Human)5 Tree (org.concord.energy3d.model.Tree)5 ActionEvent (java.awt.event.ActionEvent)4 ActionListener (java.awt.event.ActionListener)4