Search in sources :

Example 6 with Window

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

the class Scene method setShutterColorOfBuilding.

public void setShutterColorOfBuilding(final HousePart part, final ReadOnlyColorRGBA color) {
    if (part instanceof Foundation) {
        return;
    }
    for (final HousePart p : parts) {
        if (p instanceof Window && p.getTopContainer() == part.getTopContainer()) {
            final Window w = (Window) p;
            w.setShutterColor(color);
            w.draw();
        }
    }
}
Also used : Window(org.concord.energy3d.model.Window) Foundation(org.concord.energy3d.model.Foundation) HousePart(org.concord.energy3d.model.HousePart)

Example 7 with Window

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

the class Scene method setShutterLengthOfBuilding.

public void setShutterLengthOfBuilding(final HousePart part, final double length) {
    if (part instanceof Foundation) {
        return;
    }
    for (final HousePart p : parts) {
        if (p instanceof Window && p.getTopContainer() == part.getTopContainer()) {
            final Window w = (Window) p;
            w.setShutterLength(length);
            w.draw();
        }
    }
}
Also used : Window(org.concord.energy3d.model.Window) Foundation(org.concord.energy3d.model.Foundation) HousePart(org.concord.energy3d.model.HousePart)

Example 8 with Window

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

the class Scene method pasteToPickedLocationOnWall.

public void pasteToPickedLocationOnWall() {
    EnergyPanel.getInstance().updateRadiationHeatMap();
    final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
    if (!(selectedPart instanceof Wall)) {
        return;
    }
    if (copyBuffer == null) {
        return;
    }
    if (copyBuffer instanceof Foundation) {
        return;
    }
    final HousePart c = copyBuffer.copy(false);
    if (c == null) {
        return;
    }
    Vector3 position = SceneManager.getInstance().getPickedLocationOnWall();
    if (position == null) {
        return;
    }
    final Wall wall = (Wall) selectedPart;
    if (wall != c.getContainer()) {
        // windows and solar panels can be pasted to a different wall
        if (c instanceof Window) {
            ((Window) c).moveTo(wall);
        } else if (c instanceof SolarPanel) {
            ((SolarPanel) c).moveTo(wall);
        }
    }
    position = c.toRelative(position.subtractLocal(c.getContainer().getAbsPoint(0)));
    final Vector3 center = c.toRelative(c.getAbsCenter().subtractLocal(c.getContainer().getAbsPoint(0)));
    position = position.subtractLocal(center);
    final int n = c.getPoints().size();
    for (int i = 0; i < n; i++) {
        final Vector3 v = c.getPoints().get(i);
        v.addLocal(position);
    }
    // out of boundary check
    final List<Vector3> polygon = wall.getWallPolygonPoints();
    final List<Vector3> relativePolygon = new ArrayList<Vector3>();
    for (final Vector3 p : polygon) {
        relativePolygon.add(c.toRelative(p));
    }
    for (final Vector3 p : relativePolygon) {
        final double y = p.getY();
        p.setY(p.getZ());
        p.setZ(y);
    }
    for (int i = 0; i < n; i++) {
        final Vector3 v = c.getPoints().get(i);
        if (!Util.insidePolygon(new Vector3(v.getX(), v.getZ(), v.getY()), relativePolygon)) {
            return;
        }
    }
    add(c, true);
    copyBuffer = c;
    SceneManager.getInstance().setSelectedPart(c);
    SceneManager.getInstance().getUndoManager().addEdit(new PastePartCommand(c));
}
Also used : Window(org.concord.energy3d.model.Window) Wall(org.concord.energy3d.model.Wall) SolarPanel(org.concord.energy3d.model.SolarPanel) ArrayList(java.util.ArrayList) Foundation(org.concord.energy3d.model.Foundation) ReadOnlyVector3(com.ardor3d.math.type.ReadOnlyVector3) Vector3(com.ardor3d.math.Vector3) HousePart(org.concord.energy3d.model.HousePart) PastePartCommand(org.concord.energy3d.undo.PastePartCommand)

Example 9 with Window

use of org.concord.energy3d.model.Window 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 10 with Window

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

the class SceneManager method move.

