This commit is contained in:
fan 2023-07-19 09:20:15 +08:00
commit 5cf84d4472
5 changed files with 0 additions and 284 deletions

View File

@ -35,13 +35,6 @@
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
@blur="onUpdate"
v-model="hasControl"
:options="optionsControl"
label="是否有控制"
/>
<q-select
outlined
@blur="onUpdate"
@ -60,7 +53,6 @@ import { onMounted, reactive, ref, watch } from 'vue';
const drawStore = useDrawStore();
const stationModel = reactive(new StationData());
const hasControl = ref('是');
const concentrationStations = ref('否');
const optionsControl = ['是', '否'];
enum showSelect {
@ -86,9 +78,6 @@ watch(
(val) => {
if (val && val.type == Station.Type) {
stationModel.copyFrom(val.saveData() as StationData);
hasControl.value = (showSelectData as never)[
stationModel.hasControl + ''
];
concentrationStations.value = (showSelectData as never)[
stationModel.concentrationStations + ''
];
@ -105,7 +94,6 @@ onMounted(() => {
const station = drawStore.selectedGraphic as Station;
if (station) {
stationModel.copyFrom(station.saveData());
hasControl.value = (showSelectData as never)[stationModel.hasControl + ''];
concentrationStations.value = (showSelectData as never)[
stationModel.concentrationStations + ''
];
@ -118,7 +106,6 @@ onMounted(() => {
});
function onUpdate() {
stationModel.hasControl = JSON.parse((showSelect as never)[hasControl.value]);
stationModel.concentrationStations = JSON.parse(
(showSelect as never)[concentrationStations.value]
);

View File

@ -45,12 +45,6 @@ export class StationData extends GraphicDataBase implements IStationData {
set kilometerSystem(v: KilometerSystem) {
this.data.kilometerSystem = new graphicData.KilometerSystem(v);
}
get hasControl(): boolean {
return this.data.hasControl;
}
set hasControl(v: boolean) {
this.data.hasControl = v;
}
get concentrationStations(): boolean {
return this.data.concentrationStations;
}

View File

@ -1,4 +1,3 @@
import { Color, Container, Graphics, Point } from 'pixi.js';
import {
GraphicData,
GraphicState,
@ -13,8 +12,6 @@ export interface IStationData extends GraphicData {
set code(v: string);
get kilometerSystem(): KilometerSystem;
set kilometerSystem(v: KilometerSystem);
get hasControl(): boolean; /// 是否有控制
set hasControl(v: boolean);
get concentrationStations(): boolean; ////是否集中站
set concentrationStations(v: boolean);
get index(): number;
@ -56,239 +53,15 @@ const stationConsts = {
kilometerCodeFontSize: 8,
kilometerCodeOffsetY: -25,
};
class constrolGraphic extends Container {
circleA: Graphics = new Graphics();
codeGraphA: VectorText = new VectorText(''); //控制名--紧急站控
circleB: Graphics = new Graphics();
codeGraphB: VectorText = new VectorText(''); //控制名--中控
circleC: Graphics = new Graphics();
codeGraphC: VectorText = new VectorText(''); //控制名--站控
circleD: Graphics = new Graphics();
codeGraphD: VectorText = new VectorText(''); //控制名--联锁控
circleE: Graphics = new Graphics();
codeGraphE: VectorText = new VectorText(''); //控制名--按图折返
constructor() {
super();
this.addChild(this.circleA);
this.addChild(this.codeGraphA);
this.addChild(this.circleB);
this.addChild(this.codeGraphB);
this.addChild(this.circleC);
this.addChild(this.codeGraphC);
this.addChild(this.circleD);
this.addChild(this.codeGraphD);
this.addChild(this.circleE);
this.addChild(this.codeGraphE);
this.codeGraphA.setVectorFontSize(stationConsts.codeFontSize);
this.codeGraphB.setVectorFontSize(stationConsts.codeFontSize);
this.codeGraphC.setVectorFontSize(stationConsts.codeFontSize);
this.codeGraphD.setVectorFontSize(stationConsts.codeFontSize);
this.codeGraphE.setVectorFontSize(stationConsts.codeFontSize);
}
draw(states: IStationState): void {
const graphics = [
{
circle: this.circleA,
codeGraph: this.codeGraphA,
codeText: '紧急站控',
circleFillColor: stationConsts.circleColorGrey,
codeGraphFillColor: stationConsts.circleColorWhite,
},
{
circle: this.circleB,
codeGraph: this.codeGraphB,
codeText: '中控',
circleFillColor: stationConsts.circleColorBlue,
codeGraphFillColor: stationConsts.circleColorBlue,
},
{
circle: this.circleC,
codeGraph: this.codeGraphC,
codeText: '站控',
circleFillColor: stationConsts.circleColorGrey,
codeGraphFillColor: stationConsts.circleColorWhite,
circlePs: new Point(0, stationConsts.circleOffsetY),
codeGraphPs: new Point(0, stationConsts.codeOffsetY),
},
{
circle: this.circleD,
codeGraph: this.codeGraphD,
codeText: '联锁控',
circleFillColor: stationConsts.circleColorGrey,
codeGraphFillColor: stationConsts.circleColorWhite,
},
{
circle: this.circleE,
codeGraph: this.codeGraphE,
codeText: '按图折返',
circleFillColor: stationConsts.circleColorYellow,
codeGraphFillColor: stationConsts.circleColorYellow,
},
];
if (
states.ipRtuStusInEmergencyCtrl ||
states.ipRtuStusInLocalCtrl ||
states.ipRtuStusInCentralCtrl
) {
graphics[1].circleFillColor = stationConsts.circleColorGrey;
graphics[1].codeGraphFillColor = stationConsts.circleColorWhite;
if (states.ipRtuStusInEmergencyCtrl) {
graphics[0].circleFillColor = stationConsts.emergencyStationControl;
graphics[0].codeGraphFillColor = stationConsts.emergencyStationControl;
} else if (states.ipRtuStusInCentralCtrl) {
graphics[1].circleFillColor = stationConsts.centralControl;
graphics[1].codeGraphFillColor = stationConsts.centralControl;
} else if (states.ipRtuStusInLocalCtrl) {
graphics[2].circleFillColor = stationConsts.stationControl;
graphics[2].codeGraphFillColor = stationConsts.stationControl;
}
}
const graphicsPs = [
{
circlePs: new Point(
-stationConsts.circleBetweenOffset * 2,
stationConsts.circleOffsetY
),
codeGraphPs: new Point(
-stationConsts.circleBetweenOffset * 2,
stationConsts.codeOffsetY
),
},
{
circlePs: new Point(
-stationConsts.circleBetweenOffset,
stationConsts.circleOffsetY
),
codeGraphPs: new Point(
-stationConsts.circleBetweenOffset,
stationConsts.codeOffsetY
),
},
{
circlePs: new Point(0, stationConsts.circleOffsetY),
codeGraphPs: new Point(0, stationConsts.codeOffsetY),
},
{
circlePs: new Point(
stationConsts.circleBetweenOffset,
stationConsts.circleOffsetY
),
codeGraphPs: new Point(
stationConsts.circleBetweenOffset,
stationConsts.codeOffsetY
),
},
{
circlePs: new Point(
stationConsts.circleBetweenOffset * 2,
stationConsts.circleOffsetY
),
codeGraphPs: new Point(
stationConsts.circleBetweenOffset * 2,
stationConsts.codeOffsetY
),
},
];
const graphicsPsChange = [
{
circlePs: new Point(
(-stationConsts.circleBetweenOffset * 3) / 2,
stationConsts.circleOffsetY
),
codeGraphPs: new Point(
(-stationConsts.circleBetweenOffset * 3) / 2,
stationConsts.codeOffsetY
),
},
{
circlePs: new Point(
-stationConsts.circleBetweenOffset / 2,
stationConsts.circleOffsetY
),
codeGraphPs: new Point(
-stationConsts.circleBetweenOffset / 2,
stationConsts.codeOffsetY
),
},
{
circlePs: new Point(
stationConsts.circleBetweenOffset / 2,
stationConsts.circleOffsetY
),
codeGraphPs: new Point(
stationConsts.circleBetweenOffset / 2,
stationConsts.codeOffsetY
),
},
{
circlePs: new Point(
(stationConsts.circleBetweenOffset * 3) / 2,
stationConsts.circleOffsetY
),
codeGraphPs: new Point(
(stationConsts.circleBetweenOffset * 3) / 2,
stationConsts.codeOffsetY
),
},
];
//graphics.pop();
graphics.forEach((g, i) => {
Object.assign(g, graphicsPs[i]);
//Object.assign(g, graphicsPsChange[i]);
this.drawCircleCode(
g.circle,
g.codeGraph,
g.codeText,
g.circleFillColor,
g.codeGraphFillColor
);
g.circle.position.copyFrom(g.circlePs as Point);
g.codeGraph.position.copyFrom(g.codeGraphPs as Point);
});
}
drawCircleCode(
circle: Graphics,
codeGraph: VectorText,
code: string,
circleFillColor: string,
codeGraphFillColor: string
): void {
circle.clear();
circle.lineStyle(stationConsts.borderWidth, new Color(circleFillColor));
circle.beginFill(circleFillColor, 1);
circle.drawCircle(0, 0, stationConsts.radius);
circle.endFill;
codeGraph.text = code;
codeGraph.style.fill = codeGraphFillColor;
codeGraph.setVectorFontSize(stationConsts.codeControlFontSize);
codeGraph.anchor.set(0.5);
}
clear(): void {
this.circleA.clear();
this.circleB.clear();
this.circleC.clear();
this.circleD.clear();
this.circleE.clear();
this.codeGraphA.text = '';
this.codeGraphB.text = '';
this.codeGraphC.text = '';
this.codeGraphD.text = '';
this.codeGraphE.text = '';
}
}
export class Station extends JlGraphic {
static Type = 'station';
codeGraph: VectorText = new VectorText(''); //车站名
kilometerGraph: VectorText = new VectorText(''); //公里标
controlGraphic: constrolGraphic = new constrolGraphic();
constructor() {
super(Station.Type);
this.addChild(this.codeGraph);
this.addChild(this.kilometerGraph);
this.addChild(this.controlGraphic);
this.kilometerGraph.name = 'kilometer';
this.controlGraphic.name = 'trainControl';
}
get datas(): IStationData {
@ -303,8 +76,6 @@ export class Station extends JlGraphic {
doRepaint(): void {
const codeGraph = this.codeGraph;
const kilometerGraph = this.kilometerGraph;
const controlGraphic = this.controlGraphic;
controlGraphic.clear();
codeGraph.text = this.datas?.code || '车站Station';
codeGraph.style.fill = stationConsts.codeColor;
codeGraph.setVectorFontSize(stationConsts.codeFontSize);
@ -334,9 +105,6 @@ export class Station extends JlGraphic {
}
});
}
if (this.datas.hasControl) {
controlGraphic.draw(this.states);
}
}
}

View File

@ -50,7 +50,6 @@ export class StationDraw extends GraphicDrawAssistant<
}
prepareData(data: IStationData): boolean {
data.transform = this.container.saveTransform();
data.hasControl = this.graphicTemplate.hasControl;
return true;
}
}
@ -88,11 +87,6 @@ export class stationInteraction extends GraphicInteractionPlugin<Station> {
g.cursor = 'pointer';
g.scalable = true;
g.rotatable = true;
g.controlGraphic.eventMode = 'static';
g.controlGraphic.cursor = 'pointer';
g.controlGraphic.draggable = true;
g.controlGraphic.selectable = true;
g.controlGraphic.transformSave = true;
g.kilometerGraph.eventMode = 'static';
g.kilometerGraph.cursor = 'pointer';
g.kilometerGraph.draggable = true;
@ -104,10 +98,6 @@ export class stationInteraction extends GraphicInteractionPlugin<Station> {
g.eventMode = 'none';
g.scalable = false;
g.rotatable = false;
g.controlGraphic.eventMode = 'none';
g.controlGraphic.draggable = false;
g.controlGraphic.selectable = false;
g.controlGraphic.transformSave = false;
g.kilometerGraph.eventMode = 'none';
g.kilometerGraph.draggable = false;
g.kilometerGraph.selectable = false;

View File

@ -1124,7 +1124,6 @@ export namespace graphicData {
constructor(data?: any[] | {
common?: CommonInfo;
code?: string;
hasControl?: boolean;
concentrationStations?: boolean;
kilometerSystem?: KilometerSystem;
index?: number;
@ -1138,9 +1137,6 @@ export namespace graphicData {
if ("code" in data && data.code != undefined) {
this.code = data.code;
}
if ("hasControl" in data && data.hasControl != undefined) {
this.hasControl = data.hasControl;
}
if ("concentrationStations" in data && data.concentrationStations != undefined) {
this.concentrationStations = data.concentrationStations;
}
@ -1167,12 +1163,6 @@ export namespace graphicData {
set code(value: string) {
pb_1.Message.setField(this, 2, value);
}
get hasControl() {
return pb_1.Message.getFieldWithDefault(this, 3, false) as boolean;
}
set hasControl(value: boolean) {
pb_1.Message.setField(this, 3, value);
}
get concentrationStations() {
return pb_1.Message.getFieldWithDefault(this, 4, false) as boolean;
}
@ -1197,7 +1187,6 @@ export namespace graphicData {
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
hasControl?: boolean;
concentrationStations?: boolean;
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>;
index?: number;
@ -1209,9 +1198,6 @@ export namespace graphicData {
if (data.code != null) {
message.code = data.code;
}
if (data.hasControl != null) {
message.hasControl = data.hasControl;
}
if (data.concentrationStations != null) {
message.concentrationStations = data.concentrationStations;
}
@ -1227,7 +1213,6 @@ export namespace graphicData {
const data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
hasControl?: boolean;
concentrationStations?: boolean;
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>;
index?: number;
@ -1238,9 +1223,6 @@ export namespace graphicData {
if (this.code != null) {
data.code = this.code;
}
if (this.hasControl != null) {
data.hasControl = this.hasControl;
}
if (this.concentrationStations != null) {
data.concentrationStations = this.concentrationStations;
}
@ -1260,8 +1242,6 @@ export namespace graphicData {
writer.writeMessage(1, this.common, () => this.common.serialize(writer));
if (this.code.length)
writer.writeString(2, this.code);
if (this.hasControl != false)
writer.writeBool(3, this.hasControl);
if (this.concentrationStations != false)
writer.writeBool(4, this.concentrationStations);
if (this.has_kilometerSystem)
@ -1283,9 +1263,6 @@ export namespace graphicData {
case 2:
message.code = reader.readString();
break;
case 3:
message.hasControl = reader.readBool();
break;
case 4:
message.concentrationStations = reader.readBool();
break;