mapping-component-package-jp 0.1.12 → 0.1.13

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.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -636,38 +636,40 @@ export class MapOverlayManager {
636
636
  locations = JSON.parse(locationsJson, true);
637
637
 
638
638
  var cpid;
639
- bounds = new google.maps.LatLngBounds();
639
+ var mbounds = new google.maps.LatLngBounds();
640
640
 
641
641
  locations.forEach(function (location) {
642
642
 
643
- if (location && location.Poly && location.Poly.length > 0 && location.Id > 0) {
643
+ if(location && location.Poly && location.Poly.length > 0 && location.Id > 0) {
644
644
 
645
- var paths = [];
646
- location.Poly.forEach(function (poly, pi) {
647
- var path = [];
648
- var polyArea = 0;
649
- poly.forEach(function (v) {
650
- path.push(new google.maps.LatLng(parseFloat(v[1]), parseFloat(v[0])));
651
- if(pi == 0) {
652
- bounds.extend(new google.maps.LatLng(parseFloat(v[1]), parseFloat(v[0])));
653
- polyArea += google.maps.geometry.spherical.computeSignedArea(path);
654
- }
655
- polyArea -= google.maps.geometry.spherical.computeSignedArea(path);
645
+ var paths = location.Poly.map(poly => poly.map(v => new google.maps.LatLng(parseFloat(v[1]), parseFloat(v[0]))));
646
+ paths[0].forEach(coord => mbounds.extend(coord));
656
647
 
657
- });
658
- paths.push(path);
648
+ let content = `${location.FarmName} - ${location.LocationName}<br>${location.Area} ha${location.IsIrrigated ? ', irrigated' : ''}`;
649
+
650
+ if(location.CropPlanted) {
651
+ content += `<br>${location.CropPlanted}`;
652
+ if (location.CultivarPlanted) {
653
+ content += ` (${location.CultivarPlanted})`;
654
+ }
655
+ if (location.PlantingDate) {
656
+ content += `<br>Planted: ${location.PlantingDate.replace(/-/g, "/")}`;
657
+ }
658
+ }
659
+
660
+ location.Poly.forEach(function(poly, lpi) {
659
661
 
660
662
  if (location.Id == locationId) {
661
663
 
662
664
  var pArea = google.maps.geometry.spherical.computeSignedArea(path);
663
665
  var isHole = pArea > 0 && pi !== 0;
664
- cpid = Date.now() + Math.floor(Math.random() * 100000);
666
+ cpid = Date.now() + Math.floor(Math.random() * 100000);
665
667
 
666
668
  var polygon = new google.maps.Polygon({
667
669
  map: map,
668
- path: path,
670
+ path: paths[lpi],
669
671
  id: cpid,
670
- content: location.LocationName,
672
+ //content: location.LocationName,
671
673
  strokeColor: shapeConfig.StrokeColor_DrawEditShape,
672
674
  strokeOpacity: shapeConfig.StrokeOpacity,
673
675
  strokeWeight: shapeConfig.StrokeWeight,
@@ -726,12 +728,13 @@ export class MapOverlayManager {
726
728
  });
727
729
 
728
730
  polygons.push(polygon);
729
- fields_BindPolyEvents();
731
+
730
732
  }
731
733
  }
732
734
  });
733
735
 
734
736
  map.fitBounds(bounds);
737
+ fields_BindPolyEvents();
735
738
  //console.log(polygons);
736
739
  }
737
740