132 lines
3.1 KiB
TypeScript
132 lines
3.1 KiB
TypeScript
import { AnnotationBaseOption as BaseOption, ArcOption, ComponentOption, DataMarkerOption, DataRegionOption, ImageOption, LineOption, RegionFilterOption, RegionOption, TextOption } from '../../interface';
|
|
import View from '../view';
|
|
import { Controller } from './base';
|
|
/**
|
|
* Annotation controller, 主要作用:
|
|
* 1. 创建 Annotation: line、text、arc ...
|
|
* 2. 生命周期: init、layout、render、clear、destroy
|
|
*/
|
|
export default class Annotation extends Controller<BaseOption[]> {
|
|
private foregroundContainer;
|
|
private backgroundContainer;
|
|
private cache;
|
|
constructor(view: View);
|
|
get name(): string;
|
|
init(): void;
|
|
layout(): void;
|
|
render(): void;
|
|
/**
|
|
* 更新
|
|
*/
|
|
update(): void;
|
|
/**
|
|
* 清空
|
|
* @param includeOption 是否清空 option 配置项
|
|
*/
|
|
clear(includeOption?: boolean): void;
|
|
destroy(): void;
|
|
/**
|
|
* 复写基类的方法
|
|
*/
|
|
getComponents(): ComponentOption[];
|
|
private createAnnotation;
|
|
annotation(option: any): void;
|
|
/**
|
|
* 创建 Arc
|
|
* @param option
|
|
* @returns AnnotationController
|
|
*/
|
|
arc(option: ArcOption): this;
|
|
/**
|
|
* 创建 image
|
|
* @param option
|
|
* @returns AnnotationController
|
|
*/
|
|
image(option: ImageOption): this;
|
|
/**
|
|
* 创建 Line
|
|
* @param option
|
|
* @returns AnnotationController
|
|
*/
|
|
line(option: LineOption): this;
|
|
/**
|
|
* 创建 Region
|
|
* @param option
|
|
* @returns AnnotationController
|
|
*/
|
|
region(option: RegionOption): this;
|
|
/**
|
|
* 创建 Text
|
|
* @param option
|
|
* @returns AnnotationController
|
|
*/
|
|
text(option: TextOption): this;
|
|
/**
|
|
* 创建 DataMarker
|
|
* @param option
|
|
* @returns AnnotationController
|
|
*/
|
|
dataMarker(option: DataMarkerOption): this;
|
|
/**
|
|
* 创建 DataRegion
|
|
* @param option
|
|
* @returns AnnotationController
|
|
*/
|
|
dataRegion(option: DataRegionOption): void;
|
|
/**
|
|
* 创建 RegionFilter
|
|
* @param option
|
|
* @returns AnnotationController
|
|
*/
|
|
regionFilter(option: RegionFilterOption): void;
|
|
/**
|
|
* parse the point position to [x, y]
|
|
* @param p Position
|
|
* @returns { x, y }
|
|
*/
|
|
private parsePosition;
|
|
/**
|
|
* parse all the points between start and end
|
|
* @param start
|
|
* @param end
|
|
* @return Point[]
|
|
*/
|
|
private getRegionPoints;
|
|
/**
|
|
* parse the value position
|
|
* @param val
|
|
* @param scale
|
|
*/
|
|
private getNormalizedValue;
|
|
/**
|
|
* parse percent position
|
|
* @param position
|
|
*/
|
|
private parsePercentPosition;
|
|
/**
|
|
* get coordinate bbox
|
|
*/
|
|
private getCoordinateBBox;
|
|
/**
|
|
* get annotation component config by different type
|
|
* @param type
|
|
* @param option 用户的配置
|
|
* @param theme
|
|
*/
|
|
private getAnnotationCfg;
|
|
/**
|
|
* is annotation render on top
|
|
* @param option
|
|
* @return whethe on top
|
|
*/
|
|
private isTop;
|
|
/**
|
|
* get the container by option.top
|
|
* default is on top
|
|
* @param option
|
|
* @returns the container
|
|
*/
|
|
private getComponentContainer;
|
|
private getAnnotationTheme;
|
|
}
|