Custom Marker for different Squawks

Are you having problems with using or developing a plugin? Let me know here.
Post Reply
ETEJRadar
Posts: 11
Joined: Fri Aug 10, 2018 11:13 am

Custom Marker for different Squawks

Post by ETEJRadar »

I want to have a red marker if an aircraft squawk 7700, 7600 or 7500. To test if my code works I used this (there are a few other marker codes in that file so don't worry about the start and the ending of it :):

VRS.globalOptions.aircraftMarkers.unshift(
new VRS.AircraftMarker({
normalFileName: 'MIL-WTC-Medium-2-Jet-Squawk.png',
selectedFileName: 'M-WTC-Medium-2-Jet-Selected.png',
size: { width: 40, height: 40 },
matches: function(aircraft) { return aircraft.Squawk.val === '1000' }
}));
If I use return aircraft.Squawk.val === '1000' it doesn't work. It won't even show any other planes on my map. Does anyone have a solution for squawk based markers?
agw
Posts: 2250
Joined: Fri Feb 17, 2012 3:20 am

Re: Custom Marker for different Squawks

Post by agw »

JavaScript is case sensitive. You used the field name aircraft.Squawk, which doesn't exist. I think if you check the console tab on the F12 screen in the browser you'll probably see an error saying as much?

The actual name is squawk with a lower-case S, e.g.

Code: Select all

return aircraft.squawk.val === '1000' 
ETEJRadar
Posts: 11
Joined: Fri Aug 10, 2018 11:13 am

Re: Custom Marker for different Squawks

Post by ETEJRadar »

Thank you awg it worked.
Post Reply