Search in sources :

Example 31 with HousePart

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

the class Scene method removeChildren.

private void removeChildren(final HousePart part) {
    System.out.println("Removing: " + part);
    // this must happen before call to wall.delete()
    parts.remove(part);
    if (!part.getChildren().isEmpty()) {
        for (final HousePart child : part.getChildren()) {
            removeChildren(child);
        }
    }
    // originalHouseRoot.detachChild(housePart.getRoot());
    part.getRoot().removeFromParent();
    part.delete();
}
Also used : HousePart(org.concord.energy3d.model.HousePart)

Example 32 with HousePart

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

the class Scene method setModelForAllSolarPanels.

public void setModelForAllSolarPanels(final PvModuleSpecs specs) {
    for (final HousePart p : parts) {
        if (p instanceof SolarPanel) {
            ((SolarPanel) p).setPvModuleSpecs(specs);
            p.draw();
        }
    }
    SceneManager.getInstance().refresh();
}
Also used : SolarPanel(org.concord.energy3d.model.SolarPanel) HousePart(org.concord.energy3d.model.HousePart)

Example 33 with HousePart

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

the class Scene method removeAllRoofs.

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

Example 34 with HousePart

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

the class Scene method add.

public void add(final HousePart part, final boolean redraw) {
    final HousePart container = part.getContainer();
    if (container != null) {
        container.getChildren().add(part);
    }
    add(part);
    if (redraw) {
        if (part instanceof SolarCollector || part instanceof Tree || part instanceof Human) {
            // add these objects will not affect the rendering of other objects
            part.draw();
        } else if (part instanceof Foundation) {
            redrawFoundationNow((Foundation) part);
        } else if (part instanceof Window || part instanceof Door) {
            part.draw();
            part.getContainer().draw();
        } else {
            // what will fall through here?
            System.out.println("*** Warning: potential performance drag: " + part);
            redrawAll();
        }
    }
}
Also used : Human(org.concord.energy3d.model.Human) Window(org.concord.energy3d.model.Window) SolarCollector(org.concord.energy3d.model.SolarCollector) Tree(org.concord.energy3d.model.Tree) Foundation(org.concord.energy3d.model.Foundation) HousePart(org.concord.energy3d.model.HousePart) Door(org.concord.energy3d.model.Door)

Example 35 with HousePart

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

the class Scene method updateAllTextures.

public void updateAllTextures() {
    System.out.println("updateAllTextures()");
    for (final HousePart part : parts) {
        part.updateTextureAndColor();
    }
    SceneManager.getInstance().refresh();
}
Also used : HousePart(org.concord.energy3d.model.HousePart)

Aggregations

HousePart (org.concord.energy3d.model.HousePart)277 Foundation (org.concord.energy3d.model.Foundation)153 Rack (org.concord.energy3d.model.Rack)69 SolarPanel (org.concord.energy3d.model.SolarPanel)60 Roof (org.concord.energy3d.model.Roof)47 Wall (org.concord.energy3d.model.Wall)45 Window (org.concord.energy3d.model.Window)43 ActionEvent (java.awt.event.ActionEvent)42 ActionListener (java.awt.event.ActionListener)42 ArrayList (java.util.ArrayList)41 Mirror (org.concord.energy3d.model.Mirror)38 JMenuItem (javax.swing.JMenuItem)36 JDialog (javax.swing.JDialog)35 FresnelReflector (org.concord.energy3d.model.FresnelReflector)34 ParabolicTrough (org.concord.energy3d.model.ParabolicTrough)32 ParabolicDish (org.concord.energy3d.model.ParabolicDish)28 Tree (org.concord.energy3d.model.Tree)26 Door (org.concord.energy3d.model.Door)25 ReadOnlyVector3 (com.ardor3d.math.type.ReadOnlyVector3)21 JPanel (javax.swing.JPanel)21