sectionLink问题调整
This commit is contained in:
parent
2d52847289
commit
d30734eef3
@ -185,7 +185,7 @@ export class SectionLink extends JlGraphic implements ILineGraphic {
|
||||
if (!k2 || !k1) {
|
||||
throw new Error('未获取到link两侧公里标');
|
||||
}
|
||||
this._linkLength = k2 - k1;
|
||||
this._linkLength = Math.abs(k2 - k1);
|
||||
}
|
||||
return this._linkLength;
|
||||
}
|
||||
|
@ -168,17 +168,17 @@ export class SectionLinkDraw extends GraphicDrawAssistant<
|
||||
const forkP2 = new Point(turnout.position.x, turnout.position.y);
|
||||
const points: IPointData[] = [forkP1];
|
||||
const refTurnout1 = this.buildRelatedRef(
|
||||
turnout.id,
|
||||
rrDeviceType.Turnout,
|
||||
port
|
||||
);
|
||||
const refTurnout2 = this.buildRelatedRef(
|
||||
pRef.id,
|
||||
rrDeviceType.Turnout,
|
||||
pRef.devicePort
|
||||
);
|
||||
const refSimT1 = this.buildSimpleRef(turnout.id, srDeviceType.Turnout);
|
||||
const refSimT2 = this.buildSimpleRef(pRef.id, srDeviceType.Turnout);
|
||||
const refTurnout2 = this.buildRelatedRef(
|
||||
turnout.id,
|
||||
rrDeviceType.Turnout,
|
||||
port
|
||||
);
|
||||
const refSimT1 = this.buildSimpleRef(pRef.id, srDeviceType.Turnout);
|
||||
const refSimT2 = this.buildSimpleRef(turnout.id, srDeviceType.Turnout);
|
||||
if (forkP1.x > forkP2.x) {
|
||||
sectionLink.datas.aSimRef = refSimT2;
|
||||
sectionLink.datas.bSimRef = refSimT1;
|
||||
@ -361,12 +361,17 @@ export class SectionLinkDraw extends GraphicDrawAssistant<
|
||||
* @param curLinks
|
||||
* @param sectionLink
|
||||
*/
|
||||
recognizeAndCreateLink(curLinks: string[], sectionLink: SectionLink) {
|
||||
recognizeAndCreateLink(
|
||||
curLinks: string[],
|
||||
sectionLink: SectionLink
|
||||
): boolean {
|
||||
const id1 = sectionLink.datas.aSimRef?.id;
|
||||
const id2 = sectionLink.datas.bSimRef?.id;
|
||||
if (!curLinks.includes(id1 + '_' + id2)) {
|
||||
this.storeGraphic(sectionLink);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* 一键生成link
|
||||
@ -402,9 +407,11 @@ export class SectionLinkDraw extends GraphicDrawAssistant<
|
||||
axle1
|
||||
);
|
||||
gSectionList.push(g.id);
|
||||
this.recognizeAndCreateLink(curLinks, link);
|
||||
this.cacheAxleLinkRelation(axleRefLink, axleCounting.id, link.id);
|
||||
this.cacheAxleLinkRelation(axleRefLink, axle1.id, link.id);
|
||||
const addFlag = this.recognizeAndCreateLink(curLinks, link);
|
||||
if (addFlag) {
|
||||
this.cacheAxleLinkRelation(axleRefLink, axleCounting.id, link.id);
|
||||
this.cacheAxleLinkRelation(axleRefLink, axle1.id, link.id);
|
||||
}
|
||||
}
|
||||
} else if (g.type === Turnout.Type) {
|
||||
const link = this.generateByTurnoutAxle(
|
||||
@ -412,8 +419,10 @@ export class SectionLinkDraw extends GraphicDrawAssistant<
|
||||
device.devicePort,
|
||||
axleCounting
|
||||
);
|
||||
this.recognizeAndCreateLink(curLinks, link);
|
||||
this.cacheAxleLinkRelation(axleRefLink, axleCounting.id, link.id);
|
||||
const addFlag = this.recognizeAndCreateLink(curLinks, link);
|
||||
if (addFlag) {
|
||||
this.cacheAxleLinkRelation(axleRefLink, axleCounting.id, link.id);
|
||||
}
|
||||
this.cacheTurnoutPort(tpMap, g.id, device.devicePort);
|
||||
}
|
||||
});
|
||||
@ -469,6 +478,7 @@ class LinkPolylineEditPlugin extends PolylineEditPlugin {
|
||||
labels: VectorText[] = [];
|
||||
constructor(g: ILineGraphic, options?: IEditPointOptions) {
|
||||
super(g, options);
|
||||
console.log(g._datas);
|
||||
this.name = LinkPolylineEditPlugin.Name;
|
||||
this.initLabels();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user