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();
}
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();
}
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;
}
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();
}
}
}
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();
}
Aggregations