Search in sources :

Example 11 with RemoveMultiplePartsCommand

use of org.concord.energy3d.undo.RemoveMultiplePartsCommand in project energy3d by concord-consortium.

the class Scene method removeAllSensors.

public void removeAllSensors() {
    final ArrayList<HousePart> sensors = new ArrayList<HousePart>();
    final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
    if (selectedPart != null) {
        final Foundation foundation = selectedPart instanceof Foundation ? (Foundation) selectedPart : selectedPart.getTopContainer();
        for (final HousePart part : parts) {
            if (part instanceof Sensor && part.getTopContainer() == foundation) {
                sensors.add(part);
            }
        }
    } else {
        for (final HousePart part : parts) {
            if (part instanceof Sensor) {
                sensors.add(part);
            }
        }
    }
    if (sensors.isEmpty()) {
        JOptionPane.showMessageDialog(MainFrame.getInstance(), "There is no sensor to remove.", "No Sensor", JOptionPane.INFORMATION_MESSAGE);
        return;
    }
    if (JOptionPane.showConfirmDialog(MainFrame.getInstance(), "Do you really want to remove all " + sensors.size() + " sensors" + (selectedPart != null ? " on the selected foundation" : "") + "?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) != JOptionPane.YES_OPTION) {
        return;
    }
    final RemoveMultiplePartsCommand c = new RemoveMultiplePartsCommand(sensors);
    for (final HousePart part : sensors) {
        remove(part, false);
    }
    redrawAll();
    SceneManager.getInstance().getUndoManager().addEdit(c);
    edited = true;
}
Also used : ArrayList(java.util.ArrayList) Foundation(org.concord.energy3d.model.Foundation) HousePart(org.concord.energy3d.model.HousePart) Sensor(org.concord.energy3d.model.Sensor) RemoveMultiplePartsCommand(org.concord.energy3d.undo.RemoveMultiplePartsCommand)

Example 12 with RemoveMultiplePartsCommand

use of org.concord.energy3d.undo.RemoveMultiplePartsCommand in project energy3d by concord-consortium.

the class Scene method removeAllFresnelReflectors.

public void removeAllFresnelReflectors() {
    final ArrayList<HousePart> reflectors = new ArrayList<HousePart>();
    final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
    if (selectedPart != null) {
        final Foundation foundation = selectedPart instanceof Foundation ? (Foundation) selectedPart : selectedPart.getTopContainer();
        for (final HousePart part : parts) {
            if (part instanceof FresnelReflector && part.getTopContainer() == foundation) {
                reflectors.add(part);
            }
        }
    } else {
        for (final HousePart part : parts) {
            if (part instanceof FresnelReflector) {
                reflectors.add(part);
            }
        }
    }
    if (reflectors.isEmpty()) {
        JOptionPane.showMessageDialog(MainFrame.getInstance(), "There is no Fresnel reflector to remove.", "No Fresnel Reflector", JOptionPane.INFORMATION_MESSAGE);
        return;
    }
    if (JOptionPane.showConfirmDialog(MainFrame.getInstance(), "Do you really want to remove all " + reflectors.size() + " Fresnel reflectors" + (selectedPart != null ? " on the selected foundation" : "") + "?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) != JOptionPane.YES_OPTION) {
        return;
    }
    final RemoveMultiplePartsCommand c = new RemoveMultiplePartsCommand(reflectors);
    for (final HousePart part : reflectors) {
        remove(part, false);
    }
    redrawAll();
    SceneManager.getInstance().getUndoManager().addEdit(c);
    edited = true;
}
Also used : FresnelReflector(org.concord.energy3d.model.FresnelReflector) ArrayList(java.util.ArrayList) Foundation(org.concord.energy3d.model.Foundation) HousePart(org.concord.energy3d.model.HousePart) RemoveMultiplePartsCommand(org.concord.energy3d.undo.RemoveMultiplePartsCommand)

Example 13 with RemoveMultiplePartsCommand

use of org.concord.energy3d.undo.RemoveMultiplePartsCommand in project energy3d by concord-consortium.

the class Scene method removeAllTrees.

public void removeAllTrees() {
    final ArrayList<HousePart> trees = new ArrayList<HousePart>();
    for (final HousePart part : parts) {
        if (part instanceof Tree && !part.getLockEdit()) {
            trees.add(part);
        }
    }
    if (trees.isEmpty()) {
        JOptionPane.showMessageDialog(MainFrame.getInstance(), "There is no tree to remove.", "No Tree", JOptionPane.INFORMATION_MESSAGE);
        return;
    }
    if (JOptionPane.showConfirmDialog(MainFrame.getInstance(), "Do you really want to remove all " + trees.size() + " trees?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) != JOptionPane.YES_OPTION) {
        return;
    }
    final RemoveMultiplePartsCommand c = new RemoveMultiplePartsCommand(trees);
    for (final HousePart part : trees) {
        remove(part, false);
    }
    redrawAll();
    SceneManager.getInstance().getUndoManager().addEdit(c);
    edited = true;
}
Also used : ArrayList(java.util.ArrayList) Tree(org.concord.energy3d.model.Tree) HousePart(org.concord.energy3d.model.HousePart) RemoveMultiplePartsCommand(org.concord.energy3d.undo.RemoveMultiplePartsCommand)

Example 14 with RemoveMultiplePartsCommand

use of org.concord.energy3d.undo.RemoveMultiplePartsCommand in project energy3d by concord-consortium.

the class Scene method removeAllWindows.

public void removeAllWindows() {
    final ArrayList<HousePart> windows = new ArrayList<HousePart>();
    final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
    if (selectedPart != null) {
        final Foundation foundation = selectedPart instanceof Foundation ? (Foundation) selectedPart : selectedPart.getTopContainer();
        for (final HousePart part : parts) {
            if (part instanceof Window && !part.getLockEdit() && part.getTopContainer() == foundation) {
                windows.add(part);
            }
        }
    } else {
        for (final HousePart part : parts) {
            if (part instanceof Window && !part.getLockEdit()) {
                windows.add(part);
            }
        }
    }
    if (windows.isEmpty()) {
        JOptionPane.showMessageDialog(MainFrame.getInstance(), "There is no window to remove.", "No Window", JOptionPane.INFORMATION_MESSAGE);
        return;
    }
    if (JOptionPane.showConfirmDialog(MainFrame.getInstance(), "Do you really want to remove all " + windows.size() + " windows" + (selectedPart != null ? " of the selected building" : "") + "?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) != JOptionPane.YES_OPTION) {
        return;
    }
    final RemoveMultiplePartsCommand c = new RemoveMultiplePartsCommand(windows);
    for (final HousePart part : windows) {
        remove(part, false);
    }
    redrawAll();
    SceneManager.getInstance().getUndoManager().addEdit(c);
    edited = true;
}
Also used : Window(org.concord.energy3d.model.Window) ArrayList(java.util.ArrayList) Foundation(org.concord.energy3d.model.Foundation) HousePart(org.concord.energy3d.model.HousePart) RemoveMultiplePartsCommand(org.concord.energy3d.undo.RemoveMultiplePartsCommand)

Example 15 with RemoveMultiplePartsCommand

use of org.concord.energy3d.undo.RemoveMultiplePartsCommand in project energy3d by concord-consortium.

the class Scene method removeAllHeliostats.

public void removeAllHeliostats() {
    final ArrayList<HousePart> heliostats = new ArrayList<HousePart>();
    final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
    if (selectedPart != null) {
        final Foundation foundation = selectedPart instanceof Foundation ? (Foundation) selectedPart : selectedPart.getTopContainer();
        for (final HousePart part : parts) {
            if (part instanceof Mirror && part.getTopContainer() == foundation) {
                heliostats.add(part);
            }
        }
    } else {
        for (final HousePart part : parts) {
            if (part instanceof Mirror) {
                heliostats.add(part);
            }
        }
    }
    if (heliostats.isEmpty()) {
        JOptionPane.showMessageDialog(MainFrame.getInstance(), "There is no heliostat to remove.", "No Heliostat", JOptionPane.INFORMATION_MESSAGE);
        return;
    }
    if (JOptionPane.showConfirmDialog(MainFrame.getInstance(), "Do you really want to remove all " + heliostats.size() + " heliostats" + (selectedPart != null ? " on the selected foundation" : "") + "?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) != JOptionPane.YES_OPTION) {
        return;
    }
    final RemoveMultiplePartsCommand c = new RemoveMultiplePartsCommand(heliostats);
    for (final HousePart part : heliostats) {
        remove(part, false);
    }
    redrawAll();
    SceneManager.getInstance().getUndoManager().addEdit(c);
    edited = true;
}
Also used : ArrayList(java.util.ArrayList) Foundation(org.concord.energy3d.model.Foundation) Mirror(org.concord.energy3d.model.Mirror) HousePart(org.concord.energy3d.model.HousePart) RemoveMultiplePartsCommand(org.concord.energy3d.undo.RemoveMultiplePartsCommand)

Aggregations

RemoveMultiplePartsCommand (org.concord.energy3d.undo.RemoveMultiplePartsCommand)17 ArrayList (java.util.ArrayList)16 HousePart (org.concord.energy3d.model.HousePart)16 Foundation (org.concord.energy3d.model.Foundation)10 Rack (org.concord.energy3d.model.Rack)2 Roof (org.concord.energy3d.model.Roof)2 Wall (org.concord.energy3d.model.Wall)2 Vector3 (com.ardor3d.math.Vector3)1 ReadOnlyVector3 (com.ardor3d.math.type.ReadOnlyVector3)1 CullHint (com.ardor3d.scenegraph.hint.CullHint)1 Path2D (java.awt.geom.Path2D)1 Floor (org.concord.energy3d.model.Floor)1 FresnelReflector (org.concord.energy3d.model.FresnelReflector)1 Human (org.concord.energy3d.model.Human)1 Mirror (org.concord.energy3d.model.Mirror)1 ParabolicDish (org.concord.energy3d.model.ParabolicDish)1 ParabolicTrough (org.concord.energy3d.model.ParabolicTrough)1 Sensor (org.concord.energy3d.model.Sensor)1 Snap (org.concord.energy3d.model.Snap)1 SolarPanel (org.concord.energy3d.model.SolarPanel)1