Commit 82f714de authored by Tobias Meuser's avatar Tobias Meuser
Browse files

Minor changes

parent 3752262e
package de.tudarmstadt.maki.simonstrator.api.component.vehicular.api;
import java.util.List;
import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location;
/**
......@@ -77,4 +79,10 @@ public interface EdgeController {
* @return the observedAreaSet
*/
public boolean isObservedAreaSet();
/**
* @param pLaneID
* @return
*/
List<Location> getLaneShape(String pLaneID);
}
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of Simonstrator.KOM.
*
* Simonstrator.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package de.tudarmstadt.maki.simonstrator.api.component.vehicular.information;
import java.util.ArrayList;
import java.util.List;
import de.tudarmstadt.maki.simonstrator.api.component.pubsub.Notification;
import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge;
/**
* Wrapper class for a notification.
*
* @author Tobias Meuser (tobias.meuser@kom.tu-darmstadt.de)
* @version 1.0 at 14.11.2017
*
*/
public class NotificationBasedVehicularPointInformation implements VehicularPointInformation<Object> {
private Notification _notification;
public NotificationBasedVehicularPointInformation(Notification pNotification) {
_notification = pNotification;
}
@Override
public Location getLocation() {
return _notification.getAttribute(AvailableInformationAttributes.POSITION.getAttributeID(), Location.class)
.getValue();
}
@Override
public long getDetectionDate() {
return _notification.getAttribute(AvailableInformationAttributes.DATE.getAttributeID(), Long.class).getValue();
}
@Override
public <T> void setAttribute(AvailableInformationAttributes pKey, T pValue) {
throw new UnsupportedOperationException(
getClass().getSimpleName() + " is only a container class, no changes allowed!");
}
@Override
public <T> T getAttribute(AvailableInformationAttributes pKey) {
return (T) _notification.getAttribute(pKey.getAttributeID(), Object.class).getValue();
}
@Override
public List<AvailableInformationAttributes> getAvailableAttributes() {
return new ArrayList<>();
}
@Override
public <T> boolean hasAttribute(AvailableInformationAttributes pKey) {
return false;
}
@Override
public Object getValue() {
return _notification.getAttribute(AvailableInformationAttributes.VALUE.getAttributeID(), Object.class)
.getValue();
}
@Override
public RoadNetworkEdge getEdge() {
return _notification.getAttribute(AvailableInformationAttributes.EDGE.getAttributeID(), RoadNetworkEdge.class)
.getValue();
}
}
......@@ -29,17 +29,17 @@ import de.tudarmstadt.maki.simonstrator.api.Host;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.VehicularPointInformation;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge;
public class SimpleEventRelevanceCalculationComponent implements EventRelevanceCalculationComponent {
public class FixedRangeRelevanceCalculationComponent implements EventRelevanceCalculationComponent {
private final int DEPTH;
private Host _host;
public SimpleEventRelevanceCalculationComponent(Host pHost, int pDepth) {
public FixedRangeRelevanceCalculationComponent(Host pHost, int pDepth) {
_host = pHost;
DEPTH = pDepth;
}
public SimpleEventRelevanceCalculationComponent(Host pHost) {
public FixedRangeRelevanceCalculationComponent(Host pHost) {
this(pHost, 5);
}
......
......@@ -40,6 +40,8 @@ public class RoadNetworkEdge {
private final EdgeController _edgeController;
private boolean _active = false;
public RoadNetworkEdge(SerializableRoadNetworkEdge pEdge, EdgeController pEdgeController) {
_edgeController = pEdgeController;
......@@ -61,6 +63,21 @@ public class RoadNetworkEdge {
_angle = pAngle;
}
/**
* @param pActive
* the active to set
*/
public void setActive(boolean pActive) {
_active = pActive;
}
/**
* @return the active
*/
public boolean isActive() {
return _active;
}
public List<RoadNetworkLane> getLanes() {
return _lanes;
}
......@@ -135,4 +152,15 @@ public class RoadNetworkEdge {
_maxSpeed = pMaxSpeed;
_edgeController.setEdgeMaxSpeed(getEdgeID(), pMaxSpeed);
}
public List<List<Location>> getRoadShape() {
List<List<Location>> laneShapes = new ArrayList<>();
for (RoadNetworkLane roadNetworkLane : _lanes) {
List<Location> laneShape = _edgeController.getLaneShape(roadNetworkLane.getLaneID());
laneShapes.add(laneShape);
}
return laneShapes;
}
}
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