vehicleData Property

Description

The vehicleData property allows you to pass detailed information about the vehicles involved in an incident into the diagram editor. The editor then makes special vehicle symbols available to the user under "Incident Vehicles" when the Symbols layer is selected. The user can drag and drop these vehicle symbols into the diagram.

The value of property is an object of the form:

{
	"decodeVINs": true|false, //note: the decodeVINs flag is deprecated.
	"vehicles": [<vehicle data object>, ...]
}
	        

Vehicle data objects are of the form:

{
	"label": "<vehicle label",
	"data": [<vehicle data field object, ...]
}
	    	
When the property decodeVins is true, the VIN numbers in the data for each vehicle will be decoded. Note that this functionality has been deprecated and will be removed in a future release. Instead, use the lookupVINs method as shown in Example 1.

Vehicle data field objects are of the form:

{
	"name": "<field name>",
	"value": "<field value>",
	"show": true|false
}
		
The field names "VIN", "Type", "TypeId", "Year", "Make", "Model", and "Color" in vehicle data objects have special meaning.

When the field "VIN" is present in vehicle data objects, the method lookupVINs can be used to decode this field and to populate the fields "Type", "Year", "Make", "Model", and "TypeId". This is typically done before setting the vehicleData property as illustrated in Example 1.

If the field "TypeId" is present, the editor will attempt to use its value to determine the symbol representing the vehicle using this table:
		   TypeId	Symbol			NHTSA Body Type Description

			'1': 'Sports_Car',		//	Convertible/Cabriolet
			'2': 'Minivan',			//	Minivan
			'3': 'Sports_Car',		//	Coupe
			'4': 'Golf_Cart_2',		//	Low Speed Vehicle (LSV) / Neighborhood Electric Vehicle (NEV)
			'5': 'Midsize_2',		//	Hatchback/Liftback/Notchback
			'6': 'Motorcycle',		//	Motorcycle - Standard
			'7': 'SUV_3',			//	Sport Utility Vehicle (SUV)/Multi-Purpose Vehicle (MPV)
			'8': 'SUV',				//	Crossover Utility Vehicle (CUV)
			'9': 'Van',				//	Van
			'10': 'Sports_Car_2',	//	Roadster
			'11': 'Box_Van_14ft',	//	Truck
			'12': 'Motorcycle',		//	Motorcycle - Scooter
			'13': 'Large_Sedan',	//	Sedan/Saloon
			'15': 'SUV_3',			//	Wagon
			'16': 'Bus_16ft',		//	Bus
			'60': 'Pickup',			//	Pickup
			'61': 'RV_Trailer_1',	//	Trailer
			'62': 'Delivery_Van',	//	Incomplete - Cutaway
			'63': 'Pickup',			//	Incomplete - Chassis Cab (Single Cab)
			'64': 'Tractor_LN',		//	Incomplete - Glider
			'65': 'Vehicle_Label',	//	Incomplete
			'66': 'Tractor_LN',		//	Truck-Tractor
			'67': 'Vehicle_Label',	//	Incomplete - Stripped Chassis
			'68': 'Vehicle_Label',	//	Streetcar / Trolley
			'69': 'Four_Wheeler',	//	Off-road Vehicle - All Terrain Vehicle (ATV) (Motorcycle-style)
			'70': 'Tractor_CO',		//	Incomplete - Chassis Cab (Double Cab)
			'71': 'School_Bus',		//	Incomplete - School Bus Chassis
			'72': 'Bus_40ft',		//	Incomplete - Commercial Bus Chassis
			'73': 'School_Bus',		//	Bus - School Bus
			'74': 'Bus_40ft',		//	Incomplete - Chassis Cab (Number of Cab Unknown)
			'75': 'Metro_Bus',		//	Incomplete - Transit Bus Chassis
			'76': 'Metro_Bus',		//	Incomplete - Motor Coach Chassis
			'77': 'Bus_16ft',		//	Incomplete - Shuttle Bus Chassis
			'78': 'Motorhome_2',	//	Incomplete - Motor Home Chassis
			'80': 'Motorcycle',		//	Motorcycle - Sport
			'81': 'Motorcycle',		//	Motorcycle - Touring / Sport Touring
			'82': 'Motorcycle',		//	Motorcycle - Cruiser
			'83': 'Motorcycle',		//	Motorcycle - Trike
			'84': 'Motorcycle_2',	//	Off-road Vehicle - Dirt Bike / Off-Road
			'85': 'Motorcycle_2',	//	Motorcycle - Dual Sport / Adventure / Supermoto / On/Off-road
			'86': 'Motorcycle_2',	//	Off-road Vehicle - Enduro (Off-road long distance racing)
			'87': 'Motorcycle_2',	//	Motorcycle - Small / Minibike
			'88': 'Vehicle_Label',	//	Off-road Vehicle - Go Kart
			'90': 'Vehicle_Label',	//	Motorcycle - Side Car
			'94': 'Motorcycle',		//	Motorcycle - Custom
			'95': 'Van',			//	Cargo Van
			'97': 'Snowmobile',		//	Off-road Vehicle - Snowmobile
			'98': 'Motorcycle',		//	Motorcycle - Street
			'100': 'Motorcycle',	//	Motorcycle - Enclosed Three Wheeled / Enclosed Autocycle
			'103': 'Motorcycle',	//	Motorcycle - Unenclosed Three Wheeled / Open Autocycle
			'104': 'Motorcycle_2',	//	Motorcycle - Moped
			'105': 'ATV_2Seater',	//	Off-road Vehicle - Recreational Off-Road Vehicle (ROV)
			'107': 'Bus_40ft',		//	Incomplete - Bus Chassis
			'108': 'Motorhome_2',	//	Motorhome
			'109': 'Motorcycle',	//	Motorcycle - Cross Country
			'110': 'Motorcycle',	//	Motorcycle - Underbone
			'111': 'Delivery_Van',	//	Step Van / Walk-in Van
			'112': 'Vehicle_Label',	//	Incomplete - Commercial Chassis
			'113': 'Motorcycle_2',	//	Off-road Vehicle - Motocross (Off-road short distance, closed track racing)
			'114': 'Motorcycle',	//	Motorcycle - Competition
			'116': 'RV_Trailer_1',	//	Incomplete - Trailer Chassis
			'117': 'Limousine',		//	Limousine
			'119': 'SUV_3',			//	Sport Utility Truck (SUT)
			'124': 'Golf_Cart_2',	//	Off-road Vehicle - Golf Cart
			'125': 'Motorcycle',	//	Motorcycle - Unknown Body Class
			'126': 'Farm_Tractor',	//	Off-road Vehicle - Farm Equipment
			'127': 'Backhoe_Loader',//	Off-road Vehicle - Construction Equipment
			'128': 'Ambulance_001',	//	Ambulance
			'129': 'Street_Sweeper',//	Street Sweeper
			'130': 'Fire_Truck'		//	Fire Apparatus
		


