测试
This commit is contained in:
parent
ed9be45c6a
commit
849c7ffb62
@ -1,11 +1,11 @@
|
|||||||
import { FederatedPointerEvent, Point } from 'pixi.js';
|
import { FederatedPointerEvent, Point } from 'pixi.js';
|
||||||
import { GraphicDrawAssistant, IDrawApp } from 'jl-graphic';
|
import { GraphicDrawAssistant, GraphicState, IDrawApp } from 'jl-graphic';
|
||||||
import { JlPlatform } from './JlPlatform';
|
import { JlPlatform } from './JlPlatform';
|
||||||
import { PlatformTemplate } from './PlatformTemplate';
|
import { PlatformTemplate } from './PlatformTemplate';
|
||||||
import { IPlatformData } from './PlatformConfig';
|
import { IPlatformData } from './PlatformConfig';
|
||||||
export declare class PlatformDraw extends GraphicDrawAssistant<PlatformTemplate, IPlatformData> {
|
export declare class PlatformDraw<S extends GraphicState> extends GraphicDrawAssistant<PlatformTemplate<S>, IPlatformData> {
|
||||||
platformGraphic: JlPlatform;
|
platformGraphic: JlPlatform;
|
||||||
constructor(app: IDrawApp, template: PlatformTemplate, icon: string);
|
constructor(app: IDrawApp, template: PlatformTemplate<S>, icon: string);
|
||||||
bind(): void;
|
bind(): void;
|
||||||
onLeftDown(e: FederatedPointerEvent): void;
|
onLeftDown(e: FederatedPointerEvent): void;
|
||||||
redraw(p: Point): void;
|
redraw(p: Point): void;
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
import { JlGraphicTemplate } from 'jl-graphic';
|
import { GraphicState, JlGraphicTemplate } from 'jl-graphic';
|
||||||
import { JlPlatform } from './JlPlatform';
|
import { JlPlatform } from './JlPlatform';
|
||||||
import { IPlatformData } from './PlatformConfig';
|
import { IPlatformData } from './PlatformConfig';
|
||||||
import { ITHPlatformState } from '../THPlatform';
|
|
||||||
import { IGPPlatformState } from '../GPPlatform';
|
|
||||||
import { StyleType } from 'common/common';
|
import { StyleType } from 'common/common';
|
||||||
export declare class PlatformTemplate extends JlGraphicTemplate<JlPlatform> {
|
export declare class PlatformTemplate<S extends GraphicState> extends JlGraphicTemplate<JlPlatform> {
|
||||||
hasdoor?: boolean;
|
hasdoor?: boolean;
|
||||||
direction?: string;
|
direction?: string;
|
||||||
styleType: StyleType;
|
styleType: StyleType;
|
||||||
constructor(dataTemplate: IPlatformData, stateTemplate: ITHPlatformState | IGPPlatformState, styleType: StyleType);
|
constructor(dataTemplate: IPlatformData, stateTemplate: S, styleType: StyleType);
|
||||||
new(): JlPlatform;
|
new(): JlPlatform;
|
||||||
}
|
}
|
||||||
|
@ -19,18 +19,18 @@ class PlatformTemplate extends JlGraphicTemplate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
new() {
|
new() {
|
||||||
|
let platform;
|
||||||
switch (this.styleType) {
|
switch (this.styleType) {
|
||||||
case StyleType.GP:
|
case StyleType.GP:
|
||||||
const GP = new GPPlatform();
|
platform = new GPPlatform();
|
||||||
GP.loadData(this.datas);
|
break;
|
||||||
GP.loadState(this.states);
|
|
||||||
return GP;
|
|
||||||
default:
|
default:
|
||||||
const TH = new THPlatform();
|
platform = new THPlatform();
|
||||||
TH.loadData(this.datas);
|
break;
|
||||||
TH.loadState(this.states);
|
|
||||||
return TH;
|
|
||||||
}
|
}
|
||||||
|
platform.loadData(this.datas);
|
||||||
|
platform.loadState(this.states);
|
||||||
|
return platform;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { FederatedPointerEvent, Point } from 'pixi.js';
|
import { FederatedPointerEvent, Point } from 'pixi.js';
|
||||||
import { GraphicDrawAssistant, GraphicInteractionPlugin, IDrawApp, JlGraphic } from 'jl-graphic';
|
import { GraphicDrawAssistant, GraphicInteractionPlugin, GraphicState, IDrawApp, JlGraphic } from 'jl-graphic';
|
||||||
import { JlStation } from './JlStation';
|
import { JlStation } from './JlStation';
|
||||||
import { IStationData } from './StationConfig';
|
import { IStationData } from './StationConfig';
|
||||||
import { StationTemplate } from './StationTemplate';
|
import { StationTemplate } from './StationTemplate';
|
||||||
export declare class StationDraw extends GraphicDrawAssistant<StationTemplate, IStationData> {
|
export declare class StationDraw<S extends GraphicState> extends GraphicDrawAssistant<StationTemplate<S>, IStationData> {
|
||||||
codeGraph: JlStation;
|
codeGraph: JlStation;
|
||||||
constructor(app: IDrawApp, template: StationTemplate, icon: string);
|
constructor(app: IDrawApp, template: StationTemplate<S>, icon: string);
|
||||||
bind(): void;
|
bind(): void;
|
||||||
onLeftDown(e: FederatedPointerEvent): void;
|
onLeftDown(e: FederatedPointerEvent): void;
|
||||||
redraw(p: Point): void;
|
redraw(p: Point): void;
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
import { JlGraphicTemplate } from 'jl-graphic';
|
import { GraphicState, JlGraphicTemplate } from 'jl-graphic';
|
||||||
import { JlStation } from './JlStation';
|
import { JlStation } from './JlStation';
|
||||||
import { IStationData } from './StationConfig';
|
import { IStationData } from './StationConfig';
|
||||||
import { ITHStationState } from '../THStation';
|
|
||||||
import { IGPStationState } from '../GPStation';
|
|
||||||
import { StyleType } from 'common/common';
|
import { StyleType } from 'common/common';
|
||||||
export declare class StationTemplate extends JlGraphicTemplate<JlStation> {
|
export declare class StationTemplate<S extends GraphicState> extends JlGraphicTemplate<JlStation> {
|
||||||
hasControl?: boolean;
|
hasControl?: boolean;
|
||||||
styleType: StyleType;
|
styleType: StyleType;
|
||||||
constructor(dataTemplate: IStationData, stateTemplate: ITHStationState | IGPStationState, styleType: StyleType);
|
constructor(dataTemplate: IStationData, stateTemplate: S, styleType: StyleType);
|
||||||
new(): JlStation;
|
new(): JlStation;
|
||||||
}
|
}
|
||||||
|
@ -20,18 +20,18 @@ class StationTemplate extends JlGraphicTemplate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
new() {
|
new() {
|
||||||
|
let station;
|
||||||
switch (this.styleType) {
|
switch (this.styleType) {
|
||||||
case StyleType.GP:
|
case StyleType.GP:
|
||||||
const GP = new GPStation();
|
station = new GPStation();
|
||||||
GP.loadData(this.datas);
|
break;
|
||||||
GP.loadState(this.states);
|
|
||||||
return GP;
|
|
||||||
default:
|
default:
|
||||||
const TH = new THStation();
|
station = new THStation();
|
||||||
TH.loadData(this.datas);
|
break;
|
||||||
TH.loadState(this.states);
|
|
||||||
return TH;
|
|
||||||
}
|
}
|
||||||
|
station.loadData(this.datas);
|
||||||
|
station.loadState(this.states);
|
||||||
|
return station;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ import {
|
|||||||
Rectangle,
|
Rectangle,
|
||||||
Color,
|
Color,
|
||||||
Point,
|
Point,
|
||||||
IPointData,
|
|
||||||
} from 'pixi.js';
|
} from 'pixi.js';
|
||||||
import {
|
import {
|
||||||
CodeConstsConfig,
|
CodeConstsConfig,
|
||||||
|
@ -4,6 +4,7 @@ import {
|
|||||||
AbsorbablePosition,
|
AbsorbablePosition,
|
||||||
GraphicDrawAssistant,
|
GraphicDrawAssistant,
|
||||||
GraphicInteractionPlugin,
|
GraphicInteractionPlugin,
|
||||||
|
GraphicState,
|
||||||
IDrawApp,
|
IDrawApp,
|
||||||
JlGraphic,
|
JlGraphic,
|
||||||
} from 'jl-graphic';
|
} from 'jl-graphic';
|
||||||
@ -13,33 +14,29 @@ import { PlatformTemplate } from './PlatformTemplate';
|
|||||||
import { StyleType } from 'common/common';
|
import { StyleType } from 'common/common';
|
||||||
import { IPlatformData } from './PlatformConfig';
|
import { IPlatformData } from './PlatformConfig';
|
||||||
|
|
||||||
export class PlatformDraw extends GraphicDrawAssistant<
|
export class PlatformDraw<S extends GraphicState> extends GraphicDrawAssistant<
|
||||||
PlatformTemplate,
|
PlatformTemplate<S>,
|
||||||
IPlatformData
|
IPlatformData
|
||||||
> {
|
> {
|
||||||
platformGraphic: JlPlatform;
|
platformGraphic: JlPlatform;
|
||||||
constructor(app: IDrawApp, template: PlatformTemplate, icon: string) {
|
constructor(app: IDrawApp, template: PlatformTemplate<S>, icon: string) {
|
||||||
super(app, template, icon, '站台Platform');
|
super(app, template, icon, '站台Platform');
|
||||||
this.platformGraphic = this.graphicTemplate.new();
|
this.platformGraphic = this.graphicTemplate.new();
|
||||||
this.container.addChild(this.platformGraphic);
|
this.container.addChild(this.platformGraphic);
|
||||||
PlatformInteraction.init(app);
|
PlatformInteraction.init(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
bind(): void {
|
bind(): void {
|
||||||
super.bind();
|
super.bind();
|
||||||
this.platformGraphic.loadData(this.graphicTemplate.datas);
|
this.platformGraphic.loadData(this.graphicTemplate.datas);
|
||||||
this.platformGraphic.doRepaint();
|
this.platformGraphic.doRepaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
onLeftDown(e: FederatedPointerEvent): void {
|
onLeftDown(e: FederatedPointerEvent): void {
|
||||||
this.container.position.copyFrom(this.toCanvasCoordinates(e.global));
|
this.container.position.copyFrom(this.toCanvasCoordinates(e.global));
|
||||||
this.createAndStore(true);
|
this.createAndStore(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
redraw(p: Point): void {
|
redraw(p: Point): void {
|
||||||
this.container.position.copyFrom(p);
|
this.container.position.copyFrom(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
prepareData(data: IPlatformData): boolean {
|
prepareData(data: IPlatformData): boolean {
|
||||||
const template = this.graphicTemplate;
|
const template = this.graphicTemplate;
|
||||||
switch (template.styleType) {
|
switch (template.styleType) {
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
import { JlGraphicTemplate } from 'jl-graphic';
|
import { GraphicState, JlGraphicTemplate } from 'jl-graphic';
|
||||||
import { JlPlatform } from './JlPlatform';
|
import { JlPlatform } from './JlPlatform';
|
||||||
import { IPlatformData } from './PlatformConfig';
|
import { IPlatformData } from './PlatformConfig';
|
||||||
import { ITHPlatformState, THPlatform } from '../THPlatform';
|
import { THPlatform } from '../THPlatform';
|
||||||
import { GPPlatform, IGPPlatformState } from '../GPPlatform';
|
import { GPPlatform } from '../GPPlatform';
|
||||||
import { StyleType } from 'common/common';
|
import { StyleType } from 'common/common';
|
||||||
|
|
||||||
export class PlatformTemplate extends JlGraphicTemplate<JlPlatform> {
|
export class PlatformTemplate<
|
||||||
|
S extends GraphicState,
|
||||||
|
> extends JlGraphicTemplate<JlPlatform> {
|
||||||
hasdoor?: boolean;
|
hasdoor?: boolean;
|
||||||
direction?: string;
|
direction?: string;
|
||||||
styleType: StyleType;
|
styleType: StyleType;
|
||||||
constructor(
|
constructor(
|
||||||
dataTemplate: IPlatformData,
|
dataTemplate: IPlatformData,
|
||||||
stateTemplate: ITHPlatformState | IGPPlatformState,
|
stateTemplate: S,
|
||||||
styleType: StyleType,
|
styleType: StyleType,
|
||||||
) {
|
) {
|
||||||
super(JlPlatform.Type, { dataTemplate, stateTemplate });
|
super(JlPlatform.Type, { dataTemplate, stateTemplate });
|
||||||
@ -24,17 +26,17 @@ export class PlatformTemplate extends JlGraphicTemplate<JlPlatform> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
new(): JlPlatform {
|
new(): JlPlatform {
|
||||||
|
let platform: JlPlatform;
|
||||||
switch (this.styleType) {
|
switch (this.styleType) {
|
||||||
case StyleType.GP:
|
case StyleType.GP:
|
||||||
const GP = new GPPlatform();
|
platform = new GPPlatform();
|
||||||
GP.loadData(this.datas);
|
break;
|
||||||
GP.loadState(this.states);
|
|
||||||
return GP;
|
|
||||||
default:
|
default:
|
||||||
const TH = new THPlatform();
|
platform = new THPlatform();
|
||||||
TH.loadData(this.datas);
|
break;
|
||||||
TH.loadState(this.states);
|
|
||||||
return TH;
|
|
||||||
}
|
}
|
||||||
|
platform.loadData(this.datas);
|
||||||
|
platform.loadState(this.states);
|
||||||
|
return platform;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import {
|
|||||||
AbsorbablePosition,
|
AbsorbablePosition,
|
||||||
GraphicDrawAssistant,
|
GraphicDrawAssistant,
|
||||||
GraphicInteractionPlugin,
|
GraphicInteractionPlugin,
|
||||||
|
GraphicState,
|
||||||
IDrawApp,
|
IDrawApp,
|
||||||
JlGraphic,
|
JlGraphic,
|
||||||
} from 'jl-graphic';
|
} from 'jl-graphic';
|
||||||
@ -12,33 +13,29 @@ import { IStationData } from './StationConfig';
|
|||||||
import { StationTemplate } from './StationTemplate';
|
import { StationTemplate } from './StationTemplate';
|
||||||
import { StyleType } from 'common/common';
|
import { StyleType } from 'common/common';
|
||||||
|
|
||||||
export class StationDraw extends GraphicDrawAssistant<
|
export class StationDraw<S extends GraphicState> extends GraphicDrawAssistant<
|
||||||
StationTemplate,
|
StationTemplate<S>,
|
||||||
IStationData
|
IStationData
|
||||||
> {
|
> {
|
||||||
codeGraph: JlStation;
|
codeGraph: JlStation;
|
||||||
constructor(app: IDrawApp, template: StationTemplate, icon: string) {
|
constructor(app: IDrawApp, template: StationTemplate<S>, icon: string) {
|
||||||
super(app, template, icon, '车站Station');
|
super(app, template, icon, '车站Station');
|
||||||
this.codeGraph = this.graphicTemplate.new();
|
this.codeGraph = this.graphicTemplate.new();
|
||||||
this.container.addChild(this.codeGraph);
|
this.container.addChild(this.codeGraph);
|
||||||
StationInteraction.init(app);
|
StationInteraction.init(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
bind(): void {
|
bind(): void {
|
||||||
super.bind();
|
super.bind();
|
||||||
this.codeGraph.loadData(this.graphicTemplate.datas);
|
this.codeGraph.loadData(this.graphicTemplate.datas);
|
||||||
this.codeGraph.doRepaint();
|
this.codeGraph.doRepaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
onLeftDown(e: FederatedPointerEvent): void {
|
onLeftDown(e: FederatedPointerEvent): void {
|
||||||
this.container.position.copyFrom(this.toCanvasCoordinates(e.global));
|
this.container.position.copyFrom(this.toCanvasCoordinates(e.global));
|
||||||
this.createAndStore(true);
|
this.createAndStore(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
redraw(p: Point): void {
|
redraw(p: Point): void {
|
||||||
this.container.position.copyFrom(p);
|
this.container.position.copyFrom(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
prepareData(data: IStationData): boolean {
|
prepareData(data: IStationData): boolean {
|
||||||
const template = this.graphicTemplate;
|
const template = this.graphicTemplate;
|
||||||
switch (template.styleType) {
|
switch (template.styleType) {
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
import { JlGraphicTemplate } from 'jl-graphic';
|
import { GraphicState, JlGraphicTemplate } from 'jl-graphic';
|
||||||
import { JlStation } from './JlStation';
|
import { JlStation } from './JlStation';
|
||||||
import { IStationData } from './StationConfig';
|
import { IStationData } from './StationConfig';
|
||||||
import { THStation, ITHStationState } from '../THStation';
|
import { THStation } from '../THStation';
|
||||||
import { GPStation, IGPStationState } from '../GPStation';
|
import { GPStation } from '../GPStation';
|
||||||
import { StyleType } from 'common/common';
|
import { StyleType } from 'common/common';
|
||||||
|
|
||||||
export class StationTemplate extends JlGraphicTemplate<JlStation> {
|
export class StationTemplate<
|
||||||
|
S extends GraphicState,
|
||||||
|
> extends JlGraphicTemplate<JlStation> {
|
||||||
hasControl?: boolean;
|
hasControl?: boolean;
|
||||||
styleType: StyleType;
|
styleType: StyleType;
|
||||||
constructor(
|
constructor(
|
||||||
dataTemplate: IStationData,
|
dataTemplate: IStationData,
|
||||||
stateTemplate: ITHStationState | IGPStationState,
|
stateTemplate: S,
|
||||||
styleType: StyleType,
|
styleType: StyleType,
|
||||||
) {
|
) {
|
||||||
super(JlStation.Type, {
|
super(JlStation.Type, {
|
||||||
@ -25,17 +27,17 @@ export class StationTemplate extends JlGraphicTemplate<JlStation> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
new(): JlStation {
|
new(): JlStation {
|
||||||
|
let station: JlStation;
|
||||||
switch (this.styleType) {
|
switch (this.styleType) {
|
||||||
case StyleType.GP:
|
case StyleType.GP:
|
||||||
const GP = new GPStation();
|
station = new GPStation();
|
||||||
GP.loadData(this.datas);
|
break;
|
||||||
GP.loadState(this.states);
|
|
||||||
return GP;
|
|
||||||
default:
|
default:
|
||||||
const TH = new THStation();
|
station = new THStation();
|
||||||
TH.loadData(this.datas);
|
break;
|
||||||
TH.loadState(this.states);
|
|
||||||
return TH;
|
|
||||||
}
|
}
|
||||||
|
station.loadData(this.datas);
|
||||||
|
station.loadState(this.states);
|
||||||
|
return station;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user