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