diff --git a/coreplugins/gpslocation/__init__.py b/coreplugins/gpslocation/__init__.py new file mode 100644 index 000000000..48aad58ec --- /dev/null +++ b/coreplugins/gpslocation/__init__.py @@ -0,0 +1 @@ +from .plugin import * diff --git a/coreplugins/gpslocation/disabled b/coreplugins/gpslocation/disabled new file mode 100644 index 000000000..e69de29bb diff --git a/coreplugins/gpslocation/manifest.json b/coreplugins/gpslocation/manifest.json new file mode 100644 index 000000000..1280ea134 --- /dev/null +++ b/coreplugins/gpslocation/manifest.json @@ -0,0 +1,13 @@ +{ + "name": "GPS Location", + "webodmMinVersion": "0.5.0", + "description": "Add a GPS location button to the 2D map view", + "version": "1.0.0", + "author": "Piero Toffanin", + "email": "pt@masseranolabs.com", + "repository": "https://github.com/OpenDroneMap/WebODM", + "tags": ["gps", "location"], + "homepage": "https://github.com/OpenDroneMap/WebODM", + "experimental": false, + "deprecated": false +} \ No newline at end of file diff --git a/coreplugins/gpslocation/plugin.py b/coreplugins/gpslocation/plugin.py new file mode 100644 index 000000000..c1b41325f --- /dev/null +++ b/coreplugins/gpslocation/plugin.py @@ -0,0 +1,5 @@ +from app.plugins import PluginBase + +class Plugin(PluginBase): + def include_js_files(self): + return ['main.js'] diff --git a/coreplugins/gpslocation/public/main.js b/coreplugins/gpslocation/public/main.js new file mode 100644 index 000000000..08b78bfbd --- /dev/null +++ b/coreplugins/gpslocation/public/main.js @@ -0,0 +1,21 @@ +PluginsAPI.Map.willAddControls([ + 'gpslocation/node_modules/leaflet.locatecontrol/dist/L.Control.Locate.min.js', + 'gpslocation/node_modules/leaflet.locatecontrol/dist/L.Control.Locate.min.css' + ], function(args, _){ + + // TODO: how to specify consistent plugin render ordering? + // we use a timeout to make sure this button is rendered last + // but a better method is warranted + setTimeout(function(){ + L.control.locate({ + position: 'bottomleft', + showPopup: false, + locateOptions: { + enableHighAccuracy: true + }, + strings: { + title: "Show My Location" + } + }).addTo(args.map); + }, 150); +}); diff --git a/coreplugins/gpslocation/public/package.json b/coreplugins/gpslocation/public/package.json new file mode 100644 index 000000000..54e51cfad --- /dev/null +++ b/coreplugins/gpslocation/public/package.json @@ -0,0 +1,14 @@ +{ + "name": "gpslocation", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "leaflet.locatecontrol": "^0.81.1" + } +}