Search in sources :

Example 46 with Window

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

the class SetSizeForWindowsOnFoundationCommand method redo.

@Override
public void redo() throws CannotRedoException {
    super.redo();
    final int n = windows.size();
    for (int i = 0; i < n; i++) {
        final Window w = windows.get(i);
        w.setWindowWidth(newWidths[i]);
        w.setWindowHeight(newHeights[i]);
        w.draw();
        w.getContainer().draw();
    }
    SceneManager.getInstance().refresh();
}
Also used : Window(org.concord.energy3d.model.Window)

Example 47 with Window

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

the class SetPartSizeCommand method redo.

@Override
public void redo() throws CannotRedoException {
    super.redo();
    if (part instanceof Mirror) {
        final Mirror m = (Mirror) part;
        m.setMirrorWidth(newWidth);
        m.setMirrorHeight(newHeight);
    } else if (part instanceof ParabolicTrough) {
        final ParabolicTrough t = (ParabolicTrough) part;
        t.setApertureWidth(newWidth);
        t.setTroughLength(newHeight);
        t.setModuleLength(newModuleLength);
    } else if (part instanceof ParabolicDish) {
        final ParabolicDish d = (ParabolicDish) part;
        d.setRimRadius(newWidth);
    } else if (part instanceof FresnelReflector) {
        final FresnelReflector t = (FresnelReflector) part;
        t.setModuleWidth(newWidth);
        t.setLength(newHeight);
        t.setModuleLength(newModuleLength);
    } else if (part instanceof Rack) {
        final Rack r = (Rack) part;
        r.setRackWidth(newWidth);
        r.setRackHeight(newHeight);
    } else if (part instanceof Window) {
        final Window w = (Window) part;
        w.setWindowWidth(newWidth);
        w.setWindowHeight(newHeight);
        w.getContainer().draw();
    } else if (part instanceof Door) {
        final Door d = (Door) part;
        d.setDoorWidth(newWidth);
        d.setDoorHeight(newHeight);
        d.getContainer().draw();
    }
    part.draw();
    SceneManager.getInstance().refresh();
}
Also used : ParabolicDish(org.concord.energy3d.model.ParabolicDish) Window(org.concord.energy3d.model.Window) Rack(org.concord.energy3d.model.Rack) ParabolicTrough(org.concord.energy3d.model.ParabolicTrough) FresnelReflector(org.concord.energy3d.model.FresnelReflector) Mirror(org.concord.energy3d.model.Mirror) Door(org.concord.energy3d.model.Door)

Example 48 with Window

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

the class RemoveMultipleShuttersCommand method undo.

@Override
public void undo() throws CannotUndoException {
    super.undo();
    for (int i = 0; i < windows.size(); i++) {
        final Window w = windows.get(i);
        if (w.isDrawable()) {
            // as an extra defense of potential invisible ghost part
            w.setLeftShutter(leftShutters[i]);
            w.setRightShutter(rightShutters[i]);
            w.draw();
        }
    }
    if (SceneManager.getInstance().getSolarHeatMap()) {
        EnergyPanel.getInstance().updateRadiationHeatMap();
    }
}
Also used : Window(org.concord.energy3d.model.Window)

Example 49 with Window

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

the class RemoveMultipleShuttersCommand method redo.

@Override
public void redo() throws CannotRedoException {
    super.redo();
    for (final Window w : windows) {
        if (w.isDrawable()) {
            // as an extra defense of potential invisible ghost part
            w.setLeftShutter(false);
            w.setRightShutter(false);
            w.draw();
        }
    }
    if (SceneManager.getInstance().getSolarHeatMap()) {
        EnergyPanel.getInstance().updateRadiationHeatMap();
    }
}
Also used : Window(org.concord.energy3d.model.Window)

Example 50 with Window

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

the class SelectUtil method getPickResult.

