Search in sources :

Example 1 with Floor

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;
}
Also used : Floor(org.concord.energy3d.model.Floor) ArrayList(java.util.ArrayList) HousePart(org.concord.energy3d.model.HousePart) RemoveMultiplePartsCommand(org.concord.energy3d.undo.RemoveMultiplePartsCommand)

Example 2 with Floor

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;
}
Also used : Window(org.concord.energy3d.model.Window) Human(org.concord.energy3d.model.Human) Floor(org.concord.energy3d.model.Floor) ParabolicTrough(org.concord.energy3d.model.ParabolicTrough) FresnelReflector(org.concord.energy3d.model.FresnelReflector) Wall(org.concord.energy3d.model.Wall) ShedRoof(org.concord.energy3d.model.ShedRoof) Door(org.concord.energy3d.model.Door) GambrelRoof(org.concord.energy3d.model.GambrelRoof) CustomRoof(org.concord.energy3d.model.CustomRoof) ParabolicDish(org.concord.energy3d.model.ParabolicDish) PyramidRoof(org.concord.energy3d.model.PyramidRoof) Rack(org.concord.energy3d.model.Rack) SolarPanel(org.concord.energy3d.model.SolarPanel) AddPartCommand(org.concord.energy3d.undo.AddPartCommand) Tree(org.concord.energy3d.model.Tree) Foundation(org.concord.energy3d.model.Foundation) HipRoof(org.concord.energy3d.model.HipRoof) Mirror(org.concord.energy3d.model.Mirror) PickedHousePart(org.concord.energy3d.model.PickedHousePart) HousePart(org.concord.energy3d.model.HousePart) Sensor(org.concord.energy3d.model.Sensor)

Example 3 with Floor

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;
}
Also used : Floor(org.concord.energy3d.model.Floor) PickedHousePart(org.concord.energy3d.model.PickedHousePart) HousePart(org.concord.energy3d.model.HousePart) PickedHousePart(org.concord.energy3d.model.PickedHousePart)

Example 4 with Floor

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;
}
Also used : Window(org.concord.energy3d.model.Window) Building(org.concord.energy3d.model.Building) Floor(org.concord.energy3d.model.Floor) Rack(org.concord.energy3d.model.Rack) Roof(org.concord.energy3d.model.Roof) Wall(org.concord.energy3d.model.Wall) SolarPanel(org.concord.energy3d.model.SolarPanel) Tree(org.concord.energy3d.model.Tree) Foundation(org.concord.energy3d.model.Foundation) Door(org.concord.energy3d.model.Door)

Example 5 with Floor

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);
                }
            }
        }
    }
}
Also used : Window(org.concord.energy3d.model.Window) Floor(org.concord.energy3d.model.Floor) Wall(org.concord.energy3d.model.Wall) Node(com.ardor3d.scenegraph.Node) Door(org.concord.energy3d.model.Door) Rack(org.concord.energy3d.model.Rack) Roof(org.concord.energy3d.model.Roof) Spatial(com.ardor3d.scenegraph.Spatial) SolarCollector(org.concord.energy3d.model.SolarCollector) Tree(org.concord.energy3d.model.Tree) Foundation(org.concord.energy3d.model.Foundation) List(java.util.List) ArrayList(java.util.ArrayList) HousePart(org.concord.energy3d.model.HousePart)

Aggregations

Floor (org.concord.energy3d.model.Floor)16 HousePart (org.concord.energy3d.model.HousePart)15 Foundation (org.concord.energy3d.model.Foundation)12 Door (org.concord.energy3d.model.Door)11 Roof (org.concord.energy3d.model.Roof)11 Wall (org.concord.energy3d.model.Wall)11 Window (org.concord.energy3d.model.Window)10 Rack (org.concord.energy3d.model.Rack)9 SolarPanel (org.concord.energy3d.model.SolarPanel)8 Tree (org.concord.energy3d.model.Tree)7 ArrayList (java.util.ArrayList)6 List (java.util.List)5 Mesh (com.ardor3d.scenegraph.Mesh)4 Node (com.ardor3d.scenegraph.Node)4 Spatial (com.ardor3d.scenegraph.Spatial)4 Human (org.concord.energy3d.model.Human)4 Sensor (org.concord.energy3d.model.Sensor)4 SolarCollector (org.concord.energy3d.model.SolarCollector)4 ReadOnlyVector3 (com.ardor3d.math.type.ReadOnlyVector3)3 CullHint (com.ardor3d.scenegraph.hint.CullHint)3