Compare commits

...

532 Commits

Author SHA1 Message Date
Eric van der Vlist c1d070c504 npm-check-updates 2023-10-07 18:21:58 +02:00
Eric van der Vlist 2b19746bb2 Displaying a cycle icon when GPX locomotion tag is cycling 2023-08-07 18:56:28 +02:00
Eric van der Vlist f3ae5cfcf4 Saving edited tags in GpxDialog 2023-08-07 18:13:43 +02:00
Eric van der Vlist 70b431a1c5 npm updates 2023-08-07 17:59:56 +02:00
Eric van der Vlist 2d73315a9a Adding GPX tags extension 2023-08-06 18:06:54 +02:00
Eric van der Vlist a9e2855e3f npm updates 2023-08-05 18:08:14 +02:00
Eric van der Vlist 2793db6f1e Filtering out tracks, routes and waypoints 2023-08-05 18:05:41 +02:00
Eric van der Vlist b025c74d99 Displaying only the current GPX if required 2023-08-05 17:38:08 +02:00
Eric van der Vlist a297c1ec29 typo 2023-08-04 18:50:47 +02:00
Eric van der Vlist 877b0f892d Implementing a selection mechanism to define what should be drawn: GPX all/none 2023-08-03 22:09:25 +02:00
Eric van der Vlist 68d1f8140a Starting to implement a selection mechanism to define what should be drawn 2023-08-03 18:46:08 +02:00
Eric van der Vlist b9c2cf3448 regression 2023-08-03 16:16:24 +02:00
Eric van der Vlist 15e52d39d9 npm updates 2023-08-03 15:04:56 +02:00
Eric van der Vlist 132455c33a npm updates 2023-07-12 15:21:51 +02:00
Eric van der Vlist 3638103034 npm updates 2023-07-08 10:54:18 +02:00
Eric van der Vlist 435149d718 Activities and categories, WIP 2023-07-08 10:52:02 +02:00
Eric van der Vlist 03666ff605 Cosmetics (typescript) 2023-06-13 11:13:08 +02:00
Eric van der Vlist 1d9d38c437 Cosmetics (typescript) 2023-06-13 11:04:45 +02:00
Eric van der Vlist 7caf088a7e Cosmetics (typescript) 2023-06-13 11:03:02 +02:00
Eric van der Vlist 787323bcac Cosmetics 2023-06-13 10:52:52 +02:00
Eric van der Vlist 0ae8b68255 Adding a level in tag definitions to support routes (in addition to POIs) 2023-06-12 18:26:53 +02:00
Eric van der Vlist db85c8ff69 File rename 2023-06-12 16:35:50 +02:00
Eric van der Vlist 3fba5b0529 Implementing the OSM tag format definitions library 2023-06-12 16:29:17 +02:00
Eric van der Vlist 3f56cf9c23 Starting to implement a proper library for OSM tags 2023-06-12 15:51:05 +02:00
Eric van der Vlist a4e975dbeb npm updates 2023-06-12 11:57:25 +02:00
Eric van der Vlist 28271da640 Moving stuff around so that helper.ts works again 2023-06-09 18:15:02 +02:00
Eric van der Vlist ba09d5ef50 Cleanup (unused imports) 2023-06-09 17:03:35 +02:00
Eric van der Vlist 861717ee18 Cleanup 2023-06-09 16:59:53 +02:00
Eric van der Vlist 64b01bd7a5 Regression fix 2023-06-09 15:56:12 +02:00
Eric van der Vlist c2705def86 Refactoring osm tags (wip) 2023-06-09 15:49:50 +02:00
Eric van der Vlist 29f92dca10 Refactoring osm tags (wip) 2023-06-09 15:23:08 +02:00
Eric van der Vlist 92fb5f7bac Redesigning overlay definitions 2023-06-09 12:21:11 +02:00
Eric van der Vlist fc09fdf358 npm updates 2023-06-09 11:05:07 +02:00
Eric van der Vlist 6943424d34 Cleanup (removing getAllPoiTypes which was used only once) 2023-06-07 10:23:02 +02:00
Eric van der Vlist 7cb02012c0 Preparing a refactoring for overlay definitions 2023-06-06 16:03:14 +02:00
Eric van der Vlist 00fdc5577c Minor update in overlay-definitions 2023-06-06 15:15:10 +02:00
Eric van der Vlist 2bd23ac785 One timer helper to change the structure ofoverlay definitions 2023-06-05 11:17:01 +02:00
Eric van der Vlist ce6a112d77 npm updates 2023-06-02 15:34:48 +02:00
Eric van der Vlist f8ef752d09 npm updates 2023-05-31 17:12:31 +02:00
Eric van der Vlist 4b4901743b Adding new icons 2023-05-26 18:32:57 +02:00
Eric van der Vlist 988e3df1ee Require POST_NOTIFICATIONS permission (Android 13) 2023-05-26 18:04:08 +02:00
Eric van der Vlist ed5fbd7e13 npm updates 2023-05-26 17:20:45 +02:00
Eric van der Vlist 716013d605 Adding overlay definitions 2023-05-16 21:46:00 +02:00
Eric van der Vlist 2295991f23 Bug fix to support more overlay definitions 2023-05-16 19:29:00 +02:00
Eric van der Vlist c8367450d6 npm updates 2023-05-16 18:34:41 +02:00
Eric van der Vlist 713080a73b npm updates 2023-05-13 11:38:06 +02:00
Eric van der Vlist bce59f9781 npm updates 2023-05-12 18:18:20 +02:00
Eric van der Vlist cde6012227 npm updates 2023-05-09 10:10:55 +02:00
Eric van der Vlist 790a692529 Averaging heights 2023-05-09 09:59:10 +02:00
Eric van der Vlist 99daeefa98 Display delta heigth stats for trkseg 2023-05-09 09:40:42 +02:00
Eric van der Vlist 73172812f5 npm updates 2023-05-03 18:40:43 +02:00
Eric van der Vlist 4397dfc9f8 npm update 2023-04-24 16:30:11 +02:00
Eric van der Vlist dd32763895 npm install blob-util 2023-04-24 16:27:55 +02:00
Eric van der Vlist 9beb1eb1a3 Displaying thumbnails on the map 2023-04-24 15:26:03 +02:00
Eric van der Vlist e08d6993c1 Displaying WPT thumbnails 2023-04-24 15:03:34 +02:00
Eric van der Vlist 014e58a31b Calling WptEditDialog to import pictures as wpts 2023-04-23 18:06:10 +02:00
Eric van der Vlist a84b813066 npm update 2023-04-23 16:59:53 +02:00
Eric van der Vlist 65abffb5d9 Adding more properties to picture imports 2023-04-22 21:17:43 +02:00
Eric van der Vlist 06b2c60a4a Resize refactoring to create downsized image and thumbnails in one run 2023-04-22 18:04:20 +02:00
Eric van der Vlist 3ca64ad7eb Avoiding raising errors when there is no elevation in exif data 2023-04-21 21:28:09 +02:00
Eric van der Vlist e634d13ee5 Imageresizing using a canvas 2023-04-21 21:23:32 +02:00
Eric van der Vlist a91230f614 Attempt to scale using a canvas element 2023-04-21 18:53:38 +02:00
Eric van der Vlist 4df529abb7 Extracting GPS coordinates from exif 2023-04-20 17:50:30 +02:00
Eric van der Vlist d44f9a257e Using piexifjs to support exif (it(s yhe only one that can write exif data) and nothing to reisze images (WIP) 2023-04-20 15:18:32 +02:00
Eric van der Vlist 99410d7ebd npm updates 2023-04-20 10:52:55 +02:00
Eric van der Vlist ee980f219b Using image-js to generate images thumbnails (doesn't work well because of the lack of advanced interpolation methods in the current version) 2023-04-18 17:45:48 +02:00
Eric van der Vlist 15984a0d5d Adding a dragenter handler 2023-04-18 17:44:35 +02:00
Eric van der Vlist 35a03dcfc9 npm i image-js 2023-04-18 10:41:58 +02:00
Eric van der Vlist d3c0cfd393 Refactoring intent receivers for gmap links 2023-04-17 15:09:08 +02:00
Eric van der Vlist f9517b07b4 Refactoring intent receivers for web links 2023-04-17 15:02:46 +02:00
Eric van der Vlist c3c93139ed Refactoring intent receivers for geo: locations 2023-04-17 14:57:08 +02:00
Eric van der Vlist d5a8118c2a Refactoring intent receivers for invitations 2023-04-17 14:45:04 +02:00
Eric van der Vlist f82181347c Begining to refactor intent receivers to support GPX imports from more sources 2023-04-17 10:41:30 +02:00
Eric van der Vlist 8242680137 Accepting mimeType file/* (sic) to support wikiloc exports 2023-04-17 09:30:02 +02:00
Eric van der Vlist f17cc2e073 Adding a button to force importing tracks as routes 2023-04-15 20:24:35 +02:00
Eric van der Vlist 856cd7637e Making sure gpx id is 'new' when importing a GPX as a new journey 2023-04-15 18:25:27 +02:00
Eric van der Vlist b38fdf49ad Check db url before attempting to get a user id. 2023-04-15 17:29:50 +02:00
Eric van der Vlist 09e82600aa Do not restrict import file types on Android since it just doesn't work :( ... 2023-04-15 17:29:09 +02:00
Eric van der Vlist 5640cf8755 Bug regression caused by suid updates 2023-04-15 12:18:46 +02:00
Eric van der Vlist 91ef0239c9 npm updates 2023-04-15 11:55:52 +02:00
Eric van der Vlist 59f266de37 Displaying thumbnails 2023-04-04 19:33:22 +02:00
Eric van der Vlist 5333e8053b Extracting interesting stuff from exif 2023-04-04 19:17:44 +02:00
Eric van der Vlist f52191966c Reading exif tags 2023-04-04 15:25:53 +02:00
Eric van der Vlist 854a9d701a Fixing css issue with updater's alert 2023-04-04 15:03:44 +02:00
Eric van der Vlist f5e9657842 Refactoring to prepare jpg imports 2023-04-03 14:46:41 +02:00
Eric van der Vlist 9863efc26a Refactoring to prepare jpg imports 2023-04-03 14:39:55 +02:00
Eric van der Vlist 20bb1387fc Intent to receive Google maps share actions 2023-04-02 20:23:18 +02:00
Eric van der Vlist 60ca62bf09 Support for searching pluscodes (extended when required relative to the map center) 2023-04-02 16:06:38 +02:00
Eric van der Vlist b547e203a6 Pluscode npm package plus a utility function to test if a string may be a pluscode 2023-04-02 12:35:53 +02:00
Eric van der Vlist 519d671761 npm updates 2023-04-02 11:36:59 +02:00
Eric van der Vlist f6b5b97063 npm updates 2023-03-21 18:46:59 +01:00
Eric van der Vlist 41c81fca1b Adding file drop capability to import GPX files. 2023-03-17 19:57:22 +01:00
Eric van der Vlist 9b9bba1609 Trying to improve trkseg styles 2023-03-16 22:16:16 +01:00
Eric van der Vlist c9d231251f Looking how to import images 2023-03-16 21:41:51 +01:00
Eric van der Vlist 39876031e4 Setting a higher z-index for GPX layers 2023-03-16 21:41:29 +01:00
Eric van der Vlist e406590c59 Installing exifreader 2023-03-13 19:52:50 +01:00
Eric van der Vlist 7a2752e286 Declutter all wpt types (including notes) 2023-03-13 17:35:49 +01:00
Eric van der Vlist 9588ca7749 Regression that prevented initial configuration 2023-03-13 13:19:43 +01:00
Eric van der Vlist 95cfa8c8d7 Adding a click to copy feature in SystemInfo 2023-03-11 19:08:52 +01:00
Eric van der Vlist ef909b475b Adding a self test to check that web workers are supported 2023-03-11 18:35:14 +01:00
Eric van der Vlist ba14181bdd Adding a test for undefined addresses 2023-03-10 23:36:45 +01:00
Eric van der Vlist 229bc14f72 Adding a <SystemInfo> component to display basic system info 2023-03-10 23:27:03 +01:00
Eric van der Vlist 9e08a70002 Update check frequency 2023-03-10 22:26:24 +01:00
Eric van der Vlist 3aa96c7afc Moving the Account icon in a drawer 2023-03-10 20:01:40 +01:00
Eric van der Vlist 4ff760a0ff Making sure that notes default dates are the current date 2023-03-09 22:21:18 +01:00
Eric van der Vlist 06daffbd1c Add an update link for android 2023-03-09 21:51:52 +01:00
Eric van der Vlist 677ac02835 Checking if app needs update 2023-03-09 21:00:56 +01:00
Eric van der Vlist 7997138c5e Defining vite env vars with git info 2023-03-07 20:04:06 +01:00
Eric van der Vlist da76e30fc4 Use double click rather than single click to query the map 2023-03-07 19:01:25 +01:00
Eric van der Vlist bb763435ef Don't compact trksegs if you don't own them 2023-03-07 18:41:05 +01:00
Eric van der Vlist c1f1c8afb0 Displaying Wpts description and start date 2023-03-06 21:54:36 +01:00
Eric van der Vlist e620db5c7b Change origin format in put() 2023-03-06 21:38:50 +01:00
Eric van der Vlist df3039a04b Specific icon for notes 2023-03-06 21:16:19 +01:00
Eric van der Vlist adbbb3e356 First version of notes, also allowing to delete wpts 2023-03-06 16:45:20 +01:00
Eric van der Vlist bf179a4b6d Filtering out GPX positions when accuracy is less than 10 m 2023-03-06 14:36:15 +01:00
Eric van der Vlist 5404a6e5ad Implementing notes (WIP) 2023-03-06 09:24:39 +01:00
Eric van der Vlist 07cd0d04c5 Supporting invitations through geo URLs 2023-03-05 09:53:26 +01:00
Eric van der Vlist aba2ddd907 Handling deep links to web.dyomedea.add, thus supporting invitations in the app too 2023-03-04 20:52:11 +01:00
Eric van der Vlist c9be4dcc28 Typo 2023-03-04 20:09:59 +01:00
Eric van der Vlist c8644c8817 Replacing URLs by user ids in origins 2023-03-04 16:07:22 +01:00
Eric van der Vlist f07bf07c3f Replacing shared by to 2023-03-04 15:13:27 +01:00
Eric van der Vlist acb6156ed2 Replacing Shared by To... 2023-03-04 13:09:11 +01:00
Eric van der Vlist 2358c7d8fb Saving settings and reloading the page to select the invitation account 2023-03-04 12:27:27 +01:00
Eric van der Vlist 51eb54954f Adding a check for existing accounts 2023-03-04 12:10:09 +01:00
Eric van der Vlist a32faaa837 Saving the new account 2023-03-04 11:59:34 +01:00
Eric van der Vlist 87b6e1710d Cosmetics 2023-03-04 11:08:14 +01:00
Eric van der Vlist 24fb46c0fb Validation flow seems OK. 2023-03-04 10:54:32 +01:00
Eric van der Vlist 04cd163906 Moving on implementing invitations 2023-03-04 10:30:09 +01:00
Eric van der Vlist 5ad98a860e Moving invitation check in its own module 2023-03-04 09:23:28 +01:00
Eric van der Vlist bedcaa209a Checking if location's hash contains an invitation 2023-03-03 21:39:26 +01:00
Eric van der Vlist 5753245dad npm update 2023-03-03 21:38:49 +01:00
Eric van der Vlist 909949657e Adding a second vector source (and layer) per GPX to display uncluttered features. 2023-02-23 11:59:51 +01:00
Eric van der Vlist 99374520a5 npm-check-updates 2023-02-23 10:58:35 +01:00
Eric van der Vlist 0be074bbfb npm-check-updates 2023-02-21 20:36:08 +01:00
Eric van der Vlist ccd4e22934 vscode recommendations 2023-02-20 09:56:31 +01:00
Eric van der Vlist 543b7cd259 Remove decluttering which doesn't work nicely 2023-02-16 16:08:54 +01:00
Eric van der Vlist 3fd108177b Starting to implement a node component 2023-02-15 15:42:02 +01:00
Eric van der Vlist 951deb5fef Removing a condition that doesn't seem necessary before deleting docs.x 2023-02-15 15:37:45 +01:00
Eric van der Vlist 937fd885fa Sligthly bigger iconx 2023-02-15 12:34:54 +01:00
Eric van der Vlist ddf0590dcd Hiker icon for last GPX position.x 2023-02-15 12:25:12 +01:00
Eric van der Vlist 597cb8629a Displaying last position of each gpx 2023-02-15 12:02:56 +01:00
Eric van der Vlist 1406e88ad6 console.log's 2023-02-15 10:43:29 +01:00
Eric van der Vlist c4b2fa175d Bug fix (trkpts were deleted during compaction) 2023-02-14 20:55:20 +01:00
Eric van der Vlist 1d5d158f8c Bug fix when creating the first gpx. 2023-02-13 20:57:30 +01:00
Eric van der Vlist 51ab7c38e0 Store the current gpx id in account docs 2023-02-13 18:30:01 +01:00
Eric van der Vlist 8d32fa253a Bug fix 2023-02-13 15:59:41 +01:00
Eric van der Vlist 6dfe98b655 Refactoring the worker / db init flow. 2023-02-13 15:44:02 +01:00
Eric van der Vlist cfaf7ad72f Removing call to solid-worker. 2023-02-13 11:38:07 +01:00
Eric van der Vlist df42a684c3 Updating GPX import to use parent's shared. 2023-02-13 11:23:17 +01:00
Eric van der Vlist e445a7e1af db put should take parent's shared by default. 2023-02-13 10:56:48 +01:00
Eric van der Vlist 9ea29b368f 1000 ! 2023-02-13 10:14:34 +01:00
Eric van der Vlist 05532a2a5f ... 2023-02-13 10:12:59 +01:00
Eric van der Vlist 01554e3383 Breaking after 1000 purges. 2023-02-13 10:11:46 +01:00
Eric van der Vlist 19aaaba3f8 Breaking after 10000 purges to give a chance to delete _local/purges. 2023-02-13 10:02:28 +01:00
Eric van der Vlist e1d6fea35c Removing _local/purges 2023-02-13 09:59:41 +01:00
Eric van der Vlist cbd5eb1e04 Adding documents origin. 2023-02-12 21:23:30 +01:00
Eric van der Vlist 9dacad9af3 Adding a "shared" property to gpxes and family. 2023-02-12 18:14:14 +01:00
Eric van der Vlist 8853ea4670 Decreasing delay between purges. 2023-02-12 15:20:41 +01:00
Eric van der Vlist c992782ab7 Firefox issue. 2023-02-12 14:47:03 +01:00
Eric van der Vlist 8a63cc07f4 Bug fix (forEech and promises...) 2023-02-12 14:41:19 +01:00
Eric van der Vlist 4502162a36 Removing a few console.log... 2023-02-12 14:10:56 +01:00
Eric van der Vlist 5a5931dbcd Implementing a mechanism to purge deleted docs. 2023-02-12 12:19:00 +01:00
Eric van der Vlist 534ec32312 Signals are very handy in web workers ! 2023-02-12 11:12:53 +01:00
Eric van der Vlist 89689c5ed6 Porting db health to single worker mode. 2023-02-12 10:46:26 +01:00
Eric van der Vlist 0d86b789c1 Moving sync back in the first worker (sync doesn't see updates done in other workers!) 2023-02-11 20:23:18 +01:00
Eric van der Vlist 51250c1880 Bug fix (bad promise magic!) 2023-02-11 18:21:25 +01:00
Eric van der Vlist 853b158dcf Bug fix 2023-02-11 17:52:11 +01:00
Eric van der Vlist 79fed3cc28 Simplification 2023-02-11 16:08:07 +01:00
Eric van der Vlist 0e714ac361 Searching a new balance between the two web workers... 2023-02-11 15:55:49 +01:00
Eric van der Vlist 71bd820da9 Implementing a machanism to purge databases. 2023-02-11 12:02:22 +01:00
Eric van der Vlist 4a4ebdff50 Upgrading to the PouchDb indexedDb adapter while testing signals in web workers... 2023-02-11 11:31:32 +01:00
Eric van der Vlist e73497265f Updating TrksegViewer as well. 2023-02-10 15:38:18 +01:00
Eric van der Vlist b30af4c3ac Applying the same update to trkpt 2023-02-10 15:30:45 +01:00
Eric van der Vlist d8d15d9d83 More tests 2023-02-10 08:09:13 +01:00
Eric van der Vlist 31669d8aac Adapting the address fetcher for rtes. 2023-02-10 06:35:10 +01:00
Eric van der Vlist 796147e4a9 One more test (and bug fix). 2023-02-09 21:11:17 +01:00
Eric van der Vlist c30ceecbb1 More tests and debugging putRtept 2023-02-09 21:07:09 +01:00
Eric van der Vlist 3f5bb1633c More tests 2023-02-09 16:37:46 +01:00
Eric van der Vlist a04fcab25d Adding more tests. 2023-02-09 14:36:14 +01:00
Eric van der Vlist e8a3d8c62e Re implementing a basic test for db/gpx.ts 2023-02-09 14:25:13 +01:00
Eric van der Vlist 2387b1a4e9 Stting up vitest. 2023-02-09 13:57:14 +01:00
Eric van der Vlist 4b952001c3 Restoring previous version of vite.config.ts 2023-02-09 11:42:11 +01:00
Eric van der Vlist e2ef46b612 More updates related to the previous changes. 2023-02-08 22:39:04 +01:00
Eric van der Vlist 92ffe42ab9 Major update: storing trkpt and rtept inside trkseg and rte instead of independent documents. 2023-02-08 20:44:28 +01:00
Eric van der Vlist ecae9b4037 Adding the text of the license 2023-02-07 21:42:57 +01:00
Eric van der Vlist 9ca25222f5 Updating the license. 2023-02-07 21:32:40 +01:00
Eric van der Vlist aa91262de0 Adding license-report 2023-02-07 16:54:07 +01:00
Eric van der Vlist 03c0476f46 Removing tests which hadn't been updated since React (shame on me). 2023-02-07 16:47:26 +01:00
Eric van der Vlist 57010f89f4 Adding licenses checkers 2023-02-07 16:47:10 +01:00
Eric van der Vlist 994956f58d npm update 2023-02-07 09:32:26 +01:00
Eric van der Vlist 8355ee4c1e Differentiating between web and non web platforms. 2023-02-06 18:52:14 +01:00
Eric van der Vlist a458b82dc1 Second attempt to better hide the popup overlay when not shown... 2023-02-06 14:56:39 +01:00
Eric van der Vlist 0c6e497648 Adding patch-package 2023-02-06 10:04:17 +01:00
Eric van der Vlist 16d97c009f Patch for @suid/material 2023-02-06 09:56:09 +01:00
Eric van der Vlist 86427d5ff9 Hiding (through CSS) overlay popups when not shown (otherwise they are just located under the map and show up when the map is moved before tiles are loaded. 2023-02-06 09:24:57 +01:00
Eric van der Vlist e528db9fad Bug fix (was raising an error when no rows were returned) 2023-02-05 17:41:33 +01:00
Eric van der Vlist b821748fec Basic branches history in Readme.md 2023-02-05 15:32:14 +01:00
Eric van der Vlist 038e1fb9de Exposing preview to network 2023-02-05 15:25:32 +01:00
Eric van der Vlist 789e8b6067 npm update 2023-02-05 15:00:42 +01:00
Eric van der Vlist d47a5a7eb1 Working again on styles. 2023-02-04 21:33:34 +01:00
Eric van der Vlist aa158ab515 Adding an intent filter so that GPX can be imported from outdooractive 2023-02-04 21:17:05 +01:00
Eric van der Vlist ad6feb6f15 tyles (again) 2023-02-04 18:55:23 +01:00
Eric van der Vlist 38a6230565 Accepting GPX from osmand. 2023-02-04 18:22:05 +01:00
Eric van der Vlist fcaa3b95a0 Still playing with styles for ways 2023-02-04 15:07:50 +01:00
Eric van der Vlist adce285b0f Trying new styles for ways 2023-02-03 21:29:02 +01:00
Eric van der Vlist 1388f993ea <Infos> : displaying feature tags. 2023-02-03 18:37:54 +01:00
Eric van der Vlist 8e519dd862 Simplification of <Infos> 2023-02-03 18:07:18 +01:00
Eric van der Vlist 3daa2d11f9 Filter our multiple occurrences of OSM features in <Infos> 2023-02-03 17:46:56 +01:00
Eric van der Vlist b9d886db69 Slight style update 2023-02-03 17:31:20 +01:00
Eric van der Vlist db337892c4 More robust id handling in imports and rte delete. 2023-02-03 14:57:40 +01:00
Eric van der Vlist 5658cc0556 Bug fix. 2023-02-03 11:59:40 +01:00
Eric van der Vlist ccbcd12f96 Workaround for a pouchdb/chrome bug. 2023-02-02 22:19:31 +01:00
Eric van der Vlist 0af58ccb4f Call <Finder> on intent 2023-02-02 17:26:56 +01:00
Eric van der Vlist dec79c9c2d Refactoring to use the finder from en intent. 2023-02-02 16:58:23 +01:00
Eric van der Vlist 55830251e0 Wpt editor: we can add waypoints (at last !) 2023-02-02 16:10:20 +01:00
Eric van der Vlist 6451b110b9 Refactoring to avoid using an element Id for the popup. 2023-02-01 21:07:04 +01:00
Eric van der Vlist e3dc1fc083 Refactoring to facilitate creating new Wpts 2023-02-01 17:20:18 +01:00
Eric van der Vlist bd700d8782 <Finder> now supports UTM and lat lon. 2023-01-31 21:39:07 +01:00
Eric van der Vlist eec319b918 Still implementing <Finder> 2023-01-31 18:49:51 +01:00
Eric van der Vlist cc6ca0d718 Starting to implement a <Finder> component. 2023-01-31 17:32:19 +01:00
Eric van der Vlist 79bcf65f27 Differentiating international and national hiking routes 2023-01-31 12:30:28 +01:00
Eric van der Vlist cb74bb62f5 Doc 2023-01-31 12:09:49 +01:00
Eric van der Vlist fcc09e2ace Adding poi polygons. 2023-01-31 12:06:34 +01:00
Eric van der Vlist 5b9c2e3ca4 Helper to create style filters. 2023-01-31 11:56:40 +01:00
Eric van der Vlist 92c2d37e3b Changing a few style thresholds 2023-01-31 11:56:06 +01:00
Eric van der Vlist 046c4e47d5 Starting to filter POIs points 2023-01-31 11:23:52 +01:00
Eric van der Vlist 1241802888 iInitial mbstyle for hiking (edited with maputnik) 2023-01-31 10:55:55 +01:00
Eric van der Vlist c08cf8bc3f Network is now a feature's attribute (no longer in tags' hstore) 2023-01-31 10:54:31 +01:00
Eric van der Vlist e7c9d0e7cb Relying on server side vector tile filtering 2023-01-30 21:07:23 +01:00
Eric van der Vlist c17f47bb67 Playing with URL hashes 2023-01-30 15:28:35 +01:00
Eric van der Vlist 27a04f8a5d Changing zoom level on intent 2023-01-29 20:44:53 +01:00
Eric van der Vlist a42c6d99a1 Calling <Infos/> when receiving location intent. 2023-01-28 21:51:28 +01:00
Eric van der Vlist 93d13b749a Bug fix in intent (lon/lat may be negative) 2023-01-28 21:29:13 +01:00
Eric van der Vlist 2d73eb0886 Minor enhancements 2023-01-28 19:05:39 +01:00
Eric van der Vlist 3e98f7f745 Using geo.dyomedea.com 2023-01-27 08:22:45 +01:00
Eric van der Vlist c7852ad727 Adaptation to geoserver 2023-01-26 16:48:59 +01:00
Eric van der Vlist 1b4e170690 Testing with geoserver 2023-01-25 22:13:34 +01:00
Eric van der Vlist b85c82b70e Basic interfacs to query OSM data. 2023-01-24 15:18:50 +01:00
Eric van der Vlist eda1270a3c Commenting console.log 2023-01-24 11:48:02 +01:00
Eric van der Vlist d85e72956c Adding missing icons 2023-01-24 11:46:23 +01:00
Eric van der Vlist 2081093ea4 Testing missing icons 2023-01-24 10:54:36 +01:00
Eric van der Vlist 10a5f2fb18 Huge and dirty refactoring of the vector tile stuff. 2023-01-24 10:37:03 +01:00
Eric van der Vlist 36337623ca Refactoring and implementing the actual selection of features to display. 2023-01-21 21:22:36 +01:00
Eric van der Vlist 8ddbe1bdee Adding a basic mechanism to choose overlays (not operational yet) 2023-01-21 17:13:25 +01:00
Eric van der Vlist 82e38308a4 Styles... 2023-01-21 12:22:02 +01:00
Eric van der Vlist 6e64c8dd4c Working on styles. 2023-01-20 22:18:36 +01:00
Eric van der Vlist 81ffb65aaf Removing code that had been commented out. 2023-01-20 21:20:41 +01:00
Eric van der Vlist 9ade878deb Don't use useGeographic anymore since it doesn't work with clusters. 2023-01-20 21:11:18 +01:00
Eric van der Vlist 6e796f88c7 Cosmetics 2023-01-20 18:56:53 +01:00
Eric van der Vlist 982cb722f7 Back to the proxy approach... 2023-01-20 12:58:56 +01:00
Eric van der Vlist 0722fca584 Re-trying the class extension approach. 2023-01-20 12:01:30 +01:00
Eric van der Vlist c70e7baa4b Still working on the cluster proxy 2023-01-19 21:39:52 +01:00
Eric van der Vlist 6f359b2e80 Testing clustering with a proxy. 2023-01-19 21:08:06 +01:00
Eric van der Vlist 420d75520c Adding a feature filter function 2023-01-19 14:04:32 +01:00
Eric van der Vlist 66fc287e5c Still working on clustering. 2023-01-18 22:10:23 +01:00
Eric van der Vlist fce0b54574 Clustering tileVectorSource... 2023-01-18 12:05:48 +01:00
Eric van der Vlist 370a4fa90c Trying clustering... 2023-01-17 17:34:36 +01:00
Eric van der Vlist 0ef74d94be Styling 2023-01-17 12:51:44 +01:00
Eric van der Vlist 12466d214c Moving vector tile layer's MVT to Feature (instead of RenederdFeature) to prepare for clustering. 2023-01-17 12:40:38 +01:00
Eric van der Vlist 4917d27c9c Textfield: rows without multiline doesn't work well on android (the area is 1row and not resizeable) 2023-01-17 11:49:19 +01:00
Eric van der Vlist 8be0ca5b3d doc 2023-01-17 10:37:19 +01:00
Eric van der Vlist 088c3c4e27 WPT editor 2023-01-16 22:55:08 +01:00
Eric van der Vlist bdb11a52bb Reimplementing a dialog to edit waypoints 2023-01-16 20:59:00 +01:00
Eric van der Vlist 3153ee308d Improving infos.tsx 2023-01-16 18:25:38 +01:00
Eric van der Vlist ee000862f8 Adding a button to open a POIsearch in a browser 2023-01-16 17:27:49 +01:00
Eric van der Vlist 2fae581449 ncu --upgrade && npm install 2023-01-16 17:00:55 +01:00
Eric van der Vlist e011124dfe nom update 2023-01-16 16:55:30 +01:00
Eric van der Vlist 356c4b0eba Highlighting housing 2023-01-16 16:28:34 +01:00
Eric van der Vlist cb8e564270 Dirty display of vector tiles feature properties in Infos.tsx 2023-01-16 16:16:22 +01:00
Eric van der Vlist fa60f5229c Hiking trails styles 2023-01-16 09:28:57 +01:00
Eric van der Vlist 47a6159226 Vector tiles (adjusting styles) 2023-01-16 09:11:42 +01:00
Eric van der Vlist 944c8eee53 Still working on vector tiles 2023-01-15 21:35:08 +01:00
Eric van der Vlist b1e13e9306 Working on vector tiles 2023-01-15 19:29:09 +01:00
Eric van der Vlist 83f8d0d7c9 Playing around with vector tiles 2023-01-15 15:42:53 +01:00
Eric van der Vlist aa5dcbac3e Testing a transportation vector tile 2023-01-13 14:02:58 +01:00
Eric van der Vlist 6969b53618 Importing OSM routes, 2023-01-09 20:51:17 +01:00
Eric van der Vlist d6317ca8a4 i18n 2023-01-09 16:02:18 +01:00
Eric van der Vlist 1f1b57e4b4 Using a dialog for confirm delete alert. 2023-01-09 15:52:50 +01:00
Eric van der Vlist 1f3c1c750e Trak delete (again). 2023-01-09 14:40:37 +01:00
Eric van der Vlist 9931887f03 Still working on trk delete. 2023-01-09 14:23:41 +01:00
Eric van der Vlist 45f7c797e7 Implementing a delete method for tracks. 2023-01-08 22:05:08 +01:00
Eric van der Vlist a2149f9a43 Styling 2023-01-08 20:04:08 +01:00
Eric van der Vlist f9a44b3b70 Bug fix 2023-01-07 19:18:25 +01:00
Eric van der Vlist 1f2979b28b Improving TrkSegViewer 2023-01-07 18:46:14 +01:00
Eric van der Vlist 7483d9f904 Refactoring 2023-01-07 18:00:35 +01:00
Eric van der Vlist b23e44b576 Adding Spanish IGN maps 2023-01-07 17:26:24 +01:00
Eric van der Vlist e7b27cda4e Adding adresses to rtept rather than rte. 2023-01-07 15:41:16 +01:00
Eric van der Vlist 2ca519a53c Using peekCachedSignal to speedup GpxDialog 2023-01-07 15:14:44 +01:00
Eric van der Vlist 516d09e3c6 Trick to force a vertical scrollbar in dialogs (needed when the virtual keyboard hides a field). 2023-01-06 16:41:11 +01:00
Eric van der Vlist 040c0271d7 Trying to be more robust to find the name of a locality with nominatim... 2023-01-05 23:02:40 +01:00
Eric van der Vlist 97f11239e8 Adding buttons to reverse geocode routes. 2023-01-05 18:27:20 +01:00
Eric van der Vlist 69148f6e1d Error handling when fetching addresses. 2023-01-03 18:43:40 +01:00
Eric van der Vlist 9e3915c6ce Minor bug fix. 2023-01-03 18:24:38 +01:00
Eric van der Vlist 44ce641d6a Improving RteViewer. 2023-01-03 18:17:12 +01:00
Eric van der Vlist c1fe37d0a6 TrkViewer and TrksegViewer skeletons. 2023-01-03 15:24:50 +01:00
Eric van der Vlist 09ff9ca829 RteViewer 2023-01-03 15:02:21 +01:00
Eric van der Vlist 62b2b5552a Displaying waypoints (and installing a plugin to import SVG files as components) 2023-01-03 13:12:16 +01:00
Eric van der Vlist 6b0b394d33 Adding a GPX icon 2023-01-03 12:07:23 +01:00
Eric van der Vlist d9c4837f82 Slight refactoring. 2023-01-03 11:39:17 +01:00
Eric van der Vlist adc37fef03 Refactoring to implement visualization and edition features. 2023-01-02 17:27:55 +01:00
Eric van der Vlist 67cfd16efb Bug fix... 2022-12-30 21:12:46 +01:00
Eric van der Vlist 73aad8f2a2 Progressing in implementing a tree representation of features. 2022-12-30 21:03:37 +01:00
Eric van der Vlist a57968924f Extracting a hierarchy from a list of features (`<Infos/>`) 2022-12-29 22:55:48 +01:00
Eric van der Vlist b14db11938 Adding context properties to OL features. 2022-12-29 08:14:43 +01:00
Eric van der Vlist 91916fca88 Debouncing updates from the worker to the main thread (this was crashing the app during heavy syncs). 2022-12-28 18:50:09 +01:00
Eric van der Vlist 4b55763a03 Allow cleartex (non https) 2022-12-26 19:38:23 +01:00
Eric van der Vlist ad9b70173f First working version with the account dialog. 2022-12-26 18:04:01 +01:00
Eric van der Vlist 8a4396fb20 Still working on the account dialog. 2022-12-26 17:31:05 +01:00
Eric van der Vlist 1d6c3a858d Still progressing... 2022-12-25 22:24:00 +01:00
Eric van der Vlist 5dbf080190 Progressing into the implementation of the Account dialog. 2022-12-25 22:09:52 +01:00
Eric van der Vlist 5ca12b6780 Adding a mechanism to postpone DB access before the DB is ready. 2022-12-25 21:37:59 +01:00
Eric van der Vlist a36c8a28a4 Implementing an 'account' dialog (WIP) 2022-12-25 16:30:47 +01:00
Eric van der Vlist 0e2ffb0cf2 Creating a second PouchDB database for local (non sync'ed) documents such as state. 2022-12-24 16:39:55 +01:00
Eric van der Vlist cef7431012 Cosmetic bug in GPX import. 2022-12-23 16:30:24 +01:00
Eric van der Vlist 55164ef2a3 Testing CouchDB sync. 2022-12-23 15:41:03 +01:00
Eric van der Vlist 30a7bdfd12 Updating pouchdb to version 8.0.0 2022-12-22 14:53:22 +01:00
Eric van der Vlist 221d839256 NPM updates 2022-12-22 14:46:27 +01:00
Eric van der Vlist 6702bf8dc4 Indentation ? 2022-12-21 18:54:56 +01:00
Eric van der Vlist 07a7df9089 gitignore 2022-12-17 18:17:39 +01:00
Eric van der Vlist 70154a0f5a Moving current location (and navigate) during track recording. 2022-12-17 16:08:18 +01:00
Eric van der Vlist f2f55a22bd Moving the map on geo: intents. 2022-12-15 19:45:30 +01:00
Eric van der Vlist d71399e296 Adding a fullScreen option for our Dialog component. 2022-12-15 18:46:58 +01:00
Eric van der Vlist e90e71d151 Testing Android intents as a receiver. 2022-12-14 21:50:09 +01:00
Eric van der Vlist b797015c57 Making the app fullscreen on Android 2022-12-14 15:26:32 +01:00
Eric van der Vlist da61c8cf46 Moving the rotate control to the bottom 2022-12-14 08:50:13 +01:00
Eric van der Vlist d1a3e6bf82 Debouncing Map state db persisting 2022-12-14 08:22:51 +01:00
Eric van der Vlist 600ce534fe Removing existing features before adding new ones. 2022-12-14 08:03:42 +01:00
Eric van der Vlist 040122189c Dirty hack to store the app state and restore it at app startup. 2022-12-13 22:26:17 +01:00
Eric van der Vlist acc1d7cc1e (Re)Adding background geolocation. 2022-12-13 20:59:39 +01:00
Eric van der Vlist 4dbdcecadd Cosmetics 2022-12-13 16:40:16 +01:00
Eric van der Vlist 1d648a2187 Basic structure for recording UI 2022-12-13 16:16:30 +01:00
Eric van der Vlist 3d2db84235 Converting tracks without timestamps to routes during import. 2022-12-13 15:17:50 +01:00
Eric van der Vlist fdee3e8fcd Trying declutter again... 2022-12-13 12:54:46 +01:00
Eric van der Vlist 90fb0e6944 First version of the new importer (stiil needs to convert non timed tracks into routes). 2022-12-13 12:41:13 +01:00
Eric van der Vlist 102a2feddc Cosmetics 2022-12-13 08:24:50 +01:00
Eric van der Vlist a6b5be4f11 Isolating a GpxChooser component 2022-12-13 07:59:28 +01:00
Eric van der Vlist 56c9eb37bb Minor modifications 2022-12-12 21:35:00 +01:00
Eric van der Vlist daed8e5dc1 GpxDialog (working). 2022-12-12 20:57:25 +01:00
Eric van der Vlist 6da10713a0 GpxDialog (looking good). 2022-12-12 18:55:14 +01:00
Eric van der Vlist 7df0b41260 GpxDialog (wip) 2022-12-12 15:37:12 +01:00
Eric van der Vlist 2f57bff6ed Updating capacitor and android config to change appname 2022-12-12 14:40:46 +01:00
Eric van der Vlist 59faede004 Begining to implement a GPX Dialog component 2022-12-12 11:41:09 +01:00
Eric van der Vlist 31bec02496 Starting to implement a proper UI for GPX import. 2022-12-11 16:20:34 +01:00
Eric van der Vlist 3a5f5260c8 Replacing PouchDB indexes (used only to get the list of Gpxes by a custom implementation. 2022-12-11 10:45:08 +01:00
Eric van der Vlist 8c82b9c040 Trying decluttering (doesn't work that well) 2022-12-10 21:58:27 +01:00
Eric van der Vlist b2955c8bbd More robust GPX parsing 2022-12-10 21:39:58 +01:00
Eric van der Vlist 882e5545fd Allowing multiple Gpx files import 2022-12-10 21:25:15 +01:00
Eric van der Vlist 86a8c823f1 Changing Gpx and Trkpt indexes so that GPX are sorted by datetime desc and Trkpt use their timestamp as indexes. 2022-12-10 18:31:51 +01:00
Eric van der Vlist be72adce05 Modifying pouchdb index. 2022-12-10 16:52:52 +01:00
Eric van der Vlist c6e1f63a85 Adding arrows to trksegs. 2022-12-10 16:23:10 +01:00
Eric van der Vlist 327f0a6910 Mechanism to add style functions 2022-12-10 12:16:46 +01:00
Eric van der Vlist 821957a4f7 Starting to refactor OL styles to be able to support arrows and point markers. 2022-12-09 21:43:54 +01:00
Eric van der Vlist da053dcb50 Displaying routes. 2022-12-09 17:31:56 +01:00
Eric van der Vlist f84c82bc32 Relying on the change handler for Gpx, Trk and Trkseg too. 2022-12-09 15:18:14 +01:00
Eric van der Vlist c2d6f6f285 Relying on the change handler for AllGpxes and FPX import. 2022-12-09 14:57:54 +01:00
Eric van der Vlist 21a63ec54c Cleanup (remove the tree/branch mechanism which isn't useful). 2022-12-08 21:27:40 +01:00
Eric van der Vlist 38224d73da Adding minZoom extension property for Wpts 2022-12-07 15:09:08 +01:00
Eric van der Vlist 008ca2ce3b Adding Wpt icons 2022-12-07 13:30:46 +01:00
Eric van der Vlist b36ad82b61 Saving Wpt after edition. 2022-12-06 21:56:23 +01:00
Eric van der Vlist 156fefae3b Working on Wpt save after edition. 2022-12-06 21:27:25 +01:00
Eric van der Vlist c8a8622c91 Begining to implement the Wpt update dialog 2022-12-06 17:09:31 +01:00
Eric van der Vlist cc121fea27 Adding an onCleanup hook to cancel dispatches and watches for Wpt 2022-12-06 14:54:59 +01:00
Eric van der Vlist 5829f93c91 Refactoring to watch WPT updates. 2022-12-06 14:36:50 +01:00
Eric van der Vlist 6465a371cb Testingpouchdb change handler 2022-12-05 18:49:36 +01:00
Eric van der Vlist 063bee4e28 Forgotten component ... 2022-12-05 18:48:57 +01:00
Eric van der Vlist 707d20c7d1 npm update 2022-12-05 16:57:39 +01:00
Eric van der Vlist 8bd0c74727 Dialog component 2022-11-30 22:44:02 +01:00
Eric van der Vlist 1e65ca2f72 More dialog, I can't stand suid/mui :( ! 2022-11-30 18:08:45 +01:00
Eric van der Vlist b5cd2cd58b GPX labels. 2022-11-30 14:46:05 +01:00
Eric van der Vlist 3fd43b09a4 i18n 2022-11-30 13:58:55 +01:00
Eric van der Vlist 3e191dbf38 Adding `<Suspense>` wrappers to start rendering Gpxes before they have all been fetched and removed auto compaction and compact db at init time. 2022-11-30 11:15:53 +01:00
Eric van der Vlist 079a36c1de Finding the moveTolerance option (great improvement with touch screens). 2022-11-29 22:38:08 +01:00
Eric van der Vlist ca37281a0b Basic info dialog 2022-11-29 22:12:50 +01:00
Eric van der Vlist 35937a933c Changing the selection UI. 2022-11-29 21:19:28 +01:00
Eric van der Vlist 82cdad5f1f Styles. 2022-11-29 21:07:46 +01:00
Eric van der Vlist d5be1b8672 Cleaner way to define styles. 2022-11-29 19:49:05 +01:00
Eric van der Vlist 4d1b1c9a06 Setting a flag to select features 2022-11-29 16:54:13 +01:00
Eric van der Vlist deb1f267ab Doing the samething for WPts 2022-11-29 15:06:39 +01:00
Eric van der Vlist ab1d644e8e Trying different ways to select and potentially update OL features 2022-11-29 14:59:57 +01:00
Eric van der Vlist 400711eb80 Adding a selectHandler (not functional yet). 2022-11-28 21:36:12 +01:00
Eric van der Vlist 42d66ecfa5 (Re)Implementing the map chooser. 2022-11-28 19:33:02 +01:00
Eric van der Vlist f10fa11348 Basic mechanism to support different tile providers. 2022-11-28 15:27:36 +01:00
Eric van der Vlist 1fb7f47c05 Adding Wpt names. 2022-11-28 12:14:09 +01:00
Eric van der Vlist 6121df68bf Adding `<Wpt>` 2022-11-28 11:52:50 +01:00
Eric van der Vlist ec5d90f768 Diffrent flags for start and finish 2022-11-28 08:38:21 +01:00
Eric van der Vlist e49f079eb2 Re-enabling live locks. 2022-11-27 22:50:47 +01:00
Eric van der Vlist 12cfa9337a Starting to add some style to trksegs. 2022-11-27 22:48:35 +01:00
Eric van der Vlist bbaf1e798b Addinf trkseg start/end points 2022-11-27 19:17:33 +01:00
Eric van der Vlist 6c2573ba8b Refreshing GPX list after importing a new GPX. 2022-11-27 18:24:17 +01:00
Eric van der Vlist 37fd31a040 Displaying trksegs through geojson. 2022-11-27 17:12:25 +01:00
Eric van der Vlist ab7374f360 `<Trkseg>` component 2022-11-27 16:18:50 +01:00
Eric van der Vlist 54f2ab06d9 `<Trk>` component 2022-11-27 16:09:08 +01:00
Eric van der Vlist 79fb39100f `<Gpx>` component 2022-11-27 15:50:08 +01:00
Eric van der Vlist 346b9a1186 Creating a `<AllGpxes>` component. 2022-11-27 14:32:21 +01:00
Eric van der Vlist d0bc9422f3 Addind a few @ts-ignore :( ... 2022-11-27 12:29:30 +01:00
Eric van der Vlist 0f9b66b0d4 File renaming 2022-11-27 12:24:57 +01:00
Eric van der Vlist 7f571882de Moving controls out of the ol map object. 2022-11-27 12:12:22 +01:00
Eric van der Vlist 83e14932a4 GPX import. 2022-11-26 22:04:08 +01:00
Eric van der Vlist 5de30283b1 Reintroducing WebWorkers (pfeeew, Vite makes it tough !) 2022-11-26 19:36:55 +01:00
Eric van der Vlist 02f02984e5 Bring back navigation buttons. 2022-11-26 12:33:26 +01:00
Eric van der Vlist 2c79c74376 Showing the current location. 2022-11-25 22:12:44 +01:00
Eric van der Vlist 1efdc30e5c Re-implementing GetLocation 2022-11-25 21:09:59 +01:00
Eric van der Vlist ef8ee5e00e Standard ol controls. 2022-11-25 17:10:49 +01:00
Eric van der Vlist 9a5808741b Map navigation. 2022-11-25 17:06:07 +01:00
Eric van der Vlist 5ae068ae43 Reverting to a previous version of capacitor to avoid errors. 2022-11-25 16:57:24 +01:00
Eric van der Vlist 3e66119b3e Getting stuff done in the sandbox. 2022-11-25 16:45:26 +01:00
Eric van der Vlist 96e550faaa Update to latest dependency versions 2022-11-25 16:35:50 +01:00
Eric van der Vlist fd354b4e51 Fresh install 2022-11-25 16:33:59 +01:00
Eric van der Vlist 4a3be05321 Fresh install 2022-11-25 16:33:37 +01:00
Eric van der Vlist 5a4a301049 Fresh install 2022-11-25 16:27:47 +01:00
Eric van der Vlist 8bb8792ee2 Cleaning before switching to SoliJS 2022-11-25 16:23:31 +01:00
Eric van der Vlist 2fa6199979 ShowLocation component. 2022-11-23 18:25:23 +01:00
Eric van der Vlist 1555c00fe8 Moving the map center to the current location when required. 2022-11-22 22:10:08 +01:00
Eric van der Vlist 0ba385c476 Adding a (non yet operational) control to get the current location. 2022-11-22 18:03:53 +01:00
Eric van der Vlist 0f8f892688 Slight refactoring 2022-11-22 15:41:47 +01:00
Eric van der Vlist 0d8bc3b2f1 Basic Openlayers map. 2022-11-22 15:18:34 +01:00
Eric van der Vlist 65d047e53d Removing google analytics 2022-11-22 08:22:12 +01:00
Eric van der Vlist 882388aa1b Re-adding package-lock.json 2022-11-22 08:20:57 +01:00
Eric van der Vlist e75b2f670c Starting again... 2022-11-22 08:19:52 +01:00
Eric van der Vlist 1c403ae819 Adding a modal for the Explorer (context menu). 2022-11-22 07:48:17 +01:00
Eric van der Vlist 9459622a95 Re-implementing the map chooser 2022-11-21 17:49:09 +01:00
Eric van der Vlist 89fbb5d851 Updating npm packages 2022-11-21 14:43:07 +01:00
Eric van der Vlist c731c6a7e6 Testing the onContextMenu event. 2022-11-17 23:33:57 +01:00
Eric van der Vlist 8906bed1e7 Minor enhancement. 2022-11-17 23:11:33 +01:00
Eric van der Vlist 7c09a5536a Adding a simple cache to keep track of points 2022-11-17 23:04:47 +01:00
Eric van der Vlist 2733906196 Bug fix. 2022-11-17 22:13:07 +01:00
Eric van der Vlist a53ddfa63e Adding startTransition to defer GPX renderings. 2022-11-17 21:05:12 +01:00
Eric van der Vlist 64d928e893 Adding start and finish icons to trksegs. 2022-11-17 17:28:24 +01:00
Eric van der Vlist ad3d2125bb Switching from shared web workers (not supported by chrome on android) to "normal" web workers. 2022-11-17 16:10:44 +01:00
Eric van der Vlist e4621e4651 Adapting "slippy graphics" to the new structure. 2022-11-17 15:26:29 +01:00
Eric van der Vlist 812849cdef Using useViewport in LayerStack rather than TiledLayer to share it with slippy graphics. 2022-11-17 14:57:55 +01:00
Eric van der Vlist fa049e36e5 Creating a useViewport custom hook to ba used by both `<TiledLayer>` and slippy graphics. 2022-11-17 14:06:05 +01:00
Eric van der Vlist ef3759079c Displaying GPX tracks (1st attempt) 2022-11-17 12:55:00 +01:00
Eric van der Vlist d86d63ca61 Starting to implement GPX visualization. 2022-11-15 20:19:14 +01:00
Eric van der Vlist cd9ee67fed Removing unused indexes. 2022-11-15 16:03:36 +01:00
Eric van der Vlist 9b23bcec5c Computing bounding boxes when saving GPX files. 2022-11-15 15:24:21 +01:00
Eric van der Vlist 947f4dff3a Adding a new URI for GPX technical data and changing the index of wpt, rte and trk. 2022-11-15 14:39:52 +01:00
Eric van der Vlist 5fdd63103e Reimplementing GPX imports. 2022-11-14 18:35:04 +01:00
Eric van der Vlist a2d0e8cf6a Retrieving GPX import from master. 2022-11-14 14:13:12 +01:00
Eric van der Vlist 68ebdbdbf6 Using plainnumbers instead of BigInts for GPXids. 2022-11-14 11:39:37 +01:00
Eric van der Vlist 00ad6285d0 Updating pouchdb keys based on an updated version of docuri. 2022-11-13 20:02:11 +01:00
Eric van der Vlist 12f0a8a10d Using full ISO dates as Gpx ids to support a wider range of dates. 2022-11-09 10:32:06 +01:00
Eric van der Vlist 441c623999 Rtept 2022-11-08 22:14:29 +01:00
Eric van der Vlist 2245c1ff00 Routes 2022-11-08 22:02:06 +01:00
Eric van der Vlist 1b9c7fc261 Waypoints 2022-11-08 21:51:26 +01:00
Eric van der Vlist 16ca39a160 Track points 2022-11-08 21:09:33 +01:00
Eric van der Vlist b0f767721a Track segments 2022-11-08 20:21:34 +01:00
Eric van der Vlist b79599a350 More tests 2022-11-08 20:04:21 +01:00
Eric van der Vlist 9cc4c404b0 Adding more tests. 2022-11-08 18:57:37 +01:00
Eric van der Vlist a53c0210ea Going on with tracks. 2022-11-08 14:16:23 +01:00
Eric van der Vlist 26486b65b9 Cleanup and starting to implements tracks. 2022-11-07 22:12:50 +01:00
Eric van der Vlist 36a3199b36 Code restructuring for db updates. 2022-11-07 18:20:01 +01:00
Eric van der Vlist 2f362916da Trying to save a simple GPX. 2022-11-07 17:04:02 +01:00
Eric van der Vlist 510736a33a Starting to reimplement GPX db functions. 2022-11-07 16:38:44 +01:00
Eric van der Vlist 56b36ea063 Adding a test 2022-11-07 12:01:58 +01:00
Eric van der Vlist ebf4f39331 More fun with web workers... 2022-11-07 11:44:35 +01:00
Eric van der Vlist 94de17938e More work with web workers (pffff!) 2022-11-06 22:29:33 +01:00
Eric van der Vlist 9089b08c6e Starting to work with web workers. 2022-11-06 17:53:01 +01:00
Eric van der Vlist 4b53b9d4ba Removing use-pouchdb. 2022-11-04 17:14:21 +01:00
Eric van der Vlist 74dbff2d23 Fixing a bug (the `<g>` element wasn't always available as ref.current in TiledLayer), using a useEffect seems to do the trick. 2022-11-03 22:20:14 +01:00
Eric van der Vlist 84e1ece691 PouchDB init 2022-11-03 17:27:02 +01:00
Eric van der Vlist 45ab894622 Marker bug fix 2022-11-03 12:19:21 +01:00
Eric van der Vlist ba78422a29 Markers check that they belong to the current viewport to display. 2022-11-03 11:57:04 +01:00
Eric van der Vlist c4094b28ae Refactoring to send a viewport property to slippy graphics (new, more generic, name for markers) 2022-11-03 11:37:22 +01:00
Eric van der Vlist 7f03b0bca4 Cherry picking 57d17a1fa6 (Requesting a wake lock so that the screen is not dimmed while using the app.) 2022-11-02 22:33:03 +01:00
Eric van der Vlist 8e2a68fb0f Displaying the current location. 2022-11-02 22:28:08 +01:00
Eric van der Vlist 1ed4875e5e Implementing a Marker component. 2022-11-02 21:27:29 +01:00
Eric van der Vlist 925174db79 Back/Forward buttons 2022-11-02 16:04:18 +01:00
Eric van der Vlist 8e78fbc7ec Moving fils around 2022-11-02 15:29:13 +01:00
Eric van der Vlist 61fc42b251 Handling window resize (and rotate). 2022-11-02 15:14:34 +01:00
Eric van der Vlist 7811f00779 Re-implementing (foreground) geolocation (and npm packages update). 2022-11-01 21:27:36 +01:00
Eric van der Vlist fe9cc6437d Using atomWithHash to enable back/forward actions. 2022-11-01 17:58:57 +01:00
Eric van der Vlist e1583846ed Cleanup and doc. 2022-11-01 14:37:08 +01:00
Eric van der Vlist de69aff4c9 Removing nolonger used code 2022-11-01 14:23:18 +01:00
Eric van der Vlist 19062ac126 Removing a console.log() 2022-11-01 14:17:36 +01:00
Eric van der Vlist 50114598b2 Doc and cache improvement. 2022-11-01 14:16:36 +01:00
Eric van der Vlist 352cb0d870 Cleanup 2022-11-01 11:50:59 +01:00
Eric van der Vlist 04d2aa1ac1 More cleanup for the tiled layer cache. 2022-11-01 11:46:54 +01:00
Eric van der Vlist a6f10b9ee0 Implementing a cache cleanup method. 2022-10-31 22:14:28 +01:00
Eric van der Vlist 9f9576d2f6 Bug fix... 2022-10-31 21:40:10 +01:00
Eric van der Vlist 8deed17b05 Continuing to re-plug the handlers. 2022-10-31 21:01:56 +01:00
Eric van der Vlist eb1618d009 Re-pluging handlers (on LiveMap). 2022-10-31 18:05:58 +01:00
Eric van der Vlist 8341da64a3 Making a property optional 2022-10-31 15:08:50 +01:00
Eric van der Vlist 7b5abaccd3 Refactoring to split logic between `<Map>` and a brand new `<LiveMap>` component. 2022-10-31 15:02:46 +01:00
Eric van der Vlist 425ad06e33 Cleanup 2022-10-30 22:13:10 +01:00
Eric van der Vlist 0284cdbab9 Updating test snapshots. 2022-10-30 22:09:42 +01:00
Eric van der Vlist b0c7801cd1 Using `<TiledLayer>` in `<layerStack>`. 2022-10-30 22:06:55 +01:00
Eric van der Vlist ef35ffca32 Adding a component to take care of translations and scalings around `<TileSet>` components (not used yeti but should simplify `<LayerStack>`). 2022-10-30 21:35:32 +01:00
Eric van der Vlist 7322e5f5c4 Memoising `<TileSet>` 2022-10-30 20:23:12 +01:00
Eric van der Vlist edca3f0d1b Trying to simplify. 2022-10-30 20:18:21 +01:00
Eric van der Vlist 7f9400b395 Removing the tileFactory from components props (to limit re-renderings). 2022-10-29 21:16:50 +02:00
Eric van der Vlist 4479b1bd99 Typedoc update 2022-10-21 11:04:58 +02:00
Eric van der Vlist 8380d39b44 Removing package-lock.json from git 2022-10-21 10:04:04 +02:00
Eric van der Vlist 70e519c6b5 Doc 2022-10-20 21:37:05 +02:00
Eric van der Vlist eefe94c1e8 Doc 2022-10-20 21:22:37 +02:00
Eric van der Vlist c800235ebb Doc 2022-10-20 16:58:33 +02:00
Eric van der Vlist d970b288e4 Using a global variable to cache <Tile>s for <TiledLayer>s. 2022-10-20 16:21:27 +02:00
Eric van der Vlist 3dee9e90d7 Starting to implement a LayerStack component 2022-10-19 18:35:20 +02:00
Eric van der Vlist 4238ce0938 Using maps instead of objects to store tiles and removing the reinititialization when TiledLayer properties are updated. 2022-10-19 14:53:22 +02:00
Eric van der Vlist b5dd10e920 Adding tests for the <Map> component. 2022-10-19 13:55:44 +02:00
Eric van der Vlist b3a8f60f1e Doc 2022-10-19 13:04:56 +02:00
Eric van der Vlist acbefa983d Using Jotai between <Map> and <Handlers> (TODO: adapt Handlers.test.tsx) 2022-10-19 11:17:24 +02:00
Eric van der Vlist 552a49e0d6 Doc 2022-10-18 20:40:12 +02:00
Eric van der Vlist 4f069ad63f Adding touch handlers. 2022-10-18 18:47:40 +02:00
Eric van der Vlist f1ad35a479 Adding double click and wheel handlers 2022-10-18 17:42:11 +02:00
Eric van der Vlist 4f64d9906c Using useRef instead of useState in <Handler/> (no need to re-render when mouse state is updated). 2022-10-18 17:18:11 +02:00
Eric van der Vlist d758775ab7 Testing mouseMove throttling 2022-10-18 17:11:07 +02:00
Eric van der Vlist 016f99daf6 Idem with <Tile/> 2022-10-18 16:57:18 +02:00
Eric van der Vlist a7f78e0fa9 Avoid uncessessary rerendering (see https://medium.com/swlh/making-stupid-react-smart-in-re-rendering-5f04b5bab327 ). 2022-10-18 16:52:24 +02:00
Eric van der Vlist ab5c8ff6bb Simple implementation of event handler throttling. 2022-10-18 14:24:21 +02:00
Eric van der Vlist 963f6037ca Managing TiledLayer from Map. 2022-10-18 13:57:46 +02:00
Eric van der Vlist 7912d0bfe8 ntegration and bug fix 2022-10-18 13:45:16 +02:00
Eric van der Vlist 90e2c833a2 Adding some tests for <Handlers/> 2022-10-18 11:44:50 +02:00
Eric van der Vlist da50441abc Re-implementing the mouse handlers. 2022-10-18 10:10:23 +02:00
Eric van der Vlist 16097c1e2e Testing negative indices fot TiledLayer components. 2022-10-17 23:04:58 +02:00
Eric van der Vlist 0d927c72cd Tests and doc 2022-10-17 22:37:07 +02:00
Eric van der Vlist 9355d1602a Removing test files from the typedoc. 2022-10-17 21:36:39 +02:00
Eric van der Vlist 460bfbf6e5 Doc 2022-10-17 21:31:21 +02:00
Eric van der Vlist 42e2d7c2c7 Adding the Tile component. 2022-10-17 21:23:57 +02:00
Eric van der Vlist f6a0eb8963 Making sure TiledLaer's are reinitialized if their keyObject change.s 2022-10-17 20:52:10 +02:00
Eric van der Vlist ffa58ee303 Bug fix. 2022-10-17 18:30:26 +02:00
Eric van der Vlist a5dc279e4e Adding the notion of TileFactory 2022-10-17 18:17:13 +02:00
Eric van der Vlist cf50675077 Testing TiledLayer re-rendering. 2022-10-17 17:56:03 +02:00
Eric van der Vlist 36418a3e3c Making TiledLayer more generic. 2022-10-17 17:48:30 +02:00
Eric van der Vlist b3e1e4de73 Adding docuri's and unit tests. 2022-10-17 17:15:24 +02:00
Eric van der Vlist 0b7de58a4e Check spelling 2022-10-17 13:47:35 +02:00
Eric van der Vlist a6edcca740 Doc 2022-10-17 12:09:11 +02:00
Eric van der Vlist a07fb9df67 Removing the generateddoc from git. 2022-10-17 12:06:54 +02:00
Eric van der Vlist fcef58f4df Adding typedoc in the loop 2022-10-17 12:04:25 +02:00
Eric van der Vlist 1010eaaddc Doc 2022-10-17 10:39:15 +02:00
Eric van der Vlist 9c1f4aeb2f Empty Map component. 2022-10-17 10:37:26 +02:00
Eric van der Vlist a4bd11aab0 Restarting from scratch 2022-10-17 10:08:00 +02:00
442 changed files with 22597 additions and 38819 deletions

37
.gitignore vendored
View File

@ -1,31 +1,6 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# wtf ?
/android
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
.vscode
.idea
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Optional eslint cache
.eslintcache
node_modules/
dist/
android/
ios/
vite.config.ts.timestamp-*.mjs
$*$/

8
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,8 @@
{
"recommendations": [
"esbenp.prettier-vscode",
"streetsidesoftware.code-spell-checker",
"streetsidesoftware.code-spell-checker-french",
"solidjs-community.solid-snippets"
]
}

9
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,9 @@
{
"cSpell.words": [
"datatyping",
"docuri",
"Dyomedea",
"stackoverflow"
],
"workbench.colorTheme": "Default Light Modern"
}

152
AndroidManifest.xml Normal file
View File

@ -0,0 +1,152 @@
<?xml version="1.0" encoding="utf-8" ?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dyomedea.dyomedea"
>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:isGame="false"
android:appCategory="maps"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
>
<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
android:name="com.dyomedea.dyomedea.MainActivity"
android:label="@string/title_activity_main"
android:theme="@style/AppTheme.NoActionBarLaunch"
android:launchMode="singleTask"
android:exported="true"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="geo" />
<data android:scheme="" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/gpx+xml" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/gpx+xml" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/xml" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/xml" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/xml" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/xml" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="file/*" />
</intent-filter>
<intent-filter>
<action
android:name="com.darryncampbell.cordova.plugin.intent.ACTION"
/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<data android:host="web.dyomedea.app" />
</intent-filter>
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true"
>
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"
/>
</provider>
</application>
<!-- Permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION"
/>
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"
/>
<uses-permission
android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"
/>
<uses-permission
android:name="android.permission.ACCESS_BACKGROUND_LOCATION"
/>
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
/>
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
</manifest>

675
LICENSE.md Normal file
View File

@ -0,0 +1,675 @@
### GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
<https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
### Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom
to share and change all versions of a program--to make sure it remains
free software for all its users. We, the Free Software Foundation, use
the GNU General Public License for most of our software; it applies
also to any other work released this way by its authors. You can apply
it to your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you
have certain responsibilities if you distribute copies of the
software, or if you modify it: responsibilities to respect the freedom
of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the
manufacturer can do so. This is fundamentally incompatible with the
aim of protecting users' freedom to change the software. The
systematic pattern of such abuse occurs in the area of products for
individuals to use, which is precisely where it is most unacceptable.
Therefore, we have designed this version of the GPL to prohibit the
practice for those products. If such problems arise substantially in
other domains, we stand ready to extend this provision to those
domains in future versions of the GPL, as needed to protect the
freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish
to avoid the special danger that patents applied to a free program
could make it effectively proprietary. To prevent this, the GPL
assures that patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
### TERMS AND CONDITIONS
#### 0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds
of works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of
an exact copy. The resulting work is called a "modified version" of
the earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user
through a computer network, with no transfer of a copy, is not
conveying.
An interactive user interface displays "Appropriate Legal Notices" to
the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
#### 1. Source Code.
The "source code" for a work means the preferred form of the work for
making modifications to it. "Object code" means any non-source form of
a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users can
regenerate automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same
work.
#### 2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey,
without conditions so long as your license otherwise remains in force.
You may convey covered works to others for the sole purpose of having
them make modifications exclusively for you, or provide you with
facilities for running those works, provided that you comply with the
terms of this License in conveying all material for which you do not
control copyright. Those thus making or running the covered works for
you must do so exclusively on your behalf, under your direction and
control, on terms that prohibit them from making any copies of your
copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the
conditions stated below. Sublicensing is not allowed; section 10 makes
it unnecessary.
#### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such
circumvention is effected by exercising rights under this License with
respect to the covered work, and you disclaim any intention to limit
operation or modification of the work as a means of enforcing, against
the work's users, your or third parties' legal rights to forbid
circumvention of technological measures.
#### 4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
#### 5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these
conditions:
- a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
- b) The work must carry prominent notices stating that it is
released under this License and any conditions added under
section 7. This requirement modifies the requirement in section 4
to "keep intact all notices".
- c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
- d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
#### 6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of
sections 4 and 5, provided that you also convey the machine-readable
Corresponding Source under the terms of this License, in one of these
ways:
- a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
- b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the Corresponding
Source from a network server at no charge.
- c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
- d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
- e) Convey the object code using peer-to-peer transmission,
provided you inform other peers where the object code and
Corresponding Source of the work are being offered to the general
public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal,
family, or household purposes, or (2) anything designed or sold for
incorporation into a dwelling. In determining whether a product is a
consumer product, doubtful cases shall be resolved in favor of
coverage. For a particular product received by a particular user,
"normally used" refers to a typical or common use of that class of
product, regardless of the status of the particular user or of the way
in which the particular user actually uses, or expects or is expected
to use, the product. A product is a consumer product regardless of
whether the product has substantial commercial, industrial or
non-consumer uses, unless such uses represent the only significant
mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to
install and execute modified versions of a covered work in that User
Product from a modified version of its Corresponding Source. The
information must suffice to ensure that the continued functioning of
the modified object code is in no case prevented or interfered with
solely because modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or
updates for a work that has been modified or installed by the
recipient, or for the User Product in which it has been modified or
installed. Access to a network may be denied when the modification
itself materially and adversely affects the operation of the network
or violates the rules and protocols for communication across the
network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
#### 7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders
of that material) supplement the terms of this License with terms:
- a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
- b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
- c) Prohibiting misrepresentation of the origin of that material,
or requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
- d) Limiting the use for publicity purposes of names of licensors
or authors of the material; or
- e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
- f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions
of it) with contractual assumptions of liability to the recipient,
for any liability that these contractual assumptions directly
impose on those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions; the
above requirements apply either way.
#### 8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your license
from a particular copyright holder is reinstated (a) provisionally,
unless and until the copyright holder explicitly and finally
terminates your license, and (b) permanently, if the copyright holder
fails to notify you of the violation by some reasonable means prior to
60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
#### 9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run
a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
#### 10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
#### 11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims owned
or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within the
scope of its coverage, prohibits the exercise of, or is conditioned on
the non-exercise of one or more of the rights that are specifically
granted under this License. You may not convey a covered work if you
are a party to an arrangement with a third party that is in the
business of distributing software, under which you make payment to the
third party based on the extent of your activity of conveying the
work, and under which the third party grants, to any of the parties
who would receive the covered work from you, a discriminatory patent
license (a) in connection with copies of the covered work conveyed by
you (or copies made from those copies), or (b) primarily for and in
connection with specific products or compilations that contain the
covered work, unless you entered into that arrangement, or that patent
license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
#### 12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under
this License and any other pertinent obligations, then as a
consequence you may not convey it at all. For example, if you agree to
terms that obligate you to collect a royalty for further conveying
from those to whom you convey the Program, the only way you could
satisfy both those terms and this License would be to refrain entirely
from conveying the Program.
#### 13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
#### 14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions
of the GNU General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in
detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies that a certain numbered version of the GNU General Public
License "or any later version" applies to it, you have the option of
following the terms and conditions either of that numbered version or
of any later version published by the Free Software Foundation. If the
Program does not specify a version number of the GNU General Public
License, you may choose any version ever published by the Free
Software Foundation.
If the Program specifies that a proxy can decide which future versions
of the GNU General Public License can be used, that proxy's public
statement of acceptance of a version permanently authorizes you to
choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
#### 15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
CORRECTION.
#### 16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
#### 17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
### How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.
To do so, attach the following notices to the program. It is safest to
attach them to the start of each source file to most effectively state
the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper
mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands \`show w' and \`show c' should show the
appropriate parts of the General Public License. Of course, your
program's commands might be different; for a GUI interface, you would
use an "about box".
You should also get your employer (if you work as a programmer) or
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. For more information on this, and how to apply and follow
the GNU GPL, see <https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your
program into proprietary programs. If your program is a subroutine
library, you may consider it more useful to permit linking proprietary
applications with the library. If this is what you want to do, use the
GNU Lesser General Public License instead of this License. But first,
please read <https://www.gnu.org/licenses/why-not-lgpl.html>.

434
README.md
View File

@ -1,16 +1,33 @@
# Dyomedea
## License
GPL 3.0.
## Branches
* master: dev (and only active) branch (started as a React project, now using solidjs)
* multi-layers: (deprecated) attempt to create a native React map components. Went pretty far but there was still so many things to implement that I switched to:
* openlayers: (deprecated) an attempt to use React with Openlayers. Wasn't that easy because Openlayers is heavily based on the DOM while React uses a "pseudo-dom". That has been one of the reasons why I switched (again) to:
* solid: (merged into master and deprecated) a SolidJS / Openlayers implementation that has replaced the master branch on Feb 5th, 2023.
## Hiking app.
## Documentation
```bash
vdv@nuc:~/projects/tea/dyomedea/dyomedea$ npx typedoc
./src/serviceWorkerRegistration.ts:21:0 - warning Config is referenced by serviceWorkerRegistration.register.register.config but not included in the documentation.
21 type Config = {
Documentation generated at ./doc
vdv@nuc:~/projects/tea/dyomedea/dyomedea$
```
## Components
### Slippy
The viewport on the underlying map
### Map
The map itself (and its overlays)
TBD
## Data formats
@ -26,13 +43,13 @@ SVG is very generic and is used to draw 2D figures in HTML applications and does
KML, GeoJSON and OSM elements have been designed to represent generic geographical points and shapes.
GPX is more specific, having been designed to represent routes and tracks and its semantices are directly useable in our application.
GPX is more specific, having been designed to represent routes and tracks and its semantics are directly useable in our application.
The strucure of our components and indexes can therefore follow the GPX format.
The structure of our components and indexes can therefore follow the GPX format.
OSM elements is interesting to extract information from the OSM DB, either by querying their API or by downloading portions of the database.
GeoJSON might be of interest as an intermediate format since a number of JS libraries have been developped to perform queries or draw GeoJSON data as SVG.
GeoJSON might be of interest as an intermediate format since a number of JS libraries have been developed to perform queries or draw GeoJSON data as SVG.
KML might be considered as an import format.
@ -50,5 +67,402 @@ $npx patch-package localized-strings
However, it takes ages before `ionic serve` takes these modifications into account.
### Visual Code snippets
* [Create Your Own VSCode Snippets - DEV Community 👩‍💻👨‍💻](https://dev.to/brianmmdev/create-your-own-vscode-snippets-33c7)
* [vscode settings - How can I create templates for file extensions in Visual Studio Code? - Stack Overflow](https://stackoverflow.com/questions/50571130/how-can-i-create-templates-for-file-extensions-in-visual-studio-code)
### Useful commands
```bash
vdv@nuc:~/projects/tea/dyomedea/dyomedea$ adb --version
Android Debug Bridge version 1.0.41
Version 33.0.3-8952118
Installed as /homext/Android/Sdk/platform-tools/adb
$ ionic capacitor run --target RFCN20NEZ4R android
$ ionic serve --no-open
$ npm test
$ npx typedoc
$ npx trapeze run trapeze.config.yaml
vdv@nuc:~/projects/tea/dyomedea/dyomedea$ echo $ANDROID_SDK_ROOT
/home/vdv/Android/Sdk
```
### To (re)generate android/
```bash
$ rm capacitor.config.ts
$ rm -rf android
$ npx cap init dyomedea com.dyomedea.dyomedea # assets in dist/
$ npx cap add android
$ cp AndroidManifest.xml ./android/app/src/main/AndroidManifest.xml
$ npx cap run --target RFCN20NEZ4R android
```
### To generate style filters
```bash
vdv@nuc:~/projects/tea/dyomedea/dyomedea$ esrun helper.ts
{
caller: 'overlay-definitions',
legacyOverlayDefinitions: {
amenity: {
bar: [Object],
fast_food: [Object],
food_court: [Object],
pub: [Object],
restaurant: [Object],
cafe: [Object],
atm: [Object],
bank: [Object],
doctors: [Object],
hospital: [Object],
pharmacy: [Object],
police: [Object],
fire_station: [Object],
drinking_water: [Object],
water_point: [Object],
waste_basket: [Object],
waste_disposal: [Object],
vending_machine: [Object]
},
shop: {
bakery: [Object],
butcher: [Object],
cheese: [Object],
chocolate: [Object],
convenience: [Object],
dairy: [Object],
farm: [Object],
greengrocer: [Object],
health_food: [Object],
pasta: [Object],
pastry: [Object],
seafood: [Object],
water: [Object],
department_store: [Object],
general: [Object],
mall: [Object],
supermarket: [Object],
wholesale: [Object],
outdoor: [Object],
laundry: [Object]
},
tourism: {
hotel: [Object],
alpine_hut: [Object],
apartment: [Object],
camp_site: [Object],
chalet: [Object],
guest_house: [Object],
hostel: [Object],
motel: [Object],
wilderness_hut: [Object],
viewpoint: [Object]
},
waterway: { waterfall: [Object] },
natural: {
peak: [Object],
cave_entrance: [Object],
volcano: [Object],
arch: [Object],
arete: [Object],
fumarole: [Object],
rock: [Object],
saddle: [Object],
sinkhole: [Object],
stone: [Object],
glacier: [Object],
spring: [Object],
hot_spring: [Object],
geyser: [Object]
}
},
_flat: [
{ hiking: [Object] }, { hiking: [Object] }, { hiking: [Object] },
{ hiking: [Object] }, { hiking: [Object] }, { hiking: [Object] },
{ hiking: [Object] }, { hiking: [Object] }, { hiking: [Object] },
{ hiking: [Object] }, { hiking: [Object] }, { hiking: [Object] },
{ hiking: [Object] }, { hiking: [Object] }, { hiking: [Object] },
{ hiking: [Object] }, { hiking: [Object] }, { hiking: [Object] },
{ hiking: [Object] }, { hiking: [Object] }, { hiking: [Object] },
{ hiking: [Object] }, { hiking: [Object] }, { hiking: [Object] },
{ hiking: [Object] }, { hiking: [Object] }, { hiking: [Object] },
{ hiking: [Object] }, { hiking: [Object] }, { hiking: [Object] },
{ hiking: [Object] }, { hiking: [Object] }, { hiking: [Object] },
{ hiking: [Object] }, { hiking: [Object] }, { hiking: [Object] },
{ hiking: [Object] }, { hiking: [Object] }, { hiking: [Object] },
{ hiking: [Object] }, { hiking: [Object] }, { hiking: [Object] },
{ hiking: [Object] }, { hiking: [Object] }, { hiking: [Object] },
{ hiking: [Object] }, { hiking: [Object] }, { hiking: [Object] },
{ hiking: [Object] }, { hiking: [Object] }, { hiking: [Object] },
{ hiking: [Object] }, { hiking: [Object] }, { hiking: [Object] },
{ hiking: [Object] }, { hiking: [Object] }, { hiking: [Object] },
{ hiking: [Object] }, { hiking: [Object] }, { hiking: [Object] },
{ hiking: [Object] }, { hiking: [Object] }, { hiking: [Object] }
],
overlayCategories: {
hiking: Set(9) {
'drinking',
'eating',
'money',
'dayToDay',
'health',
'security',
'material',
'sleeping',
'naturalSites'
}
}
}
{
legacyOverlayDefinitions: {
amenity: {
bar: [Object],
fast_food: [Object],
food_court: [Object],
pub: [Object],
restaurant: [Object],
cafe: [Object],
atm: [Object],
bank: [Object],
doctors: [Object],
hospital: [Object],
pharmacy: [Object],
police: [Object],
fire_station: [Object],
drinking_water: [Object],
water_point: [Object],
waste_basket: [Object],
waste_disposal: [Object],
vending_machine: [Object]
},
shop: {
bakery: [Object],
butcher: [Object],
cheese: [Object],
chocolate: [Object],
convenience: [Object],
dairy: [Object],
farm: [Object],
greengrocer: [Object],
health_food: [Object],
pasta: [Object],
pastry: [Object],
seafood: [Object],
water: [Object],
department_store: [Object],
general: [Object],
mall: [Object],
supermarket: [Object],
wholesale: [Object],
outdoor: [Object],
laundry: [Object]
},
tourism: {
hotel: [Object],
alpine_hut: [Object],
apartment: [Object],
camp_site: [Object],
chalet: [Object],
guest_house: [Object],
hostel: [Object],
motel: [Object],
wilderness_hut: [Object],
viewpoint: [Object]
},
waterway: { waterfall: [Object] },
natural: {
peak: [Object],
cave_entrance: [Object],
volcano: [Object],
arch: [Object],
arete: [Object],
fumarole: [Object],
rock: [Object],
saddle: [Object],
sinkhole: [Object],
stone: [Object],
glacier: [Object],
spring: [Object],
hot_spring: [Object],
geyser: [Object]
}
},
filters: [
'any',
[
'in', 'amenity',
'bar', 'fast_food',
'food_court', 'pub',
'restaurant', 'cafe',
'atm', 'bank',
'doctors', 'hospital',
'pharmacy', 'police',
'fire_station', 'drinking_water',
'water_point', 'waste_basket',
'waste_disposal', 'vending_machine'
],
[
'in', 'shop',
'bakery', 'butcher',
'cheese', 'chocolate',
'convenience', 'dairy',
'farm', 'greengrocer',
'health_food', 'pasta',
'pastry', 'seafood',
'water', 'department_store',
'general', 'mall',
'supermarket', 'wholesale',
'outdoor', 'laundry'
],
[
'in', 'tourism',
'hotel', 'alpine_hut',
'apartment', 'camp_site',
'chalet', 'guest_house',
'hostel', 'motel',
'wilderness_hut', 'viewpoint'
],
[ 'in', 'waterway', 'waterfall' ],
[
'in', 'natural',
'peak', 'cave_entrance',
'volcano', 'arch',
'arete', 'fumarole',
'rock', 'saddle',
'sinkhole', 'stone',
'glacier', 'spring',
'hot_spring', 'geyser'
]
],
json: '["any",["in","amenity","bar","fast_food","food_court","pub","restaurant","cafe","atm","bank","doctors","hospital","pharmacy","police","fire_station","drinking_water","water_point","waste_basket","waste_disposal","vending_machine"],["in","shop","bakery","butcher","cheese","chocolate","convenience","dairy","farm","greengrocer","health_food","pasta","pastry","seafood","water","department_store","general","mall","supermarket","wholesale","outdoor","laundry"],["in","tourism","hotel","alpine_hut","apartment","camp_site","chalet","guest_house","hostel","motel","wilderness_hut","viewpoint"],["in","waterway","waterfall"],["in","natural","peak","cave_entrance","volcano","arch","arete","fumarole","rock","saddle","sinkhole","stone","glacier","spring","hot_spring","geyser"]]'
}
```
(Just copy the filters as json)
Requires esrun (`sudo npm i -g @digitak/esrun`)
### Patches
* suid: https://github.com/swordev/suid/issues/89
### NPM updates: use npm-check-updates !
```
vdv@nuc:~/projects/tea/dyomedea/dyomedea$ npm outdated
Package Current Wanted Latest Location Depended by
@capacitor/android 4.6.1 4.6.3 4.6.3 node_modules/@capacitor/android dyomedea
@capacitor/browser 4.1.0 4.1.1 4.1.1 node_modules/@capacitor/browser dyomedea
@capacitor/cli 4.6.1 4.6.3 4.6.3 node_modules/@capacitor/cli dyomedea
@capacitor/core 4.6.1 4.6.3 4.6.3 node_modules/@capacitor/core dyomedea
@capacitor/ios 4.6.1 4.6.3 4.6.3 node_modules/@capacitor/ios dyomedea
@esbuild-plugins/node-globals-polyfill 0.1.1 0.1.1 0.2.3 node_modules/@esbuild-plugins/node-globals-polyfill dyomedea
@esbuild-plugins/node-modules-polyfill 0.1.4 0.1.4 0.2.2 node_modules/@esbuild-plugins/node-modules-polyfill dyomedea
@solid-primitives/i18n 1.1.2 1.1.3 1.1.3 node_modules/@solid-primitives/i18n dyomedea
@solidjs/router 0.6.0 0.6.0 0.7.0 node_modules/@solidjs/router dyomedea
@suid/icons-material 0.5.5 0.5.8 0.5.8 node_modules/@suid/icons-material dyomedea
@suid/material 0.9.1 0.9.2 0.10.1 node_modules/@suid/material dyomedea
jsdom 21.0.0 21.1.0 21.1.0 node_modules/jsdom dyomedea
solid-js 1.6.9 1.6.10 1.6.10 node_modules/solid-js dyomedea
solid-testing-library 0.5.0 0.5.1 0.5.1 node_modules/solid-testing-library dyomedea
typescript 4.9.4 4.9.5 4.9.5 node_modules/typescript dyomedea
vite 4.0.4 4.1.1 4.1.1 node_modules/vite dyomedea
vitest 0.27.1 0.28.4 0.28.4 node_modules/vitest dyomedea
vdv@nuc:~/projects/tea/dyomedea/dyomedea$ npm-check
npm-check npm-check-updates
vdv@nuc:~/projects/tea/dyomedea/dyomedea$ npm-check-updates
Checking /home/vdv/projects/tea/dyomedea/dyomedea/package.json
[====================] 40/40 100%
@capacitor/android ^4.6.1 → ^4.6.3
@capacitor/browser ^4.1.0 → ^4.1.1
@capacitor/cli ^4.6.1 → ^4.6.3
@capacitor/core ^4.6.1 → ^4.6.3
@capacitor/ios ^4.6.1 → ^4.6.3
@esbuild-plugins/node-globals-polyfill ^0.1.1 → ^0.2.3
@esbuild-plugins/node-modules-polyfill ^0.1.4 → ^0.2.2
@solid-primitives/i18n ^1.1.2 → ^1.1.3
@solidjs/router ^0.6.0 → ^0.7.0
@suid/icons-material ^0.5.5 → ^0.5.8
@suid/material ^0.9.1 → ^0.10.1
jsdom >=21.0.0 → >=21.1.0
solid-js ^1.6.9 → ^1.6.10
typescript ^4.9.4 → ^4.9.5
vite >=4.0.4 → >=4.1.1
vitest >=0.27.1 → >=0.28.4
Run ncu -u to upgrade package.json
vdv@nuc:~/projects/tea/dyomedea/dyomedea$ npm-check-updates -u
╭─────────────────────────────────────────────────────────────────────────────────╮
│ │
│ Update available 16.4.1 → 16.6.3 │
│ Run npm i -g npm-check-updates to update │
│ https://github.com/raineorshine/npm-check-updates/compare/v16.4.1...v16.6.3 │
│ │
╰─────────────────────────────────────────────────────────────────────────────────╯
Upgrading /home/vdv/projects/tea/dyomedea/dyomedea/package.json
[====================] 40/40 100%
@capacitor/android ^4.6.1 → ^4.6.3
@capacitor/browser ^4.1.0 → ^4.1.1
@capacitor/cli ^4.6.1 → ^4.6.3
@capacitor/core ^4.6.1 → ^4.6.3
@capacitor/ios ^4.6.1 → ^4.6.3
@esbuild-plugins/node-globals-polyfill ^0.1.1 → ^0.2.3
@esbuild-plugins/node-modules-polyfill ^0.1.4 → ^0.2.2
@solid-primitives/i18n ^1.1.2 → ^1.1.3
@solidjs/router ^0.6.0 → ^0.7.0
@suid/icons-material ^0.5.5 → ^0.5.8
@suid/material ^0.9.1 → ^0.10.1
jsdom >=21.0.0 → >=21.1.0
solid-js ^1.6.9 → ^1.6.10
typescript ^4.9.4 → ^4.9.5
vite >=4.0.4 → >=4.1.1
vitest >=0.27.1 → >=0.28.4
Run pnpm install to install new versions.
vdv@nuc:~/projects/tea/dyomedea/dyomedea$ sudo npm i -g npm-check-updates
[sudo] Mot de passe de vdv :
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
added 11 packages, and changed 285 packages in 17s
56 packages are looking for funding
run `npm fund` for details
vdv@nuc:~/projects/tea/dyomedea/dyomedea$ npm install
> dyomedea-solid@0.0.0 postinstall
> node ./fix-jest-dom.mjs
added 20 packages, removed 2 packages, changed 21 packages, and audited 625 packages in 25s
91 packages are looking for funding
run `npm fund` for details
2 critical severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
vdv@nuc:~/projects/tea/dyomedea/dyomedea$ npm outdated
Package Current Wanted Latest Location Depended by
solid-testing-library 0.5.0 0.5.1 0.5.1 node_modules/solid-testing-library dyomedea
vdv@nuc:~/projects/tea/dyomedea/dyomedea$
```

11
cSpell.json Normal file
View File

@ -0,0 +1,11 @@
{
"overrides": [
{
"filename": "**/fr.*",
"language": "fr"
}
],
"words": [
"Clusterable"
]
}

