图形绘制的引入修改

This commit is contained in:
joylink_zhaoerwei 2023-09-01 10:02:58 +08:00
parent a2c0bceb2d
commit 32cfc5f329
18 changed files with 77 additions and 83 deletions

View File

@ -5,7 +5,7 @@ import {
GraphicDrawAssistant, GraphicDrawAssistant,
GraphicIdGenerator, GraphicIdGenerator,
GraphicInteractionPlugin, GraphicInteractionPlugin,
JlDrawApp, IDrawApp,
JlGraphic, JlGraphic,
distance2, distance2,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
@ -16,7 +16,7 @@ import {
AxleCountingTemplate, AxleCountingTemplate,
AxleCountingConsts, AxleCountingConsts,
} from './AxleCounting'; } from './AxleCounting';
import { Section, SectionPort, SectionType } from '../section/Section'; import { Section, SectionPort } from '../section/Section';
import { Turnout, TurnoutPort } from '../turnout/Turnout'; import { Turnout, TurnoutPort } from '../turnout/Turnout';
import { IRelatedRefData, createRelatedRefProto } from '../CommonGraphics'; import { IRelatedRefData, createRelatedRefProto } from '../CommonGraphics';
import { Signal } from '../signal/Signal'; import { Signal } from '../signal/Signal';
@ -42,7 +42,7 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
IAxleCountingData IAxleCountingData
> { > {
codeGraph: AxleCounting; codeGraph: AxleCounting;
constructor(app: JlDrawApp, template: AxleCountingTemplate) { constructor(app: IDrawApp, template: AxleCountingTemplate) {
super(app, template, 'sym_o_circle', '不展示'); super(app, template, 'sym_o_circle', '不展示');
this.codeGraph = this.graphicTemplate.new(); this.codeGraph = this.graphicTemplate.new();
this.container.addChild(this.codeGraph); this.container.addChild(this.codeGraph);
@ -198,12 +198,6 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
if (axleCountingPs.y > height.y) { if (axleCountingPs.y > height.y) {
direction = -1; direction = -1;
} }
if (
section.datas.sectionType === SectionType.Logic ||
section.datas.children.includes(refDevice.id)
) {
return;
}
if (refDevice.type == Section.Type || refDevice.type == Turnout.Type) if (refDevice.type == Section.Type || refDevice.type == Turnout.Type)
this.draw( this.draw(
axleCountingPs, axleCountingPs,
@ -352,10 +346,10 @@ function buildAbsorbablePositions(
export class AxleCountingInteraction extends GraphicInteractionPlugin<AxleCounting> { export class AxleCountingInteraction extends GraphicInteractionPlugin<AxleCounting> {
static Name = 'AxleCounting_transform'; static Name = 'AxleCounting_transform';
constructor(app: JlDrawApp) { constructor(app: IDrawApp) {
super(AxleCountingInteraction.Name, app); super(AxleCountingInteraction.Name, app);
} }
static init(app: JlDrawApp) { static init(app: IDrawApp) {
return new AxleCountingInteraction(app); return new AxleCountingInteraction(app);
} }
filter(...grahpics: JlGraphic[]): AxleCounting[] | undefined { filter(...grahpics: JlGraphic[]): AxleCounting[] | undefined {

View File

@ -10,11 +10,11 @@ import {
import { import {
AbsorbablePosition, AbsorbablePosition,
DraggablePoint, DraggablePoint,
GraphicApp, IGraphicApp,
GraphicDrawAssistant, GraphicDrawAssistant,
GraphicInteractionPlugin, GraphicInteractionPlugin,
GraphicTransformEvent, GraphicTransformEvent,
JlDrawApp, IDrawApp,
JlGraphic, JlGraphic,
KeyListener, KeyListener,
calculateMirrorPoint, calculateMirrorPoint,
@ -61,7 +61,7 @@ export class LinkDraw extends GraphicDrawAssistant<LinkTemplate, ILinkData> {
}, },
}); });
constructor(app: JlDrawApp) { constructor(app: IDrawApp) {
super(app, new LinkTemplate(), 'sym_o_horizontal_rule', '轨道Link'); super(app, new LinkTemplate(), 'sym_o_horizontal_rule', '轨道Link');
this.container.addChild(this.graphic); this.container.addChild(this.graphic);
this.graphicTemplate.curve = true; this.graphicTemplate.curve = true;
@ -268,10 +268,10 @@ function onEditPointCreate(
*/ */
export class LinkPointsEditPlugin extends GraphicInteractionPlugin<Link> { export class LinkPointsEditPlugin extends GraphicInteractionPlugin<Link> {
static Name = 'LinkPointsDrag'; static Name = 'LinkPointsDrag';
constructor(app: GraphicApp) { constructor(app: IGraphicApp) {
super(LinkPointsEditPlugin.Name, app); super(LinkPointsEditPlugin.Name, app);
} }
static init(app: GraphicApp): LinkPointsEditPlugin { static init(app: IGraphicApp): LinkPointsEditPlugin {
return new LinkPointsEditPlugin(app); return new LinkPointsEditPlugin(app);
} }
filter(...grahpics: JlGraphic[]): Link[] | undefined { filter(...grahpics: JlGraphic[]): Link[] | undefined {

View File

@ -1,8 +1,8 @@
import { import {
GraphicApp, IGraphicApp,
GraphicDrawAssistant, GraphicDrawAssistant,
GraphicInteractionPlugin, GraphicInteractionPlugin,
JlDrawApp, IDrawApp,
JlGraphic, JlGraphic,
linePoint, linePoint,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
@ -17,7 +17,7 @@ export class LogicSectionDraw extends GraphicDrawAssistant<
> { > {
points: Point[] = []; points: Point[] = [];
graphic = new Graphics(); graphic = new Graphics();
constructor(app: JlDrawApp, template: LogicSectionTemplate) { constructor(app: IDrawApp, template: LogicSectionTemplate) {
super(app, template, 'sym_o_timeline', '不展示'); super(app, template, 'sym_o_timeline', '不展示');
this.container.addChild(this.graphic); this.container.addChild(this.graphic);
LogicSectionEditPlugin.init(app); LogicSectionEditPlugin.init(app);
@ -60,10 +60,10 @@ export class LogicSectionGraphicHitArea implements IHitArea {
export class LogicSectionEditPlugin extends GraphicInteractionPlugin<LogicSection> { export class LogicSectionEditPlugin extends GraphicInteractionPlugin<LogicSection> {
static Name = 'LogicSectionInteraction'; static Name = 'LogicSectionInteraction';
constructor(app: GraphicApp) { constructor(app: IGraphicApp) {
super(LogicSectionEditPlugin.Name, app); super(LogicSectionEditPlugin.Name, app);
} }
static init(app: GraphicApp) { static init(app: IGraphicApp) {
return new LogicSectionEditPlugin(app); return new LogicSectionEditPlugin(app);
} }
filter(...grahpics: JlGraphic[]): LogicSection[] | undefined { filter(...grahpics: JlGraphic[]): LogicSection[] | undefined {

View File

@ -1,9 +1,9 @@
import { import {
GraphicDrawAssistant, GraphicDrawAssistant,
JlDrawApp, IDrawApp,
linePoint, linePoint,
GraphicInteractionPlugin, GraphicInteractionPlugin,
GraphicApp, IGraphicApp,
JlGraphic, JlGraphic,
DraggablePoint, DraggablePoint,
GraphicTransformEvent, GraphicTransformEvent,
@ -37,7 +37,7 @@ export class PathLineDraw extends GraphicDrawAssistant<
code = ''; code = '';
graphic: Graphics = new Graphics(); graphic: Graphics = new Graphics();
constructor(app: JlDrawApp, template: PathLineTemplate) { constructor(app: IDrawApp, template: PathLineTemplate) {
super(app, template, 'sym_o_horizontal_rule', '不展示'); super(app, template, 'sym_o_horizontal_rule', '不展示');
this.container.addChild(this.graphic); this.container.addChild(this.graphic);
PathLinePointsEditPlugin.init(app); PathLinePointsEditPlugin.init(app);
@ -106,10 +106,10 @@ export class PathLineGraphicHitArea implements IHitArea {
export class PathLinePointsEditPlugin extends GraphicInteractionPlugin<PathLine> { export class PathLinePointsEditPlugin extends GraphicInteractionPlugin<PathLine> {
static Name = 'LinkPointsDrag'; static Name = 'LinkPointsDrag';
constructor(app: GraphicApp) { constructor(app: IGraphicApp) {
super(PathLinePointsEditPlugin.Name, app); super(PathLinePointsEditPlugin.Name, app);
} }
static init(app: GraphicApp): PathLinePointsEditPlugin { static init(app: IGraphicApp): PathLinePointsEditPlugin {
return new PathLinePointsEditPlugin(app); return new PathLinePointsEditPlugin(app);
} }
filter(...grahpics: JlGraphic[]): PathLine[] | undefined { filter(...grahpics: JlGraphic[]): PathLine[] | undefined {

View File

@ -372,7 +372,7 @@ export class Platform extends JlGraphic {
return this.datas.code; return this.datas.code;
} }
doRepaint(): void { doRepaint(): void {
const station = this.queryStore.queryByCodeAndType<Station>( const station = this.getGraphicApp().queryStore.queryByCodeAndType<Station>(
this.states.rtuId > 9 ? '' + this.states.rtuId : '0' + this.states.rtuId, this.states.rtuId > 9 ? '' + this.states.rtuId : '0' + this.states.rtuId,
Station.Type Station.Type
); );

View File

@ -4,7 +4,7 @@ import {
AbsorbablePosition, AbsorbablePosition,
GraphicDrawAssistant, GraphicDrawAssistant,
GraphicInteractionPlugin, GraphicInteractionPlugin,
JlDrawApp, IDrawApp,
JlGraphic, JlGraphic,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
@ -19,7 +19,7 @@ export class PlatformDraw extends GraphicDrawAssistant<
IPlatformData IPlatformData
> { > {
platformGraphic: Platform; platformGraphic: Platform;
constructor(app: JlDrawApp, template: PlatformTemplate) { constructor(app: IDrawApp, template: PlatformTemplate) {
super( super(
app, app,
template, template,
@ -76,10 +76,10 @@ function buildAbsorbablePositions(platform: Platform): AbsorbablePosition[] {
export class platformInteraction extends GraphicInteractionPlugin<Platform> { export class platformInteraction extends GraphicInteractionPlugin<Platform> {
static Name = 'platform_transform'; static Name = 'platform_transform';
constructor(app: JlDrawApp) { constructor(app: IDrawApp) {
super(platformInteraction.Name, app); super(platformInteraction.Name, app);
} }
static init(app: JlDrawApp) { static init(app: IDrawApp) {
return new platformInteraction(app); return new platformInteraction(app);
} }
filter(...grahpics: JlGraphic[]): Platform[] | undefined { filter(...grahpics: JlGraphic[]): Platform[] | undefined {

View File

@ -7,11 +7,11 @@ import {
} from 'pixi.js'; } from 'pixi.js';
import { import {
DraggablePoint, DraggablePoint,
GraphicApp, IGraphicApp,
GraphicDrawAssistant, GraphicDrawAssistant,
GraphicInteractionPlugin, GraphicInteractionPlugin,
GraphicTransformEvent, GraphicTransformEvent,
JlDrawApp, IDrawApp,
JlGraphic, JlGraphic,
linePoint, linePoint,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
@ -37,7 +37,7 @@ export class PolygonDraw extends GraphicDrawAssistant<
points: Point[] = []; points: Point[] = [];
polygonGraphic: Graphics = new Graphics(); polygonGraphic: Graphics = new Graphics();
constructor(app: JlDrawApp, template: PolygonTemplate) { constructor(app: IDrawApp, template: PolygonTemplate) {
super(app, template, 'sym_o_square', '多边形Polygon'); super(app, template, 'sym_o_square', '多边形Polygon');
this.container.addChild(this.polygonGraphic); this.container.addChild(this.polygonGraphic);
PolygonPointsEditPlugin.init(app); PolygonPointsEditPlugin.init(app);
@ -151,10 +151,10 @@ function onEditPointCreate(g: ILineGraphic, dp: DraggablePoint): void {
*/ */
export class PolygonPointsEditPlugin extends GraphicInteractionPlugin<Polygon> { export class PolygonPointsEditPlugin extends GraphicInteractionPlugin<Polygon> {
static Name = 'PolygonPointsDrag'; static Name = 'PolygonPointsDrag';
constructor(app: GraphicApp) { constructor(app: IGraphicApp) {
super(PolygonPointsEditPlugin.Name, app); super(PolygonPointsEditPlugin.Name, app);
} }
static init(app: GraphicApp): PolygonPointsEditPlugin { static init(app: IGraphicApp): PolygonPointsEditPlugin {
return new PolygonPointsEditPlugin(app); return new PolygonPointsEditPlugin(app);
} }
filter(...grahpics: JlGraphic[]): Polygon[] | undefined { filter(...grahpics: JlGraphic[]): Polygon[] | undefined {

View File

@ -2,7 +2,7 @@ import { FederatedPointerEvent, Graphics, Point, IHitArea } from 'pixi.js';
import { import {
GraphicDrawAssistant, GraphicDrawAssistant,
GraphicInteractionPlugin, GraphicInteractionPlugin,
JlDrawApp, IDrawApp,
JlGraphic, JlGraphic,
pointBox, pointBox,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
@ -18,7 +18,7 @@ export class RectDraw extends GraphicDrawAssistant<RectTemplate, IRectData> {
point2: Point | null = null; point2: Point | null = null;
rectGraphic: Graphics = new Graphics(); rectGraphic: Graphics = new Graphics();
constructor(app: JlDrawApp, template: RectTemplate) { constructor(app: IDrawApp, template: RectTemplate) {
super(app, template, 'sym_o_square', '矩形Rect'); super(app, template, 'sym_o_square', '矩形Rect');
this.container.addChild(this.rectGraphic); this.container.addChild(this.rectGraphic);
rectInteraction.init(app); rectInteraction.init(app);
@ -88,10 +88,10 @@ export class RectGraphicHitArea implements IHitArea {
export class rectInteraction extends GraphicInteractionPlugin<Rect> { export class rectInteraction extends GraphicInteractionPlugin<Rect> {
static Name = 'platform_transform'; static Name = 'platform_transform';
constructor(app: JlDrawApp) { constructor(app: IDrawApp) {
super(rectInteraction.Name, app); super(rectInteraction.Name, app);
} }
static init(app: JlDrawApp) { static init(app: IDrawApp) {
return new rectInteraction(app); return new rectInteraction(app);
} }
filter(...grahpics: JlGraphic[]): Rect[] | undefined { filter(...grahpics: JlGraphic[]): Rect[] | undefined {

View File

@ -1,10 +1,10 @@
import { import {
GraphicDrawAssistant, GraphicDrawAssistant,
JlDrawApp, IDrawApp,
JlGraphic, JlGraphic,
GraphicInteractionPlugin, GraphicInteractionPlugin,
linePoint, linePoint,
GraphicApp, IGraphicApp,
AbsorbablePosition, AbsorbablePosition,
DraggablePoint, DraggablePoint,
GraphicTransformEvent, GraphicTransformEvent,
@ -40,7 +40,7 @@ export class RunLineDraw extends GraphicDrawAssistant<
points: Point[] = []; points: Point[] = [];
graphic: Graphics = new Graphics(); graphic: Graphics = new Graphics();
constructor(app: JlDrawApp, template: RunLineTemplate) { constructor(app: IDrawApp, template: RunLineTemplate) {
super(app, template, 'sym_o_horizontal_rule', '运行线RunLine'); super(app, template, 'sym_o_horizontal_rule', '运行线RunLine');
this.container.addChild(this.graphic); this.container.addChild(this.graphic);
RunLinePointsEditPlugin.init(app); RunLinePointsEditPlugin.init(app);
@ -162,10 +162,10 @@ function onEditPointCreate(
export class RunLinePointsEditPlugin extends GraphicInteractionPlugin<RunLine> { export class RunLinePointsEditPlugin extends GraphicInteractionPlugin<RunLine> {
static Name = 'LinkPointsDrag'; static Name = 'LinkPointsDrag';
constructor(app: GraphicApp) { constructor(app: IGraphicApp) {
super(RunLinePointsEditPlugin.Name, app); super(RunLinePointsEditPlugin.Name, app);
} }
static init(app: GraphicApp): RunLinePointsEditPlugin { static init(app: IGraphicApp): RunLinePointsEditPlugin {
return new RunLinePointsEditPlugin(app); return new RunLinePointsEditPlugin(app);
} }
filter(...grahpics: JlGraphic[]): RunLine[] | undefined { filter(...grahpics: JlGraphic[]): RunLine[] | undefined {

View File

@ -1,13 +1,13 @@
import { import {
ChildTransform, ChildTransform,
DraggablePoint, DraggablePoint,
GraphicApp, IGraphicApp,
GraphicDrawAssistant, GraphicDrawAssistant,
GraphicInteractionPlugin, GraphicInteractionPlugin,
GraphicRelation, GraphicRelation,
GraphicTransform, GraphicTransform,
GraphicTransformEvent, GraphicTransformEvent,
JlDrawApp, IDrawApp,
JlGraphic, JlGraphic,
VectorText, VectorText,
calculateLineMidpoint, calculateLineMidpoint,
@ -60,7 +60,7 @@ export class SectionDraw extends GraphicDrawAssistant<
points: Point[] = []; points: Point[] = [];
graphic = new Graphics(); graphic = new Graphics();
constructor(app: JlDrawApp, template: SectionTemplate) { constructor(app: IDrawApp, template: SectionTemplate) {
super(app, template, 'sym_o_timeline', '区段Section'); super(app, template, 'sym_o_timeline', '区段Section');
this.container.addChild(this.graphic); this.container.addChild(this.graphic);
@ -400,12 +400,12 @@ export class SectionPointEditPlugin extends GraphicInteractionPlugin<Section> {
static Name = 'SectionPointDrag'; static Name = 'SectionPointDrag';
drawAssistant: SectionDraw; drawAssistant: SectionDraw;
constructor(app: GraphicApp, da: SectionDraw) { constructor(app: IGraphicApp, da: SectionDraw) {
super(SectionPointEditPlugin.Name, app); super(SectionPointEditPlugin.Name, app);
this.drawAssistant = da; this.drawAssistant = da;
app.registerMenu(SectionEditMenu); app.registerMenu(SectionEditMenu);
} }
static init(app: GraphicApp, da: SectionDraw) { static init(app: IGraphicApp, da: SectionDraw) {
return new SectionPointEditPlugin(app, da); return new SectionPointEditPlugin(app, da);
} }
filter(...grahpics: JlGraphic[]): Section[] | undefined { filter(...grahpics: JlGraphic[]): Section[] | undefined {

View File

@ -4,7 +4,7 @@ import {
GraphicIdGenerator, GraphicIdGenerator,
GraphicInteractionPlugin, GraphicInteractionPlugin,
GraphicRelationParam, GraphicRelationParam,
JlDrawApp, IDrawApp,
JlGraphic, JlGraphic,
linePoint, linePoint,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
@ -25,7 +25,7 @@ export class SeparatorDraw extends GraphicDrawAssistant<
ISeparatorData ISeparatorData
> { > {
SeparatorGraph: Separator; SeparatorGraph: Separator;
constructor(app: JlDrawApp, template: SeparatorTemplate) { constructor(app: IDrawApp, template: SeparatorTemplate) {
super(app, template, 'sym_o_square', '不展示'); super(app, template, 'sym_o_square', '不展示');
this.SeparatorGraph = this.graphicTemplate.new(); this.SeparatorGraph = this.graphicTemplate.new();
this.container.addChild(this.SeparatorGraph); this.container.addChild(this.SeparatorGraph);
@ -258,10 +258,10 @@ export class SeparatorGraphicHitArea implements IHitArea {
export class SeparatorInteraction extends GraphicInteractionPlugin<Separator> { export class SeparatorInteraction extends GraphicInteractionPlugin<Separator> {
static Name = 'Separator_transform'; static Name = 'Separator_transform';
constructor(app: JlDrawApp) { constructor(app: IDrawApp) {
super(SeparatorInteraction.Name, app); super(SeparatorInteraction.Name, app);
} }
static init(app: JlDrawApp) { static init(app: IDrawApp) {
return new SeparatorInteraction(app); return new SeparatorInteraction(app);
} }
filter(...grahpics: JlGraphic[]): Separator[] | undefined { filter(...grahpics: JlGraphic[]): Separator[] | undefined {

View File

@ -5,7 +5,7 @@ import {
GraphicDrawAssistant, GraphicDrawAssistant,
GraphicInteractionPlugin, GraphicInteractionPlugin,
GraphicTransformEvent, GraphicTransformEvent,
JlDrawApp, IDrawApp,
JlGraphic, JlGraphic,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
@ -21,7 +21,7 @@ export class SignalDraw extends GraphicDrawAssistant<
> { > {
_signal: Signal | null = null; _signal: Signal | null = null;
constructor(app: JlDrawApp, template: SignalTemplate) { constructor(app: IDrawApp, template: SignalTemplate) {
super( super(
app, app,
template, template,
@ -129,10 +129,10 @@ function buildCodeAbsorbablePositions(signal: Signal): AbsorbablePosition[] {
export class signalInteraction extends GraphicInteractionPlugin<Signal> { export class signalInteraction extends GraphicInteractionPlugin<Signal> {
static Name = 'signal_transform'; static Name = 'signal_transform';
constructor(app: JlDrawApp) { constructor(app: IDrawApp) {
super(signalInteraction.Name, app); super(signalInteraction.Name, app);
} }
static init(app: JlDrawApp) { static init(app: IDrawApp) {
return new signalInteraction(app); return new signalInteraction(app);
} }
filter(...grahpics: JlGraphic[]): Signal[] | undefined { filter(...grahpics: JlGraphic[]): Signal[] | undefined {

View File

@ -4,7 +4,7 @@ import {
AbsorbablePosition, AbsorbablePosition,
GraphicDrawAssistant, GraphicDrawAssistant,
GraphicInteractionPlugin, GraphicInteractionPlugin,
JlDrawApp, IDrawApp,
JlGraphic, JlGraphic,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
@ -19,7 +19,7 @@ export class StationDraw extends GraphicDrawAssistant<
IStationData IStationData
> { > {
codeGraph: Station; codeGraph: Station;
constructor(app: JlDrawApp, template: StationTemplate) { constructor(app: IDrawApp, template: StationTemplate) {
super( super(
app, app,
template, template,
@ -72,10 +72,10 @@ function buildAbsorbablePositions(station: Station): AbsorbablePosition[] {
export class stationInteraction extends GraphicInteractionPlugin<Station> { export class stationInteraction extends GraphicInteractionPlugin<Station> {
static Name = 'station_transform'; static Name = 'station_transform';
constructor(app: JlDrawApp) { constructor(app: IDrawApp) {
super(stationInteraction.Name, app); super(stationInteraction.Name, app);
} }
static init(app: JlDrawApp) { static init(app: IDrawApp) {
return new stationInteraction(app); return new stationInteraction(app);
} }
filter(...grahpics: JlGraphic[]): Station[] | undefined { filter(...grahpics: JlGraphic[]): Station[] | undefined {

View File

@ -4,7 +4,7 @@ import {
AbsorbablePosition, AbsorbablePosition,
GraphicDrawAssistant, GraphicDrawAssistant,
GraphicInteractionPlugin, GraphicInteractionPlugin,
JlDrawApp, IDrawApp,
JlGraphic, JlGraphic,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
@ -24,7 +24,7 @@ export class StationLineDraw extends GraphicDrawAssistant<
IStationLineData IStationLineData
> { > {
codeGraph: StationLine; codeGraph: StationLine;
constructor(app: JlDrawApp, template: StationLineTemplate) { constructor(app: IDrawApp, template: StationLineTemplate) {
super( super(
app, app,
template, template,
@ -86,10 +86,10 @@ function buildAbsorbablePositions(Station: StationLine): AbsorbablePosition[] {
export class stationLineInteraction extends GraphicInteractionPlugin<StationLine> { export class stationLineInteraction extends GraphicInteractionPlugin<StationLine> {
static Name = 'stationLine_transform'; static Name = 'stationLine_transform';
static stationLine: StationLine; static stationLine: StationLine;
constructor(app: JlDrawApp) { constructor(app: IDrawApp) {
super(stationLineInteraction.Name, app); super(stationLineInteraction.Name, app);
} }
static init(app: JlDrawApp) { static init(app: IDrawApp) {
return new stationLineInteraction(app); return new stationLineInteraction(app);
} }
filter(...grahpics: JlGraphic[]): StationLine[] | undefined { filter(...grahpics: JlGraphic[]): StationLine[] | undefined {

View File

@ -2,7 +2,7 @@ import { Point, FederatedPointerEvent } from 'pixi.js';
import { import {
GraphicDrawAssistant, GraphicDrawAssistant,
GraphicInteractionPlugin, GraphicInteractionPlugin,
JlDrawApp, IDrawApp,
JlGraphic, JlGraphic,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
@ -15,7 +15,7 @@ export interface ITrainDrawOptions {
export class TrainDraw extends GraphicDrawAssistant<TrainTemplate, ITrainData> { export class TrainDraw extends GraphicDrawAssistant<TrainTemplate, ITrainData> {
_Train: Train | null = null; _Train: Train | null = null;
constructor(app: JlDrawApp, template: TrainTemplate) { constructor(app: IDrawApp, template: TrainTemplate) {
super(app, template, 'directions_bus_filled', '不展示'); super(app, template, 'directions_bus_filled', '不展示');
trainInteraction.init(app); trainInteraction.init(app);
} }
@ -48,10 +48,10 @@ export class TrainDraw extends GraphicDrawAssistant<TrainTemplate, ITrainData> {
export class trainInteraction extends GraphicInteractionPlugin<Train> { export class trainInteraction extends GraphicInteractionPlugin<Train> {
static Name = 'train_transform'; static Name = 'train_transform';
constructor(app: JlDrawApp) { constructor(app: IDrawApp) {
super(trainInteraction.Name, app); super(trainInteraction.Name, app);
} }
static init(app: JlDrawApp) { static init(app: IDrawApp) {
return new trainInteraction(app); return new trainInteraction(app);
} }
filter(...grahpics: JlGraphic[]): Train[] | undefined { filter(...grahpics: JlGraphic[]): Train[] | undefined {

View File

@ -2,7 +2,7 @@ import { FederatedMouseEvent, Point } from 'pixi.js';
import { import {
GraphicDrawAssistant, GraphicDrawAssistant,
GraphicInteractionPlugin, GraphicInteractionPlugin,
JlDrawApp, IDrawApp,
JlGraphic, JlGraphic,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
import { ITrainLineData, TrainLine, ItrainLineTemplate } from './TrainLine'; import { ITrainLineData, TrainLine, ItrainLineTemplate } from './TrainLine';
@ -13,7 +13,7 @@ export class TrainLineDraw extends GraphicDrawAssistant<
> { > {
train: TrainLine | null = null; train: TrainLine | null = null;
constructor(app: JlDrawApp, template: ItrainLineTemplate) { constructor(app: IDrawApp, template: ItrainLineTemplate) {
super(app, template, 'directions_bus_filled', '列车线网'); super(app, template, 'directions_bus_filled', '列车线网');
ItrainLineInteraction.init(app); ItrainLineInteraction.init(app);
} }
@ -51,10 +51,10 @@ export class TrainLineDraw extends GraphicDrawAssistant<
export class ItrainLineInteraction extends GraphicInteractionPlugin<TrainLine> { export class ItrainLineInteraction extends GraphicInteractionPlugin<TrainLine> {
static Name = 'trainLine_transform'; static Name = 'trainLine_transform';
constructor(app: JlDrawApp) { constructor(app: IDrawApp) {
super(ItrainLineInteraction.Name, app); super(ItrainLineInteraction.Name, app);
} }
static init(app: JlDrawApp) { static init(app: IDrawApp) {
return new ItrainLineInteraction(app); return new ItrainLineInteraction(app);
} }
filter(...grahpics: JlGraphic[]): TrainLine[] | undefined { filter(...grahpics: JlGraphic[]): TrainLine[] | undefined {

View File

@ -5,7 +5,7 @@ import {
GraphicDrawAssistant, GraphicDrawAssistant,
GraphicIdGenerator, GraphicIdGenerator,
GraphicInteractionPlugin, GraphicInteractionPlugin,
JlDrawApp, IDrawApp,
JlGraphic, JlGraphic,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
@ -69,7 +69,7 @@ export class TrainWindowDraw extends GraphicDrawAssistant<
ITrainWindowData ITrainWindowData
> { > {
trainWindowGraph: TrainWindow; trainWindowGraph: TrainWindow;
constructor(app: JlDrawApp, template: TrainWindowTemplate) { constructor(app: IDrawApp, template: TrainWindowTemplate) {
super(app, template, 'sym_o_square', '不展示'); super(app, template, 'sym_o_square', '不展示');
this.trainWindowGraph = this.graphicTemplate.new(); this.trainWindowGraph = this.graphicTemplate.new();
this.container.addChild(this.trainWindowGraph); this.container.addChild(this.trainWindowGraph);
@ -243,10 +243,10 @@ function buildAbsorbablePositions(
export class TrainWindowInteraction extends GraphicInteractionPlugin<TrainWindow> { export class TrainWindowInteraction extends GraphicInteractionPlugin<TrainWindow> {
static Name = 'TrainWindow_transform'; static Name = 'TrainWindow_transform';
constructor(app: JlDrawApp) { constructor(app: IDrawApp) {
super(TrainWindowInteraction.Name, app); super(TrainWindowInteraction.Name, app);
} }
static init(app: JlDrawApp) { static init(app: IDrawApp) {
return new TrainWindowInteraction(app); return new TrainWindowInteraction(app);
} }
filter(...grahpics: JlGraphic[]): TrainWindow[] | undefined { filter(...grahpics: JlGraphic[]): TrainWindow[] | undefined {

View File

@ -1,12 +1,12 @@
import { import {
AbsorbablePosition, AbsorbablePosition,
DraggablePoint, DraggablePoint,
GraphicApp, IGraphicApp,
GraphicDrawAssistant, GraphicDrawAssistant,
GraphicInteractionPlugin, GraphicInteractionPlugin,
GraphicRelation, GraphicRelation,
GraphicTransformEvent, GraphicTransformEvent,
JlDrawApp, IDrawApp,
JlGraphic, JlGraphic,
VectorText, VectorText,
linePoint, linePoint,
@ -44,7 +44,7 @@ export class TurnoutDraw extends GraphicDrawAssistant<
ITurnoutData ITurnoutData
> { > {
turnout: Turnout; turnout: Turnout;
constructor(app: JlDrawApp, template: TurnoutTemplate) { constructor(app: IDrawApp, template: TurnoutTemplate) {
super(app, template, 'sym_o_ramp_left', '道岔Turnout'); super(app, template, 'sym_o_ramp_left', '道岔Turnout');
this.turnout = this.graphicTemplate.new(); this.turnout = this.graphicTemplate.new();
@ -205,11 +205,11 @@ const turnoutSectionEditMenu: ContextMenu = ContextMenu.init({
export class TurnoutPointsInteractionPlugin extends GraphicInteractionPlugin<Turnout> { export class TurnoutPointsInteractionPlugin extends GraphicInteractionPlugin<Turnout> {
static Name = 'TurnoutPointsDrag'; static Name = 'TurnoutPointsDrag';
static init(app: JlDrawApp) { static init(app: IDrawApp) {
return new TurnoutPointsInteractionPlugin(app); return new TurnoutPointsInteractionPlugin(app);
} }
constructor(app: GraphicApp) { constructor(app: IGraphicApp) {
super(TurnoutPointsInteractionPlugin.Name, app); super(TurnoutPointsInteractionPlugin.Name, app);
app.registerMenu(turnoutSectionEditMenu); app.registerMenu(turnoutSectionEditMenu);
} }