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


TypeScript leaflet.polyline函数代码示例

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


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

示例1:

example = () => {
	L.polyline([
		L.latLng(-37.7612, 175.2756),
		L.latLng(-37.7702, 175.2796),
		L.latLng(-37.7802, 175.2750),
	]).bindLabel('Even polylines can have labels.').addTo(map);
};
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:7,代码来源:leaflet-label-tests.ts

示例2:

	  [[37.29, -108.58], [40.71, -108.58], [40.71, -102.50], [37.29, -102.50]] // hole
	],
	[ // second polygon
	  [[41, -111.03], [45, -111.04], [45, -104.05], [41, -104.05]]
	]
];
polygon = L.polygon(multiPolygonLatLngs);
polygon = new L.Polygon(multiPolygonLatLngs);
polygon.setLatLngs(multiPolygonLatLngs);
const multiPolygonLatLngs2: L.LatLng[][][] = polygon.getLatLngs() as L.LatLng[][][];

let polyline: L.Polyline;

// simple polyline
const simplePolylineLatLngs: L.LatLngExpression[] = [[45.51, -122.68], [37.77, -122.43], [34.04, -118.2]];
polyline = L.polyline(simplePolylineLatLngs);
polyline = new L.Polyline(simplePolylineLatLngs);
polyline.setLatLngs(simplePolylineLatLngs);
const simplePolylineLatLngs2: L.LatLng[] = polyline.getLatLngs() as L.LatLng[];

// multi polyline
const multiPolylineLatLngs: L.LatLngExpression[][] = [
    [[45.51, -122.68], [37.77, -122.43], [34.04, -118.2]],
    [[40.78, -73.91], [41.83, -87.62], [32.76, -96.72]]
];
polyline = L.polyline(multiPolylineLatLngs);
polyline = new L.Polyline(multiPolylineLatLngs);
polyline.setLatLngs(multiPolylineLatLngs);
const multiPolylineLatLngs2: L.LatLng[][] = polyline.getLatLngs() as L.LatLng[][];

const obj1 = {
开发者ID:Igorbek,项目名称:DefinitelyTyped,代码行数:31,代码来源:leaflet-tests.ts

示例3:

import * as L from 'leaflet';
import 'leaflet-polylinedecorator';

const osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
const osmAttrib = '&copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors';
const osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib});
const map = L.map('map', {layers: [osm], center: L.latLng(-37.7772, 175.2756), zoom: 15 });

const polyline = L.polyline([[0, 0], [1, 1]]);

L.polylineDecorator(polyline, {
    patterns: [
        // defines a pattern of 10px-wide dashes, repeated every 20px on the line
        {offset: 0, repeat: 20, symbol: L.Symbol.dash({pixelSize: 10})}
    ]
});

L.polylineDecorator(polyline, {
    patterns: [
        {
            offset: 0,
            endOffset: 10,
            repeat: 15,
            symbol: L.Symbol.dash({
                pixelSize: 12,
                pathOptions: {}
            })}
    ]
}).addTo(map);

L.polylineDecorator(polyline, {
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:31,代码来源:leaflet-polylinedecorator-tests.ts

示例4:

map.pm.enableDraw('Poly', drawOptions);
map.pm.disableDraw('Poly');
map.pm.setPathOptions(pathOptions);
map.pm.toggleRemoval(true);
let enabled: boolean = map.pm.globalEditEnabled();
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);
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:31,代码来源:leaflet.pm-tests.ts


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