目录结构及引用调整
This commit is contained in:
parent
3d104163f6
commit
b59d958604
@ -1,94 +0,0 @@
|
||||
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 };
|
@ -1,15 +0,0 @@
|
||||
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 };
|
@ -1,230 +0,0 @@
|
||||
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 };
|
@ -1,51 +0,0 @@
|
||||
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 };
|
6
components/common/common.d.ts
vendored
6
components/common/common.d.ts
vendored
@ -1,7 +1,7 @@
|
||||
export declare enum DevicePort {
|
||||
A = 0,
|
||||
B = 1,
|
||||
C = 2
|
||||
A = "A",
|
||||
B = "B",
|
||||
C = "C"
|
||||
}
|
||||
export declare enum DeviceType {
|
||||
Section = 0,
|
||||
|
@ -1,8 +1,8 @@
|
||||
var DevicePort;
|
||||
(function (DevicePort) {
|
||||
DevicePort[DevicePort["A"] = 0] = "A";
|
||||
DevicePort[DevicePort["B"] = 1] = "B";
|
||||
DevicePort[DevicePort["C"] = 2] = "C";
|
||||
DevicePort["A"] = "A";
|
||||
DevicePort["B"] = "B";
|
||||
DevicePort["C"] = "C";
|
||||
})(DevicePort || (DevicePort = {}));
|
||||
var DeviceType;
|
||||
(function (DeviceType) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { GraphicData, JlGraphic, JlGraphicTemplate } from 'jl-graphic';
|
||||
import { IRelatedRef, KilometerSystem } from 'src/common/common';
|
||||
import { IRelatedRef, KilometerSystem } from 'common/common';
|
||||
import { Container, Graphics } from 'pixi.js';
|
||||
declare enum TypeDetectionPoint {
|
||||
AxleCounting = 0,
|
||||
|
@ -1,19 +1,94 @@
|
||||
import { JlGraphic } from 'jl-graphic';
|
||||
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 = {}));
|
||||
class AxleCounting extends JlGraphic {
|
||||
static Type = 'axleCounting';
|
||||
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(AxleCounting.Type);
|
||||
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;
|
||||
}
|
||||
doRepaint() { }
|
||||
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 };
|
||||
export { AxleCounting, AxleCountingConsts, AxleCountingTemplate };
|
||||
|
@ -1,7 +1,7 @@
|
||||
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 { DevicePort, IRelatedRef } from 'common/common';
|
||||
import { Turnout } from 'src/packages/Turnout/Turnout';
|
||||
export interface ISectionData extends GraphicData {
|
||||
code: string;
|
||||
|
@ -195,10 +195,10 @@ let Section$1 = class Section extends JlGraphic {
|
||||
}
|
||||
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]));
|
||||
this.relationManage.addRelation(new GraphicRelationParam(this, DevicePort.A), new GraphicRelationParam(this.queryStore.queryById(this.datas.paRef.id), 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]));
|
||||
this.relationManage.addRelation(new GraphicRelationParam(this, DevicePort.B), new GraphicRelationParam(this.queryStore.queryById(this.datas.pbRef.id), this.datas.pbRef.devicePort));
|
||||
}
|
||||
if (this.datas.trackSectionId) {
|
||||
this.relationManage.addRelation(this, this.queryStore.queryById(this.datas.trackSectionId));
|
||||
|
14
components/packages/Station/StationConfig.d.ts
vendored
14
components/packages/Station/StationConfig.d.ts
vendored
@ -1,6 +1,6 @@
|
||||
import { GraphicData } from 'jl-graphic';
|
||||
import { CategoryType } from '../Platform/PlatformConfig';
|
||||
import { KilometerSystem } from 'src/common/common';
|
||||
import { KilometerSystem } from 'common/common';
|
||||
export interface StationConstsConfig {
|
||||
codeColor: string;
|
||||
codeFontSize: number;
|
||||
@ -94,15 +94,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 declare enum Direction {
|
||||
LEFT = 0,
|
||||
RIGHT = 1
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
"jl-graphic": "git+https://git.code.tencent.com/jl-framework/graphic-pixi.git#v0.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-alias": "^5.1.0",
|
||||
"@rollup/plugin-typescript": "^11.1.5",
|
||||
"@types/node": "^20.10.5",
|
||||
"eslint": "^8.56.0",
|
||||
|
@ -1,6 +1,7 @@
|
||||
const { resolve, relative, extname } = require('path');
|
||||
const { readdirSync } = require('fs');
|
||||
const typescript = require('@rollup/plugin-typescript');
|
||||
const { default: alias } = require('@rollup/plugin-alias');
|
||||
|
||||
/**
|
||||
* @type {import('rollup').RollupOptions}
|
||||
@ -14,6 +15,9 @@ const config = {
|
||||
preserveModules: true,
|
||||
},
|
||||
plugins: [
|
||||
alias({
|
||||
entries: [{ find: 'common', replacement: 'src/common' }],
|
||||
}),
|
||||
typescript({
|
||||
tsconfig: './tsconfig.json',
|
||||
compilerOptions: {
|
||||
|
@ -1,7 +1,7 @@
|
||||
export enum DevicePort {
|
||||
A = 0,
|
||||
B = 1,
|
||||
C = 2,
|
||||
A = 'A',
|
||||
B = 'B',
|
||||
C = 'C',
|
||||
}
|
||||
|
||||
export enum DeviceType {
|
||||
|
@ -4,11 +4,7 @@ import {
|
||||
JlGraphic,
|
||||
JlGraphicTemplate,
|
||||
} from 'jl-graphic';
|
||||
import {
|
||||
IRelatedRef,
|
||||
KilometerSystem,
|
||||
protoPort2Data,
|
||||
} from 'src/common/common';
|
||||
import { IRelatedRef, KilometerSystem, protoPort2Data } from 'common/common';
|
||||
import { Container, Graphics, Color } from 'pixi.js';
|
||||
|
||||
enum TypeDetectionPoint {
|
||||
|
@ -12,7 +12,7 @@ import {
|
||||
} from 'jl-graphic';
|
||||
import { IPointData } from 'pixi.js';
|
||||
import { SectionGraphic } from './SectionGraphic';
|
||||
import { DevicePort, DeviceType, IRelatedRef } from 'src/common/common';
|
||||
import { DevicePort, DeviceType, IRelatedRef } from 'common/common';
|
||||
import { Turnout } from 'src/packages/Turnout/Turnout';
|
||||
import { AxleCounting } from 'src/packages/AxleCounting/AxleCounting';
|
||||
|
||||
@ -307,7 +307,7 @@ export class Section extends JlGraphic {
|
||||
new GraphicRelationParam(this, DevicePort.A),
|
||||
new GraphicRelationParam(
|
||||
this.queryStore.queryById(this.datas.paRef.id),
|
||||
DevicePort[this.datas.paRef.devicePort],
|
||||
this.datas.paRef.devicePort,
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -316,7 +316,7 @@ export class Section extends JlGraphic {
|
||||
new GraphicRelationParam(this, DevicePort.B),
|
||||
new GraphicRelationParam(
|
||||
this.queryStore.queryById(this.datas.pbRef.id),
|
||||
DevicePort[this.datas.pbRef.devicePort],
|
||||
this.datas.pbRef.devicePort,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { GraphicData } from 'jl-graphic';
|
||||
import { CategoryType } from '../Platform/PlatformConfig';
|
||||
import { KilometerSystem } from 'src/common/common';
|
||||
import { IRelatedRef, KilometerSystem } from 'common/common';
|
||||
|
||||
export interface StationConstsConfig {
|
||||
codeColor: string;
|
||||
|
@ -7,7 +7,10 @@
|
||||
"moduleResolution": "Node",
|
||||
"strict": true,
|
||||
"isolatedModules": true,
|
||||
"lib": ["ESNext", "DOM"]
|
||||
"lib": ["ESNext", "DOM"],
|
||||
"paths": {
|
||||
"common/*": ["src/common/*"]
|
||||
}
|
||||
},
|
||||
"include": ["src/**/*.ts"],
|
||||
"exclude": ["node_modules", "components"]
|
||||
|
12
yarn.lock
12
yarn.lock
@ -323,6 +323,13 @@
|
||||
picocolors "^1.0.0"
|
||||
tslib "^2.6.0"
|
||||
|
||||
"@rollup/plugin-alias@^5.1.0":
|
||||
version "5.1.0"
|
||||
resolved "https://registry.npmmirror.com/@rollup/plugin-alias/-/plugin-alias-5.1.0.tgz#99a94accc4ff9a3483be5baeedd5d7da3b597e93"
|
||||
integrity sha512-lpA3RZ9PdIG7qqhEfv79tBffNaoDuukFDrmhLqg9ifv99u/ehn+lOg30x2zmhf8AQqQUZaMk/B9fZraQ6/acDQ==
|
||||
dependencies:
|
||||
slash "^4.0.0"
|
||||
|
||||
"@rollup/plugin-typescript@^11.1.5":
|
||||
version "11.1.5"
|
||||
resolved "https://registry.npmmirror.com/@rollup/plugin-typescript/-/plugin-typescript-11.1.5.tgz#039c763bf943a5921f3f42be255895e75764cb91"
|
||||
@ -1691,6 +1698,11 @@ signal-exit@^3.0.3, signal-exit@^3.0.7:
|
||||
resolved "https://registry.npmmirror.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9"
|
||||
integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==
|
||||
|
||||
slash@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.npmmirror.com/slash/-/slash-4.0.0.tgz#2422372176c4c6c5addb5e2ada885af984b396a7"
|
||||
integrity sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==
|
||||
|
||||
split2@^4.2.0:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.npmmirror.com/split2/-/split2-4.2.0.tgz#c9c5920904d148bab0b9f67145f245a86aadbfa4"
|
||||
|
Loading…
Reference in New Issue
Block a user