use of org.concord.energy3d.model.HousePart in project energy3d by concord-consortium.
the class Scene method setPoleSpacingForAllRacks.
public void setPoleSpacingForAllRacks(final double dx, final double dy, final boolean visible) {
for (final HousePart p : parts) {
if (p instanceof Rack) {
final Rack r = (Rack) p;
r.setPoleDistanceX(dx);
r.setPoleDistanceY(dy);
r.setPoleVisible(visible);
r.draw();
}
}
SceneManager.getInstance().refresh();
}
use of org.concord.energy3d.model.HousePart in project energy3d by concord-consortium.
the class Scene method setModuleLengthForAllFresnelReflectors.
public void setModuleLengthForAllFresnelReflectors(final double moduleLength) {
for (final HousePart p : parts) {
if (p instanceof FresnelReflector) {
final FresnelReflector r = (FresnelReflector) p;
r.setModuleLength(moduleLength);
r.ensureFullModules(false);
r.draw();
}
}
SceneManager.getInstance().refresh();
}
use of org.concord.energy3d.model.HousePart in project energy3d by concord-consortium.
the class SceneManager method autoSelectBuilding.
public Foundation autoSelectBuilding(final boolean ask) {
Foundation foundation = null;
final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
if (selectedPart == null || selectedPart instanceof Tree || selectedPart instanceof Human) {
SceneManager.getInstance().setSelectedPart(null);
int count = 0;
HousePart hp = null;
for (final HousePart x : Scene.getInstance().getParts()) {
if (x instanceof Foundation) {
count++;
hp = x;
}
}
if (count == 1) {
SceneManager.getInstance().setSelectedPart(hp);
foundation = (Foundation) hp;
} else {
if (ask) {
if (count > 1) {
JOptionPane.showMessageDialog(MainFrame.getInstance(), "There are multiple buildings. You must select a building first.", "No Selection", JOptionPane.WARNING_MESSAGE);
} else {
JOptionPane.showMessageDialog(MainFrame.getInstance(), "There is no building.", "No Building", JOptionPane.WARNING_MESSAGE);
}
}
}
} else {
final HousePart topContainer = selectedPart.getTopContainer();
if (selectedPart instanceof Foundation) {
foundation = (Foundation) selectedPart;
} else if (topContainer instanceof Foundation) {
selectedPart.setEditPointsVisible(false);
SceneManager.getInstance().setSelectedPart(topContainer);
foundation = (Foundation) topContainer;
} else {
if (ask) {
JOptionPane.showMessageDialog(MainFrame.getInstance(), "You must select a building first.", "No Selection", JOptionPane.WARNING_MESSAGE);
}
}
}
return foundation;
}
use of org.concord.energy3d.model.HousePart 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.HousePart 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;
}
Aggregations