link 关联设备调整
This commit is contained in:
parent
b3c7646fba
commit
4ef7437a5a
@ -10,8 +10,9 @@ import {
|
||||
} from 'src/jl-graphic';
|
||||
import { ILineGraphic } from 'src/jl-graphic/plugins/GraphicEditPlugin';
|
||||
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
||||
import { AxleCounting } from '../axleCounting/AxleCounting';
|
||||
import { IRelatedRefData, DevicePosition } from '../CommonGraphics';
|
||||
import { Section } from '../section/Section';
|
||||
import { Section, SectionPort } from '../section/Section';
|
||||
import { Turnout } from '../turnout/Turnout';
|
||||
|
||||
export interface ILinkData extends GraphicData {
|
||||
@ -95,11 +96,14 @@ export class Link extends JlGraphic implements ILineGraphic {
|
||||
|
||||
getDevicePoint(id: string, devicePort: number) {
|
||||
const device = this.queryStore.queryById(id);
|
||||
if (device.type === Section.Type) {
|
||||
if (devicePort === graphicData.RelatedRef.DevicePort.A) {
|
||||
return device.localToCanvasPoint((device as Section).getStartPoint());
|
||||
} else if (devicePort === graphicData.RelatedRef.DevicePort.B) {
|
||||
return device.localToCanvasPoint((device as Section).getEndPoint());
|
||||
if (device.type === AxleCounting.Type) {
|
||||
const relations = device.queryRelationByType(Section.Type);
|
||||
const relation = relations[0].getOtherRelationParam(device);
|
||||
const section = relations[0].getOtherGraphic<Section>(device);
|
||||
if (relation.param === SectionPort.A) {
|
||||
return section.localToCanvasPoint(section.getStartPoint());
|
||||
} else if (relation.param === SectionPort.B) {
|
||||
return section.localToCanvasPoint(section.getEndPoint());
|
||||
} else {
|
||||
console.error(devicePort, device);
|
||||
throw new Error('Link关联设备端口错误!');
|
||||
|
Loading…
Reference in New Issue
Block a user