Notice to GitKraken users: A vulnerability has been found in the SSH key generation of GitKraken versions 7.6.0 to 8.0.0 (https://www.gitkraken.com/blog/weak-ssh-key-fix). If you use GitKraken and have generated a SSH key using one of these versions, please remove it both from your local workstation and from your LRZ GitLab profile.

21.10.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit 640cf23c authored by Stefan Schuhbaeck's avatar Stefan Schuhbaeck
Browse files

remove quick fix and add move call to ODEModel

parent 98db5d98
......@@ -295,7 +295,6 @@ public class Simulation {
for (Model m : models) {
m.update(simTimeInSec);
}
topographyController.update(simTimeInSec); //rebuild CellGrid
if (topographyController.getTopography().hasTeleporter()) {
teleporterController.update(simTimeInSec);
......
......@@ -179,7 +179,10 @@ public abstract class ODEModel<T extends DynamicElement, TAttributes extends Att
equations.getVelocity(counter, y, newVelocity);
// set data to ped
VPoint oldPosition = element.getPosition();
setPosition(element, newPos);
topography.moveElement(element, oldPosition);
setVelocity(element, new Vector2D(newVelocity[0], newVelocity[1]));
counter++;
}
......
package org.vadere.state.scenario;
import org.vadere.util.geometry.shapes.VPoint;
public interface DynamicElementMover {
/**
* @param element the DynamicElement which was moved to a new position
* @param oldPosition the old potion the DynamicElement was prior to this call. (The new position is contained in the element)
*/
<T extends DynamicElement> void moveElement(T element, final VPoint oldPosition);
<T extends DynamicElement> void addElement(T element);
<T extends DynamicElement> void removeElement(T element);
}
......@@ -30,7 +30,7 @@ import org.vadere.util.geometry.shapes.VPolygon;
import org.vadere.util.geometry.shapes.VShape;
@JsonIgnoreProperties(value = {"allOtherAttributes", "obstacleDistanceFunction"})
public class Topography {
public class Topography implements DynamicElementMover{
/** Transient to prevent JSON serialization. */
private static Logger logger = Logger.getLogger(Topography.class);
......@@ -216,14 +216,17 @@ public class Topography {
return getContainer(elementType).getElement(id);
}
@Override
public <T extends DynamicElement> void addElement(T element) {
((DynamicElementContainer<T>) getContainer(element.getClass())).addElement(element);
}
@Override
public <T extends DynamicElement> void removeElement(T element) {
((DynamicElementContainer<T>) getContainer(element.getClass())).removeElement(element);
}
@Override
public <T extends DynamicElement> void moveElement(T element, final VPoint oldPosition) {
((DynamicElementContainer<T>) getContainer(element.getClass())).moveElement(element, oldPosition);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment