Merge branch 'master' of https://git.code.tencent.com/beijing-rtss-test/bj-rtss-client
This commit is contained in:
commit
1619eb05b6
@ -84,9 +84,15 @@ function onUpdate() {
|
||||
|
||||
const logicSectionRelations = computed(() => {
|
||||
const logicSection = drawStore.selectedGraphic as LogicSection;
|
||||
const axleCountingSection = logicSection.queryStore.queryById(
|
||||
logicSection.datas.axleSectionId
|
||||
) as AxleCountingSection;
|
||||
return [axleCountingSection.datas.code];
|
||||
let arr: string[] = [];
|
||||
if (logicSection.datas.axleSectionId) {
|
||||
const axleCountingSection = logicSection.queryStore.queryById(
|
||||
logicSection.datas.axleSectionId
|
||||
) as AxleCountingSection;
|
||||
if (axleCountingSection) {
|
||||
arr = [axleCountingSection.datas.code];
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
});
|
||||
</script>
|
||||
|
@ -14,7 +14,7 @@ export class LogicSectionData
|
||||
constructor(data?: graphicData.LogicSection) {
|
||||
let logicSection;
|
||||
if (!data) {
|
||||
logicSection = new graphicData.AxleCountingSection({
|
||||
logicSection = new graphicData.LogicSection({
|
||||
common: GraphicDataBase.defaultCommonInfo(LogicSection.Type),
|
||||
});
|
||||
} else {
|
||||
|
@ -458,9 +458,9 @@ export async function loadDrawDatas(app: GraphicApp) {
|
||||
storage.axleCountingSections.forEach((axleCountingSection) => {
|
||||
datas.push(new AxleCountingSectionData(axleCountingSection));
|
||||
});
|
||||
// storage.logicSections.forEach((logicSection) => {
|
||||
// datas.push(new LogicSectionData(logicSection));
|
||||
// });
|
||||
storage.logicSections.forEach((logicSection) => {
|
||||
datas.push(new LogicSectionData(logicSection));
|
||||
});
|
||||
await app.loadGraphic(datas);
|
||||
} else {
|
||||
app.loadGraphic([]);
|
||||
|
@ -15,7 +15,7 @@ import {
|
||||
AxleCounting,
|
||||
AxleCountingTemplate,
|
||||
} from './AxleCounting';
|
||||
import { Section, SectionPort, SectionType } from '../section/Section';
|
||||
import { Section, SectionPort } from '../section/Section';
|
||||
import { Turnout, TurnoutPort } from '../turnout/Turnout';
|
||||
import { IRelatedRefData, createRelatedRefProto } from '../CommonGraphics';
|
||||
import { Signal } from '../signal/Signal';
|
||||
|
@ -5,6 +5,7 @@ import {
|
||||
JlGraphic,
|
||||
JlGraphicTemplate,
|
||||
VectorText,
|
||||
calculateLineMidpoint,
|
||||
} from 'src/jl-graphic';
|
||||
import { IRelatedRefData, protoPort2Data } from '../CommonGraphics';
|
||||
import { SectionPort } from '../section/Section';
|
||||
@ -49,7 +50,7 @@ export class AxleCountingSection extends JlGraphic {
|
||||
this.labelGraphic = new VectorText();
|
||||
this.labelGraphic.setVectorFontSize(14);
|
||||
this.labelGraphic.anchor.set(0.5);
|
||||
this.labelGraphic.style.fill = '#0f0';
|
||||
this.labelGraphic.style.fill = '0xff0000';
|
||||
this.labelGraphic.transformSave = true;
|
||||
this.labelGraphic.name = 'label';
|
||||
this.transformSave = true;
|
||||
@ -83,10 +84,11 @@ export class AxleCountingSection extends JlGraphic {
|
||||
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
|
||||
const centerPos = calculateLineMidpoint(
|
||||
this.datas.points[0],
|
||||
this.datas.points[this.datas.points.length - 1]
|
||||
);
|
||||
this.labelGraphic.position.set(centerPos.x, centerPos.y + 40);
|
||||
}
|
||||
}
|
||||
get linePoints(): IPointData[] {
|
||||
|
@ -394,7 +394,6 @@ export class AxleCountingSectionInteraction extends GraphicInteractionPlugin<Axl
|
||||
),
|
||||
num
|
||||
);
|
||||
// let codeAppend = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.slice(0, num);
|
||||
if (
|
||||
(dir === 'ltr' &&
|
||||
axleCountingSectionData.points[0].x >
|
||||
@ -407,9 +406,8 @@ export class AxleCountingSectionInteraction extends GraphicInteractionPlugin<Axl
|
||||
axleCountingSectionData.points.length - 1
|
||||
].x)
|
||||
) {
|
||||
// codeAppend = codeAppend.split('').reverse().join('');
|
||||
}
|
||||
points.forEach((ps, i) => {
|
||||
points.forEach((ps) => {
|
||||
const data = new LogicSectionData();
|
||||
data.id = GraphicIdGenerator.next();
|
||||
data.axleSectionId = axleCountingSection.id;
|
||||
|
@ -71,18 +71,28 @@ export class LogicSectionDraw extends GraphicDrawAssistant<
|
||||
// this.app.deleteGraphics(...logicSections);
|
||||
// return;
|
||||
logicSections.forEach((logicSection) => {
|
||||
map.set(`${logicSection.datas.axleSectionId}`, 1);
|
||||
const ac = this.app.queryStore.queryById(
|
||||
logicSection.datas.axleSectionId
|
||||
) as AxleCountingSection;
|
||||
if (ac) {
|
||||
map.set(`${logicSection.datas.axleSectionId}`, 1);
|
||||
} else {
|
||||
this.app.deleteGraphics(logicSection);
|
||||
}
|
||||
});
|
||||
const axleCountingSections =
|
||||
this.app.queryStore.queryByType<AxleCountingSection>(
|
||||
AxleCountingSection.Type
|
||||
);
|
||||
axleCountingSections.forEach((axleCountingSection) => {
|
||||
if (map.has(`${axleCountingSection.id}`)) {
|
||||
return;
|
||||
}
|
||||
map.set(`${axleCountingSection.id}`, 1);
|
||||
const turnoutPosRef = axleCountingSection.datas.turnoutPosRef;
|
||||
if (turnoutPosRef.length > 0) {
|
||||
turnoutPosRef.forEach((turnout) => {
|
||||
if (turnout.position == 1 && !map.has(`${turnout.id}`)) {
|
||||
map.set(`${turnout.id}`, 1);
|
||||
if (turnout.position == 1) {
|
||||
const t = this.app.queryStore.queryById(turnout.id) as Turnout;
|
||||
const data = new LogicSectionData();
|
||||
data.points = [
|
||||
@ -94,13 +104,10 @@ export class LogicSectionDraw extends GraphicDrawAssistant<
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!map.has(`${axleCountingSection.id}`)) {
|
||||
map.set(`${axleCountingSection.id}`, 1);
|
||||
const data = new LogicSectionData();
|
||||
data.points = axleCountingSection.datas.points;
|
||||
data.axleSectionId = axleCountingSection.id;
|
||||
this.draw(data);
|
||||
}
|
||||
const data = new LogicSectionData();
|
||||
data.points = axleCountingSection.datas.points;
|
||||
data.axleSectionId = axleCountingSection.id;
|
||||
this.draw(data);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -302,6 +302,11 @@ class SectionPolylineEditPlugin extends PolylineEditPlugin {
|
||||
relation.getRelationParam(this.graphic).param === SectionPort.B
|
||||
);
|
||||
}
|
||||
relations = relations.filter(
|
||||
(relation) =>
|
||||
relation.getOtherGraphic(this.graphic) instanceof Turnout ||
|
||||
relation.getOtherGraphic(this.graphic) instanceof Section
|
||||
);
|
||||
if (!relations.length) return;
|
||||
const points: IPointData[] = [];
|
||||
const otherGraphics = relations.map((relation) =>
|
||||
|
@ -410,6 +410,11 @@ export class TurnoutEditPlugin extends GraphicEditPlugin<Turnout> {
|
||||
relation.getRelationParam(this.graphic).param === TurnoutPort.C
|
||||
);
|
||||
}
|
||||
relations = relations.filter(
|
||||
(relation) =>
|
||||
relation.getOtherGraphic(this.graphic) instanceof Turnout ||
|
||||
relation.getOtherGraphic(this.graphic) instanceof Section
|
||||
);
|
||||
if (!relations.length) return;
|
||||
const otherGraphics = relations.map((relation) =>
|
||||
relation.getOtherGraphic(this.graphic)
|
||||
|
Loading…
Reference in New Issue
Block a user