mapping-component-package-jp 0.2.2 → 0.2.4
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 +4 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/js/mapEncapsulation/mapOverlayManager.js +25 -0
package/package.json
CHANGED
|
@@ -126,6 +126,29 @@ export class MapOverlayManager {
|
|
|
126
126
|
polyLabels.push(polyLabel);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
function AddLabelMobile(location) {
|
|
130
|
+
var polyCentroidCenter = get_polygon_centroid(location.Poly);
|
|
131
|
+
var labelLat = polyCentroidCenter.y;
|
|
132
|
+
var labelLon = polyCentroidCenter.x;
|
|
133
|
+
var areaText = `${location.Area} ha`;
|
|
134
|
+
var bl = formatBlockLabel(location.Id, location.LocationName, areaText, 8);
|
|
135
|
+
|
|
136
|
+
var svgText = `<svg viewBox="0 0 200 30" xmlns="http://www.w3.org/2000/svg">
|
|
137
|
+
<text x="0" y="12" fill="${location.LabelColor}" font-family="Arial, sans-serif" font-size="8px">${ClearHTML.clearString(location.LocationName)}</text>
|
|
138
|
+
</svg>`;
|
|
139
|
+
|
|
140
|
+
var polyLabel = new google.maps.Marker({
|
|
141
|
+
map: map,
|
|
142
|
+
position: new google.maps.LatLng(parseFloat(labelLat), parseFloat(labelLon)),
|
|
143
|
+
icon: {
|
|
144
|
+
anchor: new google.maps.Point(bl.nameWidth / 2, 21),
|
|
145
|
+
url: `data:image/svg+xml;utf-8, ${svgText}`
|
|
146
|
+
},
|
|
147
|
+
id: `pl_${location.Id}`
|
|
148
|
+
});
|
|
149
|
+
polyLabels.push(polyLabel);
|
|
150
|
+
}
|
|
151
|
+
|
|
129
152
|
function get_polygon_centroid(points) {
|
|
130
153
|
var centroid = polylabel(points, 0.00001);
|
|
131
154
|
return { x: centroid[0], y: centroid[1] };
|
|
@@ -430,6 +453,8 @@ export class MapOverlayManager {
|
|
|
430
453
|
fillOpacity: location.MapLocationFeature.FillOpacity,
|
|
431
454
|
zIndex: location.MapLocationFeature.ZIndex
|
|
432
455
|
}
|
|
456
|
+
|
|
457
|
+
if (location.showLabel) AddLabelMobile(location);
|
|
433
458
|
|
|
434
459
|
var polygon = new google.maps.Polygon(polygonOptions);
|
|
435
460
|
polygons.push(polygon);
|