public class Track
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Track.Category
An enumeration of the track category returned by the SIM.
|
static class |
Track.SectorType
An enumeration of the track sector types returned by the SIM.
|
static class |
Track.TrackLocation
An enumeration of the track locations used by the SIM.
|
static class |
Track.Type
An enumeration of the track types returned by the SIM.
|
Constructor and Description |
---|
Track(SIMPlugin SIMPlugin)
Class constructor to use when you have a SIMPlugin
|
Modifier and Type | Method and Description |
---|---|
double |
_getMergePoint(double relativeTo)
Returns the merging point as a percentage of where you are allowed to merge onto the track after when leaving the pits.
|
double |
_maxPercentage() |
Data |
getBearing() |
Data |
getBearing(java.lang.String location) |
Data |
getBearing(java.lang.String location,
java.lang.Double percentage,
java.lang.String UOM)
Returns the bearing of the requested position based on percentage traveled from the start/finish line.
|
Data |
getBearing(java.lang.String location,
java.lang.String percentage) |
Data |
getBearing(java.lang.String location,
java.lang.String percentage,
java.lang.String UOM) |
Data |
getCategory()
Returns the track category as defined by
Track.Category |
Data |
getCity()
Returns the city of where the track is as reported by the SIM SIMPlugin.
|
Data |
getCondition()
Returns the track condition as reported by the SIM SIMPlugin.
|
Data |
getConfiguration()
Returns the track configuration as reported by the SIM SIMPlugin.
|
Data |
getCountry()
Returns the country code of where the track is as reported by the SIM SIMPlugin.
|
Data |
getDescription()
Returns the description of the track.
|
Data |
getFinishLineRotation() |
Data |
getFinishLineRotation(java.lang.String UOM)
Returns the degrees to rotate the finish line.
|
Data |
getImage() |
Data |
getImage(java.lang.String type)
Returns the path to the track image specified by the "type" of image.
|
Data |
getLatitude() |
Data |
getLatitude(java.lang.String location) |
Data |
getLatitude(java.lang.String location,
java.lang.Double percentage,
java.lang.String UOM)
Returns the Latitude of the requested position based on percentage traveled from the start/finish line.
|
Data |
getLatitude(java.lang.String location,
java.lang.String percentage) |
Data |
getLatitude(java.lang.String location,
java.lang.String percentage,
java.lang.String UOM) |
Data |
getLength() |
Data |
getLength(java.lang.String UOM)
Returns the length of the track using the unit of measure the distance of this track is normally reported in.
|
Data |
getLongitude() |
Data |
getLongitude(java.lang.String location) |
Data |
getLongitude(java.lang.String location,
java.lang.Double percentage,
java.lang.String UOM)
Returns the Longitude of the requested position based on percentage traveled from the start/finish line.
|
Data |
getLongitude(java.lang.String location,
java.lang.String percentage) |
Data |
getLongitude(java.lang.String location,
java.lang.String percentage,
java.lang.String UOM) |
java.util.Map<java.lang.String,java.lang.Object> |
getMap()
Returns the data map of the track as a Map<String,Object>.
|
Data |
getName()
Returns the name of the track as reported by the SIM.
|
Data |
getNorth() |
Data |
getNorth(java.lang.String UOM)
Returns the degrees of where North points, where zero degrees is at 3 o'clock and rotates clockwise.
|
Data |
getPath() |
Data |
getPath(java.lang.String location) |
Data |
getPath(java.lang.String location,
java.lang.String UOM)
Returns the path of the track's configuration.
|
Data |
getPitSpeedLimit() |
Data |
getPitSpeedLimit(java.lang.String UOM)
Returns the Pit Speed Limit for this session as reported by the SIM SIMPlugin.
|
Data |
getResolution() |
Data |
getResolution(java.lang.String UOM)
Returns the resolution to be used with GPS mapping software for displaying the track on a map.
|
Data |
getSectors() |
Data |
getSectors(java.lang.String sectorType) |
Data |
getSectors(java.lang.String sectorType,
java.lang.String UOM)
Returns an array of sector starting and ending points.
|
Data |
getTemp() |
Data |
getTemp(java.lang.String UOM)
Returns the current temperature of the track.
|
Data |
getTimeZone()
Returns the time zone of the track's actual location in long format (i.e.
|
Data |
getType()
Returns the track's type as defined by
Track.Type |
Data |
getWeatherFogLevel()
Returns the fog level as a percentage.
|
Data |
getWeatherRelativeHumidity()
Returns the relative humidity as a percentage.
|
Data |
getWeatherSkies()
Returns the condition of the skies, like "Partly Cloudy".
|
Data |
getWeatherTemp() |
Data |
getWeatherTemp(java.lang.String UOM)
Returns the current ambient temperature at the track.
|
Data |
getWeatherWindDirection() |
Data |
getWeatherWindDirection(java.lang.String UOM)
Returns the wind direction, where East is zero degrees at 3 o'clock.
|
Data |
getWeatherWindSpeed() |
Data |
getWeatherWindSpeed(java.lang.String UOM)
Returns the wind speed.
|
void |
reload()
Forces a reload of the track's JSON files.
|
public Track(SIMPlugin SIMPlugin)
SIMPlugin
- An instance of a specific SIM SIMPlugin.public double _maxPercentage()
public void reload()
public java.util.Map<java.lang.String,java.lang.Object> getMap()
{ "Latitude": 35.351669, //center to rotate on "Longitude": -80.682891, //center to rotate on "Resolution": 1.9, //meters per pixed @ 800x480 "MergePoint": 38.5, //percentage from finish line where you are safe to merge from pit road to the track "MaxPercentage": 100.0, //Normalize the percentage for distance according to this "DistanceUOM": "mile", //the unit of measure to show distance in "TempUOM": "F", //the unit of measure to show temperature in "SpeedUOM": "mph", //the unit of measure to show speed in "North": 166.0, //degrees to rotate map so north points in that direction "FinishLine": 270.0, //degrees to rotate the finish line, post rotation of the map. Initially zero degrees. "ONTRACK": { "0.0": { "Latitude": 29.18888888, "Longitude": -81.072 }, "0.1": { "Latitude": 29.18888888, "Longitude": -81.072 }, "0.2": { "Latitude": 29.18888888, "Longitude": -81.072 }, "0.3": { "Latitude": 29.18888888, "Longitude": -81.072 }, ... "100.0": { "Latitude": 29.18888888, "Longitude": -81.072 } }, "ONPITROAD": { "0.0": { "Latitude": 29.18888888, "Longitude": -81.072 }, "0.1": { "Latitude": 29.18888888, "Longitude": -81.072 }, "0.2": { "Latitude": 29.18888888, "Longitude": -81.072 }, "0.3": { "Latitude": 29.18888888, "Longitude": -81.072 }, ... "100.0": { "Latitude": 29.18888888, "Longitude": -81.072 } } }
Data
container..public double _getMergePoint(double relativeTo)
Some tracks, like Bristol, have multiple merge points because it has 2 pit lanes. So the relativeTo argument should be either your pit stall location or your current location if you are exiting the pits.
relativeTo
- The point, as a percentage, to use to find the next merge point after. Range 0.0 to 100.0.public Data getBearing(java.lang.String location, java.lang.Double percentage, java.lang.String UOM)
270 degrees is north, 0 is east, 90 is south and 180 is west.
If a SIM can return the exact bearing, then it should override this functions and return them. Otherwise, the percentage is used to approximate the position.
location
- (Optional), The location of where you want the percentage to apply to, ONTRACK, or ONPITROAD.
Defaults to ONTRACK.percentage
- (Optional), The percentage traveled from the start/finish line.
Range 0.0 to 100.0.
Defaults to 0.0.UOM
- (optional), The UOM to return the Latitude in.
Defaults to degrees.public Data getBearing(java.lang.String location, java.lang.String percentage, java.lang.String UOM)
public Data getBearing(java.lang.String location, java.lang.String percentage)
public Data getBearing(java.lang.String location)
public Data getBearing()
public Data getCategory()
Track.Category
PATH = /Track/Category
Data
container.public Data getCity()
PATH = /Track/City
Data
container.public Data getCondition()
PATH = /Track/Condition
Data
container.public Data getConfiguration()
PATH = /Track/Configuration
Data
container.public Data getCountry()
PATH = /Track/Country
Data
container.public Data getDescription()
PATH = /Track/Description
Data
container.public Data getFinishLineRotation(java.lang.String UOM)
UOM
- (Optional), The unit of measure to return, defaults to "deg".Data
container.public Data getFinishLineRotation()
public Data getImage(java.lang.String type)
The supported types are:
For example: com/SIMRacingApps/Tracks/charlotte_sat.png
PATH = /Track/Image/(type)
type
- The type of image, "sat" or "map". Defaults to "sat".Data
container.public Data getImage()
public Data getLatitude(java.lang.String location, java.lang.Double percentage, java.lang.String UOM)
If a SIM can return the exact coordinates, then it should override this functions and return them. Otherwise, the percentage is used to approximate the position.
location
- (Optional), The location of where you want the percentage to apply to, CENTER, ONTRACK, or ONPITROAD.
Defaults to CENTER.percentage
- (Optional), The percentage traveled from the start/finish line.
Range 0.0 to 100.0 or MaxPercentage.
Defaults to 0.0.UOM
- (optional), The UOM to return the Latitude in.
Defaults to degrees.public Data getLatitude(java.lang.String location, java.lang.String percentage, java.lang.String UOM)
public Data getLatitude(java.lang.String location, java.lang.String percentage)
public Data getLatitude(java.lang.String location)
public Data getLatitude()
public Data getLength(java.lang.String UOM)
PATH = /Track/Length/(UOM)
UOM
- (Optional), The UOM to return the track length in. Default to track's UOM, which is based on the country it's in.Data
container.public Data getLength()
public Data getLongitude(java.lang.String location, java.lang.Double percentage, java.lang.String UOM)
If a SIM can return the exact coordinates, then it should override this functions and return them. Otherwise, the percentage is used to approximate the position.
location
- (Optional), The location of where you want the percentage to apply to, CENTER, ONTRACK, or ONPITROAD.
Defaults to CENTER.percentage
- (Optional), The percentage traveled from the start/finish line.
Range 0.0 to 100.0 or MaxPercentage.
Defaults to 0.0.UOM
- (optional), The UOM to return the Longitude in.
Defaults to degrees.public Data getLongitude(java.lang.String location, java.lang.String percentage, java.lang.String UOM)
public Data getLongitude(java.lang.String location, java.lang.String percentage)
public Data getLongitude(java.lang.String location)
public Data getLongitude()
public Data getName()
For example: atlanta_qualoval
PATH = /Track/Name
Data
container.public Data getNorth(java.lang.String UOM)
PATH = /Track/North/(UOM)
UOM
- (Optional), The unit of measure to return the direction of north in, defaults to "deg".Data
container.public Data getNorth()
public Data getPath(java.lang.String location, java.lang.String UOM)
The results are returned in the following format. Type values are: -1.0 move to, 0.0 line to. NOTE: I use to use the close Type, but not all Start/Finish lines are at the same place on all tracks.
[ { "Type": -1.0, "Lat": 0.0, "Lon": 0.0 }, { "Type": 0.0, "Lat": 0.0, "Lon": 0.0 }, ]
PATH = /Track/Path
location
- (Optional) The location of the track to return the path to. Can be ONTRACK, ONPITROAD. Defaults to ONTRACK.UOM
- (Optional) The unit of measure to return the path in, default to the track's UOM.Data
container as ArrayList<Map<String,Double>>.public Data getPath(java.lang.String location)
public Data getPath()
public Data getPitSpeedLimit(java.lang.String UOM)
PATH = /Track/PitSpeedLimit/(UOM)
UOM
- (Optional) The unit of measure to return the speed limit in, default to the track's UOM.public Data getPitSpeedLimit()
public Data getResolution(java.lang.String UOM)
UOM
- (Optional) The unit of measure to return the resolution in, defaults to meters.Data
container.public Data getResolution()
public Data getSectors(java.lang.String sectorType, java.lang.String UOM)
sectorType
- (optional) Indicates the type of the values being returned. Valid values are Track.SectorType
, PERCENTAGE, COORDINATES. Defaults PERCENTAGE.UOM
- (optional) Specifies the unit of measure to return. %, RAD, DEG. Default is % and DEG.Data
container.public Data getSectors(java.lang.String sectorType)
public Data getSectors()
public Data getTemp(java.lang.String UOM)
PATH = /Track/Temp/(UOM)
UOM
- (Optional) The unit of measure to convert the temperature in, default to track's UOM.Data
container.public Data getTemp()
public Data getTimeZone()
Data
container.public Data getType()
Track.Type
PATH = /Track/Type
Data
container.public Data getWeatherFogLevel()
PATH = /Track/WeatherFogLevel
Data
container.public Data getWeatherRelativeHumidity()
Data
container.public Data getWeatherSkies()
PATH = /Track/WeatherSkies
Data
container.public Data getWeatherTemp(java.lang.String UOM)
PATH = /Track/WeatherTemp/(UOM)
UOM
- (Optional) The unit of measure to convert the temperature in, default to track's UOM.Data
container.public Data getWeatherTemp()
public Data getWeatherWindDirection(java.lang.String UOM)
UOM
- (Optional) The unit of measure to return the wind direction in, defaults to "deg".Data
container.public Data getWeatherWindDirection()
public Data getWeatherWindSpeed(java.lang.String UOM)
UOM
- (Optional) The unit of measure to return the wind speed in, defaults to track's UOM for Pit Road Speed.Data
container.public Data getWeatherWindSpeed()