Search in sources :

Example 46 with HousePart

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

the class Scene method setColorOfAllPartsOfSameType.

public void setColorOfAllPartsOfSameType(final HousePart part, final ReadOnlyColorRGBA color) {
    for (final HousePart p : parts) {
        if (p.getClass().equals(part.getClass())) {
            p.setColor(color);
            p.draw();
        }
    }
    SceneManager.getInstance().refresh();
}
Also used : HousePart(org.concord.energy3d.model.HousePart)

Example 47 with HousePart

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

the class Scene method setTrackerForAllSolarPanels.

public void setTrackerForAllSolarPanels(final int tracker) {
    for (final HousePart p : parts) {
        if (p instanceof SolarPanel && !(p.getContainer() instanceof Rack)) {
            // no tracker for solar panels on racks as they use rack trackers
            ((SolarPanel) p).setTracker(tracker);
            p.draw();
        }
    }
    SceneManager.getInstance().refresh();
}
Also used : Rack(org.concord.energy3d.model.Rack) SolarPanel(org.concord.energy3d.model.SolarPanel) HousePart(org.concord.energy3d.model.HousePart)

Example 48 with HousePart

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

the class Scene method setHeightForAllWalls.

public void setHeightForAllWalls(final double height) {
    for (final HousePart p : parts) {
        if (p instanceof Wall) {
            final Wall w = (Wall) p;
            w.setHeight(height, true);
        }
    }
    redrawAllWallsNow();
}
Also used : Wall(org.concord.energy3d.model.Wall) HousePart(org.concord.energy3d.model.HousePart)

Example 49 with HousePart

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

the class Scene method setTiltAngleForAllRacks.

public void setTiltAngleForAllRacks(final double angle) {
    for (final HousePart p : parts) {
        if (p instanceof Rack) {
            ((Rack) p).setTiltAngle(angle);
            p.draw();
        }
    }
    SceneManager.getInstance().refresh();
}
Also used : Rack(org.concord.energy3d.model.Rack) HousePart(org.concord.energy3d.model.HousePart)

Example 50 with HousePart

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

the class Scene method removeAllChildren.

public void removeAllChildren(final HousePart parent) {
    final List<HousePart> children = parent.getChildren();
    final String s = parent.getClass().getSimpleName();
    // make a copy to avoid ConcurrentModificationException
    final List<HousePart> copy = new ArrayList<HousePart>();
    for (final HousePart p : children) {
        if (p instanceof Roof) {
            // make an exception of roof (it is a child of a wall)
            continue;
        }
        copy.add(p);
    }
    if (copy.isEmpty()) {
        JOptionPane.showMessageDialog(MainFrame.getInstance(), "There is no element to remove from " + s + ".", "No Element", JOptionPane.INFORMATION_MESSAGE);
        return;
    }
    if (JOptionPane.showConfirmDialog(MainFrame.getInstance(), "Do you really want to remove all " + copy.size() + " elements of " + s + "?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.NO_OPTION) {
        return;
    }
    final RemoveMultiplePartsCommand c = new RemoveMultiplePartsCommand(copy);
    for (final HousePart p : copy) {
        remove(p, false);
    }
    parent.draw();
    SceneManager.getInstance().getUndoManager().addEdit(c);
    edited = true;
    SceneManager.getInstance().refresh();
}
Also used : Roof(org.concord.energy3d.model.Roof) ArrayList(java.util.ArrayList) HousePart(org.concord.energy3d.model.HousePart) RemoveMultiplePartsCommand(org.concord.energy3d.undo.RemoveMultiplePartsCommand)

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