框架更新报错修改
This commit is contained in:
parent
2e849d8893
commit
6a8abaa990
@ -49,7 +49,7 @@ const sectionRelations = computed(() => {
|
||||
const turnout = drawStore.selectedGraphic as Turnout;
|
||||
|
||||
const sectionRelations =
|
||||
turnout?.relationManage.getRelationsOfGraphicAndOtherType(
|
||||
turnout.relationManage.getRelationsOfGraphicAndOtherType(
|
||||
turnout,
|
||||
Section.Type
|
||||
);
|
||||
|
@ -44,6 +44,24 @@ export class TurnoutData extends GraphicDataBase implements ITurnoutData {
|
||||
set pointC(v: IPointData[]) {
|
||||
this.data.pointC = v.map((p) => new graphicData.Point({ x: p.x, y: p.y }));
|
||||
}
|
||||
get paRef(): graphicData.RelatedRef {
|
||||
return new graphicData.RelatedRef();
|
||||
}
|
||||
set paRef(ref: graphicData.RelatedRef) {
|
||||
this.data.paRef = ref;
|
||||
}
|
||||
get pbRef(): graphicData.RelatedRef {
|
||||
return new graphicData.RelatedRef();
|
||||
}
|
||||
set pbRef(ref: graphicData.RelatedRef) {
|
||||
this.data.paRef = ref;
|
||||
}
|
||||
get pcRef(): graphicData.RelatedRef {
|
||||
return new graphicData.RelatedRef();
|
||||
}
|
||||
set pcRef(ref: graphicData.RelatedRef) {
|
||||
this.data.paRef = ref;
|
||||
}
|
||||
clone(): TurnoutData {
|
||||
return new TurnoutData(this.data.cloneMessage());
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ export class IscsFan extends JlGraphic {
|
||||
export class IscsFanTemplate extends JlGraphicTemplate<IscsFan> {
|
||||
fanTextures?: FanTextures;
|
||||
constructor() {
|
||||
super(IscsFan.Type);
|
||||
super(IscsFan.Type, {});
|
||||
}
|
||||
new(): IscsFan {
|
||||
if (this.fanTextures) {
|
||||
|
@ -13,15 +13,9 @@ export class IscsFanDraw extends GraphicDrawAssistant<
|
||||
> {
|
||||
_iscsFan: IscsFan | null = null;
|
||||
|
||||
constructor(app: JlDrawApp, createData: () => IIscsFanData) {
|
||||
constructor(app: JlDrawApp) {
|
||||
const template = new IscsFanTemplate();
|
||||
super(
|
||||
app,
|
||||
template,
|
||||
createData,
|
||||
'svguse:../drawIcon.svg#icon-fans',
|
||||
'风机'
|
||||
);
|
||||
super(app, template, 'svguse:../drawIcon.svg#icon-fans', '风机');
|
||||
IscsFanInteraction.init(app);
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ export class LinkTemplate extends JlGraphicTemplate<Link> {
|
||||
lineColor: string;
|
||||
segmentsCount: number;
|
||||
constructor() {
|
||||
super(Link.Type);
|
||||
super(Link.Type, {});
|
||||
this.lineWidth = 2;
|
||||
this.lineColor = '#000000';
|
||||
this.curve = false;
|
||||
|
@ -61,14 +61,8 @@ export class LinkDraw extends GraphicDrawAssistant<LinkTemplate, ILinkData> {
|
||||
},
|
||||
});
|
||||
|
||||
constructor(app: JlDrawApp, createData: () => ILinkData) {
|
||||
super(
|
||||
app,
|
||||
new LinkTemplate(),
|
||||
createData,
|
||||
'sym_o_horizontal_rule',
|
||||
'轨道Link'
|
||||
);
|
||||
constructor(app: JlDrawApp) {
|
||||
super(app, new LinkTemplate(), 'sym_o_horizontal_rule', '轨道Link');
|
||||
this.container.addChild(this.graphic);
|
||||
this.graphicTemplate.curve = true;
|
||||
|
||||
|
@ -276,7 +276,7 @@ export class PlatformTemplate extends JlGraphicTemplate<Platform> {
|
||||
hasdoor: boolean;
|
||||
direction: string;
|
||||
constructor() {
|
||||
super(Platform.Type);
|
||||
super(Platform.Type, {});
|
||||
this.hasdoor = true;
|
||||
this.direction = 'up';
|
||||
}
|
||||
|
@ -28,11 +28,10 @@ export class PlatformDraw extends GraphicDrawAssistant<
|
||||
platformGraphic: childJlGraphic = new rectGraphic();
|
||||
doorGraphic: childJlGraphic = new doorGraphic();
|
||||
|
||||
constructor(app: JlDrawApp, createData: () => IPlatformData) {
|
||||
constructor(app: JlDrawApp) {
|
||||
super(
|
||||
app,
|
||||
new PlatformTemplate(),
|
||||
createData,
|
||||
'svguse:../../drawIcon.svg#icon-platform',
|
||||
'站台Platform'
|
||||
);
|
||||
|
@ -60,7 +60,7 @@ export class PolygonTemplate extends JlGraphicTemplate<Polygon> {
|
||||
lineWidth: number;
|
||||
lineColor: string;
|
||||
constructor() {
|
||||
super(Polygon.Type);
|
||||
super(Polygon.Type, {});
|
||||
this.lineWidth = polygonConsts.lineWidth;
|
||||
this.lineColor = polygonConsts.lineColor;
|
||||
}
|
||||
|
@ -37,14 +37,8 @@ export class PolygonDraw extends GraphicDrawAssistant<
|
||||
points: Point[] = [];
|
||||
polygonGraphic: Graphics = new Graphics();
|
||||
|
||||
constructor(app: JlDrawApp, createData: () => IPolygonData) {
|
||||
super(
|
||||
app,
|
||||
new PolygonTemplate(),
|
||||
createData,
|
||||
'sym_o_square',
|
||||
'多边形Polygon'
|
||||
);
|
||||
constructor(app: JlDrawApp) {
|
||||
super(app, new PolygonTemplate(), 'sym_o_square', '多边形Polygon');
|
||||
this.container.addChild(this.polygonGraphic);
|
||||
PolygonPointsEditPlugin.init(app);
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ export class RectTemplate extends JlGraphicTemplate<Rect> {
|
||||
lineWidth: number;
|
||||
lineColor: string;
|
||||
constructor() {
|
||||
super(Rect.Type);
|
||||
super(Rect.Type, {});
|
||||
this.lineWidth = rectConsts.lineWidth;
|
||||
this.lineColor = rectConsts.lineColor;
|
||||
}
|
||||
|
@ -18,8 +18,8 @@ export class RectDraw extends GraphicDrawAssistant<RectTemplate, IRectData> {
|
||||
point2: Point | null = null;
|
||||
rectGraphic: Graphics = new Graphics();
|
||||
|
||||
constructor(app: JlDrawApp, createData: () => IRectData) {
|
||||
super(app, new RectTemplate(), createData, 'sym_o_square', '矩形Rect');
|
||||
constructor(app: JlDrawApp) {
|
||||
super(app, new RectTemplate(), 'sym_o_square', '矩形Rect');
|
||||
this.container.addChild(this.rectGraphic);
|
||||
rectInteraction.init(app);
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ export enum SectionPort {
|
||||
|
||||
export class SectionTemplate extends JlGraphicTemplate<Section> {
|
||||
constructor() {
|
||||
super(Section.Type);
|
||||
super(Section.Type, {});
|
||||
}
|
||||
new() {
|
||||
return new Section();
|
||||
|
@ -40,14 +40,8 @@ export class SectionDraw extends GraphicDrawAssistant<
|
||||
points: Point[] = [];
|
||||
graphic = new Graphics();
|
||||
|
||||
constructor(app: JlDrawApp, createData: () => ISectionData) {
|
||||
super(
|
||||
app,
|
||||
new SectionTemplate(),
|
||||
createData,
|
||||
'sym_o_timeline',
|
||||
'区段Section'
|
||||
);
|
||||
constructor(app: JlDrawApp) {
|
||||
super(app, new SectionTemplate(), 'sym_o_timeline', '区段Section');
|
||||
this.container.addChild(this.graphic);
|
||||
|
||||
SectionPointEditPlugin.init(app);
|
||||
@ -56,9 +50,9 @@ export class SectionDraw extends GraphicDrawAssistant<
|
||||
onLeftDown(e: FederatedMouseEvent): void {
|
||||
const { x, y } = this.toCanvasCoordinates(e.global);
|
||||
const p = new Point(x, y);
|
||||
// this.points.pop();
|
||||
this.points.push(p);
|
||||
}
|
||||
|
||||
onRightClick(): void {
|
||||
if (this.points.length < 2) {
|
||||
this.finish();
|
||||
@ -66,6 +60,7 @@ export class SectionDraw extends GraphicDrawAssistant<
|
||||
}
|
||||
this.createAndStore(true);
|
||||
}
|
||||
|
||||
onEsc(): void {
|
||||
if (this.points.length < 2) {
|
||||
this.finish();
|
||||
@ -87,12 +82,14 @@ export class SectionDraw extends GraphicDrawAssistant<
|
||||
});
|
||||
this.graphic.lineTo(cp.x, cp.y);
|
||||
}
|
||||
|
||||
prepareData(data: ISectionData): boolean {
|
||||
data.points = this.points;
|
||||
data.code = 'G000';
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
clearCache(): void {
|
||||
this.points = [];
|
||||
this.graphic.clear();
|
||||
@ -125,14 +122,12 @@ function buildAbsorbablePositions(section: Section): AbsorbablePosition[] {
|
||||
other.localToCanvasPoint(other.getStartPoint()),
|
||||
other.localToCanvasPoint(other.getEndPoint()),
|
||||
];
|
||||
// const apa = new AbsorbablePoint(ps);
|
||||
// const apb = new AbsorbablePoint(pe);
|
||||
const { width, height } = section.getGraphicApp().canvas;
|
||||
const xs = new AbsorbableLine({ x: 0, y: ps.y }, { x: width, y: ps.y });
|
||||
const ys = new AbsorbableLine({ x: ps.x, y: 0 }, { x: ps.x, y: height });
|
||||
const xe = new AbsorbableLine({ x: 0, y: pe.y }, { x: width, y: pe.y });
|
||||
const ye = new AbsorbableLine({ x: pe.x, y: 0 }, { x: pe.x, y: height });
|
||||
aps.push(/* apa, apb, */ xs, ys, xe, ye);
|
||||
aps.push(xs, ys, xe, ye);
|
||||
});
|
||||
|
||||
const turnouts = section.queryStore.queryByType<Turnout>(Turnout.Type);
|
||||
@ -216,9 +211,12 @@ export class SectionPointEditPlugin extends GraphicInteractionPlugin<Section> {
|
||||
g.lineGraphic.eventMode = 'static';
|
||||
g.lineGraphic.cursor = 'pointer';
|
||||
g.lineGraphic.hitArea = new SectionGraphicHitArea(g);
|
||||
g.transformSave = true;
|
||||
g.labelGraphic.eventMode = 'static';
|
||||
g.labelGraphic.cursor = 'pointer';
|
||||
g.labelGraphic.draggable = true;
|
||||
g.labelGraphic.transformSave = true;
|
||||
g.labelGraphic.name = 'label';
|
||||
g.on('selected', this.onSelected, this);
|
||||
g.on('unselected', this.onUnselected, this);
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ export class Station extends JlGraphic {
|
||||
export class StationTemplate extends JlGraphicTemplate<Station> {
|
||||
hasControl: boolean;
|
||||
constructor() {
|
||||
super(Station.Type);
|
||||
super(Station.Type, {});
|
||||
this.hasControl = true;
|
||||
}
|
||||
new(): Station {
|
||||
|
@ -19,11 +19,10 @@ export class StationDraw extends GraphicDrawAssistant<
|
||||
IStationData
|
||||
> {
|
||||
codeGraph: Station;
|
||||
constructor(app: JlDrawApp, createData: () => IStationData) {
|
||||
constructor(app: JlDrawApp) {
|
||||
super(
|
||||
app,
|
||||
new StationTemplate(),
|
||||
createData,
|
||||
'svguse:../../drawIcon.svg#icon-station',
|
||||
'车站Station'
|
||||
);
|
||||
@ -34,7 +33,7 @@ export class StationDraw extends GraphicDrawAssistant<
|
||||
|
||||
bind(): void {
|
||||
super.bind();
|
||||
this.codeGraph.loadData(this.createGraphicData());
|
||||
this.codeGraph.loadData(this.graphicTemplate.datas);
|
||||
this.codeGraph.doRepaint();
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ export class StationLine extends JlGraphic {
|
||||
export class StationLineTemplate extends JlGraphicTemplate<StationLine> {
|
||||
hasTransfer: boolean;
|
||||
constructor() {
|
||||
super(StationLine.Type);
|
||||
super(StationLine.Type, {});
|
||||
this.hasTransfer = true;
|
||||
}
|
||||
new(): StationLine {
|
||||
|
@ -25,11 +25,10 @@ export class StationLineDraw extends GraphicDrawAssistant<
|
||||
IStationLineData
|
||||
> {
|
||||
codeGraph: StationLine;
|
||||
constructor(app: JlDrawApp, createData: () => IStationLineData) {
|
||||
constructor(app: JlDrawApp) {
|
||||
super(
|
||||
app,
|
||||
new StationLineTemplate(),
|
||||
createData,
|
||||
'svguse:../../drawIcon.svg#icon-station',
|
||||
'车站StationLine'
|
||||
);
|
||||
@ -40,7 +39,7 @@ export class StationLineDraw extends GraphicDrawAssistant<
|
||||
|
||||
bind(): void {
|
||||
super.bind();
|
||||
this.codeGraph.loadData(this.createGraphicData());
|
||||
this.codeGraph.loadData(this.graphicTemplate.datas);
|
||||
this.codeGraph.doRepaint();
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ export class TrainTemplate extends JlGraphicTemplate<Train> {
|
||||
trainDirection: string;
|
||||
hasBorder: boolean;
|
||||
constructor() {
|
||||
super(Train.Type);
|
||||
super(Train.Type, {});
|
||||
this.trainDirection = 'left';
|
||||
this.hasBorder = true;
|
||||
}
|
||||
|
@ -23,14 +23,8 @@ export class TrainDraw extends GraphicDrawAssistant<TrainTemplate, ITrainData> {
|
||||
headLeft: TrainHead;
|
||||
trainbody: TrainBody;
|
||||
|
||||
constructor(app: JlDrawApp, createData: () => ITrainData) {
|
||||
super(
|
||||
app,
|
||||
new TrainTemplate(),
|
||||
createData,
|
||||
'directions_bus_filled',
|
||||
'列车Train'
|
||||
);
|
||||
constructor(app: JlDrawApp) {
|
||||
super(app, new TrainTemplate(), 'directions_bus_filled', '列车Train');
|
||||
this.headLeft = new TrainHead('left');
|
||||
this.trainbody = new TrainBody();
|
||||
this.container.addChild(this.headLeft);
|
||||
|
@ -30,7 +30,7 @@ export class TrainLine extends JlGraphic {
|
||||
export class ItrainLineTemplate extends JlGraphicTemplate<TrainLine> {
|
||||
trainTextures?: Texture;
|
||||
constructor() {
|
||||
super(TrainLine.Type);
|
||||
super(TrainLine.Type, {});
|
||||
}
|
||||
new(): TrainLine {
|
||||
if (this.trainTextures) {
|
||||
|
@ -13,9 +13,9 @@ export class TrainLineDraw extends GraphicDrawAssistant<
|
||||
> {
|
||||
train: TrainLine | null = null;
|
||||
|
||||
constructor(app: JlDrawApp, createData: () => ITrainLineData) {
|
||||
constructor(app: JlDrawApp) {
|
||||
const template = new ItrainLineTemplate();
|
||||
super(app, template, createData, 'directions_bus_filled', '列车线网');
|
||||
super(app, template, 'directions_bus_filled', '列车线网');
|
||||
ItrainLineInteraction.init(app);
|
||||
}
|
||||
|
||||
|
@ -38,8 +38,8 @@ export class TrainWindowDraw extends GraphicDrawAssistant<
|
||||
ITrainWindowData
|
||||
> {
|
||||
trainWindowGraph: TrainWindow;
|
||||
constructor(app: JlDrawApp, createData: () => ITrainWindowData) {
|
||||
super(app, new TrainWindowTemplate(), createData, 'sym_o_square', '不展示');
|
||||
constructor(app: JlDrawApp) {
|
||||
super(app, new TrainWindowTemplate(), 'sym_o_square', '不展示');
|
||||
this.trainWindowGraph = this.graphicTemplate.new();
|
||||
this.container.addChild(this.trainWindowGraph);
|
||||
TrainWindowInteraction.init(app);
|
||||
@ -47,7 +47,7 @@ export class TrainWindowDraw extends GraphicDrawAssistant<
|
||||
|
||||
bind(): void {
|
||||
super.bind();
|
||||
this.trainWindowGraph.loadData(this.createGraphicData());
|
||||
this.trainWindowGraph.loadData(this.graphicTemplate.datas);
|
||||
this.trainWindowGraph.doRepaint();
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ export class TrainWindowDraw extends GraphicDrawAssistant<
|
||||
const offsetX = (direction * TrainWindowConsts.width + interval) * i;
|
||||
point.x += offsetX;
|
||||
const trainWindow = new TrainWindow();
|
||||
trainWindow.loadData(this.createGraphicData());
|
||||
trainWindow.loadData(this.graphicTemplate.datas);
|
||||
trainWindow.position.copyFrom(point);
|
||||
trainWindow.id = GraphicIdGenerator.next();
|
||||
trainWindows.push(trainWindow);
|
||||
@ -109,7 +109,7 @@ export class TrainWindowDraw extends GraphicDrawAssistant<
|
||||
for (let i = 0; i < points.length - 1; i++) {
|
||||
const x = (points[i].x + points[i + 1].x) / 2;
|
||||
const trainWindow = new TrainWindow();
|
||||
trainWindow.loadData(this.createGraphicData());
|
||||
trainWindow.loadData(this.graphicTemplate.datas);
|
||||
trainWindow.position.set(
|
||||
x,
|
||||
points[i].y - direction * TrainWindowConsts.offsetSection
|
||||
|
@ -112,6 +112,8 @@ export class Turnout extends JlGraphic {
|
||||
this.graphics.label.style.fill = '#0f0';
|
||||
this.graphics.label.setVectorFontSize(16);
|
||||
this.graphics.label.position.set(20, 20);
|
||||
this.graphics.label.transformSave = true;
|
||||
this.graphics.label.name = 'label';
|
||||
this.addChild(this.graphics.label);
|
||||
}
|
||||
|
||||
@ -282,7 +284,7 @@ export enum TurnoutPort {
|
||||
|
||||
export class TurnoutTemplate extends JlGraphicTemplate<Turnout> {
|
||||
constructor() {
|
||||
super(Turnout.Type);
|
||||
super(Turnout.Type, {});
|
||||
}
|
||||
|
||||
new() {
|
||||
|
@ -37,14 +37,8 @@ export class TurnoutDraw extends GraphicDrawAssistant<
|
||||
ITurnoutData
|
||||
> {
|
||||
turnout: Turnout;
|
||||
constructor(app: JlDrawApp, createData: () => ITurnoutData) {
|
||||
super(
|
||||
app,
|
||||
new TurnoutTemplate(),
|
||||
createData,
|
||||
'sym_o_ramp_left',
|
||||
'道岔Turnout'
|
||||
);
|
||||
constructor(app: JlDrawApp) {
|
||||
super(app, new TurnoutTemplate(), 'sym_o_ramp_left', '道岔Turnout');
|
||||
|
||||
this.turnout = this.graphicTemplate.new();
|
||||
this.container.addChild(this.turnout);
|
||||
|
Loading…
Reference in New Issue
Block a user