驾驶台相关

This commit is contained in:
joylink_zhaoerwei 2024-03-19 14:20:53 +08:00
parent eee398eaa1
commit 9261a95f78
17 changed files with 1369 additions and 55 deletions

View File

@ -56,7 +56,8 @@ export interface TrainCreateParams {
total_length: number;
train_model: number;
train_sets: string;
trainConfigData?: TrainConfigData
trainConfigData?: TrainConfigData;
trainControlMapId: number;
}
/**

View File

@ -163,6 +163,7 @@ function onCreate() {
wheelDiameter: wheelDiameter.value,
trainLength: trainConfig.value.total_length,
configTrain: trainConfig.value.trainConfigData as TrainConfigData,
trainControlMapId: trainConfig.value.trainControlMapId,
trainEndsA: {
radarCheckSpeedDiff: 0,
radarCheckTime: 0,
@ -208,6 +209,7 @@ const trainConfig = ref<TrainConfigItem | null>({
total_length: 0,
train_model: 0,
train_sets: '',
trainControlMapId: 0,
});
function setConfigVal(val: TrainConfigItem | null) {
trainConfig.value = val || null;

View File

@ -190,6 +190,7 @@ import SetTrainParam from 'src/components/draw-app/dialogs/SetTrainParam.vue';
import { Dialog } from 'quasar';
import { state } from 'src/protos/device_state';
import SetTrainLink from 'src/components/draw-app/dialogs/SetTrainLink.vue';
import { useTccStore } from 'src/stores/tcc-store';
interface KeyType {
label: string;
@ -607,6 +608,10 @@ const options = [
label: '列车连接',
value: 2,
},
{
label: '列车驾驶台',
value: 3,
},
];
function doTrainOperation(option: { label: string; value: number }) {
@ -614,6 +619,8 @@ function doTrainOperation(option: { label: string; value: number }) {
setTrain();
} else if (option.value == 2) {
linkTrain();
} else if (option.value == 3) {
openTccDialog();
}
}
@ -649,6 +656,14 @@ function setTrain() {
persistent: true,
});
}
function openTccDialog() {
const trainId = trainInfo.value?.id ? +trainInfo.value?.id : 0;
useTccStore().setTccParam(
trainId,
trainInfo.value?.trainControlMapId as number
);
}
</script>
<style lang="scss" scoped>
.q-item {

View File

@ -8,7 +8,7 @@ import { tccGraphicData } from 'src/protos/tccGraphics';
import { GraphicDataBase, GraphicStateBase } from './GraphicDataBase';
import { state } from 'src/protos/device_state';
import { GraphicInteractionPlugin, IGraphicScene, JlGraphic } from 'jl-graphic';
import { type FederatedMouseEvent } from 'pixi.js';
import { type FederatedMouseEvent, DisplayObject } from 'pixi.js';
import { useTccStore } from 'src/stores/tcc-store';
export class TccHandleData extends GraphicDataBase implements ITccHandleData {
@ -96,37 +96,52 @@ export class TccHandleInteraction extends GraphicInteractionPlugin<TccHandle> {
return grahpics.filter((g): g is TccHandle => g instanceof TccHandle);
}
bind(g: TccHandle): void {
g.eventMode = 'static';
g.cursor = 'pointer';
g._tccHandle.eventMode = 'static';
g._tccHandle.cursor = 'pointer';
g._tccHandle.on('mousedown', this.onMouseDown);
g._tccHandle.on('mouseup', this.onMouseUp);
g._tccHandle.onmousedown = (e) => {
this.onMouseDown(e);
};
g._tccHandle.onmouseup = () => {
this.isMouseDown = false;
};
g.onmousemove = (e) => {
this.onMouseOver(e);
this.onMouseMove(e);
};
g.onmouseleave = () => {
this.isMouseDown = false;
};
}
unbind(g: TccHandle): void {
g.eventMode = 'none';
g._tccHandle.eventMode = 'none';
g._tccHandle.off('mousedown', this.onMouseDown);
g._tccHandle.off('mouseup', this.onMouseUp);
g._tccHandle.onmousedown = null;
g._tccHandle.onmouseup = null;
g.onmousemove = null;
g.onmouseleave = null;
}
onMouseDown(e: FederatedMouseEvent) {
const tccHandle = e.target as TccHandle;
const target = e.target as DisplayObject;
const tccHandle = target.getGraphic<TccHandle>();
if (!tccHandle) return;
this.isMouseDown = true;
this.mouseDownBeginPos = e.clientY;
this.mouseDownTccHandleBeginPos = tccHandle._tccHandle.y;
}
onMouseUp() {
this.isMouseDown = false;
}
onMouseOver(e: FederatedMouseEvent) {
const tccHandle = e.target as TccHandle;
if (this.isMouseDown) {
onMouseMove(e: FederatedMouseEvent) {
const target = e.target as DisplayObject;
const tccHandle = target.getGraphic<TccHandle>();
if (!tccHandle) return;
if (
this.isMouseDown &&
tccHandle._tccHandle.y > -145 &&
tccHandle._tccHandle.y < 145
) {
tccHandle._tccHandle.y =
this.mouseDownTccHandleBeginPos + e.clientY - this.mouseDownBeginPos;
if (tccHandle._tccHandle.y >= 145) {
tccHandle._tccHandle.y = 144;
} else if (tccHandle._tccHandle.y <= -145) {
tccHandle._tccHandle.y = -144;
}
}
}
}

View File

@ -4,7 +4,7 @@ import { tccGraphicData } from 'src/protos/tccGraphics';
import { GraphicDataBase, GraphicStateBase } from './GraphicDataBase';
import { state } from 'src/protos/device_state';
import { GraphicInteractionPlugin, IGraphicScene, JlGraphic } from 'jl-graphic';
import { type FederatedMouseEvent } from 'pixi.js';
import { type FederatedMouseEvent, DisplayObject, Point } from 'pixi.js';
import { useTccStore } from 'src/stores/tcc-store';
export class TccKeyData extends GraphicDataBase implements ITccKeyData {
@ -82,6 +82,8 @@ export class TccKeyState extends GraphicStateBase implements ITccKeyState {
export class TccKeyInteraction extends GraphicInteractionPlugin<TccKey> {
static Name = 'TccKeyInteraction';
isMouseDown = false;
mouseDownBeginPos = new Point();
constructor(app: IGraphicScene) {
super(TccKeyInteraction.Name, app);
}
@ -92,9 +94,20 @@ export class TccKeyInteraction extends GraphicInteractionPlugin<TccKey> {
return grahpics.filter((g): g is TccKey => g instanceof TccKey);
}
bind(g: TccKey): void {
g.eventMode = 'static';
g.cursor = 'pointer';
g.on('_leftclick', this.onClick);
g._tccKey.eventMode = 'static';
g._tccKey.cursor = 'pointer';
g._tccKey.onmousedown = (e) => {
this.onMouseDown(e);
};
g._tccKey.onmouseup = () => {
this.isMouseDown = false;
};
g.onmousemove = (e) => {
this.onMousemove(e);
};
g.onmouseleave = () => {
this.isMouseDown = false;
};
}
unbind(g: TccKey): void {
g.eventMode = 'none';
@ -105,4 +118,68 @@ export class TccKeyInteraction extends GraphicInteractionPlugin<TccKey> {
/* const changeState = useTccStore().tccKeyOperation;
changeState(g.datas.id, g.state.gear === 0 ? 1 : 0); */
}
onMouseDown(e: FederatedMouseEvent) {
const target = e.target as DisplayObject;
const tccKey = target.getGraphic<TccKey>();
if (!tccKey) return;
this.isMouseDown = true;
this.mouseDownBeginPos = tccKey
.getGraphicApp()
.getScene('tcc')
.toCanvasCoordinates(e.global);
}
onMousemove(e: FederatedMouseEvent) {
const target = e.target as DisplayObject;
const tccKey = target.getGraphic<TccKey>();
if (!tccKey) return;
if (this.isMouseDown) {
const mouseEndPos = tccKey
.getGraphicApp()
.getScene('tcc')
.toCanvasCoordinates(e.global);
const { angle, direction } = calculateAngleAndDirection(
this.mouseDownBeginPos,
tccKey.position,
mouseEndPos
);
if (
direction == 'ssz' &&
angle > 45 &&
(tccKey._tccKey.rotation == -Math.PI / 4 ||
tccKey._tccKey.rotation == 0)
) {
tccKey._tccKey.rotation += Math.PI / 4;
}
if (
direction == 'nsz' &&
angle > 45 &&
(tccKey._tccKey.rotation == Math.PI / 4 || tccKey._tccKey.rotation == 0)
) {
tccKey._tccKey.rotation -= Math.PI / 4;
}
}
}
}
function calculateAngleAndDirection(
pointA: Point,
pointO: Point,
pointB: Point
) {
const vectorAO = { x: pointA.x - pointO.x, y: pointA.y - pointO.y };
const vectorOB = { x: pointB.x - pointO.x, y: pointB.y - pointO.y };
const dotProduct = vectorAO.x * vectorOB.x + vectorAO.y * vectorOB.y;
const magnitudeAO = Math.sqrt(vectorAO.x ** 2 + vectorAO.y ** 2);
const magnitudeOB = Math.sqrt(vectorOB.x ** 2 + vectorOB.y ** 2);
const angle =
Math.acos(dotProduct / (magnitudeAO * magnitudeOB)) * (180 / Math.PI);
const crossProduct = vectorAO.x * vectorOB.y - vectorAO.y * vectorOB.x;
let rotationDirection = '';
if (crossProduct > 0) {
rotationDirection = 'ssz';
} else {
rotationDirection = 'nsz';
}
return { angle: angle, direction: rotationDirection };
}

