框架同步
This commit is contained in:
parent
ee4a26a36c
commit
9afb470615
@ -25,6 +25,7 @@ import {
|
|||||||
type AppStateSubscription,
|
type AppStateSubscription,
|
||||||
type MessageCliOption,
|
type MessageCliOption,
|
||||||
GraphicQuery,
|
GraphicQuery,
|
||||||
|
ICreateOnNotFound,
|
||||||
} from '../message';
|
} from '../message';
|
||||||
import { OperationRecord } from '../operation/JlOperation';
|
import { OperationRecord } from '../operation/JlOperation';
|
||||||
import {
|
import {
|
||||||
@ -476,7 +477,7 @@ export interface IGraphicScene extends EventEmitter<GraphicAppEvents> {
|
|||||||
handleGraphicStates(
|
handleGraphicStates(
|
||||||
graphicStates: GraphicState[],
|
graphicStates: GraphicState[],
|
||||||
queryer?: GraphicQuery,
|
queryer?: GraphicQuery,
|
||||||
createOnNotFound?: boolean
|
createOnNotFound?: ICreateOnNotFound
|
||||||
): void;
|
): void;
|
||||||
/**
|
/**
|
||||||
* 根据类型获取图形模板
|
* 根据类型获取图形模板
|
||||||
@ -1094,7 +1095,7 @@ abstract class GraphicSceneBase
|
|||||||
handleGraphicStates(
|
handleGraphicStates(
|
||||||
graphicStates: GraphicState[],
|
graphicStates: GraphicState[],
|
||||||
queryer?: GraphicQuery,
|
queryer?: GraphicQuery,
|
||||||
createOnNotFound?: boolean
|
createOnNotFound?: ICreateOnNotFound
|
||||||
): void {
|
): void {
|
||||||
graphicStates.forEach((state) => {
|
graphicStates.forEach((state) => {
|
||||||
let g: JlGraphic | undefined;
|
let g: JlGraphic | undefined;
|
||||||
@ -1106,7 +1107,13 @@ abstract class GraphicSceneBase
|
|||||||
try {
|
try {
|
||||||
if (!g) {
|
if (!g) {
|
||||||
// 未找到图形对象
|
// 未找到图形对象
|
||||||
if (createOnNotFound) {
|
if (
|
||||||
|
createOnNotFound &&
|
||||||
|
createOnNotFound.graphicTypes &&
|
||||||
|
createOnNotFound.graphicTypes.findIndex(
|
||||||
|
(v) => v === state.graphicType
|
||||||
|
) >= 0
|
||||||
|
) {
|
||||||
const template = this.getGraphicTemplatesByType(state.graphicType);
|
const template = this.getGraphicTemplatesByType(state.graphicType);
|
||||||
const g = template.new();
|
const g = template.new();
|
||||||
g.loadState(state);
|
g.loadState(state);
|
||||||
|
@ -155,6 +155,10 @@ export type GraphicQuery = (
|
|||||||
// 订阅消息处理器
|
// 订阅消息处理器
|
||||||
export type SubscriptionMessageHandle = (message: Uint8Array) => void;
|
export type SubscriptionMessageHandle = (message: Uint8Array) => void;
|
||||||
|
|
||||||
|
export interface ICreateOnNotFound {
|
||||||
|
graphicTypes?: string[];
|
||||||
|
}
|
||||||
|
|
||||||
// 图形app状态订阅
|
// 图形app状态订阅
|
||||||
export interface AppStateSubscription {
|
export interface AppStateSubscription {
|
||||||
/**
|
/**
|
||||||
@ -171,8 +175,9 @@ export interface AppStateSubscription {
|
|||||||
graphicQueryer?: GraphicQuery;
|
graphicQueryer?: GraphicQuery;
|
||||||
/**
|
/**
|
||||||
* 当未根据状态找到图形对象时是否创建新对象
|
* 当未根据状态找到图形对象时是否创建新对象
|
||||||
|
* 值为设备类型列表
|
||||||
*/
|
*/
|
||||||
createOnNotFound?: boolean;
|
createOnNotFound?: ICreateOnNotFound;
|
||||||
/**
|
/**
|
||||||
* 订阅消息处理
|
* 订阅消息处理
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user