From 062e9eb1773375b5c45d3efad891cfd32d392725 Mon Sep 17 00:00:00 2001 From: RyanBirtch-aot Date: Mon, 29 Jul 2024 17:09:30 +0000 Subject: [PATCH 1/4] init, added marker png to component folder --- .../src/components/Map/Common/marker-icon.png | Bin 0 -> 1466 bytes .../src/components/Map/services/MapService.ts | 6 +++++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 components/src/components/Map/Common/marker-icon.png diff --git a/components/src/components/Map/Common/marker-icon.png b/components/src/components/Map/Common/marker-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..950edf24677ded147df13b26f91baa2b0fa70513 GIT binary patch literal 1466 zcmV;r1x5OaP)P001cn1^@s6z>|W`000GnNklGNuHDcIX17Zdjl&3`L?0sTjIws<{((Dh&g-s0<@jYQyl?D*X^?%13;ml^gy> ziMrY_^1WI=(g@LMizu=zCoA>C`6|QEq1eV92k*7m>G65*&@&6)aC&e}G zI)pf-Za|N`DT&Cn1J|o`19mumxW~hiKiKyc-P`S@q)rdTo84@QI@;0yXrG%9uhI>A zG5QHb6s4=<6xy{1 z@NMxEkryp{LS44%z$3lP^cX!9+2-;CTt3wM4(k*#C{aiIiLuB>jJj;KPhPzIC00bL zU3a#;aJld94lCW=`4&aAy8M7PY=HQ>O%$YEP4c4UY#CRxfgbE~(|uiI=YS8q;O9y6 zmIkXzR`}p7ti|PrM3a}WMnR=3NVnWdAAR>b9X@)DKL6=YsvmH%?I24wdq?Gh54_;# z$?_LvgjEdspdQlft#4CQ z`2Zyvy?*)N1Ftw|{_hakhG9WjS?Az@I@+IZ8JbWewR!XUK4&6346+d#~gsE0SY(LX8&JfY>Aj)RxGy96nwhs2rv zzW6pTnMpFkDSkT*a*6Dx|u@ds6ISVn0@^RmIsKZ5Y;bazbc;tTSq(kg(=481ODrPyNB6n z-$+U}(w$m6U6H$w17Bw+wDaFIe~GvNMYvnw31MpY0eQKT9l>SU``8k7w4)z!GZKMI z#_cEKq7k~i%nlK@6c-K?+R;B#5$?T#YpKD`t_4bAs^#E+@5QW$@OX3*`;(#{U^d-vY)&xEE>n5lYl&T?AmOnly one marker for submission

') .openOn(map); } else { + console.log(layer); + layer.icon({ iconUrl: CUSTOM_MARKER_URI }); drawnItems.addLayer(layer); } this.bindPopupToLayer(layer); @@ -68,7 +71,6 @@ class MapService { viewMode, } = options; - if (drawOptions.rectangle) { drawOptions.rectangle.showArea = false; } @@ -81,6 +83,8 @@ class MapService { }).addTo(map); // Initialize Draw Layer let drawnItems = new L.FeatureGroup(); + //({ iconUrl: '../common/marker-icon.png/' }); + map.addLayer(drawnItems); // Add Drawing Controllers From f459450222d76a463371bbb61cb5edb641ea5ffe Mon Sep 17 00:00:00 2001 From: RyanBirtch-aot Date: Wed, 31 Jul 2024 19:20:30 +0000 Subject: [PATCH 2/4] Added custom marker, placeholder marker image --- .../src/components/Map/services/MapService.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/components/src/components/Map/services/MapService.ts b/components/src/components/Map/services/MapService.ts index 174d27471..9a456aeed 100644 --- a/components/src/components/Map/services/MapService.ts +++ b/components/src/components/Map/services/MapService.ts @@ -9,7 +9,8 @@ const DEFAULT_LAYER_ATTRIBUTION = const DEFAULT_MAP_ZOOM = 5; const DECIMALS_LATLNG = 5; // the number of decimals of latitude and longitude to be displayed in the marker popup const COMPONENT_EDIT_CLASS = 'component-edit-tabs'; -const CUSTOM_MARKER_URI = '../Common/marker-icon.png/'; +const CUSTOM_MARKER_PATH = + 'http://leafletjs.com/examples/custom-icons/leaf-green.png'; interface MapServiceOptions { mapContainer: HTMLElement; @@ -45,7 +46,10 @@ class MapService { .openOn(map); } else { console.log(layer); - layer.icon({ iconUrl: CUSTOM_MARKER_URI }); + if (layer.type === 'marker') { + layer.setIcon(this.customMarker); + console.log('Adding marker' + layer); + } drawnItems.addLayer(layer); } this.bindPopupToLayer(layer); @@ -157,7 +161,8 @@ class MapService { items.forEach((item) => { let layer; if (item.type === 'marker') { - layer = L.marker(item.coordinates); + layer = L.marker(item.coordinates).setIcon(this.customMarker); //layer.setIcon(this.customMarker); + console.log('Loading Marker' + layer); } else if (item.type === 'rectangle') { layer = L.rectangle(item.bounds); } else if (item.type === 'circle') { @@ -184,5 +189,10 @@ class MapService { } return false; } + customMarker = L.icon({ + iconUrl: CUSTOM_MARKER_PATH, + iconSize: [25, 41], + iconAnchor: [12, 20], + }); } export default MapService; From 6decb87633a6ff27c2de8f03f44fbccd98f651f0 Mon Sep 17 00:00:00 2001 From: RyanBirtch-aot Date: Thu, 1 Aug 2024 17:31:53 +0000 Subject: [PATCH 3/4] Added fixes for marker centering --- components/src/components/Map/services/MapService.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/src/components/Map/services/MapService.ts b/components/src/components/Map/services/MapService.ts index 9a456aeed..24b69e0fa 100644 --- a/components/src/components/Map/services/MapService.ts +++ b/components/src/components/Map/services/MapService.ts @@ -10,7 +10,7 @@ const DEFAULT_MAP_ZOOM = 5; const DECIMALS_LATLNG = 5; // the number of decimals of latitude and longitude to be displayed in the marker popup const COMPONENT_EDIT_CLASS = 'component-edit-tabs'; const CUSTOM_MARKER_PATH = - 'http://leafletjs.com/examples/custom-icons/leaf-green.png'; + 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png'; interface MapServiceOptions { mapContainer: HTMLElement; @@ -192,7 +192,7 @@ class MapService { customMarker = L.icon({ iconUrl: CUSTOM_MARKER_PATH, iconSize: [25, 41], - iconAnchor: [12, 20], + iconAnchor: [12, 41], }); } export default MapService; From 174dfb1801c36af3185d44a22f52c46226e5d3de Mon Sep 17 00:00:00 2001 From: RyanBirtch-aot Date: Thu, 1 Aug 2024 20:55:38 +0000 Subject: [PATCH 4/4] Removed comments, and logs --- components/src/components/Map/services/MapService.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/components/src/components/Map/services/MapService.ts b/components/src/components/Map/services/MapService.ts index 24b69e0fa..55aaca367 100644 --- a/components/src/components/Map/services/MapService.ts +++ b/components/src/components/Map/services/MapService.ts @@ -45,10 +45,8 @@ class MapService { .setContent('

Only one marker for submission

') .openOn(map); } else { - console.log(layer); if (layer.type === 'marker') { layer.setIcon(this.customMarker); - console.log('Adding marker' + layer); } drawnItems.addLayer(layer); } @@ -162,7 +160,6 @@ class MapService { let layer; if (item.type === 'marker') { layer = L.marker(item.coordinates).setIcon(this.customMarker); //layer.setIcon(this.customMarker); - console.log('Loading Marker' + layer); } else if (item.type === 'rectangle') { layer = L.rectangle(item.bounds); } else if (item.type === 'circle') {