use of org.concord.energy3d.model.Wall in project energy3d by concord-consortium.
the class Scene method pasteToPickedLocationOnLand.
public void pasteToPickedLocationOnLand() {
if (SceneManager.getInstance().getSolarHeatMap()) {
EnergyPanel.getInstance().updateRadiationHeatMap();
}
if (copyBuffer == null) {
return;
}
final HousePart c = copyBuffer.copy(false);
if (c == null) {
return;
}
final Vector3 position = SceneManager.getInstance().getPickedLocationOnLand();
if (position == null) {
return;
}
if (c instanceof Tree || c instanceof Human) {
c.getPoints().set(0, position);
add(c, true);
copyBuffer = c;
SceneManager.getInstance().getUndoManager().addEdit(new PastePartCommand(c));
} else if (c instanceof Foundation) {
// pasting a foundation also clones the building above it
final Vector3 shift = position.subtractLocal(c.getAbsCenter()).multiplyLocal(1, 1, 0);
final int n = c.getPoints().size();
for (int i = 0; i < n; i++) {
c.getPoints().get(i).addLocal(shift);
}
add(c, true);
// copy gable info, too
final Foundation oldFoundation = (Foundation) copyBuffer;
final Foundation newFoundation = (Foundation) c;
final List<Roof> oldRoofs = oldFoundation.getRoofs();
final List<Roof> newRoofs = newFoundation.getRoofs();
if (!oldRoofs.isEmpty() && !newRoofs.isEmpty()) {
for (int i = 0; i < newRoofs.size(); i++) {
final Map<Integer, List<Wall>> oldMap = oldRoofs.get(i).getGableEditPointToWallMap();
if (oldMap == null || oldMap.isEmpty()) {
continue;
}
final Map<Integer, List<Wall>> newMap = new HashMap<Integer, List<Wall>>();
for (final Integer key : oldMap.keySet()) {
final List<Wall> oldWalls = oldMap.get(key);
final List<Wall> newWalls = new ArrayList<Wall>();
for (final Wall w : oldWalls) {
newWalls.add(getCopiedWall(w, oldFoundation, newFoundation));
}
newMap.put(key, newWalls);
}
newRoofs.get(i).setGableEditPointToWallMap(newMap);
}
}
copyBuffer = c;
setIdOfChildren(c);
SceneManager.getInstance().getUndoManager().addEdit(new PastePartCommand(c));
}
SceneManager.getInstance().setSelectedPart(c);
}
use of org.concord.energy3d.model.Wall in project energy3d by concord-consortium.
the class Scene method connectWalls.
public void connectWalls() {
List<Wall> walls = null;
for (final HousePart part : parts) {
if (part instanceof Wall) {
if (walls == null) {
walls = new ArrayList<Wall>();
}
walls.add((Wall) part);
part.reset();
}
}
if (walls != null && !walls.isEmpty()) {
for (final Wall w : walls) {
w.connectedWalls();
}
for (final Wall w : walls) {
w.computeInsideDirectionOfAttachedWalls(false);
}
walls.clear();
}
}
use of org.concord.energy3d.model.Wall in project energy3d by concord-consortium.
the class Scene method deleteAllConnectedWalls.
public void deleteAllConnectedWalls(final Wall w) {
final List<HousePart> copy = new ArrayList<HousePart>();
w.visitNeighbors(new WallVisitor() {
@Override
public void visit(final Wall currentWall, final Snap prev, final Snap next) {
copy.add(currentWall);
}
});
final RemoveMultiplePartsCommand c = new RemoveMultiplePartsCommand(copy);
for (final HousePart p : copy) {
remove(p, false);
}
SceneManager.getInstance().getUndoManager().addEdit(c);
edited = true;
SceneManager.getInstance().refresh();
}
use of org.concord.energy3d.model.Wall in project energy3d by concord-consortium.
the class Scene method setThicknessForAllWalls.
public void setThicknessForAllWalls(final double thickness) {
for (final HousePart p : parts) {
if (p instanceof Wall) {
((Wall) p).setThickness(thickness);
p.draw();
}
}
SceneManager.getInstance().refresh();
}
use of org.concord.energy3d.model.Wall 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();
}
Aggregations