当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript leaflet.layerGroup函数代码示例

本文整理汇总了TypeScript中leaflet.layerGroup函数的典型用法代码示例。如果您正苦于以下问题:TypeScript layerGroup函数的具体用法?TypeScript layerGroup怎么用?TypeScript layerGroup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了layerGroup函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: initMap

 initMap() {
   this.map = L.map('map', {
     center: [this.coords[0], this.coords[1]],
     zoom: 8,
   });
   let basemap = L.tileLayer('https://api.mapbox.com/styles/v1/nathanhnew/cj62p1p9l3nyx2qp07zm12yh5/tiles/256/{z}/{x}/{y}?access_token=pk.eyJ1IjoibmF0aGFuaG5ldyIsImEiOiJjajYxZXJ2NHowdHk1MnFvZnFvcjE2aTZ3In0.uyW_Te8pYugmfTiKuVHvOA', {
     attribution: 'Imagery © Mapbox, Map Data © OpenStreetMap |'
   });
   var radarWMS = L.tileLayer.wms("https://nowcoast.noaa.gov/arcgis/services/nowcoast/radar_meteo_imagery_nexrad_time/MapServer/WMSServer", {
     layers: '1',
     format: 'image/png',
     transparent: true,
     opacity: 0.8,
     attribution: 'Radar data provided by National Weather Service via nowCOAST'
   });
   var warningsWMS = L.tileLayer.wms("https://nowcoast.noaa.gov/arcgis/services/nowcoast/wwa_meteoceanhydro_shortduration_hazards_warnings_time/MapServer/WMSServer", {
     layers: '1',
     format: 'image/png',
     transparent: true,
     opacity: 0.8,
     attribution: 'nowCOAST'
   });
   let overlay = L.tileLayer('https://api.mapbox.com/styles/v1/nathanhnew/cj62phsw73npj2rphndjzt3i2/tiles/256/{z}/{x}/{y}?access_token=pk.eyJ1IjoibmF0aGFuaG5ldyIsImEiOiJjajYxZXJ2NHowdHk1MnFvZnFvcjE2aTZ3In0.uyW_Te8pYugmfTiKuVHvOA');
   let layers = L.layerGroup([basemap,radarWMS,warningsWMS,overlay]).addTo(this.map)
   this.initialized = true;
 }
开发者ID:nathanhnew,项目名称:nathansweather-legacy,代码行数:26,代码来源:leaflet-map.component.ts

示例2:

L.Util.cancelAnimFrame(1);
L.Util.emptyImageUrl;

interface MyProperties {
	testProperty: string;
}

(L.polygon(simplePolygonLatLngs) as L.Polygon<MyProperties>).feature.properties.testProperty = "test";

(L.marker([1, 2], {
	icon: L.icon({
		iconUrl: 'my-icon.png'
	})
}) as L.Marker<MyProperties>).feature.properties.testProperty = "test";

let lg = L.layerGroup();
lg = L.layerGroup([new L.Layer(), new L.Layer()]);
lg = L.layerGroup([new L.Layer(), new L.Layer()], {
	pane: 'overlayPane',
	attribution: 'test'
});

lg = new L.LayerGroup();
lg = new L.LayerGroup([new L.Layer(), new L.Layer()]);
lg = new L.LayerGroup([new L.Layer(), new L.Layer()], {
	pane: 'overlayPane',
	attribution: 'test'
});

