@mapcreator/sdk 3.0.0 → 3.1.1

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.
@@ -0,0 +1,13 @@
1
+ import { SvgCache } from './utils/svgHelpers';
2
+ import { JobObjectFormat } from './types/jobObject';
3
+ import { MCMap } from './MCMap';
4
+ export declare class Image {
5
+ private mcMap;
6
+ private format;
7
+ private svgCache;
8
+ private backgroundColor;
9
+ constructor(mcMap: MCMap, format: JobObjectFormat, svgCache: SvgCache, backgroundColor: string);
10
+ frame(asBlob: true): Promise<Blob>;
11
+ frame(asBlob: false): Promise<ImageData>;
12
+ frame(asBlob: boolean): Promise<Blob | ImageData>;
13
+ }
package/dist/MCMap.d.ts CHANGED
@@ -1,16 +1,79 @@
1
1
  import { Evented, Map as MapLibre, StyleSpecification } from '@mapcreator/maplibre-gl';
2
+ import { JobObject, JobObjectFormat } from './types/jobObject';
2
3
  import { ExportType, LayerInfo, Svgs } from './types';
3
- import { JobObject } from './types/jobObject';
4
4
  import { SvgCache } from './utils/svgHelpers';
5
5
  import { SdkEventType } from './events';
6
6
  export declare class MCMap extends Evented<SdkEventType> {
7
7
  map: MapLibre;
8
+ private format;
9
+ private mapstyle;
10
+ private svgCache;
11
+ private backgroundColor;
12
+ private vapiUrl;
13
+ private accessToken;
14
+ private image;
8
15
  private video;
9
- constructor(map: MapLibre, exportType: ExportType, jobObject: JobObject, svgs: Svgs, svgCache: SvgCache, mapstyle: StyleSpecification, overlays: Map<number, StyleSpecification>, layerInfo: LayerInfo, backgroundColor: string);
16
+ constructor(map: MapLibre, format: JobObjectFormat, exportType: ExportType, jobObject: JobObject, svgs: Svgs, svgCache: SvgCache, mapstyle: StyleSpecification, overlays: Map<number, StyleSpecification>, layerInfo: LayerInfo, backgroundColor: string, vapiUrl: string, accessToken: string);
10
17
  play(): void;
11
18
  pause(): void;
12
19
  seekTo(time: number): void;
13
- frames(): AsyncGenerator<ImageData, void, void>;
20
+ frames(asBlob: true): AsyncGenerator<Blob, void, void>;
21
+ frames(asBlob?: false): AsyncGenerator<ImageData, void, void>;
22
+ frames(asBlob?: boolean): AsyncGenerator<Blob | ImageData, void, void>;
14
23
  preload(): Promise<void>;
24
+ geoTiffMetadata(size: {
25
+ width: number;
26
+ height: number;
27
+ }): {
28
+ width: number;
29
+ height: number;
30
+ GTRasterTypeGeoKey: number;
31
+ PhotometricInterpretation: number;
32
+ ProjectedCSTypeGeoKey: number;
33
+ ModelTiepoint: number[];
34
+ ModelPixelScale: never[];
35
+ };
36
+ svgExportOptions(api: {
37
+ href?: string;
38
+ token: string;
39
+ }, geoRef?: boolean, signal?: AbortSignal | undefined): {
40
+ map: MapLibre;
41
+ api: {
42
+ href?: string;
43
+ token: string;
44
+ };
45
+ signal: AbortSignal | undefined;
46
+ options: {
47
+ svgElements: {
48
+ name: string | undefined;
49
+ svg: string;
50
+ x: number;
51
+ y: number;
52
+ w: number;
53
+ h: number;
54
+ }[];
55
+ fillPatterns: {
56
+ name: string;
57
+ string: string;
58
+ }[];
59
+ backgroundColor: string;
60
+ detailLevel: number;
61
+ forPDF: boolean;
62
+ geoRef: boolean;
63
+ };
64
+ };
65
+ pdfExportOptions(api: {
66
+ href?: string;
67
+ token: string;
68
+ }): {
69
+ colorCallback: (inValue: [[number, number, number], number] | undefined) => [[number, number, number, number], number] | undefined;
70
+ fontCallback: (family: string, requestedWeight: number, requestedStyle: string, doc: {
71
+ registerFont(name: string, data: ArrayBuffer): unknown;
72
+ }, fontOptions?: {
73
+ fauxBold: boolean;
74
+ fauxItalic: boolean;
75
+ }) => Promise<string>;
76
+ assumePt: boolean;
77
+ };
15
78
  remove(): void;
16
79
  }
