package art.servers.fleetserver.configuration;
|
|
import art.library.model.devices.vehicle.VehiclePosition;
|
import art.servers.Shared;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonRootName;
|
|
|
@JsonRootName(value = "Configuration bus action area")
|
|
|
public class ConfigurationBusActionArea
|
{
|
@JsonProperty("Latitude")
|
public double latitude = 0d;
|
|
@JsonProperty("Longitude")
|
public double longitude = 0d;
|
|
|
/**
|
* Radius in meters
|
*/
|
@JsonProperty("Radius")
|
public int radius = 0;
|
|
/**
|
* Angle 1
|
*/
|
@JsonProperty("Angle 1")
|
public double angle1 = 0d;
|
|
|
/**
|
* Angle 2
|
*/
|
@JsonProperty("Angle 2")
|
public double angle2 = 0d;
|
|
|
|
|
public boolean correctAngle(VehiclePosition position)
|
{
|
try
|
{
|
if (angle2 < angle1)
|
{
|
if ((position.direction > angle2) && (position.direction < angle1)) return(false);
|
}
|
else
|
{
|
if ((position.direction < angle1) || (position.direction > angle2)) return(false);
|
}
|
|
return(true);
|
}
|
catch (Exception exception)
|
{
|
Shared.printstack("ConfigurationBusActionArea", exception);
|
}
|
|
return(false);
|
}
|
}
|