mapping-component-package-jp 0.0.44 → 0.0.46
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 +2 -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/js/mapEncapsulation/mapOverlayManager.d.ts +2 -1
- package/src/js/mapEncapsulation/mapOverlayManager.js +186 -3
package/package.json
CHANGED
|
@@ -18,11 +18,12 @@ export class MapOverlayManager {
|
|
|
18
18
|
|
|
19
19
|
// Rendering Methods
|
|
20
20
|
RenderFields(locations: any[], properties: any, editMode?: boolean): void;
|
|
21
|
-
RenderRegionFarms(locationsJson: any, icon: any, fitBounds: boolean): void;
|
|
21
|
+
RenderRegionFarms(locationsJson: any, icon: any, fitBounds: boolean, offsetX: number, offsetY: number): void;
|
|
22
22
|
RenderRegions(regionLocations: any[], properties: any, farmLocations: any[], icon: any, offsetX: number, offsetY: number): void;
|
|
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
|
+
RenderSADelineatedFields(saDelineatedFieldsJson: any, offsetX: number, offsetY: number, vmWidth: number, isDashboard: boolean, fitBounds: boolean): void;
|
|
26
27
|
RenderGSGPRegions(gpRegionsJson: any[], gsByRegionJson: any[], selectedRegion: number, offsetX: number, offsetY: number, vMapWidth: number, isDashboard: boolean): void;
|
|
27
28
|
RenderGSProvinces(provincesJson: any[], gsByProvinceJson: any[], selectedProvince: number, offsetX: number, offsetY: number, vMapWidth: number, isDashboard: boolean): void;
|
|
28
29
|
|
|
@@ -220,7 +220,7 @@ export class MapOverlayManager {
|
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
function AdvancedMarker(locations, icon, markerType = 'field', fitBounds) {
|
|
223
|
+
function AdvancedMarker(locations, icon, markerType = 'field', fitBounds, offsetX, offsetY) {
|
|
224
224
|
|
|
225
225
|
if (map.getMapCapabilities().isAdvancedMarkersAvailable && locations && locations.length > 0) {
|
|
226
226
|
var mapBounds = new google.maps.LatLngBounds();
|
|
@@ -288,6 +288,11 @@ export class MapOverlayManager {
|
|
|
288
288
|
|
|
289
289
|
if (markerType === 'farm') {
|
|
290
290
|
if(fitBounds) {
|
|
291
|
+
|
|
292
|
+
var mboundsChangedListener = google.maps.event.addListenerOnce(map, "bounds_changed", function() {
|
|
293
|
+
offsetCenter(map.getCenter(), offsetX, offsetY);
|
|
294
|
+
});
|
|
295
|
+
mapListeners.push(mboundsChangedListener);
|
|
291
296
|
map.fitBounds(mapBounds);
|
|
292
297
|
}
|
|
293
298
|
farms_BindMarkerEvents();
|
|
@@ -1911,9 +1916,9 @@ export class MapOverlayManager {
|
|
|
1911
1916
|
|
|
1912
1917
|
}
|
|
1913
1918
|
|
|
1914
|
-
_this.RenderRegionFarms = function (locationsJson, icon, fitBounds) {
|
|
1919
|
+
_this.RenderRegionFarms = function (locationsJson, icon, fitBounds, offsetX, offsetY) {
|
|
1915
1920
|
if(icon){
|
|
1916
|
-
AdvancedMarker(locationsJson, icon, 'farm', fitBounds);
|
|
1921
|
+
AdvancedMarker(locationsJson, icon, 'farm', fitBounds, offsetX, offsetY);
|
|
1917
1922
|
}
|
|
1918
1923
|
}
|
|
1919
1924
|
|
|
@@ -2813,6 +2818,184 @@ export class MapOverlayManager {
|
|
|
2813
2818
|
SACadastral_DrawSACadastral(saCadastralJson, offsetX, offsetY, vmWidth, isDashboard, fitBounds);
|
|
2814
2819
|
}
|
|
2815
2820
|
|
|
2821
|
+
function SADelineatedFields_DrawSADelineatedFields(saDelineatedFieldsJson, offsetX, offsetY, vmWidth, isDashboard, fitBounds) {
|
|
2822
|
+
mapListeners_clear();
|
|
2823
|
+
polygonListeners_clear();
|
|
2824
|
+
markerListeners_clear();
|
|
2825
|
+
fmarkers_clear();
|
|
2826
|
+
fPolies_clear();
|
|
2827
|
+
|
|
2828
|
+
var mdeListener = google.maps.event.addListener(map, 'dragend', function() {
|
|
2829
|
+
if(map.getZoom() >= 13 && map.getZoom() <= 17) {
|
|
2830
|
+
eventHandlers["ReloadDelineatedFieldsData"]({
|
|
2831
|
+
type: 'SUCCESS',
|
|
2832
|
+
message: 'Reload delineated fields data on dragend',
|
|
2833
|
+
code: 200,
|
|
2834
|
+
data: null
|
|
2835
|
+
});
|
|
2836
|
+
|
|
2837
|
+
} else {
|
|
2838
|
+
|
|
2839
|
+
mapListeners_clear();
|
|
2840
|
+
fPolies_clear();
|
|
2841
|
+
if(map.getZoom() < 13) {
|
|
2842
|
+
map.setZoom(13);
|
|
2843
|
+
}
|
|
2844
|
+
if(map.getZoom() > 17) {
|
|
2845
|
+
map.setZoom(17);
|
|
2846
|
+
}
|
|
2847
|
+
eventHandlers["ReloadDelineatedFieldsData"]({
|
|
2848
|
+
type: 'SUCCESS',
|
|
2849
|
+
message: 'Reload delineated fields data on dragend, zoom outside range',
|
|
2850
|
+
code: 200,
|
|
2851
|
+
data: null
|
|
2852
|
+
});
|
|
2853
|
+
}
|
|
2854
|
+
});
|
|
2855
|
+
mapListeners.push(mdeListener);
|
|
2856
|
+
|
|
2857
|
+
var mzcListener = google.maps.event.addListener(map, 'zoom_changed', function() {
|
|
2858
|
+
if(map.getZoom() >= 13 && map.getZoom() <= 17) {
|
|
2859
|
+
eventHandlers["ReloadDelineatedFieldsData"]({
|
|
2860
|
+
type: 'SUCCESS',
|
|
2861
|
+
message: 'Reload delineated fields data on zoom changed',
|
|
2862
|
+
code: 200,
|
|
2863
|
+
data: null
|
|
2864
|
+
});
|
|
2865
|
+
|
|
2866
|
+
} else {
|
|
2867
|
+
|
|
2868
|
+
mapListeners_clear();
|
|
2869
|
+
fPolies_clear();
|
|
2870
|
+
if(map.getZoom() < 13) {
|
|
2871
|
+
map.setZoom(13);
|
|
2872
|
+
}
|
|
2873
|
+
if(map.getZoom() > 17) {
|
|
2874
|
+
map.setZoom(17);
|
|
2875
|
+
}
|
|
2876
|
+
eventHandlers["ReloadDelineatedFieldsData"]({
|
|
2877
|
+
type: 'SUCCESS',
|
|
2878
|
+
message: 'Reload delineated fields data on zoom changed, zoom outside range',
|
|
2879
|
+
code: 200,
|
|
2880
|
+
data: null
|
|
2881
|
+
});
|
|
2882
|
+
}
|
|
2883
|
+
});
|
|
2884
|
+
mapListeners.push(mzcListener);
|
|
2885
|
+
|
|
2886
|
+
var mbcListener = google.maps.event.addListenerOnce(map, 'bounds_changed', function() {
|
|
2887
|
+
if(map.getZoom() >= 13 && map.getZoom() <= 17) {
|
|
2888
|
+
eventHandlers["ReloadDelineatedFieldsData"]({
|
|
2889
|
+
type: 'SUCCESS',
|
|
2890
|
+
message: 'Reload delineated fields data on bounds changed',
|
|
2891
|
+
code: 200,
|
|
2892
|
+
data: null
|
|
2893
|
+
});
|
|
2894
|
+
|
|
2895
|
+
} else {
|
|
2896
|
+
|
|
2897
|
+
mapListeners_clear();
|
|
2898
|
+
fPolies_clear();
|
|
2899
|
+
if(map.getZoom() < 13) {
|
|
2900
|
+
map.setZoom(13);
|
|
2901
|
+
}
|
|
2902
|
+
if(map.getZoom() > 17) {
|
|
2903
|
+
map.setZoom(17);
|
|
2904
|
+
}
|
|
2905
|
+
eventHandlers["ReloadDelineatedFieldsData"]({
|
|
2906
|
+
type: 'SUCCESS',
|
|
2907
|
+
message: 'Reload delineated fields data on bounds changed, zoom outside range',
|
|
2908
|
+
code: 200,
|
|
2909
|
+
data: null
|
|
2910
|
+
});
|
|
2911
|
+
}
|
|
2912
|
+
});
|
|
2913
|
+
mapListeners.push(mbcListener);
|
|
2914
|
+
|
|
2915
|
+
if(map.getZoom() >= 13 && map.getZoom() <= 17) {
|
|
2916
|
+
Display_SADelineatedFields(saDelineatedFieldsJson, offsetX, offsetY, vmWidth, isDashboard, fitBounds);
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
|
|
2920
|
+
function Display_SADelineatedFields(saDelineatedFieldsJson, offsetX, offsetY, vmWidth, isDashboard, fitBounds) {
|
|
2921
|
+
|
|
2922
|
+
var locations = saDelineatedFieldsJson;
|
|
2923
|
+
|
|
2924
|
+
if(locations && locations.length > 0) {
|
|
2925
|
+
locations.forEach(function(v) {
|
|
2926
|
+
if(fitBounds) {
|
|
2927
|
+
bounds = new google.maps.LatLngBounds();
|
|
2928
|
+
}
|
|
2929
|
+
|
|
2930
|
+
var spolies = v.poly.split(',');
|
|
2931
|
+
var paths = [];
|
|
2932
|
+
spolies.forEach(function(p) {
|
|
2933
|
+
var sp = polyline.decode(p);
|
|
2934
|
+
var path = [];
|
|
2935
|
+
sp.forEach(function(c) {
|
|
2936
|
+
path.push(new google.maps.LatLng(parseFloat(c[0]),parseFloat(c[1])));
|
|
2937
|
+
bounds.extend(new google.maps.LatLng(parseFloat(c[0]),parseFloat(c[1])));
|
|
2938
|
+
});
|
|
2939
|
+
paths.push(path);
|
|
2940
|
+
});
|
|
2941
|
+
|
|
2942
|
+
var area = v.area/10000;
|
|
2943
|
+
var content = v.category+'<br>'+area.toFixed(2)+' ha';
|
|
2944
|
+
|
|
2945
|
+
var fpoly = new google.maps.Polygon({
|
|
2946
|
+
map: map,
|
|
2947
|
+
paths: paths,
|
|
2948
|
+
strokeWeight: 3,
|
|
2949
|
+
strokeColor: '#000000',
|
|
2950
|
+
strokeOpacity: 1,
|
|
2951
|
+
fillColor: '#000000',
|
|
2952
|
+
fillOpacity: 0.01,
|
|
2953
|
+
id: v.id,
|
|
2954
|
+
content: content,
|
|
2955
|
+
zIndex: 10001,
|
|
2956
|
+
});
|
|
2957
|
+
|
|
2958
|
+
if(fitBounds) {
|
|
2959
|
+
map.fitBounds(bounds);
|
|
2960
|
+
}
|
|
2961
|
+
fpolies.push(fpoly);
|
|
2962
|
+
});
|
|
2963
|
+
|
|
2964
|
+
}
|
|
2965
|
+
|
|
2966
|
+
SADelineatedFields_BindPolyEvents(isDashboard);
|
|
2967
|
+
}
|
|
2968
|
+
|
|
2969
|
+
function SADelineatedFields_BindPolyEvents(isDashboard) {
|
|
2970
|
+
deleteTooltip();
|
|
2971
|
+
|
|
2972
|
+
fpolies.forEach(function (poly) {
|
|
2973
|
+
polygonListeners.push(google.maps.event.addListener(poly, 'mouseover', function (event) {
|
|
2974
|
+
poly.setOptions({strokeColor: '#f1a81e', strokeWeight: 3, zIndex: 10011});
|
|
2975
|
+
deleteTooltip();
|
|
2976
|
+
injectTooltip(event, poly.content);
|
|
2977
|
+
}));
|
|
2978
|
+
polygonListeners.push(google.maps.event.addListener(poly, 'mousemove', moveTooltip));
|
|
2979
|
+
polygonListeners.push(google.maps.event.addListener(poly, 'mouseout', function(event) {
|
|
2980
|
+
poly.setOptions({strokeColor: '#000000', strokeWeight: 3, zIndex: 10001});
|
|
2981
|
+
deleteTooltip();
|
|
2982
|
+
}));
|
|
2983
|
+
if(!isDashboard) {
|
|
2984
|
+
polygonListeners.push(google.maps.event.addListener(poly, 'click', function (event) {
|
|
2985
|
+
deleteTooltip();
|
|
2986
|
+
eventHandlers["SADelineatedFieldPolyOnClick"](this.id);
|
|
2987
|
+
}));
|
|
2988
|
+
}
|
|
2989
|
+
});
|
|
2990
|
+
}
|
|
2991
|
+
|
|
2992
|
+
_this.RenderSADelineatedFields = function (saDelineatedFieldsJson, offsetX, offsetY, vmWidth, isDashboard, fitBounds) {
|
|
2993
|
+
SADelineatedFields_DrawSADelineatedFields(saDelineatedFieldsJson, offsetX, offsetY, vmWidth, isDashboard, fitBounds);
|
|
2994
|
+
}
|
|
2995
|
+
|
|
2996
|
+
|
|
2997
|
+
|
|
2998
|
+
|
|
2816
2999
|
function Display_DrawGPRegions(locationsJson, selectedRegion, offsetX, offsetY) {
|
|
2817
3000
|
var polygon = null;
|
|
2818
3001
|
var locations = locationsJson;
|