change pin color dynamically

hello, I need to manage my fleet in an unusual way, I have a main geozones with a predefined color for proper management, I thought about setting a pin based on the geozone color when it exits one, that is: Vehicle (pin red) -> left the geozone (blue color) automatically the vehicle pin changes to blue, I know that I must save in a field the color of the pin that I want to use and update this field when a team enters or leaves said geozone, but honestly I do not know where to start since I have no knowledge about the code and the structure of the project, could you guide me on how to achieve it or a clue where to start?

Anton Tananaev4 years ago

Check MapMarkerController class. That's a good starting point. From there you should be able to figure out how it all works.

hi, thanks for answering my help, I just read and understand well the class and the necessary functions to modify the marker of the color you need with the functions, getDeviceColor: function, updateDevice: function, now I need to know where to look to save the color of the geozone where the vehicle is and then send the color through the api and these functions consume the color transmitted by the api.

another query, MakMarkerController is fixed in the Traccar-web project is this based on the new view or is it the old view that comes from the Traccar-server project?

Anton Tananaev4 years ago

That repository contains both, but this class specifically is a part of the old web app.

hello, I have managed to make the desired changes and it works without problem, now I try to compile the project to upload it to my VPS but I get the following compilation message "Could not target platform: 'Java SE 11' using tool chain: 'JDK 8 ( 1.8) '. " I am using Intellij idea. I have changed everything to be compatible but I get the same error, any idea what I should be doing wrong or what should I change?

Anton Tananaev4 years ago

How do you compile it in Intellij? You need to compile web app.

I meant that I am using the IDE, I am compiling as the guide indicates Traccar Build with "./gradlew assemble" I am trying to compile traccar-server

Anton Tananaev4 years ago

That command is for compiling the back-end. Still don't understand how it's related to the web app.

I am not trying to compile traccar-web, I am trying to compile traccar-server, I made some changes in traccar server to keep the color attribute on the pin permanently, because of that I had to modify some classes in java, such as " GeofenceEventHandler.java "among others more

Anton Tananaev4 years ago

How is it related to the topic then?

ok, I have created another entry consulting about the compilation of traccar-server