View File

@ -3,8 +3,10 @@ import { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
appId: 'com.dyomedea.dyomedea',
appName: 'dyomedea',
webDir: 'build',
bundledWebRuntime: false
webDir: 'dist',
server: {
androidScheme: 'https'
}
};
export default config;

63
helper.ts Normal file
View File

@ -0,0 +1,63 @@
import {
overlayDefinitions,
osmTags,
} from './src/components/overlays/overlay-definitions';
// One timer
// let tags = {};
// let overlays = {};
// for (const tagName of Object.keys(legacyOverlayDefinitions)) {
// for (const tagValue of Object.keys(legacyOverlayDefinitions[tagName])) {
// tags[tagValue] = { name: tagName, value: tagValue };
// for (const activity of Object.keys(
// legacyOverlayDefinitions[tagName][tagValue]
// )) {
// if (!overlays[activity]) {
// overlays[activity] = {};
// }
// for (const category of Object.keys(
// legacyOverlayDefinitions[tagName][tagValue][activity]
// )) {
// if (!overlays[activity][category]) {
// overlays[activity][category] = [];
// }
// overlays[activity][category].push(tagValue);
// }
// }
// }
// }
// console.log({
// caller: 'onetimer / result',
// tags: JSON.stringify(tags),
// overlays: JSON.stringify(overlays),
// });
// End of one timer
for (const overlayCategory of Object.keys(overlayDefinitions)) {
let filters: any[] = ['any'];
const definitions = overlayDefinitions[overlayCategory];
let tags = {};
for (const category of Object.keys(definitions)) {
//console.log({ category });
for (const tagId of definitions[category]) {
//console.log({ tagId });
const tag = osmTags[tagId];
if (!tags[tag.name]) {
tags[tag.name] = [];
}
tags[tag.name].push(tag.value);
}
}
for (const tagName of Object.keys(tags)) {
let filter = ['in', tagName];
for (const tagValue of tags[tagName]) {
filter.push(tagValue);
}
filters.push(filter);
}
console.log({ overlayCategory, filters: JSON.stringify(filters) });
}

