计轴
This commit is contained in:
parent
1e847a82ea
commit
352025daf8
94
components/AxleCounting/AxleCounting.js
Normal file
94
components/AxleCounting/AxleCounting.js
Normal file
@ -0,0 +1,94 @@
|
||||
import { JlGraphic, GraphicRelationParam, JlGraphicTemplate } from 'jl-graphic';
|
||||
import { protoPort2Data } from '../common/common.js';
|
||||
import { Container, Graphics, Color } from 'pixi.js';
|
||||
|
||||
var TypeDetectionPoint;
|
||||
(function (TypeDetectionPoint) {
|
||||
TypeDetectionPoint[TypeDetectionPoint["AxleCounting"] = 0] = "AxleCounting";
|
||||
TypeDetectionPoint[TypeDetectionPoint["SectionBoundary"] = 1] = "SectionBoundary";
|
||||
})(TypeDetectionPoint || (TypeDetectionPoint = {}));
|
||||
const AxleCountingConsts = {
|
||||
radius: 6,
|
||||
borderWidth: 1,
|
||||
circleColorBlue: '0x08F80D',
|
||||
circleColorRed: '0xff0000',
|
||||
};
|
||||
class TwoCircleGraphic extends Container {
|
||||
circleA = new Graphics();
|
||||
circleB = new Graphics();
|
||||
line = new Graphics();
|
||||
constructor() {
|
||||
super();
|
||||
this.addChild(this.circleA);
|
||||
this.addChild(this.circleB);
|
||||
this.addChild(this.line);
|
||||
}
|
||||
draw(data) {
|
||||
this.drawCircle(this.circleA, data);
|
||||
this.drawCircle(this.circleB, data);
|
||||
this.circleA.position.set(-12, 0);
|
||||
this.circleB.position.set(12, 0);
|
||||
const color = data.type == 1
|
||||
? AxleCountingConsts.circleColorRed
|
||||
: AxleCountingConsts.circleColorBlue;
|
||||
this.line
|
||||
.clear()
|
||||
.lineStyle(1, new Color(color))
|
||||
.moveTo(-24, 0)
|
||||
.lineTo(24, 0);
|
||||
}
|
||||
drawCircle(circle, data) {
|
||||
const color = data.type == 1
|
||||
? AxleCountingConsts.circleColorRed
|
||||
: AxleCountingConsts.circleColorBlue;
|
||||
circle
|
||||
.clear()
|
||||
.lineStyle(AxleCountingConsts.borderWidth, new Color(color))
|
||||
.beginFill(color, 1)
|
||||
.drawCircle(0, 0, AxleCountingConsts.radius).endFill;
|
||||
}
|
||||
clear() {
|
||||
this.circleA.clear();
|
||||
this.circleB.clear();
|
||||
}
|
||||
}
|
||||
class AxleCounting extends JlGraphic {
|
||||
static Type = 'AxleCounting';
|
||||
twoCircle = new TwoCircleGraphic();
|
||||
direction;
|
||||
constructor(direction) {
|
||||
super(AxleCounting.Type);
|
||||
this.addChild(this.twoCircle);
|
||||
this.direction = direction;
|
||||
}
|
||||
get datas() {
|
||||
return this.getDatas();
|
||||
}
|
||||
doRepaint() {
|
||||
this.twoCircle.draw(this.datas);
|
||||
}
|
||||
buildRelation() {
|
||||
this.loadRelations();
|
||||
}
|
||||
loadRelations() {
|
||||
if (this.datas.axleCountingRef.length) {
|
||||
this.datas.axleCountingRef.forEach((device) => {
|
||||
this.relationManage.addRelation(new GraphicRelationParam(this, 'A'), new GraphicRelationParam(this.queryStore.queryById(device.id), protoPort2Data(device.devicePort)));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
class AxleCountingTemplate extends JlGraphicTemplate {
|
||||
constructor(dataTemplate) {
|
||||
super(AxleCounting.Type, {
|
||||
dataTemplate,
|
||||
});
|
||||
}
|
||||
new() {
|
||||
const axleCounting = new AxleCounting(1);
|
||||
axleCounting.loadData(this.datas);
|
||||
return axleCounting;
|
||||
}
|
||||
}
|
||||
|
||||
export { AxleCounting, AxleCountingConsts, AxleCountingTemplate };
|
15
components/Section/bjrtss/Section.js
Normal file
15
components/Section/bjrtss/Section.js
Normal file
@ -0,0 +1,15 @@
|
||||
import { Section as Section$1 } from '../common/Section.js';
|
||||
|
||||
const displayConfig = {
|
||||
lineColor: '#5578b6',
|
||||
occupiedColor: '#f00',
|
||||
lineWidth: 5
|
||||
};
|
||||
class Section extends Section$1 {
|
||||
constructor() {
|
||||
super();
|
||||
this.setDisplayConfig(displayConfig);
|
||||
}
|
||||
}
|
||||
|
||||
export { Section };
|
230
components/Section/common/Section.js
Normal file
230
components/Section/common/Section.js
Normal file
@ -0,0 +1,230 @@
|
||||
import { JlGraphic, VectorText, convertToBezierParams, Vector2, splitLineEvenly, distance2, GraphicRelationParam, JlGraphicTemplate } from 'jl-graphic';
|
||||
import { SectionGraphic } from './SectionGraphic.js';
|
||||
import { DevicePort, IRelatedRef } from '../../common/common.js';
|
||||
import { Turnout } from '../../Turnout/Turnout.js';
|
||||
import { AxleCounting } from '../../AxleCounting/AxleCounting.js';
|
||||
|
||||
const tolerance = 0.01;
|
||||
var SectionType;
|
||||
(function (SectionType) {
|
||||
SectionType[SectionType["Physical"] = 0] = "Physical";
|
||||
SectionType[SectionType["Logic"] = 1] = "Logic";
|
||||
SectionType[SectionType["TurnoutPhysical"] = 2] = "TurnoutPhysical";
|
||||
SectionType[SectionType["Track"] = 4] = "Track";
|
||||
SectionType[SectionType["TrackLogic"] = 5] = "TrackLogic";
|
||||
})(SectionType || (SectionType = {}));
|
||||
const defaultDisplayConfig = {
|
||||
lineColor: '#5578b6',
|
||||
occupiedColor: '#f00',
|
||||
lineWidth: 5,
|
||||
};
|
||||
let Section$1 = class Section extends JlGraphic {
|
||||
static Type = 'Section';
|
||||
lineGraphic;
|
||||
labelGraphic;
|
||||
displayConfig = defaultDisplayConfig;
|
||||
constructor() {
|
||||
super(Section.Type);
|
||||
this.lineGraphic = new SectionGraphic();
|
||||
this.labelGraphic = new VectorText('');
|
||||
this.labelGraphic.setVectorFontSize(14);
|
||||
this.labelGraphic.anchor.set(0.5);
|
||||
this.labelGraphic.style.fill = '#0f0';
|
||||
this.labelGraphic.transformSave = true;
|
||||
this.labelGraphic.name = 'label';
|
||||
this.transformSave = true;
|
||||
this.addChild(this.lineGraphic);
|
||||
this.addChild(this.labelGraphic);
|
||||
}
|
||||
setDisplayConfig(config) {
|
||||
this.displayConfig = config;
|
||||
}
|
||||
getVerticesList() {
|
||||
if (this.datas.isCurve) {
|
||||
return [
|
||||
this.datas.points[0],
|
||||
...convertToBezierParams(this.datas.points).map((param) => param.p2),
|
||||
];
|
||||
}
|
||||
else {
|
||||
return this.datas.points;
|
||||
}
|
||||
}
|
||||
getStartPoint() {
|
||||
return this.datas.points[0];
|
||||
}
|
||||
getEndPoint() {
|
||||
return this.datas.points[this.datas.points.length - 1];
|
||||
}
|
||||
doRepaint() {
|
||||
this.lineGraphic.clear();
|
||||
if (this.datas.sectionType === SectionType.TurnoutPhysical) {
|
||||
return;
|
||||
}
|
||||
this.lineGraphic.isCurve = this.datas.isCurve;
|
||||
if (this.lineGraphic.isCurve) {
|
||||
this.lineGraphic.segmentsCount = this.datas.segmentsCount;
|
||||
}
|
||||
this.lineGraphic.points = this.datas.points;
|
||||
this.lineGraphic.lineStyle(this.displayConfig.lineWidth, this.states.occupied
|
||||
? this.displayConfig.occupiedColor
|
||||
: this.displayConfig.lineColor);
|
||||
this.labelGraphic.text = this.datas.code;
|
||||
const labelPosition = this.datas.childTransforms?.find((t) => t.name === this.labelGraphic.name)?.transform.position;
|
||||
if (labelPosition) {
|
||||
this.labelGraphic.position.set(labelPosition.x, labelPosition.y);
|
||||
}
|
||||
else {
|
||||
this.labelGraphic.position.set(this.datas.points[0].x, this.datas.points[0].y + 20);
|
||||
}
|
||||
}
|
||||
get datas() {
|
||||
return this.getDatas();
|
||||
}
|
||||
get states() {
|
||||
return this.getStates();
|
||||
}
|
||||
get linePoints() {
|
||||
return this.datas.points;
|
||||
}
|
||||
set linePoints(points) {
|
||||
const old = this.datas.clone();
|
||||
old.points = points;
|
||||
this.updateData(old);
|
||||
}
|
||||
getConnectElement(port) {
|
||||
const relation = this.relationManage
|
||||
.getRelationsOfGraphic(this)
|
||||
.find((relation) => relation.getRelationParam(this).getParam() === port &&
|
||||
(relation.getOtherGraphic(this) instanceof Section ||
|
||||
relation.getOtherGraphic(this) instanceof Turnout));
|
||||
if (!relation) {
|
||||
return;
|
||||
}
|
||||
return {
|
||||
g: relation?.getOtherGraphic(this),
|
||||
port: relation?.getOtherRelationParam(this).getParam(),
|
||||
};
|
||||
}
|
||||
/** 获取拆分逻辑区段数据 */
|
||||
getSplitPoints(count) {
|
||||
if (this.datas.points.length !== 2) {
|
||||
let totalLen = 0;
|
||||
const lengths = [];
|
||||
for (let i = 1; i < this.datas.points.length; i++) {
|
||||
const { x: x1, y: y1 } = this.datas.points[i - 1], { x: x2, y: y2 } = this.datas.points[i];
|
||||
const len = new Vector2([x2 - x1, y2 - y1]).length();
|
||||
totalLen += len;
|
||||
lengths.push(len);
|
||||
}
|
||||
const counts = lengths.map((length) => Math.round((count * length) / totalLen));
|
||||
if (counts.reduce((p, c) => p + c, 0) !== count) {
|
||||
const intersection = counts.reduce((p, c) => p + c, 0) - count;
|
||||
let maxCountIndex = 0, maxCount = 0;
|
||||
counts.forEach((c, i) => {
|
||||
if (c > maxCount) {
|
||||
maxCount = c;
|
||||
maxCountIndex = i;
|
||||
}
|
||||
});
|
||||
counts[maxCountIndex] + intersection;
|
||||
}
|
||||
return counts
|
||||
.map((count, i) => {
|
||||
return splitLineEvenly(this.localToCanvasPoint(this.datas.points[i]), this.localToCanvasPoint(this.datas.points[i + 1]), count);
|
||||
})
|
||||
.flat();
|
||||
}
|
||||
else {
|
||||
return splitLineEvenly(this.localToCanvasPoint(this.datas.points[0]), this.localToCanvasPoint(this.datas.points[this.datas.points.length - 1]), count);
|
||||
}
|
||||
}
|
||||
buildRelation() {
|
||||
this.relationManage.deleteRelationOfGraphicAndOtherType(this, Section.Type);
|
||||
if (this.datas.sectionType === SectionType.Physical) {
|
||||
this.queryStore.queryByType(Section.Type).forEach((section) => {
|
||||
if (section.id === this.id)
|
||||
return;
|
||||
let param = [];
|
||||
if (distance2(this.localToCanvasPoint(this.getStartPoint()), section.localToCanvasPoint(section.getStartPoint())) <= tolerance) {
|
||||
param = [DevicePort.A, DevicePort.A];
|
||||
}
|
||||
if (distance2(this.localToCanvasPoint(this.getEndPoint()), section.localToCanvasPoint(section.getStartPoint())) <= tolerance) {
|
||||
param = [DevicePort.B, DevicePort.A];
|
||||
}
|
||||
if (distance2(this.localToCanvasPoint(this.getStartPoint()), section.localToCanvasPoint(section.getEndPoint())) <= tolerance) {
|
||||
param = [DevicePort.A, DevicePort.B];
|
||||
}
|
||||
if (distance2(this.localToCanvasPoint(this.getEndPoint()), section.localToCanvasPoint(section.getEndPoint())) <= tolerance) {
|
||||
param = [DevicePort.B, DevicePort.B];
|
||||
}
|
||||
if (param.length) {
|
||||
this.relationManage.addRelation(new GraphicRelationParam(this, param[0]), new GraphicRelationParam(section, param[1]));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
saveRelations() {
|
||||
const paRelation = this.relationManage
|
||||
.getRelationsOfGraphic(this)
|
||||
.find((relation) => relation.getRelationParam(this).param === DevicePort.A &&
|
||||
(relation.getOtherGraphic(this) instanceof Section ||
|
||||
relation.getOtherGraphic(this) instanceof Turnout));
|
||||
const paDevice = paRelation?.getOtherGraphic(this);
|
||||
if (paDevice) {
|
||||
this.datas.paRef = IRelatedRef.create(paDevice.type, paDevice.id, paRelation.getOtherRelationParam(this).getParam());
|
||||
}
|
||||
else {
|
||||
this.datas.paRef = undefined;
|
||||
}
|
||||
const pbRelation = this.relationManage
|
||||
.getRelationsOfGraphic(this)
|
||||
.find((relation) => relation.getRelationParam(this).param === DevicePort.B &&
|
||||
(relation.getOtherGraphic(this) instanceof Section ||
|
||||
relation.getOtherGraphic(this) instanceof Turnout));
|
||||
const pbDevice = pbRelation?.getOtherGraphic(this);
|
||||
if (pbDevice) {
|
||||
this.datas.pbRef = IRelatedRef.create(pbDevice.type, pbDevice.id, pbRelation?.getOtherRelationParam(this).param);
|
||||
}
|
||||
else {
|
||||
this.datas.pbRef = undefined;
|
||||
}
|
||||
this.datas.axleCountings = this.relationManage
|
||||
.getRelationsOfGraphicAndOtherType(this, AxleCounting.Type)
|
||||
.map((relation) => relation.getOtherGraphic(this).datas.id);
|
||||
}
|
||||
loadRelations() {
|
||||
if (this.datas?.paRef?.id) {
|
||||
this.relationManage.addRelation(new GraphicRelationParam(this, DevicePort.A), new GraphicRelationParam(this.queryStore.queryById(this.datas.paRef.id), DevicePort[this.datas.paRef.devicePort]));
|
||||
}
|
||||
if (this.datas?.pbRef?.id) {
|
||||
this.relationManage.addRelation(new GraphicRelationParam(this, DevicePort.B), new GraphicRelationParam(this.queryStore.queryById(this.datas.pbRef.id), DevicePort[this.datas.pbRef.devicePort]));
|
||||
}
|
||||
if (this.datas.trackSectionId) {
|
||||
this.relationManage.addRelation(this, this.queryStore.queryById(this.datas.trackSectionId));
|
||||
}
|
||||
if (this.datas.sectionType === SectionType.TurnoutPhysical) {
|
||||
if (this.datas.axleCountings) {
|
||||
this.datas.axleCountings.forEach((id) => {
|
||||
this.relationManage.addRelation(this, this.queryStore.queryById(id));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
class SectionTemplate extends JlGraphicTemplate {
|
||||
constructor(dataTemplate, stateTemplate) {
|
||||
super(Section$1.Type, {
|
||||
dataTemplate,
|
||||
stateTemplate,
|
||||
});
|
||||
}
|
||||
new() {
|
||||
const section = new Section$1();
|
||||
section.loadData(this.datas);
|
||||
section.loadState(this.states);
|
||||
return section;
|
||||
}
|
||||
}
|
||||
|
||||
export { Section$1 as Section, SectionTemplate, SectionType };
|
51
components/Section/common/SectionGraphic.js
Normal file
51
components/Section/common/SectionGraphic.js
Normal file
@ -0,0 +1,51 @@
|
||||
import { Graphics } from 'pixi.js';
|
||||
import { assertBezierPoints, convertToBezierParams } from 'jl-graphic';
|
||||
|
||||
class SectionGraphic extends Graphics {
|
||||
static Type = 'SectionGraphic';
|
||||
_points = [];
|
||||
get points() {
|
||||
return this._points;
|
||||
}
|
||||
set points(value) {
|
||||
if (!this.isCurve) {
|
||||
if (value.length < 2) {
|
||||
throw Error('Polyline must have at least 2 points');
|
||||
}
|
||||
}
|
||||
else {
|
||||
assertBezierPoints(value);
|
||||
}
|
||||
this._points = value;
|
||||
}
|
||||
_segmentsCount = 10;
|
||||
get segmentsCount() {
|
||||
return this._segmentsCount;
|
||||
}
|
||||
set segmentsCount(value) {
|
||||
if (value < 1) {
|
||||
throw Error('segmentsCount must be at least 1');
|
||||
}
|
||||
this._segmentsCount = value;
|
||||
}
|
||||
isCurve = false;
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
paint() {
|
||||
if (this.isCurve) {
|
||||
const bps = convertToBezierParams(this.points);
|
||||
bps.forEach((bp) => {
|
||||
this.drawBezierCurve(bp.p1, bp.p2, bp.cp1, bp.cp2, this.segmentsCount);
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.moveTo(this.points[0].x, this.points[0].y);
|
||||
for (let i = 1; i < this.points.length; i++) {
|
||||
this.lineTo(this.points[i].x, this.points[i].y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { SectionGraphic };
|
@ -84,10 +84,5 @@ const stationConstsMap = new Map([
|
||||
[CategoryType.BeiJing, BeiJingConsts],
|
||||
[CategoryType.XiAn, XiAnConsts],
|
||||
]);
|
||||
var Direction;
|
||||
(function (Direction) {
|
||||
Direction[Direction["LEFT"] = 0] = "LEFT";
|
||||
Direction[Direction["RIGHT"] = 1] = "RIGHT";
|
||||
})(Direction || (Direction = {}));
|
||||
|
||||
export { BeiJingConsts, Direction, XiAnConsts, otherConsts, stationConstsMap };
|
||||
export { BeiJingConsts, XiAnConsts, otherConsts, stationConstsMap };
|
||||
|
39
components/common/common.d.ts
vendored
Normal file
39
components/common/common.d.ts
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
export declare enum DevicePort {
|
||||
A = 0,
|
||||
B = 1,
|
||||
C = 2
|
||||
}
|
||||
export declare enum DeviceType {
|
||||
Section = 0,
|
||||
Turnout = 1,
|
||||
TrainWindow = 2,
|
||||
AxleCounting = 3,
|
||||
SectionLink = 4,
|
||||
Signal = 5,
|
||||
Station = 6,
|
||||
ScreenDoor = 7,
|
||||
SignalFaultAlarm = 8,
|
||||
Breakers = 9,
|
||||
PowerScreen = 10
|
||||
}
|
||||
export declare enum Direction {
|
||||
LEFT = 0,
|
||||
RIGHT = 1
|
||||
}
|
||||
export interface KilometerSystem {
|
||||
get coordinateSystem(): string;
|
||||
set coordinateSystem(v: string);
|
||||
get kilometer(): number;
|
||||
set kilometer(v: number);
|
||||
get direction(): Direction;
|
||||
set direction(v: Direction);
|
||||
}
|
||||
export interface IRelatedRef {
|
||||
deviceType: DeviceType;
|
||||
id: number;
|
||||
devicePort: DevicePort;
|
||||
}
|
||||
export declare namespace IRelatedRef {
|
||||
function create(type: string, id: number, port: DevicePort): IRelatedRef;
|
||||
}
|
||||
export declare function protoPort2Data(port: DevicePort): "A" | "B" | "C" | undefined;
|
49
components/common/common.js
Normal file
49
components/common/common.js
Normal file
@ -0,0 +1,49 @@
|
||||
var DevicePort;
|
||||
(function (DevicePort) {
|
||||
DevicePort[DevicePort["A"] = 0] = "A";
|
||||
DevicePort[DevicePort["B"] = 1] = "B";
|
||||
DevicePort[DevicePort["C"] = 2] = "C";
|
||||
})(DevicePort || (DevicePort = {}));
|
||||
var DeviceType;
|
||||
(function (DeviceType) {
|
||||
DeviceType[DeviceType["Section"] = 0] = "Section";
|
||||
DeviceType[DeviceType["Turnout"] = 1] = "Turnout";
|
||||
DeviceType[DeviceType["TrainWindow"] = 2] = "TrainWindow";
|
||||
DeviceType[DeviceType["AxleCounting"] = 3] = "AxleCounting";
|
||||
DeviceType[DeviceType["SectionLink"] = 4] = "SectionLink";
|
||||
DeviceType[DeviceType["Signal"] = 5] = "Signal";
|
||||
DeviceType[DeviceType["Station"] = 6] = "Station";
|
||||
DeviceType[DeviceType["ScreenDoor"] = 7] = "ScreenDoor";
|
||||
DeviceType[DeviceType["SignalFaultAlarm"] = 8] = "SignalFaultAlarm";
|
||||
DeviceType[DeviceType["Breakers"] = 9] = "Breakers";
|
||||
DeviceType[DeviceType["PowerScreen"] = 10] = "PowerScreen";
|
||||
})(DeviceType || (DeviceType = {}));
|
||||
var Direction;
|
||||
(function (Direction) {
|
||||
Direction[Direction["LEFT"] = 0] = "LEFT";
|
||||
Direction[Direction["RIGHT"] = 1] = "RIGHT";
|
||||
})(Direction || (Direction = {}));
|
||||
var IRelatedRef;
|
||||
(function (IRelatedRef) {
|
||||
function create(type, id, port) {
|
||||
const typeNum = Object.keys(DeviceType).indexOf(type);
|
||||
if (typeNum < 0)
|
||||
throw Error('Invalid device type');
|
||||
return {
|
||||
deviceType: typeNum,
|
||||
id,
|
||||
devicePort: port,
|
||||
};
|
||||
}
|
||||
IRelatedRef.create = create;
|
||||
})(IRelatedRef || (IRelatedRef = {}));
|
||||
function protoPort2Data(port) {
|
||||
if (port === DevicePort.A)
|
||||
return 'A';
|
||||
if (port === DevicePort.B)
|
||||
return 'B';
|
||||
if (port === DevicePort.C)
|
||||
return 'C';
|
||||
}
|
||||
|
||||
export { DevicePort, DeviceType, Direction, IRelatedRef, protoPort2Data };
|
47
components/packages/AxleCounting/AxleCounting.d.ts
vendored
Normal file
47
components/packages/AxleCounting/AxleCounting.d.ts
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
import { GraphicData, JlGraphic, JlGraphicTemplate } from 'jl-graphic';
|
||||
import { IRelatedRef, KilometerSystem } from 'src/common/common';
|
||||
import { Container, Graphics } from 'pixi.js';
|
||||
declare enum TypeDetectionPoint {
|
||||
AxleCounting = 0,
|
||||
SectionBoundary = 1
|
||||
}
|
||||
export interface IAxleCountingData extends GraphicData {
|
||||
code: string;
|
||||
kilometerSystem: KilometerSystem;
|
||||
axleCountingRef: IRelatedRef[];
|
||||
type?: TypeDetectionPoint;
|
||||
centralizedStations?: number[];
|
||||
clone(): IAxleCountingData;
|
||||
copyFrom(data: IAxleCountingData): void;
|
||||
eq(other: IAxleCountingData): boolean;
|
||||
}
|
||||
export declare const AxleCountingConsts: {
|
||||
radius: number;
|
||||
borderWidth: number;
|
||||
circleColorBlue: string;
|
||||
circleColorRed: string;
|
||||
};
|
||||
declare class TwoCircleGraphic extends Container {
|
||||
circleA: Graphics;
|
||||
circleB: Graphics;
|
||||
line: Graphics;
|
||||
constructor();
|
||||
draw(data: IAxleCountingData): void;
|
||||
drawCircle(circle: Graphics, data: IAxleCountingData): void;
|
||||
clear(): void;
|
||||
}
|
||||
export declare class AxleCounting extends JlGraphic {
|
||||
static Type: string;
|
||||
twoCircle: TwoCircleGraphic;
|
||||
direction: number;
|
||||
constructor(direction: number);
|
||||
get datas(): IAxleCountingData;
|
||||
doRepaint(): void;
|
||||
buildRelation(): void;
|
||||
loadRelations(): void;
|
||||
}
|
||||
export declare class AxleCountingTemplate extends JlGraphicTemplate<AxleCounting> {
|
||||
constructor(dataTemplate: IAxleCountingData);
|
||||
new(): AxleCounting;
|
||||
}
|
||||
export {};
|
24
components/packages/EsbButton/ThEsbButton.d.ts
vendored
Normal file
24
components/packages/EsbButton/ThEsbButton.d.ts
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
import { Graphics } from 'pixi.js';
|
||||
import { GraphicData, GraphicState, JlGraphic, VectorText } from 'jl-graphic';
|
||||
export interface IEsbButtonData extends GraphicData {
|
||||
get code(): string;
|
||||
set code(v: string);
|
||||
get flip(): boolean;
|
||||
set flip(v: boolean);
|
||||
}
|
||||
export interface IEsbButtonState extends GraphicState {
|
||||
id: number;
|
||||
get down(): boolean;
|
||||
set down(v: boolean);
|
||||
}
|
||||
export declare class EsbButton extends JlGraphic {
|
||||
static Type: string;
|
||||
codeGraph: VectorText;
|
||||
circleBody: Graphics;
|
||||
rectBody: Graphics;
|
||||
lineBody: Graphics;
|
||||
constructor();
|
||||
get datas(): IEsbButtonData;
|
||||
get state(): IEsbButtonState;
|
||||
doRepaint(): void;
|
||||
}
|
35
components/packages/EsbButton/ZdwxEsbButton.d.ts
vendored
Normal file
35
components/packages/EsbButton/ZdwxEsbButton.d.ts
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
import { Graphics } from 'pixi.js';
|
||||
import { GraphicData, GraphicState, JlGraphic, VectorText } from 'jl-graphic';
|
||||
export interface IZdwxEsbData extends GraphicData {
|
||||
get code(): string;
|
||||
set code(v: string);
|
||||
get flip(): boolean;
|
||||
set flip(v: boolean);
|
||||
}
|
||||
export interface IZdwxEsbState extends GraphicState {
|
||||
id: number;
|
||||
get down(): boolean;
|
||||
set down(v: boolean);
|
||||
}
|
||||
export declare const zdwxEsbConsts: {
|
||||
codeFontSize: number;
|
||||
codeColor: number;
|
||||
bodyLineColor: number;
|
||||
lineWidth: number;
|
||||
bodyRectLineColor: number;
|
||||
bodyRectLineWidth: number;
|
||||
bodyRectWidth: number;
|
||||
bodyRectHeight: number;
|
||||
bodyCircleRadius: number;
|
||||
bodyColor: number;
|
||||
rectOffset: number;
|
||||
};
|
||||
export declare class ZdwxEsb extends JlGraphic {
|
||||
static Type: string;
|
||||
codeGraph: VectorText;
|
||||
circleBody: Graphics;
|
||||
constructor();
|
||||
get datas(): IZdwxEsbData;
|
||||
get state(): IZdwxEsbState;
|
||||
doRepaint(): void;
|
||||
}
|
25
components/packages/GatedBox/GatedBox.d.ts
vendored
Normal file
25
components/packages/GatedBox/GatedBox.d.ts
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
import { Graphics } from 'pixi.js';
|
||||
import { GraphicData, JlGraphic, VectorText } from 'jl-graphic';
|
||||
export interface IGatedBox extends GraphicData {
|
||||
get code(): string;
|
||||
set code(v: string);
|
||||
get flip(): boolean;
|
||||
set flip(v: boolean);
|
||||
get refScreenDoor(): number;
|
||||
set refScreenDoor(v: number);
|
||||
get refGatedBoxMapCode(): string;
|
||||
set refGatedBoxMapCode(v: string);
|
||||
clone(): IGatedBox;
|
||||
copyFrom(data: IGatedBox): void;
|
||||
eq(other: IGatedBox): boolean;
|
||||
}
|
||||
export declare class GatedBox extends JlGraphic {
|
||||
static Type: string;
|
||||
codeGraph: VectorText;
|
||||
rectBody: Graphics;
|
||||
lineBody: Graphics;
|
||||
textGraph: VectorText;
|
||||
constructor();
|
||||
get datas(): IGatedBox;
|
||||
doRepaint(): void;
|
||||
}
|
10
components/packages/Platform/BeiJingPlatform.d.ts
vendored
Normal file
10
components/packages/Platform/BeiJingPlatform.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
import { GraphicState } from 'jl-graphic';
|
||||
import { JlPlatform } from './JlPlatform';
|
||||
export interface IBeiJingPlatformState extends GraphicState {
|
||||
id?: number;
|
||||
}
|
||||
export declare class BeiJingPlatform extends JlPlatform {
|
||||
constructor();
|
||||
get states(): IBeiJingPlatformState;
|
||||
doRepaint(): void;
|
||||
}
|
51
components/packages/Platform/JlPlatform.d.ts
vendored
Normal file
51
components/packages/Platform/JlPlatform.d.ts
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
import { JlGraphic, VectorText } from 'jl-graphic';
|
||||
import { Container, Graphics } from 'pixi.js';
|
||||
import { CategoryType, IPlatformData, PlatformConstsConfig } from './PlatformConfig';
|
||||
declare class RectGraphic extends Container {
|
||||
categoryType: CategoryType;
|
||||
rect: Graphics;
|
||||
stateFillColor?: string;
|
||||
constructor(categoryType: CategoryType);
|
||||
draw(platformConsts: PlatformConstsConfig): void;
|
||||
clear(): void;
|
||||
}
|
||||
declare class DoorGraphic extends Container {
|
||||
categoryType: CategoryType;
|
||||
doorGraphic: Graphics;
|
||||
doorCloseGraphic: Graphics;
|
||||
stateFillColor?: string;
|
||||
constructor(categoryType: CategoryType);
|
||||
draw(platformConsts: PlatformConstsConfig): void;
|
||||
clear(): void;
|
||||
}
|
||||
declare class CodeGraphic extends Container {
|
||||
categoryType: CategoryType;
|
||||
character: VectorText;
|
||||
runLevel: VectorText;
|
||||
runTime: VectorText;
|
||||
stopTime: VectorText;
|
||||
circle: Graphics;
|
||||
constructor(categoryType: CategoryType, platformConsts: PlatformConstsConfig);
|
||||
draw(platformConsts: PlatformConstsConfig): void;
|
||||
clear(): void;
|
||||
}
|
||||
declare class LozengeGraphic extends Container {
|
||||
categoryType: CategoryType;
|
||||
lozenge: Graphics;
|
||||
constructor(categoryType: CategoryType);
|
||||
draw(platformConsts: PlatformConstsConfig): void;
|
||||
clear(): void;
|
||||
}
|
||||
export declare abstract class JlPlatform extends JlGraphic {
|
||||
static Type: string;
|
||||
private categoryType;
|
||||
private platformConsts;
|
||||
rectGraphic: RectGraphic;
|
||||
doorGraphic?: DoorGraphic;
|
||||
lozengeGraphic?: LozengeGraphic;
|
||||
codeGraphic?: CodeGraphic;
|
||||
constructor(categoryType: CategoryType);
|
||||
get datas(): IPlatformData;
|
||||
doRepaint(): void;
|
||||
}
|
||||
export {};
|
95
components/packages/Platform/PlatformConfig.d.ts
vendored
Normal file
95
components/packages/Platform/PlatformConfig.d.ts
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
import { GraphicData } from 'jl-graphic';
|
||||
export declare enum CategoryType {
|
||||
BeiJing = "BeiJing",//北京
|
||||
XiAn = "XiAn"
|
||||
}
|
||||
export interface PlatformConstsConfig {
|
||||
width: number;
|
||||
height: number;
|
||||
lineWidth: number;
|
||||
noTrainStop: string;
|
||||
trainStop: string;
|
||||
trainJump: string;
|
||||
doorGraphic?: DoorConstsConfig;
|
||||
codeGraphic?: CodeConstsConfig;
|
||||
lozengeGraphic?: LozengeConstsConfig;
|
||||
}
|
||||
export interface DoorConstsConfig {
|
||||
doorGreen: string;
|
||||
doorRed: string;
|
||||
doorBlue: string;
|
||||
doorOpenSpacing: number;
|
||||
doorPlatformSpacing: number;
|
||||
}
|
||||
export interface CodeConstsConfig {
|
||||
besideSpacing: number;
|
||||
besideFontSize: number;
|
||||
whiteNumbers: string;
|
||||
whiteCircle: string;
|
||||
circleRadius: number;
|
||||
HCharYellow: string;
|
||||
HCharWhite: string;
|
||||
HCharRed: string;
|
||||
}
|
||||
export interface LozengeConstsConfig {
|
||||
lozengeRed: string;
|
||||
doorPlatformSpacing: number;
|
||||
}
|
||||
export declare const BeiJingConsts: {
|
||||
width: number;
|
||||
height: number;
|
||||
lineWidth: number;
|
||||
noTrainStop: string;
|
||||
trainStop: string;
|
||||
trainJump: string;
|
||||
};
|
||||
export declare const XiAnConsts: {
|
||||
width: number;
|
||||
height: number;
|
||||
lineWidth: number;
|
||||
noTrainStop: string;
|
||||
trainStop: string;
|
||||
trainJump: string;
|
||||
doorGraphic: {
|
||||
doorOpenSpacing: number;
|
||||
doorGreen: string;
|
||||
doorRed: string;
|
||||
doorBlue: string;
|
||||
doorPlatformSpacing: number;
|
||||
};
|
||||
codeGraphic: {
|
||||
circleRadius: number;
|
||||
besideSpacing: number;
|
||||
besideFontSize: number;
|
||||
whiteNumbers: string;
|
||||
whiteCircle: string;
|
||||
HCharYellow: string;
|
||||
HCharWhite: string;
|
||||
HCharRed: string;
|
||||
};
|
||||
lozengeGraphic: {
|
||||
lozengeRed: string;
|
||||
doorPlatformSpacing: number;
|
||||
};
|
||||
};
|
||||
export declare const platformConstsMap: Map<CategoryType, PlatformConstsConfig>;
|
||||
declare enum TypeOfPlatform {
|
||||
Unknown = 0,
|
||||
up = 1,
|
||||
down = 2
|
||||
}
|
||||
export interface IPlatformData extends GraphicData {
|
||||
code: string;
|
||||
hasdoor?: boolean;
|
||||
direction?: string;
|
||||
up?: boolean;
|
||||
type?: TypeOfPlatform;
|
||||
centralizedStation?: number;
|
||||
refStation: number;
|
||||
refSection: number;
|
||||
refEsbRelayCode?: string;
|
||||
clone(): IPlatformData;
|
||||
copyFrom(data: IPlatformData): void;
|
||||
eq(other: IPlatformData): boolean;
|
||||
}
|
||||
export {};
|
13
components/packages/Platform/PlatformDrawAssistant.d.ts
vendored
Normal file
13
components/packages/Platform/PlatformDrawAssistant.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
import { FederatedPointerEvent, Point } from 'pixi.js';
|
||||
import { GraphicDrawAssistant, IDrawApp } from 'jl-graphic';
|
||||
import { JlPlatform } from './JlPlatform';
|
||||
import { PlatformTemplate } from './PlatformTemplate';
|
||||
import { IPlatformData } from './PlatformConfig';
|
||||
export declare class PlatformDraw extends GraphicDrawAssistant<PlatformTemplate, IPlatformData> {
|
||||
platformGraphic: JlPlatform;
|
||||
constructor(app: IDrawApp, template: PlatformTemplate, icon: string);
|
||||
bind(): void;
|
||||
onLeftDown(e: FederatedPointerEvent): void;
|
||||
redraw(p: Point): void;
|
||||
prepareData(data: IPlatformData): boolean;
|
||||
}
|
12
components/packages/Platform/PlatformTemplate.d.ts
vendored
Normal file
12
components/packages/Platform/PlatformTemplate.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
import { JlGraphicTemplate } from 'jl-graphic';
|
||||
import { JlPlatform } from './JlPlatform';
|
||||
import { CategoryType, IPlatformData } from './PlatformConfig';
|
||||
import { IXiAnPlatformState } from './XiAnPlatform';
|
||||
import { IBeiJingPlatformState } from './BeiJingPlatform';
|
||||
export declare class PlatformTemplate extends JlGraphicTemplate<JlPlatform> {
|
||||
hasdoor?: boolean;
|
||||
direction?: string;
|
||||
categoryType: CategoryType;
|
||||
constructor(dataTemplate: IPlatformData, stateTemplate: IXiAnPlatformState | IBeiJingPlatformState, categoryType: CategoryType);
|
||||
new(): JlPlatform;
|
||||
}
|
43
components/packages/Platform/XiAnPlatform.d.ts
vendored
Normal file
43
components/packages/Platform/XiAnPlatform.d.ts
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
import { GraphicState } from 'jl-graphic';
|
||||
import { JlPlatform } from './JlPlatform';
|
||||
export interface IXiAnPlatformState extends GraphicState {
|
||||
get emergstop(): boolean;
|
||||
set emergstop(v: boolean);
|
||||
get trainberth(): boolean;
|
||||
set trainberth(v: boolean);
|
||||
get close(): boolean;
|
||||
set close(v: boolean);
|
||||
get upHold(): boolean;
|
||||
set upHold(v: boolean);
|
||||
get downHold(): boolean;
|
||||
set downHold(v: boolean);
|
||||
get upOccHold(): boolean;
|
||||
set upOccHold(v: boolean);
|
||||
get downOccHold(): boolean;
|
||||
set downOccHold(v: boolean);
|
||||
get psdOpen(): boolean;
|
||||
set psdOpen(v: boolean);
|
||||
get psdCut(): boolean;
|
||||
set psdCut(v: boolean);
|
||||
get upSkipstop(): boolean;
|
||||
set upSkipstop(v: boolean);
|
||||
get downSkipstop(): boolean;
|
||||
set downSkipstop(v: boolean);
|
||||
get upTrainSkipstop(): boolean;
|
||||
set upTrainSkipstop(v: boolean);
|
||||
get downTrainSkipstop(): boolean;
|
||||
set downTrainSkipstop(v: boolean);
|
||||
get nextSectionRunTime(): number;
|
||||
set nextSectionRunTime(v: number);
|
||||
get nextSectionRunLevel(): number;
|
||||
set nextSectionRunLevel(v: number);
|
||||
get stopTime(): number;
|
||||
set stopTime(v: number);
|
||||
get rtuId(): number;
|
||||
set rtuId(v: number);
|
||||
}
|
||||
export declare class XiAnPlatform extends JlPlatform {
|
||||
constructor();
|
||||
get states(): IXiAnPlatformState;
|
||||
doRepaint(): void;
|
||||
}
|
4
components/packages/Section/bjrtss/Section.d.ts
vendored
Normal file
4
components/packages/Section/bjrtss/Section.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
import { Section as SectionBase } from "../common/Section";
|
||||
export declare class Section extends SectionBase {
|
||||
constructor();
|
||||
}
|
65
components/packages/Section/common/Section.d.ts
vendored
Normal file
65
components/packages/Section/common/Section.d.ts
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
import { GraphicData, GraphicState, JlGraphic, JlGraphicTemplate, VectorText } from 'jl-graphic';
|
||||
import { IPointData } from 'pixi.js';
|
||||
import { SectionGraphic } from './SectionGraphic';
|
||||
import { DevicePort, IRelatedRef } from 'src/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 class Section 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 | Section;
|
||||
port: DevicePort;
|
||||
} | undefined;
|
||||
/** 获取拆分逻辑区段数据 */
|
||||
getSplitPoints(count: number): IPointData[][];
|
||||
buildRelation(): void;
|
||||
saveRelations(): void;
|
||||
loadRelations(): void;
|
||||
}
|
||||
export declare class SectionTemplate extends JlGraphicTemplate<Section> {
|
||||
constructor(dataTemplate: ISectionData, stateTemplate?: ISectionState);
|
||||
new(): Section;
|
||||
}
|
13
components/packages/Section/common/SectionGraphic.d.ts
vendored
Normal file
13
components/packages/Section/common/SectionGraphic.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
import { Graphics, IPointData } from 'pixi.js';
|
||||
export declare class SectionGraphic extends Graphics {
|
||||
static Type: string;
|
||||
private _points;
|
||||
get points(): IPointData[];
|
||||
set points(value: IPointData[]);
|
||||
private _segmentsCount;
|
||||
get segmentsCount(): number;
|
||||
set segmentsCount(value: number);
|
||||
isCurve: boolean;
|
||||
constructor();
|
||||
paint(): void;
|
||||
}
|
20
components/packages/Signal/bjRtss/LampMainBody.d.ts
vendored
Normal file
20
components/packages/Signal/bjRtss/LampMainBody.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
import { Graphics, Container } from 'pixi.js';
|
||||
import { Lamp } from '../common/Lamp';
|
||||
import { Model } from './Signal';
|
||||
export declare class LampMainBody extends Container {
|
||||
static Type: string;
|
||||
lampNum: number;
|
||||
lampPost: Graphics;
|
||||
lamps: Lamp[];
|
||||
mirror: boolean;
|
||||
paint(mt: Model, mirror: boolean): void;
|
||||
setStateBlueShow(): void;
|
||||
setStateLogic(): void;
|
||||
setStateH(): void;
|
||||
setStateL(): void;
|
||||
setStateU(): void;
|
||||
setStateHu(): void;
|
||||
setStateA(): void;
|
||||
setStateB(): void;
|
||||
setStateOff(): void;
|
||||
}
|
154
components/packages/Signal/bjRtss/Signal.d.ts
vendored
Normal file
154
components/packages/Signal/bjRtss/Signal.d.ts
vendored
Normal file
@ -0,0 +1,154 @@
|
||||
import { Graphics } from 'pixi.js';
|
||||
import { GraphicData, JlGraphic, GraphicState, JlGraphicTemplate } from 'jl-graphic';
|
||||
import { LampMainBody } from './LampMainBody';
|
||||
import { SignalCode } from '../common/SignalCode';
|
||||
/** 信号机类型 */
|
||||
export declare enum Model {
|
||||
HL = 0,// 红绿灯
|
||||
HLU_FU = 1,// 红绿黄,封黄灯,无引导
|
||||
HLU_DU_YY = 2,// 红绿黄,不封灯,有单黄,带引导
|
||||
HLU_YY = 3,// 红绿黄,不封灯,无单黄,带引导
|
||||
HLU_FL_DU_YY = 4,// 红绿黄,封绿灯,有单黄,带引导
|
||||
HLU_DU = 5,// 红绿黄,不封灯,有单黄,无引导
|
||||
AB = 6,// 蓝白
|
||||
HBU_DU = 7
|
||||
}
|
||||
export declare enum Direction {
|
||||
LEFT = 0,
|
||||
RIGHT = 1
|
||||
}
|
||||
export declare enum DeviceType {
|
||||
Section = 0,
|
||||
Turnout = 1,
|
||||
TrainWindow = 2,
|
||||
AxleCounting = 3,
|
||||
SectionLink = 4,
|
||||
signal = 5,
|
||||
station = 6,
|
||||
ScreenDoor = 7,
|
||||
SignalFaultAlarm = 8,
|
||||
Breakers = 9,
|
||||
PowerScreen = 10
|
||||
}
|
||||
export declare enum Aspect {
|
||||
Non = 0,
|
||||
OFF = 1,
|
||||
L = 2,
|
||||
H = 3,
|
||||
U = 4,
|
||||
HU = 5,
|
||||
B = 6,
|
||||
A = 7
|
||||
}
|
||||
export declare enum DevicePort {
|
||||
A = 0,
|
||||
B = 1,
|
||||
C = 2
|
||||
}
|
||||
export interface KilometerSystem {
|
||||
get coordinateSystem(): string;
|
||||
set coordinateSystem(v: string);
|
||||
get kilometer(): number;
|
||||
set kilometer(v: number);
|
||||
get direction(): Direction;
|
||||
set direction(v: Direction);
|
||||
}
|
||||
export interface IRelatedRefData {
|
||||
deviceType: DeviceType;
|
||||
id: number;
|
||||
devicePort: DevicePort;
|
||||
}
|
||||
export interface ISignalData extends GraphicData {
|
||||
get code(): string;
|
||||
set code(v: string);
|
||||
get mirror(): boolean;
|
||||
set mirror(v: boolean);
|
||||
get kilometerSystem(): KilometerSystem;
|
||||
set kilometerSystem(v: KilometerSystem);
|
||||
get refDev(): IRelatedRefData;
|
||||
set refDev(v: IRelatedRefData);
|
||||
get centralizedStations(): number[];
|
||||
set centralizedStations(v: number[]);
|
||||
get mt(): Model;
|
||||
set mt(v: Model);
|
||||
get direction(): Direction;
|
||||
set direction(v: Direction);
|
||||
clone(): ISignalData;
|
||||
copyFrom(data: ISignalData): void;
|
||||
eq(other: ISignalData): boolean;
|
||||
}
|
||||
export interface ISignalState extends GraphicState {
|
||||
id?: string;
|
||||
get aspect(): number;
|
||||
set aspect(v: number);
|
||||
}
|
||||
export declare enum SignalColorEnum {
|
||||
humanControlColor = "0xffff00",
|
||||
fleetModeColor = "0x00ff00",
|
||||
blockedColor = "0XFF0000",
|
||||
defaultCodeColor = "0XFFFFFF",
|
||||
lampPostColor = "0xFFFFFF",
|
||||
redLamp = "0XFF0000",
|
||||
greenLamp = "0X00FF00",
|
||||
yellowLamp = "0XFFFF00",
|
||||
whiteLamp = "0XFFFFFF",
|
||||
blueLamp = "0X0033FF",
|
||||
closeLamp = "0X000000",
|
||||
logicModeColor = "0x000000",
|
||||
lampLineColor = "0x3149c3"
|
||||
}
|
||||
export declare const signalConsts: {
|
||||
fleetModeLength: number;
|
||||
fleetModeRadius: number;
|
||||
fleetModeLineWidth: number;
|
||||
humanControlRadius: number;
|
||||
codeOffset: number;
|
||||
codeFontSize: number;
|
||||
blockedLineWidth: number;
|
||||
verticalLampPostLength: number;
|
||||
levelLampPostLength: number;
|
||||
postLineWidth: number;
|
||||
lampRadius: number;
|
||||
logicModeLineWidth: number;
|
||||
logicModeDistance: number;
|
||||
lampLineWidth: number;
|
||||
};
|
||||
export declare class Signal extends JlGraphic {
|
||||
static Type: string;
|
||||
signalCode: SignalCode;
|
||||
humanControl: Graphics;
|
||||
fleetMode: Graphics;
|
||||
lampMainBody: LampMainBody;
|
||||
blockedMode: Graphics;
|
||||
constructor();
|
||||
get datas(): ISignalData;
|
||||
get mirror(): boolean;
|
||||
set mirror(v: boolean);
|
||||
get states(): ISignalState;
|
||||
paint(): void;
|
||||
doRepaint(): void;
|
||||
chagneState(): void;
|
||||
/** 设置状态自动进路 */
|
||||
/** 设置状态人工控 */
|
||||
/** 设置状态封锁 */
|
||||
/** 设置状态红灯 */
|
||||
setStateH(): void;
|
||||
/** 设置状态绿灯 */
|
||||
setStateL(): void;
|
||||
/** 设置状态黄灯 */
|
||||
setStateU(): void;
|
||||
/** 设置状态红黄灯 */
|
||||
setStateHu(): void;
|
||||
/** 设置状态白灯 */
|
||||
setStateA(): void;
|
||||
/** 设置状态蓝灯 */
|
||||
setStateB(): void;
|
||||
/** 设置状态灯位关闭 */
|
||||
setStateOff(): void;
|
||||
buildRelation(): void;
|
||||
loadRelations(): void;
|
||||
}
|
||||
export declare class SignalTemplate extends JlGraphicTemplate<Signal> {
|
||||
constructor(dataTemplate: ISignalData, stateTemplate: ISignalState);
|
||||
new(): Signal;
|
||||
}
|
29
components/packages/Signal/bjRtss/SignalDrawAssistant.d.ts
vendored
Normal file
29
components/packages/Signal/bjRtss/SignalDrawAssistant.d.ts
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
import { FederatedPointerEvent, IHitArea, Point } from 'pixi.js';
|
||||
import { GraphicDrawAssistant, GraphicInteractionPlugin, GraphicTransformEvent, IDrawApp, JlGraphic } from 'jl-graphic';
|
||||
import { ISignalData, Signal, SignalTemplate } from './Signal';
|
||||
export interface ISignalDrawOptions {
|
||||
newData: () => ISignalData;
|
||||
}
|
||||
export declare class SignalDraw extends GraphicDrawAssistant<SignalTemplate, ISignalData> {
|
||||
_signal: Signal | null;
|
||||
constructor(app: IDrawApp, template: SignalTemplate);
|
||||
get signal(): Signal;
|
||||
onLeftUp(e: FederatedPointerEvent): void;
|
||||
redraw(p: Point): void;
|
||||
prepareData(data: ISignalData): boolean;
|
||||
}
|
||||
export declare class SignalGraphicHitArea implements IHitArea {
|
||||
signal: Signal;
|
||||
constructor(signal: Signal);
|
||||
contains(x: number, y: number): boolean;
|
||||
}
|
||||
export declare class SignalInteraction extends GraphicInteractionPlugin<Signal> {
|
||||
static Name: string;
|
||||
constructor(app: IDrawApp);
|
||||
static init(app: IDrawApp): SignalInteraction;
|
||||
filter(...grahpics: JlGraphic[]): Signal[] | undefined;
|
||||
bind(g: Signal): void;
|
||||
unbind(g: Signal): void;
|
||||
transformstart(e: GraphicTransformEvent): void;
|
||||
codetransformstart(e: GraphicTransformEvent): void;
|
||||
}
|
12
components/packages/Signal/common/CommonGraphics.d.ts
vendored
Normal file
12
components/packages/Signal/common/CommonGraphics.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
import { Graphics } from 'pixi.js';
|
||||
/**
|
||||
*
|
||||
* @param polygon
|
||||
* @param x 箭头顶点x坐标
|
||||
* @param y 箭头顶点y坐标
|
||||
* @param length 箭头长度
|
||||
* @param radius 箭头三角半径
|
||||
* @param lineWidth 箭头线宽
|
||||
* @param mirror 是否镜像翻转 (基于箭头顶点)
|
||||
*/
|
||||
export declare function drawArrow(polygon: Graphics, x: number, y: number, length: number, radius: number, lineWidth: number, mirror: boolean): void;
|
15
components/packages/Signal/common/Lamp.d.ts
vendored
Normal file
15
components/packages/Signal/common/Lamp.d.ts
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
import { Container } from '@pixi/display';
|
||||
import { Graphics } from 'pixi.js';
|
||||
export declare class Lamp extends Container {
|
||||
circleLamp: Graphics;
|
||||
logicMode: Graphics;
|
||||
radiusX: number;
|
||||
radiusY: number;
|
||||
constructor(hasLogic: boolean);
|
||||
paint(radiusX: number, radiusY: number): void;
|
||||
createLampBad(): void;
|
||||
createLamp(color?: string): void;
|
||||
createLogicMode(): void;
|
||||
logicModeClear(): void;
|
||||
lampClear(): void;
|
||||
}
|
11
components/packages/Signal/common/SignalCode.d.ts
vendored
Normal file
11
components/packages/Signal/common/SignalCode.d.ts
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
import { Container, Graphics } from 'pixi.js';
|
||||
import { VectorText } from 'jl-graphic';
|
||||
import { ISignalData } from '../bjRtss/Signal';
|
||||
export declare class SignalCode extends Container {
|
||||
blockedMode: Graphics;
|
||||
codeGraph: VectorText;
|
||||
name: string;
|
||||
constructor();
|
||||
paint(datas: ISignalData): void;
|
||||
createBlockedMode(): void;
|
||||
}
|
25
components/packages/Signal/th/LampMainBody.d.ts
vendored
Normal file
25
components/packages/Signal/th/LampMainBody.d.ts
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
import { Graphics, Container } from 'pixi.js';
|
||||
import { GraphicAnimation } from 'jl-graphic';
|
||||
import { Lamp } from '../common/Lamp';
|
||||
import { Model } from './Signal';
|
||||
export declare class LampMainBody extends Container {
|
||||
static Type: string;
|
||||
lampNum: number;
|
||||
lampPost: Graphics;
|
||||
lamps: Lamp[];
|
||||
mirror: boolean;
|
||||
deltaTime: number;
|
||||
constructor();
|
||||
paint(mt: Model, mirror: boolean): void;
|
||||
setStateBlueShow(): void;
|
||||
setStateLampBad(): void;
|
||||
setStateLogic(): void;
|
||||
setStateH(): void;
|
||||
setStateL(): void;
|
||||
setStateU(): void;
|
||||
setStateHu(): void;
|
||||
setStateA(): void;
|
||||
setStateB(): void;
|
||||
setStateOff(): void;
|
||||
createFlashAnmiation(name: string, color: string, lampIndex: number): GraphicAnimation;
|
||||
}
|
112
components/packages/Signal/th/Signal.d.ts
vendored
Normal file
112
components/packages/Signal/th/Signal.d.ts
vendored
Normal file
@ -0,0 +1,112 @@
|
||||
import { GraphicData, JlGraphic } from 'jl-graphic';
|
||||
import { Graphics } from 'pixi.js';
|
||||
import { SignalCode } from '../common/SignalCode';
|
||||
import { LampMainBody } from './LampMainBody';
|
||||
/** 信号机类型 */
|
||||
export declare enum Model {
|
||||
HL = 0,// 红绿灯
|
||||
HLU_FU = 1,// 红绿黄,封黄灯,无引导
|
||||
HLU_DU_YY = 2,// 红绿黄,不封灯,有单黄,带引导
|
||||
HLU_YY = 3,// 红绿黄,不封灯,无单黄,带引导
|
||||
HLU_FL_DU_YY = 4,// 红绿黄,封绿灯,有单黄,带引导
|
||||
HLU_DU = 5,// 红绿黄,不封灯,有单黄,无引导
|
||||
AB = 6,// 蓝白
|
||||
HBU_DU = 7
|
||||
}
|
||||
/** 信号机颜色 */
|
||||
export declare enum SignalColorEnum {
|
||||
humanControlColor = "0xffff00",
|
||||
fleetModeColor = "0x00ff00",
|
||||
blockedColor = "0XFF0000",
|
||||
defaultCodeColor = "0XFFFFFF",
|
||||
lampPostColor = "0xFFFFFF",
|
||||
redLamp = "0XFF0000",
|
||||
greenLamp = "0X00FF00",
|
||||
yellowLamp = "0XFFFF00",
|
||||
whiteLamp = "0XFFFFFF",
|
||||
blueLamp = "0X0033FF",
|
||||
closeLamp = "0X000000",
|
||||
logicModeColor = "0x000000",
|
||||
lampLineColor = "0x3149c3"
|
||||
}
|
||||
/** 信号机常量 */
|
||||
export declare const signalConsts: {
|
||||
fleetModeLength: number;
|
||||
fleetModeRadius: number;
|
||||
fleetModeLineWidth: number;
|
||||
humanControlRadius: number;
|
||||
codeOffset: number;
|
||||
codeFontSize: number;
|
||||
blockedLineWidth: number;
|
||||
verticalLampPostLength: number;
|
||||
levelLampPostLength: number;
|
||||
postLineWidth: number;
|
||||
lampRadius: number;
|
||||
logicModeLineWidth: number;
|
||||
logicModeDistance: number;
|
||||
lampLineWidth: number;
|
||||
};
|
||||
export interface ISignalData extends GraphicData {
|
||||
code: string;
|
||||
mirror: boolean;
|
||||
mt: Model;
|
||||
}
|
||||
export declare class Signal extends JlGraphic {
|
||||
static Type: string;
|
||||
datas: ISignalData;
|
||||
signalCode: SignalCode;
|
||||
humanControl: Graphics;
|
||||
fleetMode: Graphics;
|
||||
lampMainBody: LampMainBody;
|
||||
blockedMode: Graphics;
|
||||
constructor(datas: ISignalData);
|
||||
doRepaint(): void;
|
||||
stopAnmiation(): void;
|
||||
/** 设置状态自动进路 */
|
||||
setStateFleetMode(): void;
|
||||
/** 设置状态人工控 */
|
||||
setStateHumanControl(): void;
|
||||
/** 设置状态封锁 */
|
||||
setStateBlocked(): void;
|
||||
/** 设置状态蓝显 */
|
||||
setStateBlueShow(): void;
|
||||
/** 设置状态信号机损坏 */
|
||||
setStateSignalBad(): void;
|
||||
/** 设置状态逻辑点灯 */
|
||||
setStateLogic(): void;
|
||||
/** 设置状态红灯 */
|
||||
setStateH(): void;
|
||||
/** 设置状态绿灯 */
|
||||
setStateL(): void;
|
||||
/** 设置状态黄灯 */
|
||||
setStateU(): void;
|
||||
/** 设置状态红黄灯 */
|
||||
setStateHu(): void;
|
||||
/** 设置状态白灯 */
|
||||
setStateA(): void;
|
||||
/** 设置状态蓝灯 */
|
||||
setStateB(): void;
|
||||
/** 设置状态灯位关闭 */
|
||||
setStateOff(): void;
|
||||
/** 设置状态红闪 */
|
||||
setStateRedFlash(): void;
|
||||
/** 设置状态绿闪 */
|
||||
setStateGreenFlash(): void;
|
||||
/** 设置状态黄闪 */
|
||||
setStateYellowFlash(): void;
|
||||
/** 设置状态蓝闪 */
|
||||
setStateBlueFlash(): void;
|
||||
/** 设置状态白闪 */
|
||||
setStateWhiteFlash(): void;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param polygon
|
||||
* @param x 箭头顶点x坐标
|
||||
* @param y 箭头顶点y坐标
|
||||
* @param length 箭头长度
|
||||
* @param radius 箭头三角半径
|
||||
* @param lineWidth 箭头线宽
|
||||
* @param mirror 是否镜像翻转 (基于箭头顶点)
|
||||
*/
|
||||
export declare function drawArrow(polygon: Graphics, x: number, y: number, length: number, radius: number, lineWidth: number, mirror: boolean): void;
|
16
components/packages/SpksSwitch/SpksSwitch.d.ts
vendored
Normal file
16
components/packages/SpksSwitch/SpksSwitch.d.ts
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
import { Graphics } from 'pixi.js';
|
||||
import { GraphicData, JlGraphic, VectorText } from 'jl-graphic';
|
||||
export interface ISpksSwitchData extends GraphicData {
|
||||
code: string;
|
||||
flip: boolean;
|
||||
}
|
||||
export declare class SpksSwitch extends JlGraphic {
|
||||
static Type: string;
|
||||
datas: ISpksSwitchData;
|
||||
codeGraph: VectorText;
|
||||
rectBody: Graphics;
|
||||
lineBody: Graphics;
|
||||
textGraph: VectorText;
|
||||
constructor(datas: ISpksSwitchData);
|
||||
doRepaint(): void;
|
||||
}
|
10
components/packages/Station/BeiJingStation.d.ts
vendored
Normal file
10
components/packages/Station/BeiJingStation.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
import { GraphicState } from 'jl-graphic';
|
||||
import { JlStation } from './JlStation';
|
||||
export interface IBeiJingStationState extends GraphicState {
|
||||
id: number;
|
||||
}
|
||||
export declare class BeiJingStation extends JlStation {
|
||||
constructor();
|
||||
get states(): IBeiJingStationState;
|
||||
doRepaint(): void;
|
||||
}
|
29
components/packages/Station/JlStation.d.ts
vendored
Normal file
29
components/packages/Station/JlStation.d.ts
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
import { Container, Point } from 'pixi.js';
|
||||
import { JlGraphic, VectorText } from 'jl-graphic';
|
||||
import { ConstrolConstsConfig, ConstrolItemConfig, IStationData, StationConstsConfig } from './StationConfig';
|
||||
import { CategoryType } from '../Platform/PlatformConfig';
|
||||
declare class ConstrolGraphic extends Container {
|
||||
categoryType: CategoryType;
|
||||
constrolConfig?: ConstrolItemConfig[];
|
||||
stateArrowFillColor?: string;
|
||||
constructor(categoryType: CategoryType);
|
||||
draw(stationConsts: StationConstsConfig): void;
|
||||
drawCircleCode(constrolConsts: ConstrolConstsConfig, code: string, circleFillColor: string, codeGraphFillColor: string, pos: {
|
||||
circlePs: Point;
|
||||
codeGraphPs: Point;
|
||||
}): void;
|
||||
clear(): void;
|
||||
}
|
||||
export declare abstract class JlStation extends JlGraphic {
|
||||
static Type: string;
|
||||
private categoryType;
|
||||
private stationConsts;
|
||||
codeGraph: VectorText;
|
||||
kilometerGraph: VectorText;
|
||||
controlGraphic?: ConstrolGraphic;
|
||||
constructor(categoryType: CategoryType);
|
||||
get datas(): IStationData;
|
||||
get code(): string;
|
||||
doRepaint(): void;
|
||||
}
|
||||
export {};
|
96
components/packages/Station/StationConfig.d.ts
vendored
Normal file
96
components/packages/Station/StationConfig.d.ts
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
import { GraphicData } from 'jl-graphic';
|
||||
import { CategoryType } from '../Platform/PlatformConfig';
|
||||
import { KilometerSystem } from 'src/common/common';
|
||||
export interface StationConstsConfig {
|
||||
codeColor: string;
|
||||
codeFontSize: number;
|
||||
kilometerCodeColor: string;
|
||||
kilometerCodeFontSize: number;
|
||||
kilometerCodeOffsetY: number;
|
||||
constrolGraphic?: ConstrolConstsConfig;
|
||||
}
|
||||
export interface ConstrolConstsConfig {
|
||||
radius: number;
|
||||
borderWidth: number;
|
||||
codeControlFontSize: number;
|
||||
codeOffsetY: number;
|
||||
circleOffsetY: number;
|
||||
circleBetweenOffset: number;
|
||||
constrolConfig: ConstrolItemConfig[];
|
||||
inArrowConfig?: InArrowConfig;
|
||||
}
|
||||
export interface ConstrolItemConfig {
|
||||
codeText: string;
|
||||
circleFillColor: string;
|
||||
codeGraphFillColor: string;
|
||||
}
|
||||
export interface InArrowConfig {
|
||||
inArrowFillColorGray: string;
|
||||
inArrowFillColorBlue: string;
|
||||
}
|
||||
export declare const BeiJingConsts: {
|
||||
codeColor: string;
|
||||
codeFontSize: number;
|
||||
kilometerCodeColor: string;
|
||||
kilometerCodeFontSize: number;
|
||||
kilometerCodeOffsetY: number;
|
||||
};
|
||||
export declare const XiAnConsts: {
|
||||
codeColor: string;
|
||||
codeFontSize: number;
|
||||
kilometerCodeColor: string;
|
||||
kilometerCodeFontSize: number;
|
||||
kilometerCodeOffsetY: number;
|
||||
constrolGraphic: {
|
||||
radius: number;
|
||||
borderWidth: number;
|
||||
codeControlFontSize: number;
|
||||
codeOffsetY: number;
|
||||
circleOffsetY: number;
|
||||
circleBetweenOffset: number;
|
||||
constrolConfig: {
|
||||
codeText: string;
|
||||
circleFillColor: string;
|
||||
codeGraphFillColor: string;
|
||||
}[];
|
||||
inArrowConfig: {
|
||||
inArrowFillColorGray: string;
|
||||
inArrowFillColorBlue: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
export declare const otherConsts: {
|
||||
codeColor: string;
|
||||
codeFontSize: number;
|
||||
kilometerCodeColor: string;
|
||||
kilometerCodeFontSize: number;
|
||||
kilometerCodeOffsetY: number;
|
||||
constrolGraphic: {
|
||||
radius: number;
|
||||
borderWidth: number;
|
||||
codeControlFontSize: number;
|
||||
codeOffsetY: number;
|
||||
circleOffsetY: number;
|
||||
circleBetweenOffset: number;
|
||||
constrolConfig: {
|
||||
codeText: string;
|
||||
circleFillColor: string;
|
||||
codeGraphFillColor: string;
|
||||
}[];
|
||||
};
|
||||
};
|
||||
export declare const stationConstsMap: Map<CategoryType, StationConstsConfig>;
|
||||
export interface IStationData extends GraphicData {
|
||||
code: string;
|
||||
stationName?: string;
|
||||
kilometerSystem: KilometerSystem;
|
||||
hasControl?: boolean;
|
||||
concentrationStations: boolean;
|
||||
name: string;
|
||||
manageStations: number[];
|
||||
depots: boolean;
|
||||
refIbpMapCode?: string;
|
||||
clone(): IStationData;
|
||||
copyFrom(data: IStationData): void;
|
||||
eq(other: IStationData): boolean;
|
||||
}
|
22
components/packages/Station/StationDrawAssistant.d.ts
vendored
Normal file
22
components/packages/Station/StationDrawAssistant.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
import { FederatedPointerEvent, Point } from 'pixi.js';
|
||||
import { GraphicDrawAssistant, GraphicInteractionPlugin, IDrawApp, JlGraphic } from 'jl-graphic';
|
||||
import { JlStation } from './JlStation';
|
||||
import { IStationData } from './StationConfig';
|
||||
import { StationTemplate } from './StationTemplate';
|
||||
export declare class StationDraw extends GraphicDrawAssistant<StationTemplate, IStationData> {
|
||||
codeGraph: JlStation;
|
||||
constructor(app: IDrawApp, template: StationTemplate, icon: string);
|
||||
bind(): void;
|
||||
onLeftDown(e: FederatedPointerEvent): void;
|
||||
redraw(p: Point): void;
|
||||
prepareData(data: IStationData): boolean;
|
||||
}
|
||||
export declare class StationInteraction extends GraphicInteractionPlugin<JlStation> {
|
||||
static Name: string;
|
||||
constructor(app: IDrawApp);
|
||||
static init(app: IDrawApp): StationInteraction;
|
||||
filter(...grahpics: JlGraphic[]): JlStation[] | undefined;
|
||||
bind(g: JlStation): void;
|
||||
unbind(g: JlStation): void;
|
||||
onSelected(): void;
|
||||
}
|
12
components/packages/Station/StationTemplate.d.ts
vendored
Normal file
12
components/packages/Station/StationTemplate.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
import { JlGraphicTemplate } from 'jl-graphic';
|
||||
import { JlStation } from './JlStation';
|
||||
import { IStationData } from './StationConfig';
|
||||
import { IXiAnStationState } from './XiAnStation';
|
||||
import { IBeiJingStationState } from './BeiJingStation';
|
||||
import { CategoryType } from '../Platform/PlatformConfig';
|
||||
export declare class StationTemplate extends JlGraphicTemplate<JlStation> {
|
||||
hasControl?: boolean;
|
||||
categoryType: CategoryType;
|
||||
constructor(dataTemplate: IStationData, stateTemplate: IXiAnStationState | IBeiJingStationState, categoryType: CategoryType);
|
||||
new(): JlStation;
|
||||
}
|
20
components/packages/Station/XiAnStation.d.ts
vendored
Normal file
20
components/packages/Station/XiAnStation.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
import { GraphicState } from 'jl-graphic';
|
||||
import { JlStation } from './JlStation';
|
||||
export interface IXiAnStationState extends GraphicState {
|
||||
get ipRtuStusDown(): boolean;
|
||||
set ipRtuStusDown(v: boolean);
|
||||
get ipRtuStusInLocalCtrl(): boolean;
|
||||
set ipRtuStusInLocalCtrl(v: boolean);
|
||||
get ipRtuStusInCentralCtrl(): boolean;
|
||||
set ipRtuStusInCentralCtrl(v: boolean);
|
||||
get ipRtuStusInEmergencyCtrl(): boolean;
|
||||
set ipRtuStusInEmergencyCtrl(v: boolean);
|
||||
get rtuId(): number;
|
||||
set rtuId(v: number);
|
||||
}
|
||||
export declare class XiAnStation extends JlStation {
|
||||
_ipRtuStusDown: boolean;
|
||||
constructor();
|
||||
get states(): IXiAnStationState;
|
||||
doRepaint(): void;
|
||||
}
|
4
components/packages/Turnout/Turnout.d.ts
vendored
Normal file
4
components/packages/Turnout/Turnout.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
import { JlGraphic } from "jl-graphic";
|
||||
export declare class Turnout extends JlGraphic {
|
||||
doRepaint(): void;
|
||||
}
|
@ -54,3 +54,9 @@ export namespace IRelatedRef {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export function protoPort2Data(port: DevicePort) {
|
||||
if (port === DevicePort.A) return 'A';
|
||||
if (port === DevicePort.B) return 'B';
|
||||
if (port === DevicePort.C) return 'C';
|
||||
}
|
||||
|
@ -1,5 +1,15 @@
|
||||
import { GraphicData, JlGraphic } from 'jl-graphic';
|
||||
import { IRelatedRef, KilometerSystem } from 'src/common/common';
|
||||
import {
|
||||
GraphicData,
|
||||
GraphicRelationParam,
|
||||
JlGraphic,
|
||||
JlGraphicTemplate,
|
||||
} from 'jl-graphic';
|
||||
import {
|
||||
IRelatedRef,
|
||||
KilometerSystem,
|
||||
protoPort2Data,
|
||||
} from 'src/common/common';
|
||||
import { Container, Graphics, Color } from 'pixi.js';
|
||||
|
||||
enum TypeDetectionPoint {
|
||||
AxleCounting = 0,
|
||||
@ -9,24 +19,108 @@ enum TypeDetectionPoint {
|
||||
export interface IAxleCountingData extends GraphicData {
|
||||
code: string;
|
||||
kilometerSystem: KilometerSystem;
|
||||
axleCountingRef: IRelatedRef[];
|
||||
type: TypeDetectionPoint;
|
||||
centralizedStations: number[];
|
||||
axleCountingRef: IRelatedRef[]; //关联的设备--一键生成时赋值
|
||||
type?: TypeDetectionPoint; // 计轴、区段边界
|
||||
centralizedStations?: number[];
|
||||
clone(): IAxleCountingData;
|
||||
copyFrom(data: IAxleCountingData): void;
|
||||
eq(other: IAxleCountingData): boolean;
|
||||
}
|
||||
|
||||
export class AxleCounting extends JlGraphic {
|
||||
static Type = 'axleCounting';
|
||||
export const AxleCountingConsts = {
|
||||
radius: 6,
|
||||
borderWidth: 1,
|
||||
circleColorBlue: '0x08F80D',
|
||||
circleColorRed: '0xff0000',
|
||||
};
|
||||
|
||||
class TwoCircleGraphic extends Container {
|
||||
circleA: Graphics = new Graphics();
|
||||
circleB: Graphics = new Graphics();
|
||||
line: Graphics = new Graphics();
|
||||
constructor() {
|
||||
super(AxleCounting.Type);
|
||||
super();
|
||||
this.addChild(this.circleA);
|
||||
this.addChild(this.circleB);
|
||||
this.addChild(this.line);
|
||||
}
|
||||
draw(data: IAxleCountingData): void {
|
||||
this.drawCircle(this.circleA, data);
|
||||
this.drawCircle(this.circleB, data);
|
||||
this.circleA.position.set(-12, 0);
|
||||
this.circleB.position.set(12, 0);
|
||||
const color =
|
||||
data.type == 1
|
||||
? AxleCountingConsts.circleColorRed
|
||||
: AxleCountingConsts.circleColorBlue;
|
||||
this.line
|
||||
.clear()
|
||||
.lineStyle(1, new Color(color))
|
||||
.moveTo(-24, 0)
|
||||
.lineTo(24, 0);
|
||||
}
|
||||
drawCircle(circle: Graphics, data: IAxleCountingData): void {
|
||||
const color =
|
||||
data.type == 1
|
||||
? AxleCountingConsts.circleColorRed
|
||||
: AxleCountingConsts.circleColorBlue;
|
||||
circle
|
||||
.clear()
|
||||
.lineStyle(AxleCountingConsts.borderWidth, new Color(color))
|
||||
.beginFill(color, 1)
|
||||
.drawCircle(0, 0, AxleCountingConsts.radius).endFill;
|
||||
}
|
||||
clear(): void {
|
||||
this.circleA.clear();
|
||||
this.circleB.clear();
|
||||
}
|
||||
}
|
||||
export class AxleCounting extends JlGraphic {
|
||||
static Type = 'AxleCounting';
|
||||
twoCircle: TwoCircleGraphic = new TwoCircleGraphic();
|
||||
direction: number;
|
||||
constructor(direction: number) {
|
||||
super(AxleCounting.Type);
|
||||
this.addChild(this.twoCircle);
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
doRepaint(): void {}
|
||||
|
||||
get datas(): IAxleCountingData {
|
||||
return this.getDatas<IAxleCountingData>();
|
||||
}
|
||||
|
||||
doRepaint(): void {
|
||||
this.twoCircle.draw(this.datas);
|
||||
}
|
||||
|
||||
buildRelation(): void {
|
||||
this.loadRelations();
|
||||
}
|
||||
|
||||
loadRelations(): void {
|
||||
if (this.datas.axleCountingRef.length) {
|
||||
this.datas.axleCountingRef.forEach((device) => {
|
||||
this.relationManage.addRelation(
|
||||
new GraphicRelationParam(this, 'A'),
|
||||
new GraphicRelationParam(
|
||||
this.queryStore.queryById(device.id),
|
||||
protoPort2Data(device.devicePort),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class AxleCountingTemplate extends JlGraphicTemplate<AxleCounting> {
|
||||
constructor(dataTemplate: IAxleCountingData) {
|
||||
super(AxleCounting.Type, {
|
||||
dataTemplate,
|
||||
});
|
||||
}
|
||||
new(): AxleCounting {
|
||||
const axleCounting = new AxleCounting(1);
|
||||
axleCounting.loadData(this.datas);
|
||||
return axleCounting;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { GraphicData } from 'jl-graphic';
|
||||
import { CategoryType } from '../Platform/PlatformConfig';
|
||||
import { KilometerSystem } from 'src/common/common';
|
||||
|
||||
export interface StationConstsConfig {
|
||||
codeColor: string;
|
||||
@ -134,17 +135,3 @@ export interface IStationData extends GraphicData {
|
||||
copyFrom(data: IStationData): void;
|
||||
eq(other: IStationData): boolean;
|
||||
}
|
||||
|
||||
export interface KilometerSystem {
|
||||
get coordinateSystem(): string;
|
||||
set coordinateSystem(v: string);
|
||||
get kilometer(): number;
|
||||
set kilometer(v: number);
|
||||
get direction(): Direction;
|
||||
set direction(v: Direction);
|
||||
}
|
||||
|
||||
export enum Direction {
|
||||
LEFT = 0,
|
||||
RIGHT = 1,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user