本文整理汇总了TypeScript中leaflet.control.zoom方法的典型用法代码示例。如果您正苦于以下问题:TypeScript control.zoom方法的具体用法?TypeScript control.zoom怎么用?TypeScript control.zoom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类leaflet.control
的用法示例。
在下文中一共展示了control.zoom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: ngOnInit
ngOnInit () {
let options = {
mapId: "map",
lat: "51.505",
lng: "-0.09",
zoom: 12
}
let map = L.map(options.mapId, {
center: new L.LatLng(options.lat, options.lng),
zoom: options.zoom,
zoomControl: false
});
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
var zoomControl = L.control.zoom({
position: 'topright'
});
map.addControl(zoomControl);
this.map = map;
this.addDrawControl();
return map;
}
示例2: postLink
link: function postLink(scope, element) {
L.Icon.Default.imagePath = config.appSubUrl + "/public/vendor/leaflet/dist/images";
var baselayers = {};
var overlays = {};
var layerControl = L.control.layers(baselayers, overlays, {position: 'topleft'});
var zoomControl = L.control.zoom({position: 'topright'});
var scaleControl = L.control.scale({position: 'bottomleft'});
var esri = L.tileLayer(
'http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}'
);
var initialZoom = 6;
var initialPosition = new L.LatLng(31.5635497, -91.1403352);
var map = L.map(element[0], {
zoomControl: false,
attributionControl: false,
inertia: false,
keyboard: true,
dragging: true,
scrollWheelZoom: true,
zoomAnimation: true,
layers: [esri] // only add one!
}).setView(initialPosition, initialZoom);
scope.$on("zoom", function (event, args) {
console.log("picked up the event");
map.setView(initialPosition, args.zoomlevel,
{
"animate": true
}
);
});
var markerLayer = MapSrv.getMarkerLayer();
markerLayer.success(processMarkerLayer);
var baseLayers = MapSrv.getBaseLayers();
baseLayers.success(processBaseLayers);
var remoteLayers = MapSrv.getRemoteLayers();
remoteLayers.success(processRemoteLayers);
var layers = MapSrv.getLayers();
layers.success(processLayers);
zoomControl.addTo(map);
scaleControl.addTo(map);
layerControl.addTo(map);
function processMarkerLayer(response) {
var markerLayerHandlers = {
onEachFeature: markerLayerOnEachFeatureFunction
};
var layer = L.geoJson(response, markerLayerHandlers);
layer.addTo(map);
}
function processBaseLayers (response) {
for (var i = 0; i < response.length; i++) {
var name = response[i].name;
var url = response[i].url;
var attribution = response[i].attribution;
var subdomains = response[i].subdomains;
var baselayer = L.tileLayer(
url,
{
attribution: attribution,
subdomains: subdomains
}
);
layerControl.addBaseLayer(baselayer, name);
};
}
function processRemoteLayers (response) {
for (var i = 0; i < response.length; i++) {
var name = response[i].name;
var url = response[i].url;
var handler_factory_args = {
style: {
radius: 8,
fillColor: "#" + response[i].color,
color: "#000",
weight: 1,
opacity: 1,
fillOpacity: 0.8
}
};
var handler_factories = {
style: defaultStyleFactory,
pointToLayer: circleMarkerPointToLayerFactory,
onEachFeature: simplePopupOnEachFeatureFactory
};
process_geojson(url, name, handler_factory_args, handler_factories);
}
}
function processLayers(response) {
for (var i = 0; i < response.length; i++) {
var name = response[i].display_name;
var url = "http://129.114.111.79/media/" + "geojson/" + response[i].file_name;
//var url = "http://localhost:8000/media/" + "geojson/" + response[i].file_name;
//.........这里部分代码省略.........