@sswroom/sswr 1.6.18 → 1.6.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Changelog +9 -0
- package/cesium.js +2 -1
- package/data.js +36 -6
- package/domtoimage/fontFaces.js +56 -0
- package/domtoimage/images.js +47 -0
- package/domtoimage/index.js +328 -0
- package/domtoimage/inliner.js +65 -0
- package/domtoimage/util.js +248 -0
- package/dummy/Cesium.d.ts +1 -0
- package/dummy/Cesium.js +1 -0
- package/exporter/XLSXExporter.js +578 -524
- package/leaflet/EasyPrint.js +731 -0
- package/package.json +1 -1
- package/web.d.ts +1 -0
- package/web.js +17 -0
|
@@ -0,0 +1,731 @@
|
|
|
1
|
+
import * as data from "../data.js";
|
|
2
|
+
import * as math from "../math.js";
|
|
3
|
+
import * as web from "../web.js";
|
|
4
|
+
import * as domtoimage from "../domtoimage/index.js";
|
|
5
|
+
|
|
6
|
+
export class EasyPrint
|
|
7
|
+
{
|
|
8
|
+
/**
|
|
9
|
+
* @param {L.map} map
|
|
10
|
+
* @param {{title?: string, position?: string, sizeModes?: string[], filename?: string, exportOnly?: boolean, hidden?: boolean, tileLayer?: L.tileLayer|L.tileLayer[],tileWait?: number, hideControlContainer?: boolean, hideClasses?: string[], hideIds?: string[], pageBorderTopHTML?: string, pageBorderBottomHTML?: string, pageBorderHeight?: number, overlayHTML?: string, spinnerBgCOlor?: string, customSpinnerClass?: string}} options
|
|
11
|
+
*/
|
|
12
|
+
constructor(map, options)
|
|
13
|
+
{
|
|
14
|
+
this._a4PageSize = {
|
|
15
|
+
height: 715,
|
|
16
|
+
width: 1045
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
this._a4PaperSize = {
|
|
20
|
+
width: 1123.660266,
|
|
21
|
+
height: 794.547794
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
this._a3PaperSize = {
|
|
25
|
+
width: 1589.095588,
|
|
26
|
+
height: 1123.660266
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
this._pageMargin = {
|
|
30
|
+
x: 40,
|
|
31
|
+
y: 40
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
this.blankDiv = null;
|
|
35
|
+
this._map = map;
|
|
36
|
+
this.options = data.mergeOptions(options, {
|
|
37
|
+
title: 'Print map',
|
|
38
|
+
position: 'topleft',
|
|
39
|
+
sizeModes: ['Current','A4Landscape','A4Portrait','A3Landscape','A3Portrait'],
|
|
40
|
+
sizeModeObjs: [],
|
|
41
|
+
filename: 'map',
|
|
42
|
+
exportOnly: false,
|
|
43
|
+
hidden: false,
|
|
44
|
+
tileLayer: null, //Layer[] | Layer
|
|
45
|
+
tileWait: 500,
|
|
46
|
+
hideControlContainer: true,
|
|
47
|
+
hideClasses: [],
|
|
48
|
+
hideIds: [],
|
|
49
|
+
onclick: null,
|
|
50
|
+
pageBorderTopHTML: null,
|
|
51
|
+
pageBorderBottomHTML: null,
|
|
52
|
+
pageBorderHeight: 0,
|
|
53
|
+
overlayHTML: null,
|
|
54
|
+
customWindowTitle: window.document.title,
|
|
55
|
+
spinnerBgCOlor: '#0DC5C1',
|
|
56
|
+
customSpinnerClass: 'epLoader',
|
|
57
|
+
defaultSizeTitles: {
|
|
58
|
+
Current: 'Current Size',
|
|
59
|
+
A4Landscape: 'A4 Landscape',
|
|
60
|
+
A4Portrait: 'A4 Portrait',
|
|
61
|
+
A3Landscape: 'A3 Landscape',
|
|
62
|
+
A3Portrait: 'A3 Portrait'
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
this.mapContainer = map.getContainer();
|
|
66
|
+
this.originalState = {
|
|
67
|
+
mapWidth: this.mapContainer.style.width,
|
|
68
|
+
widthWasAuto: false,
|
|
69
|
+
widthWasPercentage: false,
|
|
70
|
+
mapHeight: this.mapContainer.style.height,
|
|
71
|
+
zoom: this._map.getZoom(),
|
|
72
|
+
center: this._map.getCenter()
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
_sizeModeObjs()
|
|
77
|
+
{
|
|
78
|
+
this.options.sizeModeObjs = this.options.sizeModes.map(function (sizeMode) {
|
|
79
|
+
if (sizeMode === 'Current') {
|
|
80
|
+
return {
|
|
81
|
+
name: this.options.defaultSizeTitles.Current,
|
|
82
|
+
className: 'CurrentSize'
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (sizeMode === 'A4Landscape') {
|
|
86
|
+
return {
|
|
87
|
+
height: this._a4PageSize.height,
|
|
88
|
+
width: this._a4PageSize.width,
|
|
89
|
+
name: this.options.defaultSizeTitles.A4Landscape,
|
|
90
|
+
className: 'A4Landscape page',
|
|
91
|
+
paperSize: 'A4'
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (sizeMode === 'A4Portrait') {
|
|
95
|
+
return {
|
|
96
|
+
height: this._a4PageSize.width,
|
|
97
|
+
width: this._a4PageSize.height,
|
|
98
|
+
name: this.options.defaultSizeTitles.A4Portrait,
|
|
99
|
+
className: 'A4Portrait page',
|
|
100
|
+
paperSize: 'A4'
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
if (sizeMode === 'A3Landscape') {
|
|
104
|
+
return {
|
|
105
|
+
height: this._a3PaperSize.height - this._pageMargin.y * 2,
|
|
106
|
+
width: this._a3PaperSize.width - this._pageMargin.x * 2,
|
|
107
|
+
name: this.options.defaultSizeTitles.A3Landscape,
|
|
108
|
+
className: 'A3Landscape page',
|
|
109
|
+
paperSize: 'A3'
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (sizeMode === 'A3Portrait') {
|
|
113
|
+
return {
|
|
114
|
+
height: this._a3PaperSize.width - this._pageMargin.x * 2,
|
|
115
|
+
width: this._a3PaperSize.height - this._pageMargin.y * 2,
|
|
116
|
+
name: this.options.defaultSizeTitles.A3Portrait,
|
|
117
|
+
className: 'A3Portrait page',
|
|
118
|
+
paperSize: 'A3'
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
return sizeMode;
|
|
122
|
+
}, this);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* @param {string|{ target: { className: any; }; }} event
|
|
126
|
+
* @param {string} filename
|
|
127
|
+
*/
|
|
128
|
+
printMap(event, filename) {
|
|
129
|
+
this.resolve = null;
|
|
130
|
+
this.reject = null;
|
|
131
|
+
if (filename) {
|
|
132
|
+
this.options.filename = filename
|
|
133
|
+
}
|
|
134
|
+
if (!this.options.exportOnly) {
|
|
135
|
+
this._page = window.open("", "_blank", 'toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,left=10, top=10, width=200, height=250, visible=none');
|
|
136
|
+
this._page.document.write(this._createSpinner(this.options.customWindowTitle, this.options.customSpinnerClass, this.options.spinnerBgCOlor));
|
|
137
|
+
}
|
|
138
|
+
this._sizeModeObjs();
|
|
139
|
+
this.originalState = {
|
|
140
|
+
mapWidth: this.mapContainer.style.width,
|
|
141
|
+
widthWasAuto: false,
|
|
142
|
+
widthWasPercentage: false,
|
|
143
|
+
mapHeight: this.mapContainer.style.height,
|
|
144
|
+
zoom: this._map.getZoom(),
|
|
145
|
+
center: this._map.getCenter()
|
|
146
|
+
};
|
|
147
|
+
if (this.originalState.mapWidth === 'auto') {
|
|
148
|
+
this.originalState.mapWidth = this._map.getSize().x + 'px'
|
|
149
|
+
this.originalState.widthWasAuto = true
|
|
150
|
+
} else if (this.originalState.mapWidth.includes('%')) {
|
|
151
|
+
this.originalState.percentageWidth = this.originalState.mapWidth
|
|
152
|
+
this.originalState.widthWasPercentage = true
|
|
153
|
+
this.originalState.mapWidth = this._map.getSize().x + 'px'
|
|
154
|
+
}
|
|
155
|
+
this._map.fire("easyPrint-start", { event: event });
|
|
156
|
+
if (!this.options.hidden) {
|
|
157
|
+
this._togglePageSizeButtons({type: null});
|
|
158
|
+
}
|
|
159
|
+
if (this.options.hideControlContainer) {
|
|
160
|
+
this._toggleControls();
|
|
161
|
+
}
|
|
162
|
+
if (this.options.hideClasses) {
|
|
163
|
+
this._toggleClasses(this.options.hideClasses);
|
|
164
|
+
}
|
|
165
|
+
if (this.options.hideIds) {
|
|
166
|
+
this._toggleIds(this.options.hideIds);
|
|
167
|
+
}
|
|
168
|
+
let sizeMode = typeof event !== 'string' ? event.target.className : event;
|
|
169
|
+
if (sizeMode === 'CurrentSize') {
|
|
170
|
+
return this._printOpertion(sizeMode);
|
|
171
|
+
}
|
|
172
|
+
this.outerContainer = this._createOuterContainer(this.mapContainer)
|
|
173
|
+
if (this.originalState.widthWasAuto) {
|
|
174
|
+
this.outerContainer.style.width = this.originalState.mapWidth
|
|
175
|
+
}
|
|
176
|
+
this._createImagePlaceholder(sizeMode)
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* @param {math.Coord2D} size
|
|
181
|
+
* @returns {Promise<Blob>}
|
|
182
|
+
*/
|
|
183
|
+
toPNG(size) {
|
|
184
|
+
this.resolve = null;
|
|
185
|
+
this.reject = null;
|
|
186
|
+
this._sizeModeObjs();
|
|
187
|
+
this.originalState = {
|
|
188
|
+
mapWidth: this.mapContainer.style.width,
|
|
189
|
+
widthWasAuto: false,
|
|
190
|
+
widthWasPercentage: false,
|
|
191
|
+
mapHeight: this.mapContainer.style.height,
|
|
192
|
+
zoom: this._map.getZoom(),
|
|
193
|
+
center: this._map.getCenter()
|
|
194
|
+
};
|
|
195
|
+
if (this.originalState.mapWidth === 'auto') {
|
|
196
|
+
this.originalState.mapWidth = this._map.getSize().x + 'px'
|
|
197
|
+
this.originalState.widthWasAuto = true
|
|
198
|
+
} else if (this.originalState.mapWidth.includes('%')) {
|
|
199
|
+
this.originalState.percentageWidth = this.originalState.mapWidth
|
|
200
|
+
this.originalState.widthWasPercentage = true
|
|
201
|
+
this.originalState.mapWidth = this._map.getSize().x + 'px'
|
|
202
|
+
}
|
|
203
|
+
let plugin = this;
|
|
204
|
+
return new Promise((resolve, reject) => {
|
|
205
|
+
plugin.resolve = resolve;
|
|
206
|
+
plugin.reject = reject;
|
|
207
|
+
if (!plugin.options.hidden) {
|
|
208
|
+
plugin._togglePageSizeButtons({type: null});
|
|
209
|
+
}
|
|
210
|
+
if (plugin.options.hideControlContainer) {
|
|
211
|
+
plugin._toggleControls();
|
|
212
|
+
}
|
|
213
|
+
if (plugin.options.hideClasses) {
|
|
214
|
+
plugin._toggleClasses(plugin.options.hideClasses);
|
|
215
|
+
}
|
|
216
|
+
if (plugin.options.hideIds) {
|
|
217
|
+
plugin._toggleIds(plugin.options.hideIds);
|
|
218
|
+
}
|
|
219
|
+
if (size == null) {
|
|
220
|
+
return plugin._printOpertion('CurrentSize');
|
|
221
|
+
}
|
|
222
|
+
plugin.outerContainer = plugin._createOuterContainer(plugin.mapContainer)
|
|
223
|
+
if (plugin.originalState.widthWasAuto) {
|
|
224
|
+
plugin.outerContainer.style.width = plugin.originalState.mapWidth
|
|
225
|
+
}
|
|
226
|
+
plugin._createImagePlaceholder(size)
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* @param {string} name
|
|
232
|
+
* @param {any} value
|
|
233
|
+
*/
|
|
234
|
+
updateOptions(name, value) {
|
|
235
|
+
this.options[name] = value;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* @param {string|math.Coord2D} sizeMode
|
|
240
|
+
*/
|
|
241
|
+
async _createImagePlaceholder(sizeMode) {
|
|
242
|
+
let plugin = this;
|
|
243
|
+
let dataUrl = await domtoimage.toPng(this.mapContainer, {
|
|
244
|
+
width: parseInt(this.originalState.mapWidth.replace('px')),
|
|
245
|
+
height: parseInt(this.originalState.mapHeight.replace('px')),
|
|
246
|
+
imagePlaceholder: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH6AMECQMVtyBSbwAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAALSURBVAjXY2AAAgAABQAB4iYFmwAAAABJRU5ErkJggg=="
|
|
247
|
+
});
|
|
248
|
+
try
|
|
249
|
+
{
|
|
250
|
+
plugin.blankDiv = document.createElement("div");
|
|
251
|
+
let blankDiv = plugin.blankDiv;
|
|
252
|
+
plugin.outerContainer.parentElement.insertBefore(blankDiv, plugin.outerContainer);
|
|
253
|
+
blankDiv.className = 'epHolder';
|
|
254
|
+
blankDiv.style.backgroundImage = 'url("' + dataUrl + '")';
|
|
255
|
+
blankDiv.style.position = 'absolute';
|
|
256
|
+
blankDiv.style.zIndex = 1011;
|
|
257
|
+
blankDiv.style.display = 'initial';
|
|
258
|
+
blankDiv.style.width = plugin.originalState.mapWidth;
|
|
259
|
+
blankDiv.style.height = plugin.originalState.mapHeight;
|
|
260
|
+
plugin._resizeAndPrintMap(sizeMode);
|
|
261
|
+
}
|
|
262
|
+
catch (error) {
|
|
263
|
+
console.error('oops, something went wrong!', error);
|
|
264
|
+
let dataUrl = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH6AMECQMVtyBSbwAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAALSURBVAjXY2AAAgAABQAB4iYFmwAAAABJRU5ErkJggg==";
|
|
265
|
+
plugin.blankDiv = document.createElement("div");
|
|
266
|
+
let blankDiv = plugin.blankDiv;
|
|
267
|
+
plugin.outerContainer.parentElement.insertBefore(blankDiv, plugin.outerContainer);
|
|
268
|
+
blankDiv.className = 'epHolder';
|
|
269
|
+
blankDiv.style.backgroundImage = 'url("' + dataUrl + '")';
|
|
270
|
+
blankDiv.style.position = 'absolute';
|
|
271
|
+
blankDiv.style.zIndex = 1011;
|
|
272
|
+
blankDiv.style.display = 'initial';
|
|
273
|
+
blankDiv.style.width = plugin.originalState.mapWidth;
|
|
274
|
+
blankDiv.style.height = plugin.originalState.mapHeight;
|
|
275
|
+
plugin._resizeAndPrintMap(sizeMode);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* @param {string|math.Coord2D} sizeMode
|
|
281
|
+
*/
|
|
282
|
+
_resizeAndPrintMap(sizeMode) {
|
|
283
|
+
this.outerContainer.style.opacity = 0;
|
|
284
|
+
let pageSize;
|
|
285
|
+
if (typeof sizeMode == "string")
|
|
286
|
+
{
|
|
287
|
+
pageSize = this.options.sizeModeObjs.filter(function (item) {
|
|
288
|
+
return item.className.indexOf(sizeMode) > -1;
|
|
289
|
+
});
|
|
290
|
+
pageSize = pageSize[0];
|
|
291
|
+
}
|
|
292
|
+
else
|
|
293
|
+
{
|
|
294
|
+
pageSize = {width: sizeMode.x, height: sizeMode.y, className: "Custom", name: "Custom"};
|
|
295
|
+
}
|
|
296
|
+
if (pageSize == null)
|
|
297
|
+
{
|
|
298
|
+
console.log(this.options.sizeModeObjs, sizeMode);
|
|
299
|
+
throw new Error("sizeMode not found");
|
|
300
|
+
}
|
|
301
|
+
let pageBorderHeight = 0;
|
|
302
|
+
if (this.options.pageBorderHeight)
|
|
303
|
+
pageBorderHeight = this.options.pageBorderHeight + 4;
|
|
304
|
+
this.mapContainer.style.width = pageSize.width + 'px';
|
|
305
|
+
this.mapContainer.style.height = (pageSize.height - pageBorderHeight) + 'px';
|
|
306
|
+
if (pageSize.width < pageSize.height) {
|
|
307
|
+
this.orientation = 'portrait';
|
|
308
|
+
} else {
|
|
309
|
+
this.orientation = 'landscape';
|
|
310
|
+
}
|
|
311
|
+
this.paperSize = pageSize.paperSize;
|
|
312
|
+
this._map.setView(this.originalState.center);
|
|
313
|
+
this._map.setZoom(this.originalState.zoom);
|
|
314
|
+
this._map.invalidateSize();
|
|
315
|
+
if (this.options.tileLayer) {
|
|
316
|
+
this._pausePrint(sizeMode)
|
|
317
|
+
} else {
|
|
318
|
+
this._printOpertion(sizeMode)
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* @param {string|math.Coord2D} sizeMode
|
|
324
|
+
*/
|
|
325
|
+
_pausePrint(sizeMode) {
|
|
326
|
+
let plugin = this;
|
|
327
|
+
let loadingTest = setInterval(function () {
|
|
328
|
+
let loading = false;
|
|
329
|
+
let tileLayer = plugin.options.tileLayer;
|
|
330
|
+
if (tileLayer.constructor === Array)
|
|
331
|
+
{
|
|
332
|
+
let i = 0;
|
|
333
|
+
let j = tileLayer.length;
|
|
334
|
+
while (i < j)
|
|
335
|
+
{
|
|
336
|
+
if (tileLayer[i].isLoading())
|
|
337
|
+
{
|
|
338
|
+
loading = true;
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
341
|
+
i++;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
else
|
|
345
|
+
{
|
|
346
|
+
loading = tileLayer.isLoading();
|
|
347
|
+
}
|
|
348
|
+
if (!loading)
|
|
349
|
+
{
|
|
350
|
+
clearInterval(loadingTest);
|
|
351
|
+
plugin._printOpertion(sizeMode)
|
|
352
|
+
}
|
|
353
|
+
}, plugin.options.tileWait);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* @param {string|math.Coord2D} sizemode
|
|
358
|
+
*/
|
|
359
|
+
async _printOpertion(sizemode) {
|
|
360
|
+
let plugin = this;
|
|
361
|
+
let widthForExport = this.mapContainer.style.width
|
|
362
|
+
if (this.originalState.widthWasAuto && sizemode === 'CurrentSize' || this.originalState.widthWasPercentage && sizemode === 'CurrentSize') {
|
|
363
|
+
widthForExport = this.originalState.mapWidth
|
|
364
|
+
}
|
|
365
|
+
let dataUrl = await domtoimage.toPng(plugin.mapContainer, {
|
|
366
|
+
width: parseInt(widthForExport),
|
|
367
|
+
height: parseInt(plugin.mapContainer.style.height.replace('px')),
|
|
368
|
+
imagePlaceholder: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH6AMECQMVtyBSbwAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAALSURBVAjXY2AAAgAABQAB4iYFmwAAAABJRU5ErkJggg=="
|
|
369
|
+
});
|
|
370
|
+
try
|
|
371
|
+
{
|
|
372
|
+
let blob = plugin._dataURItoBlob(dataUrl);
|
|
373
|
+
if (plugin.resolve) {
|
|
374
|
+
plugin.resolve(blob);
|
|
375
|
+
} else if (plugin.options.exportOnly) {
|
|
376
|
+
web.openData(blob, blob.type, plugin.options.filename + '.png');
|
|
377
|
+
} else {
|
|
378
|
+
plugin._sendToBrowserPrint(dataUrl, plugin.orientation, plugin.paperSize);
|
|
379
|
+
}
|
|
380
|
+
plugin._toggleControls(true);
|
|
381
|
+
plugin._toggleClasses(plugin.options.hideClasses, true);
|
|
382
|
+
plugin._toggleIds(plugin.options.hideIds, true);
|
|
383
|
+
|
|
384
|
+
if (plugin.outerContainer) {
|
|
385
|
+
if (plugin.originalState.widthWasAuto) {
|
|
386
|
+
plugin.mapContainer.style.width = 'auto'
|
|
387
|
+
} else if (plugin.originalState.widthWasPercentage) {
|
|
388
|
+
plugin.mapContainer.style.width = plugin.originalState.percentageWidth
|
|
389
|
+
}
|
|
390
|
+
else {
|
|
391
|
+
plugin.mapContainer.style.width = plugin.originalState.mapWidth;
|
|
392
|
+
}
|
|
393
|
+
plugin.mapContainer.style.height = plugin.originalState.mapHeight;
|
|
394
|
+
plugin._removeOuterContainer(plugin.mapContainer, plugin.outerContainer, plugin.blankDiv)
|
|
395
|
+
plugin._map.invalidateSize();
|
|
396
|
+
plugin._map.setView(plugin.originalState.center);
|
|
397
|
+
plugin._map.setZoom(plugin.originalState.zoom);
|
|
398
|
+
}
|
|
399
|
+
plugin._map.fire("easyPrint-finished");
|
|
400
|
+
}
|
|
401
|
+
catch (error) {
|
|
402
|
+
console.error('Print operation failed', error);
|
|
403
|
+
if (plugin.reject)
|
|
404
|
+
{
|
|
405
|
+
plugin.reject("Failed");
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
plugin._page.document.close();
|
|
409
|
+
plugin._toggleControls(true);
|
|
410
|
+
plugin._toggleClasses(plugin.options.hideClasses, true);
|
|
411
|
+
plugin._toggleIds(plugin.options.hideIds, true);
|
|
412
|
+
|
|
413
|
+
if (plugin.outerContainer) {
|
|
414
|
+
if (plugin.originalState.widthWasAuto) {
|
|
415
|
+
plugin.mapContainer.style.width = 'auto'
|
|
416
|
+
} else if (plugin.originalState.widthWasPercentage) {
|
|
417
|
+
plugin.mapContainer.style.width = plugin.originalState.percentageWidth
|
|
418
|
+
}
|
|
419
|
+
else {
|
|
420
|
+
plugin.mapContainer.style.width = plugin.originalState.mapWidth;
|
|
421
|
+
}
|
|
422
|
+
plugin.mapContainer.style.height = plugin.originalState.mapHeight;
|
|
423
|
+
plugin._removeOuterContainer(plugin.mapContainer, plugin.outerContainer, plugin.blankDiv)
|
|
424
|
+
plugin._map.invalidateSize();
|
|
425
|
+
plugin._map.setView(plugin.originalState.center);
|
|
426
|
+
plugin._map.setZoom(plugin.originalState.zoom);
|
|
427
|
+
}
|
|
428
|
+
plugin._map.fire("easyPrint-finished");
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* @param {string} img
|
|
434
|
+
* @param {string} orientation
|
|
435
|
+
* @param {any} paperSize
|
|
436
|
+
*/
|
|
437
|
+
_sendToBrowserPrint(img, orientation, paperSize) {
|
|
438
|
+
this._page.resizeTo(600, 800);
|
|
439
|
+
let pageContent = this._createNewWindow(img, orientation, this, paperSize)
|
|
440
|
+
this._page.document.body.innerHTML = ''
|
|
441
|
+
this._page.document.write(pageContent);
|
|
442
|
+
this._page.document.close();
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* @param {string} title
|
|
447
|
+
* @param {string} spinnerClass
|
|
448
|
+
* @param {string} spinnerColor
|
|
449
|
+
*/
|
|
450
|
+
_createSpinner(title, spinnerClass, spinnerColor) {
|
|
451
|
+
return `<html><head><title>`+ title + `</title></head><body><style>
|
|
452
|
+
body{
|
|
453
|
+
background: ` + spinnerColor + `;
|
|
454
|
+
}
|
|
455
|
+
.epLoader,
|
|
456
|
+
.epLoader:before,
|
|
457
|
+
.epLoader:after {
|
|
458
|
+
border-radius: 50%;
|
|
459
|
+
}
|
|
460
|
+
.epLoader {
|
|
461
|
+
color: #ffffff;
|
|
462
|
+
font-size: 11px;
|
|
463
|
+
text-indent: -99999em;
|
|
464
|
+
margin: 55px auto;
|
|
465
|
+
position: relative;
|
|
466
|
+
width: 10em;
|
|
467
|
+
height: 10em;
|
|
468
|
+
box-shadow: inset 0 0 0 1em;
|
|
469
|
+
-webkit-transform: translateZ(0);
|
|
470
|
+
-ms-transform: translateZ(0);
|
|
471
|
+
transform: translateZ(0);
|
|
472
|
+
}
|
|
473
|
+
.epLoader:before,
|
|
474
|
+
.epLoader:after {
|
|
475
|
+
position: absolute;
|
|
476
|
+
content: '';
|
|
477
|
+
}
|
|
478
|
+
.epLoader:before {
|
|
479
|
+
width: 5.2em;
|
|
480
|
+
height: 10.2em;
|
|
481
|
+
background: #0dc5c1;
|
|
482
|
+
border-radius: 10.2em 0 0 10.2em;
|
|
483
|
+
top: -0.1em;
|
|
484
|
+
left: -0.1em;
|
|
485
|
+
-webkit-transform-origin: 5.2em 5.1em;
|
|
486
|
+
transform-origin: 5.2em 5.1em;
|
|
487
|
+
-webkit-animation: load2 2s infinite ease 1.5s;
|
|
488
|
+
animation: load2 2s infinite ease 1.5s;
|
|
489
|
+
}
|
|
490
|
+
.epLoader:after {
|
|
491
|
+
width: 5.2em;
|
|
492
|
+
height: 10.2em;
|
|
493
|
+
background: #0dc5c1;
|
|
494
|
+
border-radius: 0 10.2em 10.2em 0;
|
|
495
|
+
top: -0.1em;
|
|
496
|
+
left: 5.1em;
|
|
497
|
+
-webkit-transform-origin: 0px 5.1em;
|
|
498
|
+
transform-origin: 0px 5.1em;
|
|
499
|
+
-webkit-animation: load2 2s infinite ease;
|
|
500
|
+
animation: load2 2s infinite ease;
|
|
501
|
+
}
|
|
502
|
+
@-webkit-keyframes load2 {
|
|
503
|
+
0% {
|
|
504
|
+
-webkit-transform: rotate(0deg);
|
|
505
|
+
transform: rotate(0deg);
|
|
506
|
+
}
|
|
507
|
+
100% {
|
|
508
|
+
-webkit-transform: rotate(360deg);
|
|
509
|
+
transform: rotate(360deg);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
@keyframes load2 {
|
|
513
|
+
0% {
|
|
514
|
+
-webkit-transform: rotate(0deg);
|
|
515
|
+
transform: rotate(0deg);
|
|
516
|
+
}
|
|
517
|
+
100% {
|
|
518
|
+
-webkit-transform: rotate(360deg);
|
|
519
|
+
transform: rotate(360deg);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
</style>
|
|
523
|
+
<div class="`+spinnerClass+`">Loading...</div></body></html>`;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* @param {string} img
|
|
528
|
+
* @param {string} orientation
|
|
529
|
+
* @param {this} plugin
|
|
530
|
+
* @param {string|null} paperSize
|
|
531
|
+
*/
|
|
532
|
+
_createNewWindow(img, orientation, plugin, paperSize) {
|
|
533
|
+
let strs = new Array();
|
|
534
|
+
strs.push(`<html><head>
|
|
535
|
+
<style>@media print {
|
|
536
|
+
img { max-width: 98%!important; max-height: 98%!important; }
|
|
537
|
+
@page { size: ` + (paperSize?paperSize:'')+' '+ orientation + `;}}
|
|
538
|
+
</style>
|
|
539
|
+
<script>function step1(){
|
|
540
|
+
setTimeout('step2()', 10);}
|
|
541
|
+
function step2(){window.print();window.close()}
|
|
542
|
+
</script></head><body onload='step1()' style="margin: 0px;">`);
|
|
543
|
+
if (plugin.options.pageBorderTopHTML || plugin.options.pageBorderBottomHTML)
|
|
544
|
+
{
|
|
545
|
+
strs.push("<table border=\"0\" width=\"100%\" height=\"100%\">");
|
|
546
|
+
if (plugin.options.pageBorderTopHTML)
|
|
547
|
+
{
|
|
548
|
+
strs.push("<tr><td>"+plugin.options.pageBorderTopHTML+"</td></tr>");
|
|
549
|
+
}
|
|
550
|
+
strs.push(`<tr><td>`);
|
|
551
|
+
if (plugin.options.overlayHTML)
|
|
552
|
+
strs.push(plugin.options.overlayHTML);
|
|
553
|
+
strs.push(`<img src="` + img + `" style="display:block; margin:auto;"></td></tr>`);
|
|
554
|
+
if (plugin.options.pageBorderBottomHTML)
|
|
555
|
+
{
|
|
556
|
+
strs.push("<tr><td>"+plugin.options.pageBorderBottomHTML+"</td></tr>");
|
|
557
|
+
}
|
|
558
|
+
strs.push("</table>");
|
|
559
|
+
}
|
|
560
|
+
else
|
|
561
|
+
{
|
|
562
|
+
if (plugin.options.overlayHTML)
|
|
563
|
+
strs.push(plugin.options.overlayHTML);
|
|
564
|
+
strs.push(`<img src="` + img + `" style="display:block; margin:auto;">`);
|
|
565
|
+
}
|
|
566
|
+
strs.push(`</body></html>`);
|
|
567
|
+
return strs.join("");
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* @param {HTMLDivElement} mapDiv
|
|
572
|
+
*/
|
|
573
|
+
_createOuterContainer(mapDiv) {
|
|
574
|
+
let outerContainer = document.createElement('div');
|
|
575
|
+
mapDiv.parentNode.insertBefore(outerContainer, mapDiv);
|
|
576
|
+
mapDiv.parentNode.removeChild(mapDiv);
|
|
577
|
+
outerContainer.appendChild(mapDiv);
|
|
578
|
+
outerContainer.style.width = mapDiv.style.width;
|
|
579
|
+
outerContainer.style.height = mapDiv.style.height;
|
|
580
|
+
outerContainer.style.display = 'inline-block'
|
|
581
|
+
outerContainer.style.overflow = 'hidden';
|
|
582
|
+
return outerContainer;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* @param {HTMLDivElement} mapDiv
|
|
587
|
+
* @param {HTMLDivElement} outerContainer
|
|
588
|
+
* @param {HTMLDivElement} blankDiv
|
|
589
|
+
*/
|
|
590
|
+
_removeOuterContainer(mapDiv, outerContainer, blankDiv) {
|
|
591
|
+
if (outerContainer.parentNode) {
|
|
592
|
+
outerContainer.parentNode.insertBefore(mapDiv, outerContainer);
|
|
593
|
+
outerContainer.parentNode.removeChild(blankDiv);
|
|
594
|
+
outerContainer.parentNode.removeChild(outerContainer);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
_addCss() {
|
|
599
|
+
let css = document.createElement("style");
|
|
600
|
+
css.type = "text/css";
|
|
601
|
+
css.innerHTML = `.leaflet-control-easyPrint-button {
|
|
602
|
+
background-image: url(data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjE2cHgiIGhlaWdodD0iMTZweCIgdmlld0JveD0iMCAwIDUxMiA1MTIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDUxMiA1MTI7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPGc+Cg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MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjE2cHgiIGhlaWdodD0iMTZweCIgdmlld0JveD0iMCAwIDQzMy41IDQzMy41IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0MzMuNSA0MzMuNTsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8Zz4KCTxnIGlkPSJmaWxlLWRvd25sb2FkIj4KCQk8cGF0aCBkPSJNMzk1LjI1LDE1M2gtMTAyVjBoLTE1M3YxNTNoLTEwMmwxNzguNSwxNzguNUwzOTUuMjUsMTUzeiBNMzguMjUsMzgyLjV2NTFoMzU3di01MUgzOC4yNXoiIGZpbGw9IiMwMDAwMDAiLz4KCTwvZz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K);
|
|
608
|
+
background-size: 16px 16px;
|
|
609
|
+
cursor: pointer;
|
|
610
|
+
}
|
|
611
|
+
.easyPrintHolder a {
|
|
612
|
+
background-size: 16px 16px;
|
|
613
|
+
cursor: pointer;
|
|
614
|
+
}
|
|
615
|
+
.easyPrintHolder .CurrentSize{
|
|
616
|
+
background-image: url(data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4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NlPSJwcmVzZXJ2ZSIgd2lkdGg9IjUxMnB4IiBoZWlnaHQ9IjUxMnB4Ij4KPGc+Cgk8Zz4KCQk8cGF0aCBkPSJNNTUuMjUsNDQ0LjgzM2gzMzQuMzMzYzkuMzUsMCwxNy03LjY1LDE3LTE3VjEzOS4xMTdjMC00LjgxNy0xLjk4My05LjM1LTUuMzgzLTEyLjQ2N0wyNjkuNzMzLDQuNTMzICAgIEMyNjYuNjE3LDEuNywyNjIuMzY3LDAsMjU4LjExNywwSDU1LjI1Yy05LjM1LDAtMTcsNy42NS0xNywxN3Y0MTAuODMzQzM4LjI1LDQzNy4xODMsNDUuOSw0NDQuODMzLDU1LjI1LDQ0NC44MzN6ICAgICBNMzcyLjU4MywxNDYuNDgzdjAuODVIMjU2LjQxN3YtMTA4LjhMMzcyLjU4MywxNDYuNDgzeiBNNzIuMjUsMzRoMTUwLjE2N3YxMzAuMzMzYzAsOS4zNSw3LjY1LDE3LDE3LDE3aDEzMy4xNjd2MjI5LjVINzIuMjVWMzR6ICAgICIgZmlsbD0iIzAwMDAwMCIvPgoJPC9nPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+Cjwvc3ZnPgo=);
|
|
620
|
+
}
|
|
621
|
+
.easyPrintHolder .A4Landscape {
|
|
622
|
+
transform: rotate(-90deg);
|
|
623
|
+
}
|
|
624
|
+
.easyPrintHolder .A3Landscape {
|
|
625
|
+
transform: rotate(-90deg);
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
.leaflet-control-easyPrint-button{
|
|
629
|
+
display: inline-block;
|
|
630
|
+
}
|
|
631
|
+
.easyPrintHolder{
|
|
632
|
+
margin-top:-31px;
|
|
633
|
+
margin-bottom: -5px;
|
|
634
|
+
margin-left: 30px;
|
|
635
|
+
padding-left: 0px;
|
|
636
|
+
display: none;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
.easyPrintSizeMode {
|
|
640
|
+
display: inline-block;
|
|
641
|
+
}
|
|
642
|
+
.easyPrintHolder .easyPrintSizeMode a {
|
|
643
|
+
border-radius: 0px;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
.easyPrintHolder .easyPrintSizeMode:last-child a{
|
|
647
|
+
border-top-right-radius: 2px;
|
|
648
|
+
border-bottom-right-radius: 2px;
|
|
649
|
+
margin-left: -1px;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
.easyPrintPortrait:hover, .easyPrintLandscape:hover{
|
|
653
|
+
background-color: #757570;
|
|
654
|
+
cursor: pointer;
|
|
655
|
+
}`;
|
|
656
|
+
document.body.appendChild(css);
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* @param {string} dataURI
|
|
661
|
+
*/
|
|
662
|
+
_dataURItoBlob(dataURI) {
|
|
663
|
+
let byteString = atob(dataURI.split(',')[1]);
|
|
664
|
+
let mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
|
|
665
|
+
let ab = new ArrayBuffer(byteString.length);
|
|
666
|
+
let dw = new DataView(ab);
|
|
667
|
+
for(let i = 0; i < byteString.length; i++) {
|
|
668
|
+
dw.setUint8(i, byteString.charCodeAt(i));
|
|
669
|
+
}
|
|
670
|
+
return new Blob([ab], {type: mimeString});
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* @param {{ type: any; }} e
|
|
675
|
+
*/
|
|
676
|
+
_togglePageSizeButtons(e) {
|
|
677
|
+
/* let holderStyle = this.holder.style
|
|
678
|
+
let linkStyle = this.link.style
|
|
679
|
+
if (e.type === 'mouseover') {
|
|
680
|
+
holderStyle.display = 'block';
|
|
681
|
+
linkStyle.borderTopRightRadius = '0'
|
|
682
|
+
linkStyle.borderBottomRightRadius = '0'
|
|
683
|
+
} else {
|
|
684
|
+
holderStyle.display = 'none';
|
|
685
|
+
linkStyle.borderTopRightRadius = '2px'
|
|
686
|
+
linkStyle.borderBottomRightRadius = '2px'
|
|
687
|
+
}*/
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* @param {boolean | undefined} [show]
|
|
692
|
+
*/
|
|
693
|
+
_toggleControls(show) {
|
|
694
|
+
let controlContainer = document.getElementsByClassName("leaflet-control-container")[0];
|
|
695
|
+
if (show)
|
|
696
|
+
controlContainer.style.display = 'block';
|
|
697
|
+
else
|
|
698
|
+
controlContainer.style.display = 'none';
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* @param {any[]} classes
|
|
703
|
+
* @param {boolean | undefined} [show]
|
|
704
|
+
*/
|
|
705
|
+
_toggleClasses(classes, show) {
|
|
706
|
+
classes.forEach(function (/** @type {string} */ className) {
|
|
707
|
+
let divs = document.getElementsByClassName(className);
|
|
708
|
+
let i;
|
|
709
|
+
for (i in divs)
|
|
710
|
+
{
|
|
711
|
+
if (divs[i].style)
|
|
712
|
+
{
|
|
713
|
+
divs[i].style.display = show?'':'none';
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* @param {any[]} ids
|
|
720
|
+
* @param {boolean | undefined} [show]
|
|
721
|
+
*/
|
|
722
|
+
_toggleIds(ids, show) {
|
|
723
|
+
ids.forEach(function (/** @type {string} */ id) {
|
|
724
|
+
let div = document.getElementById(id);
|
|
725
|
+
if (div && div.style)
|
|
726
|
+
{
|
|
727
|
+
div.style.display = show?'':'none';
|
|
728
|
+
}
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
}
|