集中区分割线关联数据增加端点
This commit is contained in:
parent
9677f87c96
commit
1b4e4fcc71
@ -28,15 +28,15 @@
|
|||||||
/>
|
/>
|
||||||
<q-list bordered separator class="rounded-borders">
|
<q-list bordered separator class="rounded-borders">
|
||||||
<q-item
|
<q-item
|
||||||
v-for="(sectionRelation, index) in sectionRelations"
|
v-for="sectionRelation in sectionRelations"
|
||||||
:key="sectionRelation"
|
:key="sectionRelation.label"
|
||||||
>
|
>
|
||||||
<q-item-section no-wrap class="q-gutter-y-sm column">
|
<q-item-section no-wrap class="q-gutter-y-sm column">
|
||||||
<q-item-label> 关联的区段-交点{{ index + 1 }} </q-item-label>
|
<q-item-label> {{ sectionRelation.label }} </q-item-label>
|
||||||
<div class="q-gutter-sm row">
|
<div class="q-gutter-sm row">
|
||||||
<q-chip
|
<q-chip
|
||||||
v-for="item in sectionRelation"
|
v-for="(item, index) in sectionRelation.refSectionInfo"
|
||||||
:key="item"
|
:key="index"
|
||||||
square
|
square
|
||||||
color="primary"
|
color="primary"
|
||||||
text-color="white"
|
text-color="white"
|
||||||
@ -67,26 +67,37 @@ const { data: concentrationDividingLineModel, onUpdate } = useFormData(
|
|||||||
const centralizedStations = ref<{ label: string; value: string }[]>([]);
|
const centralizedStations = ref<{ label: string; value: string }[]>([]);
|
||||||
|
|
||||||
const sectionRelations = computed(() => {
|
const sectionRelations = computed(() => {
|
||||||
const refSectionInfo: string[][] = [];
|
const refSectionInfo: { label: string; refSectionInfo: string[] }[] = [
|
||||||
|
{ label: '左边关联的区段', refSectionInfo: [] },
|
||||||
|
{ label: '右边关联的区段', refSectionInfo: [] },
|
||||||
|
];
|
||||||
|
enum devicePort {
|
||||||
|
'A',
|
||||||
|
'B',
|
||||||
|
}
|
||||||
const concentrationDividingLine =
|
const concentrationDividingLine =
|
||||||
drawStore.selectedGraphic as ConcentrationDividingLine;
|
drawStore.selectedGraphic as ConcentrationDividingLine;
|
||||||
concentrationDividingLine.datas.nodeConWithSecs.forEach((nodeConWithSec) => {
|
concentrationDividingLine.datas.nodeConWithSecs.forEach((nodeConWithSec) => {
|
||||||
const refleftSection =
|
const refleftSection =
|
||||||
nodeConWithSec.leftSectionId !== ''
|
nodeConWithSec.leftSection.id !== ''
|
||||||
? drawStore
|
? `${
|
||||||
.getDrawApp()
|
drawStore
|
||||||
.queryStore.queryById<Section>(nodeConWithSec.leftSectionId).datas
|
.getDrawApp()
|
||||||
.code
|
.queryStore.queryById<Section>(nodeConWithSec.leftSection.id)
|
||||||
|
.datas.code
|
||||||
|
}(${devicePort[nodeConWithSec.leftSection.devicePort]})`
|
||||||
: '边界';
|
: '边界';
|
||||||
|
refSectionInfo[0].refSectionInfo.push(refleftSection);
|
||||||
const refRightSection =
|
const refRightSection =
|
||||||
nodeConWithSec.rightSectionId !== ''
|
nodeConWithSec.rightSection.id !== ''
|
||||||
? drawStore
|
? `${
|
||||||
.getDrawApp()
|
drawStore
|
||||||
.queryStore.queryById<Section>(nodeConWithSec.rightSectionId).datas
|
.getDrawApp()
|
||||||
.code
|
.queryStore.queryById<Section>(nodeConWithSec.rightSection.id)
|
||||||
|
.datas.code
|
||||||
|
}(${devicePort[nodeConWithSec.rightSection.devicePort]})`
|
||||||
: '边界';
|
: '边界';
|
||||||
|
refSectionInfo[1].refSectionInfo.push(refRightSection);
|
||||||
refSectionInfo.push([`${refleftSection}`, `${refRightSection}`]);
|
|
||||||
});
|
});
|
||||||
return refSectionInfo;
|
return refSectionInfo;
|
||||||
});
|
});
|
||||||
|
@ -9,8 +9,9 @@ import {
|
|||||||
import { ILineGraphic } from 'src/jl-graphic/plugins/GraphicEditPlugin';
|
import { ILineGraphic } from 'src/jl-graphic/plugins/GraphicEditPlugin';
|
||||||
import { SectionGraphic } from '../sectionGraphic/SectionGraphic';
|
import { SectionGraphic } from '../sectionGraphic/SectionGraphic';
|
||||||
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
||||||
import { Section, SectionType } from '../section/Section';
|
import { Section, SectionPort, SectionType } from '../section/Section';
|
||||||
import { arePolylinesIntersect } from './ConcentrationDividingLineUtils';
|
import { arePolylinesIntersect } from './ConcentrationDividingLineUtils';
|
||||||
|
import { createRelatedRefProto } from '../CommonGraphics';
|
||||||
|
|
||||||
export interface IConcentrationDividingLineData extends GraphicData {
|
export interface IConcentrationDividingLineData extends GraphicData {
|
||||||
get code(): string; // 编号
|
get code(): string; // 编号
|
||||||
@ -115,8 +116,16 @@ export class ConcentrationDividingLine
|
|||||||
: [section.id, sectionRelations[0].id];
|
: [section.id, sectionRelations[0].id];
|
||||||
nodeConWithSecs.push(
|
nodeConWithSecs.push(
|
||||||
new graphicData.NodeConWithSec({
|
new graphicData.NodeConWithSec({
|
||||||
leftSectionId,
|
leftSection: createRelatedRefProto(
|
||||||
rightSectionId,
|
Section.Type,
|
||||||
|
leftSectionId,
|
||||||
|
SectionPort.B
|
||||||
|
),
|
||||||
|
rightSection: createRelatedRefProto(
|
||||||
|
Section.Type,
|
||||||
|
rightSectionId,
|
||||||
|
SectionPort.A
|
||||||
|
),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
} else if (sectionRelations.length == 0) {
|
} else if (sectionRelations.length == 0) {
|
||||||
@ -124,8 +133,16 @@ export class ConcentrationDividingLine
|
|||||||
relationParam === 'A' ? ['', section.id] : [section.id, ''];
|
relationParam === 'A' ? ['', section.id] : [section.id, ''];
|
||||||
nodeConWithSecs.push(
|
nodeConWithSecs.push(
|
||||||
new graphicData.NodeConWithSec({
|
new graphicData.NodeConWithSec({
|
||||||
leftSectionId,
|
leftSection: createRelatedRefProto(
|
||||||
rightSectionId,
|
Section.Type,
|
||||||
|
leftSectionId,
|
||||||
|
SectionPort.B
|
||||||
|
),
|
||||||
|
rightSection: createRelatedRefProto(
|
||||||
|
Section.Type,
|
||||||
|
rightSectionId,
|
||||||
|
SectionPort.A
|
||||||
|
),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -133,10 +150,10 @@ export class ConcentrationDividingLine
|
|||||||
});
|
});
|
||||||
nodeConWithSecs.sort((a, b) => {
|
nodeConWithSecs.sort((a, b) => {
|
||||||
const sectionAId =
|
const sectionAId =
|
||||||
a.leftSectionId !== '' ? a.leftSectionId : a.rightSectionId;
|
a.leftSection.id !== '' ? a.leftSection.id : a.rightSection.id;
|
||||||
const sectionA = this.queryStore.queryById<Section>(sectionAId);
|
const sectionA = this.queryStore.queryById<Section>(sectionAId);
|
||||||
const sectionBId =
|
const sectionBId =
|
||||||
b.leftSectionId !== '' ? b.leftSectionId : b.rightSectionId;
|
b.leftSection.id !== '' ? b.leftSection.id : b.rightSection.id;
|
||||||
const sectionB = this.queryStore.queryById<Section>(sectionBId);
|
const sectionB = this.queryStore.queryById<Section>(sectionBId);
|
||||||
return (
|
return (
|
||||||
sectionA.localToCanvasPoint(
|
sectionA.localToCanvasPoint(
|
||||||
|
@ -615,7 +615,6 @@ function oneClickgenerateStopPosition() {
|
|||||||
|
|
||||||
function oneClickRelateCentralizedStation() {
|
function oneClickRelateCentralizedStation() {
|
||||||
const drawApp = drawStore.getDrawApp();
|
const drawApp = drawStore.getDrawApp();
|
||||||
const devicePort = graphicData.RelatedRef.DevicePort;
|
|
||||||
const concentrationDividingLines = drawApp.queryStore
|
const concentrationDividingLines = drawApp.queryStore
|
||||||
.queryByType<ConcentrationDividingLine>(ConcentrationDividingLine.Type)
|
.queryByType<ConcentrationDividingLine>(ConcentrationDividingLine.Type)
|
||||||
.sort((a, b) => a.datas.points[0].x - b.datas.points[0].x);
|
.sort((a, b) => a.datas.points[0].x - b.datas.points[0].x);
|
||||||
@ -623,10 +622,16 @@ function oneClickRelateCentralizedStation() {
|
|||||||
let containDeviceIds: string[] = [];
|
let containDeviceIds: string[] = [];
|
||||||
//右边
|
//右边
|
||||||
const rightDatas = concentrationDividingLines[i].datas;
|
const rightDatas = concentrationDividingLines[i].datas;
|
||||||
const rightSections: Section[] = [];
|
const rightSections: {
|
||||||
|
section: Section;
|
||||||
|
port: graphicData.RelatedRef.DevicePort;
|
||||||
|
}[] = [];
|
||||||
rightDatas.nodeConWithSecs.forEach((node) => {
|
rightDatas.nodeConWithSecs.forEach((node) => {
|
||||||
if (node.rightSectionId !== '') {
|
if (node.rightSection.id !== '') {
|
||||||
rightSections.push(drawApp.queryStore.queryById(node.rightSectionId));
|
rightSections.push({
|
||||||
|
section: drawApp.queryStore.queryById(node.rightSection.id),
|
||||||
|
port: node.rightSection.devicePort,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//左边
|
//左边
|
||||||
@ -635,16 +640,24 @@ function oneClickRelateCentralizedStation() {
|
|||||||
const LeftDatas = concentrationDividingLines[j].datas;
|
const LeftDatas = concentrationDividingLines[j].datas;
|
||||||
if (LeftDatas.refLeftStationId == rightDatas.refRightStationId) {
|
if (LeftDatas.refLeftStationId == rightDatas.refRightStationId) {
|
||||||
LeftDatas.nodeConWithSecs.forEach((node) => {
|
LeftDatas.nodeConWithSecs.forEach((node) => {
|
||||||
if (node.leftSectionId !== '') {
|
if (node.leftSection.id !== '') {
|
||||||
leftSections.push(node.leftSectionId);
|
leftSections.push(node.leftSection.id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
containDeviceIds = [...rightSections.map((g) => g.id), ...leftSections];
|
containDeviceIds = [
|
||||||
|
...rightSections.map((g) => g.section.id),
|
||||||
|
...leftSections,
|
||||||
|
];
|
||||||
//递归从右边的设备开始找路径,找到左边相同的集中站停下来
|
//递归从右边的设备开始找路径,找到左边相同的集中站停下来
|
||||||
rightSections.forEach((rightSection) => {
|
rightSections.forEach((rightSection) => {
|
||||||
findContainDevice(rightSection, devicePort.A, containDeviceIds, drawApp);
|
findContainDevice(
|
||||||
|
rightSection.section,
|
||||||
|
rightSection.port,
|
||||||
|
containDeviceIds,
|
||||||
|
drawApp
|
||||||
|
);
|
||||||
containDeviceIds = Array.from(new Set(containDeviceIds));
|
containDeviceIds = Array.from(new Set(containDeviceIds));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1854,55 +1854,61 @@ export namespace graphicData {
|
|||||||
export class NodeConWithSec extends pb_1.Message {
|
export class NodeConWithSec extends pb_1.Message {
|
||||||
#one_of_decls: number[][] = [];
|
#one_of_decls: number[][] = [];
|
||||||
constructor(data?: any[] | {
|
constructor(data?: any[] | {
|
||||||
leftSectionId?: string;
|
leftSection?: RelatedRef;
|
||||||
rightSectionId?: string;
|
rightSection?: RelatedRef;
|
||||||
}) {
|
}) {
|
||||||
super();
|
super();
|
||||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||||
if (!Array.isArray(data) && typeof data == "object") {
|
if (!Array.isArray(data) && typeof data == "object") {
|
||||||
if ("leftSectionId" in data && data.leftSectionId != undefined) {
|
if ("leftSection" in data && data.leftSection != undefined) {
|
||||||
this.leftSectionId = data.leftSectionId;
|
this.leftSection = data.leftSection;
|
||||||
}
|
}
|
||||||
if ("rightSectionId" in data && data.rightSectionId != undefined) {
|
if ("rightSection" in data && data.rightSection != undefined) {
|
||||||
this.rightSectionId = data.rightSectionId;
|
this.rightSection = data.rightSection;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
get leftSectionId() {
|
get leftSection() {
|
||||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
return pb_1.Message.getWrapperField(this, RelatedRef, 1) as RelatedRef;
|
||||||
}
|
}
|
||||||
set leftSectionId(value: string) {
|
set leftSection(value: RelatedRef) {
|
||||||
pb_1.Message.setField(this, 1, value);
|
pb_1.Message.setWrapperField(this, 1, value);
|
||||||
}
|
}
|
||||||
get rightSectionId() {
|
get has_leftSection() {
|
||||||
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
|
return pb_1.Message.getField(this, 1) != null;
|
||||||
}
|
}
|
||||||
set rightSectionId(value: string) {
|
get rightSection() {
|
||||||
pb_1.Message.setField(this, 2, value);
|
return pb_1.Message.getWrapperField(this, RelatedRef, 2) as RelatedRef;
|
||||||
|
}
|
||||||
|
set rightSection(value: RelatedRef) {
|
||||||
|
pb_1.Message.setWrapperField(this, 2, value);
|
||||||
|
}
|
||||||
|
get has_rightSection() {
|
||||||
|
return pb_1.Message.getField(this, 2) != null;
|
||||||
}
|
}
|
||||||
static fromObject(data: {
|
static fromObject(data: {
|
||||||
leftSectionId?: string;
|
leftSection?: ReturnType<typeof RelatedRef.prototype.toObject>;
|
||||||
rightSectionId?: string;
|
rightSection?: ReturnType<typeof RelatedRef.prototype.toObject>;
|
||||||
}): NodeConWithSec {
|
}): NodeConWithSec {
|
||||||
const message = new NodeConWithSec({});
|
const message = new NodeConWithSec({});
|
||||||
if (data.leftSectionId != null) {
|
if (data.leftSection != null) {
|
||||||
message.leftSectionId = data.leftSectionId;
|
message.leftSection = RelatedRef.fromObject(data.leftSection);
|
||||||
}
|
}
|
||||||
if (data.rightSectionId != null) {
|
if (data.rightSection != null) {
|
||||||
message.rightSectionId = data.rightSectionId;
|
message.rightSection = RelatedRef.fromObject(data.rightSection);
|
||||||
}
|
}
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
toObject() {
|
toObject() {
|
||||||
const data: {
|
const data: {
|
||||||
leftSectionId?: string;
|
leftSection?: ReturnType<typeof RelatedRef.prototype.toObject>;
|
||||||
rightSectionId?: string;
|
rightSection?: ReturnType<typeof RelatedRef.prototype.toObject>;
|
||||||
} = {};
|
} = {};
|
||||||
if (this.leftSectionId != null) {
|
if (this.leftSection != null) {
|
||||||
data.leftSectionId = this.leftSectionId;
|
data.leftSection = this.leftSection.toObject();
|
||||||
}
|
}
|
||||||
if (this.rightSectionId != null) {
|
if (this.rightSection != null) {
|
||||||
data.rightSectionId = this.rightSectionId;
|
data.rightSection = this.rightSection.toObject();
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@ -1910,10 +1916,10 @@ export namespace graphicData {
|
|||||||
serialize(w: pb_1.BinaryWriter): void;
|
serialize(w: pb_1.BinaryWriter): void;
|
||||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||||
const writer = w || new pb_1.BinaryWriter();
|
const writer = w || new pb_1.BinaryWriter();
|
||||||
if (this.leftSectionId.length)
|
if (this.has_leftSection)
|
||||||
writer.writeString(1, this.leftSectionId);
|
writer.writeMessage(1, this.leftSection, () => this.leftSection.serialize(writer));
|
||||||
if (this.rightSectionId.length)
|
if (this.has_rightSection)
|
||||||
writer.writeString(2, this.rightSectionId);
|
writer.writeMessage(2, this.rightSection, () => this.rightSection.serialize(writer));
|
||||||
if (!w)
|
if (!w)
|
||||||
return writer.getResultBuffer();
|
return writer.getResultBuffer();
|
||||||
}
|
}
|
||||||
@ -1924,10 +1930,10 @@ export namespace graphicData {
|
|||||||
break;
|
break;
|
||||||
switch (reader.getFieldNumber()) {
|
switch (reader.getFieldNumber()) {
|
||||||
case 1:
|
case 1:
|
||||||
message.leftSectionId = reader.readString();
|
reader.readMessage(message.leftSection, () => message.leftSection = RelatedRef.deserialize(reader));
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
message.rightSectionId = reader.readString();
|
reader.readMessage(message.rightSection, () => message.rightSection = RelatedRef.deserialize(reader));
|
||||||
break;
|
break;
|
||||||
default: reader.skipField();
|
default: reader.skipField();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user