Merge branch 'master' of https://git.code.tencent.com/beijing-rtss-test/bj-rtss-client
This commit is contained in:
commit
98a128a4dd
@ -1,6 +1,6 @@
|
||||
import { api } from 'src/boot/axios';
|
||||
import { request } from 'src/protos/request';
|
||||
import { TrainConfigData } from './TrainModelApi'
|
||||
import { TrainConfigData } from './TrainModelApi';
|
||||
|
||||
const UriBase = '/api/v1/simulation';
|
||||
|
||||
@ -39,12 +39,16 @@ export interface TrainEnd {
|
||||
* @param devicePort 道岔的端口
|
||||
* @param headOffset 偏移量(区段从A端为偏移原点,道岔从岔芯为偏移原点)
|
||||
* @param trainLength 列车总长
|
||||
* @param trainId 列车编号
|
||||
* @param trainSpeed 列车初始速度
|
||||
*/
|
||||
export async function addTrain(data: {
|
||||
simulationId: string;
|
||||
mapId: number;
|
||||
up: boolean;
|
||||
id: number;
|
||||
trainId: number;
|
||||
trainSpeed: number;
|
||||
devicePort?: string;
|
||||
headOffset: number;
|
||||
trainLength?: number;
|
||||
@ -87,6 +91,17 @@ export async function removeTrain(data: {
|
||||
return response.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除所有列车
|
||||
*/
|
||||
export async function removeAllTrain(data: {
|
||||
simulationId: string;
|
||||
mapId: number;
|
||||
}) {
|
||||
const response = await api.post(`${UriBase}/train/remove/all`, data);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export async function setAxleSectionState(data: {
|
||||
simulationId: string;
|
||||
mapId: number;
|
||||
@ -113,8 +128,8 @@ export interface SignalOperationReq {
|
||||
deviceId: number;
|
||||
operation: request.Signal.Operation;
|
||||
param: {
|
||||
force: request.Signal.Force,
|
||||
dsList: request.Signal.DS[]
|
||||
force: request.Signal.Force;
|
||||
dsList: request.Signal.DS[];
|
||||
};
|
||||
}
|
||||
export async function setSignalState(data: SignalOperationReq) {
|
||||
@ -167,6 +182,21 @@ export async function ibpKeyOperation(params: IbpKeyOperationParams) {
|
||||
return await api.post(`${UriBase}/ibp/key/operation`, params);
|
||||
}
|
||||
|
||||
export interface BypassOperationParams {
|
||||
simulationId: string;
|
||||
mapId: number;
|
||||
deviceId: number;
|
||||
deviceCode: string;
|
||||
stationId?: number;
|
||||
gateBoxId?: number;
|
||||
operation: request.BypassOperationReq.Operation;
|
||||
btnType: request.BypassOperationReq.BtnType;
|
||||
}
|
||||
|
||||
export async function bypassOperation(params: BypassOperationParams) {
|
||||
return await api.post(`${UriBase}/bypass/operation`, params);
|
||||
}
|
||||
|
||||
export function checkMapData(data: { mapProto: string }) {
|
||||
return api.post(`${UriBase}/check/data`, data);
|
||||
}
|
||||
@ -359,21 +389,21 @@ export interface TrainConfig {
|
||||
idlingA: number;
|
||||
idlingR: number;
|
||||
idlingD: number;
|
||||
},
|
||||
};
|
||||
trainEndsA: {
|
||||
radarCheckSpeedDiff: number;
|
||||
radarCheckTime: number;
|
||||
radarEnable: boolean;
|
||||
speedSensorEnableA: boolean;
|
||||
speedSensorEnableB: boolean;
|
||||
},
|
||||
};
|
||||
trainEndsB: {
|
||||
radarCheckSpeedDiff: number;
|
||||
radarCheckTime: number;
|
||||
radarEnable: boolean;
|
||||
speedSensorEnableA: boolean;
|
||||
speedSensorEnableB: boolean;
|
||||
},
|
||||
};
|
||||
}
|
||||
/** 列车参数修改 */
|
||||
export async function updateTrainConfig(data: TrainConfig) {
|
||||
|
@ -16,6 +16,21 @@
|
||||
:label="props.dev.type"
|
||||
v-model="props.dev.id"
|
||||
/>
|
||||
<q-input
|
||||
type="number"
|
||||
outlined
|
||||
label="列车编号"
|
||||
v-model.number="trainId"
|
||||
lazy-rules
|
||||
/>
|
||||
<q-input
|
||||
type="number"
|
||||
outlined
|
||||
label="列车初始速度(km/h)"
|
||||
:min="0"
|
||||
v-model.number="trainSpeed"
|
||||
lazy-rules
|
||||
/>
|
||||
<q-input
|
||||
type="number"
|
||||
outlined
|
||||
@ -113,6 +128,8 @@ const dirOptions = [
|
||||
{ label: '上行', value: 1 },
|
||||
{ label: '下行', value: 0 },
|
||||
];
|
||||
const trainSpeed = ref(0);
|
||||
const trainId = ref(1);
|
||||
|
||||
const showAddTrainOperation = ref(true);
|
||||
|
||||
@ -141,6 +158,8 @@ function onCreate() {
|
||||
up: !!dir.value,
|
||||
id: props.dev.datas.id,
|
||||
headOffset: offset.value,
|
||||
trainId: trainId.value,
|
||||
trainSpeed: trainSpeed.value,
|
||||
wheelDiameter: wheelDiameter.value,
|
||||
trainLength: trainConfig.value.total_length,
|
||||
configTrain: trainConfig.value.trainConfigData as TrainConfigData,
|
||||
|
@ -18,6 +18,14 @@
|
||||
@update:model-value="onUpdate"
|
||||
label="关联站台"
|
||||
></q-select>
|
||||
<q-select
|
||||
outlined
|
||||
class="q-mt-sm"
|
||||
@blur="onUpdate"
|
||||
v-model="esbButtonModel.refEsbButtonMapCode"
|
||||
:options="pslNameList"
|
||||
label="关联PSL地图"
|
||||
/>
|
||||
</q-form>
|
||||
</template>
|
||||
|
||||
@ -25,8 +33,10 @@
|
||||
import { EsbButtonData } from 'src/drawApp/graphics/EsbButtonInteraction';
|
||||
import { useFormData } from 'src/components/DrawAppFormUtils';
|
||||
import { useDrawStore } from 'src/stores/draw-store';
|
||||
import { onMounted, reactive } from 'vue';
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { Platform } from 'src/graphics/platform/Platform';
|
||||
import { getPublishList } from 'src/api/PublishApi';
|
||||
import { PictureType } from 'src/protos/picture';
|
||||
|
||||
const drawStore = useDrawStore();
|
||||
const platformList: { label: string; value: number }[] = reactive([]);
|
||||
@ -35,8 +45,22 @@ const { data: esbButtonModel, onUpdate } = useFormData(
|
||||
new EsbButtonData(),
|
||||
drawStore.getDrawApp()
|
||||
);
|
||||
const pslNameList = ref<string[]>([]);
|
||||
|
||||
onMounted(() => {
|
||||
const list2: string[] = [];
|
||||
getPublishList({
|
||||
type: PictureType.Psl,
|
||||
category: useDrawStore().categoryType,
|
||||
}).then((pslMapList) => {
|
||||
if (pslMapList && pslMapList.length) {
|
||||
pslMapList.forEach((item) => {
|
||||
list2.push(item.name);
|
||||
});
|
||||
}
|
||||
pslNameList.value = list2;
|
||||
});
|
||||
|
||||
const platforms = drawStore
|
||||
.getDrawApp()
|
||||
.queryStore.queryByType<Platform>(Platform.Type);
|
||||
|
@ -80,7 +80,10 @@
|
||||
</template>
|
||||
</q-select>
|
||||
<q-select
|
||||
v-if="gatedBoxSetProperty.refGatedBoxMapCode"
|
||||
v-if="
|
||||
commonSetProperty.commonRefGatedBoxMapCode ||
|
||||
commonSetProperty.oneDeviceTypeOfPSL
|
||||
"
|
||||
outlined
|
||||
bottom-slots
|
||||
v-model="refGatedBoxMapCode"
|
||||
@ -155,6 +158,10 @@ import {
|
||||
findCommonElements,
|
||||
handleCentralizedStationsData,
|
||||
} from 'src/graphics/concentrationDividingLine/ConcentrationDividingLineUtils';
|
||||
import { EsbButton } from 'src/graphics/esbButton/EsbButton';
|
||||
import { EsbButtonData } from 'src/drawApp/graphics/EsbButtonInteraction';
|
||||
import { ZdwxEsb } from 'src/graphics/esbButton/ZdwxEsb';
|
||||
import { ZdwxEsbData } from 'src/drawApp/graphics/ZdwxEsbInteraction';
|
||||
|
||||
const drawStore = useDrawStore();
|
||||
const $q = useQuasar();
|
||||
@ -196,7 +203,17 @@ const transponderSetProperty = ref<{
|
||||
const gatedBoxSetProperty = ref<{
|
||||
[key: string]: boolean;
|
||||
}>({
|
||||
refGatedBoxMapCode: false,
|
||||
commonRefGatedBoxMapCode: false,
|
||||
});
|
||||
const esbButtonSetProperty = ref<{
|
||||
[key: string]: boolean;
|
||||
}>({
|
||||
commonRefGatedBoxMapCode: false,
|
||||
});
|
||||
const ZdwxEsbSetProperty = ref<{
|
||||
[key: string]: boolean;
|
||||
}>({
|
||||
commonRefGatedBoxMapCode: false,
|
||||
});
|
||||
const screenDoorSetProperty = ref<{
|
||||
[key: string]: boolean;
|
||||
@ -215,6 +232,8 @@ const commonSetProperty = ref<{
|
||||
oneDeviceTypeOfJZZ: false, //多选的是一种设备判断设备是否含有集中站属性——设置公共属性时必须两个同时有且按现有顺序!!!
|
||||
commonCodeEndings: false,
|
||||
oneDeviceTypeOfCCE: false,
|
||||
commonRefGatedBoxMapCode: false, //共同关联的PSL
|
||||
oneDeviceTypeOfPSL: false,
|
||||
});
|
||||
|
||||
const allDeviceProperty = [
|
||||
@ -226,6 +245,8 @@ const allDeviceProperty = [
|
||||
{ type: AxleCounting.Type, setProperty: axleCountingSetProperty }, //集中站
|
||||
{ type: Transponder.Type, setProperty: transponderSetProperty }, //集中站
|
||||
{ type: GatedBox.Type, setProperty: gatedBoxSetProperty }, //关联PSL地图Code
|
||||
{ type: EsbButton.Type, setProperty: esbButtonSetProperty }, //关联PSL地图Code
|
||||
{ type: ZdwxEsb.Type, setProperty: ZdwxEsbSetProperty }, //关联PSL地图Code
|
||||
{ type: ScreenDoor.Type, setProperty: screenDoorSetProperty }, //屏蔽门的编号
|
||||
{ type: Platform.Type, setProperty: platformSetProperty }, //紧急停车继电器的编号
|
||||
];
|
||||
@ -452,15 +473,31 @@ const pslNameList = ref<string[]>([]);
|
||||
function setGatedBoxPslName() {
|
||||
if (refGatedBoxMapCode.value) {
|
||||
$q.dialog({
|
||||
message: `确定批量设置选中门控箱关联的PSL地图为【${refGatedBoxMapCode.value}】吗?`,
|
||||
message: `确定批量设置选中门控箱和紧急关闭按钮关联的PSL地图为【${refGatedBoxMapCode.value}】吗?`,
|
||||
cancel: true,
|
||||
}).onOk(() => {
|
||||
drawStore.selectedGraphics?.forEach((gatedBox) => {
|
||||
drawStore.selectedGraphics?.forEach((device) => {
|
||||
if (device instanceof GatedBox) {
|
||||
const data = new GatedBoxData();
|
||||
data.copyFrom(gatedBox.saveData());
|
||||
data.copyFrom(device.saveData());
|
||||
if (data.refGatedBoxMapCode !== refIbpMapCode.value) {
|
||||
data.refGatedBoxMapCode = refGatedBoxMapCode.value;
|
||||
gatedBox.updateData(data);
|
||||
device.updateData(data);
|
||||
}
|
||||
} else if (device instanceof EsbButton) {
|
||||
const data = new EsbButtonData();
|
||||
data.copyFrom(device.saveData());
|
||||
if (data.refEsbButtonMapCode !== refIbpMapCode.value) {
|
||||
data.refEsbButtonMapCode = refGatedBoxMapCode.value;
|
||||
device.updateData(data);
|
||||
}
|
||||
} else {
|
||||
const data = new ZdwxEsbData();
|
||||
data.copyFrom(device.saveData());
|
||||
if (data.refEsbButtonMapCode !== refIbpMapCode.value) {
|
||||
data.refEsbButtonMapCode = refGatedBoxMapCode.value;
|
||||
device.updateData(data);
|
||||
}
|
||||
}
|
||||
});
|
||||
refGatedBoxMapCode.value = '';
|
||||
|
@ -468,7 +468,6 @@ watch(
|
||||
function getTrainStates(train: Train) {
|
||||
trainInfo.value = null;
|
||||
const s = train.states as ITrainState;
|
||||
console.log(s, '=======');
|
||||
trainInfo.value = s;
|
||||
}
|
||||
|
||||
|
@ -115,6 +115,14 @@ const options = [
|
||||
label: '重置报文',
|
||||
value: TransponderOperation.ResetMessage,
|
||||
},
|
||||
{
|
||||
label: '停止发送报文',
|
||||
value: TransponderOperation.ResetMessage,
|
||||
},
|
||||
{
|
||||
label: '取消停止发送报文',
|
||||
value: TransponderOperation.ResetMessage,
|
||||
},
|
||||
];
|
||||
|
||||
const directionOptions = [
|
||||
|
@ -10,6 +10,7 @@ function getHost(): string {
|
||||
// return '192.168.3.15:9091'; // 张骞
|
||||
// return '192.168.3.93:9091';
|
||||
// return '192.168.3.37:9091'; //卫志宏
|
||||
return 'test.joylink.club/bjrtsts-service'; // 测试
|
||||
return '192.168.3.233:9091';
|
||||
}
|
||||
|
||||
@ -23,7 +24,8 @@ export function getHttpBase() {
|
||||
|
||||
export function getWebsocketUrl() {
|
||||
let protocol = 'ws';
|
||||
let host = '192.168.3.233';
|
||||
// let host = '192.168.3.233';
|
||||
let host = 'test.joylink.club';
|
||||
let port = '8083';
|
||||
let url = `${protocol}://${host}:${port}`;
|
||||
if (process.env.ENV_MODE == 'test') {
|
||||
|
@ -53,6 +53,12 @@ export class EsbButtonData extends GraphicDataBase implements IEsbButtonData {
|
||||
set refStand(v: number) {
|
||||
this.data.refStand = v;
|
||||
}
|
||||
get refEsbButtonMapCode(): string {
|
||||
return this.data.refEsbButtonMapCode;
|
||||
}
|
||||
set refEsbButtonMapCode(v: string) {
|
||||
this.data.refEsbButtonMapCode = v;
|
||||
}
|
||||
clone(): EsbButtonData {
|
||||
return new EsbButtonData(this.data.cloneMessage());
|
||||
}
|
||||
@ -66,7 +72,8 @@ export class EsbButtonData extends GraphicDataBase implements IEsbButtonData {
|
||||
|
||||
export class EsbButtonState
|
||||
extends GraphicStateBase
|
||||
implements IEsbButtonState {
|
||||
implements IEsbButtonState
|
||||
{
|
||||
constructor(data?: state.ButtonState) {
|
||||
let ibpButtonState;
|
||||
if (data) {
|
||||
|
@ -7,13 +7,19 @@ import {
|
||||
} from 'src/graphics/IBPButton/IBPButton';
|
||||
import { ibpGraphicData } from 'src/protos/ibpGraphics';
|
||||
import {
|
||||
ContextMenu,
|
||||
GraphicInteractionPlugin,
|
||||
IGraphicScene,
|
||||
JlGraphic,
|
||||
MenuItemOptions,
|
||||
} from 'jl-graphic';
|
||||
import { FederatedMouseEvent } from 'pixi.js';
|
||||
import { state } from 'src/protos/device_state';
|
||||
import { useIbpStore } from 'src/stores/ibp-store';
|
||||
import { useLineStore } from 'src/stores/line-store';
|
||||
import { bypassOperation } from 'src/api/Simulation';
|
||||
import { request } from 'src/protos/request';
|
||||
import { errorNotify } from 'src/utils/CommonNotify';
|
||||
|
||||
export class IBPButtonData extends GraphicDataBase implements IIBPButtonData {
|
||||
constructor(data?: ibpGraphicData.IBPButton) {
|
||||
@ -67,7 +73,8 @@ export class IBPButtonData extends GraphicDataBase implements IIBPButtonData {
|
||||
|
||||
export class IbpButtonState
|
||||
extends GraphicStateBase
|
||||
implements IIbpButtonState {
|
||||
implements IIbpButtonState
|
||||
{
|
||||
constructor(data?: state.ButtonState) {
|
||||
let ibpButtonState;
|
||||
if (data) {
|
||||
@ -95,6 +102,12 @@ export class IbpButtonState
|
||||
set active(v: boolean) {
|
||||
this.states.active = v;
|
||||
}
|
||||
get bypass(): boolean {
|
||||
return this.states.bypass;
|
||||
}
|
||||
set bypass(v: boolean) {
|
||||
this.states.bypass = v;
|
||||
}
|
||||
clone(): IbpButtonState {
|
||||
return new IbpButtonState(this.states.cloneMessage());
|
||||
}
|
||||
@ -106,11 +119,27 @@ export class IbpButtonState
|
||||
}
|
||||
}
|
||||
|
||||
const bypassConfig: MenuItemOptions = {
|
||||
name: '旁路',
|
||||
};
|
||||
const bypassResetConfig: MenuItemOptions = {
|
||||
name: '旁路复位',
|
||||
};
|
||||
const IbpButtonMenu: ContextMenu = ContextMenu.init({
|
||||
name: 'ibp按钮编辑菜单',
|
||||
groups: [
|
||||
{
|
||||
items: [bypassConfig, bypassResetConfig],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
// IbpScene使用
|
||||
export class IbpButtonInteraction extends GraphicInteractionPlugin<IBPButton> {
|
||||
static Name = 'ibp_button_operate_menu';
|
||||
constructor(app: IGraphicScene) {
|
||||
super(IbpButtonInteraction.Name, app);
|
||||
app.registerMenu(IbpButtonMenu);
|
||||
}
|
||||
static init(app: IGraphicScene) {
|
||||
return new IbpButtonInteraction(app);
|
||||
@ -124,12 +153,14 @@ export class IbpButtonInteraction extends GraphicInteractionPlugin<IBPButton> {
|
||||
g.on('mousedown', this.onMouseDown);
|
||||
g.on('mouseup', this.onMouseUp);
|
||||
g.on('mouseleave', this.onMouseLeave);
|
||||
g.on('_rightclick', this.onContextMenu, this);
|
||||
}
|
||||
unbind(g: IBPButton): void {
|
||||
g.eventMode = 'none';
|
||||
g.off('mousedown', this.onMouseDown);
|
||||
g.off('mouseup', this.onMouseUp);
|
||||
g.off('mouseleave', this.onMouseLeave);
|
||||
g.off('_rightclick', this.onContextMenu, this);
|
||||
}
|
||||
onMouseDown(e: FederatedMouseEvent) {
|
||||
const g = e.target as IBPButton;
|
||||
@ -154,4 +185,45 @@ export class IbpButtonInteraction extends GraphicInteractionPlugin<IBPButton> {
|
||||
changeState(g.datas.id, false);
|
||||
}
|
||||
}
|
||||
onContextMenu(e: FederatedMouseEvent) {
|
||||
const simulationId = useLineStore().simulationId;
|
||||
const mapId = useLineStore().mapId;
|
||||
const stationId = useIbpStore().stationId;
|
||||
const ibpButton = e.target as IBPButton;
|
||||
bypassConfig.handler = () => {
|
||||
if (!simulationId || !mapId) {
|
||||
return;
|
||||
}
|
||||
bypassOperation({
|
||||
simulationId,
|
||||
mapId,
|
||||
deviceId: ibpButton.id,
|
||||
deviceCode: ibpButton.datas.code,
|
||||
stationId,
|
||||
operation: request.BypassOperationReq.Operation.bypass,
|
||||
btnType: request.BypassOperationReq.BtnType.ibp_btn,
|
||||
}).catch((err) => {
|
||||
errorNotify('操作失败', { message: err.origin.response.data.title });
|
||||
});
|
||||
};
|
||||
bypassResetConfig.handler = () => {
|
||||
bypassConfig.handler = () => {
|
||||
if (!simulationId || !mapId) {
|
||||
return;
|
||||
}
|
||||
bypassOperation({
|
||||
simulationId,
|
||||
mapId,
|
||||
deviceId: ibpButton.id,
|
||||
deviceCode: ibpButton.datas.code,
|
||||
stationId,
|
||||
operation: request.BypassOperationReq.Operation.bypass_reset,
|
||||
btnType: request.BypassOperationReq.BtnType.ibp_btn,
|
||||
}).catch((err) => {
|
||||
errorNotify('操作失败', { message: err.origin.response.data.title });
|
||||
});
|
||||
};
|
||||
};
|
||||
IbpButtonMenu.open(e.global);
|
||||
}
|
||||
}
|
||||
|
@ -4,12 +4,18 @@ import { ibpGraphicData } from 'src/protos/ibpGraphics';
|
||||
import { GraphicDataBase, GraphicStateBase } from './GraphicDataBase';
|
||||
import { state } from 'src/protos/device_state';
|
||||
import {
|
||||
ContextMenu,
|
||||
GraphicInteractionPlugin,
|
||||
IGraphicScene,
|
||||
JlGraphic,
|
||||
MenuItemOptions,
|
||||
} from 'jl-graphic';
|
||||
import { type FederatedMouseEvent } from 'pixi.js';
|
||||
import { useIbpStore } from 'src/stores/ibp-store';
|
||||
import { useLineStore } from 'src/stores/line-store';
|
||||
import { bypassOperation } from 'src/api/Simulation';
|
||||
import { request } from 'src/protos/request';
|
||||
import { errorNotify } from 'src/utils/CommonNotify';
|
||||
|
||||
export class IbpKeyData extends GraphicDataBase implements IIbpKeyData {
|
||||
constructor(data?: ibpGraphicData.IbpKey) {
|
||||
@ -67,6 +73,12 @@ export class IbpKeyState extends GraphicStateBase implements IIbpKeyState {
|
||||
set gear(v: number) {
|
||||
this.states.gear = v;
|
||||
}
|
||||
get bypass(): boolean {
|
||||
return this.states.bypass;
|
||||
}
|
||||
set bypass(v: boolean) {
|
||||
this.states.bypass = v;
|
||||
}
|
||||
clone(): IbpKeyState {
|
||||
return new IbpKeyState(this.states.cloneMessage());
|
||||
}
|
||||
@ -78,10 +90,26 @@ export class IbpKeyState extends GraphicStateBase implements IIbpKeyState {
|
||||
}
|
||||
}
|
||||
|
||||
const bypassConfig: MenuItemOptions = {
|
||||
name: '旁路',
|
||||
};
|
||||
const bypassResetConfig: MenuItemOptions = {
|
||||
name: '旁路复位',
|
||||
};
|
||||
const IbpKeyMenu: ContextMenu = ContextMenu.init({
|
||||
name: 'ibp钥匙编辑菜单',
|
||||
groups: [
|
||||
{
|
||||
items: [bypassConfig, bypassResetConfig],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export class IbpKeyInteraction extends GraphicInteractionPlugin<IbpKey> {
|
||||
static Name = 'IbpKeyInteraction';
|
||||
constructor(app: IGraphicScene) {
|
||||
super(IbpKeyInteraction.Name, app);
|
||||
app.registerMenu(IbpKeyMenu);
|
||||
}
|
||||
static init(app: IGraphicScene) {
|
||||
return new IbpKeyInteraction(app);
|
||||
@ -93,14 +121,57 @@ export class IbpKeyInteraction extends GraphicInteractionPlugin<IbpKey> {
|
||||
g.eventMode = 'static';
|
||||
g.cursor = 'pointer';
|
||||
g.on('_leftclick', this.onClick);
|
||||
g.on('_rightclick', this.onContextMenu, this);
|
||||
}
|
||||
unbind(g: IbpKey): void {
|
||||
g.eventMode = 'none';
|
||||
g.off('_leftclick', this.onClick);
|
||||
g.off('_rightclick', this.onContextMenu, this);
|
||||
}
|
||||
onClick(e: FederatedMouseEvent): void {
|
||||
const g = e.target as IbpKey;
|
||||
const changeState = useIbpStore().ibpKeyOperation;
|
||||
changeState(g.datas.id, g.state.gear === 0 ? 1 : 0);
|
||||
}
|
||||
onContextMenu(e: FederatedMouseEvent) {
|
||||
const simulationId = useLineStore().simulationId;
|
||||
const mapId = useLineStore().mapId;
|
||||
const stationId = useIbpStore().stationId;
|
||||
const ibpKey = e.target as IbpKey;
|
||||
bypassConfig.handler = () => {
|
||||
if (!simulationId || !mapId) {
|
||||
return;
|
||||
}
|
||||
bypassOperation({
|
||||
simulationId,
|
||||
mapId,
|
||||
deviceId: ibpKey.id,
|
||||
deviceCode: ibpKey.datas.code,
|
||||
stationId,
|
||||
operation: request.BypassOperationReq.Operation.bypass,
|
||||
btnType: request.BypassOperationReq.BtnType.ibp_key,
|
||||
}).catch((err) => {
|
||||
errorNotify('操作失败', { message: err.origin.response.data.title });
|
||||
});
|
||||
};
|
||||
bypassResetConfig.handler = () => {
|
||||
bypassConfig.handler = () => {
|
||||
if (!simulationId || !mapId) {
|
||||
return;
|
||||
}
|
||||
bypassOperation({
|
||||
simulationId,
|
||||
mapId,
|
||||
deviceId: ibpKey.id,
|
||||
deviceCode: ibpKey.datas.code,
|
||||
stationId,
|
||||
operation: request.BypassOperationReq.Operation.bypass_reset,
|
||||
btnType: request.BypassOperationReq.BtnType.ibp_key,
|
||||
}).catch((err) => {
|
||||
errorNotify('操作失败', { message: err.origin.response.data.title });
|
||||
});
|
||||
};
|
||||
};
|
||||
IbpKeyMenu.open(e.global);
|
||||
}
|
||||
}
|
||||
|
@ -5,18 +5,21 @@ import {
|
||||
PslButton,
|
||||
} from 'src/graphics/pslButton/pslButton';
|
||||
import {
|
||||
ContextMenu,
|
||||
GraphicInteractionPlugin,
|
||||
IGraphicScene,
|
||||
JlGraphic,
|
||||
MenuItemOptions,
|
||||
} from 'jl-graphic';
|
||||
import { pslGraphicData } from 'src/protos/pslGraphics';
|
||||
import { GraphicDataBase, GraphicStateBase } from './GraphicDataBase';
|
||||
import { pslOperate } from 'src/api/Simulation';
|
||||
import { bypassOperation, pslOperate } from 'src/api/Simulation';
|
||||
import { useLineStore } from 'src/stores/line-store';
|
||||
import { DisplayObject, FederatedMouseEvent } from 'pixi.js';
|
||||
import { errorNotify } from 'src/utils/CommonNotify';
|
||||
import { usePslStore } from 'src/stores/psl-store';
|
||||
import { state } from 'src/protos/device_state';
|
||||
import { request } from 'src/protos/request';
|
||||
|
||||
export class PslButtonData extends GraphicDataBase implements IPslButtonData {
|
||||
constructor(data?: pslGraphicData.PslButton) {
|
||||
@ -65,7 +68,8 @@ export class PslButtonData extends GraphicDataBase implements IPslButtonData {
|
||||
}
|
||||
export class PslButtonState
|
||||
extends GraphicStateBase
|
||||
implements IPslButtonState {
|
||||
implements IPslButtonState
|
||||
{
|
||||
constructor(proto?: state.ButtonState) {
|
||||
let states;
|
||||
if (proto) {
|
||||
@ -84,6 +88,12 @@ export class PslButtonState
|
||||
set down(v: boolean) {
|
||||
this.states.down = v;
|
||||
}
|
||||
get bypass(): boolean {
|
||||
return this.states.bypass;
|
||||
}
|
||||
set bypass(v: boolean) {
|
||||
this.states.bypass = v;
|
||||
}
|
||||
get states(): state.ButtonState {
|
||||
return this.getState<state.ButtonState>();
|
||||
}
|
||||
@ -98,10 +108,26 @@ export class PslButtonState
|
||||
}
|
||||
}
|
||||
|
||||
const bypassConfig: MenuItemOptions = {
|
||||
name: '旁路',
|
||||
};
|
||||
const bypassResetConfig: MenuItemOptions = {
|
||||
name: '旁路复位',
|
||||
};
|
||||
const PslButtonMenu: ContextMenu = ContextMenu.init({
|
||||
name: 'Psl按钮编辑菜单',
|
||||
groups: [
|
||||
{
|
||||
items: [bypassConfig, bypassResetConfig],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export class PslButtonOperateInteraction extends GraphicInteractionPlugin<PslButton> {
|
||||
static Name = 'psl_button_operate_menu';
|
||||
constructor(app: IGraphicScene) {
|
||||
super(PslButtonOperateInteraction.Name, app);
|
||||
app.registerMenu(PslButtonMenu);
|
||||
}
|
||||
static init(app: IGraphicScene) {
|
||||
return new PslButtonOperateInteraction(app);
|
||||
@ -117,6 +143,7 @@ export class PslButtonOperateInteraction extends GraphicInteractionPlugin<PslBut
|
||||
g.on('mousedown', this.onMouseDown, this);
|
||||
g.on('mouseup', this.onMouseUp, this);
|
||||
g.on('mouseout', this.onMouseOut, this);
|
||||
g.on('_rightclick', this.onContextMenu, this);
|
||||
}
|
||||
|
||||
unbind(g: PslButton): void {
|
||||
@ -124,6 +151,7 @@ export class PslButtonOperateInteraction extends GraphicInteractionPlugin<PslBut
|
||||
g.off('mousedown', this.onMouseDown, this);
|
||||
g.on('mouseup', this.onMouseUp, this);
|
||||
g.on('mouseout', this.onMouseOut, this);
|
||||
g.off('_rightclick', this.onContextMenu, this);
|
||||
}
|
||||
onMouseOut(e: FederatedMouseEvent) {
|
||||
const target = e.target as DisplayObject;
|
||||
@ -181,4 +209,47 @@ export class PslButtonOperateInteraction extends GraphicInteractionPlugin<PslBut
|
||||
errorNotify('操作失败', { message: err.origin.response.data.title });
|
||||
});
|
||||
}
|
||||
onContextMenu(e: FederatedMouseEvent) {
|
||||
const simulationId = useLineStore().simulationId;
|
||||
const mapId = useLineStore().mapId;
|
||||
const gateBoxId = usePslStore().gatedBoxId;
|
||||
const target = e.target as DisplayObject;
|
||||
const pslButton = target.getGraphic() as PslButton;
|
||||
this.app.updateSelected(pslButton);
|
||||
bypassConfig.handler = () => {
|
||||
if (!simulationId || !mapId) {
|
||||
return;
|
||||
}
|
||||
bypassOperation({
|
||||
simulationId,
|
||||
mapId,
|
||||
deviceId: pslButton.id,
|
||||
deviceCode: pslButton.datas.code,
|
||||
gateBoxId,
|
||||
operation: request.BypassOperationReq.Operation.bypass,
|
||||
btnType: request.BypassOperationReq.BtnType.pls_btn,
|
||||
}).catch((err) => {
|
||||
errorNotify('操作失败', { message: err.origin.response.data.title });
|
||||
});
|
||||
};
|
||||
bypassResetConfig.handler = () => {
|
||||
bypassConfig.handler = () => {
|
||||
if (!simulationId || !mapId) {
|
||||
return;
|
||||
}
|
||||
bypassOperation({
|
||||
simulationId,
|
||||
mapId,
|
||||
deviceId: pslButton.id,
|
||||
deviceCode: pslButton.datas.code,
|
||||
gateBoxId,
|
||||
operation: request.BypassOperationReq.Operation.bypass_reset,
|
||||
btnType: request.BypassOperationReq.BtnType.pls_btn,
|
||||
}).catch((err) => {
|
||||
errorNotify('操作失败', { message: err.origin.response.data.title });
|
||||
});
|
||||
};
|
||||
};
|
||||
PslButtonMenu.open(e.global);
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import { removeTrain } from 'src/api/Simulation';
|
||||
import { useLineStore } from 'src/stores/line-store';
|
||||
import { successNotify, errorNotify } from '../../utils/CommonNotify';
|
||||
import { Dialog } from 'quasar';
|
||||
import SetTrainParam from 'src/components/draw-app/dialogs/SetTrainParam.vue'
|
||||
import SetTrainParam from 'src/components/draw-app/dialogs/SetTrainParam.vue';
|
||||
export class TrainState extends GraphicStateBase implements ITrainState {
|
||||
constructor(proto?: state.TrainMapState) {
|
||||
let states;
|
||||
@ -609,8 +609,8 @@ export class TrainState extends GraphicStateBase implements ITrainState {
|
||||
// name: '列车轮径调整',
|
||||
// };
|
||||
const TrainParam: MenuItemOptions = {
|
||||
name: '设置参数'
|
||||
}
|
||||
name: '设置参数',
|
||||
};
|
||||
const removeTrainConfig: MenuItemOptions = {
|
||||
name: '清除列车',
|
||||
};
|
||||
@ -673,6 +673,11 @@ export class TrainOperateInteraction extends GraphicInteractionPlugin<Train> {
|
||||
});
|
||||
};
|
||||
removeTrainConfig.handler = () => {
|
||||
Dialog.create({
|
||||
title: '确认',
|
||||
message: '确认清除所有列车吗?',
|
||||
cancel: true,
|
||||
}).onOk(async () => {
|
||||
removeTrain({
|
||||
simulationId,
|
||||
mapId,
|
||||
@ -684,6 +689,7 @@ export class TrainOperateInteraction extends GraphicInteractionPlugin<Train> {
|
||||
.catch((err) => {
|
||||
errorNotify('移除列车失败!', err);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
TrainOperateMenu.open(e.global);
|
||||
|
@ -19,7 +19,7 @@ import { FederatedMouseEvent, DisplayObject } from 'pixi.js';
|
||||
import { useLineStore } from 'src/stores/line-store';
|
||||
import { Dialog } from 'quasar';
|
||||
import MoveTranspondere from '../../components/draw-app/dialogs/MoveTransponder.vue';
|
||||
import UpdateMessageTransponder from '../../components/draw-app/dialogs/UpdateMessageTransponder.vue'
|
||||
import UpdateMessageTransponder from '../../components/draw-app/dialogs/UpdateMessageTransponder.vue';
|
||||
import {
|
||||
resetMessageTransponder,
|
||||
resetPositionTransponder,
|
||||
@ -29,7 +29,8 @@ import { state } from 'src/protos/device_state';
|
||||
|
||||
export class TransponderData
|
||||
extends GraphicDataBase
|
||||
implements ITransponderData {
|
||||
implements ITransponderData
|
||||
{
|
||||
constructor(data?: graphicData.Transponder) {
|
||||
let transponder;
|
||||
if (!data) {
|
||||
@ -105,17 +106,28 @@ const movePosition: MenuItemOptions = { name: '移动应答器位置' };
|
||||
const recoverPosition: MenuItemOptions = { name: '复位应答器' };
|
||||
const modifyMessage: MenuItemOptions = { name: '修改报文' };
|
||||
const resetMessage: MenuItemOptions = { name: '重置报文' };
|
||||
// const sendMessage: MenuItemOptions = { name: '发送报文' };
|
||||
const stopSendMessage: MenuItemOptions = { name: '停止发送报文' };
|
||||
const cancelStopSendMessage: MenuItemOptions = { name: '取消停止发送报文' };
|
||||
const TransponderOperationMenu: ContextMenu = ContextMenu.init({
|
||||
name: '应答器操作',
|
||||
groups: [
|
||||
{ items: [movePosition, recoverPosition, modifyMessage, resetMessage] },
|
||||
{
|
||||
items: [
|
||||
movePosition,
|
||||
recoverPosition,
|
||||
modifyMessage,
|
||||
resetMessage,
|
||||
stopSendMessage,
|
||||
cancelStopSendMessage,
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export class TransponderState
|
||||
extends GraphicStateBase
|
||||
implements ITransponderState {
|
||||
implements ITransponderState
|
||||
{
|
||||
constructor(proto?: state.BaliseState) {
|
||||
let states;
|
||||
if (proto) {
|
||||
@ -234,7 +246,7 @@ export class TransponderOperationPlugin extends GraphicInteractionPlugin<Transpo
|
||||
coordinateSystem: transponder.states.km?.coordinateSystem,
|
||||
kilometer: transponder.states.km?.kilometer,
|
||||
direction: transponder.states.km?.direction,
|
||||
id: transponder.datas.id
|
||||
id: transponder.datas.id,
|
||||
},
|
||||
cancel: true,
|
||||
persistent: true,
|
||||
@ -262,7 +274,7 @@ export class TransponderOperationPlugin extends GraphicInteractionPlugin<Transpo
|
||||
id: transponder.datas.id,
|
||||
type: transponder.datas.type,
|
||||
variableTelegram: transponder.states.variableTelegram,
|
||||
variableUserTelegram: transponder.states.variableUserTelegram
|
||||
variableUserTelegram: transponder.states.variableUserTelegram,
|
||||
},
|
||||
cancel: true,
|
||||
persistent: true,
|
||||
|
@ -53,6 +53,12 @@ export class ZdwxEsbData extends GraphicDataBase implements IZdwxEsbData {
|
||||
set refStand(v: number) {
|
||||
this.data.refStand = v;
|
||||
}
|
||||
get refEsbButtonMapCode(): string {
|
||||
return this.data.refEsbButtonMapCode;
|
||||
}
|
||||
set refEsbButtonMapCode(v: string) {
|
||||
this.data.refEsbButtonMapCode = v;
|
||||
}
|
||||
clone(): ZdwxEsbData {
|
||||
return new ZdwxEsbData(this.data.cloneMessage());
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ import {
|
||||
} from './graphics/SectionLinkInteraction';
|
||||
import { AxleCountingSectionData } from './graphics/AxleCountingSectionInteraction';
|
||||
import { LogicSectionData } from './graphics/LogicSectionInteraction';
|
||||
import { Notify, QNotifyUpdateOptions } from 'quasar';
|
||||
import { Notify, QNotifyUpdateOptions, Dialog } from 'quasar';
|
||||
import {
|
||||
StopPosition,
|
||||
StopPositionTemplate,
|
||||
@ -158,7 +158,9 @@ import {
|
||||
AutoReturnBoxOperationInteraction,
|
||||
AutoReturnBoxState,
|
||||
} from './graphics/AutoReturnBoxInteraction';
|
||||
import { errorNotify } from 'src/utils/CommonNotify';
|
||||
import { errorNotify, successNotify } from 'src/utils/CommonNotify';
|
||||
import { removeAllTrain } from 'src/api/Simulation';
|
||||
import { ApiError } from 'src/boot/axios';
|
||||
|
||||
const showOptions: MenuItemOptions = {
|
||||
name: '显示控制',
|
||||
@ -167,17 +169,26 @@ const initTranspondersOptions: MenuItemOptions = {
|
||||
name: '应答器一键恢复',
|
||||
};
|
||||
const searchDeviceOptions: MenuItemOptions = {
|
||||
name: '设备检索'
|
||||
name: '设备检索',
|
||||
};
|
||||
const searchTrainOptions: MenuItemOptions = {
|
||||
name: '列车检索'
|
||||
}
|
||||
name: '列车检索',
|
||||
};
|
||||
const clearAllTrainOptions: MenuItemOptions = {
|
||||
name: '清除所有列车',
|
||||
};
|
||||
|
||||
const DefaultCanvasMenu = new ContextMenu({
|
||||
name: '图层选择',
|
||||
groups: [
|
||||
{
|
||||
items: [showOptions, initTranspondersOptions, searchDeviceOptions, searchTrainOptions],
|
||||
items: [
|
||||
showOptions,
|
||||
initTranspondersOptions,
|
||||
searchDeviceOptions,
|
||||
searchTrainOptions,
|
||||
clearAllTrainOptions,
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
@ -314,6 +325,27 @@ export function initLineScene(lineApp: IGraphicApp, sceneName: string) {
|
||||
searchTrainOptions.handler = () => {
|
||||
lineStore.setShowTrainSearch(true);
|
||||
};
|
||||
clearAllTrainOptions.handler = () => {
|
||||
if (!lineStore.simulationId) {
|
||||
return;
|
||||
}
|
||||
Dialog.create({
|
||||
title: '确认',
|
||||
message: '确认清除所有列车吗?',
|
||||
cancel: true,
|
||||
}).onOk(async () => {
|
||||
try {
|
||||
await removeAllTrain({
|
||||
simulationId: lineStore.simulationId || '',
|
||||
mapId: lineStore.mapId || 0,
|
||||
});
|
||||
successNotify('清除所有列车成功!');
|
||||
} catch (err) {
|
||||
const error = err as ApiError;
|
||||
errorNotify('清除所有列车失败!', error.title);
|
||||
}
|
||||
});
|
||||
};
|
||||
DefaultCanvasMenu.open(e.global);
|
||||
});
|
||||
lineScene.on('postdataloaded', () => {
|
||||
|
@ -3,11 +3,20 @@ import {
|
||||
GraphicState,
|
||||
JlGraphic,
|
||||
JlGraphicTemplate,
|
||||
getRectangleCenter,
|
||||
} from 'jl-graphic';
|
||||
import { ibpGraphicData } from 'src/protos/ibpGraphics';
|
||||
import IPBButtonAssets from './ibpButton.png';
|
||||
import IBPButtonJSON from './ibpButton.json';
|
||||
import { Assets, Sprite, Spritesheet, Texture } from 'pixi.js';
|
||||
import {
|
||||
Assets,
|
||||
Sprite,
|
||||
Spritesheet,
|
||||
Texture,
|
||||
Rectangle,
|
||||
Graphics,
|
||||
Color,
|
||||
} from 'pixi.js';
|
||||
|
||||
export interface IIBPButtonData extends GraphicData {
|
||||
get code(): string;
|
||||
@ -26,12 +35,22 @@ export interface IIbpButtonState extends GraphicState {
|
||||
set down(v: boolean);
|
||||
get active(): boolean;
|
||||
set active(v: boolean);
|
||||
get bypass(): boolean;
|
||||
set bypass(v: boolean);
|
||||
}
|
||||
|
||||
const ibpButtonConsts = {
|
||||
width: 100,
|
||||
height: 110,
|
||||
lineWidth: 3,
|
||||
redColor: '0xff0000',
|
||||
};
|
||||
|
||||
export class IBPButton extends JlGraphic {
|
||||
static Type = 'IBPButton';
|
||||
textures: IBPButtonTextures;
|
||||
sprite: Sprite;
|
||||
rectGraphic: Graphics;
|
||||
|
||||
constructor(textures: IBPButtonTextures) {
|
||||
super(IBPButton.Type);
|
||||
@ -43,7 +62,10 @@ export class IBPButton extends JlGraphic {
|
||||
false
|
||||
);
|
||||
this.sprite.anchor.set(0.5);
|
||||
this.rectGraphic = new Graphics();
|
||||
this.addChild(this.sprite);
|
||||
this.addChild(this.rectGraphic);
|
||||
this.drawRectBypass();
|
||||
}
|
||||
get code(): string {
|
||||
return this.datas.code;
|
||||
@ -61,6 +83,16 @@ export class IBPButton extends JlGraphic {
|
||||
this.state.down,
|
||||
this.datas.hasLight && this.state.active
|
||||
);
|
||||
this.rectGraphic.visible = this.state.bypass ? true : false;
|
||||
}
|
||||
drawRectBypass() {
|
||||
this.rectGraphic
|
||||
.clear()
|
||||
.lineStyle(ibpButtonConsts.lineWidth, new Color(ibpButtonConsts.redColor))
|
||||
.drawRect(0, 0, ibpButtonConsts.width, ibpButtonConsts.height);
|
||||
this.rectGraphic.pivot = getRectangleCenter(
|
||||
new Rectangle(0, 0, ibpButtonConsts.width, ibpButtonConsts.height)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,8 @@ export interface IEsbButtonData extends GraphicData {
|
||||
set flip(v: boolean);
|
||||
get refStand(): number;
|
||||
set refStand(v: number);
|
||||
get refEsbButtonMapCode(): string;
|
||||
set refEsbButtonMapCode(v: string);
|
||||
clone(): IEsbButtonData;
|
||||
copyFrom(data: IEsbButtonData): void;
|
||||
eq(other: IEsbButtonData): boolean;
|
||||
|
@ -14,6 +14,8 @@ export interface IZdwxEsbData extends GraphicData {
|
||||
set flip(v: boolean);
|
||||
get refStand(): number;
|
||||
set refStand(v: number);
|
||||
get refEsbButtonMapCode(): string;
|
||||
set refEsbButtonMapCode(v: string);
|
||||
clone(): IZdwxEsbData;
|
||||
copyFrom(data: IZdwxEsbData): void;
|
||||
eq(other: IZdwxEsbData): boolean;
|
||||
|
@ -3,11 +3,20 @@ import {
|
||||
GraphicState,
|
||||
JlGraphic,
|
||||
JlGraphicTemplate,
|
||||
getRectangleCenter,
|
||||
} from 'jl-graphic';
|
||||
import Ibp_Key_Assets from './ibp-key-spritesheet.png';
|
||||
import Ibp_Key_JSON from './ibp-key-data.json';
|
||||
|
||||
import { Assets, Sprite, Spritesheet, Texture } from 'pixi.js';
|
||||
import {
|
||||
Assets,
|
||||
Sprite,
|
||||
Spritesheet,
|
||||
Texture,
|
||||
Rectangle,
|
||||
Graphics,
|
||||
Color,
|
||||
} from 'pixi.js';
|
||||
|
||||
interface IbpKeyTextures {
|
||||
ibpKey: Texture;
|
||||
@ -21,12 +30,22 @@ export interface IIbpKeyData extends GraphicData {
|
||||
export interface IIbpKeyState extends GraphicState {
|
||||
get gear(): number;
|
||||
set gear(v: number);
|
||||
get bypass(): boolean;
|
||||
set bypass(v: boolean);
|
||||
}
|
||||
|
||||
const ibpKeyConsts = {
|
||||
width: 50,
|
||||
height: 50,
|
||||
lineWidth: 2,
|
||||
redColor: '0xff0000',
|
||||
};
|
||||
|
||||
export class IbpKey extends JlGraphic {
|
||||
static Type = 'IbpKey';
|
||||
_ibpKey: Sprite;
|
||||
ibpKeyTextures: IbpKeyTextures;
|
||||
rectGraphic: Graphics;
|
||||
__state = 0;
|
||||
|
||||
constructor(ibpKeyTextures: IbpKeyTextures) {
|
||||
@ -35,7 +54,10 @@ export class IbpKey extends JlGraphic {
|
||||
this._ibpKey = new Sprite();
|
||||
this._ibpKey.texture = this.ibpKeyTextures.ibpKey;
|
||||
this._ibpKey.anchor.set(0.5);
|
||||
this.rectGraphic = new Graphics();
|
||||
this.addChild(this._ibpKey);
|
||||
this.addChild(this.rectGraphic);
|
||||
this.drawRectBypass();
|
||||
}
|
||||
get code(): string {
|
||||
return this.datas.code;
|
||||
@ -49,6 +71,17 @@ export class IbpKey extends JlGraphic {
|
||||
doRepaint(): void {
|
||||
this._ibpKey.rotation = (-Math.PI / 2) * this.state.gear;
|
||||
this._ibpKey.texture = this.ibpKeyTextures.ibpKey;
|
||||
this.rectGraphic.visible = this.state.bypass ? true : false;
|
||||
}
|
||||
drawRectBypass() {
|
||||
this.rectGraphic
|
||||
.clear()
|
||||
.lineStyle(ibpKeyConsts.lineWidth, new Color(ibpKeyConsts.redColor))
|
||||
.drawRect(0, 0, ibpKeyConsts.width, ibpKeyConsts.height);
|
||||
this.rectGraphic.pivot = getRectangleCenter(
|
||||
new Rectangle(0, 0, ibpKeyConsts.width, ibpKeyConsts.height)
|
||||
);
|
||||
this.rectGraphic.rotation = Math.PI / 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,11 +3,20 @@ import {
|
||||
GraphicState,
|
||||
JlGraphic,
|
||||
JlGraphicTemplate,
|
||||
getRectangleCenter,
|
||||
} from 'jl-graphic';
|
||||
import Psl_Button_Assets from './psl-button-spritesheet.png';
|
||||
import Psl_Button_JSON from './psl-button-data.json';
|
||||
|
||||
import { Assets, Sprite, Spritesheet, Texture } from 'pixi.js';
|
||||
import {
|
||||
Assets,
|
||||
Sprite,
|
||||
Spritesheet,
|
||||
Texture,
|
||||
Graphics,
|
||||
Color,
|
||||
Rectangle,
|
||||
} from 'pixi.js';
|
||||
import { pslGraphicData } from 'src/protos/pslGraphics';
|
||||
|
||||
interface PslButtonTextures {
|
||||
@ -31,12 +40,22 @@ export interface IPslButtonState extends GraphicState {
|
||||
set code(v: string);
|
||||
get down(): boolean;
|
||||
set down(v: boolean);
|
||||
get bypass(): boolean;
|
||||
set bypass(v: boolean);
|
||||
}
|
||||
|
||||
const pslButtonConsts = {
|
||||
width: 70,
|
||||
height: 70,
|
||||
lineWidth: 1,
|
||||
redColor: '0xff0000',
|
||||
};
|
||||
|
||||
export class PslButton extends JlGraphic {
|
||||
static Type = 'PslButton';
|
||||
_pslButton: Sprite;
|
||||
pslButtonTextures: PslButtonTextures;
|
||||
rectGraphic: Graphics;
|
||||
__state = 0;
|
||||
|
||||
constructor(pslButtonTextures: PslButtonTextures) {
|
||||
@ -45,7 +64,10 @@ export class PslButton extends JlGraphic {
|
||||
this._pslButton = new Sprite();
|
||||
this._pslButton.texture = this.pslButtonTextures.redBtn;
|
||||
this._pslButton.anchor.set(0.5);
|
||||
this.rectGraphic = new Graphics();
|
||||
this.addChild(this._pslButton);
|
||||
this.addChild(this.rectGraphic);
|
||||
this.drawRectBypass();
|
||||
}
|
||||
get code(): string {
|
||||
return this.datas.code;
|
||||
@ -71,6 +93,16 @@ export class PslButton extends JlGraphic {
|
||||
this._pslButton.texture = this.pslButtonTextures.redBtn;
|
||||
}
|
||||
}
|
||||
this.rectGraphic.visible = this.states.bypass ? true : false;
|
||||
}
|
||||
drawRectBypass() {
|
||||
this.rectGraphic
|
||||
.clear()
|
||||
.lineStyle(pslButtonConsts.lineWidth, new Color(pslButtonConsts.redColor))
|
||||
.drawRect(0, 0, pslButtonConsts.width, pslButtonConsts.height);
|
||||
this.rectGraphic.pivot = getRectangleCenter(
|
||||
new Rectangle(0, 0, pslButtonConsts.width, pslButtonConsts.height)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ export class TransponderCode extends Container {
|
||||
this.addChild(this.codeText);
|
||||
}
|
||||
setVectorFontSize(fontSize: number) {
|
||||
this.codeText.setVectorFontSize(fontSize)
|
||||
this.codeText.setVectorFontSize(fontSize);
|
||||
}
|
||||
|
||||
clear() {
|
||||
@ -211,7 +211,16 @@ export class Transponder extends JlGraphic {
|
||||
});
|
||||
polygonGraphic.endFill;
|
||||
this.labelGraphic.paint(this.datas);
|
||||
this.labelGraphic.codeText.style.fill = lineColor;
|
||||
let textColor = '#ff0000';
|
||||
if (
|
||||
this.states.km &&
|
||||
this.states.km.kilometer === this.datas.kilometerSystem.kilometer &&
|
||||
this.states.fixedTelegram === this.datas.fixedTelegram &&
|
||||
this.states.fixedUserTelegram === this.datas.fixedUserTelegram
|
||||
) {
|
||||
textColor = '#ffffff';
|
||||
}
|
||||
this.labelGraphic.codeText.style.fill = textColor;
|
||||
const codeTransform = this.datas?.childTransforms?.find(
|
||||
(item) => item.name === 'transponderCode'
|
||||
);
|
||||
|
@ -5079,6 +5079,7 @@ export namespace state {
|
||||
id?: number;
|
||||
down?: boolean;
|
||||
active?: boolean;
|
||||
bypass?: boolean;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
@ -5092,6 +5093,9 @@ export namespace state {
|
||||
if ("active" in data && data.active != undefined) {
|
||||
this.active = data.active;
|
||||
}
|
||||
if ("bypass" in data && data.bypass != undefined) {
|
||||
this.bypass = data.bypass;
|
||||
}
|
||||
}
|
||||
}
|
||||
get id() {
|
||||
@ -5112,10 +5116,17 @@ export namespace state {
|
||||
set active(value: boolean) {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
}
|
||||
get bypass() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 4, false) as boolean;
|
||||
}
|
||||
set bypass(value: boolean) {
|
||||
pb_1.Message.setField(this, 4, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
id?: number;
|
||||
down?: boolean;
|
||||
active?: boolean;
|
||||
bypass?: boolean;
|
||||
}): ButtonState {
|
||||
const message = new ButtonState({});
|
||||
if (data.id != null) {
|
||||
@ -5127,6 +5138,9 @@ export namespace state {
|
||||
if (data.active != null) {
|
||||
message.active = data.active;
|
||||
}
|
||||
if (data.bypass != null) {
|
||||
message.bypass = data.bypass;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
@ -5134,6 +5148,7 @@ export namespace state {
|
||||
id?: number;
|
||||
down?: boolean;
|
||||
active?: boolean;
|
||||
bypass?: boolean;
|
||||
} = {};
|
||||
if (this.id != null) {
|
||||
data.id = this.id;
|
||||
@ -5144,6 +5159,9 @@ export namespace state {
|
||||
if (this.active != null) {
|
||||
data.active = this.active;
|
||||
}
|
||||
if (this.bypass != null) {
|
||||
data.bypass = this.bypass;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
@ -5156,6 +5174,8 @@ export namespace state {
|
||||
writer.writeBool(2, this.down);
|
||||
if (this.active != false)
|
||||
writer.writeBool(3, this.active);
|
||||
if (this.bypass != false)
|
||||
writer.writeBool(4, this.bypass);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -5174,6 +5194,9 @@ export namespace state {
|
||||
case 3:
|
||||
message.active = reader.readBool();
|
||||
break;
|
||||
case 4:
|
||||
message.bypass = reader.readBool();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
@ -5669,6 +5692,7 @@ export namespace state {
|
||||
constructor(data?: any[] | {
|
||||
id?: number;
|
||||
gear?: number;
|
||||
bypass?: boolean;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
@ -5679,6 +5703,9 @@ export namespace state {
|
||||
if ("gear" in data && data.gear != undefined) {
|
||||
this.gear = data.gear;
|
||||
}
|
||||
if ("bypass" in data && data.bypass != undefined) {
|
||||
this.bypass = data.bypass;
|
||||
}
|
||||
}
|
||||
}
|
||||
get id() {
|
||||
@ -5693,9 +5720,16 @@ export namespace state {
|
||||
set gear(value: number) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
get bypass() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 3, false) as boolean;
|
||||
}
|
||||
set bypass(value: boolean) {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
id?: number;
|
||||
gear?: number;
|
||||
bypass?: boolean;
|
||||
}): KeyState {
|
||||
const message = new KeyState({});
|
||||
if (data.id != null) {
|
||||
@ -5704,12 +5738,16 @@ export namespace state {
|
||||
if (data.gear != null) {
|
||||
message.gear = data.gear;
|
||||
}
|
||||
if (data.bypass != null) {
|
||||
message.bypass = data.bypass;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
id?: number;
|
||||
gear?: number;
|
||||
bypass?: boolean;
|
||||
} = {};
|
||||
if (this.id != null) {
|
||||
data.id = this.id;
|
||||
@ -5717,6 +5755,9 @@ export namespace state {
|
||||
if (this.gear != null) {
|
||||
data.gear = this.gear;
|
||||
}
|
||||
if (this.bypass != null) {
|
||||
data.bypass = this.bypass;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
@ -5727,6 +5768,8 @@ export namespace state {
|
||||
writer.writeUint32(1, this.id);
|
||||
if (this.gear != 0)
|
||||
writer.writeInt32(2, this.gear);
|
||||
if (this.bypass != false)
|
||||
writer.writeBool(3, this.bypass);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -5742,6 +5785,9 @@ export namespace state {
|
||||
case 2:
|
||||
message.gear = reader.readInt32();
|
||||
break;
|
||||
case 3:
|
||||
message.bypass = reader.readBool();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,246 @@
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as pb_1 from "google-protobuf";
|
||||
export namespace request {
|
||||
export class BypassOperationReq extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
simulationId?: string;
|
||||
mapId?: number;
|
||||
deviceId?: number;
|
||||
deviceCode?: string;
|
||||
stationId?: number;
|
||||
gateBoxId?: number;
|
||||
operation?: BypassOperationReq.Operation;
|
||||
btnType?: BypassOperationReq.BtnType;
|
||||
}) {
|
||||
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 ("mapId" in data && data.mapId != undefined) {
|
||||
this.mapId = data.mapId;
|
||||
}
|
||||
if ("deviceId" in data && data.deviceId != undefined) {
|
||||
this.deviceId = data.deviceId;
|
||||
}
|
||||
if ("deviceCode" in data && data.deviceCode != undefined) {
|
||||
this.deviceCode = data.deviceCode;
|
||||
}
|
||||
if ("stationId" in data && data.stationId != undefined) {
|
||||
this.stationId = data.stationId;
|
||||
}
|
||||
if ("gateBoxId" in data && data.gateBoxId != undefined) {
|
||||
this.gateBoxId = data.gateBoxId;
|
||||
}
|
||||
if ("operation" in data && data.operation != undefined) {
|
||||
this.operation = data.operation;
|
||||
}
|
||||
if ("btnType" in data && data.btnType != undefined) {
|
||||
this.btnType = data.btnType;
|
||||
}
|
||||
}
|
||||
}
|
||||
get simulationId() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||
}
|
||||
set simulationId(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get mapId() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
|
||||
}
|
||||
set mapId(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 deviceCode() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 5, "") as string;
|
||||
}
|
||||
set deviceCode(value: string) {
|
||||
pb_1.Message.setField(this, 5, value);
|
||||
}
|
||||
get stationId() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 6, 0) as number;
|
||||
}
|
||||
set stationId(value: number) {
|
||||
pb_1.Message.setField(this, 6, value);
|
||||
}
|
||||
get gateBoxId() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 7, 0) as number;
|
||||
}
|
||||
set gateBoxId(value: number) {
|
||||
pb_1.Message.setField(this, 7, value);
|
||||
}
|
||||
get operation() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 8, BypassOperationReq.Operation.bypass) as BypassOperationReq.Operation;
|
||||
}
|
||||
set operation(value: BypassOperationReq.Operation) {
|
||||
pb_1.Message.setField(this, 8, value);
|
||||
}
|
||||
get btnType() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 9, BypassOperationReq.BtnType.esb_btn) as BypassOperationReq.BtnType;
|
||||
}
|
||||
set btnType(value: BypassOperationReq.BtnType) {
|
||||
pb_1.Message.setField(this, 9, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
simulationId?: string;
|
||||
mapId?: number;
|
||||
deviceId?: number;
|
||||
deviceCode?: string;
|
||||
stationId?: number;
|
||||
gateBoxId?: number;
|
||||
operation?: BypassOperationReq.Operation;
|
||||
btnType?: BypassOperationReq.BtnType;
|
||||
}): BypassOperationReq {
|
||||
const message = new BypassOperationReq({});
|
||||
if (data.simulationId != null) {
|
||||
message.simulationId = data.simulationId;
|
||||
}
|
||||
if (data.mapId != null) {
|
||||
message.mapId = data.mapId;
|
||||
}
|
||||
if (data.deviceId != null) {
|
||||
message.deviceId = data.deviceId;
|
||||
}
|
||||
if (data.deviceCode != null) {
|
||||
message.deviceCode = data.deviceCode;
|
||||
}
|
||||
if (data.stationId != null) {
|
||||
message.stationId = data.stationId;
|
||||
}
|
||||
if (data.gateBoxId != null) {
|
||||
message.gateBoxId = data.gateBoxId;
|
||||
}
|
||||
if (data.operation != null) {
|
||||
message.operation = data.operation;
|
||||
}
|
||||
if (data.btnType != null) {
|
||||
message.btnType = data.btnType;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
simulationId?: string;
|
||||
mapId?: number;
|
||||
deviceId?: number;
|
||||
deviceCode?: string;
|
||||
stationId?: number;
|
||||
gateBoxId?: number;
|
||||
operation?: BypassOperationReq.Operation;
|
||||
btnType?: BypassOperationReq.BtnType;
|
||||
} = {};
|
||||
if (this.simulationId != null) {
|
||||
data.simulationId = this.simulationId;
|
||||
}
|
||||
if (this.mapId != null) {
|
||||
data.mapId = this.mapId;
|
||||
}
|
||||
if (this.deviceId != null) {
|
||||
data.deviceId = this.deviceId;
|
||||
}
|
||||
if (this.deviceCode != null) {
|
||||
data.deviceCode = this.deviceCode;
|
||||
}
|
||||
if (this.stationId != null) {
|
||||
data.stationId = this.stationId;
|
||||
}
|
||||
if (this.gateBoxId != null) {
|
||||
data.gateBoxId = this.gateBoxId;
|
||||
}
|
||||
if (this.operation != null) {
|
||||
data.operation = this.operation;
|
||||
}
|
||||
if (this.btnType != null) {
|
||||
data.btnType = this.btnType;
|
||||
}
|
||||
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.mapId != 0)
|
||||
writer.writeInt32(2, this.mapId);
|
||||
if (this.deviceId != 0)
|
||||
writer.writeUint32(3, this.deviceId);
|
||||
if (this.deviceCode.length)
|
||||
writer.writeString(5, this.deviceCode);
|
||||
if (this.stationId != 0)
|
||||
writer.writeUint32(6, this.stationId);
|
||||
if (this.gateBoxId != 0)
|
||||
writer.writeUint32(7, this.gateBoxId);
|
||||
if (this.operation != BypassOperationReq.Operation.bypass)
|
||||
writer.writeEnum(8, this.operation);
|
||||
if (this.btnType != BypassOperationReq.BtnType.esb_btn)
|
||||
writer.writeEnum(9, this.btnType);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): BypassOperationReq {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new BypassOperationReq();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.simulationId = reader.readString();
|
||||
break;
|
||||
case 2:
|
||||
message.mapId = reader.readInt32();
|
||||
break;
|
||||
case 3:
|
||||
message.deviceId = reader.readUint32();
|
||||
break;
|
||||
case 5:
|
||||
message.deviceCode = reader.readString();
|
||||
break;
|
||||
case 6:
|
||||
message.stationId = reader.readUint32();
|
||||
break;
|
||||
case 7:
|
||||
message.gateBoxId = reader.readUint32();
|
||||
break;
|
||||
case 8:
|
||||
message.operation = reader.readEnum();
|
||||
break;
|
||||
case 9:
|
||||
message.btnType = reader.readEnum();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): BypassOperationReq {
|
||||
return BypassOperationReq.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export namespace BypassOperationReq {
|
||||
export enum Operation {
|
||||
bypass = 0,
|
||||
bypass_reset = 1
|
||||
}
|
||||
export enum BtnType {
|
||||
esb_btn = 0,
|
||||
ibp_btn = 1,
|
||||
ibp_key = 2,
|
||||
pls_btn = 3
|
||||
}
|
||||
}
|
||||
export class Relay extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {}) {
|
||||
|
@ -6920,6 +6920,7 @@ export namespace graphicData {
|
||||
flip?: boolean;
|
||||
oldrefStand?: string;
|
||||
refStand?: number;
|
||||
refEsbButtonMapCode?: string;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
@ -6939,6 +6940,9 @@ export namespace graphicData {
|
||||
if ("refStand" in data && data.refStand != undefined) {
|
||||
this.refStand = data.refStand;
|
||||
}
|
||||
if ("refEsbButtonMapCode" in data && data.refEsbButtonMapCode != undefined) {
|
||||
this.refEsbButtonMapCode = data.refEsbButtonMapCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
get common() {
|
||||
@ -6974,12 +6978,19 @@ export namespace graphicData {
|
||||
set refStand(value: number) {
|
||||
pb_1.Message.setField(this, 7, value);
|
||||
}
|
||||
get refEsbButtonMapCode() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 8, "") as string;
|
||||
}
|
||||
set refEsbButtonMapCode(value: string) {
|
||||
pb_1.Message.setField(this, 8, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
|
||||
code?: string;
|
||||
flip?: boolean;
|
||||
oldrefStand?: string;
|
||||
refStand?: number;
|
||||
refEsbButtonMapCode?: string;
|
||||
}): EsbButton {
|
||||
const message = new EsbButton({});
|
||||
if (data.common != null) {
|
||||
@ -6997,6 +7008,9 @@ export namespace graphicData {
|
||||
if (data.refStand != null) {
|
||||
message.refStand = data.refStand;
|
||||
}
|
||||
if (data.refEsbButtonMapCode != null) {
|
||||
message.refEsbButtonMapCode = data.refEsbButtonMapCode;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
@ -7006,6 +7020,7 @@ export namespace graphicData {
|
||||
flip?: boolean;
|
||||
oldrefStand?: string;
|
||||
refStand?: number;
|
||||
refEsbButtonMapCode?: string;
|
||||
} = {};
|
||||
if (this.common != null) {
|
||||
data.common = this.common.toObject();
|
||||
@ -7022,6 +7037,9 @@ export namespace graphicData {
|
||||
if (this.refStand != null) {
|
||||
data.refStand = this.refStand;
|
||||
}
|
||||
if (this.refEsbButtonMapCode != null) {
|
||||
data.refEsbButtonMapCode = this.refEsbButtonMapCode;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
@ -7038,6 +7056,8 @@ export namespace graphicData {
|
||||
writer.writeString(6, this.oldrefStand);
|
||||
if (this.refStand != 0)
|
||||
writer.writeUint32(7, this.refStand);
|
||||
if (this.refEsbButtonMapCode.length)
|
||||
writer.writeString(8, this.refEsbButtonMapCode);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -7062,6 +7082,9 @@ export namespace graphicData {
|
||||
case 7:
|
||||
message.refStand = reader.readUint32();
|
||||
break;
|
||||
case 8:
|
||||
message.refEsbButtonMapCode = reader.readString();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user