vitalidze / traccar-web

Traccar Web UI mod
http://traccar.litvak.su/
152 stars 145 forks source link

getting google link #1228

Open kelvintaku opened 5 years ago

kelvintaku commented 5 years ago

Hello guys, Actually im using this client mod and im trying to add a feature that when i open the ContextMenu for a device, it displays an option that links to the device's google maps for its last position. Ive managed to add the MenuItem on the context menu but haven't figured out how to get device's google map link and put it on the onSelection command. If anyone can help me, i would really appreciate it

vitalidze commented 5 years ago

The device itself does not have the latest positions. But it can be obtained through the map controller, see for example the following method in the DeviceController:

    public void onMouseOver(int mouseX, int mouseY, Device device) {
        Position latestPosition = mapController.getLatestPosition(device);
        if (latestPosition != null) {
            positionInfo.show(mouseX, mouseY, latestPosition);
        }
    }