Merge branch 'master' of https://git.code.tencent.com/xian-ncc-da/xian-ncc-da-client
This commit is contained in:
commit
e1ab9751e5
@ -41,7 +41,7 @@
|
||||
<div class="q-gutter-sm row">
|
||||
<q-chip
|
||||
v-for="item in sectionRelations"
|
||||
:key="item.id"
|
||||
:key="item"
|
||||
square
|
||||
color="primary"
|
||||
text-color="white"
|
||||
@ -57,7 +57,7 @@
|
||||
<div class="q-gutter-sm row">
|
||||
<q-chip
|
||||
v-for="item in turnoutRelations"
|
||||
:key="item.id"
|
||||
:key="item"
|
||||
square
|
||||
color="primary"
|
||||
text-color="white"
|
||||
@ -137,12 +137,13 @@ const sectionRelations = computed(() => {
|
||||
axleCounting,
|
||||
Section.Type
|
||||
);
|
||||
return sectionRelations.map(
|
||||
const ref = sectionRelations.map(
|
||||
(relation) =>
|
||||
`${relation.getOtherGraphic<Section>(axleCounting).datas.code}(${
|
||||
relation.getOtherRelationParam(axleCounting).param
|
||||
})`
|
||||
);
|
||||
return Array.from(new Set(ref));
|
||||
});
|
||||
|
||||
const turnoutRelations = computed(() => {
|
||||
@ -152,11 +153,12 @@ const turnoutRelations = computed(() => {
|
||||
axleCounting,
|
||||
Turnout.Type
|
||||
);
|
||||
return turnoutRelations.map(
|
||||
const ref = turnoutRelations.map(
|
||||
(relation) =>
|
||||
`${relation.getOtherGraphic<Turnout>(axleCounting).datas.code}(${
|
||||
relation.getOtherRelationParam(axleCounting).param
|
||||
})`
|
||||
);
|
||||
return Array.from(new Set(ref));
|
||||
});
|
||||
</script>
|
||||
|
@ -91,7 +91,7 @@ export class AxleCounting extends JlGraphic {
|
||||
if (this.datas.axleCountingRef.length) {
|
||||
this.datas.axleCountingRef.forEach((device) => {
|
||||
this.relationManage.addRelation(
|
||||
this,
|
||||
new GraphicRelationParam(this, 'A'),
|
||||
new GraphicRelationParam(
|
||||
this.queryStore.queryById(device.id),
|
||||
protoPort2Data(device.devicePort)
|
||||
|
@ -7,6 +7,7 @@ import {
|
||||
GraphicInteractionPlugin,
|
||||
JlDrawApp,
|
||||
JlGraphic,
|
||||
distance2,
|
||||
} from 'src/jl-graphic';
|
||||
|
||||
import {
|
||||
@ -18,6 +19,7 @@ import {
|
||||
import { Section, SectionPort, SectionType } from '../section/Section';
|
||||
import { Turnout, TurnoutPort } from '../turnout/Turnout';
|
||||
import { IRelatedRefData, createRelatedRefProto } from '../CommonGraphics';
|
||||
import { Signal } from '../signal/Signal';
|
||||
|
||||
export interface IAxleCountingDrawOptions {
|
||||
newData: () => IAxleCountingData;
|
||||
@ -84,9 +86,20 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
|
||||
port == TurnoutPort.B &&
|
||||
refPort == TurnoutPort.B
|
||||
) {
|
||||
map.set(`${graphic.id}-${port}`, 1);
|
||||
map.set(`${refGraphic.id}-${refPort}`, 1);
|
||||
return;
|
||||
const points = (graphic as Turnout).getPortPoints();
|
||||
const portPs = graphic.localToCanvasPoints(points[1][0])[0];
|
||||
let hasSingle = false;
|
||||
const singles = this.app.queryStore.queryByType<Signal>(Signal.Type);
|
||||
singles.forEach((single) => {
|
||||
if (distance2(portPs, single.position) < 50) {
|
||||
hasSingle = true;
|
||||
}
|
||||
});
|
||||
if (!hasSingle) {
|
||||
map.set(`${graphic.id}-${port}`, 1);
|
||||
map.set(`${refGraphic.id}-${refPort}`, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
@ -258,7 +271,9 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
|
||||
const portIndex = DevicePort[port] as unknown as number;
|
||||
const refTurnout = relation.getOtherGraphic<Turnout>(turnout);
|
||||
const refTurnoutPort = relation.getOtherRelationParam(turnout).param;
|
||||
const portPs = turnout.localToCanvasPoints(points[portIndex][0])[0];
|
||||
const portPs = turnout.localToCanvasPoints(...points[portIndex])[
|
||||
points[portIndex].length - 1
|
||||
];
|
||||
this.draw(
|
||||
portPs,
|
||||
1,
|
||||
@ -286,10 +301,10 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
|
||||
return p !== port && p;
|
||||
});
|
||||
otherPort.forEach((port) => {
|
||||
const portIndex1 = DevicePort[port] as unknown as number;
|
||||
const portIndex = DevicePort[port] as unknown as number;
|
||||
const axleCountingPs1 = turnout.localToCanvasPoints(
|
||||
points[portIndex1][0]
|
||||
)[0];
|
||||
...points[portIndex]
|
||||
)[points[portIndex].length - 1];
|
||||
this.drawAdd(axleCountingPs1, 1, turnout, port, map);
|
||||
});
|
||||
} else if (axleCountingRelations.length == 2) {
|
||||
@ -302,8 +317,8 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
|
||||
if (otherPort.length) {
|
||||
const portIndex = DevicePort[otherPort[0]] as unknown as number;
|
||||
const axleCountingPs1 = turnout.localToCanvasPoints(
|
||||
points[portIndex][0]
|
||||
)[0];
|
||||
...points[portIndex]
|
||||
)[points[portIndex].length - 1];
|
||||
this.drawAdd(axleCountingPs1, 1, turnout, otherPort[0], map);
|
||||
}
|
||||
} else if (axleCountingRelations.length == 0) {
|
||||
|
@ -34,10 +34,10 @@ export interface ISectionData extends GraphicData {
|
||||
set code(v: string);
|
||||
get points(): IPointData[]; // 线坐标点
|
||||
set points(points: IPointData[]);
|
||||
get paRef(): IRelatedRefData;
|
||||
set paRef(ref: IRelatedRefData);
|
||||
get pbRef(): IRelatedRefData;
|
||||
set pbRef(ref: IRelatedRefData);
|
||||
get paRef(): IRelatedRefData | undefined;
|
||||
set paRef(ref: IRelatedRefData | undefined);
|
||||
get pbRef(): IRelatedRefData | undefined;
|
||||
set pbRef(ref: IRelatedRefData | undefined);
|
||||
get sectionType(): SectionType;
|
||||
set sectionType(type: SectionType);
|
||||
get children(): string[];
|
||||
@ -204,6 +204,8 @@ export class Section extends JlGraphic implements ILineGraphic {
|
||||
paDevice.id,
|
||||
paRelation?.getOtherRelationParam(this).param
|
||||
);
|
||||
} else {
|
||||
this.datas.paRef = undefined;
|
||||
}
|
||||
const pbRelation = this.relationManage
|
||||
.getRelationsOfGraphic(this)
|
||||
@ -217,6 +219,8 @@ export class Section extends JlGraphic implements ILineGraphic {
|
||||
pbDevice.id,
|
||||
pbRelation?.getOtherRelationParam(this).param
|
||||
);
|
||||
} else {
|
||||
this.datas.pbRef = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,12 +27,12 @@ export interface ITurnoutData extends GraphicData {
|
||||
set pointB(point: IPointData[]);
|
||||
get pointC(): IPointData[];
|
||||
set pointC(point: IPointData[]);
|
||||
get paRef(): IRelatedRefData;
|
||||
set paRef(ref: IRelatedRefData);
|
||||
get pbRef(): IRelatedRefData;
|
||||
set pbRef(ref: IRelatedRefData);
|
||||
get pcRef(): IRelatedRefData;
|
||||
set pcRef(ref: IRelatedRefData);
|
||||
get paRef(): IRelatedRefData | undefined;
|
||||
set paRef(ref: IRelatedRefData | undefined);
|
||||
get pbRef(): IRelatedRefData | undefined;
|
||||
set pbRef(ref: IRelatedRefData | undefined);
|
||||
get pcRef(): IRelatedRefData | undefined;
|
||||
set pcRef(ref: IRelatedRefData | undefined);
|
||||
get kilometerSystem(): KilometerSystem[];
|
||||
set kilometerSystem(v: KilometerSystem[]);
|
||||
clone(): ITurnoutData;
|
||||
@ -268,6 +268,8 @@ export class Turnout extends JlGraphic {
|
||||
paDevice.id,
|
||||
paRelation?.getOtherRelationParam(this).param
|
||||
);
|
||||
} else {
|
||||
this.datas.paRef = undefined;
|
||||
}
|
||||
const pbRelation = this.relationManage
|
||||
.getRelationsOfGraphic(this)
|
||||
@ -281,6 +283,8 @@ export class Turnout extends JlGraphic {
|
||||
pbDevice.id,
|
||||
pbRelation?.getOtherRelationParam(this).param
|
||||
);
|
||||
} else {
|
||||
this.datas.pbRef = undefined;
|
||||
}
|
||||
const pcRelation = this.relationManage
|
||||
.getRelationsOfGraphic(this)
|
||||
@ -294,6 +298,8 @@ export class Turnout extends JlGraphic {
|
||||
pcDevice.id,
|
||||
pcRelation?.getOtherRelationParam(this).param
|
||||
);
|
||||
} else {
|
||||
this.datas.pcRef = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user