mapping-component-package-jp 0.0.13 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mapping-component-package-jp",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -156,7 +156,7 @@ export class MapOverlayManager {
156
156
  });
157
157
  }
158
158
 
159
- function regions_BindPolyEvents() {
159
+ function regions_BindPolyEvents(farmLocations, icon) {
160
160
  deleteTooltip();
161
161
 
162
162
  fpolies.forEach(function (poly) {
@@ -2384,7 +2384,12 @@ export class MapOverlayManager {
2384
2384
  };
2385
2385
 
2386
2386
  _this.NDVI_AddOverlay_DEA = function (locationJson, ndviTileURL, validGMTiles, eosLocationCropperRefId, eosViewId, spinnerURL, spinnerLat, spinnerLon, paletteId, colorMapTypeIdValue, isFullView, onComplete) {
2387
- var locationParsed = locationJson;
2387
+
2388
+ console.log('_this.NDVI_AddOverlay_DEA');
2389
+ console.log(locationJson);
2390
+ console.log('zoom at entry: '+map.getZoom());
2391
+
2392
+ var locationParsed = JSON.parse(locationJson, true);
2388
2393
  var location = locationParsed[0];
2389
2394
  var centerLat, centerLng;
2390
2395
  var polyBounds = new google.maps.LatLngBounds();
@@ -2395,7 +2400,7 @@ export class MapOverlayManager {
2395
2400
  centerLng = centroid.x;
2396
2401
 
2397
2402
  location.Poly.forEach(function (poly, pIndex) {
2398
- poly.forEach(function (v) {
2403
+ poly.forEach(function (v, idx) {
2399
2404
  if(pIndex == 0) {
2400
2405
  polyBounds.extend(new google.maps.LatLng(parseFloat(v[1]), parseFloat(v[0])));
2401
2406
  }
@@ -2427,6 +2432,8 @@ export class MapOverlayManager {
2427
2432
  spinnerImg.height = 120;
2428
2433
  spinnerImg.style.transform = 'translate(0, 50%)';
2429
2434
  const position = new google.maps.LatLng(centerLat, centerLng);
2435
+
2436
+ console.log(spinnerImg);
2430
2437
 
2431
2438
  var spinnerMarker = new google.maps.marker.AdvancedMarkerElement({
2432
2439
  map: map,
@@ -2434,12 +2441,16 @@ export class MapOverlayManager {
2434
2441
  content: spinnerImg,
2435
2442
  });
2436
2443
  fmarkers.push(spinnerMarker);
2444
+
2437
2445
  spinnerSet = true;
2438
2446
  }
2439
2447
 
2440
2448
  var tilesToLoad = [];
2441
2449
 
2442
2450
  if (map.getZoom() > 17) {
2451
+
2452
+ console.log('zoom > 17');
2453
+
2443
2454
  var zoomOnAddOverlayChangedListener = google.maps.event.addListenerOnce(map, 'zoom_changed', function () {
2444
2455
  tilesToLoad = [];
2445
2456
 
@@ -2448,7 +2459,7 @@ export class MapOverlayManager {
2448
2459
  if(vgmTiles.indexOf(zoom+'|'+coord.x+'|'+coord.y) > -1) {
2449
2460
  const booleanFullView = fullView ? 'true' : 'false';
2450
2461
  console.log([ndviTileURL.replace(/{l}/,eosLocationCropperRefId).replace(/{v}/,eosViewId).replace(/{p}/,paletteId).replace(/{f}/,booleanFullView).replace(/{z}/,zoom).replace(/{x}/,coord.x).replace(/{y}/,coord.y)].join(''));
2451
- tilesToLoad.push({eosLocationCropperRefId: eosLocationCropperRefId, eosViewId: eosViewId, z: zoom});
2462
+ tilesToLoad.push({eosLocationCropperRefId: eosLocationCropperRefId, eosViewId: eosViewId, z: zoom, x: coord.x, y: coord.y});
2452
2463
  return [ndviTileURL.replace(/{l}/,eosLocationCropperRefId).replace(/{v}/,eosViewId).replace(/{p}/,paletteId).replace(/{f}/,booleanFullView).replace(/{z}/,zoom).replace(/{x}/,coord.x).replace(/{y}/,coord.y)].join('');
2453
2464
  }
2454
2465
  },
@@ -2476,39 +2487,51 @@ export class MapOverlayManager {
2476
2487
  }
2477
2488
  }
2478
2489
 
2479
- if (typeof onComplete === 'function') {
2480
- if(tilesToLoad.length > 0) {
2481
- const currentZoom = map.getZoom();
2482
- let zoomTileCount = 0;
2483
- validGMTiles.forEach((tile) => {
2484
- if(parseInt(tile.substring(0,tile.indexOf('|'))) == currentZoom ) {
2485
- zoomTileCount++;
2486
- }
2487
- })
2488
- if(tilesToLoad.length == zoomTileCount) {
2489
- eventHandlers["OverlayTilesLoaded"]({
2490
- type: 'SUCCESS',
2491
- message: 'NDVI overlay completed',
2492
- code: 200,
2493
- data: tilesToLoad[0]
2494
- });
2495
- } else {
2496
- eventHandlers["OverlayTilesLoaded"]({
2497
- type: 'ERROR',
2498
- message: 'Not all tiles loaded',
2499
- code: 400,
2500
- data: null
2501
- });
2502
- }
2490
+ if(tilesToLoad.length > 0) {
2491
+ const currentZoom = map.getZoom();
2492
+ console.log('currentZoom: '+currentZoom);
2493
+
2494
+ let uniqueTilesToLoad = [];
2495
+ tilesToLoad.forEach(function(ttl) {
2496
+ if(uniqueTilesToLoad.indexOf(ttl.z+'|'+ttl.x+'|'+ttl.y) == -1) {
2497
+ uniqueTilesToLoad.push(ttl.z+'|'+ttl.x+'|'+ttl.y);
2498
+ }
2499
+ });
2500
+
2501
+ let zoomTileCount = 0;
2502
+ validGMTiles.forEach((tile) => {
2503
+ if(parseInt(tile.substring(0,tile.indexOf('|'))) == currentZoom ) {
2504
+ zoomTileCount++;
2505
+ }
2506
+ });
2507
+
2508
+ console.log('tilesToLoad.length: '+tilesToLoad.length);
2509
+ console.log('uniqueTilesToLoad.length: '+uniqueTilesToLoad.length);
2510
+ console.log('zoomTileCount: '+zoomTileCount);
2511
+
2512
+ if(uniqueTilesToLoad.length == zoomTileCount) {
2513
+ eventHandlers["OverlayTilesLoaded"]({
2514
+ type: 'SUCCESS',
2515
+ message: 'NDVI overlay completed',
2516
+ code: 200,
2517
+ data: tilesToLoad[0]
2518
+ });
2503
2519
  } else {
2504
2520
  eventHandlers["OverlayTilesLoaded"]({
2505
2521
  type: 'ERROR',
2506
- message: 'No tiles loaded',
2522
+ message: 'Not all tiles loaded',
2507
2523
  code: 400,
2508
2524
  data: null
2509
2525
  });
2510
2526
  }
2511
- }
2527
+ } else {
2528
+ eventHandlers["OverlayTilesLoaded"]({
2529
+ type: 'ERROR',
2530
+ message: 'No tiles loaded',
2531
+ code: 400,
2532
+ data: null
2533
+ });
2534
+ }
2512
2535
 
2513
2536
  tilesToLoad = [];
2514
2537
 
@@ -2521,6 +2544,10 @@ export class MapOverlayManager {
2521
2544
  map.setZoom(17);
2522
2545
 
2523
2546
  } else if (map.getZoom() < 13) {
2547
+
2548
+ console.log('zoom < 13');
2549
+
2550
+
2524
2551
  var zoomOnAddOverlayChangedListener = google.maps.event.addListenerOnce(map, 'zoom_changed', function () {
2525
2552
 
2526
2553
  tilesToLoad = [];
@@ -2530,7 +2557,7 @@ export class MapOverlayManager {
2530
2557
  if(vgmTiles.indexOf(zoom+'|'+coord.x+'|'+coord.y) > -1) {
2531
2558
  const booleanFullView = fullView ? 'true' : 'false';
2532
2559
  console.log([ndviTileURL.replace(/{l}/,eosLocationCropperRefId).replace(/{v}/,eosViewId).replace(/{p}/,paletteId).replace(/{f}/,booleanFullView).replace(/{z}/,zoom).replace(/{x}/,coord.x).replace(/{y}/,coord.y)].join(''));
2533
- tilesToLoad.push({eosLocationCropperRefId: eosLocationCropperRefId, eosViewId: eosViewId, z: zoom});
2560
+ tilesToLoad.push({eosLocationCropperRefId: eosLocationCropperRefId, eosViewId: eosViewId, z: zoom, x: coord.x, y: coord.y});
2534
2561
  return [ndviTileURL.replace(/{l}/,eosLocationCropperRefId).replace(/{v}/,eosViewId).replace(/{p}/,paletteId).replace(/{f}/,booleanFullView).replace(/{z}/,zoom).replace(/{x}/,coord.x).replace(/{y}/,coord.y)].join('');
2535
2562
  }
2536
2563
  },
@@ -2557,16 +2584,31 @@ export class MapOverlayManager {
2557
2584
  }
2558
2585
  }
2559
2586
 
2560
- //if (typeof onComplete === 'function') {
2561
2587
  if(tilesToLoad.length > 0) {
2562
2588
  const currentZoom = map.getZoom();
2589
+ console.log('currentZoom: '+currentZoom);
2590
+
2591
+ let uniqueTilesToLoad = [];
2592
+ tilesToLoad.forEach(function(ttl) {
2593
+ if(uniqueTilesToLoad.indexOf(ttl.z+'|'+ttl.x+'|'+ttl.y) == -1) {
2594
+ uniqueTilesToLoad.push(ttl.z+'|'+ttl.x+'|'+ttl.y);
2595
+ }
2596
+ });
2597
+
2598
+
2563
2599
  let zoomTileCount = 0;
2564
2600
  validGMTiles.forEach((tile) => {
2565
2601
  if(parseInt(tile.substring(0,tile.indexOf('|'))) == currentZoom ) {
2566
2602
  zoomTileCount++;
2567
2603
  }
2568
2604
  })
2569
- if(tilesToLoad.length == zoomTileCount) {
2605
+
2606
+ console.log('tilesToLoad.length: '+tilesToLoad.length);
2607
+ console.log('uniqueTilesToLoad.length: '+uniqueTilesToLoad.length);
2608
+ console.log('zoomTileCount: '+zoomTileCount);
2609
+
2610
+
2611
+ if(uniqueTilesToLoad.length == zoomTileCount) {
2570
2612
  eventHandlers["OverlayTilesLoaded"]({
2571
2613
  type: 'SUCCESS',
2572
2614
  message: 'NDVI overlay completed',
@@ -2589,7 +2631,6 @@ export class MapOverlayManager {
2589
2631
  data: null
2590
2632
  });
2591
2633
  }
2592
- //}
2593
2634
 
2594
2635
  tilesToLoad = [];
2595
2636
 
@@ -2602,14 +2643,27 @@ export class MapOverlayManager {
2602
2643
  map.setZoom(13);
2603
2644
 
2604
2645
  } else {
2605
- tilesToLoad = [];
2646
+
2647
+ tilesToLoad = [];
2648
+
2649
+ console.log('ndviTileURL: '+ndviTileURL);
2650
+
2651
+ /*
2652
+ var zoomGMTiles = [];
2653
+ vgmTiles.forEach(function(v) {
2654
+ if(parseInt(v.substr(0,v.indexOf('|'))) == map.getZoom()) {
2655
+ zoomGMTiles.push(v);
2656
+ }
2657
+
2658
+ });
2659
+ */
2606
2660
 
2607
2661
  var vdiMapType = new google.maps.ImageMapType({
2608
2662
  getTileUrl: function (coord, zoom) {
2609
2663
  if(vgmTiles.indexOf(zoom+'|'+coord.x+'|'+coord.y) > -1) {
2610
2664
  const booleanFullView = fullView ? 'true' : 'false';
2611
2665
  console.log([ndviTileURL.replace(/{l}/,eosLocationCropperRefId).replace(/{v}/,eosViewId).replace(/{p}/,paletteId).replace(/{f}/,booleanFullView).replace(/{z}/,zoom).replace(/{x}/,coord.x).replace(/{y}/,coord.y)].join(''));
2612
- tilesToLoad.push({eosLocationCropperRefId: eosLocationCropperRefId, eosViewId: eosViewId, z: zoom});
2666
+ tilesToLoad.push({eosLocationCropperRefId: eosLocationCropperRefId, eosViewId: eosViewId, z: zoom, x: coord.x, y: coord.y});
2613
2667
  return [ndviTileURL.replace(/{l}/,eosLocationCropperRefId).replace(/{v}/,eosViewId).replace(/{p}/,paletteId).replace(/{f}/,booleanFullView).replace(/{z}/,zoom).replace(/{x}/,coord.x).replace(/{y}/,coord.y)].join('');
2614
2668
  }
2615
2669
  },
@@ -2622,9 +2676,11 @@ export class MapOverlayManager {
2622
2676
  if(spinnerSet) {
2623
2677
 
2624
2678
  fmarkers.forEach(function(l,index) {
2679
+ //if(l.id == 'spinnerMarker') {
2625
2680
  l.setMap(null);
2626
2681
  fmarkers.splice(index, 1);
2627
2682
  spinnerSet = false;
2683
+ //}
2628
2684
  });
2629
2685
  }
2630
2686
 
@@ -2635,38 +2691,52 @@ export class MapOverlayManager {
2635
2691
  }
2636
2692
  }
2637
2693
 
2638
- if(tilesToLoad.length > 0) {
2639
- const currentZoom = map.getZoom();
2640
- let zoomTileCount = 0;
2641
- validGMTiles.forEach((tile) => {
2642
- if(parseInt(tile.substring(0,tile.indexOf('|'))) == currentZoom ) {
2643
- zoomTileCount++;
2644
- }
2645
- })
2646
- if(tilesToLoad.length == zoomTileCount) {
2647
- eventHandlers["OverlayTilesLoaded"]({
2648
- type: 'SUCCESS',
2649
- message: 'NDVI overlay completed',
2650
- code: 200,
2651
- data: tilesToLoad[0]
2652
- });
2653
- } else {
2654
- eventHandlers["OverlayTilesLoaded"]({
2655
- type: 'ERROR',
2656
- message: 'Not all tiles loaded',
2657
- code: 400,
2658
- data: null
2659
- });
2660
- }
2694
+ if(tilesToLoad.length > 0) {
2695
+ const currentZoom = map.getZoom();
2696
+ let zoomTileCount = 0;
2697
+
2698
+ let uniqueTilesToLoad = [];
2699
+ tilesToLoad.forEach(function(ttl) {
2700
+ //console.log(ttl.z+'|'+ttl.x+'|'+ttl.y);
2701
+ if(uniqueTilesToLoad.indexOf(ttl.z+'|'+ttl.x+'|'+ttl.y) == -1) {
2702
+ uniqueTilesToLoad.push(ttl.z+'|'+ttl.x+'|'+ttl.y);
2703
+ }
2704
+ });
2705
+
2706
+ validGMTiles.forEach((tile) => {
2707
+ if(parseInt(tile.substring(0,tile.indexOf('|'))) == currentZoom ) {
2708
+ zoomTileCount++;
2709
+ }
2710
+ })
2711
+
2712
+ console.log('tilesToLoad.length: '+tilesToLoad.length);
2713
+ console.log('uniqueTilesToLoad.length: '+uniqueTilesToLoad.length);
2714
+ console.log('zoomTileCount: '+zoomTileCount);
2715
+
2716
+ if(uniqueTilesToLoad.length == zoomTileCount) {
2717
+ eventHandlers["OverlayTilesLoaded"]({
2718
+ type: 'SUCCESS',
2719
+ message: 'NDVI overlay completed',
2720
+ code: 200,
2721
+ data: tilesToLoad[0]
2722
+ });
2661
2723
  } else {
2662
2724
  eventHandlers["OverlayTilesLoaded"]({
2663
2725
  type: 'ERROR',
2664
- message: 'No tiles loaded',
2726
+ message: 'Not all tiles loaded',
2665
2727
  code: 400,
2666
2728
  data: null
2667
2729
  });
2668
- }
2669
-
2730
+ }
2731
+ } else {
2732
+ eventHandlers["OverlayTilesLoaded"]({
2733
+ type: 'ERROR',
2734
+ message: 'No tiles loaded',
2735
+ code: 400,
2736
+ data: null
2737
+ });
2738
+ }
2739
+
2670
2740
  tilesToLoad = [];
2671
2741
 
2672
2742
  });