16
index.html Normal file
View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<link rel="shortcut icon" type="image/ico" href="/src/assets/favicon.ico" />
<title>Solid App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script src="/src/index.tsx" type="module"></script>
</body>
</html>

View File

@ -1,7 +0,0 @@
{
"name": "dyomedea",
"integrations": {
"capacitor": {}
},
"type": "react"
}

34806
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,102 +1,70 @@
{
"name": "dyomedea",
"version": "0.0.1",
"private": true,
"dependencies": {
"@awesome-cordova-plugins/core": "^5.45.0",
"@awesome-cordova-plugins/geolocation": "^5.45.0",
"@capacitor-community/background-geolocation": "^1.2.4",
"@capacitor-community/file-opener": "^1.0.1",
"@capacitor/android": "^4.2.0",
"@capacitor/app": "4.0.1",
"@capacitor/cli": "^4.2.0",
"@capacitor/core": "^4.2.0",
"@capacitor/filesystem": "^4.1.2",
"@capacitor/haptics": "4.0.1",
"@capacitor/keyboard": "4.0.1",
"@capacitor/status-bar": "4.0.1",
"@chatscope/chat-ui-kit-react": "^1.9.7",
"@chatscope/chat-ui-kit-styles": "^1.4.0",
"@ionic/react": "^6.2.6",
"@ionic/react-router": "^6.2.6",
"@openpgp/asmcrypto.js": "^2.3.2",
"@reduxjs/toolkit": "^1.8.5",
"@testing-library/jest-dom": "^5.11.9",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
"@trapezedev/configure": "^5.0.6",
"@types/jest": "^26.0.20",
"@types/node": "^12.19.15",
"name": "dyomedea-solid",
"version": "0.0.0",
"description": "",
"type": "module",
"scripts": {
"start": "vite",
"dev": "vite",
"build": "vite build",
"serve": "vite preview --host",
"test": "vitest",
"postinstall": "patch-package"
},
"license": "GPL-3.0-only",
"devDependencies": {
"@capacitor/cli": "^5.4.2",
"@solidjs/testing-library": "^0.8.4",
"@testing-library/jest-dom": "^6.1.3",
"@types/lodash": "^4.14.199",
"@types/memoizee": "^0.4.9",
"@types/pouchdb": "^6.4.0",
"@types/react": "^18.0.18",
"@types/react-dom": "^18.0.6",
"@types/react-router": "^5.1.11",
"@types/react-router-dom": "^5.1.7",
"buffer": "^6.0.3",
"cordova-plugin-geolocation": "^4.1.0",
"crypto-browserify": "^3.12.0",
"docuri": "^4.2.2",
"font-gis": "^1.0.5",
"git": "^0.1.5",
"ionicons": "^6.0.3",
"@types/proj4": "^2.5.3",
"@types/shelljs": "^0.8.13",
"@vitest/ui": "^0.34.6",
"jsdom": "^22.1.0",
"license-checker": "^25.0.1",
"license-compatibility-checker": "^0.3.5",
"license-report": "^6.4.0",
"shelljs": "^0.8.5",
"typescript": "^5.2.2",
"vite": ">=4.4.11",
"vite-plugin-solid": "^2.7.0",
"vitest": "^0.34.6"
},
"dependencies": {
"@awesome-cordova-plugins/android-full-screen": "^6.4.0",
"@awesome-cordova-plugins/geolocation": "^6.4.0",
"@awesome-cordova-plugins/web-intent": "^6.4.0",
"@capacitor-community/background-geolocation": "^1.2.15",
"@capacitor/android": "^5.4.2",
"@capacitor/browser": "^5.1.0",
"@capacitor/core": "^5.4.2",
"@capacitor/filesystem": "^5.1.4",
"@capacitor/ios": "^5.4.2",
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
"@solid-primitives/i18n": "^2.0.0",
"@solidjs/router": "^0.8.3",
"@suid/icons-material": "^0.6.11",
"@suid/material": "^0.15.1",
"@suid/vite-plugin": "^0.1.5",
"blob-util": "^2.0.2",
"com-darryncampbell-cordova-plugin-intent": "^2.2.0",
"cordova-plugin-fullscreen": "^1.3.0",
"isomorphic-xml2js": "^0.1.3",
"lodash": "^4.17.21",
"pouchdb": "^7.3.0",
"pouchdb-browser": "^7.3.0",
"pouchdb-find": "^7.3.0",
"react": "^18.2.0",
"react-app-polyfill": "^3.0.0",
"react-dom": "^18.2.0",
"react-localization": "^1.0.19",
"react-pouchdb": "^2.1.0",
"react-redux": "^8.0.2",
"react-router": "^6.3.0",
"react-router-dom": "^6.3.0",
"react-scripts": "^5.0.0",
"status": "^0.0.13",
"stream-browserify": "^3.0.0",
"typescript": "^4.8.3",
"web-vitals": "^0.2.4",
"workbox-background-sync": "^5.1.4",
"workbox-broadcast-update": "^5.1.4",
"workbox-cacheable-response": "^5.1.4",
"workbox-core": "^5.1.4",
"workbox-expiration": "^5.1.4",
"workbox-google-analytics": "^5.1.4",
"workbox-navigation-preload": "^5.1.4",
"workbox-precaching": "^5.1.4",
"workbox-range-requests": "^5.1.4",
"workbox-routing": "^5.1.4",
"workbox-strategies": "^5.1.4",
"workbox-streams": "^5.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --transformIgnorePatterns 'node_modules/(?!(@ionic/react|@ionic/react-router|@ionic/core|@stencil/core|ionicons)/)'",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@types/lodash": "^4.14.184"
},
"description": "An Ionic project",
"postinstall": "npx patch-package"
"memoizee": "^0.4.15",
"ol": "^8.1.0",
"osmtogeojson": "^3.0.0-beta.5",
"patch-package": "^8.0.0",
"piexifjs": "^1.0.6",
"pluscodes": "^2.6.0",
"pouchdb": "^8.0.1",
"pouchdb-adapter-indexeddb": "^8.0.1",
"pouchdb-browser": "^8.0.1",
"proj4": "^2.9.0",
"solid-js": "^1.7.12",
"vite-plugin-solid-svg": "^0.6.4"
}
}

View File