If the field "Type" is present, the editor will attempt to use its value to determine the symbol representing the vehicle. Note that this behavior is deprecated and may be removed in future releases.

If the field "Color" is present, the editor will attempt to use its value to determine the color of the symbol representing the vehicle. Valid values for the field "Color" include:
"white"
"black"
"gray"
"grey"
"silver"
"red"
"blue"
"brown"
"green"
"beige"
"orange"
"gold"
"yellow"
"purple"
			
Color values are case insensitive.

The property "show" specifies whether the field should be shown by default in the diagram. Field names and values can be shown in special callouts attached to vehicle symbols. Field values can also be included in the label of a vehicle symbol.

The property label and data field "VIN" determine the label of a vehicle symbol. If the property label is specified, it is used as the symbol's label. If it is empty, the value of the data field "VIN" is used as the vehicle's label. If neither are specified, the label will be "Unknown Vehicle".

Setting the property to undefined will remove all special incident vehicle symbols.

Use set method of the editor to set this property as illustrated below.

Example 1 - Vehicle Data with VIN Decoding

editor = new window.__editor(undefined, document.getElementById('editor-node'));

editor.startup(...):

// Set sample case-specific vehicles with VIN decoding.
editor.lookupVINs({
	vehicles: [
		{ "label": "Unit 1", "data": [
			{name: "VIN", value: "1G1YW2DW0A1JB9MJ9", show: true},
			{name: "Color", value: "green", show: false}
		]},
		{ "label": "Unit 2", "data": [
			{name: "VIN", value: "JN1BZ36D69L7HLX6H", show: true},
			{name: "Color", value: "silver", show: false}
		]},
		{ "label": "Unit 3",  "data": [
			{name: "VIN", value: "4S6CK58W12U4HNUEM", show: true},
			{name: "Color", value: "black", show: false}
		]}
	]
}, function(result) { editor.set("vehicleData", result);},
function(err) { console.log(err);});
        

Example 2 - Vehicle Data without VIN Decoding

editor = new window.__editor(undefined, document.getElementById('editor-node'));

editor.startup(...):

// Set sample case-specific vehicles without VIN decoding.
editor.set('vehicleData', {
	vehicles: [
		{ "label": "Red Ford", "data": [
			{name: "Type", value: "other", show: false},
			{name: "Make", value: "Ford", show: true},
			{name: "Model", value: "Fusion", show: true},
			{name: "Color", value: "red", show: false},
			{name: "License State", value: "", show: false},
			{name: "License Number", value: "", show: false}
		]},
		{ "label": "Green Corvette", "data": [
			{name: "VIN", value: "1G1YW2DW0A1JB9MJ9", show: false},
			{name: "Type", value: "Coupe", show: false},
			{name: "TypeId", value: "3", show: false},
			{name: "Year", value: "2021", show: true},
			{name: "Make", value: "Ford", show: true},
			{name: "Model", value: "Mustang", show: true},
			{name: "Color", value: "green", show: false},
			{name: "License State", value: "", show: false},
			{name: "License Number", value: "", show: false}
		]},
		{ "label": "Silver 350Z",  "data": [
			{name: "VIN", value: "JN1BZ36D69L7HLX6H", show: false},
			{name: "Type", value: "Convertible", show: false},
			{name: "TypeId", value: "2", show: false},
			{name: "Year", value: "1994", show: true},
			{name: "Make", value: "Nissan", show: true},
			{name: "Model", value: "350Z", show: true},
			{name: "Color", value: "silver", show: false},
			{name: "License State", value: "", show: false},
			{name: "License Number", value: "", show: false}
		]},
		{ "label": "Black Honda",  "data": [
			{name: "VIN", value: "4S6CK58W12U4HNUEM", show: false},
			{name: "Type", value: "Sport Utility Vehicle", show: false},
			{name: "TypeId", value: "5", show: false},
			{name: "Year", value: "2018", show: true},
			{name: "Make", value: "Honda", show: true},
			{name: "Model", value: "unknown", show: true},
			{name: "Color", value: "black", show: false},
			{name: "License State", value: "", show: false},
			{name: "License Number", value: "", show: false}
		]}
	]
});