@web-map-service/map2d
Version:
基于openlayer的2D地图服务
57 lines (56 loc) • 1.89 kB
TypeScript
import { BaseElement, ElementExtend, ElementImage, Coord, CircleData, PointData } from './types';
import { CirclePluginOptions } from './circle';
import { PolygonPluginOptions } from './polygon';
import { LinePluginOptions } from './line';
import { ImagePluginOptions } from './image';
import { StorkeStyle, FillStyle, ImageStyle, CircleStyle } from '../../style';
import { default as __DTS_DEFAULT_0__ } from 'ol/Feature';
import { Geometry } from 'ol/geom';
import { Style } from '../..';
export interface ElementPluginsMap {
line: {
options: LinePluginOptions;
};
circle: {
options: CirclePluginOptions;
};
polygon: {
options: PolygonPluginOptions;
};
rect: {
options: PolygonPluginOptions;
};
image: {
options: ImagePluginOptions;
};
}
export interface Element<T extends ElementType = any> extends BaseElement<T extends ElementType ? ElementPluginsMap[T]['options']['data'] : any> {
type: ElementType;
}
export type ElementType = keyof ElementPluginsMap;
export declare function createElement<T extends ElementType>(options: Omit<ElementPluginsMap[T]['options'], keyof ElementExtend> & {
type: T;
}, layerId: number): {
id: number;
layerId: number;
type: Element["type"];
name: string | undefined;
image: ElementImage | undefined;
data: any;
rotate: number;
style: Partial<{
stroke: Partial< StorkeStyle>;
fill: Partial< FillStyle>;
image: Partial< ImageStyle>;
circle: Partial< CircleStyle>;
}> | undefined;
readonly props: {
[x: string]: any;
};
setName(name: string): void;
setRotate(rotate: number): void;
setProps(props: Record<string, unknown>): void;
getOlFeature(): __DTS_DEFAULT_0__<Geometry>;
setStyle(style: Style): void;
setData(data: Coord | CircleData | PointData): void;
};