package/dist/Video.d.ts CHANGED
@@ -28,17 +28,11 @@ export declare class Video {
28
28
  pause(): void;
29
29
  seekTo(time: number): void;
30
30
  remove(): void;
31
- frames(): AsyncGenerator<ImageData, void, void>;
31
+ frames(asBlob: true): AsyncGenerator<Blob, void, void>;
32
+ frames(asBlob: false): AsyncGenerator<ImageData, void, void>;
33
+ frames(asBlob: boolean): AsyncGenerator<Blob | ImageData, void, void>;
32
34
  preload(): Promise<void>;
33
- /**
34
- * Waits for the next 'render' or a meaningful 'dataabort' event, whichever
35
- * comes first. 'dataabort' events for tiles that aren't in the 'loading'
36
- * state (e.g. errored tiles being evicted) are ignored — they don't indicate
37
- * lost in-flight work.
38
- */
39
- private waitForRenderOrAbort;
40
35
  private captureFrame;
41
- private drawAdornments;
42
36
  private playFrame;
43
37
  private setFrame;
44
38
  private setCamera;
@@ -1,2 +1,3 @@
1
+ import { Fonts } from '../utils/fonts';
1
2
  import { JobObjectManualLegend } from '../types/jobObject';
2
- export declare function getCategoricalLegendSvg(legend: JobObjectManualLegend, defaultFont: string, mapScale: number): string;
3
+ export declare function getCategoricalLegendSvg(legend: JobObjectManualLegend, defaultFont: string, mapScale: number, fonts: Fonts): string;
@@ -1,7 +1,8 @@
1
+ import { Fonts } from '../utils/fonts';
1
2
  import { Map as MapLibre } from '@mapcreator/maplibre-gl';
2
- import { JobObject, JobObjectConnectedLegend } from '../types/jobObject';
3
3
  import { ExportType } from '../types';
4
- export declare function useConnectedLegend(legend: JobObjectConnectedLegend, jobObject: JobObject, map: MapLibre, vapiUrl: string, accessToken: string, exportType: ExportType): {
4
+ import { JobObject, JobObjectConnectedLegend } from '../types/jobObject';
5
+ export declare function useConnectedLegend(legend: JobObjectConnectedLegend, jobObject: JobObject, map: MapLibre, fonts: Fonts, exportType: ExportType): {
5
6
  element: HTMLElement;
6
7
  ready: Promise<void>;
7
8
  };
@@ -1,3 +1,7 @@
1
- import { Map } from '@mapcreator/maplibre-gl';
2
1
  import { JobObjectCopyright } from '../types/jobObject';
3
- export declare function useCopyright(copyright: JobObjectCopyright, map: Map): HTMLElement;
2
+ import { Fonts } from '../utils/fonts';
3
+ import { Map } from '@mapcreator/maplibre-gl';
4
+ export declare function useCopyright(copyright: JobObjectCopyright, map: Map, fonts: Fonts): {
5
+ element: HTMLElement;
6
+ ready: Promise<void>;
7
+ };
@@ -1,7 +1,8 @@
1
+ import { Fonts } from '../utils/fonts';
1
2
  import { JobObjectHeading } from '../types/jobObject';
2
3
  import { Map } from '@mapcreator/maplibre-gl';
3
4
  import { ExportType } from '../types';
4
- export declare function useHeading(heading: JobObjectHeading, map: Map, vapiUrl: string, accessToken: string, exportType: ExportType): {
5
+ export declare function useHeading(heading: JobObjectHeading, map: Map, fonts: Fonts, exportType: ExportType): {
5
6
  element: HTMLElement;
6
7
  ready: Promise<void>;
7
8
  };
@@ -1,7 +1,8 @@
1
1
  import { JobObjectManualLegend } from '../types/jobObject';
2
2
  import { Map } from '@mapcreator/maplibre-gl';
3
+ import { Fonts } from '../utils/fonts';
3
4
  import { ExportType } from '../types';
4
- export declare function useManualLegend(legend: JobObjectManualLegend, map: Map, vapiUrl: string, accessToken: string, exportType: ExportType): {
5
+ export declare function useManualLegend(legend: JobObjectManualLegend, map: Map, fonts: Fonts, exportType: ExportType): {
5
6
  element: HTMLElement;
6
7
  ready: Promise<void>;
7
8
  };
@@ -1,7 +1,8 @@
1
+ import { Fonts } from '../utils/fonts';
1
2
  import { JobObjectScalebar } from '../types/jobObject';
2
3
  import { Map } from '@mapcreator/maplibre-gl';
3
4
  import { ExportType } from '../types';
4
- export declare function useScalebar(scalebar: JobObjectScalebar, map: Map, vapiUrl: string, accessToken: string, exportType: ExportType): {
5
+ export declare function useScalebar(scalebar: JobObjectScalebar, map: Map, fonts: Fonts, exportType: ExportType): {
5
6
  element: HTMLElement;
6
7
  ready: Promise<void>;
7
8
  };
@@ -9,6 +9,7 @@ export declare const defaultPositionOffsets: PositionOffsets;
9
9
  export declare const positionConfig: {
10
10
  [position in AdornmentPosition]: PositionConfig;
11
11
  };
12
+ export declare const adornmentSpacing = 5;
12
13
  export declare const defaultFov = 36.87;
13
14
  type OpacityConfig = {
14
15
  props: Array<keyof AllPaintProperties>;