use of org.concord.energy3d.undo.MovePartCommand 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);
}
Aggregations