mapping-component-package-jp 0.1.6 → 0.1.9
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 +10 -0
- 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 +10 -0
- package/src/js/mapEncapsulation/mapOverlayManager.js +141 -1
package/package.json
CHANGED
|
@@ -5,6 +5,13 @@ export class MapOverlayManager {
|
|
|
5
5
|
eventHandlers_set(eH: any): void;
|
|
6
6
|
eventHandlers_get(): any;
|
|
7
7
|
|
|
8
|
+
// Getters
|
|
9
|
+
center_get(): any;
|
|
10
|
+
zoom_get(): number;
|
|
11
|
+
fpolies_get(): any;
|
|
12
|
+
locPolygons_get(): any;
|
|
13
|
+
overlayMapTypes_get(): any;
|
|
14
|
+
|
|
8
15
|
// Shape Management
|
|
9
16
|
Shape_IsShapeHole(ShapeId: string | number): boolean;
|
|
10
17
|
Shape_PolygonCustomEdit_Add(isHole: boolean, config: any, isMobile: boolean, mapWidth: number, mapHeight: number, vmWidth: number, offsetX: number, offsetY: number): string;
|
|
@@ -16,6 +23,8 @@ export class MapOverlayManager {
|
|
|
16
23
|
Shape_Delete(ShapeId: string | number, EventHandlers?: any): void;
|
|
17
24
|
Shape_DeleteAll(isMobile?: boolean): void;
|
|
18
25
|
Shape_Convert(ShapeId: string | number): string;
|
|
26
|
+
SelectedShape_GetType(ShapeId: string | number, shapeTypes: any): string;
|
|
27
|
+
SelectedShape_GetByShapeId(ShapeId: string | number): any;
|
|
19
28
|
|
|
20
29
|
// Rendering Methods
|
|
21
30
|
RenderFields(locations: any[], properties: any, editMode?: boolean): void;
|
|
@@ -43,6 +52,7 @@ export class MapOverlayManager {
|
|
|
43
52
|
// Field Management
|
|
44
53
|
TriggerField_ChangeEvent(): any;
|
|
45
54
|
DrawField_AttachEvents(eHandlers: any): void;
|
|
55
|
+
DrawField_DetachEvents(StrokeColor: string, SelectedShapeId: string): void;
|
|
46
56
|
clearBackgroundFields(): void;
|
|
47
57
|
checkForBackgroundFieldOverlaps(): boolean;
|
|
48
58
|
|
|
@@ -45,6 +45,7 @@ export class MapOverlayManager {
|
|
|
45
45
|
var dpolylines = [];
|
|
46
46
|
var rpolylines = [];
|
|
47
47
|
var fmarkers = [];
|
|
48
|
+
var locations = [];
|
|
48
49
|
|
|
49
50
|
var currentPolylineCustomEdit = null;
|
|
50
51
|
var currentPolygonCustomEdit = null;
|
|
@@ -308,6 +309,27 @@ export class MapOverlayManager {
|
|
|
308
309
|
return eventHandlers;
|
|
309
310
|
};
|
|
310
311
|
|
|
312
|
+
_this.center_get = function () {
|
|
313
|
+
return map.getCenter();
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
_this.zoom_get = function () {
|
|
317
|
+
return map.getZoom();
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
_this.fpolies_get = function () {
|
|
321
|
+
return fpolies;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
_this.locPolygons_get = function () {
|
|
325
|
+
return locPolygons;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
_this.overlayMapTypes_get = function() {
|
|
329
|
+
return map.overlayMapTypes;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
|
|
311
333
|
//#DRAW/DISPLAY FIELDS
|
|
312
334
|
_this.RenderFields = function (locations, properties) {
|
|
313
335
|
var mbounds = new google.maps.LatLngBounds();
|
|
@@ -609,6 +631,90 @@ export class MapOverlayManager {
|
|
|
609
631
|
|
|
610
632
|
// #endregion
|
|
611
633
|
|
|
634
|
+
_this.DrawField_DrawLocation = function (locationsJson, locationId, shapeConfig) {
|
|
635
|
+
|
|
636
|
+
locations = JSON.parse(locationsJson, true);
|
|
637
|
+
|
|
638
|
+
var cpid;
|
|
639
|
+
|
|
640
|
+
locations.forEach(function (location) {
|
|
641
|
+
|
|
642
|
+
if (location && location.Poly && location.Poly.length > 0 && location.Id > 0) {
|
|
643
|
+
|
|
644
|
+
var polies = location.Poly.split(',');
|
|
645
|
+
|
|
646
|
+
var paths = [];
|
|
647
|
+
polies.forEach(function (poly, pIndex) {
|
|
648
|
+
var path = [];
|
|
649
|
+
poly.forEach(function (v, idx) {
|
|
650
|
+
path.push(new google.maps.LatLng(parseFloat(v[1]), parseFloat(v[0])));
|
|
651
|
+
});
|
|
652
|
+
paths.push(path);
|
|
653
|
+
|
|
654
|
+
if (location.Id == locationId) {
|
|
655
|
+
|
|
656
|
+
var pArea = google.maps.geometry.spherical.computeSignedArea(path);
|
|
657
|
+
var isHole = pArea > 0 && pIndex !== 0;
|
|
658
|
+
cpid = Date.now() + Math.floor(Math.random() * 100000);
|
|
659
|
+
|
|
660
|
+
var polygon = new google.maps.Polygon({
|
|
661
|
+
map: map,
|
|
662
|
+
path: path,
|
|
663
|
+
id: cpid,
|
|
664
|
+
content: location.LocationName,
|
|
665
|
+
strokeColor: shapeConfig.StrokeColor_DrawEditShape,
|
|
666
|
+
strokeOpacity: shapeConfig.StrokeOpacity,
|
|
667
|
+
strokeWeight: shapeConfig.StrokeWeight,
|
|
668
|
+
fillColor: shapeConfig.FillColor,
|
|
669
|
+
fillOpacity: shapeConfig.FillOpacity,
|
|
670
|
+
zIndex: isHole ? 10200 : 10100,
|
|
671
|
+
clickable: true,
|
|
672
|
+
editable: false,
|
|
673
|
+
draggable: true,
|
|
674
|
+
isPolygon: true,
|
|
675
|
+
isCircle: false,
|
|
676
|
+
isCircleSector: false,
|
|
677
|
+
isCircleSegment: false,
|
|
678
|
+
isHole: isHole,
|
|
679
|
+
latitude: location.Latitude,
|
|
680
|
+
longitude: location.Longitude,
|
|
681
|
+
poly: location.Poly,
|
|
682
|
+
area: location.Area,
|
|
683
|
+
perimeter: location.Perimeter
|
|
684
|
+
});
|
|
685
|
+
|
|
686
|
+
locPolygons.push(polygon);
|
|
687
|
+
}
|
|
688
|
+
});
|
|
689
|
+
|
|
690
|
+
if (location.Id != locationId) {
|
|
691
|
+
|
|
692
|
+
cpid = Date.now() + Math.floor(Math.random() * 100000);
|
|
693
|
+
|
|
694
|
+
var polygon = new google.maps.Polygon({
|
|
695
|
+
map: map,
|
|
696
|
+
paths: paths,
|
|
697
|
+
id: cpid,
|
|
698
|
+
content: location.LocationName,
|
|
699
|
+
strokeColor: shapeConfig.StrokeColor_Other,
|
|
700
|
+
strokeOpacity: shapeConfig.StrokeOpacity,
|
|
701
|
+
strokeWeight: shapeConfig.StrokeWeight,
|
|
702
|
+
fillColor: shapeConfig.FillColor,
|
|
703
|
+
fillOpacity: 0.3, //shapeConfig.FillOpacity,
|
|
704
|
+
zIndex: 10000,
|
|
705
|
+
clickable: false,
|
|
706
|
+
editable: false,
|
|
707
|
+
draggable: false
|
|
708
|
+
});
|
|
709
|
+
|
|
710
|
+
polygons.push(polygon);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
});
|
|
714
|
+
|
|
715
|
+
//console.log(polygons);
|
|
716
|
+
}
|
|
717
|
+
|
|
612
718
|
_this.Shape_IsShapeHole = function(ShapeId) {
|
|
613
719
|
let isHole = false;
|
|
614
720
|
locPolygons.forEach(function (polygon, index) {
|
|
@@ -620,6 +726,25 @@ export class MapOverlayManager {
|
|
|
620
726
|
|
|
621
727
|
}
|
|
622
728
|
|
|
729
|
+
_this.SelectedShape_GetType = function (ShapeId, shapeTypes) {
|
|
730
|
+
var polygon = locPolygons.find(p => p.id == ShapeId);
|
|
731
|
+
|
|
732
|
+
if (polygon.id == ShapeId) {
|
|
733
|
+
if (polygon.isPolygon) {
|
|
734
|
+
return shapeTypes.ShapeTypeId_Polygon;
|
|
735
|
+
} else if (polygon.isCircle) {
|
|
736
|
+
return shapeTypes.ShapeTypeId_Circle;
|
|
737
|
+
} else if (polygon.isCircleSector) {
|
|
738
|
+
return shapeTypes.ShapeTypeId_CircleSector;
|
|
739
|
+
} else if (polygon.isCircleSegment) {
|
|
740
|
+
return shapeTypes.ShapeTypeId_CircleSegment;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
_this.SelectedShape_GetByShapeId = function(ShapeId) {
|
|
746
|
+
return locPolygons.find(p => p.id == ShapeId);
|
|
747
|
+
}
|
|
623
748
|
|
|
624
749
|
_this.selectShape = function(shapeId, selectedStyle, unselectedStyle) {
|
|
625
750
|
console.log('Selecting shape:', shapeId);
|
|
@@ -2010,7 +2135,7 @@ export class MapOverlayManager {
|
|
|
2010
2135
|
return { perimeter, area, path };
|
|
2011
2136
|
}
|
|
2012
2137
|
|
|
2013
|
-
_this.DrawField_AttachEvents = function (eHandlers) {
|
|
2138
|
+
_this.DrawField_AttachEvents = function (eHandlers, ShapeId, StrokeColor) {
|
|
2014
2139
|
|
|
2015
2140
|
locPolygons.forEach(function (polygon) {
|
|
2016
2141
|
|
|
@@ -2028,10 +2153,25 @@ export class MapOverlayManager {
|
|
|
2028
2153
|
eHandlers["ShapeSelect"](this.id);
|
|
2029
2154
|
});
|
|
2030
2155
|
polygonListeners.push(mclListener);
|
|
2156
|
+
|
|
2157
|
+
if (polygon.id == ShapeId && StrokeColor !== undefined) {
|
|
2158
|
+
polygon.setOptions({ strokeColor: StrokeColor, strokeWeight: 3 });
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2031
2161
|
});
|
|
2032
2162
|
|
|
2033
2163
|
}
|
|
2034
2164
|
|
|
2165
|
+
_this.DrawField_DetachEvents = function (StrokeColor, SelectedShapeId) {
|
|
2166
|
+
polygonListeners_clear();
|
|
2167
|
+
|
|
2168
|
+
locPolygons.forEach(function (polygon) {
|
|
2169
|
+
if(polygon.id == SelectedShapeId) {
|
|
2170
|
+
polygon.setOptions({ strokeColor: StrokeColor });
|
|
2171
|
+
}
|
|
2172
|
+
});
|
|
2173
|
+
}
|
|
2174
|
+
|
|
2035
2175
|
_this.PolygonCustomEdit_Edit = function (ShapeId, isMobile) {
|
|
2036
2176
|
var polygonCE = locPolygons.find(p => p.id == ShapeId);
|
|
2037
2177
|
if (polygonCE) {
|