MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / canvasFunctionInternal_

Method canvasFunctionInternal_

src/openlayers/overlay/Mapv.js:51–89  ·  view source on GitHub ↗
(extent, resolution, pixelRatio, size, projection)

Source from the content-addressed store, hash-verified

49 this.mapvOptions = opt_options.mapvOptions;
50
51 function canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) { // eslint-disable-line no-unused-vars
52 var mapWidth = size[0] / pixelRatio;
53 var mapHeight = size[1] / pixelRatio;
54 var width = this.map.getSize()[0];
55 var height = this.map.getSize()[1];
56 if (!this.layer) {
57 this.layer = new MapvLayer(this.map, this.dataSet, this.mapvOptions, mapWidth, mapHeight, this);
58 }
59 this.layer.pixelRatio = pixelRatio;
60 this.layer.offset = [(mapWidth - width) / 2 , (mapHeight - height) / 2 ];
61 if (!this.rotate) {
62 this.rotate = this.map.getView().getRotation();
63 } else {
64 if (this.rotate !== this.map.getView().getRotation()) {
65 this.layer.canvasLayer.resize(mapWidth, mapHeight);
66 this.rotate = this.map.getView().getRotation()
67 }
68 }
69 var canvas = this.layer.canvasLayer.canvas;
70 if (!this.layer.isEnabledTime()) {
71 this.layer.canvasLayer.resize(mapWidth, mapHeight);
72 this.layer.canvasLayer.draw();
73 }
74 if (!this.context) {
75 this.context = Util.createCanvasContext2D(mapWidth, mapHeight);
76 }
77 var canvas2 = this.context.canvas;
78 this.context.clearRect(0, 0, canvas2.width, canvas2.height);
79 canvas2.width = size[0];
80 canvas2.height = size[1];
81 canvas2.style.width = size[0] + "px";
82 canvas2.style.height = size[1] + "px";
83 this.context.drawImage(canvas, 0, 0);
84 if (this.resolution !== resolution || JSON.stringify(this.extent) !== JSON.stringify(extent)) {
85 this.resolution = resolution;
86 this.extent = extent;
87 }
88 return this.context.canvas;
89 }
90 }
91
92 /**

Callers

nothing calls this directly

Calls 5

getSizeMethod · 0.80
getViewMethod · 0.80
isEnabledTimeMethod · 0.80
resizeMethod · 0.45
drawMethod · 0.45

Tested by

no test coverage detected