本文整理匯總了TypeScript中leaflet.control.scale方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript control.scale方法的具體用法?TypeScript control.scale怎麽用?TypeScript control.scale使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類leaflet.control
的用法示例。
在下文中一共展示了control.scale方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: basemapLayer
points.addTo(map);
var baseMaps = {
"Streets": basemapLayer("Streets"),
"Topographic": basemapLayer("Topographic")
};
var overlayMaps = {
"TAs": polygons,
"Gates": points
};
baseMaps["Streets"].addTo(map);
L.control.layers(baseMaps, overlayMaps).addTo(map);
L.control.scale().addTo(map);
polygons.bindPopup(function (feature) {
return esriLeafletUtil.template('<p>{F_Area_ID}<br>{F_label}<br>{Use_Restri}<br>More stuff here!</p>', feature.properties);
});
points.bindPopup(function ({feature}) {
return L.Util.template('<p>Gate {F_Area_ID}<br>{TA}<br><br>More stuff here!</p>', feature.properties);
});
polygons.on('mouseout', function (e) {
document.getElementById('info-pane').innerHTML = 'Hover to Inspect';
});
var oldId;
polygons.on('mouseover', function (e) {
polygons.resetStyle(oldId);
示例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;
//.........這裏部分代碼省略.........