@ -0,0 +1,13 @@
diff --git a/node_modules/@suid/material/InputBase/InputBase.jsx b/node_modules/@suid/material/InputBase/InputBase.jsx
index 4d9a4b9..e465053 100644
--- a/node_modules/@suid/material/InputBase/InputBase.jsx
+++ b/node_modules/@suid/material/InputBase/InputBase.jsx
@@ -239,7 +239,7 @@ const inputGlobalStyles = () => (<>
"@keyframes mui-auto-fill-cancel": { from: { display: "block" } },
}}/>}
</>);
-const selectionTypes = new Set(["text", "search", "password", "tel", "url"]);
+const selectionTypes = new Set(["text", "textarea", "search", "password", "tel", "url"]);
/**
* `InputBase` contains as few styles as possible.
* It aims to be a simple building block for creating an input.

View File

@ -1,15 +0,0 @@
diff --git a/node_modules/localized-strings/lib/LocalizedStrings.js b/node_modules/localized-strings/lib/LocalizedStrings.js
index eefa6c8..e0a3cae 100644
--- a/node_modules/localized-strings/lib/LocalizedStrings.js
+++ b/node_modules/localized-strings/lib/LocalizedStrings.js
@@ -192,8 +192,8 @@ var LocalizedStrings = function () {
if (_this4._opts.logsEnabled) {
console.log("\uD83D\uDEA7 \uD83D\uDC77 key '" + key + "' not found in localizedStrings for language " + _this4._language + " \uD83D\uDEA7");
}
- } else if (typeof strings[key] !== "string") {
- // It's an object
+ } else if (typeof strings[key] !== "string" && defaultStrings[key].$$typeof === undefined) {
+ // It's an object (and it's not a React component)
_this4._fallbackValues(defaultStrings[key], strings[key]);
}
});

View File

@ -0,0 +1,33 @@
diff --git a/node_modules/piexifjs/piexif.js b/node_modules/piexifjs/piexif.js
index 3d0bd12..a920f5e 100644
--- a/node_modules/piexifjs/piexif.js
+++ b/node_modules/piexifjs/piexif.js
@@ -1781,6 +1781,18 @@ SOFTWARE.
'name': 'DateTimeDigitized',
'type': 'Ascii'
},
+ 36880: {
+ 'name': 'OffsetTime',
+ 'type': 'Ascii'
+ },
+ 36881: {
+ 'name': 'OffsetTimeOriginal',
+ 'type': 'Ascii'
+ },
+ 36882: {
+ 'name': 'OffsetTimeDigitized',
+ 'type': 'Ascii'
+ },
37121: {
'name': 'ComponentsConfiguration',
'type': 'Undefined'
@@ -2349,6 +2361,9 @@ SOFTWARE.
ExifVersion:36864,
DateTimeOriginal:36867,
DateTimeDigitized:36868,
+ OffsetTime:36880,
+ OffsetTimeOriginal:36881,
+ OffsetTimeDigitized:36882,
ComponentsConfiguration:37121,
CompressedBitsPerPixel:37122,
ShutterSpeedValue:37377,

2238
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 930 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

View File

@ -1,44 +0,0 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="1000"
height="2000"
viewBox="0 0 250 500"
>
<g>
<circle
cx="100"
cy="100"
r="10"
fill='green'
stroke='black'
stroke-width="1"
vector-effect="non-scaling-stroke"
/>
<circle
cx="200"
cy="200"
r="10"
fill='green'
stroke='black'
stroke-width="1"
vector-effect="non-scaling-size"
/>
<path
d="M 50, 50 l 0.0001 0"
stroke-width="10"
stroke-linecap="round"
stroke="green"
vector-effect="non-scaling-stroke"
/>
</g>
</svg>
<!--
<svg width="921" height="1301"><g transform="scale(256) translate(6.916599514166666,8.07269355334303))"><circle cx="0.7154276391666667" cy="0.6137091783430285" r="10px" fill="green" vector-effect="non-scaling-size"></circle></g></svg>
<svg width="921" height="1301"><g transform="scale(256) translate(6.916599514166666,8.07269355334303))"><path d="M 0.7154276391666667 0.6137091783430285 l 0.0001 0" vector-effect="non-scaling-stroke" stroke-width="50" stroke-linecap="round" stroke="green"></path></g></svg>
-->

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1 +0,0 @@
<svg width="350" height="140" xmlns="http://www.w3.org/2000/svg" style="background:#f6f7f9"><g fill="none" fill-rule="evenodd"><path fill="#F04141" style="mix-blend-mode:multiply" d="M61.905-34.23l96.194 54.51-66.982 54.512L22 34.887z"/><circle fill="#10DC60" style="mix-blend-mode:multiply" cx="155.5" cy="135.5" r="57.5"/><path fill="#3880FF" style="mix-blend-mode:multiply" d="M208.538 9.513l84.417 15.392L223.93 93.93z"/><path fill="#FFCE00" style="mix-blend-mode:multiply" d="M268.625 106.557l46.332-26.75 46.332 26.75v53.5l-46.332 26.75-46.332-26.75z"/><circle fill="#7044FF" style="mix-blend-mode:multiply" cx="299.5" cy="9.5" r="38.5"/><rect fill="#11D3EA" style="mix-blend-mode:multiply" transform="rotate(-60 148.47 37.886)" x="143.372" y="-7.056" width="10.196" height="89.884" rx="5.098"/><path d="M-25.389 74.253l84.86 8.107c5.498.525 9.53 5.407 9.004 10.905a10 10 0 0 1-.057.477l-12.36 85.671a10.002 10.002 0 0 1-11.634 8.42l-86.351-15.226c-5.44-.959-9.07-6.145-8.112-11.584l13.851-78.551a10 10 0 0 1 10.799-8.219z" fill="#7044FF" style="mix-blend-mode:multiply"/><circle fill="#0CD1E8" style="mix-blend-mode:multiply" cx="273.5" cy="106.5" r="20.5"/></g></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,34 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Ionic App</title>
<base href="/" />
<meta name="color-scheme" content="light dark" />
<meta
name="viewport"
content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link
rel="shortcut icon"
type="image/png"
href="%PUBLIC_URL%/assets/icon/favicon.png"
/>
<!-- add to homescreen for ios -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-title" content="Ionic App" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
</head>
<body>
<div id="root"></div>
</body>
</html>

View File

@ -1,21 +0,0 @@
{
"short_name": "Dyomedea",
"name": "Dyomedea",
"icons": [
{
"src": "assets/icon/favicon.png",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "assets/icon/icon.png",
"type": "image/png",
"sizes": "512x512",
"purpose": "maskable"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#ffffff",
"background_color": "#ffffff"
}

1
setupVitest.ts Normal file
View File

@ -0,0 +1 @@
import '@testing-library/jest-dom';

33
src/App.module.css Normal file
View File

@ -0,0 +1,33 @@
.App {
text-align: center;
}
.logo {
animation: logo-spin infinite 20s linear;
height: 40vmin;
pointer-events: none;
}
.header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
.link {
color: #b318f0;
}
@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

View File

@ -1,72 +1,13 @@
import { IonApp, setupIonicReact } from '@ionic/react';
import type { Component } from 'solid-js';
import { Routes, Route, Navigate } from '@solidjs/router';
import Map from './components/map';
import store from './store/index';
import { Provider } from 'react-redux';
import { Suspense } from 'react';
import { PouchDB } from 'react-pouchdb';
/* Core CSS required for Ionic components to work properly */
import '@ionic/react/css/core.css';
/* Basic CSS for apps built with Ionic */
import '@ionic/react/css/normalize.css';
import '@ionic/react/css/structure.css';
import '@ionic/react/css/typography.css';
/* Optional CSS utils that can be commented out */
import '@ionic/react/css/padding.css';
import '@ionic/react/css/float-elements.css';
import '@ionic/react/css/text-alignment.css';
import '@ionic/react/css/text-transformation.css';
import '@ionic/react/css/flex-utils.css';
import '@ionic/react/css/display.css';
/* Theme variables */
import './theme/variables.css';
import Map from './components/map/map';
setupIonicReact();
// See https://stackoverflow.com/questions/71538643/property-wakelock-does-not-exist-on-type-navigator
const requestWakeLock = async () => {
const anyNav: any = navigator;
if ('wakeLock' in navigator) {
try {
const wakeLock = await anyNav['wakeLock'].request('screen');
} catch (err: any) {
// The wake lock request fails - usually system-related, such as low battery.
console.log(`Wake lock request failed: ${err.name}, ${err.message}`);
}
} else {
console.log('No wake lock support here...');
}
};
const handleVisibilityChange = () => {
if (document.hidden) {
console.log('Application hidden');
} else {
console.log('Application visible');
requestWakeLock();
}
};
// See https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API
document.addEventListener('visibilitychange', handleVisibilityChange, false);
requestWakeLock();
const App: React.FC = () => {
const App: Component = () => {
return (
<IonApp>
<Provider store={store}>
<PouchDB name='dyomedea' auto_compaction={true} revs_limit={10}>
<Suspense fallback='loading...'>
<Map />
</Suspense>
</PouchDB>
</Provider>
</IonApp>
<Routes>
<Route path='/map/:provider/:lon/:lat/:zoom/:rotation' component={Map} />
<Route path='/*' element={<Navigate href='/map/osm/0/0/2/0' />} />
</Routes>
);
};

View File

@ -1,12 +0,0 @@
import react, { Fragment } from 'react';
interface FormProps {
context: any;
validate: (ctx: any) => {};
}
const Form: react.FC<{}> = () => {
return <Fragment />;
};
export default Form;

View File

@ -0,0 +1,222 @@
import { Component, createSignal, For } from 'solid-js';
import PersonIcon from '@suid/icons-material/Person';
import {
Box,
Button,
DialogActions,
InputLabel,
ListItem,
ListItemButton,
ListItemIcon,
ListItemText,
NativeSelect,
TextField,
} from '@suid/material';
import { useI18n } from '@solid-primitives/i18n';
import Dialog from '../dialog';
import dispatch from '../../workers/dispatcher-main';
import { cloneDeep } from 'lodash';
import { getAccountById } from '../../db/account';
const Account: Component<{}> = (props) => {
const [t] = useI18n();
const [open, setOpen] = createSignal(false);
const [settings, setSettings] = createSignal<any>();
const [accounts, setAccounts] = createSignal<any>();
const [account, setAccount] = createSignal<any>({});
const handleClickOpen = async () => {
setOpen(true);
const newSettings: any = await dispatch({
action: 'getSettings',
});
setSettings(newSettings || {});
const newAccounts: any = await dispatch({
action: 'getAccounts',
});
console.log({
caller: 'Account / handleClickOpen',
newAccounts,
});
setAccounts([{ id: '--new--', name: t('newAccount') }, ...newAccounts]);
setAccount(
cloneDeep(getAccountById(accounts(), settings().currentAccountId))
);
console.log({
caller: 'Account / handleClickOpen',
settings: settings(),
accounts: accounts(),
});
};
const handleClose = (event: any, reason?: string) => {
console.log({
caller: 'Account / handleClose',
event,
reason,
});
if (reason === undefined) {
setOpen(false);
}
};
const changeAccountHandler = (event: any) => {
const selectedAccountId = event.target.value;
setAccount(cloneDeep(getAccountById(accounts(), selectedAccountId)));
console.log({
caller: 'Account / changeAccountHandler',
event,
selectedAccountId: selectedAccountId,
account: account(),
});
};
const changeHandlerFactory = (path: string) => (event: any) => {
const value = event.target.value;
const newAccount = cloneDeep(account());
newAccount[path] = value;
setAccount(newAccount);
console.log({
caller: 'Account / changeHandlerFactory / ' + path,
event,
value,
account: account(),
});
};
const saveHandler = async () => {
const updatedAccount = account();
if (updatedAccount.id === '--new--') {
updatedAccount.id = updatedAccount.name;
}
await dispatch({
action: 'putAccount',
params: { id: updatedAccount.id, account: updatedAccount },
});
const updatedSettings = {
...settings(),
currentAccountId: updatedAccount.id,
};
await dispatch({
action: 'putSettings',
params: { settings: updatedSettings },
});
console.log({
caller: 'Account / saveHandler',
account: account(),
updatedAccount,
settings: settings(),
updatedSettings,
});
handleClose();
location.reload();
};
const isValid = () => {
if (!account().localDb) {
return false;
}
//TODO: add more tests
return true;
};
return (
<>
<ListItem>
<ListItemButton onClick={handleClickOpen}>
<ListItemIcon>
<PersonIcon />
</ListItemIcon>
<ListItemText>Account</ListItemText>
</ListItemButton>
</ListItem>
<Dialog
open={open()}
title={t('account')}
closeHandler={handleClose}
fullScreen={true}
>
<Box
component='form'
sx={{
width: '100%',
'& .MuiTextField-root': { m: 1, width: '100%' },
paddingTop: '5px',
}}
noValidate
autoComplete='off'
>
<InputLabel variant='normal' htmlFor='account-chooser'>
{t('accountChooser')}
</InputLabel>
<NativeSelect
inputProps={{
name: 'account-chooser',
id: 'account-chooser',
}}
onChange={changeAccountHandler}
>
<For each={accounts()}>
{(account: any) => (
<option
value={account.id}
selected={account.id === settings().currentAccountId}
>
{account.name}
</option>
)}
</For>
</NativeSelect>
<TextField
label={t('accountName')}
value={account().name || ''}
onChange={changeHandlerFactory('name')}
/>
<TextField
label={t('localDb')}
value={account().localDb || ''}
onChange={changeHandlerFactory('localDb')}
/>
<TextField
label={t('remoteDbServer')}
value={account().remoteDbServer || ''}
onChange={changeHandlerFactory('remoteDbServer')}
/>
<TextField
label={t('remoteDbUser')}
value={account().remoteDbUser || ''}
onChange={changeHandlerFactory('remoteDbUser')}
/>
<TextField
label={t('remoteDbPassword')}
value={account().remoteDbPassword || ''}
onChange={changeHandlerFactory('remoteDbPassword')}
/>
</Box>
<DialogActions>
<Button
variant='contained'
disabled={!isValid()}
onClick={saveHandler}
>
{t('accountSave')}
</Button>
<Button variant='outlined' color='secondary' onClick={handleClose}>
{t('accountCancel')}
</Button>
</DialogActions>
</Dialog>
</>
);
};
export default Account;

View File

@ -0,0 +1 @@
export { default } from './Account';

View File

@ -0,0 +1,33 @@
import { Component, JSXElement } from 'solid-js';
import { Alert as MuiAlert } from '@suid/material';
import { AlertColor } from '@suid/material/Alert';
import Dialog from '../dialog';
interface Props {
open: boolean;
closeHandler: (event: any, reason?: string) => void;
severity?: AlertColor;
icon?: JSXElement;
action?: JSXElement;
children?: JSXElement;
}
const Alert: Component<Props> = ({
open,
closeHandler,
severity,
icon,
action,
children,
}) => {
return (
<Dialog open={open()} closeHandler={closeHandler} maxWidth={false}>
<MuiAlert severity={severity} icon={icon} action={action}>
{children}
</MuiAlert>
</Dialog>
);
};
export default Alert;

View File

@ -0,0 +1 @@
export { default } from './Alert';

View File

@ -0,0 +1,45 @@
import { Component, createEffect, For, onCleanup, Suspense } from 'solid-js';
import OlMap from 'ol/Map';
import Gpx from '../gpx';
import {
createCachedSignal,
destroyCachedSignal,
} from '../../workers/cached-signals';
interface Props {
map: () => OlMap | null;
}
export const AllGpxes: Component<Props> = ({ map }) => {
const params = {
id: 'gpx',
method: 'getAllGpxes',
};
const allGpxIds = createCachedSignal(params);
onCleanup(() => {
destroyCachedSignal(params);
});
createEffect(() => {
console.log({ caller: 'AllGpxes', allGpxes: allGpxIds(), map: map() });
});
return (
// @ts-ignore
<For each={allGpxIds()}>
{(gpxId: string) => {
console.log({ caller: 'AllGpxes / loop', gpxId });
return (
<Suspense>
<Gpx map={map} gpxId={gpxId} />
</Suspense>
);
}}
</For>
);
};
export default AllGpxes;

View File

@ -0,0 +1 @@
export { default } from './AllGpxes';

View File

@ -0,0 +1,16 @@
.common {
opacity: 1;
position: fixed !important;
top: 6px;
z-index: 1;
}
.back {
composes: common;
margin-left: 6px !important;
}
.forward {
composes: common;
margin-left: 40px !important;
}

View File

@ -0,0 +1,30 @@
import { Component, createEffect, createSignal } from 'solid-js';
import { IconButton } from '@suid/material';
import ArrowBackIcon from '@suid/icons-material/ArrowBack';
import ArrowForwardIcon from '@suid/icons-material/ArrowForward';
import styles from './BackForward.module.css';
export const Back: Component = () => {
const onClickHandler = (event: any) => {
window.history.back();
};
return (
<IconButton onClick={onClickHandler} class={styles.back}>
<ArrowBackIcon />
</IconButton>
);
};
export const Forward: Component = () => {
const onClickHandler = (event: any) => {
window.history.forward();
};
return (
<IconButton onClick={onClickHandler} class={styles.forward}>
<ArrowForwardIcon />
</IconButton>
);
};

View File

@ -0,0 +1 @@
export { Back, Forward } from './BackForward';

View File

@ -0,0 +1,54 @@
import { Component, JSXElement, Show } from 'solid-js';
import {
Dialog as MuiDialog,
DialogContent,
DialogTitle,
IconButton,
} from '@suid/material';
import CloseIcon from '@suid/icons-material/Close';
const Dialog: Component<{
open: boolean;
fullScreen?: boolean;
maxWidth?: boolean;
title?: JSXElement;
closeHandler: (event: any, reason?: string) => void;
children: JSXElement;
}> = (props) => {
return (
<MuiDialog
onClose={props.closeHandler}
open={props.open}
PaperProps={{ sx: { minWidth: '300px' } }}
fullScreen={props.fullScreen}
>
<Show when={props.title}>
<DialogTitle
sx={{
backgroundColor: 'rgba(14, 116, 144, 0.7)',
color: 'white',
clear: 'both',
margin: '0',
paddingLeft: '0',
}}
>
<IconButton onClick={props.closeHandler}>
<CloseIcon />
</IconButton>
{props.title}
</DialogTitle>
</Show>
<DialogContent
sx={{
width: 'calc(100% - 60px)',
paddingBottom:
props.maxWidth === undefined || props.maxWidth ? '2000px' : '2px',
}}
>
{props.children}
</DialogContent>
</MuiDialog>
);
};
export default Dialog;

View File

@ -0,0 +1 @@
export { default } from './Dialog';

View File

@ -0,0 +1,43 @@
import { IconButton } from '@suid/material';
import SearchIcon from '@suid/icons-material/Search';
import { Component, Show } from 'solid-js';
import { findAddress, getVillageOrTown } from '../../lib/osm';
import { cloneDeep } from 'lodash';
import { useI18n } from '@solid-primitives/i18n';
import dispatch from '../../workers/dispatcher-main';
interface Props {
wpt: () => Wpt;
dispatchParams: (wpt: Wpt) => { action: string; params: any };
}
const DisplayOrGetAddress: Component<Props> = ({ wpt, dispatchParams }) => {
const [t, { add, locale, dict }] = useI18n();
const findClickHandler = async () => {
console.log({ caller: 'findClickHandler', wpt: wpt() });
const address = await findAddress(wpt().$.lon, wpt().$.lat, locale);
const updatedTarget = cloneDeep(wpt());
if (updatedTarget.extensions === undefined) {
updatedTarget.extensions = {};
}
updatedTarget.extensions.address = address;
dispatch(dispatchParams(updatedTarget));
};
return (
<Show
when={wpt()?.extensions?.address}
fallback={
<IconButton color='primary' onClick={findClickHandler}>
<SearchIcon />
</IconButton>
}
>
<>{getVillageOrTown(wpt()?.extensions?.address)}</>
</Show>
);
};
export default DisplayOrGetAddress;

View File

@ -0,0 +1,36 @@
import { Component } from 'solid-js';
import { useI18n } from '@solid-primitives/i18n';
import DisplayOrGetAddress from '.';
interface Props {
id: string;
wpts: () => Wpt[];
putAction: string;
}
const DisplayOrGetStartEndAddresses: Component<Props> = (props) => {
const { id, wpts, putAction } = props;
const [t, { add, locale, dict }] = useI18n();
const dispatchParamsFactory = (index: number) => (wpt: Wpt) => ({
action: putAction,
params: { id, index, wpt },
});
return (
<>
{t('from')}{' '}
<DisplayOrGetAddress
wpt={() => wpts()?.at(0)}
dispatchParams={dispatchParamsFactory(0)}
/>{' '}
{t('to')}{' '}
<DisplayOrGetAddress
wpt={() => wpts()?.at(-1)}
dispatchParams={dispatchParamsFactory(-1)}
/>
</>
);
};
export default DisplayOrGetStartEndAddresses;

View File

@ -0,0 +1,2 @@
export { default } from './DisplayOrGetAddress';
export { default as DisplayOrGetStartEndAddresses } from './DisplayOrGetStartEndAddresses';

View File

@ -0,0 +1,222 @@
import { Component, createEffect } from 'solid-js';
import style from './index.module.css';
import Tree from '../tree/Tree';
import getUri from '../../lib/ids';
import { createCachedSignal } from '../../workers/cached-signals';
import { FormControlLabel, Radio, RadioGroup } from '@suid/material';
import { getDrawingSelections } from '../../db/drawing-selections';
import dispatch from '../../workers/dispatcher-main';
import { Feature } from 'ol';
import uri from '../../lib/ids';
import { currentGpxId } from '../gpx-dialog';
const id = getUri('drawingSelections', undefined);
type CompleteSelectionType = 'ALL' | 'NONE' | 'CURRENT';
type RestrictedSelectionType = 'ALL' | 'NONE';
type DrawingSelections = {
gpxSelection: CompleteSelectionType;
trkSelection: RestrictedSelectionType;
rteSelection: RestrictedSelectionType;
wptSelection: RestrictedSelectionType;
};
const defaultDrawingSelections: DrawingSelections = {
gpxSelection: 'ALL',
trkSelection: 'ALL',
rteSelection: 'ALL',
wptSelection: 'ALL',
};
const drawingSelections = createCachedSignal({
id,
method: 'getDrawingSelections',
defaultDrawingSelections,
}) as () => DrawingSelections;
createEffect(() => {
console.log({
caller: 'DrawingSelections',
drawingSelections: drawingSelections(),
});
});
const AllNoneCurrent: Component<{}> = (props) => {
return (
<>
<FormControlLabel
value='ALL'
control={<Radio />}
label='All'
></FormControlLabel>
<FormControlLabel
value='NONE'
control={<Radio />}
label='None'
></FormControlLabel>
<FormControlLabel
value='CURRENT'
control={<Radio />}
label='Current'
></FormControlLabel>
</>
);
};
const AllNone: Component<{}> = (props) => {
return (
<>
<FormControlLabel
value='ALL'
control={<Radio />}
label='All'
></FormControlLabel>
<FormControlLabel
value='NONE'
control={<Radio />}
label='None'
></FormControlLabel>
</>
);
};
const gpxSelection = () => drawingSelections().gpxSelection;
const gpxMustBeDrawn = (feature: Feature) => {
const id = feature.getId() as String;
if (gpxSelection() === 'ALL') {
return true;
}
if (gpxSelection() === 'CURRENT') {
return id.startsWith(currentGpxId());
}
return false;
};
const typeMustBeDrawn = (feature: Feature) => {
const type = feature.get('type') as String;
if (type.startsWith('trk')) {
return drawingSelections().trkSelection !== 'NONE';
}
if (type === 'wpt') {
return drawingSelections().wptSelection !== 'NONE';
}
if (type === 'rte') {
return drawingSelections().rteSelection !== 'NONE';
}
return true;
};
export const mustBeDrawn = (feature: Feature) => {
console.log({
caller: 'DrawingSelector / mustBeDrawn',
feature,
});
return gpxMustBeDrawn(feature) && typeMustBeDrawn(feature);
};
const handleGpxSelectionChange = (ev: any) => {
const value = ev.target.value;
console.log({
caller: 'DrawingSelector / handleGpxSelectionChange',
ev,
value,
});
const newDrawingSelections = drawingSelections();
newDrawingSelections.gpxSelection = value;
dispatch({
action: 'putDrawingSelections',
params: { id, drawingSelections: newDrawingSelections },
});
};
const handleTrkSelectionChange = (ev: any) => {
const value = ev.target.value;
console.log({
caller: 'DrawingSelector / handleTrkSelectionChange',
ev,
value,
});
const newDrawingSelections = drawingSelections();
newDrawingSelections.trkSelection = value;
dispatch({
action: 'putDrawingSelections',
params: { id, drawingSelections: newDrawingSelections },
});
};
const handleRteSelectionChange = (ev: any) => {
const value = ev.target.value;
console.log({
caller: 'DrawingSelector / handleRteSelectionChange',
ev,
value,
});
const newDrawingSelections = drawingSelections();
newDrawingSelections.rteSelection = value;
dispatch({
action: 'putDrawingSelections',
params: { id, drawingSelections: newDrawingSelections },
});
};
const handleWptSelectionChange = (ev: any) => {
const value = ev.target.value;
console.log({
caller: 'DrawingSelector / handleWptSelectionChange',
ev,
value,
});
const newDrawingSelections = drawingSelections();
newDrawingSelections.wptSelection = value;
dispatch({
action: 'putDrawingSelections',
params: { id, drawingSelections: newDrawingSelections },
});
};
const DrawingSelector: Component<{}> = (props) => {
return (
<Tree
title='Show'
content={
<>
<div>Trips</div>
<RadioGroup
defaultValue={drawingSelections()?.gpxSelection}
onChange={handleGpxSelectionChange}
>
<AllNoneCurrent />
</RadioGroup>
<div>Tracks</div>
<RadioGroup
defaultValue={drawingSelections()?.trkSelection}
onChange={handleTrkSelectionChange}
>
<AllNone />
</RadioGroup>
<div>Routes</div>
<RadioGroup
defaultValue={drawingSelections()?.rteSelection}
onChange={handleRteSelectionChange}
>
<AllNone />
</RadioGroup>{' '}
<div>Waypoints</div>
<RadioGroup
defaultValue={drawingSelections()?.wptSelection}
onChange={handleWptSelectionChange}
>
<AllNone />
</RadioGroup>
</>
}
subTree={undefined}
/>
);
};
export default DrawingSelector;

View File

@ -0,0 +1,3 @@
import { mustBeDrawn } from './DrawingSelector';
export { default, mustBeDrawn } from './DrawingSelector';

View File

@ -0,0 +1,56 @@
.control {
opacity: 1;
position: fixed !important;
top: 0px;
margin-left: calc(100% - 230px) !important;
z-index: 1;
}
.control_web {
opacity: 1;
position: fixed !important;
top: 0px;
margin-left: calc(100% - 190px) !important;
z-index: 1;
}
.ol_popup {
position: absolute;
background-color: white;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
padding: 15px;
border-radius: 10px;
border: 1px solid #cccccc;
bottom: 12px;
left: -50px;
min-width: 280px;
}
.ol_popup:after,
.ol_popup:before {
top: 100%;
border: solid transparent;
content: ' ';
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.ol_popup:after {
border-top-color: white;
border-width: 10px;
left: 48px;
margin-left: -10px;
}
.ol_popup:before {
border-top-color: #cccccc;
border-width: 11px;
left: 48px;
margin-left: -11px;
}
.ol_popup_closer {
text-decoration: none;
position: absolute;
top: 2px;
right: 8px;
}
.ol_popup_closer:after {
content: '✖';
}

View File

@ -0,0 +1,216 @@
import { Coordinate } from 'ol/coordinate';
import { Component, createEffect, createSignal } from 'solid-js';
import { useNavigate } from '@solidjs/router';
import SearchIcon from '@suid/icons-material/Search';
import { useI18n } from '@solid-primitives/i18n';
import proj4 from 'proj4';
import style from './Finder.module.css';
import './finder.css';
import { Box, Button, IconButton, TextField } from '@suid/material';
import Dialog from '../dialog';
import { getMap, getState } from '../map';
import { Overlay } from 'ol';
import { fromLonLat } from 'ol/proj';
import WptEditDialog from '../wpt/WptEditDialog';
import maybePlusCode from '../../lib/check-pluscodes';
import { decode, expand } from 'pluscodes';
const [popup, setPopup] = createSignal<Overlay>();
const [open, setOpen] = createSignal(false);
const [coordinate, setCoordinate] = createSignal<Coordinate>();
let popupElement: HTMLElement;
export const findLocation = (
navigate: (url: string) => void,
coordinate: Coordinate
) => {
setOpen(false);
if (popup() === undefined) {
setPopup(
new Overlay({
element: popupElement,
positioning: 'center-center',
})
);
}
console.log({
caller: 'Finder / submitHandler / popup',
coordinate,
popup: popup(),
popupElement,
});
setCoordinate(coordinate);
popup().setMap(getMap());
popup().setPosition(fromLonLat(coordinate));
getMap()?.addOverlay(popup());
navigate(
`/map/${getState().provider}/${coordinate[0]}/${coordinate[1]}/16/${
getState().rotation
}`
);
};
interface Props {}
const Finder: Component<Props> = (props) => {
const [searchString, setSearchString] = createSignal('');
const [popupContent, setPopupContent] = createSignal(<></>);
const [t, { add, locale, dict }] = useI18n();
const searchStringChangeHandler = (event: any) => {
setSearchString(event.target.value);
};
const navigate = useNavigate();
const popupCloseHandler = () => {
popup()?.setMap(null);
};
const submitHandler = () => {
setCoordinate(undefined);
const latLonRegExp = /(-?[0-9]+.[0-9]+)\s*,\s*(-?[0-9]+.[0-9]+)/;
const latLonMatch = searchString().match(latLonRegExp);
if (!!latLonMatch) {
setCoordinate([+latLonMatch[2], +latLonMatch[1]]);
setPopupContent(<>{latLonMatch[0]}</>);
console.log({
caller: 'Finder / submitHandler',
searchString: searchString(),
latLonMatch,
coordinate: coordinate(),
});
} else {
const utmRegExp = /([0-6]?[0-9])\s*([C-X])\s*([0-9]+)\s*([0-9]+)/;
const utmMatch = searchString().match(utmRegExp);
if (!!utmMatch) {
const utm = `+proj=utm +zone=${utmMatch[1]}`;
setCoordinate(proj4(utm, 'EPSG:4326', [+utmMatch[3], +utmMatch[4]]));
setPopupContent(
<>{`${coordinate()[0]}, ${coordinate()[1]} (UTM ${utmMatch[0]})`}</>
);
console.log({
caller: 'Finder / submitHandler',
searchString: searchString(),
utmMatch,
coordinate: coordinate(),
});
} else {
const potentialPlusCode = maybePlusCode(searchString());
if (!!potentialPlusCode) {
let plusCode = potentialPlusCode.code;
if (potentialPlusCode.isShort) {
plusCode = expand(potentialPlusCode.code, {
longitude: getState().lon,
latitude: getState().lat,
});
}
const plusCodeCoordinates = decode(plusCode);
if (plusCodeCoordinates) {
setCoordinate([
plusCodeCoordinates.longitude,
plusCodeCoordinates.latitude,
]);
}
console.log({
caller: 'Finder / submitHandler',
searchString: searchString(),
potentialPlusCode,
plusCode,
plusCodeCoordinates,
state: getState(),
coordinate: coordinate(),
});
} else {
console.log({
caller: 'Finder / submitHandler / no match found',
searchString: searchString(),
});
}
}
}
if (!!coordinate()) {
findLocation(navigate, coordinate());
}
};
const [openCreateWptDialog, setOpenCreateWptDialog] = createSignal(false);
const createWptCloseHandler = () => {
setOpenCreateWptDialog(false);
popupCloseHandler();
};
return (
<>
<div
class={
window.Capacitor.platform === 'web'
? style.control_web
: style.control
}
>
<IconButton
onClick={() => {
setOpen(true);
}}
>
<SearchIcon />
</IconButton>
</div>
<Dialog
closeHandler={() => {
setOpen(false);
}}
open={open()}
title={t('search')}
>
<Box
component='form'
sx={{
width: '100%',
'& .MuiTextField-root': { m: 1, width: '100%' },
paddingTop: '5px',
}}
noValidate
autoComplete='off'
onSubmit={submitHandler}
method='dialog'
>
<TextField onChange={searchStringChangeHandler} />
<Button variant='contained' onClick={submitHandler}>
Search
</Button>
</Box>
</Dialog>
<div class={style.ol_popup + ' ol_popup'} ref={popupElement}>
<a
href='#'
onclick={popupCloseHandler}
class={style.ol_popup_closer}
></a>
<div>
<div>{popupContent()}</div>
<div>
<Button
onClick={() => {
setOpenCreateWptDialog(true);
}}
>
New waypoint
</Button>
</div>
<WptEditDialog
open={openCreateWptDialog}
closeHandler={createWptCloseHandler}
coordinate={coordinate}
/>
</div>
</div>
</>
);
};
export default Finder;

View File

@ -0,0 +1,3 @@
.ol-map > .ol_popup {
visibility: hidden;
}

View File

@ -0,0 +1 @@
export { default, findLocation } from './Finder';

View File

@ -0,0 +1,7 @@
.getLocation {
opacity: 1;
margin-left: calc(50% - 20px) !important;
position: fixed !important;
z-index: 1;
bottom: 6px;
}

View File

@ -0,0 +1,41 @@
import { Component, createEffect, createSignal } from 'solid-js';
import { useNavigate } from '@solidjs/router';
import { Geolocation } from '@awesome-cordova-plugins/geolocation';
import style from './GetLocation.module.css';
import LocationSearchingIcon from '@suid/icons-material/LocationSearching';
import { IconButton } from '@suid/material';
import { getState } from '../map';
export const [getCurrentLocation, setCurrentLocation] = createSignal<{
lon: number;
lat: number;
} | null>(null);
const GetLocation: Component = () => {
const navigate = useNavigate();
const onClickHandler = (event: any) => {
console.log('Click handler');
Geolocation.getCurrentPosition().then((position) => {
console.log({ caller: 'GetLocation/onClickHandler', position });
const state = getState();
navigate(
`/map/${state.provider}/${position.coords.longitude}/${position.coords.latitude}/${state.zoom}/${state.rotation}`
);
setCurrentLocation({
lon: position.coords.longitude,
lat: position.coords.latitude,
});
});
};
//
return (
<IconButton class={style.getLocation} onClick={onClickHandler}>
<LocationSearchingIcon />
</IconButton>
);
};
export default GetLocation;

View File

@ -0,0 +1,12 @@
<svg height="24" width="24" xmlns="http://www.w3.org/2000/svg" version="1.1">
<circle
cx="12"
cy="12"
r="6"
fill='blue'
opacity='90%'
stroke='white'
stroke-width="4"
stroke-opacity='100%'
/>
</svg>

After

Width:  |  Height:  |  Size: 240 B

View File

@ -0,0 +1 @@
export { default, getCurrentLocation, setCurrentLocation } from './GetLocation';

View File

@ -0,0 +1,68 @@
import { useI18n } from '@solid-primitives/i18n';
import { FormControl, InputLabel, NativeSelect } from '@suid/material';
import { Component, createSignal, For } from 'solid-js';
import dispatch from '../../workers/dispatcher-main';
interface Props {
gpxId: () => string;
setGpxId: (id: string) => void;
disabled?: boolean;
}
const GpxChooser: Component<Props> = (props: Props) => {
const { gpxId, setGpxId, disabled } = props;
const [t] = useI18n();
const [allGpxes, setAllGpxes] = createSignal<any[]>([
{ id: 'new', name: t('newGpx'), creator: 'dyomedea' },
]);
dispatch(
{
action: 'getAllGpxesWithSummary',
},
(error, result) => {
console.log({
caller: 'GpxChooser / getAllGpxesWithSummary',
error,
result,
});
if (!error) {
setAllGpxes([
{ id: 'new', name: t('newGpx'), creator: 'dyomedea' },
...result,
]);
}
}
);
const gpxChangeHandler = async (event: any) => {
setGpxId(event.target.value);
};
return (
<FormControl disabled={disabled}>
<InputLabel variant='normal' htmlFor='gpx-chooser'>
{t('gpxChooser')}
</InputLabel>
<NativeSelect
inputProps={{
name: 'gpx-chooser',
id: 'gpx-chooser',
}}
onChange={gpxChangeHandler}
>
<For each={allGpxes()}>
{(gpx) => (
<option value={gpx.id} selected={gpx.id === gpxId()}>
{gpx.name || `${t('gpxNoName')} (${gpx.creator})`}
</option>
)}
</For>
</NativeSelect>
</FormControl>
);
};
export default GpxChooser;

View File

@ -0,0 +1 @@
export { default } from './GpxChooser';

View File

@ -0,0 +1,7 @@
.control {
opacity: 1;
position: fixed !important;
top: 0px;
margin-left: calc(100% - 150px) !important;
z-index: 1;
}

View File

@ -0,0 +1,253 @@
import { useI18n } from '@solid-primitives/i18n';
import {
Box,
Button,
FormControlLabel,
IconButton,
Radio,
RadioGroup,
SvgIcon,
TextField,
} from '@suid/material';
import { cloneDeep, isPlainObject } from 'lodash';
import { Component, createSignal, Show } from 'solid-js';
import { newEmptyGpx } from '../../db/gpx';
import { peekCachedSignal } from '../../workers/cached-signals';
import dispatch from '../../workers/dispatcher-main';
import Dialog from '../dialog';
import GpxChooser from '../gpx-chooser';
import GpxIcon from '../gpx/GpxIcon';
//import GpxesIcon from '../../icons/adventure-journey-location-svgrepo-com.svg';
import style from './GpxDialog.module.css';
import {
getTagValue,
getTagsFromObj,
setTagValue,
setTagsIntoObj,
} from '../../lib/tags/tags';
export const [currentGpxId, setCurrentGpxId] = createSignal<string>('new');
const GpxDialog: Component<{}> = (props) => {
const [t] = useI18n();
const [open, setOpen] = createSignal(false);
const [selectedGpxId, setSelectedGpxId] = createSignal<string>('');
const [gpx, setGpx] = createSignal<Gpx>();
const [currentAccount, setCurrentAccount] = createSignal<any>();
console.log({ caller: 'GpxDialog', currentGpxId: currentGpxId() });
const fetchGpx = (gpxId: string) => {
if (gpxId === 'new' || !gpxId) {
return newEmptyGpx();
}
const newGpx = peekCachedSignal({
id: gpxId,
action: 'getGpx',
});
return newGpx();
};
dispatch({ action: 'getCurrentAccount' }).then((currentAccount: any) => {
console.log({ caller: 'GpxDialog / currentAccount', currentAccount });
setCurrentAccount(currentAccount);
setCurrentGpxId(currentAccount.currentGpxId || 'new');
setSelectedGpxId(currentAccount.currentGpxId || 'new');
});
const handleClickOpen = async () => {
setOpen(true);
setGpx(fetchGpx(currentGpxId()) as Gpx);
console.log({
caller: 'GpxDialog / handleClickOpen',
currentGpxId: currentGpxId(),
gpx: gpx(),
});
};
const handleClose = (event: any, reason?: string) => {
console.log({
caller: 'GpxDialog / handleClose',
event,
reason,
});
if (reason === undefined) {
setOpen(false);
}
};
const gpxChangeHandler = async (gpxId: string) => {
setSelectedGpxId(gpxId);
setGpx(fetchGpx(gpxId) as Gpx);
console.log({
caller: 'GpxDialog / gpxChangeHandler',
gpxId,
gpx: gpx(),
});
};
const gpxNameChangeHandler = (event: any) => {
const newGpx: Gpx = cloneDeep(gpx()) as Gpx;
if (newGpx.metadata === undefined) {
newGpx.metadata = {};
}
newGpx.metadata.name = event.target.value;
setGpx(newGpx);
console.log({
caller: 'GpxDialog / gpxNameChangeHandler',
value: event.target.value,
gpx: gpx(),
});
};
const gpxDescChangeHandler = (event: any) => {
const newGpx: Gpx = cloneDeep(gpx()) as Gpx;
if (newGpx.metadata === undefined) {
newGpx.metadata = {};
}
newGpx.metadata.desc = event.target.value;
setGpx(newGpx);
console.log({
caller: 'GpxDialog / gpxDescChangeHandler',
value: event.target.value,
gpx: gpx(),
});
};
const gpxToChangeHandler = (event: any) => {
const newGpx: Gpx = cloneDeep(gpx()) as Gpx;
if (!isPlainObject(newGpx.extensions)) {
newGpx.extensions = {};
}
newGpx.extensions.to = event.target.value;
setGpx(newGpx);
console.log({
caller: 'GpxDialog / gpxToChangeHandler',
value: event.target.value,
gpx: gpx(),
newGpx,
});
};
const gpxTimeChangeHandler = (event: any) => {
const newGpx: Gpx = cloneDeep(gpx()) as Gpx;
if (newGpx.metadata === undefined) {
newGpx.metadata = {};
}
newGpx.metadata.time = new Date(event.target.value).toISOString();
setGpx(newGpx);
console.log({
caller: 'GpxDialog / gpxTimeChangeHandler',
value: event.target.value,
gpx: gpx(),
});
};
const getGpxTagValue = (tagName: string, defaultValue: string) => {
return getTagValue(getTagsFromObj(gpx()), tagName) || defaultValue;
};
const gpxLocomotionChangeHandler = (event: any) => {
const newGpx: Gpx = cloneDeep(gpx()) as Gpx;
const tags = getTagsFromObj(newGpx);
setTagValue(tags, 'locomotion', event.target.value);
setTagsIntoObj(newGpx, tags);
setGpx(newGpx);
};
const saveHandler = async (event: any) => {
const id = (await dispatch({
action: 'putGpx',
params: {
id: selectedGpxId(),
gpx: gpx(),
},
})) as string;
setCurrentGpxId(id);
setOpen(false);
await dispatch({
action: 'putCurrentAccount',
params: {
account: { ...currentAccount(), currentGpxId: currentGpxId() },
},
});
};
return (
<>
<div class={style.control}>
<IconButton onClick={handleClickOpen}>
<GpxIcon />
</IconButton>
</div>
<Dialog
open={open()}
title={t('gpxDialog')}
closeHandler={handleClose}
fullScreen={true}
>
<Box
component='form'
sx={{
width: '100%',
'& .MuiTextField-root': { m: 1, width: '100%' },
paddingTop: '5px',
}}
noValidate
autoComplete='off'
>
<GpxChooser gpxId={selectedGpxId} setGpxId={gpxChangeHandler} />
<Show when={gpx() != undefined}>
<TextField
label={t('gpxName')}
value={gpx()?.metadata?.name || ''}
onChange={gpxNameChangeHandler}
/>
<TextField
label={t('gpxTime')}
type='datetime-local'
value={(gpx()?.metadata?.time || '').replace('Z', '')}
onChange={gpxTimeChangeHandler}
/>
<TextField
label={t('gpxDesc')}
multiline={true}
rows={5}
value={gpx()?.metadata?.desc || ''}
onChange={gpxDescChangeHandler}
InputProps={{ inputComponent: 'textarea' }}
/>
<div>Locomotion</div>
<RadioGroup
value={getGpxTagValue('locomotion', 'hiking')}
onChange={gpxLocomotionChangeHandler}
>
<FormControlLabel
value='hiking'
control={<Radio />}
label='Hiking'
></FormControlLabel>
<FormControlLabel
value='cycling'
control={<Radio />}
label='Cycling'
></FormControlLabel>
</RadioGroup>
<TextField
label={t('gpxTo')}
multiline={true}
rows={5}
value={gpx()?.extensions?.to || ''}
onChange={gpxToChangeHandler}
InputProps={{ inputComponent: 'textarea' }}
/>
<Button variant='contained' onClick={saveHandler}>
{t('gpxSave')}
</Button>
</Show>
</Box>
</Dialog>
</>
);
};
export default GpxDialog;

View File

@ -0,0 +1 @@
export { default, currentGpxId, setCurrentGpxId } from './GpxDialog';

View File

@ -0,0 +1,7 @@
.control {
opacity: 1;
position: fixed !important;
top: 0px;
margin-left: calc(100% - 190px) !important;
z-index: 1;
}

View File

@ -0,0 +1,215 @@
import {
Box,
Button,
DialogActions,
IconButton,
Typography,
} from '@suid/material';
import FiberManualRecordIcon from '@suid/icons-material/FiberManualRecord';
import { Component, createEffect, createSignal, Show } from 'solid-js';
import style from './GpxRecord.module.css';
import Dialog from '../dialog';
import { useI18n } from '@solid-primitives/i18n';
import GpxChooser from '../gpx-chooser';
import { currentGpxId } from '../gpx-dialog';
import {
startBackgroundGeolocation,
stopBackgroundGeolocation,
} from '../../lib/background-geolocation';
import dispatch from '../../workers/dispatcher-main';
import { emptyTrk } from '../../db/trk';
import getUri from '../../lib/ids';
import { setCurrentLocation } from '../get-location/GetLocation';
import { getState } from '../map';
import { useNavigate } from '@solidjs/router';
declare global {
var $lastValidLocationTime: number;
}
const GpxRecord: Component<{}> = (props) => {
const [t] = useI18n();
const navigate = useNavigate();
const [state, setState] = createSignal('stopped');
const [open, setOpen] = createSignal(false);
const [watcherId, setWatcherId] = createSignal();
const [gpxId, setGpxId] = createSignal<string>('');
const [trksegId, setTrksegId] = createSignal<IdTrkseg>();
const newLocationHandler = async (location: any) => {
console.log(
`Location filtering, elapsed time: ${
location.time - globalThis.$lastValidLocationTime
}`
);
if (
location.accuracy < 10 &&
location.time - globalThis.$lastValidLocationTime > 15000
) {
globalThis.$lastValidLocationTime = location.time;
await dispatch({
action: 'appendTrkpt',
params: {
trksegIdObj: trksegId(),
trkpt: {
$: {
lat: location.latitude,
lon: location.longitude,
},
ele: location.altitude,
time: new Date(location.time).toISOString(),
extensions: {
speed: location.speed,
accuracy: location.accuracy,
},
},
},
});
setCurrentLocation({ lon: location.longitude, lat: location.latitude });
const state = getState();
navigate(
`/map/${state.provider}/${location.longitude}/${location.latitude}/${state.zoom}/${state.rotation}`
);
}
};
const handleClickOpen = () => {
if (state() === 'stopped') {
setGpxId(currentGpxId());
}
setOpen(true);
};
const handleClose = () => {
setOpen(false);
};
const startRecordingHandler = async () => {
const trkId = await dispatch({
action: 'appendTrk',
params: { gpxId: gpxId(), trk: emptyTrk },
});
const trkIdObj = getUri('trk', trkId);
setTrksegId({ ...trkIdObj, trkseg: 0 });
globalThis.$lastValidLocationTime = 0;
const id = await startBackgroundGeolocation(newLocationHandler, 10);
setWatcherId(id);
setState('recording');
setOpen(false);
};
const pauseRecordingHandler = () => {
stopBackgroundGeolocation(watcherId());
setState('paused');
setOpen(false);
};
const resumeRecordingHandler = async () => {
setTrksegId({ ...trksegId()!, trkseg: trksegId()!.trkseg + 1 });
const id = await startBackgroundGeolocation(newLocationHandler, 10);
setWatcherId(id);
setState('recording');
setOpen(false);
};
const stopRecordingHandler = () => {
stopBackgroundGeolocation(watcherId());
setState('stopped');
setOpen(false);
};
return (
<>
<div class={style.control}>
<IconButton onClick={handleClickOpen}>
<FiberManualRecordIcon
color={
state() === 'recording'
? 'error'
: state() === 'paused'
? 'primary'
: 'inherit'
}
/>
</IconButton>
</div>
<Dialog open={open()} title={t('gpxRecord')} closeHandler={handleClose}>
<Box
sx={{
width: '100%',
paddingTop: '10px',
paddingBottom: '10px',
}}
>
<GpxChooser
gpxId={gpxId}
setGpxId={setGpxId}
disabled={state() !== 'stopped'}
/>
<Typography sx={{ paddingTop: '20px' }} variant='h6'>
{t(`gpx_${state()}`)}
</Typography>
<Show when={state() === 'stopped'}>
<Button
color='primary'
variant='contained'
onClick={startRecordingHandler}
disabled={gpxId() === 'new'}
sx={{
width: '100%',
margin: '10px',
}}
>
{t('gpxStartRecording')}
</Button>
</Show>
<Show when={state() === 'recording'}>
<Button
color='primary'
variant='contained'
onClick={pauseRecordingHandler}
sx={{
width: '100%',
margin: '10px',
}}
>
{t('gpxPauseRecording')}
</Button>
<Button
color='warning'
variant='contained'
onClick={stopRecordingHandler}
sx={{
width: '100%',
margin: '10px',
}}
>
{t('gpxStopRecording')}
</Button>
</Show>
<Show when={state() === 'paused'}>
<Button
color='primary'
variant='contained'
onClick={resumeRecordingHandler}
sx={{
width: '100%',
margin: '10px',
}}
>
{t('gpxResumeRecording')}
</Button>
<Button
color='warning'
variant='contained'
onClick={stopRecordingHandler}
sx={{
width: '100%',
margin: '10px',
}}
>
{t('gpxStopRecording')}
</Button>
</Show>
</Box>
</Dialog>
</>
);
};
export default GpxRecord;

View File

@ -0,0 +1 @@
export { default } from './GpxRecord';

114
src/components/gpx/Gpx.tsx Normal file
View File

@ -0,0 +1,114 @@
import { Component, createEffect, For, onCleanup, Suspense } from 'solid-js';
import OlMap from 'ol/Map';
import Trk from '../trk';
import VectorSource from 'ol/source/Vector';
import VectorLayer from 'ol/layer/Vector';
import style from './styles';
import Wpt from '../wpt';
import Rte from '../rte';
import {
createCachedSignal,
destroyCachedSignal,
} from '../../workers/cached-signals';
import { getTagsFromObj } from '../../lib/tags/tags';
interface Props {
gpxId: string;
map: () => OlMap | null;
}
export const Gpx: Component<Props> = ({ map, gpxId }) => {
const params = {
id: gpxId,
method: 'getGpx',
};
const gpx = createCachedSignal(params);
onCleanup(() => {
console.log({
caller: 'Gpx / onCleanup',
gpxId,
gpx: gpx(),
params,
});
destroyCachedSignal(params);
});
const vectorSources = [new VectorSource(), new VectorSource()];
const vectorLayers = [
new VectorLayer({
source: vectorSources[0],
style,
declutter: true,
zIndex: 1,
}),
new VectorLayer({
source: vectorSources[1],
style,
declutter: false,
zIndex: 2,
}),
];
createEffect(() => {
map()?.addLayer(vectorLayers[0]);
map()?.addLayer(vectorLayers[1]);
});
createEffect(() => {
console.log({ caller: 'Gpx', map: map(), gpxId, gpx: gpx(), vectorLayers });
});
return (
<>
<For each={gpx() ? gpx().trk || [] : []}>
{(trkId: string) => {
console.log({ caller: 'Gpx / loop', trkId });
return (
<Suspense>
<Trk
vectorSources={vectorSources}
trkId={trkId}
context={{ gpx, gpxId }}
tags={getTagsFromObj(gpx())}
/>
</Suspense>
);
}}
</For>
<For each={gpx() ? gpx().rte || [] : []}>
{(rteId: string) => {
console.log({ caller: 'Gpx / loop', rteId });
return (
<Suspense>
<Rte
vectorSources={vectorSources}
rteId={rteId}
context={{ gpx, gpxId }}
/>
</Suspense>
);
}}
</For>
<For each={gpx() ? gpx().wpt || [] : []}>
{(wptId: string) => {
console.log({ caller: 'Gpx / loop', wptId });
return (
<Suspense>
<Wpt
vectorSources={vectorSources}
wptId={wptId}
context={{ gpx, gpxId }}
/>
</Suspense>
);
}}
</For>
</>
);
};
export default Gpx;

View File

@ -0,0 +1,32 @@
import { SvgIcon } from '@suid/material';
import { Component } from 'solid-js';
const GpxIcon: Component<{}> = (props) => {
return (
<SvgIcon>
<svg
viewBox='0 0 170 170'
width='64px'
height='64px'
version='1.1'
style='stroke-width: 1%; stroke:black'
xml:space='preserve'
xmlns='http://www.w3.org/2000/svg'
xmlns:xlink='http://www.w3.org/1999/xlink'
>
<g>
<path d='M63.5,16c-0.3-0.2-0.7-0.3-1-0.1l-20.4,7.3l-14.3-5.2c0.8-2,1.2-3.8,1.2-5.3c0-2.7-1-5.1-2.9-7c-1.9-1.9-4.4-2.9-7-2.9 c-5.5,0-9.9,4.4-9.9,9.9c0,1.9,0.7,4.2,1.9,7L0.7,23.2c-0.4,0.2-0.7,0.6-0.7,1v36c0,0.4,0.2,0.7,0.5,0.9c0.2,0.1,0.4,0.2,0.6,0.2 c0.1,0,0.3,0,0.4-0.1L21.9,54l19.8,7.3c0.2,0.1,0.5,0.1,0.7,0l20.8-7.4c0.4-0.2,0.7-0.6,0.7-1v-36C64,16.5,63.8,16.2,63.5,16z M19.1,4.8c2.1,0,4,0.8,5.4,2.3c0,0,0,0,0,0c1.5,1.4,2.3,3.4,2.3,5.4c0,1.4-0.5,3.3-1.5,5.5c-1.8,4-4.8,8.2-6.2,10.1 c-0.2-0.2-0.3-0.4-0.5-0.7c-1.3-1.8-3.4-4.8-4.9-7.9c-1.5-2.9-2.2-5.3-2.2-7.1C11.4,8.3,14.9,4.8,19.1,4.8z M61.8,52.1l-19.7,7 l-19.8-7.3c-0.1,0-0.3-0.1-0.4-0.1c-0.1,0-0.3,0-0.4,0.1L2.2,58.7V25l10-3.5c0,0,0,0,0,0.1c0.1,0.1,0.1,0.2,0.2,0.3 c0.1,0.2,0.2,0.4,0.3,0.6c0.1,0.1,0.1,0.2,0.2,0.3c0.1,0.2,0.2,0.4,0.3,0.6c0.1,0.1,0.1,0.2,0.2,0.3c0.1,0.2,0.2,0.4,0.3,0.5 c0.1,0.1,0.1,0.2,0.2,0.3c0.1,0.2,0.2,0.3,0.3,0.5c0.1,0.1,0.1,0.2,0.2,0.3c0.1,0.2,0.2,0.3,0.3,0.5c0.1,0.1,0.1,0.2,0.2,0.3 c0.1,0.2,0.2,0.3,0.3,0.5c0.1,0.1,0.1,0.2,0.2,0.3c0.1,0.2,0.2,0.3,0.3,0.5c0.1,0.1,0.1,0.2,0.2,0.2c0.1,0.2,0.2,0.3,0.3,0.4 c0,0.1,0.1,0.1,0.1,0.2c0.1,0.2,0.2,0.3,0.3,0.4c0,0,0.1,0.1,0.1,0.1c0.1,0.1,0.2,0.3,0.3,0.4c0,0,0.1,0.1,0.1,0.1 c0.1,0.1,0.2,0.3,0.3,0.4c0,0,0,0,0,0c0.1,0.1,0.2,0.2,0.3,0.3c0,0,0,0,0,0c0.2,0.3,0.4,0.5,0.4,0.6c0.2,0.3,0.5,0.4,0.9,0.4 c0.3,0,0.6-0.2,0.9-0.4c0,0,0.1-0.1,0.3-0.3c0,0,0.1-0.1,0.1-0.1c0.1-0.1,0.1-0.1,0.2-0.2c0,0,0.1-0.1,0.1-0.1 c0.1-0.1,0.1-0.2,0.2-0.3c0-0.1,0.1-0.1,0.1-0.2c0.1-0.1,0.2-0.2,0.2-0.3c0.1-0.1,0.1-0.2,0.2-0.3c0.1-0.1,0.2-0.2,0.3-0.4 c0.1-0.1,0.1-0.2,0.2-0.3c0.1-0.1,0.2-0.2,0.3-0.4c0.1-0.1,0.2-0.2,0.2-0.3c0.1-0.1,0.2-0.3,0.3-0.4c0.1-0.1,0.2-0.3,0.3-0.4 c0.1-0.1,0.2-0.3,0.3-0.4c0.1-0.1,0.2-0.3,0.3-0.4c0.1-0.2,0.2-0.3,0.3-0.5c0.1-0.1,0.2-0.3,0.3-0.4c0.1-0.2,0.2-0.3,0.3-0.5 c0.1-0.2,0.2-0.3,0.3-0.5c0.1-0.2,0.2-0.3,0.3-0.5c0.1-0.2,0.2-0.3,0.3-0.5c0.1-0.2,0.2-0.3,0.3-0.5c0.1-0.2,0.2-0.3,0.3-0.5 c0.1-0.2,0.2-0.3,0.3-0.5c0.1-0.2,0.2-0.3,0.3-0.5c0.1-0.2,0.2-0.4,0.3-0.5c0.1-0.2,0.2-0.3,0.2-0.5c0,0,0,0,0-0.1l14.8,5.4 c0.2,0.1,0.5,0.1,0.7,0l19.3-6.9V52.1z' />
<path d='M52.5,42.4c0.2,0.1,0.5,0.1,0.7,0.1c0.6,0,1.2-0.2,1.7-0.5c0.7-0.5,1.2-1.2,1.4-2c0.2-0.8,0-1.7-0.4-2.4 c-0.5-0.7-1.2-1.2-2-1.4c-1.7-0.4-3.5,0.7-3.9,2.4v0c-0.2,0.8,0,1.7,0.4,2.4C51,41.7,51.7,42.2,52.5,42.4z M52.2,39 c0.1-0.6,0.7-0.9,1.2-0.8c0.3,0.1,0.5,0.2,0.6,0.5c0.1,0.2,0.2,0.5,0.1,0.8c-0.1,0.3-0.2,0.5-0.5,0.6c-0.2,0.1-0.5,0.2-0.8,0.1 c-0.3-0.1-0.5-0.2-0.6-0.5C52.2,39.5,52.2,39.3,52.2,39z' />
<path d='M11,39.1l-0.7,0.4l-0.4-0.7c-0.3-0.5-1-0.7-1.5-0.3c-0.5,0.3-0.7,1-0.3,1.5l0.4,0.7l-0.7,0.4c-0.5,0.3-0.7,1-0.3,1.5 C7.6,43,8,43.1,8.3,43.1c0.2,0,0.4-0.1,0.6-0.2l0.7-0.4l0.4,0.7c0.2,0.3,0.6,0.5,0.9,0.5c0.2,0,0.4-0.1,0.6-0.2 c0.5-0.3,0.7-1,0.3-1.5l-0.4-0.7l0.7-0.4c0.5-0.3,0.7-1,0.3-1.5C12.2,38.9,11.5,38.8,11,39.1z' />
<path d='M21.3,42.1c-1.3,0-3-0.2-4.1-0.5c-0.6-0.1-1.2,0.3-1.3,0.9c-0.1,0.6,0.3,1.2,0.9,1.3c1.1,0.2,2.9,0.5,4.5,0.5c0,0,0,0,0,0 c0.6,0,1.1-0.5,1.1-1.1C22.4,42.6,21.9,42.1,21.3,42.1z' />
<path d='M29.5,38.3c-0.7,1-1.5,1.8-2.5,2.4c-0.3,0.2-0.7,0.4-1.1,0.6c-0.6,0.2-0.8,0.9-0.6,1.5c0.2,0.4,0.6,0.7,1,0.7 c0.1,0,0.3,0,0.4-0.1c0.5-0.2,0.9-0.4,1.3-0.7c1.2-0.8,2.2-1.7,3.1-2.9c0.4-0.5,0.3-1.2-0.2-1.5C30.6,37.7,29.9,37.8,29.5,38.3z' />
<path d='M37.5,31.1c-1.1,0-1.7,0.3-2.3,0.5c-1.4,0.6-2.6,1.9-2.9,2.3c-0.4,0.5-0.3,1.2,0.1,1.6c0.2,0.2,0.5,0.3,0.7,0.3 c0.3,0,0.6-0.1,0.8-0.4c0.5-0.6,1.3-1.3,2.1-1.7c0.6-0.2,0.8-0.3,1.5-0.4c0.6,0,1.1-0.5,1.1-1.1C38.6,31.6,38.1,31.1,37.5,31.1z' />
<path d='M41.6,32.8c-0.2,0.6,0,1.2,0.6,1.5c1.1,0.5,2.7,1.3,3.9,2.2c0.2,0.1,0.4,0.2,0.6,0.2c0.4,0,0.7-0.2,0.9-0.5 c0.3-0.5,0.2-1.2-0.3-1.5c-1.4-0.9-3-1.8-4.3-2.3C42.5,32,41.9,32.3,41.6,32.8z' />
<path d='M19.1,15.2c1.9,0,3.4-1.5,3.4-3.4S21,8.4,19.1,8.4c-1.9,0-3.4,1.5-3.4,3.4S17.3,15.2,19.1,15.2z M19.1,10.6 c0.6,0,1.2,0.5,1.2,1.2c0,0.6-0.5,1.2-1.2,1.2c-0.6,0-1.2-0.5-1.2-1.2C18,11.2,18.5,10.6,19.1,10.6z' />
</g>
</svg>
</SvgIcon>
);
};
export default GpxIcon;

View File

@ -0,0 +1,61 @@
import { Component, For } from 'solid-js';
import { peekCachedSignal } from '../../workers/cached-signals';
import { RteViewer } from '../rte';
import Tree from '../tree';
import { TrkViewer } from '../trk';
import { WptViewer } from '../wpt';
import GpxIcon from './GpxIcon';
interface Props {
gpxId: string;
restrictToHierarchy?: any;
}
const GpxViewer: Component<Props> = ({ gpxId, restrictToHierarchy }) => {
const gpx = peekCachedSignal({ id: gpxId, action: 'getGpx' });
console.log({ caller: 'GpxViewer', gpxId, restrictToHierarchy, gpx: gpx() });
const title = () => {
return gpx().metadata.name;
};
return (
<Tree
title={
<>
<span>
{' '}
<GpxIcon /> {title()}
</span>
</>
}
content={undefined}
subTree={
<For
each={Object.keys(restrictToHierarchy).filter(
(key: string) =>
key.startsWith('gpx/') &&
(gpx().trk?.includes(key) ||
gpx().wpt?.includes(key) ||
gpx().rte?.includes(key))
)}
>
{(key: string) => {
const child = restrictToHierarchy[key];
if (child.type === 'wpt') {
return <WptViewer wptId={key} />;
}
if (child.type === 'rte') {
return <RteViewer rteId={key} />;
}
if (child.type === 'trk') {
return <TrkViewer trkId={key} restrictToHierarchy={child} />;
}
return <></>;
}}
</For>
}
/>
);
};
export default GpxViewer;

View File

@ -0,0 +1,5 @@
export { default } from './Gpx';
export { default as GpxViewer } from './GpxViewer';
export { default as GpxIcon } from './GpxIcon';

View File

@ -0,0 +1,146 @@
import atm from '../../icons/osm/atm_euro.svg';
import bar from '../../icons/osm/bar.svg';
import cafe from '../../icons/osm/cafe.svg';
import fast_food from '../../icons/osm/fastfood.svg';
import pub from '../../icons/osm/pub.svg';
import restaurant from '../../icons/osm/restaurant.svg';
import bank from '../../icons/osm/bank_euro.svg';
import doctors from '../../icons/osm/doctors.svg';
import hospital from '../../icons/osm/hospital.svg';
import pharmacy from '../../icons/osm/pharmacie.svg';
import police from '../../icons/osm/police2.svg';
import fire_station from '../../icons/osm/firestation.svg';
import drinking_water from '../../icons/osm/drinking_water.svg';
import waste_basket from '../../icons/osm/waste_basket.svg';
import waste_disposal from '../../icons/osm/waste_disposal.svg';
import vending_machine from '../../icons/osm/vending_machine.svg';
import bakery from '../../icons/osm/bakery.svg';
import butcher from '../../icons/osm/butcher2.svg';
//import cheese from '../../icons/osm/cheese.svg';
//import chocolate from '../../icons/osm/chocolate.svg';
import dairy from '../../icons/osm/dairy.svg';
//import farm from '../../icons/osm/farm.svg';
import greengrocer from '../../icons/osm/greengrocer.svg';
//import health_food from '../../icons/osm/health_food.svg';
//import pasta from '../../icons/osm/pasta.svg';
//import pastry from '../../icons/osm/pastry.svg';
import seafood from '../../icons/osm/seafood.svg';
//import water from '../../icons/osm/water.svg';
import department_store from '../../icons/osm/department_store.svg';
//import general from '../../icons/osm/general.svg';
//import mall from '../../icons/osm/mall.svg';
import supermarket from '../../icons/osm/supermarket.svg';
//import wholesale from '../../icons/osm/wholesale.svg';
import outdoor from '../../icons/osm/outdoor.svg';
import laundry from '../../icons/osm/laundry.svg';
import convenience from '../../icons/osm/convenience.svg';
import hotel from '../../icons/osm/hotel2.svg';
import alpine_hut from '../../icons/osm/alpinehut.svg';
import apartment from '../../icons/osm/apartment.svg';
import camp_site from '../../icons/osm/camping.svg';
import chalet from '../../icons/osm/chalet.svg';
import guest_house from '../../icons/osm/guest_house.svg';
import hostel from '../../icons/osm/hostel.svg';
import motel from '../../icons/osm/motel.svg';
import wilderness_hut from '../../icons/osm/wilderness_hut.svg';
import viewpoint from '../../icons/osm/view_point.svg';
import waterfall from '../../icons/osm/waterfall.svg';
import cave_entrance from '../../icons/osm/cave.svg';
import volcano from '../../icons/osm/volcano.png';
import glacier from '../../icons/osm/glacier.png';
import peak from '../../icons/osm/peak.svg';
import arete from '../../icons/osm/arete2.svg';
import rock from '../../icons/osm/rock.svg';
import saddle from '../../icons/osm/saddle.svg';
import stone from '../../icons/osm/stone.svg';
import spring from '../../icons/osm/spring.svg';
import fumarole from '../../icons/osm/eruption-svgrepo-com.svg';
import parking from '../../icons/osm/parking.svg';
import bicycle_parking from '../../icons/osm/parking_bicycle.svg';
export const osmIcons = {
parking,
bicycle_parking,
bar,
fast_food,
food_court: fast_food,
pub,
restaurant,
cafe,
atm,
bank,
doctors,
hospital,
pharmacy,
police,
fire_station,
drinking_water,
water_point: drinking_water,
waste_basket,
waste_disposal,
vending_machine: convenience,
bakery,
butcher,
cheese: dairy,
chocolate: bakery,
convenience,
dairy,
farm: convenience,
greengrocer,
health_food: convenience,
pasta: dairy,
pastry: bakery,
seafood,
water: drinking_water,
department_store,
general: department_store,
mall: department_store,
supermarket,
wholesale: supermarket,
outdoor,
laundry,
hotel,
alpine_hut,
apartment,
camp_site,
chalet,
guest_house,
hostel,
motel,
wilderness_hut,
viewpoint,
waterfall,
peak,
cave_entrance,
volcano,
arete,
rock,
saddle,
stone,
glacier,
spring,
fumarole,
hot_spring: fumarole,
geyser: fumarole,
arch: cave_entrance,
sinkhole: cave_entrance,
};
export const highlight = {
hotel,
alpine_hut,
apartment,
camp_site,
chalet,
guest_house,
hostel,
motel,
wilderness_hut,
};
export default osmIcons;

View File

@ -0,0 +1,703 @@
import { Fill, Text, Icon, Stroke, Style, Circle } from 'ol/style';
import wptIcon from '../../icons/location-pin-svgrepo-com-green.svg';
import houseIcon from '../../icons/house-svgrepo-com.svg';
import houseFlatIcon from '../../icons/houseFlat-svgrepo-com.svg';
import campingIcon from '../../icons/camping-14-svgrepo-com.svg';
import farmPigIcon from '../../icons/farm-pig-svgrepo-com.svg';
import cheeseIcon from '../../icons/cheese-svgrepo-com.svg';
import trainIcon from '../../icons/train-svgrepo-com.svg';
import picnicIcon from '../../icons/picnic-svgrepo-com.svg';
import caveIcon from '../../icons/cave-entrance-svgrepo-com.svg';
import hikerIcon from '../../icons/hiker-svgrepo-com.svg';
import cycleIcon from '../../icons/bicycle-man-svgrepo-com.svg';
import blackArrowheadPointingUp from '../../icons/black-arrowhead-pointing-up-svgrepo-com.svg';
import noteIcon from '../../icons/note-svgrepo-com.svg';
import { Feature } from 'ol';
import memoize from 'memoizee';
import { getMap } from '../map';
import { Point } from 'ol/geom';
import { Coordinate } from 'ol/coordinate';
import { createDefaultStyle } from 'ol/style/Style';
import osmIcons from './osm-icons';
import { getZoomInteger } from '../map/Map';
import { isHighlightedTagType } from '../map-tile-provider/MapTileProvider';
import { getCenter } from 'ol/extent';
import {
getVectorTileFeatureType,
getTagType,
} from '../overlays/overlay-definitions';
import { Category } from '../wpt/WptEditDialog';
import { mustBeDrawn } from '../drawing-selector';
import { getTagValue } from '../../lib/tags/tags';
interface StyleParameters {
type: string;
isSelected: boolean;
}
const icons = {
note: {
src: noteIcon,
scale: 1 / 20,
opacity: 0.9,
anchor: [0.5, 1],
},
house: {
src: houseIcon,
scale: 1 / 15,
opacity: 0.9,
anchor: [0.5, 1],
},
houseFlat: {
src: houseFlatIcon,
scale: 1 / 15,
opacity: 0.9,
anchor: [0.5, 1],
},
camping: {
src: campingIcon,
scale: 2,
opacity: 0.9,
anchor: [0.5, 1],
},
farmPig: {
src: farmPigIcon,
scale: 1 / 12,
opacity: 0.9,
anchor: [0.5, 1],
},
cheese: {
src: cheeseIcon,
scale: 3 / 4,
opacity: 0.9,
anchor: [0.5, 1],
},
train: {
src: trainIcon,
scale: 1 / 10,
opacity: 0.9,
anchor: [0.5, 1],
},
picnic: {
src: picnicIcon,
scale: 1 / 15,
opacity: 0.9,
anchor: [0.5, 1],
},
cave: {
src: caveIcon,
scale: 1 / 7,
opacity: 0.9,
anchor: [0.5, 1],
},
};
const wptIconObj = {
src: wptIcon,
scale: 0.1,
opacity: 0.9,
anchor: [0.5, 1],
};
const textStroke = new Stroke({
color: '#fff',
width: 3,
});
const textStrokeSel = new Stroke({
color: 'blue',
width: 2,
});
const textFill = new Fill({
color: '#000',
});
const textFillSel = new Fill({
color: 'red',
});
const rteStroke = new Stroke({
color: [18, 71, 11, 0.8],
width: 3,
});
const rteStrokeSel = new Stroke({
color: 'red',
width: 3,
});
const circleFill = new Fill({
color: 'rgba(255,255,255,0.4)',
});
const circleStroke = new Stroke({
color: '#3399CC',
width: 1.25,
});
const poiTextFill = new Fill({
color: 'white',
});
const circle = new Circle({
fill: circleFill,
stroke: circleStroke,
radius: 5,
});
const replacer = (key: string, value: any) => {
if (key === 'feature' && typeof value === 'object') {
return { id: value.get('id'), rev: value.getRevision() };
}
return value;
};
const normalizer = (params: any) => {
const key = JSON.stringify(params, replacer);
// console.log({ caller: 'getStyle / normalizer', key });
return key;
};
const memoizeOptions = {
length: 1,
normalizer,
max: 1024000,
};
const styles = {
wpt: {
getParameters: (feature: Feature) => {
if (!mustBeDrawn(feature)) return null;
const extensions = feature.get('extensions');
const minZoom = extensions?.['dyo:minZoom'];
const category = extensions?.category;
return {
isSelected: feature.get('isSelected') ?? false,
text: feature.get('name'),
customIcon:
icons[feature.get('sym') as keyof typeof icons] ||
icons[category as keyof typeof icons],
thumbnailUrl:
category === Category.PICTURE ? extensions?.thumbnailUrl : undefined,
hidden: minZoom && getZoominteger() < minZoom,
};
},
getStyle: memoize((params: any) => {
// console.log({ caller: 'getStyle', params });
const { isSelected, text, customIcon, hidden, thumbnailUrl } = params;
if (hidden) {
return null;
}
const thumbnailIcon = !!thumbnailUrl
? { src: thumbnailUrl, scale: 1 / 2, anchor: [0.5, 0.5] }
: undefined;
const icon = customIcon ?? thumbnailIcon ?? wptIconObj;
return new Style({
image: new Icon(icon),
text: new Text({
font: '16px Calibri,sans-serif',
text: text,
fill: isSelected ? textFillSel : textFill,
stroke: isSelected ? textStrokeSel : textStroke,
offsetY: -40,
}),
});
}, memoizeOptions),
},
trkseg: {
getParameters: (feature: Feature) => {
if (!mustBeDrawn(feature)) return null;
return {
isSelected: feature.get('isSelected') ?? false,
feature: getZoomInteger() >= 7 ? feature : undefined,
zoom: getZoomInteger() >= 7 ? Math.floor(getZoomInteger()) : undefined,
};
},
ownStyles: {
normal: [
new Style({
stroke: new Stroke({
color: [44, 64, 255, 0.8],
width: 2,
}),
}),
new Style({
stroke: new Stroke({
color: [44, 64, 255, 0.2],
width: 7,
}),
}),
],
selected: [
new Style({
stroke: new Stroke({
color: [44, 64, 255, 0.8],
width: 2,
}),
}),
new Style({
stroke: new Stroke({
color: [255, 0, 0, 0.4],
width: 7,
}),
}),
],
},
getStyle: memoize((params: any) => {
// console.log({ caller: 'getStyle', params });
const { isSelected, feature, zoom } = params;
let currentStyles: any = isSelected
? styles.trkseg.ownStyles.selected
: styles.trkseg.ownStyles.normal;
if (feature) {
const map = getMap();
const geometry = feature.getGeometry();
const coordinates = geometry.getCoordinates();
let start = coordinates[0];
let startPixels = map?.getPixelFromCoordinate(start);
coordinates.slice(1).forEach((end: Coordinate) => {
const endPixels = map?.getPixelFromCoordinate(end);
if (
startPixels !== undefined &&
endPixels !== undefined &&
Math.sqrt(
(startPixels[0] - endPixels[0]) ** 2 +
(startPixels[1] - endPixels[1]) ** 2
) > 80
) {
const dx = end[0] - start[0];
const dy = end[1] - start[1];
const rotation = Math.atan2(dy, dx) - Math.PI / 2;
currentStyles.push(
new Style({
geometry: new Point(end),
image: new Icon({
src: blackArrowheadPointingUp,
scale: 1 / 20,
anchor: [0.5, 0.5],
rotateWithView: true,
rotation: -rotation,
}),
})
);
startPixels = endPixels;
start = end;
}
});
}
return currentStyles;
}, memoizeOptions),
},
'trkseg-finish': {
getParameters: (feature: Feature) => {
if (!mustBeDrawn(feature)) return null;
const positions: Set<string> = feature.get('positions');
const tags: any = feature.get('tags') || {};
return {
isLast: positions.has('gpx-end') && positions.has('trk-end'),
locomotion: getTagValue(tags, 'locomotion') || 'hiking',
};
},
getStyle: memoize((params: any) => {
// console.log({ caller: 'getStyle', params });
const { isLast, locomotion } = params;
if (isLast) {
return new Style({
image: new Icon({
src: locomotion === 'cycling' ? cycleIcon : hikerIcon,
scale: 1 / 20,
opacity: 0.9,
anchor: [0.5, 0.5],
}),
});
}
return null;
}, memoizeOptions),
},
rte: {
getParameters: (feature: Feature) => {
if (!mustBeDrawn(feature)) return null;
return {
isSelected: feature.get('isSelected') ?? false,
};
},
getStyle: memoize((params: any) => {
// console.log({ caller: 'getStyle', params });
const { isSelected } = params;
return new Style({ stroke: isSelected ? rteStrokeSel : rteStroke });
}, memoizeOptions),
},
way: {
strokes: {
veryLowZoom: {
iwn: [
new Style({
stroke: new Stroke({
color: [255, 0, 0, 1],
width: 1,
}),
}),
],
nwn: [
new Style({
stroke: new Stroke({
color: [255, 0, 0, 1],
width: 1,
}),
}),
],
rwn: [
new Style({
stroke: new Stroke({
color: [255, 128, 0, 1],
width: 1,
}),
}),
],
lwn: [
new Style({
stroke: new Stroke({
color: [255, 255, 0, 1],
width: 1,
}),
}),
],
default: [
new Style({
stroke: new Stroke({
color: [255, 255, 0, 1],
width: 1,
lineDash: [10, 10],
}),
}),
],
},
lowZoom: {
iwn: [
new Style({
stroke: new Stroke({
color: [255, 0, 0, 0.6],
width: 3,
}),
}),
],
nwn: [
new Style({
stroke: new Stroke({
color: [255, 0, 0, 0.6],
width: 3,
}),
}),
],
rwn: [
new Style({
stroke: new Stroke({
color: [255, 128, 0, 0.6],
width: 3,
}),
}),
],
lwn: [
new Style({
stroke: new Stroke({
color: [255, 255, 0, 0.6],
width: 3,
lineDash: [10, 10],
}),
}),
],
default: [
new Style({
stroke: new Stroke({
color: [255, 255, 0, 0.6],
width: 1,
lineDash: [10, 10],
}),
}),
],
},
highZoom: {
iwn: [
new Style({
stroke: new Stroke({
color: [255, 0, 0, 0.6],
width: 7,
// lineDash: [10, 10],
// lineDashOffset: 10,
}),
}),
new Style({
stroke: new Stroke({
color: [255, 255, 255, 0.6],
width: 3,
// lineDash: [10, 10],
// lineDashOffset: 0,
}),
}),
],
nwn: [
new Style({
stroke: new Stroke({
color: [255, 0, 0, 0.6],
width: 7,
// lineDash: [10, 10],
// lineDashOffset: 10,
}),
}),
new Style({
stroke: new Stroke({
color: [255, 255, 255, 0.6],
width: 3,
// lineDash: [10, 10],
// lineDashOffset: 0,
}),
}),
],
rwn: [
new Style({
stroke: new Stroke({
color: [255, 255, 0, 0.6],
width: 7,
// lineDash: [10, 10],
// lineDashOffset: 10,
}),
}),
new Style({
stroke: new Stroke({
color: [255, 0, 0, 0.6],
width: 3,
// lineDash: [10, 10],
// lineDashOffset: 0,
}),
}),
],
lwn: [
new Style({
stroke: new Stroke({
color: [0, 0, 255, 0.6],
width: 3,
}),
}),
new Style({
stroke: new Stroke({
color: [255, 255, 0, 0.6],
width: 1,
}),
}),
],
default: [
new Style({
stroke: new Stroke({
color: [0, 0, 255, 0.6],
lineDash: [10, 10],
width: 3,
}),
}),
new Style({
stroke: new Stroke({
color: [255, 255, 0, 0.6],
lineDash: [10, 10],
width: 1,
}),
}),
],
},
},
getParameters: (feature: Feature) => {
// let tags = feature.get('tags');
// try {
// tags = JSON.parse(feature.get('tags'));
// } catch (error) {
// tags = { error };
// console.error({
// caller: 'style / JSON.parse',
// tags: feature.get('tags'),
// error,
// feature,
// });
// }
const network = feature.get('network');
if (getZoomInteger() < 7 && !['iwn'].includes(network)) {
return null;
}
if (getZoomInteger() < 11 && !['iwn', 'nwn'].includes(network)) {
return null;
}
if (getZoomInteger() < 13 && !['iwn', 'nwn', 'lwn'].includes(network)) {
return null;
}
const name =
getZoomInteger() < 15
? feature.get('ref')
: feature.get('name') || feature.get('ref');
return {
// isSelected: feature.get('isSelected') ?? false,
name: !!name ? name : undefined,
network,
zoom:
getZoomInteger() >= 12
? 'highZoom'
: getZoomInteger() >= 8
? 'lowZoom'
: 'veryLowZoom',
};
},
getStyle: memoize((params: any) => {
// console.log({ caller: 'getStyle', params });
const { name, network, zoom } = params;
return [
...(styles.way.strokes[zoom][network] ??
styles.way.strokes[zoom].default),
new Style({
text: new Text({
text: name,
font: 'bold 14px "Open Sans", "Arial Unicode MS", "sans-serif"',
placement: 'line',
overflow: false,
maxAngle: Math.PI / 16,
textBaseline: ['iwn', 'nwn'].includes(network) ? 'top' : 'bottom',
padding: [2, 2, 2, 2],
fill: new Fill({
color: 'black',
}),
}),
}),
];
}, memoizeOptions),
},
poi: {
getParameters: (feature: Feature) => {
if (feature.getGeometryName() !== 'Point') {
feature.setGeometry(
new Point(getCenter(feature.getGeometry().getExtent()))
);
}
if (getZoomInteger() < 16) {
return null;
}
const tagType = getTagType(feature);
const isHighlightedFeature = isHighlightedTagType(tagType);
if (
(isHighlightedFeature && getZoomInteger() < 16) ||
(!isHighlightedFeature && getZoomInteger() < 18)
) {
return null;
}
return {
name: feature.get('name'),
poiType: tagType,
isHighlighted: isHighlightedFeature,
isTextHidden: getZoomInteger() < 19,
};
},
getStyle: memoize((params: any) => {
// console.log({ caller: 'getStyle', params });
const { name, poiType, isTextHidden, isHighlighted } = params;
const icon = osmIcons[poiType];
if (icon === undefined) {
return undefined;
}
return [
new Style({
image: new Circle({
radius: 28,
fill: new Fill({
color: isHighlighted ? [174, 33, 219, 0.7] : [255, 255, 255, 0.3],
}),
displacement: isHighlighted ? [0, +0] : [0, +3],
}),
}),
new Style({
image: new Icon({
src: icon,
scale: isHighlighted ? 2 : 1,
opacity: 1,
color: isHighlighted ? 'red' : 'black',
// anchor: [0, 0],
}),
text:
name && !isTextHidden
? new Text({
text: name,
font: 'bold 14px "Open Sans", "Arial Unicode MS", "sans-serif"',
offsetY: +40,
padding: [0, 0, 0, 0],
fill: new Fill({
color: 'black',
}),
backgroundFill: poiTextFill,
})
: undefined,
}),
];
}, memoizeOptions),
},
cluster: {
getParameters: (feature: Feature) => {
const nbFeatures = feature.get('features').length;
// console.log({ caller: 'cluster / getParameters', feature, nbFeatures });
return {
nbFeatures,
};
},
getStyle: memoize((params: any) => {
// console.log({ caller: 'cluster / getStyle', params });
const { nbFeatures } = params;
return new Style({
image: new Circle({
radius: 12,
fill: new Fill({ color: [174, 33, 219, 0.7] }),
}),
text: new Text({
text: `${nbFeatures}`,
font: 'bold 18px "Open Sans", "Arial Unicode MS", "sans-serif"',
offsetY: +2,
padding: [0, 0, 0, 0],
fill: new Fill({
color: 'black',
}),
}),
});
}, memoizeOptions),
},
};
export const style = (feature: Feature, resolution: number) => {
// console.log({ caller: 'style', feature, values: feature.values_ });
const type = (
feature.get('type') !== undefined
? feature.get('type')
: getVectorTileFeatureType(feature)
) as keyof typeof styles;
const styleForType = styles[type];
if (!styleForType) {
console.log({ caller: 'style / default', type, feature, resolution });
// return createDefaultStyle(feature, resolution)[0];
return null;
}
const params = styles[type].getParameters(feature);
// console.log({
// caller: 'style',
// type,
// styleForType,
// params,
// feature,
// resolution,
// });
if (params === null || params?.isHidden) {
return null;
}
// if (params.subFeature) {
// return style(params.subFeature, resolution);
// }
const getStyle = styles[type].getStyle;
const result = getStyle(params);
// console.log({ caller: 'style', feature, type, params, style });
if (result === undefined) {
// console.log({ caller: 'style / unknown', feature });
return createDefaultStyle(feature, resolution)[0];
}
return result;
};
export default style;

View File

@ -0,0 +1,18 @@
.container {
position: fixed !important;
top: 6px;
margin-left: calc(100% - 100px) !important;
z-index: 1;
}
.label {
opacity: 0.8;
}
.inputFile {
width: 0.1px;
height: 0.1px;
opacity: 0;
overflow: hidden;
/* position: absolute; */
z-index: -1;
}

View File

@ -0,0 +1,81 @@
import { Component, createSignal, For } from 'solid-js';
import CloudUploadIcon from '@suid/icons-material/CloudUpload';
// @ts-ignore
import css from './Import.module.css';
import Dialog from '../dialog';
import { useI18n } from '@solid-primitives/i18n';
import { Box } from '@suid/material';
import ImportSingleFile from './ImportSingleFile';
const [filesToImport, setFilesToImport] = createSignal<FileList | string[]>();
export const importUrls = (urls: string[]) => {
setFilesToImport(urls);
};
const GpxImport: Component = () => {
const [t] = useI18n();
const onChangeHandler = (event: any) => {
console.log({
caller: 'GpxImport / On change handler',
files: event.target.files,
});
setFilesToImport(event.target.files);
};
const handleClose = (event: any, reason?: string) => {
console.log({
caller: 'GpxImport / handleClose',
event,
reason,
});
if (reason === undefined) {
setFilesToImport(undefined);
}
};
const accept =
window.Capacitor.platform === 'android'
? ''
: '.gpx,.jpg,image/jpeg,application/gpx+xml';
return (
<>
<div class={css.container}>
<label for='gpx-import' class={css.label}>
<CloudUploadIcon />
</label>
<input
type='file'
id='gpx-import'
class={css.inputFile}
accept={accept}
multiple={true}
onChange={onChangeHandler}
/>
</div>
<Dialog
open={filesToImport() !== undefined}
title={t('gpxImport')}
closeHandler={handleClose}
fullScreen
>
<Box
sx={{
width: '100%',
}}
>
<For each={filesToImport()}>
{(file) => <ImportSingleFile file={file} />}
</For>
</Box>
</Dialog>
</>
);
};
export default GpxImport;

View File

@ -0,0 +1,355 @@
import { useI18n } from '@solid-primitives/i18n';
import {
Typography,
Card,
CardContent,
CardActions,
Button,
Box,
LinearProgress,
CircularProgress,
} from '@suid/material';
import { Component, createEffect, createSignal, Show } from 'solid-js';
import { findStartTime } from '../../lib/gpx';
import GPX from '../../lib/gpx-parser-builder/src/gpx';
import dispatch from '../../workers/dispatcher-main';
import GpxChooser from '../gpx-chooser';
import { currentGpxId } from '../gpx-dialog';
import {
Filesystem as CapacitorFileSystem,
Encoding,
} from '@capacitor/filesystem';
import piexif from 'piexifjs';
import { getDate, getGps } from '../../lib/exif';
import { downsize } from '../../lib/image';
import { Coordinate } from 'ol/coordinate';
import WptEditDialog, { Category } from '../wpt/WptEditDialog';
interface Props {
file: File;
}
interface StatsAndGpx {
gpx: Gpx;
stats: any;
}
interface Picture {
id: string;
date: string;
gpx: { Latitude: number; Longitude: number; Altitude: number };
thumbnailUrl: string;
}
const analyzeGpx = (gpx: Gpx | undefined) => {
if (gpx === undefined) {
return {};
}
const stats = {
creator: gpx.$.creator,
nbWpts: gpx.wpt ? gpx.wpt?.length : 0,
nbRtes: gpx.rte ? gpx.rte?.length : 0,
nbTrks: gpx.trk ? gpx.trk?.length : 0,
trkMaybeRte:
gpx.trk &&
gpx.trk[0].trkseg &&
gpx.trk[0].trkseg[0] &&
gpx.trk[0].trkseg[0].trkpt &&
!gpx.trk[0].trkseg[0].trkpt[0].time,
startTime: findStartTime(gpx),
};
return stats;
};
const ImportSingleFile: Component<Props> = ({ file: file }) => {
const [t] = useI18n();
const [statsAndGpx, setStatsAndGpx] = createSignal<StatsAndGpx>();
const [picture, setPicture] = createSignal<Picture>();
const [state, setState] = createSignal('init');
const [gpxId, setGpxId] = createSignal<string>('new');
const [open, setOpen] = createSignal<boolean>(false);
const [coordinate, setCoordinate] = createSignal<Coordinate>();
const [initialWpt, setInitialWpt] = createSignal({
$: { lat: 0, lon: 0 },
ele: undefined,
time: undefined,
magvar: undefined,
geoidheight: undefined,
name: undefined,
cmt: undefined,
desc: undefined,
src: undefined,
link: undefined,
sym: undefined,
type: undefined,
fix: undefined,
sat: undefined,
hdop: undefined,
vdop: undefined,
pdop: undefined,
ageofdgpsdata: undefined,
dgpsid: undefined,
extensions: {
address: undefined,
startTime: undefined,
endTime: undefined,
category: Category.PICTURE,
subCategory: undefined,
pictureId: '',
thumbnailUrl: '',
},
});
createEffect(() => {
setGpxId(currentGpxId());
});
const parseGpx = (content: string) => {
const gpx = GPX.parse(content);
console.log({
caller: 'ImportSingleFile / JSON',
gpxFile: file,
gpx,
gpxId: gpxId(),
});
setStatsAndGpx({ gpx, stats: analyzeGpx(gpx) });
};
if (typeof file === 'string') {
CapacitorFileSystem.requestPermissions().then((permissionStatus) => {
console.log({
caller: 'ImportSingleFile / content',
permissionStatus,
});
});
CapacitorFileSystem.readFile({
path: file,
encoding: Encoding.UTF8,
}).then((content) => {
console.log({
caller: 'ImportSingleFile / content',
file,
content,
});
parseGpx(content.data);
});
} else {
const reader = new FileReader();
if (file.type === 'image/jpeg') {
reader.readAsDataURL(file);
reader.addEventListener(
'load',
async () => {
const imageUrl = reader.result;
const exifObj = piexif.load(imageUrl);
console.log({
caller: 'ImportSingleFile / Jpeg',
file,
type: file.type,
result: reader.result,
exifObj,
});
const id = exifObj.Exif[piexif.ExifIFD.ImageUniqueID];
const gps = getGps(exifObj);
const date = getDate(exifObj);
const [downsizedUrl, bigThumbnailUrl, thumbnailUrl] = await downsize(
reader.result,
[1024, 512, 128]
);
console.log({
caller: 'ImportSingleFile / Jpeg',
file,
id,
gps,
date,
type: file.type,
result: reader.result,
exifObj,
});
setPicture({
id,
gps,
date,
thumbnailUrl,
bigThumbnailUrl,
downsizedUrl,
});
setCoordinate([gps.longitude, gps.latitude]);
setInitialWpt({
...initialWpt(),
extensions: {
...initialWpt().extensions,
category: Category.PICTURE,
startTime: date.toISOString(),
endTime: date.toISOString(),
pictureId: id,
thumbnailUrl: thumbnailUrl,
},
});
},
false
);
} else {
// GPX
reader.readAsText(file);
reader.addEventListener(
'load',
async () => {
// this will then display a text gpxfile
console.log({
caller: 'ImportSingleFile / XML',
file,
type: file.type,
result: reader.result,
});
parseGpx(reader.result);
},
false
);
}
}
const doImport = async (forceImportAsRoutes: boolean = false) => {
setState('importing');
// console.log({ caller: 'GpxImport / JSON', file, gpx });
// if (gpx) {
// const startTime = new Date(findStartTime(gpx)!);
await dispatch({
action: 'pruneAndSaveImportedGpx',
params: {
id: gpxId(),
forceImportAsRoutes,
gpx: statsAndGpx()?.gpx,
tech:
typeof file === 'string'
? {
importDate: new Date().toISOString(),
uri: file,
}
: {
lastModified: new Date(file.lastModified).toISOString(),
importDate: new Date().toISOString(),
name: file.name,
size: file.size,
type: file.type,
},
},
});
console.log({
caller: 'GpxImport / JSON / done',
gpxFile: file,
gpx: statsAndGpx()?.gpx,
});
setState('done');
// } else {
// console.error({
// message: "can't parse GPX file",
// file,
// xml: fileReader.result,
// });
// }
// // TODO: error handling
// },
// false
// );
// }
};
const [selectedTrkTransform, setSelectedTrkTransform] = createSignal(
'importNonTimedTrksAsRtes'
);
const handleTrkTransformChange = (event: any) => {
setSelectedTrkTransform(event.target.value);
};
const controlTrkTransformProps = (item: string) => ({
checked: selectedTrkTransform() === item,
onChange: handleTrkTransformChange,
value: item,
name: 'trkTransform',
label: t(item),
inputProps: { 'aria-label': item },
});
return (
<Card raised>
<CardContent>
<Typography variant='h6'>
{t('file')}
{file.name}
</Typography>
</CardContent>
<CardContent>
<Show when={statsAndGpx() !== undefined}>
<Typography variant='body1'>
{t('gpxStats', statsAndGpx().stats)}{' '}
{statsAndGpx()?.stats.startTime
? t('gpxStartTime', statsAndGpx().stats)
: t('gpxNoStartTime')}
</Typography>
<Show when={statsAndGpx().stats.trkMaybeRte}>
<Typography variant='body1'>{t('trkMaybeRte')}</Typography>
</Show>
<Show when={state() === 'importing'}>
<LinearProgress />
</Show>
<CardActions>
<GpxChooser
gpxId={gpxId}
setGpxId={setGpxId}
disabled={state() != 'init'}
/>
<Button
variant='contained'
disabled={state() != 'init'}
onClick={() => doImport(false)}
>
{t('import')}
</Button>
<Button
variant='contained'
disabled={state() != 'init'}
onClick={() => doImport(true)}
>
{t('importAllTrksAsRtes')}
</Button>
</CardActions>
</Show>
<Show when={picture() !== undefined}>
<img src={picture()?.bigThumbnailUrl} />
<p>Id: {picture()?.id}</p>
<p>Date: {picture()?.date.toString()}</p>
<p>
Coordinates: {picture()?.gps.latitude}, {picture()?.gps.longitude}
</p>
<CardActions>
<Button
variant='contained'
disabled={state() != 'init'}
onClick={() => setOpen(true)}
>
{t('import')}
</Button>
</CardActions>
<Show when={open()}>
<WptEditDialog
open={open}
closeHandler={() => {
setOpen(false);
setState('imported');
}}
coordinate={coordinate}
initialWpt={initialWpt}
imageUrl={picture()?.downsizedUrl}
/>
</Show>
</Show>
</CardContent>
</Card>
);
};
export default ImportSingleFile;

View File

@ -0,0 +1 @@
export { default, importUrls } from './Import';

View File

@ -0,0 +1,301 @@
import { Button, IconButton } from '@suid/material';
import { Feature } from 'ol';
import { Geometry } from 'ol/geom';
import { Component, createSignal, For, Match, Show, Switch } from 'solid-js';
import { useI18n } from '@solid-primitives/i18n';
import TravelExploreIcon from '@suid/icons-material/TravelExplore';
import AddLocationAltIcon from '@suid/icons-material/AddLocationAlt';
import OpenInNewIcon from '@suid/icons-material/OpenInNew';
import CallIcon from '@suid/icons-material/Call';
import { Paper, Stack } from '@suid/material';
import styled from '@suid/material/styles/styled';
import Dialog from '../dialog';
import Tree from '../tree';
import { GpxViewer } from '../gpx';
import { Browser } from '@capacitor/browser';
import { isHighlightedTagType } from '../map-tile-provider/MapTileProvider';
import style from '../gpx/styles';
import OsmFindAll from './OsmFindAll';
import { toLonLat } from 'ol/proj';
import { getTagType } from '../overlays/overlay-definitions';
const Item = styled(Paper)(({ theme }) => ({
...theme.typography.body2,
padding: theme.spacing(1),
textAlign: 'center',
color: theme.palette.text.secondary,
}));
const [open, setOpen] = createSignal(false);
const [location, setLocation] = createSignal();
let selectedFeatures: Feature[] = [];
let vectorLayerFeatures: Feature[] = [];
let hierarchy: any = {};
const level2Key = (feature: Feature) =>
feature.get('context').wptId ||
feature.get('context').rteId ||
feature.get('context').trkId;
export const clickHandler = (event: any) => {
hierarchy = {};
const map = event.map;
const pixel = [event.originalEvent.x, event.originalEvent.y];
const features = map.getFeaturesAtPixel(pixel, { hitTolerance: 30 });
setLocation(toLonLat(map.getCoordinateFromPixel(pixel)));
console.log({ caller: 'Infos.tsx / clickHandler', features, event });
selectedFeatures.map((feature) => {
if (feature.set) {
feature.set('isSelected', false);
}
});
selectedFeatures = features.filter((feature: any) => feature.get('context'));
let osmIds = new Set<string>();
vectorLayerFeatures = features.filter((feature: any) => {
if (feature.get('context')) {
return false;
}
const osmId = feature.get('osm_id');
if (osmIds.has(osmId)) {
return false;
}
osmIds.add(osmId);
return true;
});
selectedFeatures.sort((f1: Feature, f2: Feature) => {
const ctx1 = f1.get('context');
const ctx2 = f2.get('context');
if (ctx1.gpxId < ctx2.gpxId) {
return 1;
} else if (ctx1.gpxId > ctx2.gpxId) {
return -1;
}
const level2Key1 = level2Key(f1);
const level2Key2 = level2Key(f2);
if (level2Key1 < level2Key2) {
return -1;
}
if (level2Key1 > level2Key2) {
return 1;
}
if (ctx1.trksegId < ctx2.trksegId) {
return -1;
}
if (ctx1.trksegId > ctx2.trksegId) {
return 1;
}
return 0;
});
selectedFeatures.map((feature: Feature<Geometry>) => {
const gpxId = feature.get('context').gpxId;
if (!hierarchy.hasOwnProperty(gpxId)) {
hierarchy[gpxId] = { type: 'gpx' };
}
const l2key = level2Key(feature);
if (!hierarchy[gpxId].hasOwnProperty(l2key)) {
hierarchy[gpxId][l2key] = {};
if (feature.get('type') === 'trkseg') {
hierarchy[gpxId][l2key].type = 'trk';
} else {
hierarchy[gpxId][l2key].type = feature.get('type');
hierarchy[gpxId][l2key].feature = feature;
}
}
if (feature.get('type') === 'trkseg') {
const trksegId = feature.get('context').trksegId;
if (!hierarchy[gpxId][l2key].hasOwnProperty(trksegId)) {
hierarchy[gpxId][l2key][trksegId] = {
type: 'trkseg',
feature,
};
}
}
});
console.log({
caller: '<Infos/> / clickHandler',
event,
features,
hierarchy,
vectorLayerFeatures,
location: location(),
});
selectedFeatures.map((feature: Feature<Geometry>) => {
const id = feature.get('id');
feature.set('isSelected', true);
// const geometry = feature.getGeometry();
// const length = getLength(geometry, { projection: "EPSG:4326" });
console.log({
caller: '<Infos/> / clickHandler / feature',
event,
feature,
id,
// geometry,
// length,
});
});
setOpen(true);
};
const FeaturesTree: Component<{ featuresHierarchy: any }> = ({
featuresHierarchy,
}) => {
return (
<Tree
title={featuresHierarchy.type || 'voyages'}
content={undefined}
subTree={Object.keys(featuresHierarchy)
.filter((key: string) => key.startsWith('gpx/'))
.map((key: string) => (
<GpxViewer gpxId={key} restrictToHierarchy={featuresHierarchy[key]} />
))}
/>
);
};
const Infos: Component<{}> = (props) => {
const [t, { add, locale, dict }] = useI18n();
const handleClick = () => {
setOpen(false);
};
return (
<Dialog closeHandler={handleClick} open={open()} title={t('nearby')}>
<Stack
spacing={1}
direction='column'
alignItems='center'
sx={{ width: 'calc(100% - 5px)' }}
>
<Tree
title='everything'
content={undefined}
subTree={
<>
<Tree
title={
<>
<div>osm</div>
<OsmFindAll location={location()} />
</>
}
content={undefined}
subTree={
<>
<For each={vectorLayerFeatures}>
{(feature) => (
<Tree
title={
<>
<div>{feature.get('name') || ''}</div>
<div>
<IconButton>
<AddLocationAltIcon />
</IconButton>
<IconButton
onClick={async () => {
await Browser.open({
url: `https://www.qwant.com/?q=${encodeURIComponent(
feature.get('name') || ''
)}&t=web`,
});
}}
>
<TravelExploreIcon />
</IconButton>
</div>
</>
}
content={
<>
<>
{console.log({
caller: 'Infos / vector layer feature',
isHighlighted: isHighlightedTagType(
getTagType(feature)
),
tagValue: getTagType(feature),
properties: feature.getProperties(),
style: style(feature),
})}
</>
<For each={Object.keys(feature.getProperties())}>
{(key: string) => (
<div>
<Switch
fallback={`${key}: ${
feature.getProperties()[key]
}`}
>
<Match when={key === 'website'}>
<Button
size='small'
startIcon={<OpenInNewIcon />}
onClick={async () => {
await Browser.open({
url: feature.getProperties()[key],
});
}}
>
{feature.getProperties()[key]}
</Button>
</Match>
<Match when={key === 'phone'}>
<Button
size='small'
startIcon={<CallIcon />}
href={
'tel:' +
feature.getProperties()[key]
}
>
{feature.getProperties()[key]}
</Button>
</Match>
<Match when={key === 'tags'}>
tags:
<ul>
<For
each={Object.keys(
feature.getProperties()[key]
)}
>
{(tagKey) => (
<li>
{tagKey}:
{
feature.getProperties()[key][
tagKey
]
}
</li>
)}
</For>
</ul>
</Match>
</Switch>
</div>
)}
</For>
</>
}
subTree={undefined}
/>
)}
</For>
</>
}
/>
<FeaturesTree featuresHierarchy={hierarchy} />
</>
}
/>
</Stack>
</Dialog>
);
};
export default Infos;

View File

@ -0,0 +1,99 @@
import { IconButton } from '@suid/material';
import { Coordinate } from 'ol/coordinate';
import { Point } from 'ol/geom';
import { Component, createSignal, For, Show } from 'solid-js';
import OsmIcon from '../../icons/OpenStreetMap-logo.svg?component-solid';
import Dialog from '../dialog';
import Tree from '../tree';
interface Props {
location: Coordinate;
}
const OsmFindAll: Component<Props> = (props) => {
const { location } = props;
const [osmResult, setOsmResult] = createSignal(false);
const handleClick = async () => {
const query = `[out:json][timeout:25];
(
nwr(if:count_tags()>0)(around:50,${location[1]},${location[0]});
);
out body;
`;
const response = await fetch(
'https://overpass-api.de/api/interpreter?contact=vdv@dyomedea.com',
{
method: 'POST', // *GET, POST, PUT, DELETE, etc.
mode: 'cors', // no-cors, *cors, same-origin
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
credentials: 'same-origin', // include, *same-origin, omit
headers: {
'Content-Type': 'text/plain',
// 'Content-Type': 'application/x-www-form-urlencoded',
},
redirect: 'follow', // manual, *follow, error
referrerPolicy: 'no-referrer', // no-referrer, *no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url
body: query, // body data type must match "Content-Type" header
}
);
const osmJson = await response.json(); // parses JSON response into native JavaScript objects
console.log({
caller: 'OsmFindAll / handleClick',
query,
osmJson,
});
setOsmResult(osmJson);
};
const closeHandler = () => {
setOsmResult(false);
};
return (
<>
<IconButton onClick={handleClick}>
<OsmIcon width={24} height={24} viewBox='0 0 240 240' />
</IconButton>
<Dialog
open={!!osmResult()}
title='OsmObjects'
closeHandler={closeHandler}
>
<Tree
title='OSMData'
content={undefined}
subTree={
<For each={osmResult().elements}>
{(element) => (
<Tree
title={element.id}
content={
<>
<div>type: {element.type}</div>
<Show when={element.type === 'node'}>
<div>
Coordinates: {element.lat}, {element.lon}
</div>
</Show>
<For each={Object.keys(element.tags)}>
{(tag) => (
<div>
{tag}: {element.tags[tag]}
</div>
)}
</For>
</>
}
subTree={undefined}
></Tree>
)}
</For>
}
></Tree>
</Dialog>
</>
);
};
export default OsmFindAll;

View File

@ -0,0 +1 @@
export { default, clickHandler } from './Infos';

View File

@ -0,0 +1,247 @@
import {
Alert,
Box,
Button,
Modal,
TextField,
Typography,
} from '@suid/material';
import { Component, createEffect, createSignal, Show } from 'solid-js';
import { parseUserId } from '../../lib/user-id';
import dispatch from '../../workers/dispatcher-main';
import Dialog from '../dialog';
interface props {}
const [invitation, setInvitation] = createSignal<any>(false);
const fetchInvitation = () => {
fetch(invitation().url)
.then((response) => response.json())
.then((data) => {
setInvitation({ ...invitation(), data });
return invitation();
})
.then(() => {
dispatch({
action: 'getAccount',
params: { id: invitation().data.id },
}).then((account) => {
console.log({ caller: 'Invitation / fetchInvitation', account });
setInvitation({ ...invitation(), existing: true });
});
})
.catch((error) => {
console.error({ caller: 'Invitation / fetchInvitation', error });
});
};
export const openInvitation = (payload: string) => {
try {
const decoded = atob(payload);
const url = new URL(decoded);
setInvitation({ url });
fetchInvitation();
} catch {
console.warn({
caller: 'Invitation / searchInvitationInIntent',
payload,
message: 'Query is not a base64 encoded URL',
});
}
return true;
};
export const searchInvitation = () => {
const hash = location.hash;
console.log({ caller: 'Invitation / searchInvitation', hash });
if (hash.length > 1) {
try {
const payload = hash.slice(1);
const decoded = atob(payload);
const url = new URL(decoded);
setInvitation({ url });
fetchInvitation();
} catch {
console.warn({
caller: 'Invitation / searchInvitation',
hash,
message: 'Hash is not a base64 encoded URL',
});
}
}
};
const Invitation: Component<props> = (props) => {
createEffect(() => {
console.log({
caller: 'Invitation / createEffect',
invitation: invitation(),
});
});
const closeHandler = () => {};
const submitHandler = async () => {
try {
const response = await fetch(
`${invitation().url.href}/${invitation().code}`
);
const codeData = await response.json();
setInvitation({
...invitation(),
codeData,
failure: codeData.response !== 'OK',
success: codeData.response === 'OK',
});
const user = invitation().codeData.user;
const id = user._id;
const account = {
id,
localDb: id,
name: id,
remoteDbServer: user.database,
remoteDbUser: user.username,
remoteDbPassword: user.password,
mail: user.mail,
};
dispatch({ action: 'putAccount', params: { id, account } });
const settings: any = await dispatch({ action: 'getSettings' });
dispatch({
action: 'putSettings',
params: { settings: { ...settings, currentAccountId: id } },
});
} catch (error) {
setInvitation({
...invitation(),
failure: true,
});
}
};
const codeChangeHandler = (event: any) => {
setInvitation({ ...invitation(), code: event.target.value });
};
const handleModalFailureClose = () => {
setInvitation({ ...invitation(), failure: undefined, existing: undefined });
};
const handleCloseSuccess = () => {
setInvitation(false);
location.reload();
};
return (
<Show when={!!invitation() && !!invitation().data}>
<Dialog
open={!!invitation() && !!invitation().data}
fullScreen={false}
closeHandler={closeHandler}
title='Invitation'
>
<Box
component='form'
sx={{
width: '100%',
'& .MuiTextField-root': { m: 1, width: '100%' },
paddingTop: '5px',
}}
noValidate
autoComplete='off'
>
<p>
Pour configurer cette application en tant que "
{invitation().data.id}
", copier le code qui vous a été envoyé par mail à l'adresse "
{invitation().data.mail}" :{' '}
</p>
<TextField
required
label='Code'
type='number'
onChange={codeChangeHandler}
/>
<Button variant='contained' onClick={submitHandler}>
OK
</Button>
<Button variant='outlined' onClick={fetchInvitation}>
Renvoyer le code
</Button>
<Button variant='outlined' color='error' onClick={handleCloseSuccess}>
Annuler
</Button>
</Box>
</Dialog>
<Modal
open={!!invitation().failure}
onClose={handleModalFailureClose}
aria-labelledby='modal-modal-title'
aria-describedby='modal-modal-description'
>
<Box
sx={{
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
width: 400,
border: '2px solid #000',
boxShadow: '24px',
p: 4,
}}
>
<Alert severity='error'>Le code est erroné !</Alert>
</Box>
</Modal>
<Modal
open={!!invitation().success}
onClose={handleCloseSuccess}
aria-labelledby='modal-modal-title'
aria-describedby='modal-modal-description'
>
<Box
sx={{
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
width: 400,
border: '2px solid #000',
boxShadow: '24px',
p: 4,
}}
>
<Alert severity='success'>C'est tout bon !</Alert>
</Box>
</Modal>
<Modal
open={!!invitation().existing}
onClose={handleModalFailureClose}
aria-labelledby='modal-modal-title'
aria-describedby='modal-modal-description'
>
<Box
sx={{
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
width: 400,
border: '2px solid #000',
boxShadow: '24px',
p: 4,
}}
>
<Alert severity='info'>
Ce compte est déjà configuré, vous pouvez soit continuer et le
reconfigurer soit abandonner cette action et ne pas tenir compte du
message qui vous a é envoyé.
</Alert>
</Box>
</Modal>
</Show>
);
};
export default Invitation;

View File

@ -0,0 +1 @@
export { default, searchInvitation } from './Invitation';

View File

@ -0,0 +1,7 @@
.control {
opacity: 1;
position: fixed !important;
top: 0px;
margin-left: calc(100% - 70px) !important;
z-index: 1;
}

View File

@ -0,0 +1,307 @@
import OSM from 'ol/source/OSM';
import XYZ from 'ol/source/XYZ';
import { Component, createEffect, createSignal, For, Show } from 'solid-js';
import { useI18n } from '@solid-primitives/i18n';
import style from './MapTileProvider.module.css';
import LayersIcon from '@suid/icons-material/Layers';
import {
FormControlLabel,
IconButton,
Radio,
RadioGroup,
} from '@suid/material';
import { useNavigate, useParams } from '@solidjs/router';
import Dialog from '../dialog';
import Tree from '../tree';
import { createCachedSignal } from '../../workers/cached-signals';
import dispatch from '../../workers/dispatcher-main';
import getUri from '../../lib/ids';
import { Feature } from 'ol';
import {
overlayDefinitions,
osmTags,
OsmTag,
getTagType,
} from '../overlays/overlay-definitions';
import { cloneDeep } from 'lodash';
import DrawingSelector from '../drawing-selector/DrawingSelector';
const id = getUri('overlays', undefined);
interface TileProvider {
name: string;
language: string;
source: XYZ;
}
type TileProviders = {
[key: string]: TileProvider;
};
export const mapTileProviders: TileProviders = {
osm: {
name: 'Open Street Map',
language: 'int',
source: new OSM(),
},
osmfr: {
name: 'Open Street Map France',
language: 'fr',
source: new XYZ({
minZoom: 0,
maxZoom: 20,
url: 'https://{a-c}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png',
}),
},
otm: {
name: 'Open Topo Map',
language: 'int',
source: new XYZ({
minZoom: 0,
maxZoom: 16,
url: 'https://{a-c}.tile.opentopomap.org/{z}/{x}/{y}.png',
}),
},
cyclosm: {
name: 'CyclOSM',
language: 'int',
source: new XYZ({
minZoom: 0,
maxZoom: 19,
url: 'https://{a-c}.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png',
}),
},
//https://b.tile.openstreetmap.fr/openriverboatmap/20/535762/382966.png
openriverboatmap: {
name: 'Open River Boat Map',
language: 'int',
source: new XYZ({
minZoom: 0,
maxZoom: 19,
url: 'https://{a-c}.tile.openstreetmap.fr/openriverboatmap/{z}/{x}/{y}.png',
}),
},
rasterIgnEs: {
name: 'Cartografía Ráster de España del IGN',
language: 'es',
source: new XYZ({
minZoom: 0,
maxZoom: 19,
url: 'http://www.ign.es/wmts/mapa-raster?request=getTile&layer=MTN&TileMatrixSet=GoogleMapsCompatible&TileMatrix={z}&TileCol={x}&TileRow={y}&format=image/jpeg',
}),
},
pnoaMaEs: {
name: 'Ortoimágenes de España',
language: 'es',
source: new XYZ({
minZoom: 0,
maxZoom: 19,
url: 'http://www.ign.es/wmts/pnoa-ma?request=getTile&layer=MTN&TileMatrixSet=GoogleMapsCompatible&TileMatrix={z}&TileCol={x}&TileRow={y}&format=image/jpeg',
}),
},
};
type FeatureSubTypes = Array<string> | '*';
type FeatureTypes = Record<string, FeatureSubTypes>;
type Overlay = {
selected: boolean;
highlighted: FeatureTypes;
hidden: FeatureTypes;
};
type Overlays = Record<string, Overlay>;
const defaultOverlayContent = {
selected: false,
highlighted: {
none: [],
},
hidden: { none: [] },
};
const defaultOverlays: Overlays = {
none: { selected: true, highlighted: { none: [] }, hidden: {} },
};
const getOverlays = createCachedSignal({
id,
method: 'getOverlays',
defaultOverlays,
}) as () => Overlays;
const currentOverlayKey = () =>
getOverlays()
? Object.keys(getOverlays()).filter((key) => getOverlays()[key].selected)[0]
: 'none';
const currentOverlay = () =>
getOverlays() ? getOverlays()[currentOverlayKey()] : {};
const overlayDefinitionsPlusNone = { none: {}, ...overlayDefinitions };
export const currentCategory = () =>
Object.keys(
currentOverlayKey() === 'none'
? {}
: { none: [], ...overlayDefinitionsPlusNone[currentOverlayKey()] }
);
const currentOverlayHighlightedKey = () =>
currentOverlay() && currentOverlay().highlighted
? currentOverlay().highlighted
: 'none';
export const isHighlightedTagType = (tagType: string) => {
const currentOverlayHighlightedDefinition: string[] =
overlayDefinitions[currentOverlayKey()][currentOverlayHighlightedKey()];
return currentOverlayHighlightedDefinition.includes(tagType);
};
const MapTilesProvider: Component<{}> = (props) => {
const [open, setOpen] = createSignal(false);
const navigate = useNavigate();
const handleClickOpen = () => {
setOpen(true);
};
const handleClose = () => {
setOpen(false);
};
const params = useParams();
const [t] = useI18n();
const handleChange = (ev: any) => {
navigate(
`/map/${ev.target.value}/${params.lon}/${params.lat}/${params.zoom}/${params.rotation}`
);
setOpen(false);
};
createEffect(() => {
console.log({
caller: 'MapTilesProvider',
overlays: getOverlays(),
currentOverlayKey: currentOverlayKey(),
currentOverlay: currentOverlay(),
currentOverlayDefinition: currentCategory(),
currentOverlayHighlightedKey: currentOverlayHighlightedKey(),
});
});
const getOverlaysAddingSelectedIfMissing = (key: string) => {
const overlays = getOverlays();
if (!Object.keys(overlays).includes(key)) {
overlays[key] = cloneDeep(defaultOverlayContent);
}
return overlays;
};
const handleOverlayChange = (ev: any) => {
const value = ev.target.value;
console.log({
caller: 'MapTilesProvider / handleOverlayChange',
ev,
value,
});
const newOverlays = getOverlaysAddingSelectedIfMissing(value);
Object.keys(newOverlays).forEach((key) => {
newOverlays[key].selected = key === value;
});
dispatch({
action: 'putOverlays',
params: { id, overlays: newOverlays },
});
};
const handleOverlayHighlightChange = (ev: any) => {
const value = ev.target.value;
console.log({
caller: 'MapTilesProvider / handleOverlayHighlightChange',
ev,
value,
});
const newOverlays = getOverlays();
newOverlays[currentOverlayKey()].highlighted = value;
dispatch({
action: 'putOverlays',
params: { id, overlays: newOverlays },
});
};
return (
<>
<div class={style.control}>
<IconButton onClick={handleClickOpen}>
<LayersIcon />
</IconButton>
</div>
<Dialog
closeHandler={handleClose}
open={open()}
title={t('chooseYourMap')}
>
<DrawingSelector/>
<Tree
title={t('overlay')}
content={
<>
<RadioGroup
defaultValue={currentOverlayKey()}
onChange={handleOverlayChange}
>
<For each={Object.keys(overlayDefinitionsPlusNone)}>
{(p: string) => (
<FormControlLabel value={p} control={<Radio />} label={p} />
)}
</For>
</RadioGroup>
<Show when={currentCategory().length > 0}>
<div>---</div>
<div>Highlight</div>
<RadioGroup
defaultValue={currentOverlayHighlightedKey()}
onChange={handleOverlayHighlightChange}
>
<For each={currentCategory()}>
{(p: string) => (
<FormControlLabel
value={p}
control={<Radio />}
label={p}
/>
)}
</For>
</RadioGroup>
</Show>
</>
}
subTree={undefined}
></Tree>
<Tree
title={t('baseLayer')}
content={
<RadioGroup defaultValue={params.provider} onChange={handleChange}>
<For each={Object.keys(mapTileProviders)}>
{(p: string) => (
<FormControlLabel
value={p}
control={<Radio />}
label={mapTileProviders[p].name}
/>
)}
</For>
</RadioGroup>
}
subTree={undefined}
></Tree>
</Dialog>
</>
);
};
export default MapTilesProvider;

View File

@ -0,0 +1,6 @@
export {
default,
mapTileProviders,
currentCategory as currentOverlayDefinition,
isHighlightedTagType,
} from './MapTileProvider';

View File

@ -1,93 +0,0 @@
import React, { useId } from 'react';
import { geoPoint, lat2tile, lon2tile, Point } from '../../lib/geo';
import { tileProviders } from './tile';
interface AvatarForLocationProps {
location: geoPoint;
zoom?: number;
tileProvider?: string;
size?: number;
}
const AvatarForLocation: React.FC<AvatarForLocationProps> = (
props: AvatarForLocationProps
) => {
const size = props.size !== undefined ? props.size : 42;
const zoom = props.zoom ? Math.round(props.zoom) : 16;
const tileProvider = props.tileProvider ? props.tileProvider : 'osm';
const location = props.location;
const tilesLocation: Point = {
x: lon2tile(location.lon, zoom),
y: lat2tile(location.lat, zoom),
};
const locationWithinTile: Point = {
x: 256 * (tilesLocation.x - Math.floor(tilesLocation.x)),
y: 256 * (tilesLocation.y - Math.floor(tilesLocation.y)),
};
const eastTileNeeded = locationWithinTile.x > 256 - size / 2;
const westTileNeeded = locationWithinTile.x < size / 2;
const southTileNeeded = locationWithinTile.y > 256 - size / 2;
const northTileNeeded = locationWithinTile.y < size / 2;
const getImage = (stepX: number, stepY: number) => (
<image
href={tileProviders[tileProvider].getTileUrl(
zoom,
Math.floor(tilesLocation.x) + stepX,
Math.floor(tilesLocation.y) + stepY
)}
height='256'
width={256}
x={-locationWithinTile.x + size / 2 + stepX * 256}
y={-locationWithinTile.y + size / 2 + stepY * 256}
/>
);
var images = [getImage(0, 0)];
if (eastTileNeeded) {
images.push(getImage(1, 0));
}
if (westTileNeeded) {
images.push(getImage(-1, 0));
}
if (southTileNeeded) {
images.push(getImage(0, 1));
}
if (northTileNeeded) {
images.push(getImage(0, -1));
}
if (northTileNeeded && eastTileNeeded) {
images.push(getImage(1, -1));
}
if (northTileNeeded && westTileNeeded) {
images.push(getImage(-1, -1));
}
if (southTileNeeded && eastTileNeeded) {
images.push(getImage(1, 1));
}
if (southTileNeeded && westTileNeeded) {
images.push(getImage(-1, 1));
}
console.log(`${images.length} images: ${images}`);
const id = useId();
return (
<svg width={size} height={size}>
<defs>
<clipPath id={`cut-off-${id}`}>
<circle cx={size / 2} cy={size / 2} r={size / 2} />
</clipPath>
</defs>
<g clip-path={`url(#cut-off-${id})`}>{[images]}</g>
</svg>
);
};
export default AvatarForLocation;

View File

@ -1,33 +0,0 @@
import React
from 'react';
import { useSelector } from 'react-redux';
import { MapState } from '../../store/map';
const CurrentLocation: React.FC<{}> = () => {
const scale = useSelector(
(state: { map: MapState }) => state.map.whiteboard.scale
);
const CurrentLocationState = useSelector(
(state: { map: MapState }) => state.map.currentLocation
);
return (
<circle
cx={CurrentLocationState.whiteboard.x}
cy={CurrentLocationState.whiteboard.y}
r={6 / scale}
fill='blue'
opacity='90%'
stroke='white'
strokeWidth={3/scale}
strokeOpacity='100%'
></circle>
);
};
export default CurrentLocation;

View File

@ -1,48 +0,0 @@
import React from 'react';
import { useFind } from 'react-pouchdb';
import { lat2tile, lon2tile } from '../../lib/geo';
import { zoom0 } from '../../store/map';
const Gpx: React.FC<{ gpx: any }> = (props) => {
var trkpts: any[] = [];
trkpts = useFind({
selector: {
type: 'trkpt',
gpx: props.gpx._id,
},
// sort: ['trkpt.time'],
// use_index: 'type-trkpt-gpx-time3',
});
console.log(
`rendering gpx, subtype:"${props.gpx.subtype}", ${trkpts.length} points`
);
trkpts.sort((first: any, second: any) =>
first.trkpt.time.localeCompare(second.trkpt.time)
);
const clickHandler = (event: any) => {
console.log(`gpx (${JSON.stringify(props.gpx)}) clicked.`);
};
// console.log(`gpx: ${JSON.stringify(props.gpx)}`);
const d = trkpts.reduce((previous: string, current: any, index: number) => {
const action = index === 0 ? 'M' : index === 1 ? 'L' : '';
const trkpt = current.trkpt;
return `${previous} ${action} ${lon2tile(trkpt.$.lon, zoom0)}, ${lat2tile(
trkpt.$.lat,
zoom0
)}`;
}, '');
return (
<path d={d} className={`track ${props.gpx.subtype}`} pointerEvents='none' />
);
};
export default Gpx;

View File

@ -1,111 +0,0 @@
import { IonButton, IonIcon, isPlatform } from '@ionic/react';
import { cloudDownload } from 'ionicons/icons';
import React, { Fragment, useRef } from 'react';
import { Filesystem, Directory, Encoding } from '@capacitor/filesystem';
import { useDB } from 'react-pouchdb';
import { FileOpener } from '@capacitor-community/file-opener';
import { getGpxAsXmlString } from '../../db/gpx';
const GpxExport: React.FC<{ gpx: any }> = (props: { gpx: any }) => {
const db = useDB();
const isCapacitor = isPlatform('capacitor');
console.log(`isPlatform('capacitor'): ${isPlatform('capacitor')}`);
const hiddenLinkElement = useRef<HTMLAnchorElement>(null);
var downloadBaseName: string;
if (props.gpx.metadata.name !== undefined) {
downloadBaseName = props.gpx.metadata.name.substr(
0,
props.gpx.metadata.name.lastIndexOf('.')
);
} else if (props.gpx.gpx.metadata.name !== undefined) {
downloadBaseName = props.gpx.gpx.metadata.name;
} else {
downloadBaseName = `track-${props.gpx.metadata.lastModified}`;
}
const downloadExt = 'gpx';
const downloadName = `${downloadBaseName}.${downloadExt}`;
const getNewFilename: any = async (
filename: string,
extension: string,
i = 0
) => {
const filenameToTest =
i === 0 ? `${filename}.${extension}` : `${filename}(${i}).${extension}`;
try {
await Filesystem.stat({
path: filenameToTest,
directory: Directory.Documents,
});
return getNewFilename(filename, extension, i + 1);
} catch {
return filenameToTest;
}
};
const download = async (event: any) => {
event.preventDefault();
console.log('download()');
const gpxAsXml = await getGpxAsXmlString(db, props.gpx._id);
console.log(`gpxAsXml: ${gpxAsXml}`);
if (isCapacitor) {
const filename = await getNewFilename(
`../Download/${downloadBaseName}`,
downloadExt
);
console.log(`filename: ${filename}`);
const fileUrl = await Filesystem.writeFile({
path: filename,
data: gpxAsXml,
directory: Directory.Documents,
encoding: Encoding.UTF8,
recursive: true,
});
console.log(`fileUrl: ${fileUrl.uri}`);
await FileOpener.open({
filePath: fileUrl.uri,
contentType: 'application/gpx+xml',
openWithDefault: false,
});
} else {
const blob = new Blob([gpxAsXml], {
type: 'application/gpx+xml',
});
const fileDownloadUrl = URL.createObjectURL(blob);
console.log(`fileDownloadUrl: ${fileDownloadUrl}`);
console.log(
`hiddenLinkElement.current, href: ${
hiddenLinkElement.current!.href
}, click: ${hiddenLinkElement.current!.click}`
);
hiddenLinkElement.current!.href = fileDownloadUrl;
hiddenLinkElement.current?.click();
console.log(
`hiddenLinkElement.current, href: ${
hiddenLinkElement.current!.href
}, click: ${hiddenLinkElement.current!.click}`
);
URL.revokeObjectURL(fileDownloadUrl);
hiddenLinkElement.current!.href = '';
}
};
return (
<Fragment>
<IonButton id='gpx-export-button' onClick={download}>
<IonIcon icon={cloudDownload} title='Export' slot='icon-only' />
</IonButton>
<a className='hidden' download={downloadName} ref={hiddenLinkElement}>
download
</a>
</Fragment>
);
};
export default GpxExport;

View File

@ -1,221 +0,0 @@
import React, { Fragment, useRef, useState } from 'react';
import { useDB, useFind } from 'react-pouchdb';
import '../../theme/get-location.css';
import {
IonButton,
IonButtons,
IonContent,
IonIcon,
IonModal,
IonTitle,
IonToolbar,
} from '@ionic/react';
import {
recordingOutline,
recording,
closeCircle,
pauseCircle,
stop,
} from 'ionicons/icons';
import {
startBackgroundGeolocation,
stopBackgroundGeolocation,
} from '../../lib/background-geolocation';
import { appendTrkpt, deleteCurrent, saveCurrent } from '../../db/gpx';
import { enterAnimation, leaveAnimation } from '../../lib/animation';
import { useDispatch, useSelector } from 'react-redux';
import { mapActions } from '../../store/map';
import { SettingsState } from '../../store/settings';
import i18n, { setI18nLanguage } from '../../i18n/index';
declare global {
var $lastValidLocationTime: number;
}
const GpxRecord: React.FC<{}> = () => {
const language = useSelector(
(state: { settings: SettingsState }) => state.settings.language
);
setI18nLanguage(language);
const db = useDB();
const [isRecording, setIsRecording] = useState(false);
const [watcher_id, setWatcher_id] = useState();
const geolocationsSettingsState = useSelector(
(state: { settings: SettingsState }) => state.settings.geolocation
);
const gpxes = useFind({
selector: {
type: 'gpx',
subtype: 'current',
},
});
const hasCurrentTrack = gpxes.length > 0;
console.log(
`GpxRecord, hasCurrentTrack:${hasCurrentTrack}, gpxes: ${JSON.stringify(
gpxes
)}`
);
const modal = useRef<HTMLIonModalElement>(null);
const dismiss = () => {
modal.current?.dismiss();
};
const dispatch = useDispatch();
const newLocationHandler = (location: any) => {
console.log(
`Location filtering, elapsed time: ${
location.time - globalThis.$lastValidLocationTime
}`
);
if (
location.time - globalThis.$lastValidLocationTime >
geolocationsSettingsState.minTimeInterval
) {
globalThis.$lastValidLocationTime = location.time;
appendTrkpt(db, {
$: {
lat: location.latitude,
lon: location.longitude,
},
ele: location.altitude,
time: new Date(location.time).toISOString(),
extensions: {
speed: location.speed,
accuracy: location.accuracy,
},
});
dispatch(
mapActions.setCurrent({
lat: location.latitude,
lon: location.longitude,
})
);
dispatch(
mapActions.setCenter({
lat: location.latitude,
lon: location.longitude,
})
);
}
};
const startRecording = () => {
globalThis.$lastValidLocationTime = 0;
startBackgroundGeolocation(
newLocationHandler,
geolocationsSettingsState.minDistance
).then((result) => {
setWatcher_id(result);
});
setIsRecording(true);
dismiss();
};
const pauseRecording = () => {
if (isRecording) {
stopBackgroundGeolocation(watcher_id);
}
setIsRecording(false);
dismiss();
};
const stopRecording = () => {
saveCurrent(db);
pauseRecording();
};
const deleteRecording = () => {
deleteCurrent(db);
pauseRecording();
};
return (
<Fragment>
<IonButton id='open-RecordDialog'>
{isRecording && (
<IonIcon slot='icon-only' icon={recording} style={{ color: 'red' }} />
)}
{!isRecording && <IonIcon slot='icon-only' icon={recordingOutline} />}
</IonButton>
<IonModal
ref={modal}
trigger='open-RecordDialog'
enterAnimation={enterAnimation}
leaveAnimation={leaveAnimation}
>
<IonToolbar>
<IonTitle>{i18n.trackRecording}</IonTitle>
<IonButtons slot='end'>
<IonButton onClick={() => dismiss()}>{i18n.close}</IonButton>
</IonButtons>
</IonToolbar>
<IonContent>
{!isRecording && (
<IonButton
expand='block'
color='primary'
size='large'
onClick={startRecording}
>
<IonIcon slot='start' icon={recording}></IonIcon>
{hasCurrentTrack ? (
<span>{i18n.resumeRecording}</span>
) : (
<span>{i18n.startRecording}</span>
)}
</IonButton>
)}
{isRecording && (
<IonButton
expand='block'
color='primary'
size='large'
onClick={pauseRecording}
>
<IonIcon slot='start' icon={pauseCircle}></IonIcon>
{i18n.pauseRecording}
</IonButton>
)}
{hasCurrentTrack && (
<>
<IonButton
expand='block'
color='danger'
size='large'
onClick={stopRecording}
>
<IonIcon slot='start' icon={stop}></IonIcon>
{i18n.stopRecording}
</IonButton>
<IonButton
expand='block'
color='danger'
size='large'
onClick={deleteRecording}
>
<IonIcon slot='start' icon={closeCircle}></IonIcon>
{i18n.cancelRecording}
</IonButton>
</>
)}
</IonContent>
</IonModal>
</Fragment>
);
};
export default GpxRecord;

View File

@ -1,186 +0,0 @@
import {
IonModal,
IonToolbar,
IonTitle,
IonButtons,
IonButton,
IonContent,
IonLabel,
IonList,
IonListHeader,
IonItem,
IonSpinner,
} from '@ionic/react';
import React, { Fragment, useRef, useState } from 'react';
import { useSelector } from 'react-redux';
import i18n from '../../i18n';
import { geoPoint } from '../../lib/geo';
import { MapState } from '../../store/map';
import OsmNotesChat from './OsmNotesChat';
const LocationInfo: React.FC<{}> = () => {
const scope = useSelector((state: { map: MapState }) => state.map.scope);
const modal = useRef<HTMLIonModalElement>(null);
const dismiss = () => {
modal.current?.dismiss();
};
const [elevation, setElevation] = useState(undefined);
const [address, setAddress] = useState<{ display_name: any } | undefined>(
undefined
);
const [notes, setNotes] = useState<{ features: any } | undefined>(undefined);
const findElevation = async () => {
setElevation(undefined);
const response = await fetch(
// `https://api.opentopodata.org/v1/mapzen?locations=${scope.center.lat},${scope.center.lon}`,
`https://api.open-meteo.com/v1/elevation?latitude=${scope.center.lat}&longitude=${scope.center.lon}`,
{}
);
const data = await response.json();
console.log(`elevation: ${JSON.stringify(data)}`);
setElevation(data.elevation[0]);
};
const findAddress = async () => {
setAddress(undefined);
const response = await fetch(
`https://nominatim.openstreetmap.org/reverse?lat=${
scope.center.lat
}&lon=${
scope.center.lon
}&format=jsonv2&addressdetails=1&extratags=1&namedetails=1&accept-language=${i18n.getLanguage()}`,
{}
);
const data = await response.json();
console.log(`address: ${JSON.stringify(data)}`);
setAddress(data);
};
const roughDistance = (a: geoPoint, b: geoPoint): number => {
const pseudoDistanceInDegrees = Math.sqrt(
(a.lat - b.lat) ** 2 + (a.lon - b.lon) ** 2
);
const metresPerDegree =
111111 * Math.cos((scope.center.lat * Math.PI) / 180);
return pseudoDistanceInDegrees * metresPerDegree;
};
const findNotes = async () => {
setNotes(undefined);
const metresPerDegree =
111111 * Math.cos((scope.center.lat * Math.PI) / 180);
const deltaDegrees = 5000 / metresPerDegree;
const response = await fetch(
`https://api.openstreetmap.org/api/0.6/notes.json?bbox=${
scope.center.lon - deltaDegrees
},${scope.center.lat - deltaDegrees},${scope.center.lon + deltaDegrees},${
scope.center.lat + deltaDegrees
}`,
{}
);
const data = await response.json();
console.log(`notes: ${JSON.stringify(data)}`);
data.features.sort(
(first: any, second: any) =>
roughDistance(scope.center, {
lon: first.geometry.coordinates[0],
lat: first.geometry.coordinates[1],
}) -
roughDistance(scope.center, {
lon: second.geometry.coordinates[0],
lat: second.geometry.coordinates[1],
})
);
setNotes(data);
};
const ionModalWillPresentHandler = async () => {
findElevation();
findAddress();
findNotes();
};
const localDate = (isoDate: string) => {
const date = new Date(isoDate);
const format = new Intl.DateTimeFormat(i18n.getLanguage(), {
dateStyle: 'full',
timeStyle: 'long',
});
return format.format(date);
};
const osmNotesChat =
notes !== undefined && notes.features.length ? (
<OsmNotesChat notes={notes} />
) : (
<></>
);
return (
<IonModal
trigger='information-request'
ref={modal}
onIonModalWillPresent={ionModalWillPresentHandler}
>
<IonToolbar>
<IonTitle>{i18n.locationInfo!.title}</IonTitle>
<IonButtons slot='end'>
<IonButton onClick={() => dismiss()}>{i18n.close}</IonButton>
</IonButtons>
</IonToolbar>
<IonContent>
<IonList lines='full' class='ion-no-margin'>
<IonListHeader lines='full'>
<IonLabel>{i18n.locationInfo!.location}</IonLabel>
</IonListHeader>
<IonItem>
<IonLabel>{i18n.locationInfo!.lat}</IonLabel>
{scope.center.lat} N
</IonItem>
<IonItem>
<IonLabel>{i18n.locationInfo!.lon}</IonLabel>
{scope.center.lon} E
</IonItem>
<IonItem>
<IonLabel>{i18n.locationInfo!.elevation}</IonLabel>
{elevation === undefined && <IonSpinner name='lines' />}
{elevation !== undefined && <>{elevation} m</>}
</IonItem>
</IonList>
<IonList lines='full' class='ion-no-margin'>
<IonListHeader lines='full'>
<IonLabel>{i18n.locationInfo!.address}</IonLabel>
</IonListHeader>
<IonItem>
<IonLabel>{i18n.locationInfo!.display_name}</IonLabel>
{address === undefined && <IonSpinner name='lines' />}
{address !== undefined &&
address.display_name
.split(',')
.map((value: string, index: number) => (
<Fragment key={index}>
{value}
<br />
</Fragment>
))}
</IonItem>
</IonList>
<IonList lines='full' class='ion-no-margin'>
<IonListHeader lines='full'>
<IonLabel>
{i18n.locationInfo!.notes}
{notes === undefined && <IonSpinner name='lines' />}
</IonLabel>
</IonListHeader>
{osmNotesChat}
</IonList>
</IonContent>
</IonModal>
);
};
export default LocationInfo;

View File

@ -0,0 +1,22 @@
.ol-map {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
}
.ol-control {
position: absolute;
background-color: rgba(255, 255, 255, 0.4);
border-radius: 4px;
padding: 2px;
}
.ol-full-screen {
top: 0.5em;
right: 0.5em;
}
.ol-rotate {
top: auto;
bottom: 0.5em;
right: 3em;
}

345
src/components/map/Map.tsx Normal file
View File

@ -0,0 +1,345 @@
import { Component, createEffect, createSignal, onMount } from 'solid-js';
import { useParams, useNavigate } from '@solidjs/router';
import OlMap from 'ol/Map';
import View from 'ol/View';
import TileLayer from 'ol/layer/Tile';
import VectorLayer from 'ol/layer/Vector';
import VectorSource from 'ol/source/Vector';
import Feature from 'ol/Feature';
import Attribution from 'ol/control/Attribution';
import Rotate from 'ol/control/Rotate';
import ScaleLine from 'ol/control/ScaleLine';
import Control from 'ol/control/Control';
import Zoom from 'ol/control/Zoom';
import { fromLonLat, toLonLat } from 'ol/proj';
import DragRotate from 'ol/interaction/DragRotate';
import 'ol/ol.css';
import './Map.css';
import { Collection } from 'ol';
import { Point } from 'ol/geom';
import { Style, Icon } from 'ol/style';
import GetLocation, { getCurrentLocation } from '../get-location';
import ShowLocationIcon from '../get-location/ShowLocationIcon.svg';
import { Back, Forward } from '../back-forward';
import GpxImport, { importUrls } from '../import';
import AllGpxes from '../all-gpxes';
import MapTileProvider, { mapTileProviders } from '../map-tile-provider';
import Interaction from 'ol/interaction/Interaction';
import DragPan from 'ol/interaction/DragPan';
import PinchRotate from 'ol/interaction/PinchRotate';
import PinchZoom from 'ol/interaction/PinchZoom';
import KeyboardPan from 'ol/interaction/KeyboardPan';
import KeyboardZoom from 'ol/interaction/KeyboardZoom';
import MouseWheelZoom from 'ol/interaction/MouseWheelZoom';
import DragZoom from 'ol/interaction/DragZoom';
import Infos, { clickHandler } from '../infos';
import GpxDialog from '../gpx-dialog';
import GpxRecord from '../gpx-record';
import dispatch from '../../workers/dispatcher-main';
import { debounce } from 'lodash';
import { AndroidFullScreen } from '@awesome-cordova-plugins/android-full-screen';
import { Overlays } from '../overlays/Overlays';
import Finder, { findLocation } from '../finder';
import Note from '../note';
import Invitation, { searchInvitation } from '../invitation';
import Updater from '../updater';
import SystemDrawer from '../system-drawer';
import { receiveIntent } from '../../lib/intent-receivers';
const [getState, setState] = createSignal({
lon: 0,
lat: 0,
rotation: 0,
zoom: 0,
provider: 'osm',
});
const getZoomInteger = () => Math.floor(getState().zoom);
export { getState, getZoomInteger };
const [getMap, setMap] = createSignal<OlMap | null>(null);
export { getMap };
const Map: Component = () => {
const navigate = useNavigate();
const params = useParams();
searchInvitation();
// See https://stackoverflow.com/questions/71288670/how-to-make-fullscreen-ionic-capacitor-app
AndroidFullScreen.isImmersiveModeSupported()
.then(() => AndroidFullScreen.immersiveMode())
.catch(console.warn);
if (window.plugins) {
window.plugins.intentShim.registerBroadcastReceiver(
{
filterActions: [
'android.intent.action.VIEW',
'android.intent.action.SEND',
],
},
function (intent: any) {
console.log({
caller: 'Intent broadcast receiver',
intent,
});
}
);
window.plugins.intentShim.onIntent(function (intent: any) {
console.log({ caller: 'Intent receiver', intent });
if (receiveIntent(intent, navigate)) {
return;
}
});
} else {
console.log({
caller: 'Intent',
message: "window.plugins doesn't exist",
window,
});
}
const dropHandler = (event: any) => {
event.preventDefault();
console.log({
caller: 'Map / dropHandler',
event,
files: event.dataTransfer.files,
});
importUrls(event.dataTransfer.files);
};
const dragEnterHandler = (event: any) => {
event.preventDefault();
console.log({ caller: 'Map / dragEnterHandler', event });
};
const dragOverHandler = (event: any) => {
event.preventDefault();
console.log({ caller: 'Map / dragOverHandler', event });
};
// const dragStartHandler = (event: any) => {
// event.preventDefault();
// event.dataTransfer.effectAllowed = 'all';
// event.dataTransfer.dropEffect = 'move';
// console.log({ caller: 'Map / dragStartHandler', event });
// };
if (
params.lat === '0' &&
params.lon === '0' &&
params.provider === 'osm' &&
params.rotation === '0' &&
params.zoom === '2'
) {
dispatch({ action: 'getState' }, (error, state) => {
if (state !== null) {
console;
navigate(
`/map/${state.provider}/${state.lon}/${state.lat}/${state.zoom}/${state.rotation}`
);
}
});
}
let target: HTMLDivElement;
const debouncedDbSetState = debounce((state: any) => {
console.log({ caller: 'Map / debouncedDbSetState', state });
dispatch({ action: 'setState', params: state });
}, 60000);
createEffect(async () => {
console.log({
caller: 'Map / setState',
params: {
...params,
},
lastCommit: import.meta.env.VITE_GIT_COMMIT_HASH,
});
setState({
provider: params.provider,
lon: +params.lon,
lat: +params.lat,
rotation: +params.rotation,
zoom: +params.zoom,
});
debouncedDbSetState(getState());
const map = getMap();
const layers = map?.getLayers();
const tileLayer = layers?.item(0) as TileLayer<any> | undefined;
if (tileLayer?.get('provider') !== params.provider) {
tileLayer?.set('provider', params.provider, true);
tileLayer?.setSource(mapTileProviders[params.provider].source);
}
const view = map?.getView();
view?.animate({
center: fromLonLat([getState().lon, getState().lat]),
rotation: getState().rotation,
zoom: getState().zoom,
duration: 1000,
});
});
createEffect(() => {
const location = getCurrentLocation();
if (location) {
console.log({
caller: 'Map / updateLocation',
location,
});
const source = getMap()
?.getAllLayers()
.at(1)
?.getSource() as VectorSource;
source!.clear(true);
const point = new Point(fromLonLat([location.lon, location.lat]));
const style = new Style({
image: new Icon({
// size: [20, 20],
imgSize: [24, 24],
declutterMode: 'obstacle',
// @ts-ignore
src: ShowLocationIcon,
}),
});
const feature = new Feature({
geometry: point,
// labelPoint: point,
// name: 'current location',
style: style,
});
feature.set('type', 'current-location');
feature.setStyle(style);
source.addFeature(feature);
// source.changed();
console.log({
caller: 'Map / updateLocation',
location,
source,
style,
feature,
});
}
});
onMount(async () => {
// olUseGeographic();
const changeListener = (event: any) => {
const map = getMap();
const view = map?.getView();
const center = view?.getCenter();
if (center) {
const centerLonLat = toLonLat(center);
navigate(
`/map/${getState().provider}/${centerLonLat[0]}/${
centerLonLat[1]
}/${view?.getZoom()}/${view?.getRotation()}`
);
}
console.log({
caller: 'Map / changeListener',
event,
params: {
...params,
},
map,
center,
});
};
const tileLayer = new TileLayer({
source: mapTileProviders[params.provider].source,
});
tileLayer.set('provider', params.provider, true);
const vectorLayer = new VectorLayer({
source: new VectorSource(),
zIndex: Infinity,
});
// console.log({
// caller: 'Map / projections',
// vector: vectorLayer.getSource()?.getProjection(),
// vectorTile: clusterableVectorTileSource.getProjection(),
// });
let controls = [
new Attribution({ collapsible: true }),
new Rotate(),
new ScaleLine({ bar: true }),
];
if (window.Capacitor.platform === 'web') {
controls.push(new Zoom());
}
const olMap = new OlMap({
view: new View({
center: fromLonLat([+getState().lon, +getState().lat]),
zoom: +getState().zoom,
rotation: +getState().rotation,
}),
layers: [tileLayer, vectorLayer],
target: target,
controls: new Collection<Control>(controls),
moveTolerance: 10,
interactions: new Collection<Interaction>([
new DragRotate(),
// new DoubleClickZoom(),
new DragPan(),
new PinchRotate(),
new PinchZoom(),
new KeyboardPan(),
new KeyboardZoom(),
new MouseWheelZoom(),
new DragZoom(),
]),
});
olMap.on(['moveend'], changeListener);
olMap.on(['dblclick'], clickHandler);
setMap(olMap);
});
return (
//<OsmFetch map={getMap} />
// @ts-ignore
<div
class='ol-map'
ref={target}
ondrop={dropHandler}
ondragover={dragOverHandler}
ondragenter={dragEnterHandler}
>
<Updater />
<Invitation />
<Overlays map={getMap} />
<Note />
<Finder />
<GetLocation />
<Show when={window.Capacitor.platform !== 'web'}>
<Forward />
<Back />
<GpxRecord />
</Show>
<GpxImport />
<MapTileProvider />
<GpxDialog />
<SystemDrawer />
<AllGpxes map={getMap} />
<Infos />
</div>
);
};
export default Map;

View File

@ -1,143 +0,0 @@
import React, { useState } from 'react';
import {
MainContainer,
Sidebar,
ConversationList,
Conversation,
ConversationHeader,
ChatContainer,
MessageList,
Message,
Avatar,
} from '@chatscope/chat-ui-kit-react';
import '@chatscope/chat-ui-kit-styles/dist/default/styles.min.css';
import { useSelector } from 'react-redux';
import i18n from '../../i18n';
import { geoPoint } from '../../lib/geo';
import { MapState } from '../../store/map';
import AvatarForLocation from './AvatarForLocation';
interface OsmNotesChatProps {
notes: { features: any };
}
const OsmNotesChat: React.FC<OsmNotesChatProps> = (
props: OsmNotesChatProps
) => {
const scope = useSelector((state: { map: MapState }) => state.map.scope);
const [noteIndex, setNoteIndex] = useState(0);
const conversationClickHandlerFactory = (index: number) => (event: any) => {
setNoteIndex(index);
};
const roughDistance = (a: geoPoint, b: geoPoint): number => {
const pseudoDistanceInDegrees = Math.sqrt(
(a.lat - b.lat) ** 2 + (a.lon - b.lon) ** 2
);
const metresPerDegree =
111111 * Math.cos((scope.center.lat * Math.PI) / 180);
return pseudoDistanceInDegrees * metresPerDegree;
};
const AvatarForFeature: React.FC<{
feature: any;
size: number;
as: any;
}> = (props: { feature: any; size: number; as: any }) => {
const distance = roughDistance(scope.center, {
lon: props.feature.geometry.coordinates[0],
lat: props.feature.geometry.coordinates[1],
});
return (
<Avatar size={props.size <= 50 ? 'sm' : 'lg'}>
<AvatarForLocation
location={{
lon: props.feature.geometry.coordinates[0],
lat: props.feature.geometry.coordinates[1],
}}
size={props.size}
/>
</Avatar>
);
};
return (
<div style={{ position: 'relative' }}>
<MainContainer responsive>
<Sidebar position='left' id='chat-sidebar'>
<ConversationList>
{props.notes
.features!.slice(0, 5)
.map((feature: any, index: number) => (
<Conversation
onClick={conversationClickHandlerFactory(index)}
key={feature.properties.id}
name={i18n.locationInfo!.at!(
roughDistance(scope.center, {
lon: feature.geometry.coordinates[0],
lat: feature.geometry.coordinates[1],
})
)}
info={feature.properties.status}
>
<AvatarForFeature feature={feature} size={42} as={Avatar} />
</Conversation>
))}
</ConversationList>
</Sidebar>
<ChatContainer>
<ConversationHeader>
<AvatarForFeature
feature={props.notes.features[noteIndex]}
size={68}
as={Avatar}
/>
<ConversationHeader.Content>
<span
style={{
alignSelf: 'flex-center',
}}
>
{i18n.locationInfo!.at!(
roughDistance(scope.center, {
lon: props.notes.features[noteIndex].geometry
.coordinates[0],
lat: props.notes.features[noteIndex].geometry
.coordinates[1],
})
)}
</span>
</ConversationHeader.Content>
</ConversationHeader>
<MessageList>
{noteIndex < props.notes.features.length &&
props.notes.features[noteIndex].properties.comments.map(
(comment: any, index: number) => (
<Message
key={`${props.notes.features[noteIndex].properties.id}/${index}`}
model={{
direction: 'incoming',
position: 'single',
sender: comment.user,
sentTime: comment.date,
payload: comment.html,
}}
>
<Message.Header
sender={comment.user}
sentTime={comment.date}
/>
<Message.Footer sentTime={comment.action} />
<Avatar>{comment.user ? comment.user : '??'}</Avatar>
</Message>
)
)}
</MessageList>
</ChatContainer>
</MainContainer>
</div>
);
};
export default OsmNotesChat;

View File

@ -1,146 +0,0 @@
import _ from 'lodash';
import React, { useRef } from 'react';
import { useSelector } from 'react-redux';
import { informationCircleOutline } from 'ionicons/icons';
import { Point } from '../../lib/geo';
import { MapState } from '../../store/map';
import '../../theme/map.css';
import {
IonButton,
IonButtons,
IonModal,
IonTitle,
IonToolbar,
} from '@ionic/react';
import i18n from '../../i18n';
import eventBus from '../../lib/pubsub';
export const getSTile = (lat: number, zoom: number) => {
/**
* The horizontal distance represented by each square tile, measured along the parallel at a given latitude, is given by:
* Stile = C cos(latitude) / 2 zoomlevel
* As tiles are 256-pixels wide, the horizontal distance represented by one pixel is:
* Spixel = Stile / 256 = C cos(latitude) / 2 (zoomlevel + 8)
* where C means the equatorial circumference of the Earth (40 075 016.686 m 2π 6 378 137.000 m for the reference geoid used by OpenStreetMap).
* see https://wiki.openstreetmap.org/wiki/Zoom_levels
*/
return (40075016.686 * Math.cos((lat * Math.PI) / 180)) / 2 ** zoom;
};
const Reticle: React.FC<{}> = () => {
const windowState = useSelector(
(state: { map: MapState }) => state.map.window
);
const scope = useSelector((state: { map: MapState }) => state.map.scope);
const radius = Math.min(windowState.width, windowState.height) / 4;
const center: Point = {
x: windowState.width / 2,
y: windowState.height / 2,
};
const sTile = getSTile(scope.center.lat, scope.zoom);
const radiusMeters = (sTile * radius) / 256;
const radiusOrder = Math.floor(Math.log10(radiusMeters));
const radiusRoughUnit = radiusMeters / 10 ** radiusOrder;
var radiusBaseUnit, radiusBaseSubUnit;
if (radiusRoughUnit <= 2) {
radiusBaseUnit = 1;
radiusBaseSubUnit = 0.2;
} else if (radiusRoughUnit <= 5) {
radiusBaseUnit = 2;
radiusBaseSubUnit = 0.5;
} else {
radiusBaseUnit = 5;
radiusBaseSubUnit = 1;
}
const nbSubUnits = Math.floor(
radiusMeters / (radiusBaseSubUnit * 10 ** radiusOrder)
);
const nbUnits = Math.floor(
radiusMeters / (radiusBaseUnit * 10 ** radiusOrder)
);
const radiusUnit = radiusOrder < 3 ? 'm' : 'km';
const radiusUnitValue =
radiusOrder < 3
? radiusBaseUnit * 10 ** radiusOrder
: radiusBaseUnit * 10 ** (radiusOrder - 3);
const subUnitPxStep = ((radiusBaseSubUnit * 10 ** radiusOrder) / sTile) * 256;
const unitPxStep = ((radiusBaseUnit * 10 ** radiusOrder) / sTile) * 256;
console.log(
`radiusMeters: ${radiusMeters}, radiusOrder: ${radiusOrder}, radiusUnit: ${radiusBaseUnit}, radiusSubUnit: ${radiusBaseSubUnit}, nbSubUnits: ${nbSubUnits}`
);
return (
<g className='reticle' pointerEvents='visible' id='information-request'>
<circle
cx={center.x}
cy={center.y}
r={unitPxStep * nbUnits}
fill='transparent'
stroke='black'
strokeWidth={1}
/>
<path
d={`M ${center.x - radius},${center.y}
h ${radius - 3}
m ${6},0
h ${radius - 3}
M ${center.x},${center.y - radius}
v ${radius - 3}
m 0,${6}
v ${radius - 3}`}
strokeWidth={0.5}
/>
<g id='reticle-east'>
<path
stroke='red'
className='reticle'
strokeWidth={0.5}
d={_.range(1, nbSubUnits + 1)
.map(
(i) => `M ${center.x + i * subUnitPxStep},${center.y - 10} v 20`
)
.join(' ')}
/>
<path
stroke='red'
className='reticle'
d={_.range(1, nbUnits + 1)
.map((i) => `M ${center.x + i * unitPxStep},${center.y - 20} v 40`)
.join(' ')}
strokeWidth={0.5}
/>
</g>
<use
stroke='red'
className='reticle'
href='#reticle-east'
transform={`rotate(90, ${center.x}, ${center.y})`}
/>
<use
className='reticle'
href='#reticle-east'
transform={`rotate(180, ${center.x}, ${center.y})`}
/>
<use
className='reticle'
href='#reticle-east'
transform={`rotate(-90, ${center.x}, ${center.y})`}
/>
<text
x={center.x + unitPxStep * nbUnits - 15}
y={center.y - 10}
cursor='pointer'
>
{`${radiusUnitValue * nbUnits} ${radiusUnit}`}
</text>
</g>
);
};
export default Reticle;

View File

@ -1,210 +0,0 @@
import React, { Fragment, useEffect, useRef, useState } from 'react';
import { useDB } from 'react-pouchdb';
import {
IonButton,
IonButtons,
IonContent,
IonIcon,
IonInput,
IonItem,
IonLabel,
IonList,
IonListHeader,
IonModal,
IonSelect,
IonSelectOption,
IonTitle,
IonToolbar,
} from '@ionic/react';
import { options } from 'ionicons/icons';
import { enterAnimation, leaveAnimation } from '../../lib/animation';
import { useDispatch, useSelector } from 'react-redux';
import { settingsActions, SettingsState } from '../../store/settings';
import uri from '../../lib/ids';
import _ from 'lodash';
import i18n, { setI18nLanguage } from '../../i18n/index';
const Settings: React.FC<{}> = () => {
const dispatch = useDispatch();
const db = useDB();
useEffect(() => {
const initFromDb = async () => {
try {
const settingsFromDb = await db.get(uri('settings', {}));
console.log(
`settingsFromDb: ${JSON.stringify(settingsFromDb.settings)}`
);
dispatch(settingsActions.saveSettings(settingsFromDb.settings));
} catch {}
};
initFromDb();
}, [db, dispatch]);
const settingsState = useSelector(
(state: { settings: SettingsState }) => state.settings
);
useEffect(() => {
if (!settingsState.default) {
const settingsFromRedux = async () => {
const id = uri('settings', {});
var settingsFromDb;
try {
settingsFromDb = await db.get(id);
} catch (error) {
console.log(
`Error getting settings from db: ${JSON.stringify(error)}`
);
settingsFromDb = { _id: id, settings: {} };
}
if (!_.isEqual(settingsState, settingsFromDb.settings)) {
console.log(`settingsFromRedux: ${JSON.stringify(settingsState)}`);
settingsFromDb.settings = settingsState;
db.put(settingsFromDb);
}
};
settingsFromRedux();
}
setLocalLanguage(settingsState.language);
}, [db, settingsState]);
const [localLanguage, setLocalLanguage] = useState(settingsState.language);
const languageSelect = useRef<HTMLIonSelectElement>(null);
const pseudo = useRef<HTMLIonInputElement>(null);
const minTimeInterval = useRef<HTMLIonInputElement>(null);
const minDistance = useRef<HTMLIonInputElement>(null);
const modal = useRef<HTMLIonModalElement>(null);
const save = () => {
dispatch(
settingsActions.saveSettings({
user: {
pseudo: pseudo.current?.value,
},
geolocation: {
minTimeInterval: minTimeInterval.current?.value,
minDistance: minDistance.current?.value,
},
language: languageSelect.current?.value,
})
);
dismiss();
};
setI18nLanguage(localLanguage);
const dismiss = () => {
modal.current?.dismiss();
setLocalLanguage(settingsState.language);
};
return (
<Fragment>
<IonButton id='open-SettingsDialog'>
<IonIcon slot='icon-only' icon={options} />
</IonButton>
<IonModal
ref={modal}
trigger='open-SettingsDialog'
enterAnimation={enterAnimation}
leaveAnimation={leaveAnimation}
className='full-height'
>
<IonToolbar>
<IonTitle>{i18n.settings}</IonTitle>
<IonButtons slot='end'>
<IonButton onClick={() => dismiss()}>{i18n.close}</IonButton>
</IonButtons>
</IonToolbar>
<IonContent>
<IonList lines='full' class='ion-no-margin'>
<IonListHeader lines='full'>
<IonLabel>{i18n.language}</IonLabel>
</IonListHeader>
<IonItem>
<IonLabel>{i18n.colonize(i18n.language)} </IonLabel>
<IonSelect
placeholder={i18n.languageSelect.placeHolder}
ref={languageSelect}
value={localLanguage}
interface='popover'
onIonChange={(ev) => setLocalLanguage(ev.detail.value)}
>
{i18n.languageSelect.choices.map((choice) => (
<IonSelectOption key={choice.value} value={choice.value}>
{choice.label}
</IonSelectOption>
))}
</IonSelect>
</IonItem>
</IonList>
<IonList lines='full' class='ion-no-margin'>
<IonListHeader lines='full'>
<IonLabel>{i18n.user}</IonLabel>
</IonListHeader>
<IonItem>
<IonLabel>{i18n.colonize(i18n.pseudo)} </IonLabel>
<IonInput
ref={pseudo}
value={settingsState.user.pseudo}
autocomplete='nickname'
></IonInput>
</IonItem>
</IonList>
<IonList lines='full' class='ion-no-margin'>
<IonListHeader lines='full'>
<IonLabel>{i18n.geolocation}</IonLabel>
</IonListHeader>
<IonItem>
<IonLabel>{i18n.colonize(i18n.minTimeInt)}</IonLabel>
<IonInput
value={settingsState.geolocation.minTimeInterval}
ref={minTimeInterval}
inputMode='numeric'
type='number'
></IonInput>
</IonItem>
<IonItem>
<IonLabel>{i18n.colonize(i18n.minDist)}</IonLabel>
<IonInput
value={settingsState.geolocation.minDistance}
ref={minDistance}
inputMode='numeric'
type='number'
></IonInput>
</IonItem>
</IonList>
<IonItem>
<IonToolbar class='secondary'>
<IonButtons slot='secondary'>
<IonButton
shape='round'
fill='solid'
color='primary'
onClick={() => save()}
>
{i18n.save}
</IonButton>
<IonButton
shape='round'
fill='outline'
color='primary'
onClick={() => dismiss()}
>
{i18n.cancel}{' '}
</IonButton>
</IonButtons>
</IonToolbar>
</IonItem>
</IonContent>
</IonModal>
</Fragment>
);
};
export default Settings;

View File

@ -1,13 +0,0 @@
import React from 'react';
import { IonButton, IonIcon } from '@ionic/react';
import { layersOutline } from 'ionicons/icons';
const TileServerChooserButton: React.FC<{}> = () => {
return (
<IonButton id='open-TileServerChooser'>
<IonIcon slot='icon-only' icon={layersOutline} />
</IonButton>
);
};
export default TileServerChooserButton;

View File

@ -1,77 +0,0 @@
import {
IonButton,
IonButtons,
IonContent,
IonItem,
IonLabel,
IonList,
IonModal,
IonRadio,
IonRadioGroup,
IonTitle,
IonToolbar,
} from '@ionic/react';
import React, { useRef } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { enterAnimation, leaveAnimation } from '../../lib/animation';
import { mapActions, MapState } from '../../store/map';
import { tileProviders } from './tile';
import i18n, { setI18nLanguage } from '../../i18n/index';
import { SettingsState } from '../../store/settings';
const TileServerChooserDialog: React.FC<{}> = () => {
const tileProvider = useSelector(
(state: { map: MapState }) => state.map.scope.tileProvider
) as keyof typeof tileProviders;
const language = useSelector(
(state: { settings: SettingsState }) => state.settings.language
);
setI18nLanguage(language);
const dispatch = useDispatch();
const modal = useRef<HTMLIonModalElement>(null);
const dismiss = () => {
modal.current?.dismiss();
};
const changeHandler = (event: any) => {
dispatch(mapActions.setTileProvider(event.detail.value));
dismiss();
};
return (
<IonModal
ref={modal}
trigger='open-TileServerChooser'
enterAnimation={enterAnimation}
leaveAnimation={leaveAnimation}
>
<IonToolbar>
<IonTitle>{i18n.chooseYourMap}</IonTitle>
<IonButtons slot='end'>
<IonButton onClick={() => dismiss()}>{i18n.close}</IonButton>
</IonButtons>
</IonToolbar>
<IonContent>
<IonList>
<IonRadioGroup value={tileProvider} onIonChange={changeHandler}>
{Object.keys(tileProviders).map((provider) => {
return (
<IonItem key={provider}>
<IonLabel> {tileProviders[provider].name}</IonLabel>
<IonRadio slot='start' value={provider} />
</IonItem>
);
})}
</IonRadioGroup>
</IonList>
</IonContent>
</IonModal>
);
};
export default TileServerChooserDialog;

View File

@ -1,102 +0,0 @@
import {
IonButton,
IonButtons,
IonCard,
IonCardContent,
IonCardHeader,
IonCardTitle,
IonContent,
IonIcon,
IonItem,
IonList,
IonModal,
IonTitle,
IonToolbar,
} from '@ionic/react';
import { trash } from 'ionicons/icons';
import React, { Fragment, useRef } from 'react';
import { useFind, useDB } from 'react-pouchdb';
import { deleteGps } from '../../db/gpx';
import { enterAnimation, leaveAnimation } from '../../lib/animation';
import phoneRoute from '../../theme/icons/font-gis/svg/routing/uEB08-phone-route-nons.svg';
import GpxImport from './gpx-import';
import GpxExport from './GpxExport';
import i18n, { setI18nLanguage } from '../../i18n/index';
import { useSelector } from 'react-redux';
import { SettingsState } from '../../store/settings';
const TrackBrowser: React.FC<{}> = () => {
const gpxes = useFind({
selector: {
type: 'gpx',
},
});
const db = useDB();
const modal = useRef<HTMLIonModalElement>(null);
const dismiss = () => {
modal.current?.dismiss();
};
const language = useSelector(
(state: { settings: SettingsState }) => state.settings.language
);
setI18nLanguage(language);
return (
<Fragment>
<IonButton id='track-browser-button'>
<img src={phoneRoute} alt='GPS tracks' width='24px' />
</IonButton>
<IonModal
ref={modal}
className='full-height'
trigger='track-browser-button'
enterAnimation={enterAnimation}
leaveAnimation={leaveAnimation}
>
<IonToolbar>
<IonTitle>{i18n.tracks}</IonTitle>
<IonButtons slot='end'>
<GpxImport />
<IonButton onClick={() => dismiss()}>{i18n.close}</IonButton>
</IonButtons>
</IonToolbar>
<IonContent>
{gpxes.map((gpx: any) => (
<IonCard key={gpx._id}>
<IonCardHeader>
<IonItem>
<IonCardTitle>{gpx.gpx.metadata.name}</IonCardTitle>
<IonButtons slot='end'>
<GpxExport gpx={gpx} />
<IonButton
onClick={() => {
deleteGps(db, { _id: gpx._id, _rev: gpx._rev });
}}
color='danger'
>
<IonIcon slot='icon-only' icon={trash} />
</IonButton>
</IonButtons>
</IonItem>
<IonCardContent>
<IonList>
<IonItem>{gpx.gpx.metadata.time}</IonItem>
<IonItem>{gpx.gpx.metadata.desc}</IonItem>
</IonList>
</IonCardContent>
</IonCardHeader>
</IonCard>
))}
</IonContent>
</IonModal>
</Fragment>
);
};
export default TrackBrowser;

View File

@ -1 +0,0 @@
declare module 'avatar-initials';

Binary file not shown.

Before

Width:  |  Height:  |  Size: 546 B

View File

@ -1 +0,0 @@
declare module 'font-gis';

View File

@ -1,43 +0,0 @@
import React from 'react';
import { Geolocation } from '@awesome-cordova-plugins/geolocation';
import { useDispatch } from 'react-redux';
import { mapActions } from '../../store/map';
import '../../theme/get-location.css';
import { IonButton, IonIcon } from '@ionic/react';
import { locateOutline } from 'ionicons/icons';
const GetLocation: React.FC<{}> = () => {
const dispatch = useDispatch();
const onClickHandler = (event: any) => {
console.log('Click handler');
Geolocation.getCurrentPosition().then((position) => {
console.log(
`Click handler, position: ${position.coords.latitude}, ${position.coords.longitude}`
);
dispatch(
mapActions.setCenter({
lat: position.coords.latitude,
lon: position.coords.longitude,
})
);
dispatch(
mapActions.setCurrent({
lat: position.coords.latitude,
lon: position.coords.longitude,
})
);
});
};
return (
<IonButton onClick={onClickHandler} className='get-location' shape='round' size='small' fill='solid'>
<IonIcon slot='icon-only' icon={locateOutline} color='white' />
</IonButton>
);
};
export default GetLocation;

View File

@ -1,58 +0,0 @@
import React from 'react';
import { useDB } from 'react-pouchdb';
import GPX from '../../lib/gpx-parser-builder';
import '../../theme/get-location.css';
import { IonIcon, IonItem } from '@ionic/react';
import { cloudUpload } from 'ionicons/icons';
import { pushGpx } from '../../db/gpx';
const GpxImport: React.FC<{}> = () => {
const db = useDB();
const onChangeHandler = (event: any) => {
console.log('On change handler');
const file: File = event.target.files[0];
const fileReader = new FileReader();
fileReader.readAsText(file);
fileReader.addEventListener(
'load',
() => {
// this will then display a text file
console.log(fileReader.result);
const gpx = GPX.parse(fileReader.result);
pushGpx(db, {
gpx,
metadata: {
lastModified: new Date(file.lastModified).toISOString(),
importDate: new Date().toISOString(),
name: file.name,
size: file.size,
type: file.type,
},
});
},
false
);
};
return (
<IonItem>
<input
type='file'
id='gpx-import'
className='input-file'
accept='.gpx'
onChange={onChangeHandler}
/>
<label htmlFor='gpx-import'>
<IonIcon slot='icon-only' icon={cloudUpload} title="import" />
</label>
</IonItem>
);
};
export default GpxImport;

View File

@ -1,20 +0,0 @@
import React from 'react';
import { useFind } from 'react-pouchdb';
import Gpx from './Gpx';
const Gpxes: React.FC<{}> = () => {
const gpxes = useFind({
selector: {
type: 'gpx',
},
});
return gpxes.map((gpx: any) => {
console.log('doc');
return <Gpx key={gpx._id} gpx={gpx} />;
});
};
export default Gpxes;

View File

@ -0,0 +1 @@
export { default, getState, getMap } from './Map';

View File

@ -1,90 +0,0 @@
import react, { useMemo, useEffect, useState } from 'react';
import { useDispatch } from 'react-redux';
import { mapActions } from '../../store/map';
import _ from 'lodash';
import { useDB } from 'react-pouchdb';
import Layer from '../slippy/layer';
import Slippy from '../slippy/slippy';
import TiledMap from './tiled-map';
import GetLocation from './get-location';
import Whiteboard from './whiteboard';
import CurrentLocation from './CurrentLocation';
import {
IonApp,
IonButtons,
IonContent,
IonFooter,
IonHeader,
IonToolbar,
} from '@ionic/react';
import Gpxes from './gpxes';
import GpxRecord from './GpxRecord';
import { initDb } from '../../db';
import TileServerChooserButton from './TileServerChooserButton';
import TileServerChooserDialog from './TileServerChooserDialog';
import TrackBrowser from './TracksBrowser';
import Settings from './Settings';
import Reticle from './Reticle';
import LocationInfo from './LocationInfo';
const Map: react.FC<{}> = () => {
const dispatch = useDispatch();
const resizeHandler = () => {
dispatch(mapActions.resize());
};
const debouncedResizeHandler = useMemo(
() => _.debounce(resizeHandler, 500),
[]
);
const db = useDB();
const [dbReady, setDbReady] = useState(false);
useEffect(() => {
window.addEventListener('resize', debouncedResizeHandler);
initDb(db, setDbReady);
}, []);
return (
<>
<IonContent fullscreen={true}>
<IonApp>
<TileServerChooserDialog />
<LocationInfo />
<Slippy>
<Whiteboard fixedChildren={<Reticle />}>
<CurrentLocation />
dbReady && <Gpxes />
</Whiteboard>
<Layer>
<TiledMap />
</Layer>
</Slippy>
</IonApp>
</IonContent>
<IonHeader className='ion-no-border' translucent={true}>
<IonToolbar>
<IonButtons slot='end'>
<TrackBrowser />
<GpxRecord />
<TileServerChooserButton />
<Settings />
</IonButtons>
</IonToolbar>
</IonHeader>
<IonFooter className='ion-no-border'>
<IonToolbar>
<IonButtons>
<GetLocation />
</IonButtons>
</IonToolbar>
</IonFooter>
</>
);
};
export default Map;

Some files were not shown because too many files have changed in this diff Show More