rt-graphic-component/components/packages/Section/common/Section.d.ts
2024-01-10 17:25:39 +08:00

74 lines
2.3 KiB
TypeScript

import { GraphicData, GraphicState, JlGraphic, JlGraphicTemplate, VectorText } from 'jl-graphic';
import { IPointData } from 'pixi.js';
import { SectionGraphic } from './SectionGraphic';
import { DevicePort, IRelatedRef } from 'common/common';
import { Turnout } from 'src/packages/Turnout/Turnout';
export interface ISectionData extends GraphicData {
code: string;
isCurve: boolean;
segmentsCount: number;
points: IPointData[];
sectionType: SectionType;
paRef?: IRelatedRef;
pbRef?: IRelatedRef;
axleCountings?: number[];
centralizedStations?: number[];
trackSectionId?: number;
clone(): ISectionData;
copyFrom(data: ISectionData): void;
eq(other: ISectionData): boolean;
}
export interface ISectionState extends GraphicState {
id: number;
occupied: boolean;
}
export declare enum SectionType {
Physical = 0,//物理区段
Logic = 1,//逻辑区段
TurnoutPhysical = 2,//道岔物理区段
Track = 4,//轨道区段
TrackLogic = 5
}
export interface SectionDisplayConfig {
lineColor: string;
occupiedColor: string;
lineWidth: number;
}
export declare const defaultDisplayConfig: SectionDisplayConfig;
export declare class JlSection extends JlGraphic {
static Type: string;
lineGraphic: SectionGraphic;
labelGraphic: VectorText;
displayConfig: SectionDisplayConfig;
constructor();
setDisplayConfig(config: SectionDisplayConfig): void;
getVerticesList(): IPointData[];
getStartPoint(): IPointData;
getEndPoint(): IPointData;
doRepaint(): void;
get datas(): ISectionData;
get states(): ISectionState;
get linePoints(): IPointData[];
set linePoints(points: IPointData[]);
getConnectElement(port: DevicePort): {
g: Turnout | JlSection;
port: DevicePort;
} | undefined;
/** 获取拆分逻辑区段数据 */
getSplitPoints(count: number): IPointData[][];
/**
* * Relation处理考虑按不同区段类型分别处理或交子类处理后导出子类
*
*
*/
buildRelation(): void;
saveRelations(): void;
loadRelations(): void;
}
export declare class SectionTemplate extends JlGraphicTemplate<JlSection> {
isCurve: boolean;
segmentsCount: number;
constructor(dataTemplate: ISectionData, stateTemplate?: ISectionState);
new(): JlSection;
}