UNPKG

@obliczeniowo/elementary

Version:
92 lines (84 loc) 3.21 kB
import * as i0 from '@angular/core'; import { Renderer2, RendererFactory2 } from '@angular/core'; import { IPoint2D, ColorRGB, Point2D, ColorType } from '@obliczeniowo/elementary/classes'; import { DrawingSvgInterface, DrawingContextInterface } from '@obliczeniowo/elementary/drawing'; import { OblFileService } from '@obliczeniowo/elementary/files'; type Coords = [number, number]; interface Geometry { coordinates: Coords | Coords[] | (Coords[])[]; type: 'MultiPolygon' | 'Polygon' | 'Point' | 'Symbol' | 'LineString' | 'MultiLineString' | string; } interface LayerLike { id: string; type: string; metadata?: any; ref?: string | undefined; source?: string | undefined; 'source-layer'?: string | undefined; minzoom?: number | undefined; maxzoom?: number | undefined; interactive?: boolean | undefined; filter?: ({ [key: string]: any; })[] | undefined; layout?: { [key: string]: any; } | undefined; paint?: { [key: string]: any; } | undefined; } interface FeatureLike { feature: { geometry: Geometry[]; type: 'Feature' | string; layer: LayerLike; state: { [key: string]: any; }; properties?: { [key: string]: any; }; }; } interface MapboxLike { queryRenderedFeatures: () => (FeatureLike | any)[]; project: (coords: [number, number]) => IPoint2D; getCanvas: () => HTMLCanvasElement; } interface ToOverrideLayer { layerId: string; fillOpacity?: string | number; fill?: ColorRGB; textColor?: string; haloColor?: string; draw?: { after: ((feature: any, map: MapboxLike, dc: DrawingSvgInterface) => void)[]; before: ((feature: any, map: MapboxLike, dc: DrawingSvgInterface) => void)[]; }; } /** * Service that provide some extra functionality for mapbox library made to use maps in web applications */ declare class OblMapboxService { protected file: OblFileService; /** * Variable that contain table of layers id and properties that can be override from default one */ toOverride: ToOverrideLayer[]; protected renderer: Renderer2; constructor(file: OblFileService, rendererFactory: RendererFactory2); protected drawText(feature: any, dc: DrawingContextInterface, map: MapboxLike, override?: ToOverrideLayer, point?: IPoint2D): void; /** * Method to export mapbox layers to SVG file * @param map mapbox.map object */ exportToSvg(map: MapboxLike, draw?: (dc: DrawingContextInterface) => void): void; exportToPdf(map: MapboxLike, draw?: ((dc: DrawingContextInterface) => void)): void; protected draw(map: MapboxLike, dc: DrawingContextInterface, draw?: (dc: DrawingContextInterface) => void): void; protected drawSplittedText(dc: DrawingContextInterface, text: string, position: Point2D, color: ColorType, haloColor: ColorType | undefined, maxLength: number): number; static ɵfac: i0.ɵɵFactoryDeclaration<OblMapboxService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<OblMapboxService>; } export { OblMapboxService }; export type { FeatureLike, LayerLike, MapboxLike, ToOverrideLayer };