use of org.concord.energy3d.model.Floor in project energy3d by concord-consortium.
the class Scene method removeAllFloors.
public void removeAllFloors() {
final ArrayList<HousePart> floors = new ArrayList<HousePart>();
for (final HousePart part : parts) {
if (part instanceof Floor && !part.getLockEdit()) {
floors.add(part);
}
}
if (floors.isEmpty()) {
JOptionPane.showMessageDialog(MainFrame.getInstance(), "There is no floor to remove.", "No Floor", JOptionPane.INFORMATION_MESSAGE);
return;
}
if (JOptionPane.showConfirmDialog(MainFrame.getInstance(), "Do you really want to remove all " + floors.size() + " floors?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) != JOptionPane.YES_OPTION) {
return;
}
final RemoveMultiplePartsCommand c = new RemoveMultiplePartsCommand(floors);
for (final HousePart part : floors) {
remove(part, false);
}
redrawAll();
SceneManager.getInstance().getUndoManager().addEdit(c);
edited = true;
}
use of org.concord.energy3d.model.Floor in project energy3d by concord-consortium.
the class SceneManager method newPart.
private HousePart newPart() {
final HousePart drawn;
setGridsVisible(false);
if (operation == Operation.DRAW_WALL) {
drawn = new Wall();
drawn.setColor(Scene.getInstance().getWallColor());
} else if (operation == Operation.DRAW_DOOR) {
drawn = new Door();
drawn.setColor(Scene.getInstance().getDoorColor());
} else if (operation == Operation.DRAW_WINDOW) {
drawn = new Window();
} else if (operation == Operation.DRAW_ROOF_PYRAMID) {
drawn = new PyramidRoof();
drawn.setColor(Scene.getInstance().getRoofColor());
} else if (operation == Operation.DRAW_ROOF_HIP) {
drawn = new HipRoof();
drawn.setColor(Scene.getInstance().getRoofColor());
} else if (operation == Operation.DRAW_ROOF_SHED) {
drawn = new ShedRoof();
drawn.setColor(Scene.getInstance().getRoofColor());
} else if (operation == Operation.DRAW_ROOF_GAMBREL) {
drawn = new GambrelRoof();
drawn.setColor(Scene.getInstance().getRoofColor());
} else if (operation == Operation.DRAW_ROOF_CUSTOM) {
drawn = new CustomRoof();
drawn.setColor(Scene.getInstance().getRoofColor());
} else if (operation == Operation.DRAW_FLOOR) {
drawn = new Floor();
drawn.setColor(Scene.getInstance().getFloorColor());
} else if (operation == Operation.DRAW_SOLAR_PANEL) {
drawn = new SolarPanel();
} else if (operation == Operation.DRAW_RACK) {
drawn = new Rack();
} else if (operation == Operation.DRAW_MIRROR) {
drawn = new Mirror();
} else if (operation == Operation.DRAW_PARABOLIC_TROUGH) {
drawn = new ParabolicTrough();
} else if (operation == Operation.DRAW_PARABOLIC_DISH) {
drawn = new ParabolicDish();
} else if (operation == Operation.DRAW_FRESNEL_REFLECTOR) {
drawn = new FresnelReflector();
} else if (operation == Operation.DRAW_SENSOR) {
drawn = new Sensor();
} else if (operation == Operation.DRAW_FOUNDATION) {
drawn = new Foundation();
setGridsVisible(Scene.getInstance().isSnapToGrids());
drawn.setColor(Scene.getInstance().getFoundationColor());
} else if (operation == Operation.DRAW_DOGWOOD) {
drawn = new Tree(Tree.DOGWOOD);
setGridsVisible(true);
} else if (operation == Operation.DRAW_ELM) {
drawn = new Tree(Tree.ELM);
setGridsVisible(true);
} else if (operation == Operation.DRAW_OAK) {
drawn = new Tree(Tree.OAK);
setGridsVisible(true);
} else if (operation == Operation.DRAW_LINDEN) {
drawn = new Tree(Tree.LINDEN);
setGridsVisible(true);
} else if (operation == Operation.DRAW_COTTONWOOD) {
drawn = new Tree(Tree.COTTONWOOD);
setGridsVisible(true);
} else if (operation == Operation.DRAW_MAPLE) {
drawn = new Tree(Tree.MAPLE);
setGridsVisible(true);
} else if (operation == Operation.DRAW_PINE) {
drawn = new Tree(Tree.PINE);
setGridsVisible(true);
} else if (operation == Operation.DRAW_JANE) {
drawn = new Human(Human.JANE);
setGridsVisible(true);
} else if (operation == Operation.DRAW_JENI) {
drawn = new Human(Human.JENI);
setGridsVisible(true);
} else if (operation == Operation.DRAW_JILL) {
drawn = new Human(Human.JILL);
setGridsVisible(true);
} else if (operation == Operation.DRAW_JACK) {
drawn = new Human(Human.JACK);
setGridsVisible(true);
} else if (operation == Operation.DRAW_JOHN) {
drawn = new Human(Human.JOHN);
setGridsVisible(true);
} else if (operation == Operation.DRAW_JOSE) {
drawn = new Human(Human.JOSE);
setGridsVisible(true);
} else {
return null;
}
Scene.getInstance().add(drawn, false);
addPartCommand = new AddPartCommand(drawn);
return drawn;
}
use of org.concord.energy3d.model.Floor in project energy3d by concord-consortium.
the class SceneManager method getPickedLocationOnFloor.
Vector3 getPickedLocationOnFloor() {
if (pickMouseState != null) {
final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
if (selectedPart instanceof Floor) {
final PickedHousePart pick = SelectUtil.pickPart(pickMouseState.getX(), pickMouseState.getY(), selectedPart);
if (pick != null) {
return pick.getPoint().clone();
}
}
pickMouseState = null;
}
return null;
}
use of org.concord.energy3d.model.Floor in project energy3d by concord-consortium.
the class BuildingCost method getPartCost.
/* The material and installation costs are partly based on http://www.homewyse.com, but should be considered as largely fictitious. */
public static double getPartCost(final HousePart part) {
// The baseline cost for a wall is set to be $300/m^2, close to homewyse's estimates of masonry walls, interior framing, etc.
if (part instanceof Wall) {
final double uFactor = ((Wall) part).getUValue();
final double unitPrice = 300.0 + 8.0 / uFactor;
return part.getArea() * unitPrice;
}
// A storm window of about 1 m^2 costs about $500. A double-pane window of about 1 m^2 costs about $700.
if (part instanceof Window) {
final double uFactor = ((Window) part).getUValue();
final double unitPrice = 500.0 + 800.0 / uFactor;
return part.getArea() * unitPrice;
}
// The baseline (that is, the structure without insulation) cost for a roof is set to be $100/m^2.
if (part instanceof Roof) {
final double uFactor = ((Roof) part).getUValue();
final double unitPrice = 100.0 + 10.0 / uFactor;
return part.getArea() * unitPrice;
}
// The foundation cost is set to be $200/m^2.
if (part instanceof Foundation) {
final Foundation foundation = (Foundation) part;
final Building b = new Building(foundation);
if (b.isWallComplete()) {
b.calculate();
final double uFactor = foundation.getUValue();
final double unitPrice = 300.0 + 8.0 / uFactor;
return b.getArea() * unitPrice;
}
// the building is incomplete yet, so we can assume the floor insulation isn't there yet
return -1;
}
if (part instanceof Floor) {
final double area = part.getArea();
if (area > 0) {
return part.getArea() * 100.0;
}
return -1;
}
// According to http://www.homewyse.com/costs/cost_of_exterior_doors.html
if (part instanceof Door) {
final double uFactor = ((Door) part).getUValue();
final double unitPrice = 500.0 + 100.0 / uFactor;
return part.getArea() * unitPrice;
}
if (part instanceof SolarPanel) {
return Scene.getInstance().getPvCustomPrice().getTotalCost((SolarPanel) part);
}
if (part instanceof Rack) {
return Scene.getInstance().getPvCustomPrice().getTotalCost((Rack) part);
}
if (part instanceof Tree) {
switch(((Tree) part).getTreeType()) {
case Tree.LINDEN:
return 3000;
case Tree.COTTONWOOD:
return 2500;
case Tree.ELM:
return 2000;
case Tree.OAK:
return 2000;
case Tree.PINE:
return 1500;
case Tree.MAPLE:
return 1000;
default:
return 500;
}
}
return 0;
}
use of org.concord.energy3d.model.Floor in project energy3d by concord-consortium.
the class SolarRadiation method initCollidables.
private void initCollidables() {
collidables.clear();
collidablesToParts.clear();
for (final HousePart part : Scene.getInstance().getParts()) {
if (part instanceof SolarCollector || part instanceof Tree || part instanceof Window) {
if (part instanceof Rack) {
final Rack rack = (Rack) part;
if (rack.isMonolithic()) {
final Spatial s = part.getRadiationCollisionSpatial();
collidables.add(s);
collidablesToParts.put(s, rack);
}
} else {
final Spatial s = part.getRadiationCollisionSpatial();
collidables.add(s);
collidablesToParts.put(s, part);
}
} else if (part instanceof Foundation) {
final Foundation foundation = (Foundation) part;
for (int i = 0; i < 4; i++) {
final Spatial s = foundation.getRadiationCollisionSpatial(i);
collidables.add(s);
collidablesToParts.put(s, foundation);
}
final List<Node> importedNodes = foundation.getImportedNodes();
if (importedNodes != null) {
for (final Node node : importedNodes) {
for (final Spatial s : node.getChildren()) {
collidables.add(s);
collidablesToParts.put(s, foundation);
}
}
}
} else if (part instanceof Wall) {
final Wall wall = (Wall) part;
if (wall.getType() == Wall.SOLID_WALL) {
final Spatial s = part.getRadiationCollisionSpatial();
collidables.add(s);
collidablesToParts.put(s, wall);
}
} else if (part instanceof Door) {
final Door door = (Door) part;
final Spatial s = door.getRadiationCollisionSpatial();
collidables.add(s);
collidablesToParts.put(s, door);
} else if (part instanceof Floor) {
final Floor floor = (Floor) part;
final Spatial s = floor.getRadiationCollisionSpatial();
collidables.add(s);
collidablesToParts.put(s, floor);
} else if (part instanceof Roof) {
final Roof roof = (Roof) part;
for (final Spatial roofPart : roof.getRoofPartsRoot().getChildren()) {
if (roofPart.getSceneHints().getCullHint() != CullHint.Always) {
final Spatial s = ((Node) roofPart).getChild(6);
collidables.add(s);
collidablesToParts.put(s, roof);
}
}
}
}
}
Aggregations