chumb
Posts: 72
Joined: Wed Oct 26, 2005 3:32 pm
Location: Portugal

Vehicle selected or "active"

Wed Mar 19, 2008 8:27 pm

Hello!

Is there any variable holding the ID (owner_id) of the currently "selected" or "active" vehicle in VehicleTracker?

Another question: if we have our own code to add overlays, where would be a good place to add a call to our code, in order to force an automatic refresh of overlays whenever a new position is received for the "active" vehicle?

Thanks,

Rogério

altf4
Posts: 1035
Joined: Mon Feb 04, 2008 8:05 pm
Location: Thailand
Contact: Website

RE: Vehicle selected or "active"

Wed Mar 19, 2008 8:50 pm

the selected user is avaiable as username .. in the template variable $Username (but so far as i know not i the whole file.
(well iam not so good in asp ;-)

the thing about the overlays would be interesting for me too ... as i do overlay customerbased POI's
but in another language .. so i canot really read the sessiondate to get the application_id ...

the layer is loaded by the map-scripts .. and this are static-javascript elements.
if the js calls another file it canot this easy refer back to the sessiondata (i do this for now by getting IPadresses, but thats pretty poor code and will make sooner or later some trouble)



--
Backups are for WIMPS!

User avatar
Fredrik
Posts: 1155
Joined: Fri Mar 02, 2007 1:04 pm
Location: Sweden
Contact: Website

RE: Vehicle selected or "active"

Wed Mar 19, 2008 10:18 pm

Originally posted by chumb

Hello!

Is there any variable holding the ID (owner_id) of the currently "selected" or "active" vehicle in VehicleTracker?You can reach the currently active vehicle as

Code: Select all

vtMain.vTracker.getActiveVehicle()
Another question: if we have our own code to add overlays, where would be a good place to add a call to our code, in order to force an automatic refresh of overlays whenever a new position is received for the "active" vehicle?

Thanks,

Rogério
vTracker exposes an event called 'onpositionupdated' that is intended for this purpose. See vehicletrackermain.js, aprox line 330, for an example of how to use it.

I'd recommend that you place your code in a separate file and then hook to this event after vtMain.start() has been called (see page_load in VehicleTracker.aspx). (If you edit the original source-code your changes won't be available when running using compressed scripts, and you'd have to do more patching when new versions are released)

Regards,
Fredrik

Franson Support

chumb
Posts: 72
Joined: Wed Oct 26, 2005 3:32 pm
Location: Portugal

RE: Vehicle selected or "active"

Thu Mar 20, 2008 1:39 am

Thank you both for the information.

Regards,

Rogério

Return to “GpsGate Server - How to setup and use”