MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / creatGraphicLayer

Function creatGraphicLayer

test/mapboxgl/overlay/GraphicLayerSpec.js:17–67  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15 ];
16 let testDiv, map;
17 function creatGraphicLayer() {
18 let graphics = [], graphicLayer;
19 //构建数据
20 for (let i = 0; i < coors.length; i++) {
21 let lngLat = {
22 lng: parseFloat(coors[i][0]),
23 lat: parseFloat(coors[i][1])
24 };
25 graphics.push(new Graphic(lngLat));
26 graphics[i].setId(i);
27 graphics[i].setAttributes({ name: "graphic_" + i });
28 }
29 testDiv = window.document.createElement("div");
30 testDiv.setAttribute("id", "map");
31 testDiv.style.styleFloat = "left";
32 testDiv.style.marginLeft = "8px";
33 testDiv.style.marginTop = "50px";
34 testDiv.style.width = "500px";
35 testDiv.style.height = "500px";
36 window.document.body.appendChild(testDiv);
37 map = new mapboxgl.Map({
38 container: 'map',
39 style: {
40 version: 8,
41 sources: {
42 'raster-tiles': {
43 type: 'raster',
44 tiles: [GlobeParameter.ChinaURL + '/zxyTileImage.png?z={z}&x={x}&y={y}'],
45 tileSize: 256
46 }
47 },
48 layers: [
49 {
50 id: 'simple-tiles',
51 type: 'raster',
52 source: 'raster-tiles',
53 minzoom: 0,
54 maxzoom: 22
55 }
56 ]
57 },
58 center: [13.413952, 52.531913],
59 zoom: 16.000000000000004,
60 pitch: 33.2
61 });
62 graphicLayer = new GraphicLayer("graphicLayer", {
63 graphics: graphics
64 });
65 graphicLayer.addTo(map);
66 return graphicLayer
67 }
68 beforeEach(() => {
69 originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
70 jasmine.DEFAULT_TIMEOUT_INTERVAL = 50000;

Callers 1

Calls 5

pushMethod · 0.80
createElementMethod · 0.80
setIdMethod · 0.45
setAttributesMethod · 0.45
addToMethod · 0.45

Tested by

no test coverage detected