mapping-component-package-jp 0.0.37 → 0.0.39
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.d.ts +1 -1
- 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/components/JPMapComponent.tsx +0 -2
- package/src/js/mapEncapsulation/mapOverlayManager.d.ts +1 -1
- package/src/js/mapEncapsulation/mapOverlayManager.js +196 -2
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@ export class MapOverlayManager {
|
|
|
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
25
|
RenderSACadastral(saCadastralJson: any, offsetX: number, offsetY: number, vmWidth: number, isDashboard: boolean, fitBounds: boolean): void;
|
|
26
|
-
|
|
26
|
+
RenderGPRegions(gpRegionsJson: any[], gsByRegionJson: any[], selectedRegion: number, offsetX: number, offsetY: number, vMapWidth: number, isDashboard: boolean): void;
|
|
27
27
|
// Shape Selection and Management
|
|
28
28
|
selectShape(shapeId: string | number, selectedStyle: any, unselectedStyle: any): void;
|
|
29
29
|
isShapeInLocPolygons(shapeId: string | number): boolean;
|
|
@@ -2818,6 +2818,202 @@ export class MapOverlayManager {
|
|
|
2818
2818
|
SACadastral_DrawSACadastral(saCadastralJson, offsetX, offsetY, vmWidth, isDashboard, fitBounds);
|
|
2819
2819
|
}
|
|
2820
2820
|
|
|
2821
|
+
function Display_DrawGPRegions(locationsJson, selectedRegion, offsetX, offsetY) {
|
|
2822
|
+
var polygon = null;
|
|
2823
|
+
locations = locationsJson;
|
|
2824
|
+
|
|
2825
|
+
locations.forEach(function (location) {
|
|
2826
|
+
if(location.id == selectedRegion || selectedRegion === 0) {
|
|
2827
|
+
if (location && location.poly && location.poly.length > 0) {
|
|
2828
|
+
var dp = google.maps.geometry.encoding.decodePath(location.poly, 5);
|
|
2829
|
+
|
|
2830
|
+
polygon = new google.maps.Polygon({
|
|
2831
|
+
map: map,
|
|
2832
|
+
path: dp,
|
|
2833
|
+
strokeColor: '#000000',
|
|
2834
|
+
strokeOpacity: 1,
|
|
2835
|
+
strokeWeight: 3,
|
|
2836
|
+
fillColor: '#000000',
|
|
2837
|
+
fillOpacity: 0.3,
|
|
2838
|
+
id: location.id,
|
|
2839
|
+
content: location.regionName,
|
|
2840
|
+
zIndex: 10000
|
|
2841
|
+
});
|
|
2842
|
+
fpolies.push(polygon);
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
});
|
|
2846
|
+
}
|
|
2847
|
+
|
|
2848
|
+
function Display_DrawGSByRegion(locationsJson, offsetX, offsetY, vMapWidth) {
|
|
2849
|
+
|
|
2850
|
+
locations = locationsJson;
|
|
2851
|
+
bounds = new google.maps.LatLngBounds();
|
|
2852
|
+
var mapPanned = false;
|
|
2853
|
+
|
|
2854
|
+
locations.forEach(function (location) {
|
|
2855
|
+
|
|
2856
|
+
var mpos = new google.maps.LatLng(location.latitude,location.longitude);
|
|
2857
|
+
bounds.extend(new google.maps.LatLng(location.latitude,location.longitude));
|
|
2858
|
+
|
|
2859
|
+
var parser = new DOMParser();
|
|
2860
|
+
|
|
2861
|
+
var svgIconString = '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" fill="none">';
|
|
2862
|
+
svgIconString += '<g transform="translate(0.5, 4)"><path d="M0,0 32,0 16,27.7Z" stroke="#000000" stroke-width="1" fill="'+location.iconColor+'" fill-opacity="0.9"></path></g>';
|
|
2863
|
+
svgIconString += '</svg>';
|
|
2864
|
+
|
|
2865
|
+
var svgIcon = parser.parseFromString(svgIconString, 'image/svg+xml').documentElement;
|
|
2866
|
+
|
|
2867
|
+
var fmarker = new google.maps.marker.AdvancedMarkerElement({
|
|
2868
|
+
map: map,
|
|
2869
|
+
position: mpos,
|
|
2870
|
+
content: svgIcon,
|
|
2871
|
+
zIndex: 10002,
|
|
2872
|
+
});
|
|
2873
|
+
fmarker.setAttribute("id", location.id+'|'+location.Name+'|'+location.CompanyName+'|'+location.JSEAbbreviation+'|'+location.Label+'|'+location.Capacity+'|'+location.SagisCode);
|
|
2874
|
+
fmarkers.push(fmarker);
|
|
2875
|
+
});
|
|
2876
|
+
|
|
2877
|
+
if(locations.length > 1) {
|
|
2878
|
+
var boundsChangedListener = google.maps.event.addListenerOnce(map, 'bounds_changed', function () {
|
|
2879
|
+
if(!mapPanned) {
|
|
2880
|
+
|
|
2881
|
+
var psw = map.getProjection().fromLatLngToPoint(bounds.getSouthWest());
|
|
2882
|
+
var pne = map.getProjection().fromLatLngToPoint(bounds.getNorthEast());
|
|
2883
|
+
|
|
2884
|
+
var zoom = map.getZoom();
|
|
2885
|
+
var scale = 1 << zoom;
|
|
2886
|
+
|
|
2887
|
+
if((pne.x - psw.x)*scale >= vMapWidth) {
|
|
2888
|
+
map.setZoom(zoom-1);
|
|
2889
|
+
}
|
|
2890
|
+
|
|
2891
|
+
if (map.getZoom() > 16) {
|
|
2892
|
+
map.setZoom(16);
|
|
2893
|
+
}
|
|
2894
|
+
|
|
2895
|
+
offsetCenter(bounds.getCenter(), offsetX, offsetY);
|
|
2896
|
+
mapPanned = !mapPanned;
|
|
2897
|
+
}
|
|
2898
|
+
});
|
|
2899
|
+
mapListeners.push(boundsChangedListener);
|
|
2900
|
+
|
|
2901
|
+
map.fitBounds(bounds);
|
|
2902
|
+
|
|
2903
|
+
} else if(locations.length == 1) {
|
|
2904
|
+
|
|
2905
|
+
|
|
2906
|
+
var boundsChangedListener = google.maps.event.addListenerOnce(map, 'bounds_changed', function () {
|
|
2907
|
+
if(!mapPanned) {
|
|
2908
|
+
|
|
2909
|
+
offsetCenter(map.getCenter(), offsetX, offsetY);
|
|
2910
|
+
mapPanned = !mapPanned;
|
|
2911
|
+
|
|
2912
|
+
}
|
|
2913
|
+
});
|
|
2914
|
+
|
|
2915
|
+
map.panTo(new google.maps.LatLng(locations[0].latitude,locations[0].longitude));
|
|
2916
|
+
map.setZoom(9);
|
|
2917
|
+
|
|
2918
|
+
}
|
|
2919
|
+
//map.fitBounds(bounds);
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2922
|
+
function GPRegions_DrawProductionRegions(gpRegionsJson, gsByRegionJson, selectedRegion, offsetX, offsetY, vMapWidth, isDashboard) {
|
|
2923
|
+
locations = gpRegionsJson;
|
|
2924
|
+
|
|
2925
|
+
mapListeners_clear();
|
|
2926
|
+
polygonListeners_clear();
|
|
2927
|
+
markerListeners_clear();
|
|
2928
|
+
fmarkers_clear();
|
|
2929
|
+
fPolies_clear();
|
|
2930
|
+
|
|
2931
|
+
Display_DrawGPRegions(gpRegionsJson, selectedRegion, offsetX, offsetY);
|
|
2932
|
+
GPRegions_BindPolyEvents(isDashboard);
|
|
2933
|
+
|
|
2934
|
+
Display_DrawGSByRegion(gsByRegionJson, offsetX, offsetY, vMapWidth);
|
|
2935
|
+
GSByRegion_BindPolyEvents(isDashboard);
|
|
2936
|
+
}
|
|
2937
|
+
|
|
2938
|
+
function GPRegions_BindPolyEvents(isDashboard) {
|
|
2939
|
+
deleteTooltip();
|
|
2940
|
+
|
|
2941
|
+
fpolies.forEach(function (poly) {
|
|
2942
|
+
polygonListeners.push(google.maps.event.addListener(poly, 'mouseover', function (event) {
|
|
2943
|
+
poly.setOptions({strokeColor: '#f1a81e', strokeWeight: 3, zIndex: 10012});
|
|
2944
|
+
deleteTooltip();
|
|
2945
|
+
injectTooltip(event, poly.content);
|
|
2946
|
+
}));
|
|
2947
|
+
polygonListeners.push(google.maps.event.addListener(poly, 'mousemove', moveTooltip));
|
|
2948
|
+
polygonListeners.push(google.maps.event.addListener(poly, 'mouseout', function(event) {
|
|
2949
|
+
poly.setOptions({strokeColor: '#000000', strokeWeight: 3, zIndex: 10002});
|
|
2950
|
+
deleteTooltip();
|
|
2951
|
+
}));
|
|
2952
|
+
if(!isDashboard) {
|
|
2953
|
+
polygonListeners.push(google.maps.event.addListener(poly, 'click', function (event) {
|
|
2954
|
+
deleteTooltip();
|
|
2955
|
+
eventHandlers["CPRPolyOnClick"]({
|
|
2956
|
+
type: 'SUCCESS',
|
|
2957
|
+
message: 'CPRPoly clicked',
|
|
2958
|
+
code: 200,
|
|
2959
|
+
data: poly.id,
|
|
2960
|
+
});
|
|
2961
|
+
}));
|
|
2962
|
+
}
|
|
2963
|
+
});
|
|
2964
|
+
}
|
|
2965
|
+
|
|
2966
|
+
function GSByRegion_BindPolyEvents(isDashboard) {
|
|
2967
|
+
|
|
2968
|
+
deleteTooltip();
|
|
2969
|
+
|
|
2970
|
+
fmarkers.forEach(function (marker) {
|
|
2971
|
+
var ttc = marker.id.split('|');
|
|
2972
|
+
var ttdata = '<b>'+ttc[1]+'</b><br>';
|
|
2973
|
+
ttdata += 'Company: '+ttc[2]+' ('+ttc[3]+')<br>';
|
|
2974
|
+
ttdata += 'Type: '+ttc[4]+'<br>';
|
|
2975
|
+
if(parseInt(ttc[5]) > 0) {
|
|
2976
|
+
ttdata += 'Capacity: '+ttc[5]+'t<br>';
|
|
2977
|
+
} else {
|
|
2978
|
+
ttdata += 'Capacity: n/a<br>';
|
|
2979
|
+
}
|
|
2980
|
+
if(parseInt(ttc[6]) > 0) {
|
|
2981
|
+
ttdata += 'Sagis Code: '+ttc[6];
|
|
2982
|
+
} else {
|
|
2983
|
+
ttdata += 'Sagis Code: n/a';
|
|
2984
|
+
}
|
|
2985
|
+
var mclickListener = marker.addListener('click', function (event) {
|
|
2986
|
+
eventHandlers["GSMarkerOnClick"]({
|
|
2987
|
+
type: 'SUCCESS',
|
|
2988
|
+
message: 'GSMarker clicked',
|
|
2989
|
+
code: 200,
|
|
2990
|
+
data: ttc[0],
|
|
2991
|
+
});
|
|
2992
|
+
});
|
|
2993
|
+
markerListeners.push(mclickListener);
|
|
2994
|
+
|
|
2995
|
+
var moverListener = marker.content.addEventListener('mouseover', function (event) {
|
|
2996
|
+
deleteTooltip();
|
|
2997
|
+
injectMarkerTooltip(event, ttdata);
|
|
2998
|
+
});
|
|
2999
|
+
markerListeners.push(moverListener);
|
|
3000
|
+
|
|
3001
|
+
var mmoveListener = marker.content.addEventListener('mousemove', function (event) {
|
|
3002
|
+
moveMarkerTooltip(event);
|
|
3003
|
+
});
|
|
3004
|
+
markerListeners.push(mmoveListener);
|
|
3005
|
+
|
|
3006
|
+
var moutListener = marker.content.addEventListener('mouseout', function (event) {
|
|
3007
|
+
deleteTooltip(event);
|
|
3008
|
+
});
|
|
3009
|
+
markerListeners.push(moutListener);
|
|
3010
|
+
});
|
|
3011
|
+
}
|
|
3012
|
+
|
|
3013
|
+
_this.RenderGPRegions = function(gpRegionsJson, gsByRegionJson, selectedRegion, offsetX, offsetY, vMapWidth, isDashboard) {
|
|
3014
|
+
GPRegions_DrawProductionRegions(gpRegionsJson, gsByRegionJson, selectedRegion, offsetX, offsetY, vMapWidth, isDashboard);
|
|
3015
|
+
}
|
|
3016
|
+
|
|
2821
3017
|
_this.NDVI_AddOverlay_DEA = function (locationJson, ndviTileURL, validGMTiles, eosLocationCropperRefId, eosViewId, spinnerURL, spinnerLat, spinnerLon, paletteId, colorMapTypeIdValue, isFullView, onComplete) {
|
|
2822
3018
|
|
|
2823
3019
|
//console.log('_this.NDVI_AddOverlay_DEA');
|
|
@@ -2867,8 +3063,6 @@ export class MapOverlayManager {
|
|
|
2867
3063
|
spinnerImg.height = 120;
|
|
2868
3064
|
spinnerImg.style.transform = 'translate(0, 50%)';
|
|
2869
3065
|
const position = new google.maps.LatLng(centerLat, centerLng);
|
|
2870
|
-
|
|
2871
|
-
//console.log(spinnerImg);
|
|
2872
3066
|
|
|
2873
3067
|
var spinnerMarker = new google.maps.marker.AdvancedMarkerElement({
|
|
2874
3068
|
map: map,
|