Current trip index.
All vehicle individual trips or sections already traveled or left to travel.
Vehicle's initial heading angle.
If vehicle is moving.
Trip start datetime.
All vehicle individual trips or sections left to travel.
Adds a next step in the trip.
Next position.
Speed in km/h.
Fetches the current vehicle position in time.
Current vehicle position.
Gets the vehicle frame on a particular timeStamp.
Fetch the vehicle's distance left to travel in meters.
Fetch the vehicle GeoJson feature. The vehicle full path.
GeoJson feature.
Get the vehicle's destination position.
Destination position.
Returns the position the vehicle should be in a given time.
Timestamp to get the vehicle position from.
position and heading of the vehicle.
Adds vehicle to a map instance.
Map instance.
Generated using TypeDoc
The Vehicle class defines a vehicle to be put on a map. It stores the model information, trips and other position information.
const pos = new google.maps.LatLng(20.65273901635008, -103.44528316226638) const id = "uniqueId" const orientation = 120 const model = new Mapster.Model( 'red', 'https://stsiliantstaticdev.blob.core.windows.net/map-3d-models/taxi.glb', 10, 7, 100, 2) const vehicle = new Mapster.Vehicle(id, pos, orientation, model, { anotherProperty: 1 }) // Add vehicle to map. See more about adding vehicles to the map on the map documentation. vehicle.setMap(map); map.addVehicle(vehicle); map.setVehicles([vehicle]) // Add positions to trip queue const goToPosition = new google.maps.LatLng(20.693668019183118, -103.35969321162369) vehicle.addPosition(goToPosition) // Get position in current timestamp. const currentPosition = vehicle.getCurrentPosition() console.log(currentPosition) // Get if vehicle is moving or not. console.log(vehicle.isMoving) // Get last position of last trip. const lastPosition = vehicle.getLastPosition() console.log(lastPosition)