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