本文整理匯總了TypeScript中leaflet.Polygon類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Polygon類的具體用法?TypeScript Polygon怎麽用?TypeScript Polygon使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Polygon類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: createMask
createMask() {
//Hide other countries with mask
L.Mask = L.Polygon.extend({
options: {
stroke: false,
color: '#1b3716',// 'white',//'rgb(152,152,152)',//'#1b3716',
fillOpacity:/* 1,*/ 0.8,
clickable: false,
outerBounds: new L.LatLngBounds([-90, -360], [90, 360])
},
initialize: function (latLngs, options) {
var outerBoundsLatLngs = [
this.options.outerBounds.getSouthWest(),
this.options.outerBounds.getNorthWest(),
this.options.outerBounds.getNorthEast(),
this.options.outerBounds.getSouthEast()
];
L.Polygon.prototype.initialize.call(this, [outerBoundsLatLngs, latLngs], options);
},
});
L.mask = function (latLngs, options) {
return new L.Mask(latLngs, options);
};
L.mask(this._mapService.ukraineMask).addTo(map);
}
示例2:
L.marker([1, 2], {
icon: L.divIcon({
className: 'my-icon-class'
})
}).setIcon(L.icon({
iconUrl: 'my-icon.png'
})).setIcon(L.divIcon({
className: 'my-div-icon'
}));
let polygon: L.Polygon;
// simple polygon
const simplePolygonLatLngs: L.LatLngExpression[] = [[37, -109.05], [41, -109.03], [41, -102.05], [37, -102.04]];
polygon = L.polygon(simplePolygonLatLngs);
polygon = new L.Polygon(simplePolygonLatLngs);
polygon.setLatLngs(simplePolygonLatLngs);
const simplePolygonLatLngs2: L.LatLng[] = polygon.getLatLngs() as L.LatLng[];
// complex polygon (polygon with holes)
const complexPolygonLatLngs: L.LatLngExpression[][] = [
[[37, -109.05], [41, -109.03], [41, -102.05], [37, -102.04]], // outer ring
[[37.29, -108.58], [40.71, -108.58], [40.71, -102.50], [37.29, -102.50]] // hole
];
polygon = L.polygon(complexPolygonLatLngs);
polygon = new L.Polygon(complexPolygonLatLngs);
polygon.setLatLngs(complexPolygonLatLngs);
const complexPolygonLatLngs2: L.LatLng[][] = polygon.getLatLngs() as L.LatLng[][];
// multi polygon
const multiPolygonLatLngs: L.LatLngExpression[][][] = [