mapping-component-package-jp 0.1.7 → 0.1.10
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 +9 -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 +9 -0
- package/src/js/mapEncapsulation/mapOverlayManager.js +109 -0
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;
|
|
@@ -17,6 +24,7 @@ export class MapOverlayManager {
|
|
|
17
24
|
Shape_DeleteAll(isMobile?: boolean): void;
|
|
18
25
|
Shape_Convert(ShapeId: string | number): string;
|
|
19
26
|
SelectedShape_GetType(ShapeId: string | number, shapeTypes: any): string;
|
|
27
|
+
SelectedShape_GetByShapeId(ShapeId: string | number): any;
|
|
20
28
|
|
|
21
29
|
// Rendering Methods
|
|
22
30
|
RenderFields(locations: any[], properties: any, editMode?: boolean): void;
|
|
@@ -42,6 +50,7 @@ export class MapOverlayManager {
|
|
|
42
50
|
CircleSegment_Edit(ShapeId: string | number, isMobile: boolean): void;
|
|
43
51
|
|
|
44
52
|
// Field Management
|
|
53
|
+
DrawField_DrawLocation(locationsJson: any[], locationId: any, shapeConfig: any): void;
|
|
45
54
|
TriggerField_ChangeEvent(): any;
|
|
46
55
|
DrawField_AttachEvents(eHandlers: any): void;
|
|
47
56
|
DrawField_DetachEvents(StrokeColor: string, SelectedShapeId: string): void;
|
|
@@ -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) {
|
|
@@ -636,6 +742,9 @@ export class MapOverlayManager {
|
|
|
636
742
|
}
|
|
637
743
|
}
|
|
638
744
|
|
|
745
|
+
_this.SelectedShape_GetByShapeId = function(ShapeId) {
|
|
746
|
+
return locPolygons.find(p => p.id == ShapeId);
|
|
747
|
+
}
|
|
639
748
|
|
|
640
749
|
_this.selectShape = function(shapeId, selectedStyle, unselectedStyle) {
|
|
641
750
|
console.log('Selecting shape:', shapeId);
|