mapping-component-package-jp 0.1.11 → 0.1.12
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/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/js/mapEncapsulation/mapOverlayManager.js +29 -9
package/package.json
CHANGED
|
@@ -636,25 +636,31 @@ export class MapOverlayManager {
|
|
|
636
636
|
locations = JSON.parse(locationsJson, true);
|
|
637
637
|
|
|
638
638
|
var cpid;
|
|
639
|
+
bounds = new google.maps.LatLngBounds();
|
|
639
640
|
|
|
640
641
|
locations.forEach(function (location) {
|
|
641
642
|
|
|
642
643
|
if (location && location.Poly && location.Poly.length > 0 && location.Id > 0) {
|
|
643
644
|
|
|
644
|
-
var polies = location.Poly.split(',');
|
|
645
|
-
|
|
646
645
|
var paths = [];
|
|
647
|
-
|
|
646
|
+
location.Poly.forEach(function (poly, pi) {
|
|
648
647
|
var path = [];
|
|
649
|
-
|
|
648
|
+
var polyArea = 0;
|
|
649
|
+
poly.forEach(function (v) {
|
|
650
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);
|
|
656
|
+
|
|
651
657
|
});
|
|
652
|
-
|
|
658
|
+
paths.push(path);
|
|
653
659
|
|
|
654
660
|
if (location.Id == locationId) {
|
|
655
661
|
|
|
656
662
|
var pArea = google.maps.geometry.spherical.computeSignedArea(path);
|
|
657
|
-
var isHole = pArea > 0 &&
|
|
663
|
+
var isHole = pArea > 0 && pi !== 0;
|
|
658
664
|
cpid = Date.now() + Math.floor(Math.random() * 100000);
|
|
659
665
|
|
|
660
666
|
var polygon = new google.maps.Polygon({
|
|
@@ -691,11 +697,23 @@ export class MapOverlayManager {
|
|
|
691
697
|
|
|
692
698
|
cpid = Date.now() + Math.floor(Math.random() * 100000);
|
|
693
699
|
|
|
700
|
+
let content = `${location.FarmName} - ${location.LocationName}<br>${location.Area} ha${location.IsIrrigated ? ', irrigated' : ''}`;
|
|
701
|
+
|
|
702
|
+
if (location.CropPlanted) {
|
|
703
|
+
content += `<br>${location.CropPlanted}`;
|
|
704
|
+
if (location.CultivarPlanted) {
|
|
705
|
+
content += ` (${location.CultivarPlanted})`;
|
|
706
|
+
}
|
|
707
|
+
if (location.PlantingDate) {
|
|
708
|
+
content += `<br>Planted: ${location.PlantingDate.replace(/-/g, "/")}`;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
|
|
694
712
|
var polygon = new google.maps.Polygon({
|
|
695
713
|
map: map,
|
|
696
714
|
paths: paths,
|
|
697
715
|
id: cpid,
|
|
698
|
-
content:
|
|
716
|
+
content: content,
|
|
699
717
|
strokeColor: shapeConfig.StrokeColor_Other,
|
|
700
718
|
strokeOpacity: shapeConfig.StrokeOpacity,
|
|
701
719
|
strokeWeight: shapeConfig.StrokeWeight,
|
|
@@ -704,20 +722,22 @@ export class MapOverlayManager {
|
|
|
704
722
|
zIndex: 10000,
|
|
705
723
|
clickable: false,
|
|
706
724
|
editable: false,
|
|
707
|
-
draggable: false
|
|
725
|
+
draggable: false,
|
|
708
726
|
});
|
|
709
727
|
|
|
710
728
|
polygons.push(polygon);
|
|
729
|
+
fields_BindPolyEvents();
|
|
711
730
|
}
|
|
712
731
|
}
|
|
713
732
|
});
|
|
714
733
|
|
|
734
|
+
map.fitBounds(bounds);
|
|
715
735
|
//console.log(polygons);
|
|
716
736
|
}
|
|
717
737
|
|
|
718
738
|
_this.Shape_IsShapeHole = function(ShapeId) {
|
|
719
739
|
let isHole = false;
|
|
720
|
-
locPolygons.forEach(function (polygon
|
|
740
|
+
locPolygons.forEach(function (polygon) {
|
|
721
741
|
if (polygon.id == ShapeId) {
|
|
722
742
|
isHole = polygon.isHole;
|
|
723
743
|
}
|