@Before public void setUp() { reg = MapSpatialRegistry.create(); }
/** * Constructs a new instance. * @param b The builder with configuration options. * @param c A reference to the clock. */ protected CollisionPlaneRoadModel(CollisionPlaneRMB b, Clock c) { super(b); objRadius = b.getObjectRadius(); deltaMax = maxSpeed * unitConversion.toInTime(c.getTickLength(), c.getTimeUnit()); checkArgument(deltaMax <= DMAX_RAD_RATIO * objRadius, "Incompatible parameters. The following condition should hold: deltaMax " + "(%s) <= %s * objRadius (%s), where deltaMax = maxSpeed (%s %s) * " + "tickLength (%s %s).", deltaMax, DMAX_RAD_RATIO, objRadius, maxSpeed, getSpeedUnit(), c.getTickLength(), c.getTimeUnit()); blockingRegistry = MapSpatialRegistry.create(); }
/** * Creates a new instance using the specified {@link Graph} as road structure. * The default units are used as defined by {@link AbstractRoadModel}. * @param g The graph which will be used as road structure. * @param b The builder that contains the properties. */ protected GraphRoadModelImpl(Graph<? extends ConnectionData> g, RoadModelBuilders.AbstractGraphRMB<?, ?, ?> b) { super(b.getDistanceUnit(), b.getSpeedUnit()); graph = g; snapshot = GraphRoadModelSnapshot.create( ImmutableGraph.copyOf(graph), b.getDistanceUnit()); registry = GraphSpatialRegistry.create(MapSpatialRegistry.<RoadUser>create()); }
PlaneRoadModel(RoadModelBuilders.AbstractPlaneRMB<?, ?> b) { super(b.getDistanceUnit(), b.getSpeedUnit()); min = b.getMin(); max = b.getMax(); width = max.x - min.x; height = max.y - min.y; maxSpeed = unitConversion.toInSpeed(b.getMaxSpeed()); snapshot = PlaneRoadModelSnapshot.create(this); planeGraph = new PlaneGraph<>(); registry = MapSpatialRegistry.create(); }