Merge branch 'master' of https://git.code.tencent.com/jl-framework/rt-graphic-component
This commit is contained in:
commit
0567dadd3e
9
components/packages/Platform/GPPlatform.d.ts
vendored
9
components/packages/Platform/GPPlatform.d.ts
vendored
@ -1,10 +1,13 @@
|
|||||||
import { GraphicState } from 'jl-graphic';
|
import { GraphicState } from 'jl-graphic';
|
||||||
import { JlPlatform } from './JlPlatform';
|
import { JlPlatform } from './common/JlPlatform';
|
||||||
export interface IBeiJingPlatformState extends GraphicState {
|
export interface IGPPlatformState extends GraphicState {
|
||||||
id?: number;
|
id?: number;
|
||||||
}
|
}
|
||||||
export declare class GPPlatform extends JlPlatform {
|
export declare class GPPlatform extends JlPlatform {
|
||||||
constructor();
|
constructor();
|
||||||
get states(): IBeiJingPlatformState;
|
get states(): IGPPlatformState;
|
||||||
doRepaint(): void;
|
doRepaint(): void;
|
||||||
|
buildRelation(): void;
|
||||||
|
saveRelations(): void;
|
||||||
|
loadRelations(): void;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { GPConsts } from './PlatformConfig.js';
|
import { GPConsts } from './common/PlatformConfig.js';
|
||||||
import { JlPlatform } from './JlPlatform.js';
|
import { JlPlatform } from './common/JlPlatform.js';
|
||||||
|
|
||||||
class GPPlatform extends JlPlatform {
|
class GPPlatform extends JlPlatform {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -12,6 +12,15 @@ class GPPlatform extends JlPlatform {
|
|||||||
this.rectGraphic.stateFillColor = GPConsts.noTrainStop;
|
this.rectGraphic.stateFillColor = GPConsts.noTrainStop;
|
||||||
super.draw();
|
super.draw();
|
||||||
}
|
}
|
||||||
|
buildRelation() {
|
||||||
|
super.buildCommonRelation();
|
||||||
|
}
|
||||||
|
saveRelations() {
|
||||||
|
super.saveCommonRelations();
|
||||||
|
}
|
||||||
|
loadRelations() {
|
||||||
|
super.loadCommonRelations();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { GPPlatform };
|
export { GPPlatform };
|
||||||
|
5
components/packages/Platform/THPlatform.d.ts
vendored
5
components/packages/Platform/THPlatform.d.ts
vendored
@ -1,5 +1,5 @@
|
|||||||
import { GraphicState } from 'jl-graphic';
|
import { GraphicState } from 'jl-graphic';
|
||||||
import { JlPlatform, DoorCodeLozenge } from './JlPlatform';
|
import { JlPlatform, DoorCodeLozenge } from './common/JlPlatform';
|
||||||
export interface ITHPlatformState extends GraphicState {
|
export interface ITHPlatformState extends GraphicState {
|
||||||
get emergstop(): boolean;
|
get emergstop(): boolean;
|
||||||
set emergstop(v: boolean);
|
set emergstop(v: boolean);
|
||||||
@ -41,4 +41,7 @@ export declare class THPlatform extends JlPlatform {
|
|||||||
constructor();
|
constructor();
|
||||||
get states(): ITHPlatformState;
|
get states(): ITHPlatformState;
|
||||||
doRepaint(): void;
|
doRepaint(): void;
|
||||||
|
buildRelation(): void;
|
||||||
|
saveRelations(): void;
|
||||||
|
loadRelations(): void;
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import { THConsts } from './PlatformConfig.js';
|
import { THConsts } from './common/PlatformConfig.js';
|
||||||
import { JlPlatform, DoorCodeLozenge } from './JlPlatform.js';
|
import { JlPlatform, DoorCodeLozenge } from './common/JlPlatform.js';
|
||||||
import { StyleType } from '../../common/common.js';
|
import { THStation } from '../Station/THStation.js';
|
||||||
|
|
||||||
class THPlatform extends JlPlatform {
|
class THPlatform extends JlPlatform {
|
||||||
doorCodeLozenge;
|
doorCodeLozenge;
|
||||||
constructor() {
|
constructor() {
|
||||||
super(THConsts);
|
super(THConsts);
|
||||||
this.doorCodeLozenge = new DoorCodeLozenge(StyleType.TH);
|
this.doorCodeLozenge = new DoorCodeLozenge(THConsts);
|
||||||
this.addChild(this.doorCodeLozenge);
|
this.addChild(this.doorCodeLozenge);
|
||||||
}
|
}
|
||||||
get states() {
|
get states() {
|
||||||
@ -20,15 +20,15 @@ class THPlatform extends JlPlatform {
|
|||||||
if (this.states.upSkipstop || this.states.downSkipstop) {
|
if (this.states.upSkipstop || this.states.downSkipstop) {
|
||||||
this.rectGraphic.stateFillColor = THConsts.trainJump;
|
this.rectGraphic.stateFillColor = THConsts.trainJump;
|
||||||
}
|
}
|
||||||
/* const station = this.getGraphicApp().queryStore.queryByCodeAndType<Station>(
|
const station = this.getGraphicApp().queryStore.queryByCodeAndType(this.states.rtuId > 9
|
||||||
this.states.rtuId > 9 ? '' + this.states.rtuId : '0' + this.states.rtuId,
|
? '' + this.states.rtuId
|
||||||
Station.Type
|
: '0' + this.states.rtuId, THStation.Type);
|
||||||
); */
|
|
||||||
const doorGraphic = this.doorCodeLozenge.doorGraphic;
|
const doorGraphic = this.doorCodeLozenge.doorGraphic;
|
||||||
doorGraphic.stateFillColor = THConsts.doorGraphic.doorGreen;
|
doorGraphic.stateFillColor = THConsts.doorGraphic.doorGreen;
|
||||||
/* if (!!station?.states.ipRtuStusDown) {
|
if (!!station?.states.ipRtuStusDown) {
|
||||||
doorGraphic.stateFillColor = THConsts.doorGraphic.doorBlue;
|
doorGraphic.stateFillColor = THConsts.doorGraphic.doorBlue;
|
||||||
} */ if (this.states.psdCut) {
|
}
|
||||||
|
else if (this.states.psdCut) {
|
||||||
doorGraphic.stateFillColor = THConsts.doorGraphic.doorRed;
|
doorGraphic.stateFillColor = THConsts.doorGraphic.doorRed;
|
||||||
}
|
}
|
||||||
super.draw();
|
super.draw();
|
||||||
@ -94,6 +94,15 @@ class THPlatform extends JlPlatform {
|
|||||||
codeGraphic.stopTime.text = this.states.stopTime;
|
codeGraphic.stopTime.text = this.states.stopTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
buildRelation() {
|
||||||
|
super.buildCommonRelation();
|
||||||
|
}
|
||||||
|
saveRelations() {
|
||||||
|
super.saveCommonRelations();
|
||||||
|
}
|
||||||
|
loadRelations() {
|
||||||
|
super.loadCommonRelations();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { THPlatform };
|
export { THPlatform };
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { JlGraphic, VectorText } from 'jl-graphic';
|
import { JlGraphic, VectorText } from 'jl-graphic';
|
||||||
import { Container, Graphics } from 'pixi.js';
|
import { Container, Graphics } from 'pixi.js';
|
||||||
import { IPlatformData, PlatformConstsConfig } from './PlatformConfig';
|
import { IPlatformData, PlatformConstsConfig } from './PlatformConfig';
|
||||||
import { StyleType } from 'common/common';
|
|
||||||
declare class RectGraphic extends Container {
|
declare class RectGraphic extends Container {
|
||||||
rect: Graphics;
|
rect: Graphics;
|
||||||
stateFillColor?: string;
|
stateFillColor?: string;
|
||||||
@ -34,12 +33,11 @@ declare class LozengeGraphic extends Container {
|
|||||||
clear(): void;
|
clear(): void;
|
||||||
}
|
}
|
||||||
export declare class DoorCodeLozenge extends Container {
|
export declare class DoorCodeLozenge extends Container {
|
||||||
private styleType;
|
|
||||||
private platformConsts;
|
private platformConsts;
|
||||||
doorGraphic: DoorGraphic;
|
doorGraphic: DoorGraphic;
|
||||||
lozengeGraphic: LozengeGraphic;
|
lozengeGraphic: LozengeGraphic;
|
||||||
codeGraphic: CodeGraphic;
|
codeGraphic: CodeGraphic;
|
||||||
constructor(styleType: StyleType);
|
constructor(platformConsts: PlatformConstsConfig);
|
||||||
draw(hasDoor: boolean, direction: string): void;
|
draw(hasDoor: boolean, direction: string): void;
|
||||||
}
|
}
|
||||||
export declare abstract class JlPlatform extends JlGraphic {
|
export declare abstract class JlPlatform extends JlGraphic {
|
||||||
@ -50,5 +48,8 @@ export declare abstract class JlPlatform extends JlGraphic {
|
|||||||
get datas(): IPlatformData;
|
get datas(): IPlatformData;
|
||||||
get code(): string;
|
get code(): string;
|
||||||
draw(): void;
|
draw(): void;
|
||||||
|
buildCommonRelation(): void;
|
||||||
|
saveCommonRelations(): void;
|
||||||
|
loadCommonRelations(): void;
|
||||||
}
|
}
|
||||||
export {};
|
export {};
|
@ -1,6 +1,7 @@
|
|||||||
import { calculateMirrorPoint, JlGraphic, getRectangleCenter, VectorText } from 'jl-graphic';
|
import { calculateMirrorPoint, JlGraphic, distance2, getRectangleCenter, VectorText } from 'jl-graphic';
|
||||||
import { Container, Point, Graphics, Color, Rectangle } from 'pixi.js';
|
import { Container, Point, Graphics, Color, Rectangle } from 'pixi.js';
|
||||||
import { platformConstsMap } from './PlatformConfig.js';
|
import { JlSection } from '../../Section/common/Section.js';
|
||||||
|
import { JlStation } from '../../Station/common/JlStation.js';
|
||||||
|
|
||||||
//子元素--矩形
|
//子元素--矩形
|
||||||
class RectGraphic extends Container {
|
class RectGraphic extends Container {
|
||||||
@ -157,15 +158,13 @@ class LozengeGraphic extends Container {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
class DoorCodeLozenge extends Container {
|
class DoorCodeLozenge extends Container {
|
||||||
styleType;
|
|
||||||
platformConsts;
|
platformConsts;
|
||||||
doorGraphic;
|
doorGraphic;
|
||||||
lozengeGraphic;
|
lozengeGraphic;
|
||||||
codeGraphic;
|
codeGraphic;
|
||||||
constructor(styleType) {
|
constructor(platformConsts) {
|
||||||
super();
|
super();
|
||||||
this.styleType = styleType;
|
this.platformConsts = platformConsts;
|
||||||
this.platformConsts = platformConstsMap.get(this.styleType);
|
|
||||||
this.doorGraphic = new DoorGraphic();
|
this.doorGraphic = new DoorGraphic();
|
||||||
this.addChild(this.doorGraphic);
|
this.addChild(this.doorGraphic);
|
||||||
this.lozengeGraphic = new LozengeGraphic();
|
this.lozengeGraphic = new LozengeGraphic();
|
||||||
@ -228,6 +227,56 @@ class JlPlatform extends JlGraphic {
|
|||||||
draw() {
|
draw() {
|
||||||
this.rectGraphic.draw(this.platformConsts);
|
this.rectGraphic.draw(this.platformConsts);
|
||||||
}
|
}
|
||||||
|
buildCommonRelation() {
|
||||||
|
const stationas = this.queryStore.queryByType(JlStation.Type);
|
||||||
|
for (let i = 0; i < stationas.length; i++) {
|
||||||
|
const sP = stationas[i].localBoundsToCanvasPoints();
|
||||||
|
if (this.x > sP[0].x && this.x < sP[1].x) {
|
||||||
|
this.relationManage.addRelation(this, stationas[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const sections = this.queryStore.queryByType(JlSection.Type);
|
||||||
|
const minDistanceRefSections = [];
|
||||||
|
sections.forEach((section) => {
|
||||||
|
const sP = section.localBoundsToCanvasPoints();
|
||||||
|
if (this.x > sP[0].x && this.x < sP[1].x) {
|
||||||
|
minDistanceRefSections.push(section);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (minDistanceRefSections) {
|
||||||
|
const refSection = minDistanceRefSections.reduce((prev, cur) => {
|
||||||
|
return distance2(prev.localToCanvasPoint(getRectangleCenter(prev.getLocalBounds())), this.position) >
|
||||||
|
distance2(cur.localToCanvasPoint(getRectangleCenter(cur.getLocalBounds())), this.position)
|
||||||
|
? cur
|
||||||
|
: prev;
|
||||||
|
});
|
||||||
|
this.relationManage.deleteRelationOfGraphicAndOtherType(this, JlSection.Type);
|
||||||
|
this.relationManage.addRelation(this, refSection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
saveCommonRelations() {
|
||||||
|
const refStation = this.relationManage
|
||||||
|
.getRelationsOfGraphicAndOtherType(this, JlStation.Type)
|
||||||
|
.map((relation) => relation.getOtherGraphic(this).datas.id);
|
||||||
|
if (refStation.length) {
|
||||||
|
this.datas.refStation = refStation[0];
|
||||||
|
}
|
||||||
|
const refSection = this.relationManage
|
||||||
|
.getRelationsOfGraphicAndOtherType(this, JlSection.Type)
|
||||||
|
.map((relation) => relation.getOtherGraphic(this).datas.id);
|
||||||
|
if (refSection.length) {
|
||||||
|
this.datas.refSection = refSection[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
loadCommonRelations() {
|
||||||
|
if (this.datas.refStation) {
|
||||||
|
this.relationManage.addRelation(this, this.queryStore.queryById(this.datas.refStation));
|
||||||
|
}
|
||||||
|
if (this.datas.refSection) {
|
||||||
|
this.relationManage.addRelation(this, this.queryStore.queryById(this.datas.refSection));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { DoorCodeLozenge, JlPlatform };
|
export { DoorCodeLozenge, JlPlatform };
|
@ -1,4 +1,3 @@
|
|||||||
import { StyleType } from 'common/common';
|
|
||||||
import { GraphicData } from 'jl-graphic';
|
import { GraphicData } from 'jl-graphic';
|
||||||
export interface PlatformConstsConfig {
|
export interface PlatformConstsConfig {
|
||||||
width: number;
|
width: number;
|
||||||
@ -69,7 +68,6 @@ export declare const THConsts: {
|
|||||||
doorPlatformSpacing: number;
|
doorPlatformSpacing: number;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
export declare const platformConstsMap: Map<StyleType, PlatformConstsConfig>;
|
|
||||||
declare enum TypeOfPlatform {
|
declare enum TypeOfPlatform {
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
up = 1,
|
up = 1,
|
@ -1,5 +1,3 @@
|
|||||||
import { StyleType } from '../../common/common.js';
|
|
||||||
|
|
||||||
const GPConsts = {
|
const GPConsts = {
|
||||||
width: 90,
|
width: 90,
|
||||||
height: 20,
|
height: 20,
|
||||||
@ -37,10 +35,6 @@ const THConsts = {
|
|||||||
doorPlatformSpacing: 10,
|
doorPlatformSpacing: 10,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const platformConstsMap = new Map([
|
|
||||||
[StyleType.GP, GPConsts],
|
|
||||||
[StyleType.TH, THConsts],
|
|
||||||
]);
|
|
||||||
var TypeOfPlatform;
|
var TypeOfPlatform;
|
||||||
(function (TypeOfPlatform) {
|
(function (TypeOfPlatform) {
|
||||||
TypeOfPlatform[TypeOfPlatform["Unknown"] = 0] = "Unknown";
|
TypeOfPlatform[TypeOfPlatform["Unknown"] = 0] = "Unknown";
|
||||||
@ -48,4 +42,4 @@ var TypeOfPlatform;
|
|||||||
TypeOfPlatform[TypeOfPlatform["down"] = 2] = "down";
|
TypeOfPlatform[TypeOfPlatform["down"] = 2] = "down";
|
||||||
})(TypeOfPlatform || (TypeOfPlatform = {}));
|
})(TypeOfPlatform || (TypeOfPlatform = {}));
|
||||||
|
|
||||||
export { GPConsts, THConsts, platformConstsMap };
|
export { GPConsts, THConsts };
|
@ -1,6 +1,6 @@
|
|||||||
import { GraphicDrawAssistant, GraphicInteractionPlugin, AbsorbableLine } from 'jl-graphic';
|
import { GraphicDrawAssistant, GraphicInteractionPlugin, AbsorbableLine } from 'jl-graphic';
|
||||||
import { JlPlatform } from './JlPlatform.js';
|
import { JlPlatform } from './JlPlatform.js';
|
||||||
import { StyleType } from '../../common/common.js';
|
import { StyleType } from '../../../common/common.js';
|
||||||
|
|
||||||
class PlatformDraw extends GraphicDrawAssistant {
|
class PlatformDraw extends GraphicDrawAssistant {
|
||||||
platformGraphic;
|
platformGraphic;
|
@ -1,13 +1,13 @@
|
|||||||
import { JlGraphicTemplate } from 'jl-graphic';
|
import { JlGraphicTemplate } from 'jl-graphic';
|
||||||
import { JlPlatform } from './JlPlatform';
|
import { JlPlatform } from './JlPlatform';
|
||||||
import { IPlatformData } from './PlatformConfig';
|
import { IPlatformData } from './PlatformConfig';
|
||||||
import { ITHPlatformState } from './THPlatform';
|
import { ITHPlatformState } from '../THPlatform';
|
||||||
import { IBeiJingPlatformState } from './GPPlatform';
|
import { IGPPlatformState } from '../GPPlatform';
|
||||||
import { StyleType } from 'common/common';
|
import { StyleType } from 'common/common';
|
||||||
export declare class PlatformTemplate extends JlGraphicTemplate<JlPlatform> {
|
export declare class PlatformTemplate extends JlGraphicTemplate<JlPlatform> {
|
||||||
hasdoor?: boolean;
|
hasdoor?: boolean;
|
||||||
direction?: string;
|
direction?: string;
|
||||||
styleType: StyleType;
|
styleType: StyleType;
|
||||||
constructor(dataTemplate: IPlatformData, stateTemplate: ITHPlatformState | IBeiJingPlatformState, styleType: StyleType);
|
constructor(dataTemplate: IPlatformData, stateTemplate: ITHPlatformState | IGPPlatformState, styleType: StyleType);
|
||||||
new(): JlPlatform;
|
new(): JlPlatform;
|
||||||
}
|
}
|
@ -1,8 +1,8 @@
|
|||||||
import { JlGraphicTemplate } from 'jl-graphic';
|
import { JlGraphicTemplate } from 'jl-graphic';
|
||||||
import { JlPlatform } from './JlPlatform.js';
|
import { JlPlatform } from './JlPlatform.js';
|
||||||
import { THPlatform } from './THPlatform.js';
|
import { THPlatform } from '../THPlatform.js';
|
||||||
import { GPPlatform } from './GPPlatform.js';
|
import { GPPlatform } from '../GPPlatform.js';
|
||||||
import { StyleType } from '../../common/common.js';
|
import { StyleType } from '../../../common/common.js';
|
||||||
|
|
||||||
class PlatformTemplate extends JlGraphicTemplate {
|
class PlatformTemplate extends JlGraphicTemplate {
|
||||||
hasdoor;
|
hasdoor;
|
5
components/packages/Section/GPSection.d.ts
vendored
Normal file
5
components/packages/Section/GPSection.d.ts
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import { JlSection as SectionBase } from './common/Section';
|
||||||
|
export declare class Section extends SectionBase {
|
||||||
|
constructor();
|
||||||
|
}
|
||||||
|
export { SectionTemplate } from './common/Section';
|
@ -1,12 +1,12 @@
|
|||||||
import { Section as Section$1 } from '../common/Section.js';
|
import { JlSection } from './common/Section.js';
|
||||||
export { SectionTemplate } from '../common/Section.js';
|
export { SectionTemplate } from './common/Section.js';
|
||||||
|
|
||||||
const displayConfig = {
|
const displayConfig = {
|
||||||
lineColor: '#5578b6',
|
lineColor: '#5578b6',
|
||||||
occupiedColor: '#f00',
|
occupiedColor: '#f00',
|
||||||
lineWidth: 5,
|
lineWidth: 5,
|
||||||
};
|
};
|
||||||
class Section extends Section$1 {
|
class Section extends JlSection {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.setDisplayConfig(displayConfig);
|
this.setDisplayConfig(displayConfig);
|
@ -1,5 +0,0 @@
|
|||||||
import { Section as SectionBase } from '../common/Section';
|
|
||||||
export declare class Section extends SectionBase {
|
|
||||||
constructor();
|
|
||||||
}
|
|
||||||
export { SectionTemplate } from '../common/Section';
|
|
@ -35,7 +35,7 @@ export interface SectionDisplayConfig {
|
|||||||
lineWidth: number;
|
lineWidth: number;
|
||||||
}
|
}
|
||||||
export declare const defaultDisplayConfig: SectionDisplayConfig;
|
export declare const defaultDisplayConfig: SectionDisplayConfig;
|
||||||
export declare class Section extends JlGraphic {
|
export declare class JlSection extends JlGraphic {
|
||||||
static Type: string;
|
static Type: string;
|
||||||
lineGraphic: SectionGraphic;
|
lineGraphic: SectionGraphic;
|
||||||
labelGraphic: VectorText;
|
labelGraphic: VectorText;
|
||||||
@ -51,7 +51,7 @@ export declare class Section extends JlGraphic {
|
|||||||
get linePoints(): IPointData[];
|
get linePoints(): IPointData[];
|
||||||
set linePoints(points: IPointData[]);
|
set linePoints(points: IPointData[]);
|
||||||
getConnectElement(port: DevicePort): {
|
getConnectElement(port: DevicePort): {
|
||||||
g: Turnout | Section;
|
g: Turnout | JlSection;
|
||||||
port: DevicePort;
|
port: DevicePort;
|
||||||
} | undefined;
|
} | undefined;
|
||||||
/** 获取拆分逻辑区段数据 */
|
/** 获取拆分逻辑区段数据 */
|
||||||
@ -65,9 +65,9 @@ export declare class Section extends JlGraphic {
|
|||||||
saveRelations(): void;
|
saveRelations(): void;
|
||||||
loadRelations(): void;
|
loadRelations(): void;
|
||||||
}
|
}
|
||||||
export declare class SectionTemplate extends JlGraphicTemplate<Section> {
|
export declare class SectionTemplate extends JlGraphicTemplate<JlSection> {
|
||||||
isCurve: boolean;
|
isCurve: boolean;
|
||||||
segmentsCount: number;
|
segmentsCount: number;
|
||||||
constructor(dataTemplate: ISectionData, stateTemplate?: ISectionState);
|
constructor(dataTemplate: ISectionData, stateTemplate?: ISectionState);
|
||||||
new(): Section;
|
new(): JlSection;
|
||||||
}
|
}
|
||||||
|
@ -18,13 +18,13 @@ const defaultDisplayConfig = {
|
|||||||
occupiedColor: '#f00',
|
occupiedColor: '#f00',
|
||||||
lineWidth: 5,
|
lineWidth: 5,
|
||||||
};
|
};
|
||||||
let Section$1 = class Section extends JlGraphic {
|
class JlSection extends JlGraphic {
|
||||||
static Type = 'Section';
|
static Type = 'Section';
|
||||||
lineGraphic;
|
lineGraphic;
|
||||||
labelGraphic;
|
labelGraphic;
|
||||||
displayConfig = defaultDisplayConfig;
|
displayConfig = defaultDisplayConfig;
|
||||||
constructor() {
|
constructor() {
|
||||||
super(Section.Type);
|
super(JlSection.Type);
|
||||||
this.lineGraphic = new SectionGraphic();
|
this.lineGraphic = new SectionGraphic();
|
||||||
this.labelGraphic = new VectorText('');
|
this.labelGraphic = new VectorText('');
|
||||||
this.labelGraphic.setVectorFontSize(14);
|
this.labelGraphic.setVectorFontSize(14);
|
||||||
@ -96,7 +96,7 @@ let Section$1 = class Section extends JlGraphic {
|
|||||||
const relation = this.relationManage
|
const relation = this.relationManage
|
||||||
.getRelationsOfGraphic(this)
|
.getRelationsOfGraphic(this)
|
||||||
.find((relation) => relation.getRelationParam(this).getParam() === port &&
|
.find((relation) => relation.getRelationParam(this).getParam() === port &&
|
||||||
(relation.getOtherGraphic(this) instanceof Section ||
|
(relation.getOtherGraphic(this) instanceof JlSection ||
|
||||||
relation.getOtherGraphic(this) instanceof Turnout));
|
relation.getOtherGraphic(this) instanceof Turnout));
|
||||||
if (!relation) {
|
if (!relation) {
|
||||||
return;
|
return;
|
||||||
@ -146,9 +146,9 @@ let Section$1 = class Section extends JlGraphic {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
buildRelation() {
|
buildRelation() {
|
||||||
this.relationManage.deleteRelationOfGraphicAndOtherType(this, Section.Type);
|
this.relationManage.deleteRelationOfGraphicAndOtherType(this, JlSection.Type);
|
||||||
if (this.datas.sectionType === SectionType.Physical) {
|
if (this.datas.sectionType === SectionType.Physical) {
|
||||||
this.queryStore.queryByType(Section.Type).forEach((section) => {
|
this.queryStore.queryByType(JlSection.Type).forEach((section) => {
|
||||||
if (section.id === this.id)
|
if (section.id === this.id)
|
||||||
return;
|
return;
|
||||||
let param = [];
|
let param = [];
|
||||||
@ -174,7 +174,7 @@ let Section$1 = class Section extends JlGraphic {
|
|||||||
const paRelation = this.relationManage
|
const paRelation = this.relationManage
|
||||||
.getRelationsOfGraphic(this)
|
.getRelationsOfGraphic(this)
|
||||||
.find((relation) => relation.getRelationParam(this).param === DevicePort.A &&
|
.find((relation) => relation.getRelationParam(this).param === DevicePort.A &&
|
||||||
(relation.getOtherGraphic(this) instanceof Section ||
|
(relation.getOtherGraphic(this) instanceof JlSection ||
|
||||||
relation.getOtherGraphic(this) instanceof Turnout));
|
relation.getOtherGraphic(this) instanceof Turnout));
|
||||||
const paDevice = paRelation?.getOtherGraphic(this);
|
const paDevice = paRelation?.getOtherGraphic(this);
|
||||||
if (paDevice) {
|
if (paDevice) {
|
||||||
@ -186,7 +186,7 @@ let Section$1 = class Section extends JlGraphic {
|
|||||||
const pbRelation = this.relationManage
|
const pbRelation = this.relationManage
|
||||||
.getRelationsOfGraphic(this)
|
.getRelationsOfGraphic(this)
|
||||||
.find((relation) => relation.getRelationParam(this).param === DevicePort.B &&
|
.find((relation) => relation.getRelationParam(this).param === DevicePort.B &&
|
||||||
(relation.getOtherGraphic(this) instanceof Section ||
|
(relation.getOtherGraphic(this) instanceof JlSection ||
|
||||||
relation.getOtherGraphic(this) instanceof Turnout));
|
relation.getOtherGraphic(this) instanceof Turnout));
|
||||||
const pbDevice = pbRelation?.getOtherGraphic(this);
|
const pbDevice = pbRelation?.getOtherGraphic(this);
|
||||||
if (pbDevice) {
|
if (pbDevice) {
|
||||||
@ -217,22 +217,22 @@ let Section$1 = class Section extends JlGraphic {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
class SectionTemplate extends JlGraphicTemplate {
|
class SectionTemplate extends JlGraphicTemplate {
|
||||||
isCurve = false;
|
isCurve = false;
|
||||||
segmentsCount = 10;
|
segmentsCount = 10;
|
||||||
constructor(dataTemplate, stateTemplate) {
|
constructor(dataTemplate, stateTemplate) {
|
||||||
super(Section$1.Type, {
|
super(JlSection.Type, {
|
||||||
dataTemplate,
|
dataTemplate,
|
||||||
stateTemplate,
|
stateTemplate,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
new() {
|
new() {
|
||||||
const section = new Section$1();
|
const section = new JlSection();
|
||||||
section.loadData(this.datas);
|
section.loadData(this.datas);
|
||||||
section.loadState(this.states);
|
section.loadState(this.states);
|
||||||
return section;
|
return section;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Section$1 as Section, SectionTemplate, SectionType, defaultDisplayConfig };
|
export { JlSection, SectionTemplate, SectionType, defaultDisplayConfig };
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { GraphicDrawAssistant, GraphicInteractionPlugin, IDrawApp, IGraphicApp, JlGraphic, KeyListener, MenuItemOptions } from 'jl-graphic';
|
import { GraphicDrawAssistant, GraphicInteractionPlugin, IDrawApp, IGraphicApp, JlGraphic, KeyListener, MenuItemOptions } from 'jl-graphic';
|
||||||
import { ISectionData, SectionTemplate } from './Section';
|
import { ISectionData, SectionTemplate } from './Section';
|
||||||
import { Point, Graphics, type FederatedMouseEvent, type IHitArea, type DisplayObject } from 'pixi.js';
|
import { Point, Graphics, type FederatedMouseEvent, type IHitArea, type DisplayObject } from 'pixi.js';
|
||||||
import { Section } from '../bjrtss/Section';
|
import { Section } from '../GPSection';
|
||||||
export declare class SectionDraw extends GraphicDrawAssistant<SectionTemplate, ISectionData> {
|
export declare class SectionDraw extends GraphicDrawAssistant<SectionTemplate, ISectionData> {
|
||||||
points: Point[];
|
points: Point[];
|
||||||
graphic: Graphics;
|
graphic: Graphics;
|
||||||
|
@ -2,7 +2,7 @@ import { ContextMenu, GraphicDrawAssistant, KeyListener, calculateMirrorPoint, c
|
|||||||
import { SectionType, defaultDisplayConfig } from './Section.js';
|
import { SectionType, defaultDisplayConfig } from './Section.js';
|
||||||
import { Graphics, Point } from 'pixi.js';
|
import { Graphics, Point } from 'pixi.js';
|
||||||
import { Turnout } from '../../Turnout/Turnout.js';
|
import { Turnout } from '../../Turnout/Turnout.js';
|
||||||
import { Section } from '../bjrtss/Section.js';
|
import { Section } from '../GPSection.js';
|
||||||
|
|
||||||
class SectionDraw extends GraphicDrawAssistant {
|
class SectionDraw extends GraphicDrawAssistant {
|
||||||
points = [];
|
points = [];
|
||||||
|
2
components/packages/Station/GPStation.d.ts
vendored
2
components/packages/Station/GPStation.d.ts
vendored
@ -1,5 +1,5 @@
|
|||||||
import { GraphicState } from 'jl-graphic';
|
import { GraphicState } from 'jl-graphic';
|
||||||
import { JlStation } from './JlStation';
|
import { JlStation } from './common/JlStation';
|
||||||
export interface IGPStationState extends GraphicState {
|
export interface IGPStationState extends GraphicState {
|
||||||
id: number;
|
id: number;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { JlStation } from './JlStation.js';
|
import { JlStation } from './common/JlStation.js';
|
||||||
import { StyleType } from '../../common/common.js';
|
import { StyleType } from '../../common/common.js';
|
||||||
|
|
||||||
class GPStation extends JlStation {
|
class GPStation extends JlStation {
|
||||||
|
2
components/packages/Station/THStation.d.ts
vendored
2
components/packages/Station/THStation.d.ts
vendored
@ -1,5 +1,5 @@
|
|||||||
import { GraphicState } from 'jl-graphic';
|
import { GraphicState } from 'jl-graphic';
|
||||||
import { ConstrolGraphic, JlStation } from './JlStation';
|
import { ConstrolGraphic, JlStation } from './common/JlStation';
|
||||||
export interface ITHStationState extends GraphicState {
|
export interface ITHStationState extends GraphicState {
|
||||||
get ipRtuStusDown(): boolean;
|
get ipRtuStusDown(): boolean;
|
||||||
set ipRtuStusDown(v: boolean);
|
set ipRtuStusDown(v: boolean);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { JlStation, ConstrolGraphic } from './JlStation.js';
|
import { JlStation, ConstrolGraphic } from './common/JlStation.js';
|
||||||
import { THConsts } from './StationConfig.js';
|
import { THConsts } from './common/StationConfig.js';
|
||||||
import { StyleType } from '../../common/common.js';
|
import { StyleType } from '../../common/common.js';
|
||||||
|
|
||||||
class THStation extends JlStation {
|
class THStation extends JlStation {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Container, Point, Graphics, Color } from 'pixi.js';
|
import { Container, Point, Graphics, Color } from 'pixi.js';
|
||||||
import { VectorText, JlGraphic } from 'jl-graphic';
|
import { VectorText, JlGraphic } from 'jl-graphic';
|
||||||
import { stationConstsMap } from './StationConfig.js';
|
import { stationConstsMap } from './StationConfig.js';
|
||||||
import { StyleType } from '../../common/common.js';
|
import { StyleType } from '../../../common/common.js';
|
||||||
|
|
||||||
class ConstrolGraphic extends Container {
|
class ConstrolGraphic extends Container {
|
||||||
constrolConfig;
|
constrolConfig;
|
@ -1,4 +1,4 @@
|
|||||||
import { StyleType } from '../../common/common.js';
|
import { StyleType } from '../../../common/common.js';
|
||||||
|
|
||||||
const GPConsts = {
|
const GPConsts = {
|
||||||
codeColor: '0xF48815',
|
codeColor: '0xF48815',
|
@ -1,6 +1,6 @@
|
|||||||
import { GraphicDrawAssistant, GraphicInteractionPlugin, AbsorbableLine } from 'jl-graphic';
|
import { GraphicDrawAssistant, GraphicInteractionPlugin, AbsorbableLine } from 'jl-graphic';
|
||||||
import { JlStation } from './JlStation.js';
|
import { JlStation } from './JlStation.js';
|
||||||
import { StyleType } from '../../common/common.js';
|
import { StyleType } from '../../../common/common.js';
|
||||||
|
|
||||||
class StationDraw extends GraphicDrawAssistant {
|
class StationDraw extends GraphicDrawAssistant {
|
||||||
codeGraph;
|
codeGraph;
|
@ -1,8 +1,8 @@
|
|||||||
import { JlGraphicTemplate } from 'jl-graphic';
|
import { JlGraphicTemplate } from 'jl-graphic';
|
||||||
import { JlStation } from './JlStation';
|
import { JlStation } from './JlStation';
|
||||||
import { IStationData } from './StationConfig';
|
import { IStationData } from './StationConfig';
|
||||||
import { ITHStationState } from './THStation';
|
import { ITHStationState } from '../THStation';
|
||||||
import { IGPStationState } from './GPStation';
|
import { IGPStationState } from '../GPStation';
|
||||||
import { StyleType } from 'common/common';
|
import { StyleType } from 'common/common';
|
||||||
export declare class StationTemplate extends JlGraphicTemplate<JlStation> {
|
export declare class StationTemplate extends JlGraphicTemplate<JlStation> {
|
||||||
hasControl?: boolean;
|
hasControl?: boolean;
|
@ -1,8 +1,8 @@
|
|||||||
import { JlGraphicTemplate } from 'jl-graphic';
|
import { JlGraphicTemplate } from 'jl-graphic';
|
||||||
import { JlStation } from './JlStation.js';
|
import { JlStation } from './JlStation.js';
|
||||||
import { THStation } from './THStation.js';
|
import { THStation } from '../THStation.js';
|
||||||
import { GPStation } from './GPStation.js';
|
import { GPStation } from '../GPStation.js';
|
||||||
import { StyleType } from '../../common/common.js';
|
import { StyleType } from '../../../common/common.js';
|
||||||
|
|
||||||
class StationTemplate extends JlGraphicTemplate {
|
class StationTemplate extends JlGraphicTemplate {
|
||||||
hasControl;
|
hasControl;
|
@ -1,8 +1,8 @@
|
|||||||
import { GraphicState } from 'jl-graphic';
|
import { GraphicState } from 'jl-graphic';
|
||||||
import { GPConsts } from './PlatformConfig';
|
import { GPConsts } from './common/PlatformConfig';
|
||||||
import { JlPlatform } from './JlPlatform';
|
import { JlPlatform } from './common/JlPlatform';
|
||||||
|
|
||||||
export interface IBeiJingPlatformState extends GraphicState {
|
export interface IGPPlatformState extends GraphicState {
|
||||||
id?: number;
|
id?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10,11 +10,20 @@ export class GPPlatform extends JlPlatform {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super(GPConsts);
|
super(GPConsts);
|
||||||
}
|
}
|
||||||
get states(): IBeiJingPlatformState {
|
get states(): IGPPlatformState {
|
||||||
return this.getStates<IBeiJingPlatformState>();
|
return this.getStates<IGPPlatformState>();
|
||||||
}
|
}
|
||||||
doRepaint(): void {
|
doRepaint(): void {
|
||||||
this.rectGraphic.stateFillColor = GPConsts.noTrainStop;
|
this.rectGraphic.stateFillColor = GPConsts.noTrainStop;
|
||||||
super.draw();
|
super.draw();
|
||||||
}
|
}
|
||||||
|
buildRelation() {
|
||||||
|
super.buildCommonRelation();
|
||||||
|
}
|
||||||
|
saveRelations() {
|
||||||
|
super.saveCommonRelations();
|
||||||
|
}
|
||||||
|
loadRelations() {
|
||||||
|
super.loadCommonRelations();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { GraphicState } from 'jl-graphic';
|
import { GraphicState } from 'jl-graphic';
|
||||||
import { THConsts } from './PlatformConfig';
|
import { THConsts } from './common/PlatformConfig';
|
||||||
import { JlPlatform, DoorCodeLozenge } from './JlPlatform';
|
import { JlPlatform, DoorCodeLozenge } from './common/JlPlatform';
|
||||||
import { StyleType } from 'common/common';
|
import { THStation } from '../Station/THStation';
|
||||||
|
|
||||||
export interface ITHPlatformState extends GraphicState {
|
export interface ITHPlatformState extends GraphicState {
|
||||||
get emergstop(): boolean; //紧急关闭
|
get emergstop(): boolean; //紧急关闭
|
||||||
@ -44,7 +44,7 @@ export class THPlatform extends JlPlatform {
|
|||||||
doorCodeLozenge: DoorCodeLozenge;
|
doorCodeLozenge: DoorCodeLozenge;
|
||||||
constructor() {
|
constructor() {
|
||||||
super(THConsts);
|
super(THConsts);
|
||||||
this.doorCodeLozenge = new DoorCodeLozenge(StyleType.TH);
|
this.doorCodeLozenge = new DoorCodeLozenge(THConsts);
|
||||||
this.addChild(this.doorCodeLozenge);
|
this.addChild(this.doorCodeLozenge);
|
||||||
}
|
}
|
||||||
get states(): ITHPlatformState {
|
get states(): ITHPlatformState {
|
||||||
@ -58,15 +58,18 @@ export class THPlatform extends JlPlatform {
|
|||||||
if (this.states.upSkipstop || this.states.downSkipstop) {
|
if (this.states.upSkipstop || this.states.downSkipstop) {
|
||||||
this.rectGraphic.stateFillColor = THConsts.trainJump;
|
this.rectGraphic.stateFillColor = THConsts.trainJump;
|
||||||
}
|
}
|
||||||
/* const station = this.getGraphicApp().queryStore.queryByCodeAndType<Station>(
|
const station =
|
||||||
this.states.rtuId > 9 ? '' + this.states.rtuId : '0' + this.states.rtuId,
|
this.getGraphicApp().queryStore.queryByCodeAndType<THStation>(
|
||||||
Station.Type
|
this.states.rtuId > 9
|
||||||
); */
|
? '' + this.states.rtuId
|
||||||
|
: '0' + this.states.rtuId,
|
||||||
|
THStation.Type,
|
||||||
|
);
|
||||||
const doorGraphic = this.doorCodeLozenge.doorGraphic;
|
const doorGraphic = this.doorCodeLozenge.doorGraphic;
|
||||||
doorGraphic.stateFillColor = THConsts.doorGraphic.doorGreen;
|
doorGraphic.stateFillColor = THConsts.doorGraphic.doorGreen;
|
||||||
/* if (!!station?.states.ipRtuStusDown) {
|
if (!!station?.states.ipRtuStusDown) {
|
||||||
doorGraphic.stateFillColor = THConsts.doorGraphic.doorBlue;
|
doorGraphic.stateFillColor = THConsts.doorGraphic.doorBlue;
|
||||||
} */ if (this.states.psdCut) {
|
} else if (this.states.psdCut) {
|
||||||
doorGraphic.stateFillColor = THConsts.doorGraphic.doorRed;
|
doorGraphic.stateFillColor = THConsts.doorGraphic.doorRed;
|
||||||
}
|
}
|
||||||
super.draw();
|
super.draw();
|
||||||
@ -135,4 +138,13 @@ export class THPlatform extends JlPlatform {
|
|||||||
codeGraphic.stopTime.text = this.states.stopTime;
|
codeGraphic.stopTime.text = this.states.stopTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
buildRelation() {
|
||||||
|
super.buildCommonRelation();
|
||||||
|
}
|
||||||
|
saveRelations() {
|
||||||
|
super.saveCommonRelations();
|
||||||
|
}
|
||||||
|
loadRelations() {
|
||||||
|
super.loadCommonRelations();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ import {
|
|||||||
JlGraphic,
|
JlGraphic,
|
||||||
VectorText,
|
VectorText,
|
||||||
calculateMirrorPoint,
|
calculateMirrorPoint,
|
||||||
|
distance2,
|
||||||
getRectangleCenter,
|
getRectangleCenter,
|
||||||
} from 'jl-graphic';
|
} from 'jl-graphic';
|
||||||
import { Container, Graphics, Rectangle, Color, Point } from 'pixi.js';
|
import { Container, Graphics, Rectangle, Color, Point } from 'pixi.js';
|
||||||
@ -11,9 +12,9 @@ import {
|
|||||||
IPlatformData,
|
IPlatformData,
|
||||||
LozengeConstsConfig,
|
LozengeConstsConfig,
|
||||||
PlatformConstsConfig,
|
PlatformConstsConfig,
|
||||||
platformConstsMap,
|
|
||||||
} from './PlatformConfig';
|
} from './PlatformConfig';
|
||||||
import { StyleType } from 'common/common';
|
import { JlSection } from '../../Section/common/Section';
|
||||||
|
import { JlStation } from '../../Station/common/JlStation';
|
||||||
|
|
||||||
//子元素--矩形
|
//子元素--矩形
|
||||||
class RectGraphic extends Container {
|
class RectGraphic extends Container {
|
||||||
@ -193,17 +194,13 @@ class LozengeGraphic extends Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class DoorCodeLozenge extends Container {
|
export class DoorCodeLozenge extends Container {
|
||||||
private styleType: StyleType;
|
|
||||||
private platformConsts: PlatformConstsConfig;
|
private platformConsts: PlatformConstsConfig;
|
||||||
doorGraphic: DoorGraphic;
|
doorGraphic: DoorGraphic;
|
||||||
lozengeGraphic: LozengeGraphic;
|
lozengeGraphic: LozengeGraphic;
|
||||||
codeGraphic: CodeGraphic;
|
codeGraphic: CodeGraphic;
|
||||||
constructor(styleType: StyleType) {
|
constructor(platformConsts: PlatformConstsConfig) {
|
||||||
super();
|
super();
|
||||||
this.styleType = styleType;
|
this.platformConsts = platformConsts;
|
||||||
this.platformConsts = platformConstsMap.get(
|
|
||||||
this.styleType,
|
|
||||||
) as PlatformConstsConfig;
|
|
||||||
this.doorGraphic = new DoorGraphic();
|
this.doorGraphic = new DoorGraphic();
|
||||||
this.addChild(this.doorGraphic);
|
this.addChild(this.doorGraphic);
|
||||||
this.lozengeGraphic = new LozengeGraphic();
|
this.lozengeGraphic = new LozengeGraphic();
|
||||||
@ -282,4 +279,69 @@ export abstract class JlPlatform extends JlGraphic {
|
|||||||
draw(): void {
|
draw(): void {
|
||||||
this.rectGraphic.draw(this.platformConsts);
|
this.rectGraphic.draw(this.platformConsts);
|
||||||
}
|
}
|
||||||
|
buildCommonRelation() {
|
||||||
|
const stationas = this.queryStore.queryByType<JlStation>(JlStation.Type);
|
||||||
|
for (let i = 0; i < stationas.length; i++) {
|
||||||
|
const sP = stationas[i].localBoundsToCanvasPoints();
|
||||||
|
if (this.x > sP[0].x && this.x < sP[1].x) {
|
||||||
|
this.relationManage.addRelation(this, stationas[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const sections = this.queryStore.queryByType<JlSection>(JlSection.Type);
|
||||||
|
const minDistanceRefSections: JlSection[] = [];
|
||||||
|
sections.forEach((section) => {
|
||||||
|
const sP = section.localBoundsToCanvasPoints();
|
||||||
|
if (this.x > sP[0].x && this.x < sP[1].x) {
|
||||||
|
minDistanceRefSections.push(section);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (minDistanceRefSections) {
|
||||||
|
const refSection = minDistanceRefSections.reduce((prev, cur) => {
|
||||||
|
return distance2(
|
||||||
|
prev.localToCanvasPoint(getRectangleCenter(prev.getLocalBounds())),
|
||||||
|
this.position,
|
||||||
|
) >
|
||||||
|
distance2(
|
||||||
|
cur.localToCanvasPoint(getRectangleCenter(cur.getLocalBounds())),
|
||||||
|
this.position,
|
||||||
|
)
|
||||||
|
? cur
|
||||||
|
: prev;
|
||||||
|
});
|
||||||
|
this.relationManage.deleteRelationOfGraphicAndOtherType(
|
||||||
|
this,
|
||||||
|
JlSection.Type,
|
||||||
|
);
|
||||||
|
this.relationManage.addRelation(this, refSection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
saveCommonRelations() {
|
||||||
|
const refStation = this.relationManage
|
||||||
|
.getRelationsOfGraphicAndOtherType(this, JlStation.Type)
|
||||||
|
.map((relation) => relation.getOtherGraphic<JlStation>(this).datas.id);
|
||||||
|
if (refStation.length) {
|
||||||
|
this.datas.refStation = refStation[0];
|
||||||
|
}
|
||||||
|
const refSection = this.relationManage
|
||||||
|
.getRelationsOfGraphicAndOtherType(this, JlSection.Type)
|
||||||
|
.map((relation) => relation.getOtherGraphic<JlSection>(this).datas.id);
|
||||||
|
if (refSection.length) {
|
||||||
|
this.datas.refSection = refSection[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
loadCommonRelations() {
|
||||||
|
if (this.datas.refStation) {
|
||||||
|
this.relationManage.addRelation(
|
||||||
|
this,
|
||||||
|
this.queryStore.queryById<JlStation>(this.datas.refStation),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (this.datas.refSection) {
|
||||||
|
this.relationManage.addRelation(
|
||||||
|
this,
|
||||||
|
this.queryStore.queryById<JlSection>(this.datas.refSection),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,4 +1,3 @@
|
|||||||
import { StyleType } from 'common/common';
|
|
||||||
import { GraphicData } from 'jl-graphic';
|
import { GraphicData } from 'jl-graphic';
|
||||||
|
|
||||||
export interface PlatformConstsConfig {
|
export interface PlatformConstsConfig {
|
||||||
@ -76,11 +75,6 @@ export const THConsts = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const platformConstsMap = new Map<StyleType, PlatformConstsConfig>([
|
|
||||||
[StyleType.GP, GPConsts],
|
|
||||||
[StyleType.TH, THConsts],
|
|
||||||
]);
|
|
||||||
|
|
||||||
enum TypeOfPlatform {
|
enum TypeOfPlatform {
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
up = 1,
|
up = 1,
|
@ -1,8 +1,8 @@
|
|||||||
import { JlGraphicTemplate } from 'jl-graphic';
|
import { JlGraphicTemplate } from 'jl-graphic';
|
||||||
import { JlPlatform } from './JlPlatform';
|
import { JlPlatform } from './JlPlatform';
|
||||||
import { IPlatformData } from './PlatformConfig';
|
import { IPlatformData } from './PlatformConfig';
|
||||||
import { ITHPlatformState, THPlatform } from './THPlatform';
|
import { ITHPlatformState, THPlatform } from '../THPlatform';
|
||||||
import { GPPlatform, IBeiJingPlatformState } from './GPPlatform';
|
import { GPPlatform, IGPPlatformState } from '../GPPlatform';
|
||||||
import { StyleType } from 'common/common';
|
import { StyleType } from 'common/common';
|
||||||
|
|
||||||
export class PlatformTemplate extends JlGraphicTemplate<JlPlatform> {
|
export class PlatformTemplate extends JlGraphicTemplate<JlPlatform> {
|
||||||
@ -11,7 +11,7 @@ export class PlatformTemplate extends JlGraphicTemplate<JlPlatform> {
|
|||||||
styleType: StyleType;
|
styleType: StyleType;
|
||||||
constructor(
|
constructor(
|
||||||
dataTemplate: IPlatformData,
|
dataTemplate: IPlatformData,
|
||||||
stateTemplate: ITHPlatformState | IBeiJingPlatformState,
|
stateTemplate: ITHPlatformState | IGPPlatformState,
|
||||||
styleType: StyleType,
|
styleType: StyleType,
|
||||||
) {
|
) {
|
||||||
super(JlPlatform.Type, { dataTemplate, stateTemplate });
|
super(JlPlatform.Type, { dataTemplate, stateTemplate });
|
@ -1,7 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
Section as SectionBase,
|
JlSection as SectionBase,
|
||||||
SectionDisplayConfig,
|
SectionDisplayConfig,
|
||||||
} from '../common/Section';
|
} from './common/Section';
|
||||||
|
|
||||||
const displayConfig: SectionDisplayConfig = {
|
const displayConfig: SectionDisplayConfig = {
|
||||||
lineColor: '#5578b6',
|
lineColor: '#5578b6',
|
||||||
@ -16,4 +16,4 @@ export class Section extends SectionBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { SectionTemplate } from '../common/Section';
|
export { SectionTemplate } from './common/Section';
|
@ -59,14 +59,14 @@ export const defaultDisplayConfig: SectionDisplayConfig = {
|
|||||||
lineWidth: 5,
|
lineWidth: 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
export class Section extends JlGraphic {
|
export class JlSection extends JlGraphic {
|
||||||
static Type = 'Section';
|
static Type = 'Section';
|
||||||
lineGraphic: SectionGraphic;
|
lineGraphic: SectionGraphic;
|
||||||
labelGraphic: VectorText;
|
labelGraphic: VectorText;
|
||||||
displayConfig = defaultDisplayConfig;
|
displayConfig = defaultDisplayConfig;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super(Section.Type);
|
super(JlSection.Type);
|
||||||
this.lineGraphic = new SectionGraphic();
|
this.lineGraphic = new SectionGraphic();
|
||||||
this.labelGraphic = new VectorText('');
|
this.labelGraphic = new VectorText('');
|
||||||
this.labelGraphic.setVectorFontSize(14);
|
this.labelGraphic.setVectorFontSize(14);
|
||||||
@ -150,14 +150,14 @@ export class Section extends JlGraphic {
|
|||||||
.find(
|
.find(
|
||||||
(relation) =>
|
(relation) =>
|
||||||
relation.getRelationParam(this).getParam<DevicePort>() === port &&
|
relation.getRelationParam(this).getParam<DevicePort>() === port &&
|
||||||
(relation.getOtherGraphic(this) instanceof Section ||
|
(relation.getOtherGraphic(this) instanceof JlSection ||
|
||||||
relation.getOtherGraphic(this) instanceof Turnout),
|
relation.getOtherGraphic(this) instanceof Turnout),
|
||||||
);
|
);
|
||||||
if (!relation) {
|
if (!relation) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
g: relation?.getOtherGraphic(this) as Section | Turnout,
|
g: relation?.getOtherGraphic(this) as JlSection | Turnout,
|
||||||
port: relation?.getOtherRelationParam(this).getParam<DevicePort>(),
|
port: relation?.getOtherRelationParam(this).getParam<DevicePort>(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -217,10 +217,10 @@ export class Section extends JlGraphic {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
buildRelation() {
|
buildRelation() {
|
||||||
this.relationManage.deleteRelationOfGraphicAndOtherType(this, Section.Type);
|
this.relationManage.deleteRelationOfGraphicAndOtherType(this, JlSection.Type);
|
||||||
|
|
||||||
if (this.datas.sectionType === SectionType.Physical) {
|
if (this.datas.sectionType === SectionType.Physical) {
|
||||||
this.queryStore.queryByType<Section>(Section.Type).forEach((section) => {
|
this.queryStore.queryByType<JlSection>(JlSection.Type).forEach((section) => {
|
||||||
if (section.id === this.id) return;
|
if (section.id === this.id) return;
|
||||||
|
|
||||||
let param: DevicePort[] = [];
|
let param: DevicePort[] = [];
|
||||||
@ -272,10 +272,10 @@ export class Section extends JlGraphic {
|
|||||||
.find(
|
.find(
|
||||||
(relation) =>
|
(relation) =>
|
||||||
relation.getRelationParam(this).param === DevicePort.A &&
|
relation.getRelationParam(this).param === DevicePort.A &&
|
||||||
(relation.getOtherGraphic(this) instanceof Section ||
|
(relation.getOtherGraphic(this) instanceof JlSection ||
|
||||||
relation.getOtherGraphic(this) instanceof Turnout),
|
relation.getOtherGraphic(this) instanceof Turnout),
|
||||||
);
|
);
|
||||||
const paDevice = paRelation?.getOtherGraphic<Section | Turnout>(this);
|
const paDevice = paRelation?.getOtherGraphic<JlSection | Turnout>(this);
|
||||||
if (paDevice) {
|
if (paDevice) {
|
||||||
this.datas.paRef = IRelatedRef.create(
|
this.datas.paRef = IRelatedRef.create(
|
||||||
paDevice.type,
|
paDevice.type,
|
||||||
@ -290,10 +290,10 @@ export class Section extends JlGraphic {
|
|||||||
.find(
|
.find(
|
||||||
(relation) =>
|
(relation) =>
|
||||||
relation.getRelationParam(this).param === DevicePort.B &&
|
relation.getRelationParam(this).param === DevicePort.B &&
|
||||||
(relation.getOtherGraphic(this) instanceof Section ||
|
(relation.getOtherGraphic(this) instanceof JlSection ||
|
||||||
relation.getOtherGraphic(this) instanceof Turnout),
|
relation.getOtherGraphic(this) instanceof Turnout),
|
||||||
);
|
);
|
||||||
const pbDevice = pbRelation?.getOtherGraphic<Section | Turnout>(this);
|
const pbDevice = pbRelation?.getOtherGraphic<JlSection | Turnout>(this);
|
||||||
if (pbDevice) {
|
if (pbDevice) {
|
||||||
this.datas.pbRef = IRelatedRef.create(
|
this.datas.pbRef = IRelatedRef.create(
|
||||||
pbDevice.type,
|
pbDevice.type,
|
||||||
@ -330,7 +330,7 @@ export class Section extends JlGraphic {
|
|||||||
if (this.datas.trackSectionId) {
|
if (this.datas.trackSectionId) {
|
||||||
this.relationManage.addRelation(
|
this.relationManage.addRelation(
|
||||||
this,
|
this,
|
||||||
this.queryStore.queryById<Section>(this.datas.trackSectionId),
|
this.queryStore.queryById<JlSection>(this.datas.trackSectionId),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (this.datas.sectionType === SectionType.TurnoutPhysical) {
|
if (this.datas.sectionType === SectionType.TurnoutPhysical) {
|
||||||
@ -346,17 +346,17 @@ export class Section extends JlGraphic {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SectionTemplate extends JlGraphicTemplate<Section> {
|
export class SectionTemplate extends JlGraphicTemplate<JlSection> {
|
||||||
isCurve = false;
|
isCurve = false;
|
||||||
segmentsCount = 10;
|
segmentsCount = 10;
|
||||||
constructor(dataTemplate: ISectionData, stateTemplate?: ISectionState) {
|
constructor(dataTemplate: ISectionData, stateTemplate?: ISectionState) {
|
||||||
super(Section.Type, {
|
super(JlSection.Type, {
|
||||||
dataTemplate,
|
dataTemplate,
|
||||||
stateTemplate,
|
stateTemplate,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
new(): Section {
|
new(): JlSection {
|
||||||
const section = new Section();
|
const section = new JlSection();
|
||||||
section.loadData(this.datas);
|
section.loadData(this.datas);
|
||||||
section.loadState(this.states);
|
section.loadState(this.states);
|
||||||
return section;
|
return section;
|
||||||
|
@ -46,7 +46,7 @@ import {
|
|||||||
import { Turnout } from 'src/packages/Turnout/Turnout';
|
import { Turnout } from 'src/packages/Turnout/Turnout';
|
||||||
import { AxleCounting } from 'src/packages/AxleCounting/AxleCounting';
|
import { AxleCounting } from 'src/packages/AxleCounting/AxleCounting';
|
||||||
import { DevicePort } from 'common/common';
|
import { DevicePort } from 'common/common';
|
||||||
import { Section } from '../bjrtss/Section';
|
import { Section } from '../GPSection';
|
||||||
|
|
||||||
export class SectionDraw extends GraphicDrawAssistant<
|
export class SectionDraw extends GraphicDrawAssistant<
|
||||||
SectionTemplate,
|
SectionTemplate,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { GraphicState } from 'jl-graphic';
|
import { GraphicState } from 'jl-graphic';
|
||||||
import { JlStation } from './JlStation';
|
import { JlStation } from './common/JlStation';
|
||||||
import { StyleType } from 'common/common';
|
import { StyleType } from 'common/common';
|
||||||
|
|
||||||
export interface IGPStationState extends GraphicState {
|
export interface IGPStationState extends GraphicState {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { GraphicState } from 'jl-graphic';
|
import { GraphicState } from 'jl-graphic';
|
||||||
import { ConstrolGraphic, JlStation } from './JlStation';
|
import { ConstrolGraphic, JlStation } from './common/JlStation';
|
||||||
import { THConsts } from './StationConfig';
|
import { THConsts } from './common/StationConfig';
|
||||||
import { StyleType } from 'common/common';
|
import { StyleType } from 'common/common';
|
||||||
|
|
||||||
export interface ITHStationState extends GraphicState {
|
export interface ITHStationState extends GraphicState {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { JlGraphicTemplate } from 'jl-graphic';
|
import { JlGraphicTemplate } from 'jl-graphic';
|
||||||
import { JlStation } from './JlStation';
|
import { JlStation } from './JlStation';
|
||||||
import { IStationData } from './StationConfig';
|
import { IStationData } from './StationConfig';
|
||||||
import { THStation, ITHStationState } from './THStation';
|
import { THStation, ITHStationState } from '../THStation';
|
||||||
import { GPStation, IGPStationState } from './GPStation';
|
import { GPStation, IGPStationState } from '../GPStation';
|
||||||
import { StyleType } from 'common/common';
|
import { StyleType } from 'common/common';
|
||||||
|
|
||||||
export class StationTemplate extends JlGraphicTemplate<JlStation> {
|
export class StationTemplate extends JlGraphicTemplate<JlStation> {
|
Loading…
Reference in New Issue
Block a user