private static PickedHousePart getPickResult(final Ray3 pickRay) {
    PickedHousePart pickedHousePart = null;
    double polyDist = Double.MAX_VALUE;
    double pointDist = Double.MAX_VALUE;
    int objCounter = 0;
    HousePart prevHousePart = null;
    final long pickLayer = SelectUtil.pickLayer == -1 ? -1 : SelectUtil.pickLayer % Math.max(1, pickResults.getNumber());
    for (int i = 0; i < pickResults.getNumber(); i++) {
        final PickData pick = pickResults.getPickData(i);
        if (pick.getIntersectionRecord().getNumberOfIntersections() == 0) {
            continue;
        }
        final Object obj = ((Mesh) pick.getTarget()).getUserData();
        UserData userData = null;
        if (obj instanceof UserData) {
            // FIXME: Note that userData can be null if the pick is the land
            userData = (UserData) obj;
            if (userData.getHousePart() != prevHousePart) {
                objCounter++;
                prevHousePart = userData.getHousePart();
            }
        } else if (pickLayer != -1) {
            continue;
        }
        if (pickLayer != -1 && objCounter - 1 != pickLayer) {
            continue;
        }
        final Vector3 intersectionPoint = pick.getIntersectionRecord().getIntersectionPoint(0);
        final PickedHousePart picked_i = new PickedHousePart(userData, intersectionPoint, pick.getIntersectionRecord().getIntersectionNormal(0));
        double polyDist_i = pick.getIntersectionRecord().getClosestDistance();
        if (userData != null && userData.getHousePart() instanceof Window) {
            // give more priority to window (especially skylight)
            polyDist_i -= 0.2;
        }
        double pointDist_i = Double.MAX_VALUE;
        if (userData != null && polyDist_i - polyDist < 0.1) {
            for (int j = 0; j < userData.getHousePart().getPoints().size(); j++) {
                final Vector3 p = userData.getHousePart().getAbsPoint(j);
                pointDist_i = p.distance(intersectionPoint);
                double adjust = 0;
                if (userData.getHousePart().isFirstPointInserted()) {
                    // to avoid IndexOutOfBoundsException: Index: 2, Size: 2
                    if (userData.getHousePart().getNormal() != null) {
                        adjust -= Math.abs(userData.getHousePart().getNormal().negate(null).dot(pickRay.getDirection()) / 10.0);
                    }
                }
                if (userData.getHousePart() == SceneManager.getInstance().getSelectedPart()) {
                    // give more priority because the object is selected
                    adjust -= 0.1;
                }
                if (userData.isEditPoint()) {
                    // give more priority because this is an edit point
                    adjust -= 0.1;
                }
                if (userData.isEditPoint() && userData.getHousePart() instanceof Foundation && ((Foundation) userData.getHousePart()).isResizeHouseMode()) {
                    adjust -= 0.1;
                }
                pointDist_i += adjust;
                if (pointDist_i < pointDist && (userData.getEditPointIndex() != -1 || pickedHousePart == null || pickedHousePart.getUserData() == null || pickedHousePart.getUserData().getEditPointIndex() == -1)) {
                    pickedHousePart = picked_i;
                    polyDist = polyDist_i;
                    pointDist = pointDist_i;
                }
            }
        }
        if (pickedHousePart == null || polyDist_i < polyDist) {
            pickedHousePart = picked_i;
            polyDist = polyDist_i;
            pointDist = pointDist_i;
        }
    }
    return pickedHousePart;
}
Also used : Window(org.concord.energy3d.model.Window) UserData(org.concord.energy3d.model.UserData) Mesh(com.ardor3d.scenegraph.Mesh) Vector3(com.ardor3d.math.Vector3) Foundation(org.concord.energy3d.model.Foundation) PickData(com.ardor3d.intersection.PickData) PickedHousePart(org.concord.energy3d.model.PickedHousePart) HousePart(org.concord.energy3d.model.HousePart) PickedHousePart(org.concord.energy3d.model.PickedHousePart)

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