Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
positionHComment += 20;
} else {
// Don't cut last part
newContext.fillText(
comment.substr(positionFirstCutChar),
width / 2,
positionHComment
);
}
}
}
}
// Add map to new canvas
newContext.drawImage(context.canvas, 0, positionHCanvas);
let status = SubjectStatus.Done;
try {
// Save the canvas as file
if (!doZipFile) {
this.saveCanvasImageAsFile(newCanvas, 'map', format);
} else if (format.toLowerCase() === 'tiff') {
// Add the canvas to zip
this.generateCanvaFileToZip(
newCanvas,
'map' + map.projection.replace(':', '_') + '.' + format
);
} else {
// Add the canvas to zip
this.generateCanvaFileToZip(newCanvas, 'map' + '.' + format);
}
} catch (err) {
status = SubjectStatus.Error;
.subscribe(status => {
if (status === SubjectStatus.Working) {
this.loading += 1;
} else if (status === SubjectStatus.Done) {
this.loaded += 1;
}
if (this.loaded >= this.loading) {
this.loading = this.loaded = 0;
this.status = SubjectStatus.Done;
} else if (this.loading > 0) {
this.status = SubjectStatus.Working;
}
});
.subscribe(status => {
if (status === SubjectStatus.Working) {
this.loading += 1;
} else if (status === SubjectStatus.Done) {
this.loaded += 1;
}
if (this.loaded >= this.loading) {
this.loading = this.loaded = 0;
this.status = SubjectStatus.Done;
} else if (this.loading > 0) {
this.status = SubjectStatus.Working;
}
});
const mapStatus$$ = map.status$.subscribe((mapStatus: SubjectStatus) => {
clearTimeout(timeout);
if (mapStatus !== SubjectStatus.Done) {
return;
}
mapStatus$$.unsubscribe();
let status = SubjectStatus.Done;
try {
this.addCanvas(doc, canvas, size, margins);
} catch (err) {
status = SubjectStatus.Error;
this.messageService.error(
this.languageService.translate.instant('igo.geo.printForm.corsErrorMessageBody'),
this.languageService.translate.instant('igo.geo.printForm.corsErrorMessageHeader'),
'print'
);
}
unwatchLayer(layer: Layer) {
layer.status$.next(SubjectStatus.Done);
const index = this.layers.indexOf(layer);
if (index >= 0) {
const status = (layer as any).watcher.status;
if (
[SubjectStatus.Working, SubjectStatus.Waiting].indexOf(status) !== -1
) {
this.loaded += 1;
}
this.subscriptions[index].unsubscribe();
this.subscriptions.splice(index, 1);
this.layers.splice(index, 1);
(layer as any).watcher.unwatch();
}
}
}
return;
}
const watcherIndex = event.image.__watchers__.indexOf(this.id);
if (watcherIndex < 0) {
return;
}
event.image.__watchers__.splice(watcherIndex, 1);
this.loaded += 1;
const loading = this.loading;
if (this.loaded >= loading) {
if (loading === this.loading) {
this.status = SubjectStatus.Done;
this.loaded = this.loading = 0;
}
}
}
}
(status: SubjectStatus) => {
if (status === SubjectStatus.Done) {
if (options.showLegend === true) {
this.addLegend(doc, map, margins, resolution);
} else {
this.saveDoc(doc);
}
}
if (status === SubjectStatus.Done || status === SubjectStatus.Error) {
this.activityService.unregister(this.activityId);
status$.next(SubjectStatus.Done);
}
}
);
private handleStatusChange(status: SubjectStatus) {
if (status === SubjectStatus.Working && this.activityId === undefined) {
this.activityId = this.activityService.register();
} else if (status === SubjectStatus.Done && this.activityId !== undefined) {
this.activityService.unregister(this.activityId);
this.activityId = undefined;
}
}
}
return;
}
const watcherIndex = event.tile.__watchers__.indexOf(this.id);
if (watcherIndex < 0) {
return;
}
event.tile.__watchers__.splice(watcherIndex, 1);
this.loaded += 1;
const loading = this.loading;
if (this.loaded >= loading) {
if (loading === this.loading) {
this.status = SubjectStatus.Done;
this.loaded = this.loading = 0;
}
}
}
}
const mapStatus$$ = map.status$.subscribe((mapStatus: SubjectStatus) => {
clearTimeout(timeout);
if (mapStatus !== SubjectStatus.Done) {
return;
}
mapStatus$$.unsubscribe();
let status = SubjectStatus.Done;
try {
this.addCanvas(doc, canvas, margins);
} catch (err) {
status = SubjectStatus.Error;
this.messageService.error(
this.languageService.translate.instant(
'igo.geo.printForm.corsErrorMessageBody'
),
this.languageService.translate.instant(
'igo.geo.printForm.corsErrorMessageHeader'
),
'print'
);
}
this.renderMap(map, mapSize, extent);