本文整理匯總了TypeScript中leaflet.circle函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript circle函數的具體用法?TypeScript circle怎麽用?TypeScript circle使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了circle函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
pointToLayer: function(feature, latlng) {
if (!feature || !feature.properties) {
return;
}
const properties = feature.properties;
if (properties.radius) {
// create a circle, with radius = properties.radius
return L.circle(latlng, properties);
} else if (
properties.icon &&
properties.icon.toUpperCase() === 'EPICENTER'
) {
// create an epicenter marker
return new EpicenterOverlay({
properties: {
latitude: latlng.lat,
longitude: latlng.lng
}
});
} else {
// display an orange circle marker
const defaultOptions = {
color: '#000',
fillColor: '#ff7800',
fillOpacity: 0.8,
opacity: 1,
radius: 8,
weight: 1
};
return L.circleMarker(latlng, defaultOptions);
}
},
示例2:
quakes.subscribe(quake => {
const coords = quake["geometry"].coordinates;
const size = quake["properties"].mag * 10000;
const circle = L.circle([coords[1], coords[0]], size)
.addTo(map);
quakeLayer.addLayer(circle);
codeLayers[quake["id"]] = quakeLayer.getLayerId(circle);
});
示例3: loadMap
loadMap() {
this.map = Leaflet
.map("map")
.setView(this.latLng, 13)
.on("click", this.onMapClicked.bind(this))
Leaflet.tileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png")
.addTo(this.map);
this.marker = Leaflet
.marker(this.latLng, { draggable: true })
.on("dragend", this.onMarkerPositionChanged.bind(this))
.addTo(this.map);
this.circle = Leaflet.circle(this.latLng, this.radius).addTo(this.map);
}