This commit is contained in:
fan 2024-02-06 14:13:47 +08:00
commit 863d52bf56
15 changed files with 17 additions and 718 deletions

View File

@ -18,14 +18,6 @@
@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>
@ -33,10 +25,8 @@
import { EsbButtonData } from 'src/drawApp/graphics/EsbButtonInteraction';
import { useFormData } from 'src/components/DrawAppFormUtils';
import { useDrawStore } from 'src/stores/draw-store';
import { onMounted, reactive, ref } from 'vue';
import { onMounted, reactive } 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([]);
@ -45,22 +35,8 @@ 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);

View File

@ -80,10 +80,7 @@
</template>
</q-select>
<q-select
v-if="
commonSetProperty.commonRefGatedBoxMapCode ||
commonSetProperty.oneDeviceTypeOfPSL
"
v-if="gatedBoxSetProperty.refGatedBoxMapCode"
outlined
bottom-slots
v-model="refGatedBoxMapCode"
@ -158,10 +155,6 @@ 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();
@ -203,17 +196,7 @@ const transponderSetProperty = ref<{
const gatedBoxSetProperty = ref<{
[key: string]: boolean;
}>({
commonRefGatedBoxMapCode: false,
});
const esbButtonSetProperty = ref<{
[key: string]: boolean;
}>({
commonRefGatedBoxMapCode: false,
});
const ZdwxEsbSetProperty = ref<{
[key: string]: boolean;
}>({
commonRefGatedBoxMapCode: false,
refGatedBoxMapCode: false,
});
const screenDoorSetProperty = ref<{
[key: string]: boolean;
@ -232,8 +215,6 @@ const commonSetProperty = ref<{
oneDeviceTypeOfJZZ: false, //
commonCodeEndings: false,
oneDeviceTypeOfCCE: false,
commonRefGatedBoxMapCode: false, //PSL
oneDeviceTypeOfPSL: false,
});
const allDeviceProperty = [
@ -245,8 +226,6 @@ const allDeviceProperty = [
{ type: AxleCounting.Type, setProperty: axleCountingSetProperty }, //
{ type: Transponder.Type, setProperty: transponderSetProperty }, //
{ type: GatedBox.Type, setProperty: gatedBoxSetProperty }, //PSLCode
{ type: EsbButton.Type, setProperty: esbButtonSetProperty }, //PSLCode
{ type: ZdwxEsb.Type, setProperty: ZdwxEsbSetProperty }, //PSLCode
{ type: ScreenDoor.Type, setProperty: screenDoorSetProperty }, //
{ type: Platform.Type, setProperty: platformSetProperty }, //
];
@ -473,31 +452,15 @@ 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((device) => {
if (device instanceof GatedBox) {
const data = new GatedBoxData();
data.copyFrom(device.saveData());
if (data.refGatedBoxMapCode !== refIbpMapCode.value) {
data.refGatedBoxMapCode = refGatedBoxMapCode.value;
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);
}
drawStore.selectedGraphics?.forEach((gatedBox) => {
const data = new GatedBoxData();
data.copyFrom(gatedBox.saveData());
if (data.refGatedBoxMapCode !== refIbpMapCode.value) {
data.refGatedBoxMapCode = refGatedBoxMapCode.value;
gatedBox.updateData(data);
}
});
refGatedBoxMapCode.value = '';

View File

@ -53,12 +53,6 @@ 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());
}

View File

@ -6,20 +6,10 @@ import {
IIbpButtonState,
} from 'src/graphics/IBPButton/IBPButton';
import { ibpGraphicData } from 'src/protos/ibpGraphics';
import {
ContextMenu,
GraphicInteractionPlugin,
IGraphicScene,
JlGraphic,
MenuItemOptions,
} from 'jl-graphic';
import { GraphicInteractionPlugin, IGraphicScene, JlGraphic } 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) {
@ -102,12 +92,6 @@ 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());
}
@ -119,27 +103,11 @@ 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);
@ -153,14 +121,12 @@ 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;
@ -185,43 +151,4 @@ 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 = () => {
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);
}
}

View File

@ -3,19 +3,9 @@ import { IIbpKeyData, IIbpKeyState, IbpKey } from 'src/graphics/ibpKey/IbpKey';
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 { GraphicInteractionPlugin, IGraphicScene, JlGraphic } 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) {
@ -73,12 +63,6 @@ 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());
}
@ -90,26 +74,10 @@ 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);
@ -121,55 +89,14 @@ 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 = () => {
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);
}
}

View File

@ -4,22 +4,15 @@ import {
IPslButtonState,
PslButton,
} from 'src/graphics/pslButton/pslButton';
import {
ContextMenu,
GraphicInteractionPlugin,
IGraphicScene,
JlGraphic,
MenuItemOptions,
} from 'jl-graphic';
import { GraphicInteractionPlugin, IGraphicScene, JlGraphic } from 'jl-graphic';
import { pslGraphicData } from 'src/protos/pslGraphics';
import { GraphicDataBase, GraphicStateBase } from './GraphicDataBase';
import { bypassOperation, pslOperate } from 'src/api/Simulation';
import { 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) {
@ -88,12 +81,6 @@ 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>();
}
@ -108,26 +95,10 @@ 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);
@ -143,7 +114,6 @@ 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 {
@ -151,7 +121,6 @@ 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;
@ -209,45 +178,4 @@ 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 = () => {
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);
}
}