// adapted from GridLayer documentation
const CanvasLayer = L.GridLayer.extend({
开发者ID:Igorbek,项目名称:DefinitelyTyped,代码行数:31,代码来源:leaflet-tests.ts

示例3:

import 'leaflet-editable';

class MarkerClass { }
class MarkerEditorClass { }
class MiddleMarkerClass { }
class PolygonClass { }
class PolygonEditorClass { }
class PolylineClass { }
class PolylineEditorClass { }
class VertexMarkerClass { }

const map: L.Map = L.map('div', {
    editable: true,
    editOptions: {
        drawingCSSClass: 'css-class',
        editLayer: L.layerGroup(),
        featuresLayer: L.layerGroup<L.Marker|L.Polyline|L.Polygon>(),
        lineGuideOptions: {},
        markerClass: MarkerClass,
        markerEditorClass: MarkerEditorClass,
        middleMarkerClass: MiddleMarkerClass,
        polygonClass: PolygonClass,
        polygonEditorClass: PolygonEditorClass,
        polylineClass: PolylineClass,
        polylineEditorClass: PolylineEditorClass,
        skipMiddleMarkers: true,
        vertexMarkerClass: VertexMarkerClass
    }
});

const currentPoly: L.Polygon|L.Polyline| L.Marker = map.editTools.currentPolygon;
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:31,代码来源:leaflet-editable-tests.ts

示例4:

let map = L.map('foo');

markerClusterGroup = markerClusterGroup.addTo(map);
map = map
    .addLayer(markerClusterGroup)
    .removeLayer(markerClusterGroup);

const latLng: L.LatLng = L.latLng(10, 10);

const layer: L.Layer = L.marker(latLng);
const layers: L.Layer[] = [layer];

let marker: L.Marker = L.marker(latLng);
let markers: L.Marker[] = [marker];

const layerGroup: L.LayerGroup = L.layerGroup(layers);

marker = markerClusterGroup.getVisibleParent(marker);

markerClusterGroup = markerClusterGroup
    // Layers
    .addLayer(layer)
    .removeLayer(layer)
    .addLayers(layers)
    .removeLayers(layers)
    .clearLayers()
    // RefreshClusters
    .refreshClusters()
    .refreshClusters(layerGroup)
    .refreshClusters(marker)
    .refreshClusters(markers)
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:31,代码来源:leaflet.markercluster-tests.ts

示例5:

map.pm.toggleGlobalEditMode(editOptions);

const shapes: string[] = map.pm.Draw.getShapes();

const polygon: L.Polygon = L.polygon([ [ 1.0, 1.0], [ 2.0, 1.0], [ 1.0, 2.0] ]);
polygon.pm.enable(editOptions);
polygon.pm.disable();
polygon.pm.toggleEdit(editOptions);
enabled = polygon.pm.enabled();

const polyline: L.Polyline = L.polyline([ [ 1.0, 1.0], [ 2.0, 1.0], [ 1.0, 2.0] ]);
polyline.pm.enable(editOptions);
polyline.pm.disable();
polyline.pm.toggleEdit(editOptions);
enabled = polyline.pm.enabled();

const marker: L.Marker = L.marker([ 3.0, 3.0 ]);
marker.pm.enable(editOptions);
marker.pm.disable();
marker.pm.toggleEdit(editOptions);
enabled = marker.pm.enabled();

const layerGroup: L.LayerGroup = L.layerGroup([ polygon, polyline, marker ]);
layerGroup.pm.enable(editOptions);
layerGroup.pm.disable();
layerGroup.pm.toggleEdit(editOptions);
enabled = layerGroup.pm.enabled();
const layers: L.Layer[] = layerGroup.pm.findLayers();
const dragging: boolean = layerGroup.pm.dragging();
const options: L.PM.EditOptions = layerGroup.pm.getOptions();
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:30,代码来源:leaflet.pm-tests.ts

示例6: MainController

    .controller("com.app.earthquake.mainController", function MainController($scope) {

        const socket = Rx["DOM"].fromWebSocket("ws://127.0.0.1:8080");

        this.tweetList = [];
        this.earthquakesList = [];

        const quakesTable = document.getElementById("quakes_info");
        const map = L.map("map").setView([33.858631, -118.279602], 7);
        const quakeLayer = L.layerGroup([]).addTo(map);
        L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png').addTo(map);
        const codeLayers = {};

        const getRowFromEvent = event => {

            return Rx.Observable
                .fromEvent(quakesTable, event)
                .filter(event => {

                    const el = event["target"];
                    return el.tagName === "TD" && el.parentNode.id.length;
                })
                .pluck("target")
                .pluck("parentNode")
                .distinctUntilChanged();
        };

        const quakes = Rx.Observable.interval(5000)
            .flatMap(() => {

                return Rx["DOM"].jsonpRequest({
                    url: "http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojsonp",
                    jsonpCallback: "eqfeed_callback"
                });
            })
            .flatMap(result => Rx.Observable.from(result["response"].features))
            .distinct(quake => quake["properties"].code)
            .share();

        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);
        });

        quakes.pluck("properties")
            .subscribe(quake => $scope.$apply(() => this.earthquakesList.push(quake)));

        getRowFromEvent("mouseover")
            .pairwise()
            .subscribe(rows => {

                const prevCircle = quakeLayer.getLayer(codeLayers[rows[0]["id"]]);
                const currCircle = quakeLayer.getLayer(codeLayers[rows[1]["id"]]);
                prevCircle.setStyle({ color: "#59a27a" });
                currCircle.setStyle({ color: "#b01055" });
            });

        getRowFromEvent("click")
            .subscribe(row => {

                const circle = quakeLayer.getLayer(codeLayers[row["id"]]);
                map.panTo(circle.getLatLng());
            });

        quakes
            .bufferWithCount(100)
            .map(quakeList => {

                return quakeList.map(quake => {

                    return {
                        id: quake["properties"].net + quake["properties"].code,
                        lat: quake["geometry"].coordinates[1],
                        lng: quake["geometry"].coordinates[0],
                        mag: quake["properties"].mag
                    };
                });
            })
            .subscribe(quakes => socket.onNext(JSON.stringify({ quakes })));

        socket.map(message => JSON.parse(message.data))
            .subscribe(tweet => {

                $scope.$apply(() => {

                    this.tweetList.push(tweet);
                    this.tweetList = E.from(this.tweetList)
                        .distinct(i => i["created_at"]).toArray();
                });
            });
    });
开发者ID:vasiliyutkin,项目名称:earthshakes,代码行数:98,代码来源:index.ts


注:本文中的leaflet.layerGroup函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。