View File

@ -673,6 +673,9 @@ export class TrainState extends GraphicStateBase implements ITrainState {
set connType(v: state.TrainConnState.TrainConnType) {
this.states.connState.connType = v;
}
get trainControlMapId(): number {
return this.states.connState.TrainControlMapId;
}
clone(): TrainState {
return new TrainState(this.states.cloneMessage());
}

View File

@ -60,7 +60,7 @@ function handleSubscribe(pslScene: IGraphicScene) {
const pslStore = usePslStore();
const simulationId = lineStore.simulationId;
const mapId = lineStore.mapId;
const pslId = pslStore.gatedBoxId;
const pslId = pslStore.pslId;
const app = pslScene;
app.subscribe({
destination: `/rtsts/simulation/${simulationId}/psl/${mapId}/${pslId}`,

View File

@ -31,11 +31,7 @@ import { TccKey, TccKeyTemplate } from 'src/graphics/tccKey/TccKey';
import { TccKeyData, TccKeyState } from './graphics/TccKeyInteraction';
import { TccHandleDraw } from 'src/graphics/tccHandle/TccHandleDrawAssistant';
import { TccHandle, TccHandleTemplate } from 'src/graphics/tccHandle/TccHandle';
import {
TccHandleData,
TccHandleInteraction,
TccHandleState,
} from './graphics/TccHandleInteraction';
import { TccHandleData, TccHandleState } from './graphics/TccHandleInteraction';
const UndoOptions: MenuItemOptions = {
name: '撤销',
@ -91,7 +87,6 @@ export function initTccDrawApp(): IDrawApp {
drawApp,
new TccHandleTemplate(new TccHandleData(), new TccHandleState())
);
TccHandleInteraction.init(app);
// 画布右键菜单
app.registerMenu(DefaultCanvasMenu);

View File

@ -5,7 +5,7 @@ import {
IGraphicScene,
IGraphicStorage,
} from 'jl-graphic';
import { getPublishMapInfoByName } from 'src/api/PublishApi';
import { getPublishMapInfoById } from 'src/api/PublishApi';
import { useTccStore } from 'src/stores/tcc-store';
import { toUint8Array } from 'js-base64';
import { useLineStore } from 'src/stores/line-store';
@ -37,7 +37,6 @@ export function initTccScene(lineApp: IGraphicApp, sceneName: string) {
dataLoader: loadTccDatas,
mouseToolOptions: {
boxSelect: false,
viewportDrag: false,
wheelZoom: false,
},
});
@ -54,13 +53,6 @@ export function initTccScene(lineApp: IGraphicApp, sceneName: string) {
tccScene.on('postdataloaded', () => {
handleSubscribe(tccScene);
});
tccScene.setOptions({
mouseToolOptions: {
boxSelect: false,
viewportDrag: false,
wheelZoom: false,
},
});
return tccScene;
}
@ -68,13 +60,12 @@ function handleSubscribe(tccScene: IGraphicScene) {
const lineStore = useLineStore();
const tccStore = useTccStore();
const simulationId = lineStore.simulationId;
const mapId = lineStore.mapId;
const tccId = tccStore.tccId;
const app = tccScene;
app.subscribe({
destination: `/rtsts/simulation/${simulationId}/tcc/${mapId}/${tccId}`,
destination: `/rtsts/simulation/${simulationId}/train/control/${tccId}`,
messageConverter: (message: Uint8Array) => {
// console.log('收到消息', message);
console.log('收到消息', message);
const states: GraphicState[] = [];
const storage = state.PushedDevicesStatus.deserialize(message);
if (storage.all) {
@ -92,10 +83,9 @@ function handleSubscribe(tccScene: IGraphicScene) {
async function loadTccDatas(): Promise<IGraphicStorage> {
const tccStore = useTccStore();
const { proto: base64 } = await getPublishMapInfoByName({
name: tccStore.tccMapCode,
detail: true,
});
const { proto: base64 } = await getPublishMapInfoById(
tccStore.trainControlMapId
);
if (base64) {
const storage = tccGraphicData.TccGraphicStorage.deserialize(
toUint8Array(base64)

View File

@ -240,6 +240,7 @@ export interface ITrainState extends GraphicState {
set conn(v: boolean);
get connType(): state.TrainConnState.TrainConnType;
set connType(v: state.TrainConnState.TrainConnType);
get trainControlMapId(): number;
}
interface bodyWH {
width: number; // 宽

View File

@ -64,7 +64,7 @@
style="width: 500px; height: 600px"
></div>
</draggable-dialog>
<DraggableDialog
<draggable-dialog
:title="`${ibpStore.stationCode}IBP`"
v-model="ibpStore.isIbpDialogOpen"
:width="1250"
@ -76,7 +76,15 @@
class="overflow-hidden"
style="width: 1250px; height: 615px"
/>
</DraggableDialog>
</draggable-dialog>
<draggable-dialog
v-model="tccStore.isTccDialogOpen"
:width="tccCanvasWidth"
:height="tccCanvasHeight"
@hide="tccHide"
>
<div id="tcc-app-container" class="overflow-hidden"></div>
</draggable-dialog>
</q-layout>
</template>
@ -113,6 +121,7 @@ import { state } from 'src/protos/device_state';
import { PictureType } from 'src/protos/picture';
import ConnectInfoDialog from 'src/components/line-app/dialogs/ConnectInfoDialog.vue';
import { updataOnChangeScene } from 'src/drawApp/relayScene';
import { useTccStore } from 'src/stores/tcc-store';
const $q = useQuasar();
const canvasWidth = ref(0);
@ -225,6 +234,7 @@ onMounted(async () => {
// drawerRight.value = false;
});
//psl
const pslCanvasWidth = ref(500);
const pslCanvasHeight = ref(600);
watch(
@ -252,6 +262,34 @@ function pslHide() {
pslStore.clearPslParam();
lineApp.getScene('psl').unbindDom();
}
//Tcc
const tccStore = useTccStore();
const tccCanvasWidth = ref(1000);
const tccCanvasHeight = ref(600);
watch(
() => tccStore.isTccDialogOpen,
(val: boolean) => {
if (val === true) {
nextTick(async () => {
const container = document.getElementById('tcc-app-container');
if (!container) return;
const tccScene = tccStore.getTccScene();
tccScene?.bindDom(container);
await tccScene?.reload();
if (tccScene) {
container.style.width = tccCanvasWidth.value + 'px';
container.style.height = tccCanvasHeight.value + 'px';
}
});
}
}
);
function tccHide() {
tccStore.clearTccParam();
lineApp.getScene('tcc').unbindDom();
}
watch(
() => lineStore.showTrainSearch,
(val) => {

View File

@ -423,6 +423,7 @@ const pictureTypeList: { label: string; value: PictureType }[] = [
{ label: '继电器柜布置图', value: PictureType.RelayCabinetLayout },
{ label: 'IBP盘', value: PictureType.IBP },
{ label: '列车数据', value: PictureType.TrainData },
{ label: '列车驾驶台', value: PictureType.TrainControlCab },
];
function getTypeName(val?: number) {

View File

@ -156,6 +156,16 @@
hint=""
></q-input>
</div>
<div class="col-4 q-px-sm">
<q-select
outlined
v-model="editInfo.trainControlMapId"
emitValue
mapOptions
:options="tccNameList"
label="关联驾驶台地图"
/>
</div>
<div class="col-12 q-px-sm" style="padding-bottom: 10px">
<q-input
outlined
@ -368,6 +378,8 @@ import {
import { ApiError } from 'src/boot/axios';
import { graphicData } from 'src/protos/stationLayoutGraphics';
import { computed, onMounted, reactive, ref } from 'vue';
import { getPublishList } from 'src/api/PublishApi';
import { PictureType } from 'src/protos/picture';
const $q = useQuasar();
@ -381,10 +393,24 @@ const props = withDefaults(
const tableHeight = computed(() => {
return props.sizeHeight - 32;
});
const tccNameList = ref<{ label: string; value: number }[]>([]);
onMounted(() => {
getModelOption();
tableRef.value.requestServerInteraction();
getPublishList({
type: PictureType.TrainControlCab,
category: null,
}).then((tccMapList) => {
if (tccMapList && tccMapList.length) {
tccMapList.forEach((item) => {
tccNameList.value.push({
label: item.name,
value: item.id,
});
});
}
});
});
const columnDefs: QTableColumn[] = [
@ -502,6 +528,7 @@ function onCreate() {
// max_diameter: editInfo.max_diameter,
train_sets: editInfo.train_sets,
trainConfigData: editInfo.trainConfigData,
trainControlMapId: editInfo.trainControlMapId,
};
if (editInfo.id) {
await saveTrainData(+editInfo.id, params);
@ -534,6 +561,7 @@ function onReset() {
// editInfo.min_diameter = 0;
// editInfo.max_diameter = 0;
editInfo.train_sets = '';
editInfo.trainControlMapId = 0;
editInfo.trainConfigData.davisParamA = 2.25;
editInfo.trainConfigData.davisParamB = 0.019;
editInfo.trainConfigData.davisParamC = 0.00032;
@ -588,6 +616,7 @@ interface EditCreateItem extends TrainCreateParams {
total_length: number;
train_model: number;
train_sets: string;
trainControlMapId: number;
trainConfigData: {
davisParamA: number;
davisParamB: number;
@ -619,6 +648,7 @@ const editInfo = reactive<EditCreateItem>({
min_diameter: 0,
max_diameter: 0,
train_sets: '',
trainControlMapId: 0,
trainConfigData: {
davisParamA: 2.25,
davisParamB: 0.019,
@ -651,6 +681,7 @@ function editData(row: TrainItem) {
// editInfo.min_diameter = res.min_diameter;
// editInfo.max_diameter = res.max_diameter;
editInfo.train_sets = res.train_sets;
editInfo.trainControlMapId = res.trainControlMapId;
if (res.trainConfigData) {
editInfo.trainConfigData.davisParamA = res.trainConfigData.davisParamA;
editInfo.trainConfigData.davisParamB = res.trainConfigData.davisParamB;

View File

@ -1020,6 +1020,7 @@ export namespace state {
constructor(data?: any[] | {
conn?: boolean;
connType?: TrainConnState.TrainConnType;
TrainControlMapId?: number;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -1030,6 +1031,9 @@ export namespace state {
if ("connType" in data && data.connType != undefined) {
this.connType = data.connType;
}
if ("TrainControlMapId" in data && data.TrainControlMapId != undefined) {
this.TrainControlMapId = data.TrainControlMapId;
}
}
}
get conn() {
@ -1044,9 +1048,16 @@ export namespace state {
set connType(value: TrainConnState.TrainConnType) {
pb_1.Message.setField(this, 2, value);
}
get TrainControlMapId() {
return pb_1.Message.getFieldWithDefault(this, 3, 0) as number;
}
set TrainControlMapId(value: number) {
pb_1.Message.setField(this, 3, value);
}
static fromObject(data: {
conn?: boolean;
connType?: TrainConnState.TrainConnType;
TrainControlMapId?: number;
}): TrainConnState {
const message = new TrainConnState({});
if (data.conn != null) {
@ -1055,12 +1066,16 @@ export namespace state {
if (data.connType != null) {
message.connType = data.connType;
}
if (data.TrainControlMapId != null) {
message.TrainControlMapId = data.TrainControlMapId;
}
return message;
}
toObject() {
const data: {
conn?: boolean;
connType?: TrainConnState.TrainConnType;
TrainControlMapId?: number;
} = {};
if (this.conn != null) {
data.conn = this.conn;
@ -1068,6 +1083,9 @@ export namespace state {
if (this.connType != null) {
data.connType = this.connType;
}
if (this.TrainControlMapId != null) {
data.TrainControlMapId = this.TrainControlMapId;
}
return data;
}
serialize(): Uint8Array;
@ -1078,6 +1096,8 @@ export namespace state {
writer.writeBool(1, this.conn);
if (this.connType != TrainConnState.TrainConnType.NONE)
writer.writeEnum(2, this.connType);
if (this.TrainControlMapId != 0)
writer.writeUint32(3, this.TrainControlMapId);
if (!w)
return writer.getResultBuffer();
}
@ -1093,6 +1113,9 @@ export namespace state {
case 2:
message.connType = reader.readEnum();
break;
case 3:
message.TrainControlMapId = reader.readUint32();
break;
default: reader.skipField();
}
}
@ -1138,6 +1161,7 @@ export namespace state {
tailOffset?: number;
tailDevicePort?: string;
btmState?: BTMState;
tcc?: TrainControlState;
connState?: TrainConnState;
}) {
super();
@ -1212,6 +1236,9 @@ export namespace state {
if ("btmState" in data && data.btmState != undefined) {
this.btmState = data.btmState;
}
if ("tcc" in data && data.tcc != undefined) {
this.tcc = data.tcc;
}
if ("connState" in data && data.connState != undefined) {
this.connState = data.connState;
}
@ -1373,15 +1400,24 @@ export namespace state {
get has_btmState() {
return pb_1.Message.getField(this, 23) != null;
}
get connState() {
return pb_1.Message.getWrapperField(this, TrainConnState, 24) as TrainConnState;
get tcc() {
return pb_1.Message.getWrapperField(this, TrainControlState, 24) as TrainControlState;
}
set connState(value: TrainConnState) {
set tcc(value: TrainControlState) {
pb_1.Message.setWrapperField(this, 24, value);
}
get has_connState() {
get has_tcc() {
return pb_1.Message.getField(this, 24) != null;
}
get connState() {
return pb_1.Message.getWrapperField(this, TrainConnState, 25) as TrainConnState;
}
set connState(value: TrainConnState) {
pb_1.Message.setWrapperField(this, 25, value);
}
get has_connState() {
return pb_1.Message.getField(this, 25) != null;
}
static fromObject(data: {
id?: string;
up?: boolean;
@ -1406,6 +1442,7 @@ export namespace state {
tailOffset?: number;
tailDevicePort?: string;
btmState?: ReturnType<typeof BTMState.prototype.toObject>;
tcc?: ReturnType<typeof TrainControlState.prototype.toObject>;
connState?: ReturnType<typeof TrainConnState.prototype.toObject>;
}): TrainState {
const message = new TrainState({});
@ -1478,6 +1515,9 @@ export namespace state {
if (data.btmState != null) {
message.btmState = BTMState.fromObject(data.btmState);
}
if (data.tcc != null) {
message.tcc = TrainControlState.fromObject(data.tcc);
}
if (data.connState != null) {
message.connState = TrainConnState.fromObject(data.connState);
}
@ -1508,6 +1548,7 @@ export namespace state {
tailOffset?: number;
tailDevicePort?: string;
btmState?: ReturnType<typeof BTMState.prototype.toObject>;
tcc?: ReturnType<typeof TrainControlState.prototype.toObject>;
connState?: ReturnType<typeof TrainConnState.prototype.toObject>;
} = {};
if (this.id != null) {
@ -1579,6 +1620,9 @@ export namespace state {
if (this.btmState != null) {
data.btmState = this.btmState.toObject();
}
if (this.tcc != null) {
data.tcc = this.tcc.toObject();
}
if (this.connState != null) {
data.connState = this.connState.toObject();
}
@ -1634,8 +1678,10 @@ export namespace state {
writer.writeString(22, this.tailDevicePort);
if (this.has_btmState)
writer.writeMessage(23, this.btmState, () => this.btmState.serialize(writer));
if (this.has_tcc)
writer.writeMessage(24, this.tcc, () => this.tcc.serialize(writer));
if (this.has_connState)
writer.writeMessage(24, this.connState, () => this.connState.serialize(writer));
writer.writeMessage(25, this.connState, () => this.connState.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -1715,6 +1761,9 @@ export namespace state {
reader.readMessage(message.btmState, () => message.btmState = BTMState.deserialize(reader));
break;
case 24:
reader.readMessage(message.tcc, () => message.tcc = TrainControlState.deserialize(reader));
break;
case 25:
reader.readMessage(message.connState, () => message.connState = TrainConnState.deserialize(reader));
break;
default: reader.skipField();
@ -7715,4 +7764,534 @@ export namespace state {
return SimulationThirdPartyApiServiceState.deserialize(bytes);
}
}
export class TrainControlState extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
ebutton?: TrainControlState.EmergentButton;
driverKey?: TrainControlState.DriverKeySwitch[];
dirKey?: TrainControlState.DirectionKeySwitch;
pushHandler?: TrainControlState.PushHandler;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("ebutton" in data && data.ebutton != undefined) {
this.ebutton = data.ebutton;
}
if ("driverKey" in data && data.driverKey != undefined) {
this.driverKey = data.driverKey;
}
if ("dirKey" in data && data.dirKey != undefined) {
this.dirKey = data.dirKey;
}
if ("pushHandler" in data && data.pushHandler != undefined) {
this.pushHandler = data.pushHandler;
}
}
}
get ebutton() {
return pb_1.Message.getWrapperField(this, TrainControlState.EmergentButton, 1) as TrainControlState.EmergentButton;
}
set ebutton(value: TrainControlState.EmergentButton) {
pb_1.Message.setWrapperField(this, 1, value);
}
get has_ebutton() {
return pb_1.Message.getField(this, 1) != null;
}
get driverKey() {
return pb_1.Message.getRepeatedWrapperField(this, TrainControlState.DriverKeySwitch, 2) as TrainControlState.DriverKeySwitch[];
}
set driverKey(value: TrainControlState.DriverKeySwitch[]) {
pb_1.Message.setRepeatedWrapperField(this, 2, value);
}
get dirKey() {
return pb_1.Message.getWrapperField(this, TrainControlState.DirectionKeySwitch, 3) as TrainControlState.DirectionKeySwitch;
}
set dirKey(value: TrainControlState.DirectionKeySwitch) {
pb_1.Message.setWrapperField(this, 3, value);
}
get has_dirKey() {
return pb_1.Message.getField(this, 3) != null;
}
get pushHandler() {
return pb_1.Message.getWrapperField(this, TrainControlState.PushHandler, 4) as TrainControlState.PushHandler;
}
set pushHandler(value: TrainControlState.PushHandler) {
pb_1.Message.setWrapperField(this, 4, value);
}
get has_pushHandler() {
return pb_1.Message.getField(this, 4) != null;
}
static fromObject(data: {
ebutton?: ReturnType<typeof TrainControlState.EmergentButton.prototype.toObject>;
driverKey?: ReturnType<typeof TrainControlState.DriverKeySwitch.prototype.toObject>[];
dirKey?: ReturnType<typeof TrainControlState.DirectionKeySwitch.prototype.toObject>;
pushHandler?: ReturnType<typeof TrainControlState.PushHandler.prototype.toObject>;
}): TrainControlState {
const message = new TrainControlState({});
if (data.ebutton != null) {
message.ebutton = TrainControlState.EmergentButton.fromObject(data.ebutton);
}
if (data.driverKey != null) {
message.driverKey = data.driverKey.map(item => TrainControlState.DriverKeySwitch.fromObject(item));
}
if (data.dirKey != null) {
message.dirKey = TrainControlState.DirectionKeySwitch.fromObject(data.dirKey);
}
if (data.pushHandler != null) {
message.pushHandler = TrainControlState.PushHandler.fromObject(data.pushHandler);
}
return message;
}
toObject() {
const data: {
ebutton?: ReturnType<typeof TrainControlState.EmergentButton.prototype.toObject>;
driverKey?: ReturnType<typeof TrainControlState.DriverKeySwitch.prototype.toObject>[];
dirKey?: ReturnType<typeof TrainControlState.DirectionKeySwitch.prototype.toObject>;
pushHandler?: ReturnType<typeof TrainControlState.PushHandler.prototype.toObject>;
} = {};
if (this.ebutton != null) {
data.ebutton = this.ebutton.toObject();
}
if (this.driverKey != null) {
data.driverKey = this.driverKey.map((item: TrainControlState.DriverKeySwitch) => item.toObject());
}
if (this.dirKey != null) {
data.dirKey = this.dirKey.toObject();
}
if (this.pushHandler != null) {
data.pushHandler = this.pushHandler.toObject();
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.has_ebutton)
writer.writeMessage(1, this.ebutton, () => this.ebutton.serialize(writer));
if (this.driverKey.length)
writer.writeRepeatedMessage(2, this.driverKey, (item: TrainControlState.DriverKeySwitch) => item.serialize(writer));
if (this.has_dirKey)
writer.writeMessage(3, this.dirKey, () => this.dirKey.serialize(writer));
if (this.has_pushHandler)
writer.writeMessage(4, this.pushHandler, () => this.pushHandler.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): TrainControlState {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new TrainControlState();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
reader.readMessage(message.ebutton, () => message.ebutton = TrainControlState.EmergentButton.deserialize(reader));
break;
case 2:
reader.readMessage(message.driverKey, () => pb_1.Message.addToRepeatedWrapperField(message, 2, TrainControlState.DriverKeySwitch.deserialize(reader), TrainControlState.DriverKeySwitch));
break;
case 3:
reader.readMessage(message.dirKey, () => message.dirKey = TrainControlState.DirectionKeySwitch.deserialize(reader));
break;
case 4:
reader.readMessage(message.pushHandler, () => message.pushHandler = TrainControlState.PushHandler.deserialize(reader));
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): TrainControlState {
return TrainControlState.deserialize(bytes);
}
}
export namespace TrainControlState {
export class EmergentButton extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
id?: number;
passed?: boolean;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("id" in data && data.id != undefined) {
this.id = data.id;
}
if ("passed" in data && data.passed != undefined) {
this.passed = data.passed;
}
}
}
get id() {
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
}
set id(value: number) {
pb_1.Message.setField(this, 1, value);
}
get passed() {
return pb_1.Message.getFieldWithDefault(this, 3, false) as boolean;
}
set passed(value: boolean) {
pb_1.Message.setField(this, 3, value);
}
static fromObject(data: {
id?: number;
passed?: boolean;
}): EmergentButton {
const message = new EmergentButton({});
if (data.id != null) {
message.id = data.id;
}
if (data.passed != null) {
message.passed = data.passed;
}
return message;
}
toObject() {
const data: {
id?: number;
passed?: boolean;
} = {};
if (this.id != null) {
data.id = this.id;
}
if (this.passed != null) {
data.passed = this.passed;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.id != 0)
writer.writeUint32(1, this.id);
if (this.passed != false)
writer.writeBool(3, this.passed);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): EmergentButton {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new EmergentButton();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.id = reader.readUint32();
break;
case 3:
message.passed = reader.readBool();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): EmergentButton {
return EmergentButton.deserialize(bytes);
}
}
export class DriverKeySwitch extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
id?: number;
val?: boolean;
dt?: dependency_3.request.DriverType;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("id" in data && data.id != undefined) {
this.id = data.id;
}
if ("val" in data && data.val != undefined) {
this.val = data.val;
}
if ("dt" in data && data.dt != undefined) {
this.dt = data.dt;
}
}
}
get id() {
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
}
set id(value: number) {
pb_1.Message.setField(this, 1, value);
}
get val() {
return pb_1.Message.getFieldWithDefault(this, 2, false) as boolean;
}
set val(value: boolean) {
pb_1.Message.setField(this, 2, value);
}
get dt() {
return pb_1.Message.getFieldWithDefault(this, 3, dependency_3.request.DriverType.ONE_END) as dependency_3.request.DriverType;
}
set dt(value: dependency_3.request.DriverType) {
pb_1.Message.setField(this, 3, value);
}
static fromObject(data: {
id?: number;
val?: boolean;
dt?: dependency_3.request.DriverType;
}): DriverKeySwitch {
const message = new DriverKeySwitch({});
if (data.id != null) {
message.id = data.id;
}
if (data.val != null) {
message.val = data.val;
}
if (data.dt != null) {
message.dt = data.dt;
}
return message;
}
toObject() {
const data: {
id?: number;
val?: boolean;
dt?: dependency_3.request.DriverType;
} = {};
if (this.id != null) {
data.id = this.id;
}
if (this.val != null) {
data.val = this.val;
}
if (this.dt != null) {
data.dt = this.dt;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.id != 0)
writer.writeUint32(1, this.id);
if (this.val != false)
writer.writeBool(2, this.val);
if (this.dt != dependency_3.request.DriverType.ONE_END)
writer.writeEnum(3, this.dt);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): DriverKeySwitch {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new DriverKeySwitch();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.id = reader.readUint32();
break;
case 2:
message.val = reader.readBool();
break;
case 3:
message.dt = reader.readEnum();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): DriverKeySwitch {
return DriverKeySwitch.deserialize(bytes);
}
}
export class DirectionKeySwitch extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
id?: number;
val?: number;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("id" in data && data.id != undefined) {
this.id = data.id;
}
if ("val" in data && data.val != undefined) {
this.val = data.val;
}
}
}
get id() {
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
}
set id(value: number) {
pb_1.Message.setField(this, 1, value);
}
get val() {
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
}
set val(value: number) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: {
id?: number;
val?: number;
}): DirectionKeySwitch {
const message = new DirectionKeySwitch({});
if (data.id != null) {
message.id = data.id;
}
if (data.val != null) {
message.val = data.val;
}
return message;
}
toObject() {
const data: {
id?: number;
val?: number;
} = {};
if (this.id != null) {
data.id = this.id;
}
if (this.val != null) {
data.val = this.val;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.id != 0)
writer.writeUint32(1, this.id);
if (this.val != 0)
writer.writeUint32(2, this.val);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): DirectionKeySwitch {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new DirectionKeySwitch();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.id = reader.readUint32();
break;
case 2:
message.val = reader.readUint32();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): DirectionKeySwitch {
return DirectionKeySwitch.deserialize(bytes);
}
}
export class PushHandler extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
id?: number;
val?: number;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("id" in data && data.id != undefined) {
this.id = data.id;
}
if ("val" in data && data.val != undefined) {
this.val = data.val;
}
}
}
get id() {
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
}
set id(value: number) {
pb_1.Message.setField(this, 1, value);
}
get val() {
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
}
set val(value: number) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: {
id?: number;
val?: number;
}): PushHandler {
const message = new PushHandler({});
if (data.id != null) {
message.id = data.id;
}
if (data.val != null) {
message.val = data.val;
}
return message;
}
toObject() {
const data: {
id?: number;
val?: number;
} = {};
if (this.id != null) {
data.id = this.id;
}
if (this.val != null) {
data.val = this.val;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.id != 0)
writer.writeUint32(1, this.id);
if (this.val != 0)
writer.writeInt32(2, this.val);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): PushHandler {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new PushHandler();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.id = reader.readUint32();
break;
case 2:
message.val = reader.readInt32();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): PushHandler {
return PushHandler.deserialize(bytes);
}
}
}
}

View File

@ -5,6 +5,10 @@
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as pb_1 from "google-protobuf";
export namespace request {
export enum DriverType {
ONE_END = 0,
TWO_END = 1
}
export class Relay extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {}) {
@ -1414,4 +1418,543 @@ export namespace request {
return PsdParam.deserialize(bytes);
}
}
export class TrainControl extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
simulationId?: string;
trainId?: number;
deviceId?: number;
controlType?: TrainControl.TrainControlType;
button?: TrainControl.EmergentButton;
driverKey?: TrainControl.DriverKeySwitch;
dirKey?: TrainControl.DirectionKeySwitch;
handler?: TrainControl.PushHandler;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("simulationId" in data && data.simulationId != undefined) {
this.simulationId = data.simulationId;
}
if ("trainId" in data && data.trainId != undefined) {
this.trainId = data.trainId;
}
if ("deviceId" in data && data.deviceId != undefined) {
this.deviceId = data.deviceId;
}
if ("controlType" in data && data.controlType != undefined) {
this.controlType = data.controlType;
}
if ("button" in data && data.button != undefined) {
this.button = data.button;
}
if ("driverKey" in data && data.driverKey != undefined) {
this.driverKey = data.driverKey;
}
if ("dirKey" in data && data.dirKey != undefined) {
this.dirKey = data.dirKey;
}
if ("handler" in data && data.handler != undefined) {
this.handler = data.handler;
}
}
}
get simulationId() {
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
}
set simulationId(value: string) {
pb_1.Message.setField(this, 1, value);
}
get trainId() {
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
}
set trainId(value: number) {
pb_1.Message.setField(this, 2, value);
}
get deviceId() {
return pb_1.Message.getFieldWithDefault(this, 3, 0) as number;
}
set deviceId(value: number) {
pb_1.Message.setField(this, 3, value);
}
get controlType() {
return pb_1.Message.getFieldWithDefault(this, 4, TrainControl.TrainControlType.EMERGENT_BUTTON) as TrainControl.TrainControlType;
}
set controlType(value: TrainControl.TrainControlType) {
pb_1.Message.setField(this, 4, value);
}
get button() {
return pb_1.Message.getWrapperField(this, TrainControl.EmergentButton, 5) as TrainControl.EmergentButton;
}
set button(value: TrainControl.EmergentButton) {
pb_1.Message.setWrapperField(this, 5, value);
}
get has_button() {
return pb_1.Message.getField(this, 5) != null;
}
get driverKey() {
return pb_1.Message.getWrapperField(this, TrainControl.DriverKeySwitch, 6) as TrainControl.DriverKeySwitch;
}
set driverKey(value: TrainControl.DriverKeySwitch) {
pb_1.Message.setWrapperField(this, 6, value);
}
get has_driverKey() {
return pb_1.Message.getField(this, 6) != null;
}
get dirKey() {
return pb_1.Message.getWrapperField(this, TrainControl.DirectionKeySwitch, 7) as TrainControl.DirectionKeySwitch;
}
set dirKey(value: TrainControl.DirectionKeySwitch) {
pb_1.Message.setWrapperField(this, 7, value);
}
get has_dirKey() {
return pb_1.Message.getField(this, 7) != null;
}
get handler() {
return pb_1.Message.getWrapperField(this, TrainControl.PushHandler, 8) as TrainControl.PushHandler;
}
set handler(value: TrainControl.PushHandler) {
pb_1.Message.setWrapperField(this, 8, value);
}
get has_handler() {
return pb_1.Message.getField(this, 8) != null;
}
static fromObject(data: {
simulationId?: string;
trainId?: number;
deviceId?: number;
controlType?: TrainControl.TrainControlType;
button?: ReturnType<typeof TrainControl.EmergentButton.prototype.toObject>;
driverKey?: ReturnType<typeof TrainControl.DriverKeySwitch.prototype.toObject>;
dirKey?: ReturnType<typeof TrainControl.DirectionKeySwitch.prototype.toObject>;
handler?: ReturnType<typeof TrainControl.PushHandler.prototype.toObject>;
}): TrainControl {
const message = new TrainControl({});
if (data.simulationId != null) {
message.simulationId = data.simulationId;
}
if (data.trainId != null) {
message.trainId = data.trainId;
}
if (data.deviceId != null) {
message.deviceId = data.deviceId;
}
if (data.controlType != null) {
message.controlType = data.controlType;
}
if (data.button != null) {
message.button = TrainControl.EmergentButton.fromObject(data.button);
}
if (data.driverKey != null) {
message.driverKey = TrainControl.DriverKeySwitch.fromObject(data.driverKey);
}
if (data.dirKey != null) {
message.dirKey = TrainControl.DirectionKeySwitch.fromObject(data.dirKey);
}
if (data.handler != null) {
message.handler = TrainControl.PushHandler.fromObject(data.handler);
}
return message;
}
toObject() {
const data: {
simulationId?: string;
trainId?: number;
deviceId?: number;
controlType?: TrainControl.TrainControlType;
button?: ReturnType<typeof TrainControl.EmergentButton.prototype.toObject>;
driverKey?: ReturnType<typeof TrainControl.DriverKeySwitch.prototype.toObject>;
dirKey?: ReturnType<typeof TrainControl.DirectionKeySwitch.prototype.toObject>;
handler?: ReturnType<typeof TrainControl.PushHandler.prototype.toObject>;
} = {};
if (this.simulationId != null) {
data.simulationId = this.simulationId;
}
if (this.trainId != null) {
data.trainId = this.trainId;
}
if (this.deviceId != null) {
data.deviceId = this.deviceId;
}
if (this.controlType != null) {
data.controlType = this.controlType;
}
if (this.button != null) {
data.button = this.button.toObject();
}
if (this.driverKey != null) {
data.driverKey = this.driverKey.toObject();
}
if (this.dirKey != null) {
data.dirKey = this.dirKey.toObject();
}
if (this.handler != null) {
data.handler = this.handler.toObject();
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.simulationId.length)
writer.writeString(1, this.simulationId);
if (this.trainId != 0)
writer.writeUint32(2, this.trainId);
if (this.deviceId != 0)
writer.writeUint32(3, this.deviceId);
if (this.controlType != TrainControl.TrainControlType.EMERGENT_BUTTON)
writer.writeEnum(4, this.controlType);
if (this.has_button)
writer.writeMessage(5, this.button, () => this.button.serialize(writer));
if (this.has_driverKey)
writer.writeMessage(6, this.driverKey, () => this.driverKey.serialize(writer));
if (this.has_dirKey)
writer.writeMessage(7, this.dirKey, () => this.dirKey.serialize(writer));
if (this.has_handler)
writer.writeMessage(8, this.handler, () => this.handler.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): TrainControl {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new TrainControl();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.simulationId = reader.readString();
break;
case 2:
message.trainId = reader.readUint32();
break;
case 3:
message.deviceId = reader.readUint32();
break;
case 4:
message.controlType = reader.readEnum();
break;
case 5:
reader.readMessage(message.button, () => message.button = TrainControl.EmergentButton.deserialize(reader));
break;
case 6:
reader.readMessage(message.driverKey, () => message.driverKey = TrainControl.DriverKeySwitch.deserialize(reader));
break;
case 7:
reader.readMessage(message.dirKey, () => message.dirKey = TrainControl.DirectionKeySwitch.deserialize(reader));
break;
case 8:
reader.readMessage(message.handler, () => message.handler = TrainControl.PushHandler.deserialize(reader));
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): TrainControl {
return TrainControl.deserialize(bytes);
}
}
export namespace TrainControl {
export enum TrainControlType {
EMERGENT_BUTTON = 0,
DRIVER_KEY_SWITCH = 1,
DIRECTION_KEY_SWITCH = 2,
HANDLER = 3
}
export class EmergentButton extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
active?: boolean;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("active" in data && data.active != undefined) {
this.active = data.active;
}
}
}
get active() {
return pb_1.Message.getFieldWithDefault(this, 1, false) as boolean;
}
set active(value: boolean) {
pb_1.Message.setField(this, 1, value);
}
static fromObject(data: {
active?: boolean;
}): EmergentButton {
const message = new EmergentButton({});
if (data.active != null) {
message.active = data.active;
}
return message;
}
toObject() {
const data: {
active?: boolean;
} = {};
if (this.active != null) {
data.active = this.active;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.active != false)
writer.writeBool(1, this.active);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): EmergentButton {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new EmergentButton();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.active = reader.readBool();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): EmergentButton {
return EmergentButton.deserialize(bytes);
}
}
export class DriverKeySwitch extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
val?: boolean;
dt?: DriverType;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("val" in data && data.val != undefined) {
this.val = data.val;
}
if ("dt" in data && data.dt != undefined) {
this.dt = data.dt;
}
}
}
get val() {
return pb_1.Message.getFieldWithDefault(this, 1, false) as boolean;
}
set val(value: boolean) {
pb_1.Message.setField(this, 1, value);
}
get dt() {
return pb_1.Message.getFieldWithDefault(this, 2, DriverType.ONE_END) as DriverType;
}
set dt(value: DriverType) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: {
val?: boolean;
dt?: DriverType;
}): DriverKeySwitch {
const message = new DriverKeySwitch({});
if (data.val != null) {
message.val = data.val;
}
if (data.dt != null) {
message.dt = data.dt;
}
return message;
}
toObject() {
const data: {
val?: boolean;
dt?: DriverType;
} = {};
if (this.val != null) {
data.val = this.val;
}
if (this.dt != null) {
data.dt = this.dt;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.val != false)
writer.writeBool(1, this.val);
if (this.dt != DriverType.ONE_END)
writer.writeEnum(2, this.dt);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): DriverKeySwitch {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new DriverKeySwitch();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.val = reader.readBool();
break;
case 2:
message.dt = reader.readEnum();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): DriverKeySwitch {
return DriverKeySwitch.deserialize(bytes);
}
}
export class DirectionKeySwitch extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
val?: number;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("val" in data && data.val != undefined) {
this.val = data.val;
}
}
}
get val() {
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
}
set val(value: number) {
pb_1.Message.setField(this, 1, value);
}
static fromObject(data: {
val?: number;
}): DirectionKeySwitch {
const message = new DirectionKeySwitch({});
if (data.val != null) {
message.val = data.val;
}
return message;
}
toObject() {
const data: {
val?: number;
} = {};
if (this.val != null) {
data.val = this.val;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.val != 0)
writer.writeUint32(1, this.val);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): DirectionKeySwitch {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new DirectionKeySwitch();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.val = reader.readUint32();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): DirectionKeySwitch {
return DirectionKeySwitch.deserialize(bytes);
}
}
export class PushHandler extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
val?: number;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("val" in data && data.val != undefined) {
this.val = data.val;
}
}
}
get val() {
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
}
set val(value: number) {
pb_1.Message.setField(this, 1, value);
}
static fromObject(data: {
val?: number;
}): PushHandler {
const message = new PushHandler({});
if (data.val != null) {
message.val = data.val;
}
return message;
}
toObject() {
const data: {
val?: number;
} = {};
if (this.val != null) {
data.val = this.val;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.val != 0)
writer.writeInt32(1, this.val);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): PushHandler {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new PushHandler();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.val = reader.readInt32();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): PushHandler {
return PushHandler.deserialize(bytes);
}
}
}
}

View File

@ -9837,6 +9837,7 @@ export namespace graphicData {
totalLength?: number;
trainSets?: string;
dynamicConfig?: dependency_1.common.TrainDynamicConfig;
trainControlMapId?: number;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -9856,6 +9857,9 @@ export namespace graphicData {
if ("dynamicConfig" in data && data.dynamicConfig != undefined) {
this.dynamicConfig = data.dynamicConfig;
}
if ("trainControlMapId" in data && data.trainControlMapId != undefined) {
this.trainControlMapId = data.trainControlMapId;
}
}
}
get trainModel() {
@ -9891,12 +9895,19 @@ export namespace graphicData {
get has_dynamicConfig() {
return pb_1.Message.getField(this, 7) != null;
}
get trainControlMapId() {
return pb_1.Message.getFieldWithDefault(this, 9, 0) as number;
}
set trainControlMapId(value: number) {
pb_1.Message.setField(this, 9, value);
}
static fromObject(data: {
trainModel?: Train.TrainModel;
carriageLength?: number;
totalLength?: number;
trainSets?: string;
dynamicConfig?: ReturnType<typeof dependency_1.common.TrainDynamicConfig.prototype.toObject>;
trainControlMapId?: number;
}): Train {
const message = new Train({});
if (data.trainModel != null) {
@ -9914,6 +9925,9 @@ export namespace graphicData {
if (data.dynamicConfig != null) {
message.dynamicConfig = dependency_1.common.TrainDynamicConfig.fromObject(data.dynamicConfig);
}
if (data.trainControlMapId != null) {
message.trainControlMapId = data.trainControlMapId;
}
return message;
}
toObject() {
@ -9923,6 +9937,7 @@ export namespace graphicData {
totalLength?: number;
trainSets?: string;
dynamicConfig?: ReturnType<typeof dependency_1.common.TrainDynamicConfig.prototype.toObject>;
trainControlMapId?: number;
} = {};
if (this.trainModel != null) {
data.trainModel = this.trainModel;
@ -9939,6 +9954,9 @@ export namespace graphicData {
if (this.dynamicConfig != null) {
data.dynamicConfig = this.dynamicConfig.toObject();
}
if (this.trainControlMapId != null) {
data.trainControlMapId = this.trainControlMapId;
}
return data;
}
serialize(): Uint8Array;
@ -9955,6 +9973,8 @@ export namespace graphicData {
writer.writeString(6, this.trainSets);
if (this.has_dynamicConfig)
writer.writeMessage(7, this.dynamicConfig, () => this.dynamicConfig.serialize(writer));
if (this.trainControlMapId != 0)
writer.writeInt32(9, this.trainControlMapId);
if (!w)
return writer.getResultBuffer();
}
@ -9979,6 +9999,9 @@ export namespace graphicData {
case 7:
reader.readMessage(message.dynamicConfig, () => message.dynamicConfig = dependency_1.common.TrainDynamicConfig.deserialize(reader));
break;
case 9:
message.trainControlMapId = reader.readInt32();
break;
default: reader.skipField();
}
}

View File

@ -4,7 +4,7 @@ import { getLineApp } from 'src/drawApp/lineApp';
export const useTccStore = defineStore('tcc', {
state: () => ({
tccMapCode: '',
trainControlMapId: 0,
tccId: 0,
isTccDialogOpen: false,
}),
@ -19,14 +19,14 @@ export const useTccStore = defineStore('tcc', {
return tccScene;
}
},
setTccParam(tccId: number, tccMapCode: string) {
setTccParam(tccId: number, trainControlMapId: number) {
this.tccId = tccId;
this.tccMapCode = tccMapCode;
this.trainControlMapId = trainControlMapId;
this.isTccDialogOpen = true;
},
clearTccParam() {
this.tccId = 0;
this.tccMapCode = '';
this.trainControlMapId = 0;
this.isTccDialogOpen = false;
},
},