(type: string): GT;
/**
* 添加图形
* @param graphics
*/
addGraphics(...graphics: JlGraphic[]): void;
/**
* 删除图形
* @param graphics
*/
deleteGraphics(...graphics: JlGraphic[]): JlGraphic[];
/**
* 检测并构建关系
*/
detectRelations(): void;
/**
* 注册交互插件
* @param plugins
*/
registerInteractionPlugin(...plugins: InteractionPlugin[]): void;
/**
* 暂停交互插件
*/
pauseAppInteractionPlugins(): void;
/**
* 根据name获取交互插件
* @param name
*/
interactionPlugin(name: string): P;
/**
* 更新选中图形对象
* @param graphics
*/
updateSelected(...graphics: JlGraphic[]): void;
/**
* 选中所有图形
*/
selectAllGraphics(): void;
/**
* 使所选图形居中
* @param group
*/
makeGraphicCenterShow(...group: JlGraphic[]): void;
/**
* 销毁
*/
destroy(): void;
/**
* 订阅websocket消息
*/
subscribe(sub: AppStateSubscription): void;
/**
* 取消websocket订阅
*/
unsubscribe(destination: string): void;
}
declare abstract class GraphicSceneBase extends EventEmitter implements IGraphicScene {
private graphicStore;
_options: GraphicAppOptions;
pixi: Application;
viewport: Viewport;
canvas: JlCanvas;
_loaded: boolean;
_dom?: HTMLElement;
_viewportResizer?: NodeJS.Timeout;
graphicTemplateMap: Map;
interactionPluginMap: Map;
graphicCopyPlugin: GraphicCopyPlugin;
animationManager: AnimationManager;
menuPlugin: ContextMenuPlugin;
private debounceEmitFunc;
wsMsgBroker: AppWsMsgBroker;
constructor(options: GraphicAppOptions);
get appOptions(): GraphicAppOptions;
abstract get app(): GraphicApp;
get dom(): HTMLElement | undefined;
get queryStore(): GraphicQueryStore;
get selectedGraphics(): JlGraphic[];
private load;
/**
* 重新加载数据
*/
reload(): Promise;
forceReload(): Promise;
/**
* 更新选项
* @param options
*/
setOptions(options: GraphicAppOptions): void;
toCanvasCoordinates(p: Point): Point;
/**
* 注册菜单
* @param menu
*/
registerMenu(menu: ContextMenu): void;
/**
* 注册图形对象模板
* @param graphicTemplates
*/
registerGraphicTemplates(...graphicTemplates: GraphicTemplate[]): void;
getGraphicTemplatesByType(type: string): GT;
private updateViewport;
/**
* 暂停
*/
private pause;
/**
* 恢复
*/
private resume;
bindDom(dom: HTMLElement): void;
unbindDom(): void;
/**
* 加载图形,GraphicApp默认添加到无交互容器,DrawApp默认添加到交互容器,如需定制,提供选项配置
* @param protos
* @param options 添加到可交互/不可交互容器选项配置
*/
loadGraphic(protos: GraphicData[]): Promise;
/**
* 添加图形前处理
* @param graphic
*/
beforeGraphicStore(graphic: JlGraphic): void;
/**
* 执行添加图形对象
* @param graphic
*/
private doAddGraphics;
private doDeleteGraphics;
/**
* 存储图形
* @param graphics 图形对象
*/
addGraphics(...graphics: JlGraphic[]): void;
/**
* 删除图形
* @param graphics 图形对象
*/
deleteGraphics(...graphics: JlGraphic[]): JlGraphic[];
/**
* 检测并构建关系
*/
detectRelations(): void;
/**
* 全选
*/
selectAllGraphics(filter?: (g: JlGraphic) => boolean): void;
/**
* 更新选中
*/
updateSelected(...graphics: JlGraphic[]): void;
private doEmitAppGraphicSelected;
/**
* 更新画布
* @param param
*/
updateCanvas(param: ICanvasProperties): void;
/**
* 使图形居中显示(所有图形的外包围盒)
*/
makeGraphicCenterShow(...group: JlGraphic[]): void;
/**
* 注册交互插件,会替换旧的
*/
registerInteractionPlugin(...plugins: InteractionPlugin[]): void;
/**
* 根据名称获取交互插件
* @param name
* @returns
*/
interactionPlugin(name: string): P;
/**
* 停止应用交互插件
*/
pauseAppInteractionPlugins(): void;
private doPauseInteractionPlugin;
/**
* 移除交互插件
*/
removeInteractionPlugin(plugin: InteractionPlugin): void;
private checkWsMsgCli;
/**
* 订阅websocket消息
*/
subscribe(sub: AppStateSubscription): void;
/**
* 取消websocket订阅
*/
unsubscribe(destination: string): void;
/**
* 处理图形状态
* @param graphicStates
*/
handleGraphicStates(graphicStates: GraphicState[], queryer?: GraphicQuery, createOnNotFound?: ICreateOnNotFound): void;
/**
* 销毁
*/
destroy(): void;
}
/**
* 图形应用接口
*/
export interface IGraphicApp extends IGraphicScene {
get opRecord(): OperationRecord;
/**
* 实例化一个场景
* @param code 场景标识
* @returns
*/
initScene(code: string, options: GraphicAppOptions): IGraphicScene;
/**
* 获取场景
* @param code
* @returns
*/
getScene(code: string): IGraphicScene;
/**
* 切换场景
* @param dom
*/
switchScene(code: string, dom: HTMLElement): void;
/**
* 移除指定code场景
* @param code
*/
removeScene(code: string): void;
/**
* 添加图形并记录
* @param graphics
*/
addGraphicAndRecord(...graphics: JlGraphic[]): void;
/**
* 删除图形并记录
* @param graphics
*/
deleteGraphicAndRecord(...graphics: JlGraphic[]): void;
/**
* 启动websocket消息客户端
*/
enableWsMassaging(options: MessageCliOption): void;
/**
* 添加键盘监听器,如果是相同的按键,新注册的会覆盖旧的,当移除新的时,旧的自动生效
* @param keyListeners
*/
addKeyboardListener(...keyListeners: KeyListener[]): void;
/**
* 移除键盘监听器
* @param keyListeners
*/
removeKeyboardListener(...keyListeners: KeyListener[]): void;
}
/**
* 图形app基类
*/
export declare class GraphicApp extends GraphicSceneBase implements IGraphicApp {
/**
* 场景列表
*/
scenes: Map;
opRecord: OperationRecord;
keyboardPlugin: JlGraphicAppKeyboardPlugin;
constructor(options: GraphicAppOptions);
get app(): GraphicApp;
setOptions(options: GraphicAppOptions): void;
addGraphicAndRecord(...graphics: JlGraphic[]): void;
deleteGraphicAndRecord(...graphics: JlGraphic[]): void;
/**
* 实例化一个场景
* @param code 场景标识
* @returns
*/
initScene(code: string, options: GraphicAppOptions): IGraphicScene;
/**
* 获取场景
* @param code
* @returns
*/
getScene(code: string): IGraphicScene;
switchScene(code: string, dom: HTMLElement): void;
removeScene(code: string): void;
/**
* 启动websocket消息客户端
*/
enableWsMassaging(options: MessageCliOption): void;
/**
* 添加键盘监听器,如果是相同的按键,新注册的会覆盖旧的,当移除新的时,旧的自动生效
* @param keyListeners
*/
addKeyboardListener(...keyListeners: KeyListener[]): void;
/**
* 移除键盘监听器
* @param keyListeners
*/
removeKeyboardListener(...keyListeners: KeyListener[]): void;
/**
* 销毁
*/
destroy(): void;
}
/**
* 场景
*/
export default class JlScene extends GraphicSceneBase {
code: string;
app: GraphicApp;
constructor(app: GraphicApp, code: string, options: GraphicAppOptions);
}
export {};