车站和站台引入状态数据
This commit is contained in:
parent
3d78dec574
commit
4af86c2886
@ -30,11 +30,11 @@ import { Rect, RectTemplate } from 'src/graphics/rect/Rect';
|
|||||||
import { RectDraw } from 'src/graphics/rect/RectDrawAssistant';
|
import { RectDraw } from 'src/graphics/rect/RectDrawAssistant';
|
||||||
import { RectData } from './graphics/RectInteraction';
|
import { RectData } from './graphics/RectInteraction';
|
||||||
import { Platform, PlatformTemplate } from 'src/graphics/platform/Platform';
|
import { Platform, PlatformTemplate } from 'src/graphics/platform/Platform';
|
||||||
import { PlatformData } from './graphics/PlatformInteraction';
|
import { PlatformData, PlatformState } from './graphics/PlatformInteraction';
|
||||||
import { PlatformDraw } from 'src/graphics/platform/PlatformDrawAssistant';
|
import { PlatformDraw } from 'src/graphics/platform/PlatformDrawAssistant';
|
||||||
import { Station, StationTemplate } from 'src/graphics/station/Station';
|
import { Station, StationTemplate } from 'src/graphics/station/Station';
|
||||||
import { StationDraw } from 'src/graphics/station/StationDrawAssistant';
|
import { StationDraw } from 'src/graphics/station/StationDrawAssistant';
|
||||||
import { StationData } from './graphics/StationInteraction';
|
import { StationData, StationState } from './graphics/StationInteraction';
|
||||||
import {
|
import {
|
||||||
StationLine,
|
StationLine,
|
||||||
StationLineTemplate,
|
StationLineTemplate,
|
||||||
@ -155,8 +155,14 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp {
|
|||||||
)[] = [];
|
)[] = [];
|
||||||
if (draftType === 'Line') {
|
if (draftType === 'Line') {
|
||||||
drawAssistants = [
|
drawAssistants = [
|
||||||
new PlatformDraw(app, new PlatformTemplate(new PlatformData())),
|
new PlatformDraw(
|
||||||
new StationDraw(app, new StationTemplate(new StationData())),
|
app,
|
||||||
|
new PlatformTemplate(new PlatformData(), new PlatformState())
|
||||||
|
),
|
||||||
|
new StationDraw(
|
||||||
|
app,
|
||||||
|
new StationTemplate(new StationData(), new StationState())
|
||||||
|
),
|
||||||
new SignalDraw(
|
new SignalDraw(
|
||||||
app,
|
app,
|
||||||
new SignalTemplate(new SignalData(), new SignalState())
|
new SignalTemplate(new SignalData(), new SignalState())
|
||||||
|
@ -268,6 +268,9 @@ export class Platform extends JlGraphic {
|
|||||||
get datas(): IPlatformData {
|
get datas(): IPlatformData {
|
||||||
return this.getDatas<IPlatformData>();
|
return this.getDatas<IPlatformData>();
|
||||||
}
|
}
|
||||||
|
get states(): IPlatformState {
|
||||||
|
return this.getStates<IPlatformState>();
|
||||||
|
}
|
||||||
doRepaint(): void {
|
doRepaint(): void {
|
||||||
this.doorGraphic.clear();
|
this.doorGraphic.clear();
|
||||||
if (this.datas.hasdoor) {
|
if (this.datas.hasdoor) {
|
||||||
@ -310,14 +313,18 @@ export class Platform extends JlGraphic {
|
|||||||
export class PlatformTemplate extends JlGraphicTemplate<Platform> {
|
export class PlatformTemplate extends JlGraphicTemplate<Platform> {
|
||||||
hasdoor: boolean;
|
hasdoor: boolean;
|
||||||
direction: string;
|
direction: string;
|
||||||
constructor(dataTemplate: IPlatformData) {
|
constructor(dataTemplate: IPlatformData, stateTemplate: IPlatformState) {
|
||||||
super(Platform.Type, {
|
super(Platform.Type, {
|
||||||
dataTemplate,
|
dataTemplate,
|
||||||
|
stateTemplate,
|
||||||
});
|
});
|
||||||
this.hasdoor = true;
|
this.hasdoor = true;
|
||||||
this.direction = 'up';
|
this.direction = 'up';
|
||||||
}
|
}
|
||||||
new(): Platform {
|
new(): Platform {
|
||||||
return new Platform();
|
const platform = new Platform();
|
||||||
|
platform.loadData(this.datas);
|
||||||
|
platform.loadState(this.states);
|
||||||
|
return platform;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,6 +179,9 @@ export class Station extends JlGraphic {
|
|||||||
get datas(): IStationData {
|
get datas(): IStationData {
|
||||||
return this.getDatas<IStationData>();
|
return this.getDatas<IStationData>();
|
||||||
}
|
}
|
||||||
|
get states(): IStationState {
|
||||||
|
return this.getStates<IStationState>();
|
||||||
|
}
|
||||||
doRepaint(): void {
|
doRepaint(): void {
|
||||||
const codeGraph = this.codeGraph;
|
const codeGraph = this.codeGraph;
|
||||||
const kilometerGraph = this.kilometerGraph;
|
const kilometerGraph = this.kilometerGraph;
|
||||||
@ -209,13 +212,17 @@ export class Station extends JlGraphic {
|
|||||||
|
|
||||||
export class StationTemplate extends JlGraphicTemplate<Station> {
|
export class StationTemplate extends JlGraphicTemplate<Station> {
|
||||||
hasControl: boolean;
|
hasControl: boolean;
|
||||||
constructor(dataTemplate: IStationData) {
|
constructor(dataTemplate: IStationData, stateTemplate: IStationState) {
|
||||||
super(Station.Type, {
|
super(Station.Type, {
|
||||||
dataTemplate,
|
dataTemplate,
|
||||||
|
stateTemplate,
|
||||||
});
|
});
|
||||||
this.hasControl = true;
|
this.hasControl = true;
|
||||||
}
|
}
|
||||||
new(): Station {
|
new(): Station {
|
||||||
return new Station();
|
const station = new Station();
|
||||||
|
station.loadData(this.datas);
|
||||||
|
station.loadState(this.states);
|
||||||
|
return station;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user