View File

@ -53,12 +53,6 @@ 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());
}

View File

@ -3,20 +3,11 @@ 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,
Rectangle,
Graphics,
Color,
} from 'pixi.js';
import { Assets, Sprite, Spritesheet, Texture } from 'pixi.js';
export interface IIBPButtonData extends GraphicData {
get code(): string;
@ -35,22 +26,12 @@ 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);
@ -62,10 +43,7 @@ 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;
@ -83,16 +61,6 @@ 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)
);
}
}

View File

@ -14,8 +14,6 @@ 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;

View File

@ -14,8 +14,6 @@ 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;

View File

@ -3,20 +3,11 @@ 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,
Rectangle,
Graphics,
Color,
} from 'pixi.js';
import { Assets, Sprite, Spritesheet, Texture } from 'pixi.js';
interface IbpKeyTextures {
ibpKey: Texture;
@ -30,22 +21,12 @@ 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) {
@ -54,10 +35,7 @@ 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;
@ -71,17 +49,6 @@ 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;
}
}

View File

@ -3,20 +3,11 @@ 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,
Graphics,
Color,
Rectangle,
} from 'pixi.js';
import { Assets, Sprite, Spritesheet, Texture } from 'pixi.js';
import { pslGraphicData } from 'src/protos/pslGraphics';
interface PslButtonTextures {
@ -40,22 +31,12 @@ 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) {
@ -64,10 +45,7 @@ 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;
@ -93,16 +71,6 @@ 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)
);
}
}

View File

@ -5125,7 +5125,6 @@ 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);
@ -5139,9 +5138,6 @@ 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() {
@ -5162,17 +5158,10 @@ 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) {
@ -5184,9 +5173,6 @@ export namespace state {
if (data.active != null) {
message.active = data.active;
}
if (data.bypass != null) {
message.bypass = data.bypass;
}
return message;
}
toObject() {
@ -5194,7 +5180,6 @@ export namespace state {
id?: number;
down?: boolean;
active?: boolean;
bypass?: boolean;
} = {};
if (this.id != null) {
data.id = this.id;
@ -5205,9 +5190,6 @@ export namespace state {
if (this.active != null) {
data.active = this.active;
}
if (this.bypass != null) {
data.bypass = this.bypass;
}
return data;
}
serialize(): Uint8Array;
@ -5220,8 +5202,6 @@ 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();
}
@ -5240,9 +5220,6 @@ export namespace state {
case 3:
message.active = reader.readBool();
break;
case 4:
message.bypass = reader.readBool();
break;
default: reader.skipField();
}
}
@ -5738,7 +5715,6 @@ 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);
@ -5749,9 +5725,6 @@ 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() {
@ -5766,16 +5739,9 @@ 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) {
@ -5784,16 +5750,12 @@ 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;
@ -5801,9 +5763,6 @@ export namespace state {
if (this.gear != null) {
data.gear = this.gear;
}
if (this.bypass != null) {
data.bypass = this.bypass;
}
return data;
}
serialize(): Uint8Array;
@ -5814,8 +5773,6 @@ 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();
}
@ -5831,9 +5788,6 @@ export namespace state {
case 2:
message.gear = reader.readInt32();
break;
case 3:
message.bypass = reader.readBool();
break;
default: reader.skipField();
}
}

View File

@ -5,246 +5,6 @@
* 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[] | {}) {

View File

@ -6920,7 +6920,6 @@ 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);
@ -6940,9 +6939,6 @@ 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() {
@ -6978,19 +6974,12 @@ 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) {
@ -7008,9 +6997,6 @@ export namespace graphicData {
if (data.refStand != null) {
message.refStand = data.refStand;
}
if (data.refEsbButtonMapCode != null) {
message.refEsbButtonMapCode = data.refEsbButtonMapCode;
}
return message;
}
toObject() {
@ -7020,7 +7006,6 @@ export namespace graphicData {
flip?: boolean;
oldrefStand?: string;
refStand?: number;
refEsbButtonMapCode?: string;
} = {};
if (this.common != null) {
data.common = this.common.toObject();
@ -7037,9 +7022,6 @@ export namespace graphicData {
if (this.refStand != null) {
data.refStand = this.refStand;
}
if (this.refEsbButtonMapCode != null) {
data.refEsbButtonMapCode = this.refEsbButtonMapCode;
}
return data;
}
serialize(): Uint8Array;
@ -7056,8 +7038,6 @@ 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();
}
@ -7082,9 +7062,6 @@ export namespace graphicData {
case 7:
message.refStand = reader.readUint32();
break;
case 8:
message.refEsbButtonMapCode = reader.readString();
break;
default: reader.skipField();
}
}