public void move(final Vector3 v) {
    if (SceneManager.getInstance().getSolarHeatMap()) {
        EnergyPanel.getInstance().updateRadiationHeatMap();
    }
    final MovePartCommand c = new MovePartCommand(selectedPart, v);
    if (selectedPart == null) {
        for (final HousePart p : Scene.getInstance().getParts()) {
            if (p instanceof Foundation) {
                ((Foundation) p).move(v, p.getGridSize());
            }
        }
        Scene.getInstance().redrawAll();
    } else if (selectedPart instanceof Foundation) {
        final Foundation f = (Foundation) selectedPart;
        if (f.isGroupMaster()) {
            final List<Foundation> g = Scene.getInstance().getFoundationGroup(f);
            for (final Foundation x : g) {
                x.move(v, selectedPart.getGridSize());
            }
        } else {
            f.move(v, selectedPart.getGridSize());
        }
    } else if (selectedPart instanceof FoundationPolygon) {
        ((Foundation) selectedPart.getContainer()).moveAllWithinPolygon(v);
    } else if (selectedPart instanceof Roof) {
        if (viewMode == ViewMode.TOP_VIEW) {
            final Foundation f = selectedPart.getTopContainer();
            if (f.isGroupMaster()) {
                final List<Foundation> g = Scene.getInstance().getFoundationGroup(f);
                for (final Foundation x : g) {
                    x.move(v, selectedPart.getGridSize());
                }
            } else {
                f.move(v, selectedPart.getGridSize());
            }
        }
    } else if (selectedPart instanceof Window) {
        final Window w = (Window) selectedPart;
        w.move(v);
        w.draw();
    } else if (selectedPart instanceof SolarCollector) {
        final SolarCollector sc = (SolarCollector) selectedPart;
        sc.move(v, selectedPart.getGridSize());
        selectedPart.draw();
    } else if (selectedPart instanceof Tree) {
        final Tree t = (Tree) selectedPart;
        t.move(v, selectedPart.getGridSize());
        t.draw();
    } else if (selectedPart instanceof Human) {
        final Human h = (Human) selectedPart;
        h.move(v, selectedPart.getGridSize());
        h.draw();
    }
    undoManager.addEdit(c);
    SceneManager.getInstance().refresh();
    Scene.getInstance().setEdited(true);
}
Also used : Window(org.concord.energy3d.model.Window) Human(org.concord.energy3d.model.Human) Roof(org.concord.energy3d.model.Roof) GambrelRoof(org.concord.energy3d.model.GambrelRoof) ShedRoof(org.concord.energy3d.model.ShedRoof) PyramidRoof(org.concord.energy3d.model.PyramidRoof) HipRoof(org.concord.energy3d.model.HipRoof) CustomRoof(org.concord.energy3d.model.CustomRoof) MovePartCommand(org.concord.energy3d.undo.MovePartCommand) SolarCollector(org.concord.energy3d.model.SolarCollector) Tree(org.concord.energy3d.model.Tree) Foundation(org.concord.energy3d.model.Foundation) ArrayList(java.util.ArrayList) List(java.util.List) PickedHousePart(org.concord.energy3d.model.PickedHousePart) HousePart(org.concord.energy3d.model.HousePart) FoundationPolygon(org.concord.energy3d.model.FoundationPolygon)

Aggregations

Window (org.concord.energy3d.model.Window)57 HousePart (org.concord.energy3d.model.HousePart)43 Foundation (org.concord.energy3d.model.Foundation)39 Roof (org.concord.energy3d.model.Roof)28 Wall (org.concord.energy3d.model.Wall)28 Rack (org.concord.energy3d.model.Rack)27 Door (org.concord.energy3d.model.Door)25 SolarPanel (org.concord.energy3d.model.SolarPanel)25 Mirror (org.concord.energy3d.model.Mirror)16 ArrayList (java.util.ArrayList)15 FresnelReflector (org.concord.energy3d.model.FresnelReflector)14 ParabolicTrough (org.concord.energy3d.model.ParabolicTrough)14 ParabolicDish (org.concord.energy3d.model.ParabolicDish)13 Tree (org.concord.energy3d.model.Tree)12 List (java.util.List)10 Floor (org.concord.energy3d.model.Floor)10 ReadOnlyVector3 (com.ardor3d.math.type.ReadOnlyVector3)9 SolarCollector (org.concord.energy3d.model.SolarCollector)9 Human (org.concord.energy3d.model.Human)8 Vector3 (com.ardor3d.math.Vector3)7