From 28213a7b0a00eec4c63990cd00d1426de8a12fb5 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Tue, 25 Jun 2024 14:03:59 -0400 Subject: [PATCH 1/2] Add GPS location plugin --- coreplugins/gpslocation/__init__.py | 1 + coreplugins/gpslocation/disabled | 0 coreplugins/gpslocation/manifest.json | 13 +++++++++++++ coreplugins/gpslocation/plugin.py | 5 +++++ coreplugins/gpslocation/public/main.js | 21 +++++++++++++++++++++ coreplugins/gpslocation/public/package.json | 14 ++++++++++++++ 6 files changed, 54 insertions(+) create mode 100644 coreplugins/gpslocation/__init__.py create mode 100644 coreplugins/gpslocation/disabled create mode 100644 coreplugins/gpslocation/manifest.json create mode 100644 coreplugins/gpslocation/plugin.py create mode 100644 coreplugins/gpslocation/public/main.js create mode 100644 coreplugins/gpslocation/public/package.json 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" + } +} From 62a6047f11098c1cea5a24e4863ab65be2bac099 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Tue, 25 Jun 2024 14:35:13 -0400 Subject: [PATCH 2/2] Use pip 24.0 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 027a3207a..2f63c0cda 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,7 +26,7 @@ RUN apt-get -qq update && apt-get -o Acquire::Retries=3 -qq install -y --no-inst apt-get -o Acquire::Retries=3 -qq update && apt-get -o Acquire::Retries=3 -qq install -y --no-install-recommends python3 python3-pip python3-setuptools python3-wheel git g++ python3-dev python2.7-dev libpq-dev binutils libproj-dev gdal-bin pdal libgdal-dev python3-gdal nginx certbot gettext-base cron postgresql-client-13 gettext tzdata && \ update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1 && update-alternatives --install /usr/bin/python python /usr/bin/python3.9 2 && \ # Install pip reqs - pip install -U pip && pip install -r requirements.txt "boto3==1.14.14" && \ + pip install pip==24.0 && pip install -r requirements.txt "boto3==1.14.14" && \ # Setup cron ln -s /webodm/nginx/crontab /var/spool/cron/crontabs/root && chmod 0644 /webodm/nginx/crontab && service cron start && chmod +x /webodm/nginx/letsencrypt-autogen.sh && \ /webodm/nodeodm/setup.sh && /webodm/nodeodm/cleanup.sh && cd /webodm && \