本文整理匯總了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;
//.........這裏部分代碼省略.........