mapping-component-package-jp 0.0.25 → 0.0.27

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.25",
3
+ "version": "0.0.27",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -22,6 +22,7 @@ export class MapOverlayManager {
22
22
  RenderRegions(regionLocations: any[], properties: any, farmLocations: any[], icon: any): void;
23
23
  RenderBackgroundFields(locations: any[], properties: any): void;
24
24
  RenderSAAdministrative(saAdministrativeJson: any[], selectedSAProvince: number, selectedSADM: number, selectedSALM: number, selectedSAWard: number, offsetX: number, offsetY: number, vMapWidth: number, isDashboard: boolean): void;
25
+ RenderSACadastral(saCadastralJson: any, offsetX: number, offsetY: number, vmWidth: number, isDashboard: boolean, fitBounds: boolean): void;
25
26
 
26
27
  // Shape Selection and Management
27
28
  selectShape(shapeId: string | number, selectedStyle: any, unselectedStyle: any): void;
@@ -2477,6 +2477,252 @@ export class MapOverlayManager {
2477
2477
  SAAdministrative_DrawSAAdministrative(saAdministrativeJson, selectedSAProvince, selectedSADM, selectedSALM, selectedSAWard, offsetX, offsetY, vMapWidth, isDashboard);
2478
2478
  }
2479
2479
 
2480
+ function SACadastral_DrawSACadastral(saCadastralJson, offsetX, offsetY, vmWidth, isDashboard, fitBounds) {
2481
+ mapListeners_clear();
2482
+ polygonListeners_clear();
2483
+ markerListeners_clear();
2484
+ fmarkers_clear();
2485
+ fPolies_clear();
2486
+
2487
+ var mdeListener = google.maps.event.addListener(map, 'dragend', function() {
2488
+ if(map.getZoom() >= 12 && map.getZoom() <= 17) {
2489
+ console.log('SACadastral, map on dragend');
2490
+ eventHandlers["ReloadCadastralData"]({
2491
+ type: 'SUCCESS',
2492
+ message: 'Reload cadastral data on dragend',
2493
+ code: 200,
2494
+ data: null
2495
+ });
2496
+
2497
+ } else {
2498
+ mapListeners_clear();
2499
+ fPolies_clear();
2500
+ }
2501
+ });
2502
+ mapListeners.push(mdeListener);
2503
+
2504
+ var mzcListener = google.maps.event.addListener(map, 'zoom_changed', function() {
2505
+ if(map.getZoom() >= 12 && map.getZoom() <= 17) {
2506
+ console.log('SACadastral, map on zoom changed');
2507
+ eventHandlers["ReloadCadastralData"]({
2508
+ type: 'SUCCESS',
2509
+ message: 'Reload cadastral data on zoom changed',
2510
+ code: 200,
2511
+ data: null
2512
+ });
2513
+ } else {
2514
+ mapListeners_clear();
2515
+ fPolies_clear();
2516
+ }
2517
+ });
2518
+ mapListeners.push(mzcListener);
2519
+
2520
+ Display_SACadastral(saCadastralJson, offsetX, offsetY, vmWidth, isDashboard, fitBounds);
2521
+ }
2522
+
2523
+ function Display_SACadastral(saCadastralJson, offsetX, offsetY, vmWidth, isDashboard, fitBounds) {
2524
+
2525
+ var parentFarmsJson = saCadastralJson.parentFarms;
2526
+ var farmPortionsJson = saCadastralJson.farmPortions;
2527
+ var ervenJson = saCadastralJson.erven;
2528
+
2529
+ if(parentFarmsJson.length > 0) {
2530
+ parentFarmsJson.forEach(function(v) {
2531
+ if(fitBounds) {
2532
+ bounds = new google.maps.LatLngBounds();
2533
+ }
2534
+
2535
+ var geojson = JSON.parse(v.geojson,true);
2536
+
2537
+ if(geojson.type == 'Polygon') {
2538
+
2539
+ var paths = [];
2540
+ var path = [];
2541
+
2542
+ geojson.coordinates[0].forEach(function(c,ci) {
2543
+ path.push(new google.maps.LatLng(c[1],c[0]));
2544
+ if(fitBounds) {
2545
+ bounds.extend(new google.maps.LatLng(c[1],c[0]));
2546
+ }
2547
+ });
2548
+ paths.push(path);
2549
+
2550
+ } else if(geojson.type == 'MultiPolygon') {
2551
+ var paths = [];
2552
+ geojson.coordinates.forEach(function(p,pi) {
2553
+ var path = [];
2554
+ p[0].forEach(function(c,ci) {
2555
+ path.push(new google.maps.LatLng(c[1],c[0]));
2556
+ if(fitBounds) {
2557
+ bounds.extend(new google.maps.LatLng(c[1],c[0]));
2558
+ }
2559
+ });
2560
+ paths.push(path);
2561
+ });
2562
+ }
2563
+
2564
+ var carea = v.geomarea/10000;
2565
+ //var content = 'Farm: '+v.name+'<br>'+v.lpi+'<br>'+carea.toFixed(2)+' ha';
2566
+ var content = 'Farm: '+v.name+'<br>';//+v.lpi+'<br>'+carea.toFixed(2)+' ha';
2567
+
2568
+ var fpoly = new google.maps.Polygon({
2569
+ map: map,
2570
+ paths: paths,
2571
+ strokeWeight: 5,
2572
+ strokeColor: '#000000',
2573
+ strokeOpacity: 1,
2574
+ fillColor: '#000000',
2575
+ fillOpacity: 0.01,
2576
+ id: v.id,
2577
+ content: content,
2578
+ zIndex: 10001,
2579
+ });
2580
+
2581
+ if(fitBounds) {
2582
+ map.fitBounds(bounds);
2583
+ }
2584
+ fpolies.push(fpoly);
2585
+ });
2586
+
2587
+ }
2588
+
2589
+ if(farmPortionsJson.length > 0) {
2590
+ farmPortionsJson.forEach(function(v) {
2591
+ if(fitBounds) {
2592
+ bounds = new google.maps.LatLngBounds();
2593
+ }
2594
+
2595
+ var geojson = JSON.parse(v.geojson,true);
2596
+
2597
+ if(geojson.type == 'Polygon') {
2598
+
2599
+ var paths = [];
2600
+ var path = [];
2601
+
2602
+ geojson.coordinates[0].forEach(function(c,ci) {
2603
+ path.push(new google.maps.LatLng(c[1],c[0]));
2604
+ if(fitBounds) {
2605
+ bounds.extend(new google.maps.LatLng(c[1],c[0]));
2606
+ }
2607
+ });
2608
+ paths.push(path);
2609
+
2610
+ } else if(geojson.type == 'MultiPolygon') {
2611
+ var paths = [];
2612
+ geojson.coordinates.forEach(function(p,pi) {
2613
+ var path = [];
2614
+ p[0].forEach(function(c,ci) {
2615
+ path.push(new google.maps.LatLng(c[1],c[0]));
2616
+ if(fitBounds) {
2617
+ bounds.extend(new google.maps.LatLng(c[1],c[0]));
2618
+ }
2619
+ });
2620
+ paths.push(path);
2621
+ });
2622
+ }
2623
+
2624
+ var carea = v.geomarea/10000;
2625
+
2626
+ var fpoly = new google.maps.Polygon({
2627
+ map: map,
2628
+ paths: paths,
2629
+ strokeWeight: 3,
2630
+ strokeColor: '#000000',
2631
+ strokeOpacity: 1,
2632
+ fillColor: '#000000',
2633
+ fillOpacity: 0.01,
2634
+ id: v.id,
2635
+ name: v.name,
2636
+ farm: '',
2637
+ //lpi: v.lpi,
2638
+ area: carea.toFixed(2),
2639
+ zIndex: 10001,
2640
+ });
2641
+
2642
+ if(fitBounds) {
2643
+ map.fitBounds(bounds);
2644
+ }
2645
+ fpolies.push(fpoly);
2646
+ });
2647
+
2648
+ }
2649
+
2650
+ if(ervenJson.length > 0) {
2651
+ ervenJson.forEach(function(v) {
2652
+ if(fitBounds) {
2653
+ bounds = new google.maps.LatLngBounds();
2654
+ }
2655
+
2656
+ var geojson = JSON.parse(v.geojson,true);
2657
+
2658
+ if(geojson.type == 'Polygon') {
2659
+
2660
+ var paths = [];
2661
+ var path = [];
2662
+
2663
+ geojson.coordinates[0].forEach(function(c,ci) {
2664
+ path.push(new google.maps.LatLng(c[1],c[0]));
2665
+ if(fitBounds) {
2666
+ bounds.extend(new google.maps.LatLng(c[1],c[0]));
2667
+ }
2668
+ });
2669
+ paths.push(path);
2670
+
2671
+ } else if(geojson.type == 'MultiPolygon') {
2672
+ var paths = [];
2673
+ geojson.coordinates.forEach(function(p,pi) {
2674
+ var path = [];
2675
+ p[0].forEach(function(c,ci) {
2676
+ path.push(new google.maps.LatLng(c[1],c[0]));
2677
+ if(fitBounds) {
2678
+ bounds.extend(new google.maps.LatLng(c[1],c[0]));
2679
+ }
2680
+ });
2681
+ paths.push(path);
2682
+ });
2683
+ }
2684
+
2685
+ var carea = v.geomarea/10000;
2686
+
2687
+ var fpoly = new google.maps.Polygon({
2688
+ map: map,
2689
+ paths: paths,
2690
+ strokeWeight: 1,
2691
+ strokeColor: '#000000',
2692
+ strokeOpacity: 1,
2693
+ fillColor: '#000000',
2694
+ fillOpacity: 0.01,
2695
+ id: v.id,
2696
+ name: v.name,
2697
+ farm: '',
2698
+ //lpi: v.lpi,
2699
+ area: carea.toFixed(2),
2700
+ zIndex: 10001,
2701
+ });
2702
+
2703
+ if(fitBounds) {
2704
+ map.fitBounds(bounds);
2705
+ }
2706
+ fpolies.push(fpoly);
2707
+ });
2708
+ }
2709
+
2710
+
2711
+ /*
2712
+ if(type == 'pf') {
2713
+ addListeners(pfpolies, type);
2714
+ } else if(type == 'fp') {
2715
+ addListeners(fppolies, type);
2716
+ } else if(type == 'er') {
2717
+ addListeners(erpolies, type);
2718
+ }
2719
+ */
2720
+
2721
+ }
2722
+
2723
+ _this.RenderSACadastral = function (saCadastralJson, offsetX, offsetY, vmWidth, isDashboard, fitBounds) {
2724
+ SACadastral_DrawSACadastral(saCadastralJson, offsetX, offsetY, vmWidth, isDashboard, fitBounds);
2725
+ }
2480
2726
 
2481
2727
  _this.NDVI_AddOverlay_DEA = function (locationJson, ndviTileURL, validGMTiles, eosLocationCropperRefId, eosViewId, spinnerURL, spinnerLat, spinnerLon, paletteId, colorMapTypeIdValue, isFullView, onComplete) {
2482
2728