Compare commits
2 Commits
e964b8bf27
...
6e80d2da85
Author | SHA1 | Date | |
---|---|---|---|
|
6e80d2da85 | ||
|
9e6c007377 |
@ -78,4 +78,7 @@
|
||||
<symbol id="icon-car-washing" viewBox="0 0 150 150" fill="none">
|
||||
<rect x="45" y="3" width="60" height="144" fill="#FFFFFF" stroke="#FFFFFF"/>
|
||||
</symbol>
|
||||
<symbol id="icon-flood-gate" viewBox="0 0 129 139" fill="none">
|
||||
<path fill-rule="evenodd" stroke="rgba(255, 255, 255, 1)" stroke-width="5" d="M0 1.5L61.5 1.5M61.5 1.5L123 1.5M61.5 1.5L61.5 137.5L0 137.5L123 137.5"/>
|
||||
</symbol>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@ -1 +1 @@
|
||||
Subproject commit 4c3937a7dc9bec9ee38a9db16f27dd91fd02c371
|
||||
Subproject commit a191e82832ec4182bfee3f7920d011ad318aaafe
|
@ -145,6 +145,9 @@
|
||||
<garage-door-property
|
||||
v-else-if="drawStore.selectedGraphicType === GarageDoor.Type"
|
||||
></garage-door-property>
|
||||
<flood-gate-property
|
||||
v-else-if="drawStore.selectedGraphicType === FloodGate.Type"
|
||||
></flood-gate-property>
|
||||
</q-card-section>
|
||||
</template>
|
||||
<template v-else-if="drawStore.selectedGraphics.length > 1">
|
||||
@ -227,6 +230,8 @@ import GarageDoorProperty from './properties/GarageDoorProperty.vue';
|
||||
import { GarageDoor } from 'src/graphics/garageDoor/GarageDoor';
|
||||
import CarWashingProperty from './properties/CarWashingProperty.vue';
|
||||
import { CarWashing } from 'src/graphics/carWashing/CarWashing';
|
||||
import { FloodGate } from 'src/graphics/floodGate/FloodGate';
|
||||
import FloodGateProperty from './properties/FloodGateProperty.vue';
|
||||
|
||||
const drawStore = useDrawStore();
|
||||
</script>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<draggable-dialog
|
||||
v-model="showCkmOperation"
|
||||
seamless
|
||||
title="车库门设置参数"
|
||||
:title="props.title"
|
||||
:width="380"
|
||||
:height="0"
|
||||
>
|
||||
@ -22,7 +22,7 @@
|
||||
class="q-gutter-sm"
|
||||
style="border: 1px solid #ccc; border-radius: 3px"
|
||||
>
|
||||
<div>车库门强制:</div>
|
||||
<div>强制:</div>
|
||||
<q-radio
|
||||
v-for="option in ckmForceOption"
|
||||
:key="option.value"
|
||||
@ -87,6 +87,10 @@ const props = defineProps({
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
const lineStore = useLineStore();
|
||||
const showCkmOperation = ref(true);
|
||||
@ -136,9 +140,7 @@ function onCreate() {
|
||||
fault: ckmFault.value,
|
||||
},
|
||||
};
|
||||
ckmUpdateParams(obj).catch((e) =>
|
||||
errorNotify('车库门操作失败:' + e.title, e)
|
||||
);
|
||||
ckmUpdateParams(obj).catch((e) => errorNotify('操作失败:' + e.title, e));
|
||||
showCkmOperation.value = false;
|
||||
}
|
||||
});
|
||||
|
117
src/components/draw-app/properties/FloodGateProperty.vue
Normal file
117
src/components/draw-app/properties/FloodGateProperty.vue
Normal file
@ -0,0 +1,117 @@
|
||||
<template>
|
||||
<q-form>
|
||||
<q-input outlined readonly v-model="floodGateModel.id" label="id" hint="" />
|
||||
<q-input
|
||||
outlined
|
||||
class="q-mt-sm"
|
||||
v-model="floodGateModel.code"
|
||||
@blur="onUpdate"
|
||||
label="名称"
|
||||
/>
|
||||
<q-select
|
||||
outlined
|
||||
style="margin-top: 10px"
|
||||
v-model="floodGateModel.linkSection"
|
||||
:options="sectionList"
|
||||
:map-options="true"
|
||||
:emit-value="true"
|
||||
@update:model-value="onUpdate"
|
||||
label="关联区段"
|
||||
></q-select>
|
||||
<q-select
|
||||
outlined
|
||||
class="q-mt-sm"
|
||||
@blur="onUpdate"
|
||||
v-model="floodGateModel.refPslMapCode"
|
||||
:options="pslNameList"
|
||||
label="关联PSL地图"
|
||||
/>
|
||||
<q-field class="q-mt-lg" outlined label="所属集中站" stack-label>
|
||||
<template #control>
|
||||
<q-chip
|
||||
color="primary"
|
||||
text-color="white"
|
||||
v-for="(id, index) in floodGateModel.centralizedStations"
|
||||
:key="index"
|
||||
removable
|
||||
@remove="removeStation(index)"
|
||||
square
|
||||
>{{ getName(id) }}</q-chip
|
||||
>
|
||||
<q-btn round color="primary" size="xs" icon="add" @click="addStation" />
|
||||
</template>
|
||||
</q-field>
|
||||
</q-form>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useFormData } from 'src/components/DrawAppFormUtils';
|
||||
import { useDrawStore } from 'src/stores/draw-store';
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { FloodGateData } from 'src/drawApp/graphics/FloodGateInteraction';
|
||||
import { Section } from 'src/graphics/section/Section';
|
||||
import AddCentralizedStationDialog from '../dialogs/AddCentralizedStationDialog.vue';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { Station } from 'src/graphics/station/Station';
|
||||
import { getPublishList } from 'src/api/PublishApi';
|
||||
import { PictureType } from 'src/protos/picture';
|
||||
|
||||
const drawStore = useDrawStore();
|
||||
const sectionList: { label: string; value: number }[] = reactive([]);
|
||||
|
||||
const { data: floodGateModel, onUpdate } = useFormData(
|
||||
new FloodGateData(),
|
||||
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 sections = drawStore
|
||||
.getDrawApp()
|
||||
.queryStore.queryByType<Section>(Section.Type);
|
||||
sections.forEach((p) => {
|
||||
sectionList.push({
|
||||
value: p.id,
|
||||
label: `${p.datas.code}`,
|
||||
});
|
||||
});
|
||||
});
|
||||
const $q = useQuasar();
|
||||
function removeStation(index: number) {
|
||||
floodGateModel.centralizedStations.splice(index, 1);
|
||||
onUpdate();
|
||||
}
|
||||
|
||||
function addStation() {
|
||||
$q.dialog({
|
||||
title: '',
|
||||
message: '',
|
||||
component: AddCentralizedStationDialog,
|
||||
cancel: true,
|
||||
persistent: true,
|
||||
}).onOk((data: number) => {
|
||||
floodGateModel.centralizedStations.push(data);
|
||||
onUpdate();
|
||||
});
|
||||
}
|
||||
|
||||
function getName(id: number) {
|
||||
try {
|
||||
const station = drawStore.getDrawApp().queryStore.queryById<Station>(id);
|
||||
return station.datas.code;
|
||||
} catch (error) {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
</script>
|
@ -24,6 +24,14 @@
|
||||
@update:model-value="onUpdate"
|
||||
label="关联区段"
|
||||
></q-select>
|
||||
<q-select
|
||||
outlined
|
||||
class="q-mt-sm"
|
||||
@blur="onUpdate"
|
||||
v-model="garageDoorModel.refPslMapCode"
|
||||
:options="pslNameList"
|
||||
label="关联PSL地图"
|
||||
/>
|
||||
<q-field class="q-mt-lg" outlined label="所属集中站" stack-label>
|
||||
<template #control>
|
||||
<q-chip
|
||||
@ -45,12 +53,14 @@
|
||||
<script setup lang="ts">
|
||||
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 { GarageDoorData } from 'src/drawApp/graphics/GarageDoorInteraction';
|
||||
import { Section } from 'src/graphics/section/Section';
|
||||
import AddCentralizedStationDialog from '../dialogs/AddCentralizedStationDialog.vue';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { Station } from 'src/graphics/station/Station';
|
||||
import { getPublishList } from 'src/api/PublishApi';
|
||||
import { PictureType } from 'src/protos/picture';
|
||||
|
||||
const drawStore = useDrawStore();
|
||||
const sectionList: { label: string; value: number }[] = reactive([]);
|
||||
@ -59,8 +69,20 @@ const { data: garageDoorModel, onUpdate } = useFormData(
|
||||
new GarageDoorData(),
|
||||
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 sections = drawStore
|
||||
.getDrawApp()
|
||||
.queryStore.queryByType<Section>(Section.Type);
|
||||
|
@ -31,6 +31,9 @@
|
||||
<garage-door-state
|
||||
v-else-if="lineStore.selectedGraphicType === GarageDoor.Type"
|
||||
></garage-door-state>
|
||||
<flood-gate-property
|
||||
v-else-if="lineStore.selectedGraphicType === FloodGate.Type"
|
||||
></flood-gate-property>
|
||||
</div>
|
||||
</q-scroll-area>
|
||||
</template>
|
||||
@ -61,6 +64,8 @@ import TransponderState from './states/TransponderState.vue';
|
||||
import { Transponder } from 'src/graphics/transponder/Transponder';
|
||||
import { GarageDoor } from 'src/graphics/garageDoor/GarageDoor';
|
||||
import GarageDoorState from './states/GarageDoorState.vue';
|
||||
import { FloodGate } from 'src/graphics/floodGate/FloodGate';
|
||||
import FloodGateProperty from '../draw-app/properties/FloodGateProperty.vue';
|
||||
|
||||
const lineStore = useLineStore();
|
||||
</script>
|
||||
|
186
src/components/line-app/states/FloodGateState.vue
Normal file
186
src/components/line-app/states/FloodGateState.vue
Normal file
@ -0,0 +1,186 @@
|
||||
<template>
|
||||
<q-card flat bordered>
|
||||
<q-card-section class="flex justify-between">
|
||||
<div class="text-h6">防淹门状态</div>
|
||||
<q-btn-dropdown color="primary" label="操作">
|
||||
<q-list>
|
||||
<q-item
|
||||
v-for="(item, index) in operationOptions"
|
||||
:key="index"
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="doFloodGateOperation(item)"
|
||||
>
|
||||
<q-item-section>
|
||||
<q-item-label>{{ item.label }}</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-btn-dropdown>
|
||||
</q-card-section>
|
||||
<q-separator inset />
|
||||
<q-card-section>
|
||||
<q-list dense>
|
||||
<q-item v-for="(item, index) in list" :key="index">
|
||||
<q-item-section>
|
||||
<q-item-label>{{ item.label }}</q-item-label>
|
||||
</q-item-section>
|
||||
<q-item-section side>
|
||||
<q-item-label caption>{{
|
||||
item.formatFn
|
||||
? item.formatFn(floodGateState[item.key])
|
||||
: floodGateState[item.key]
|
||||
}}</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { useLineStore } from 'src/stores/line-store';
|
||||
import { ref, watch, onMounted, onUnmounted, toRaw } from 'vue';
|
||||
import { request } from 'src/protos/request';
|
||||
import { FloodGate } from 'src/graphics/floodGate/FloodGate';
|
||||
import CkmOperation from 'src/components/draw-app/dialogs/CkmOperation.vue';
|
||||
import { FloodGateState } from 'src/drawApp/graphics/FloodGateInteraction';
|
||||
import { Dialog } from 'quasar';
|
||||
|
||||
const lineStore = useLineStore();
|
||||
const floodGateState = ref<FloodGateState>(new FloodGateState());
|
||||
const code = ref('');
|
||||
const operationOptions = [
|
||||
{
|
||||
label: '设置参数',
|
||||
value: request.Ckm.Operation.SetParams,
|
||||
},
|
||||
];
|
||||
const floodGateForce = ref<request.Ckm.Force>(0);
|
||||
const floodGateForceOption = [
|
||||
{
|
||||
label: '无强制',
|
||||
value: request.Ckm.Force.F_NONE,
|
||||
},
|
||||
{
|
||||
label: '强制开门',
|
||||
value: request.Ckm.Force.F_KM,
|
||||
},
|
||||
{
|
||||
label: '强制关门',
|
||||
value: request.Ckm.Force.F_GM,
|
||||
},
|
||||
];
|
||||
const floodGateFault = ref<request.Ckm.Fault>(0);
|
||||
let copySelectGraphic: FloodGate | null = null;
|
||||
|
||||
interface KeyType {
|
||||
label: string;
|
||||
key: keyof FloodGateState;
|
||||
formatFn?(v: FloodGateState[keyof FloodGateState]): string;
|
||||
}
|
||||
|
||||
const list: KeyType[] = [
|
||||
{ label: '防淹门索引', key: 'id' },
|
||||
{ label: '防淹门名称', key: 'code', formatFn: getNameFormat },
|
||||
{ label: '防淹门关闭', key: 'mgj', formatFn: getName },
|
||||
// { label: '状态丢失', key: 'stateLoss', formatFn: getName },
|
||||
{ label: '防淹门强制', key: 'param', formatFn: getForceName },
|
||||
{ label: '设置故障', key: 'param', formatFn: getFaultName },
|
||||
];
|
||||
|
||||
watch(
|
||||
() => lineStore.selectedGraphics,
|
||||
(val, oldVal) => {
|
||||
if (oldVal?.length == 1 && oldVal[0] instanceof FloodGate) {
|
||||
unSubscribeState(oldVal[0]);
|
||||
}
|
||||
if (val?.length == 1 && val[0] instanceof FloodGate) {
|
||||
copySelectGraphic = toRaw(val[0]);
|
||||
initFloodGateState(val[0]);
|
||||
} else {
|
||||
copySelectGraphic = null;
|
||||
floodGateState.value = new FloodGateState();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
if (lineStore.selectedGraphics) {
|
||||
initFloodGateState(lineStore.selectedGraphics[0] as FloodGate);
|
||||
}
|
||||
});
|
||||
|
||||
function getNameFormat() {
|
||||
return code.value;
|
||||
}
|
||||
|
||||
function getName(v: boolean) {
|
||||
if (v) return '是';
|
||||
return '否';
|
||||
}
|
||||
|
||||
function getForceName() {
|
||||
return (
|
||||
floodGateForceOption.find((item) => item.value == floodGateForce.value)
|
||||
?.label || ''
|
||||
);
|
||||
}
|
||||
|
||||
function getFaultName() {
|
||||
if (floodGateFault.value == request.Ckm.Fault.FA_State_Loss)
|
||||
return '状态丢失';
|
||||
return '无';
|
||||
}
|
||||
|
||||
function initFloodGateState(floodGate: FloodGate) {
|
||||
copySelectGraphic = toRaw(floodGate);
|
||||
code.value = floodGate.datas.code;
|
||||
|
||||
updateState(floodGate);
|
||||
subscribeState(floodGate);
|
||||
}
|
||||
|
||||
function updateState(floodGate: FloodGate) {
|
||||
floodGateState.value = floodGate.states.clone() as FloodGateState;
|
||||
floodGateForce.value = floodGateState.value.param.force;
|
||||
floodGateFault.value = floodGateState.value.param.fault;
|
||||
}
|
||||
|
||||
function doFloodGateOperation(item: {
|
||||
label: string;
|
||||
value: request.Ckm.Operation;
|
||||
}) {
|
||||
if (!lineStore.simulationId) return;
|
||||
if (item.label == '设置参数') {
|
||||
if (lineStore.deviceOpreratDialogInstance) return;
|
||||
lineStore.deviceOpreratDialogInstance = Dialog.create({
|
||||
component: CkmOperation,
|
||||
componentProps: {
|
||||
id: +floodGateState.value.id,
|
||||
code: code.value,
|
||||
ckmForceProp: floodGateState.value.param.force,
|
||||
ckmFaultProp: floodGateState.value.param.fault,
|
||||
title: '防淹门设置参数',
|
||||
},
|
||||
cancel: true,
|
||||
persistent: true,
|
||||
}).onCancel(() => {
|
||||
lineStore.deviceOpreratDialogInstance = null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function subscribeState(g: FloodGate) {
|
||||
g.on('stateupdate', updateState);
|
||||
}
|
||||
|
||||
function unSubscribeState(g: FloodGate) {
|
||||
g.off('stateupdate', updateState);
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
if (copySelectGraphic) {
|
||||
unSubscribeState(copySelectGraphic);
|
||||
}
|
||||
});
|
||||
</script>
|
@ -127,7 +127,8 @@ function getForceName() {
|
||||
}
|
||||
|
||||
function getFaultName() {
|
||||
if (garageDoorFault.value == request.Ckm.Fault.FA_State_Loss) return '状态丢失';
|
||||
if (garageDoorFault.value == request.Ckm.Fault.FA_State_Loss)
|
||||
return '状态丢失';
|
||||
return '无';
|
||||
}
|
||||
|
||||
@ -159,6 +160,7 @@ function doGarageDoorOperation(item: {
|
||||
code: code.value,
|
||||
ckmForceProp: garageDoorState.value.param.force,
|
||||
ckmFaultProp: garageDoorState.value.param.fault,
|
||||
title: '车库门设置参数',
|
||||
},
|
||||
cancel: true,
|
||||
persistent: true,
|
||||
|
@ -23,6 +23,7 @@ import { IbpBox } from 'src/graphics/ibpBox/IbpBox';
|
||||
import { PslBox } from 'src/graphics/pslBox/PslBox';
|
||||
import { GarageDoor } from 'src/graphics/garageDoor/GarageDoor';
|
||||
import { CarWashing } from 'src/graphics/carWashing/CarWashing';
|
||||
import { FloodGate } from 'src/graphics/floodGate/FloodGate';
|
||||
|
||||
export const drawCommonLayerList = [
|
||||
// 图层列表 默认显示的图层defaultShow: true
|
||||
@ -57,6 +58,7 @@ export const drawCommonLayerList = [
|
||||
value: ConcentrationDividingLine.Type,
|
||||
defaultShow: true,
|
||||
},
|
||||
{ label: '车库门/防淹门', value: GarageDoor.Type, defaultShow: true },
|
||||
{ label: '车库门', value: GarageDoor.Type, defaultShow: true },
|
||||
{ label: '洗车机', value: CarWashing.Type, defaultShow: true },
|
||||
{ label: '防淹门', value: FloodGate.Type, defaultShow: true },
|
||||
];
|
||||
|
@ -157,6 +157,9 @@ import {
|
||||
GarageDoorTemplate,
|
||||
} from 'src/graphics/garageDoor/GarageDoor';
|
||||
import { GarageDoorDraw } from 'src/graphics/garageDoor/GarageDoorDrawAssistant';
|
||||
import { FloodGateDraw } from 'src/graphics/floodGate/FloodGateDrawAssistant';
|
||||
import { FloodGate, FloodGateTemplate } from 'src/graphics/floodGate/FloodGate';
|
||||
import { FloodGateData, FloodGateState } from './graphics/FloodGateInteraction';
|
||||
|
||||
const UndoOptions: MenuItemOptions = {
|
||||
name: '撤销',
|
||||
@ -248,6 +251,10 @@ export function initCommonDrawApp(app: IDrawApp) {
|
||||
app,
|
||||
new GarageDoorTemplate(new GarageDoorData(), new GarageDoorState())
|
||||
);
|
||||
new FloodGateDraw(
|
||||
app,
|
||||
new FloodGateTemplate(new FloodGateData(), new FloodGateState())
|
||||
);
|
||||
DrawSignalInteraction.init(app);
|
||||
DrawStopPositionInteraction.init(app);
|
||||
DrawSpksSwitchInteraction.init(app);
|
||||
@ -463,6 +470,9 @@ export function loadCommonDrawDatas(
|
||||
storage.garageDoors.forEach((garageDoor) => {
|
||||
datas.push(new GarageDoorData(garageDoor));
|
||||
});
|
||||
storage.floodGates.forEach((floodGate) => {
|
||||
datas.push(new FloodGateData(floodGate));
|
||||
});
|
||||
return datas;
|
||||
}
|
||||
|
||||
@ -555,6 +565,9 @@ export function saveCommonDrawDatas(app: IDrawApp) {
|
||||
} else if (g instanceof GarageDoor) {
|
||||
const garageDoorData = g.saveData();
|
||||
storage.garageDoors.push((garageDoorData as GarageDoorData).data);
|
||||
} else if (g instanceof FloodGate) {
|
||||
const floodGateData = g.saveData();
|
||||
storage.floodGates.push((floodGateData as FloodGateData).data);
|
||||
}
|
||||
});
|
||||
// storage.Platforms.forEach((item) => {
|
||||
|
206
src/drawApp/graphics/FloodGateInteraction.ts
Normal file
206
src/drawApp/graphics/FloodGateInteraction.ts
Normal file
@ -0,0 +1,206 @@
|
||||
import * as pb_1 from 'google-protobuf';
|
||||
import { DisplayObject, FederatedMouseEvent } from 'pixi.js';
|
||||
import {
|
||||
FloodGate,
|
||||
IFloodGateData,
|
||||
IFloodGateState,
|
||||
} from 'src/graphics/floodGate/FloodGate';
|
||||
import {
|
||||
GraphicInteractionPlugin,
|
||||
JlGraphic,
|
||||
IGraphicScene,
|
||||
MenuItemOptions,
|
||||
ContextMenu,
|
||||
} from 'jl-graphic';
|
||||
|
||||
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
||||
import { GraphicDataBase, GraphicStateBase } from './GraphicDataBase';
|
||||
import { useLineStore } from 'src/stores/line-store';
|
||||
import { Dialog } from 'quasar';
|
||||
import CkmOperation from 'src/components/draw-app/dialogs/CkmOperation.vue';
|
||||
import { state } from 'src/protos/device_state';
|
||||
import { request } from 'src/protos/request';
|
||||
import { FloodGateGraphicHitArea } from 'src/graphics/floodGate/FloodGateDrawAssistant';
|
||||
import { usePslStore } from 'src/stores/psl-store';
|
||||
|
||||
export class FloodGateData extends GraphicDataBase implements IFloodGateData {
|
||||
constructor(data?: graphicData.GarageDoor) {
|
||||
let floodGate;
|
||||
if (!data) {
|
||||
floodGate = new graphicData.GarageDoor({
|
||||
common: GraphicDataBase.defaultCommonInfo(FloodGate.Type),
|
||||
});
|
||||
} else {
|
||||
floodGate = data;
|
||||
}
|
||||
super(floodGate);
|
||||
}
|
||||
|
||||
public get data(): graphicData.GarageDoor {
|
||||
return this.getData<graphicData.GarageDoor>();
|
||||
}
|
||||
get code(): string {
|
||||
return this.data.code;
|
||||
}
|
||||
set code(v: string) {
|
||||
this.data.code = v;
|
||||
}
|
||||
get linkSection(): number {
|
||||
return this.data.linkSection;
|
||||
}
|
||||
set linkSection(v: number) {
|
||||
this.data.linkSection = v;
|
||||
}
|
||||
get centralizedStations(): number[] {
|
||||
return this.data.centralizedStations;
|
||||
}
|
||||
set centralizedStations(v: number[]) {
|
||||
this.data.centralizedStations = v;
|
||||
}
|
||||
get refPslMapCode(): string {
|
||||
return this.data.refPslMapCode;
|
||||
}
|
||||
set refPslMapCode(v: string) {
|
||||
this.data.refPslMapCode = v;
|
||||
}
|
||||
clone(): FloodGateData {
|
||||
return new FloodGateData(this.data.cloneMessage());
|
||||
}
|
||||
copyFrom(data: FloodGateData): void {
|
||||
pb_1.Message.copyInto(data.data, this.data);
|
||||
}
|
||||
eq(other: FloodGateData): boolean {
|
||||
return pb_1.Message.equals(this.data, other.data);
|
||||
}
|
||||
}
|
||||
|
||||
export class FloodGateState
|
||||
extends GraphicStateBase
|
||||
implements IFloodGateState
|
||||
{
|
||||
constructor(proto?: state.CkmState) {
|
||||
let states;
|
||||
if (proto) {
|
||||
states = proto;
|
||||
} else {
|
||||
states = new state.CkmState();
|
||||
}
|
||||
super(states, FloodGate.Type);
|
||||
}
|
||||
get code(): string {
|
||||
return this.states.id + '';
|
||||
}
|
||||
get id(): number {
|
||||
return this.states.id;
|
||||
}
|
||||
set id(id: number) {
|
||||
this.states.id = id;
|
||||
}
|
||||
get mgj() {
|
||||
return this.states.mgj;
|
||||
}
|
||||
set mgj(v: boolean) {
|
||||
this.states.mgj = v;
|
||||
}
|
||||
get stateLoss(): boolean {
|
||||
//状态丢失
|
||||
return this.states.stateLoss;
|
||||
}
|
||||
set stateLoss(v: boolean) {
|
||||
this.states.stateLoss = v;
|
||||
}
|
||||
get param(): request.CkmParam {
|
||||
return this.states.param;
|
||||
}
|
||||
set param(param: request.CkmParam) {
|
||||
this.states.param = param;
|
||||
}
|
||||
get states(): state.CkmState {
|
||||
return this.getState<state.CkmState>();
|
||||
}
|
||||
clone(): FloodGateState {
|
||||
return new FloodGateState(this.states.cloneMessage());
|
||||
}
|
||||
copyFrom(data: GraphicStateBase): void {
|
||||
pb_1.Message.copyInto(data._state, this._state);
|
||||
}
|
||||
eq(data: GraphicStateBase): boolean {
|
||||
return pb_1.Message.equals(this._state, data._state);
|
||||
}
|
||||
}
|
||||
|
||||
const setCkmrParam: MenuItemOptions = { name: '设置参数' };
|
||||
const ckmOperateMenu: ContextMenu = ContextMenu.init({
|
||||
name: '防淹门操作菜单',
|
||||
groups: [
|
||||
{
|
||||
items: [setCkmrParam],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export class FloodGateOperationInteraction extends GraphicInteractionPlugin<FloodGate> {
|
||||
static Name = 'flood_gate_operation';
|
||||
constructor(app: IGraphicScene) {
|
||||
super(FloodGateOperationInteraction.Name, app);
|
||||
app.registerMenu(ckmOperateMenu);
|
||||
}
|
||||
static init(app: IGraphicScene) {
|
||||
return new FloodGateOperationInteraction(app);
|
||||
}
|
||||
filter(...grahpics: JlGraphic[]): FloodGate[] | undefined {
|
||||
return grahpics.filter((g): g is FloodGate => g.type === FloodGate.Type);
|
||||
}
|
||||
bind(g: FloodGate): void {
|
||||
g.eventMode = 'static';
|
||||
g.hitArea = new FloodGateGraphicHitArea(g);
|
||||
g.cursor = 'pointer';
|
||||
g.selectable = true;
|
||||
g.rectBody.eventMode = 'static';
|
||||
g.rectBody.cursor = 'pointer';
|
||||
g.rectBody.selectable = true;
|
||||
g.on('_rightclick', this.onContextMenu);
|
||||
g.rectBody.on('_leftclick', this.onLeftClick, this);
|
||||
}
|
||||
unbind(g: FloodGate): void {
|
||||
g.eventMode = 'none';
|
||||
g.cursor = 'default';
|
||||
g.selectable = false;
|
||||
g.rectBody.eventMode = 'none';
|
||||
g.rectBody.cursor = 'default';
|
||||
g.rectBody.selectable = false;
|
||||
g.off('_rightclick', this.onContextMenu);
|
||||
g.rectBody.off('_leftclick', this.onLeftClick, this);
|
||||
}
|
||||
|
||||
onContextMenu(e: FederatedMouseEvent) {
|
||||
const target = e.target as DisplayObject;
|
||||
const floodGate = target.getGraphic<FloodGate>();
|
||||
if (!floodGate) return;
|
||||
const lineStore = useLineStore();
|
||||
setCkmrParam.handler = async () => {
|
||||
if (lineStore.deviceOpreratDialogInstance) return;
|
||||
lineStore.deviceOpreratDialogInstance = Dialog.create({
|
||||
component: CkmOperation,
|
||||
componentProps: {
|
||||
id: floodGate.id,
|
||||
code: floodGate.datas.code,
|
||||
ckmForceProp: floodGate.states.param.force,
|
||||
ckmFaultProp: floodGate.states.param.fault,
|
||||
title: '防淹门设置参数',
|
||||
},
|
||||
cancel: true,
|
||||
persistent: true,
|
||||
});
|
||||
};
|
||||
ckmOperateMenu.open(e.global);
|
||||
}
|
||||
onLeftClick(e: FederatedMouseEvent) {
|
||||
const target = e.target as DisplayObject;
|
||||
const floodGate = target.getGraphic() as FloodGate;
|
||||
usePslStore().setPslParam(
|
||||
floodGate.datas.id,
|
||||
floodGate.datas.refPslMapCode
|
||||
);
|
||||
}
|
||||
}
|
@ -21,6 +21,7 @@ import CkmOperation from 'src/components/draw-app/dialogs/CkmOperation.vue';
|
||||
import { state } from 'src/protos/device_state';
|
||||
import { request } from 'src/protos/request';
|
||||
import { GarageDoorGraphicHitArea } from 'src/graphics/garageDoor/GarageDoorDrawAssistant';
|
||||
import { usePslStore } from 'src/stores/psl-store';
|
||||
|
||||
export class GarageDoorData extends GraphicDataBase implements IGarageDoorData {
|
||||
constructor(data?: graphicData.GarageDoor) {
|
||||
@ -56,6 +57,12 @@ export class GarageDoorData extends GraphicDataBase implements IGarageDoorData {
|
||||
set centralizedStations(v: number[]) {
|
||||
this.data.centralizedStations = v;
|
||||
}
|
||||
get refPslMapCode(): string {
|
||||
return this.data.refPslMapCode;
|
||||
}
|
||||
set refPslMapCode(v: string) {
|
||||
this.data.refPslMapCode = v;
|
||||
}
|
||||
clone(): GarageDoorData {
|
||||
return new GarageDoorData(this.data.cloneMessage());
|
||||
}
|
||||
@ -149,13 +156,21 @@ export class GarageDoorOperationInteraction extends GraphicInteractionPlugin<Gar
|
||||
g.hitArea = new GarageDoorGraphicHitArea(g);
|
||||
g.cursor = 'pointer';
|
||||
g.selectable = true;
|
||||
g.rectBody.eventMode = 'static';
|
||||
g.rectBody.cursor = 'pointer';
|
||||
g.rectBody.selectable = true;
|
||||
g.on('_rightclick', this.onContextMenu);
|
||||
g.rectBody.on('_leftclick', this.onLeftClick, this);
|
||||
}
|
||||
unbind(g: GarageDoor): void {
|
||||
g.eventMode = 'none';
|
||||
g.cursor = 'default';
|
||||
g.selectable = false;
|
||||
g.rectBody.eventMode = 'none';
|
||||
g.rectBody.cursor = 'default';
|
||||
g.rectBody.selectable = false;
|
||||
g.off('_rightclick', this.onContextMenu);
|
||||
g.rectBody.off('_leftclick', this.onLeftClick, this);
|
||||
}
|
||||
|
||||
onContextMenu(e: FederatedMouseEvent) {
|
||||
@ -172,6 +187,7 @@ export class GarageDoorOperationInteraction extends GraphicInteractionPlugin<Gar
|
||||
code: garageDoor.datas.code,
|
||||
ckmForceProp: garageDoor.states.param.force,
|
||||
ckmFaultProp: garageDoor.states.param.fault,
|
||||
title: '车库门设置参数',
|
||||
},
|
||||
cancel: true,
|
||||
persistent: true,
|
||||
@ -179,4 +195,12 @@ export class GarageDoorOperationInteraction extends GraphicInteractionPlugin<Gar
|
||||
};
|
||||
ckmOperateMenu.open(e.global);
|
||||
}
|
||||
onLeftClick(e: FederatedMouseEvent) {
|
||||
const target = e.target as DisplayObject;
|
||||
const garageDoor = target.getGraphic() as GarageDoor;
|
||||
usePslStore().setPslParam(
|
||||
garageDoor.datas.id,
|
||||
garageDoor.datas.refPslMapCode
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -188,6 +188,12 @@ import {
|
||||
IbpBoxData,
|
||||
IbpBoxOperateInteraction,
|
||||
} from './graphics/IbpBoxInteraction';
|
||||
import { FloodGate, FloodGateTemplate } from 'src/graphics/floodGate/FloodGate';
|
||||
import {
|
||||
FloodGateData,
|
||||
FloodGateOperationInteraction,
|
||||
FloodGateState,
|
||||
} from './graphics/FloodGateInteraction';
|
||||
|
||||
const showOptions: MenuItemOptions = {
|
||||
name: '显示控制',
|
||||
@ -250,8 +256,9 @@ export const layerList = [
|
||||
{ label: '轨道区段', value: TrackSection.Type, defaultShow: false },
|
||||
{ label: '轨道逻辑区段', value: TrackLogicSection.Type, defaultShow: false },
|
||||
{ label: '自动折返按钮箱', value: AutoReturnBox.Type, defaultShow: true },
|
||||
{ label: '车库门/防淹门', value: GarageDoor.Type, defaultShow: true },
|
||||
{ label: '车库门', value: GarageDoor.Type, defaultShow: true },
|
||||
{ label: '洗车机', value: CarWashing.Type, defaultShow: true },
|
||||
{ label: '防淹门', value: FloodGate.Type, defaultShow: true },
|
||||
];
|
||||
|
||||
let lineScene: IGraphicScene;
|
||||
@ -322,6 +329,7 @@ export function initLineScene(lineApp: IGraphicApp, sceneName: string) {
|
||||
),
|
||||
new CarWashingTemplate(new CarWashingData()),
|
||||
new GarageDoorTemplate(new GarageDoorData(), new GarageDoorState()),
|
||||
new FloodGateTemplate(new FloodGateData(), new FloodGateState()),
|
||||
];
|
||||
lineScene.registerGraphicTemplates(...graphicTemplate);
|
||||
SignalOperateInteraction.init(lineScene);
|
||||
@ -340,6 +348,7 @@ export function initLineScene(lineApp: IGraphicApp, sceneName: string) {
|
||||
IbpBoxOperateInteraction.init(lineScene);
|
||||
CarWashingOperationInteraction.init(lineScene);
|
||||
GarageDoorOperationInteraction.init(lineScene);
|
||||
FloodGateOperationInteraction.init(lineScene);
|
||||
if (categoryType === CategoryType.TH) {
|
||||
GatedBoxOperateInteraction.init(lineScene);
|
||||
}
|
||||
@ -646,6 +655,9 @@ export async function loadLineDatas(): Promise<IGraphicStorage> {
|
||||
storage.garageDoors.forEach((garageDoor) => {
|
||||
datas.push(new GarageDoorData(garageDoor));
|
||||
});
|
||||
storage.floodGates.forEach((floodGate) => {
|
||||
datas.push(new FloodGateData(floodGate));
|
||||
});
|
||||
// const linkIdGenerator = new IdGenerator(Link.Type);
|
||||
// storage.CalculateLink.forEach((link) => {
|
||||
// const g = new LinkData(link);
|
||||
|
179
src/graphics/floodGate/FloodGate.ts
Normal file
179
src/graphics/floodGate/FloodGate.ts
Normal file
@ -0,0 +1,179 @@
|
||||
import { Graphics } from 'pixi.js';
|
||||
import {
|
||||
GraphicData,
|
||||
GraphicState,
|
||||
JlGraphic,
|
||||
JlGraphicTemplate,
|
||||
VectorText,
|
||||
linePoint,
|
||||
} from 'jl-graphic';
|
||||
import { request } from 'src/protos/request';
|
||||
import { Section, SectionType } from '../section/Section';
|
||||
|
||||
export interface IFloodGateData extends GraphicData {
|
||||
get code(): string;
|
||||
set code(v: string);
|
||||
get linkSection(): number;
|
||||
set linkSection(v: number);
|
||||
get centralizedStations(): number[];
|
||||
set centralizedStations(v: number[]);
|
||||
get refPslMapCode(): string;
|
||||
set refPslMapCode(v: string);
|
||||
clone(): IFloodGateData;
|
||||
copyFrom(data: IFloodGateData): void;
|
||||
eq(other: IFloodGateData): boolean;
|
||||
}
|
||||
|
||||
export interface IFloodGateState extends GraphicState {
|
||||
get id(): number;
|
||||
set id(v: number);
|
||||
get mgj(): boolean; //防淹门关闭继电器
|
||||
set mgj(v: boolean);
|
||||
get param(): request.CkmParam;
|
||||
set param(v: request.CkmParam);
|
||||
get stateLoss(): boolean; //状态丢失
|
||||
set stateLoss(v: boolean);
|
||||
}
|
||||
|
||||
const garageConsts = {
|
||||
codeFontSize: 12,
|
||||
codeColor: 0xffffff,
|
||||
bodyLineColor: 0xffffff,
|
||||
lossStateColor: 0x0000ff,
|
||||
bodyLineWidth: 2,
|
||||
bodyColor: 0x000000,
|
||||
bodyRectWidth: 10,
|
||||
bodyRectHeight: 20,
|
||||
rectButtonWidth: 10,
|
||||
rectColor: 0xffffff,
|
||||
};
|
||||
export class FloodGate extends JlGraphic {
|
||||
static Type = 'floodGate';
|
||||
codeGraph: VectorText = new VectorText('');
|
||||
lineBody: Graphics = new Graphics();
|
||||
rectBody: Graphics = new Graphics();
|
||||
|
||||
constructor() {
|
||||
super(FloodGate.Type);
|
||||
this.addChild(this.codeGraph);
|
||||
this.addChild(this.lineBody);
|
||||
this.addChild(this.rectBody);
|
||||
this.codeGraph.name = 'flood_code';
|
||||
this.rectBody.name = 'flood_rect_body';
|
||||
}
|
||||
get code(): string {
|
||||
return this.datas.code;
|
||||
}
|
||||
get datas(): IFloodGateData {
|
||||
return this.getDatas<IFloodGateData>();
|
||||
}
|
||||
|
||||
get states(): IFloodGateState {
|
||||
return this.getStates<IFloodGateState>();
|
||||
}
|
||||
doRepaint(): void {
|
||||
const codeGraph = this.codeGraph;
|
||||
codeGraph.text = this.datas.code;
|
||||
codeGraph.style.fill = garageConsts.codeColor;
|
||||
codeGraph.setVectorFontSize(garageConsts.codeFontSize);
|
||||
codeGraph.anchor.set(0.5);
|
||||
const codeTransform = this.datas?.childTransforms?.find(
|
||||
(item) => item.name === 'flood_code'
|
||||
);
|
||||
if (codeTransform) {
|
||||
const position = codeTransform?.transform.position;
|
||||
const rotation = codeTransform?.transform?.rotation;
|
||||
codeGraph.position.set(position?.x, position?.y);
|
||||
codeGraph.rotation = rotation || 0;
|
||||
} else {
|
||||
codeGraph.position.set(0, -30);
|
||||
}
|
||||
this.lineBody.clear();
|
||||
const color =
|
||||
this.states.param?.fault === request.Ckm.Fault.FA_State_Loss
|
||||
? garageConsts.lossStateColor
|
||||
: garageConsts.bodyLineColor;
|
||||
this.lineBody.lineStyle(garageConsts.bodyLineWidth, color);
|
||||
this.lineBody.moveTo(
|
||||
-garageConsts.bodyRectWidth / 2,
|
||||
-garageConsts.bodyRectHeight / 2
|
||||
);
|
||||
this.lineBody.lineTo(
|
||||
garageConsts.bodyRectWidth / 2,
|
||||
-garageConsts.bodyRectHeight / 2
|
||||
);
|
||||
this.lineBody.moveTo(
|
||||
-garageConsts.bodyRectWidth / 2,
|
||||
garageConsts.bodyRectHeight / 2
|
||||
);
|
||||
this.lineBody.lineTo(
|
||||
garageConsts.bodyRectWidth / 2,
|
||||
garageConsts.bodyRectHeight / 2
|
||||
);
|
||||
if (this.states.mgj) {
|
||||
this.lineBody.moveTo(0, -garageConsts.bodyRectHeight / 2);
|
||||
this.lineBody.lineTo(0, garageConsts.bodyRectHeight / 2);
|
||||
} else {
|
||||
this.lineBody.moveTo(0, -garageConsts.bodyRectHeight / 2);
|
||||
this.lineBody.lineTo(0, -garageConsts.bodyRectHeight / 4);
|
||||
this.lineBody.moveTo(0, garageConsts.bodyRectHeight / 4);
|
||||
this.lineBody.lineTo(0, garageConsts.bodyRectHeight / 2);
|
||||
}
|
||||
this.rectBody.clear();
|
||||
this.rectBody.beginFill(garageConsts.rectColor, 1);
|
||||
// this.rectBody.lineStyle(1, garageConsts.rectColor);
|
||||
this.rectBody.drawRect(
|
||||
-garageConsts.bodyRectWidth / 2,
|
||||
garageConsts.bodyRectHeight / 2 + 3,
|
||||
garageConsts.rectButtonWidth,
|
||||
garageConsts.rectButtonWidth
|
||||
);
|
||||
this.rectBody.endFill();
|
||||
const rectTransform = this.datas?.childTransforms?.find(
|
||||
(item) => item.name === 'flood_rect_body'
|
||||
);
|
||||
if (rectTransform) {
|
||||
const position = rectTransform?.transform.position;
|
||||
const rotation = rectTransform?.transform?.rotation;
|
||||
this.rectBody.position.set(position?.x, position?.y);
|
||||
this.rectBody.rotation = rotation || 0;
|
||||
}
|
||||
}
|
||||
|
||||
buildRelation() {
|
||||
const sections = this.queryStore
|
||||
.queryByType<Section>(Section.Type)
|
||||
.filter((s) => s.datas.sectionType === SectionType.Physical);
|
||||
let xj = false;
|
||||
const se = sections.find((section) => {
|
||||
const points = section.linePoints;
|
||||
points.forEach((point, index) => {
|
||||
if (index !== 0) {
|
||||
xj =
|
||||
linePoint(
|
||||
section.localToCanvasPoint(points[index - 1]),
|
||||
section.localToCanvasPoint(point),
|
||||
this.localToCanvasPoint({ x: 0, y: 0 }),
|
||||
8
|
||||
) || xj;
|
||||
}
|
||||
});
|
||||
return xj;
|
||||
});
|
||||
if (se) {
|
||||
this.datas.linkSection = se.datas.id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class FloodGateTemplate extends JlGraphicTemplate<FloodGate> {
|
||||
constructor(dataTemplate: IFloodGateData, stateTemplate?: IFloodGateState) {
|
||||
super(FloodGate.Type, { dataTemplate, stateTemplate });
|
||||
}
|
||||
new(): FloodGate {
|
||||
const floodGate = new FloodGate();
|
||||
floodGate.loadData(this.datas);
|
||||
floodGate.loadState(this.states);
|
||||
return floodGate;
|
||||
}
|
||||
}
|
152
src/graphics/floodGate/FloodGateDrawAssistant.ts
Normal file
152
src/graphics/floodGate/FloodGateDrawAssistant.ts
Normal file
@ -0,0 +1,152 @@
|
||||
import { DisplayObject, FederatedMouseEvent, Point, IHitArea } from 'pixi.js';
|
||||
import {
|
||||
AbsorbableLine,
|
||||
AbsorbablePosition,
|
||||
GraphicDrawAssistant,
|
||||
GraphicInteractionPlugin,
|
||||
GraphicTransformEvent,
|
||||
IDrawApp,
|
||||
JlGraphic,
|
||||
} from 'jl-graphic';
|
||||
import { FloodGate, FloodGateTemplate, IFloodGateData } from './FloodGate';
|
||||
|
||||
export interface IFloodGateDataDrawOptions {
|
||||
newData: () => IFloodGateData;
|
||||
}
|
||||
export class FloodGateDraw extends GraphicDrawAssistant<
|
||||
FloodGateTemplate,
|
||||
IFloodGateData
|
||||
> {
|
||||
_floodGate: FloodGate | null = null;
|
||||
constructor(app: IDrawApp, template: FloodGateTemplate) {
|
||||
super(
|
||||
app,
|
||||
template,
|
||||
'svguse:../../drawIcon.svg#icon-flood-gate',
|
||||
'防淹门FloodGate'
|
||||
);
|
||||
FloodGateInteraction.init(app);
|
||||
}
|
||||
public get floodGate(): FloodGate {
|
||||
if (!this._floodGate) {
|
||||
this._floodGate = this.graphicTemplate.new();
|
||||
this._floodGate.loadData(this.graphicTemplate.datas);
|
||||
this.container.addChild(this._floodGate);
|
||||
}
|
||||
return this._floodGate;
|
||||
}
|
||||
|
||||
onLeftUp(e: FederatedMouseEvent): void {
|
||||
this.container.position.copyFrom(this.toCanvasCoordinates(e.global));
|
||||
this.createAndStore(true);
|
||||
}
|
||||
|
||||
redraw(p: Point): void {
|
||||
this.floodGate.repaint();
|
||||
this.container.position.set(p.x, p.y);
|
||||
}
|
||||
|
||||
prepareData(data: IFloodGateData): boolean {
|
||||
data.transform = this.container.saveTransform();
|
||||
data.code = 'FloodGate';
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 构建吸附线
|
||||
* @param floodGate
|
||||
*/
|
||||
function buildAbsorbablePositions(floodGate: FloodGate): AbsorbablePosition[] {
|
||||
const aps: AbsorbablePosition[] = [];
|
||||
const floodGates = floodGate.queryStore.queryByType<FloodGate>(
|
||||
FloodGate.Type
|
||||
);
|
||||
const canvas = floodGate.getCanvas();
|
||||
floodGates.forEach((item) => {
|
||||
if (item.id === floodGate.id) {
|
||||
return;
|
||||
}
|
||||
const ala = new AbsorbableLine(
|
||||
new Point(item.x, 0),
|
||||
new Point(item.x, canvas.height)
|
||||
);
|
||||
const alb = new AbsorbableLine(
|
||||
new Point(0, item.y),
|
||||
new Point(canvas.width, item.y)
|
||||
);
|
||||
aps.push(ala);
|
||||
aps.push(alb);
|
||||
});
|
||||
return aps;
|
||||
}
|
||||
|
||||
export class FloodGateGraphicHitArea implements IHitArea {
|
||||
floodGate: FloodGate;
|
||||
constructor(floodGate: FloodGate) {
|
||||
this.floodGate = floodGate;
|
||||
}
|
||||
contains(x: number, y: number): boolean {
|
||||
const bound = this.floodGate.getLocalBounds();
|
||||
const maxX = bound.x + bound.width;
|
||||
const minX = bound.x;
|
||||
const maxY = bound.y + bound.height;
|
||||
const minY = bound.y;
|
||||
return maxX >= x && x >= minX && maxY >= y && y >= minY;
|
||||
}
|
||||
}
|
||||
|
||||
export class FloodGateInteraction extends GraphicInteractionPlugin<FloodGate> {
|
||||
static Name = 'flood_gate_transform';
|
||||
constructor(app: IDrawApp) {
|
||||
super(FloodGateInteraction.Name, app);
|
||||
}
|
||||
static init(app: IDrawApp) {
|
||||
return new FloodGateInteraction(app);
|
||||
}
|
||||
filter(...grahpics: JlGraphic[]): FloodGate[] | undefined {
|
||||
return grahpics
|
||||
.filter((g) => g.type === FloodGate.Type)
|
||||
.map((g) => g as FloodGate);
|
||||
}
|
||||
bind(g: FloodGate): void {
|
||||
g.eventMode = 'static';
|
||||
g.cursor = 'pointer';
|
||||
g.scalable = true;
|
||||
g.rotatable = true;
|
||||
g.hitArea = new FloodGateGraphicHitArea(g);
|
||||
g.codeGraph.draggable = true;
|
||||
g.codeGraph.selectable = true;
|
||||
g.codeGraph.rotatable = true;
|
||||
g.codeGraph.transformSave = true;
|
||||
g.codeGraph.eventMode = 'static';
|
||||
g.rectBody.draggable = true;
|
||||
g.rectBody.selectable = true;
|
||||
g.rectBody.rotatable = true;
|
||||
g.rectBody.transformSave = true;
|
||||
g.rectBody.eventMode = 'static';
|
||||
g.on('transformstart', this.transformstart, this);
|
||||
}
|
||||
unbind(g: FloodGate): void {
|
||||
g.eventMode = 'none';
|
||||
g.scalable = false;
|
||||
g.rotatable = false;
|
||||
g.codeGraph.draggable = false;
|
||||
g.codeGraph.selectable = false;
|
||||
g.codeGraph.rotatable = false;
|
||||
g.codeGraph.transformSave = false;
|
||||
g.codeGraph.eventMode = 'none';
|
||||
g.rectBody.draggable = false;
|
||||
g.rectBody.selectable = false;
|
||||
g.rectBody.rotatable = false;
|
||||
g.rectBody.transformSave = false;
|
||||
g.rectBody.eventMode = 'none';
|
||||
g.off('transformstart', this.transformstart, this);
|
||||
}
|
||||
transformstart(e: GraphicTransformEvent) {
|
||||
const target = e.target as DisplayObject;
|
||||
const floodGate = target.getGraphic() as FloodGate;
|
||||
floodGate.getGraphicApp().setOptions({
|
||||
absorbablePositions: buildAbsorbablePositions(floodGate),
|
||||
});
|
||||
}
|
||||
}
|
@ -17,6 +17,8 @@ export interface IGarageDoorData extends GraphicData {
|
||||
set linkSection(v: number);
|
||||
get centralizedStations(): number[];
|
||||
set centralizedStations(v: number[]);
|
||||
get refPslMapCode(): string;
|
||||
set refPslMapCode(v: string);
|
||||
clone(): IGarageDoorData;
|
||||
copyFrom(data: IGarageDoorData): void;
|
||||
eq(other: IGarageDoorData): boolean;
|
||||
@ -42,17 +44,22 @@ const garageConsts = {
|
||||
bodyColor: 0x000000,
|
||||
bodyRectWidth: 10,
|
||||
bodyRectHeight: 20,
|
||||
rectButtonWidth: 10,
|
||||
rectColor: 0xffffff,
|
||||
};
|
||||
export class GarageDoor extends JlGraphic {
|
||||
static Type = 'garageDoor';
|
||||
codeGraph: VectorText = new VectorText('');
|
||||
lineBody: Graphics = new Graphics();
|
||||
rectBody: Graphics = new Graphics();
|
||||
|
||||
constructor() {
|
||||
super(GarageDoor.Type);
|
||||
this.addChild(this.codeGraph);
|
||||
this.addChild(this.lineBody);
|
||||
this.addChild(this.rectBody);
|
||||
this.codeGraph.name = 'garage_code';
|
||||
this.rectBody.name = 'garage_rect_body';
|
||||
}
|
||||
get code(): string {
|
||||
return this.datas.code;
|
||||
@ -112,6 +119,25 @@ export class GarageDoor extends JlGraphic {
|
||||
this.lineBody.moveTo(0, garageConsts.bodyRectHeight / 4);
|
||||
this.lineBody.lineTo(0, garageConsts.bodyRectHeight / 2);
|
||||
}
|
||||
this.rectBody.clear();
|
||||
this.rectBody.beginFill(garageConsts.rectColor, 1);
|
||||
// this.rectBody.lineStyle(1, garageConsts.rectColor);
|
||||
this.rectBody.drawRect(
|
||||
-garageConsts.bodyRectWidth / 2,
|
||||
garageConsts.bodyRectHeight / 2 + 3,
|
||||
garageConsts.rectButtonWidth,
|
||||
garageConsts.rectButtonWidth
|
||||
);
|
||||
this.rectBody.endFill();
|
||||
const rectTransform = this.datas?.childTransforms?.find(
|
||||
(item) => item.name === 'garage_rect_body'
|
||||
);
|
||||
if (rectTransform) {
|
||||
const position = rectTransform?.transform.position;
|
||||
const rotation = rectTransform?.transform?.rotation;
|
||||
this.rectBody.position.set(position?.x, position?.y);
|
||||
this.rectBody.rotation = rotation || 0;
|
||||
}
|
||||
}
|
||||
|
||||
buildRelation() {
|
||||
|
@ -121,6 +121,11 @@ export class GarageDoorInteraction extends GraphicInteractionPlugin<GarageDoor>
|
||||
g.codeGraph.rotatable = true;
|
||||
g.codeGraph.transformSave = true;
|
||||
g.codeGraph.eventMode = 'static';
|
||||
g.rectBody.draggable = true;
|
||||
g.rectBody.selectable = true;
|
||||
g.rectBody.rotatable = true;
|
||||
g.rectBody.transformSave = true;
|
||||
g.rectBody.eventMode = 'static';
|
||||
g.on('transformstart', this.transformstart, this);
|
||||
}
|
||||
unbind(g: GarageDoor): void {
|
||||
@ -132,6 +137,11 @@ export class GarageDoorInteraction extends GraphicInteractionPlugin<GarageDoor>
|
||||
g.codeGraph.rotatable = false;
|
||||
g.codeGraph.transformSave = false;
|
||||
g.codeGraph.eventMode = 'none';
|
||||
g.rectBody.draggable = false;
|
||||
g.rectBody.selectable = false;
|
||||
g.rectBody.rotatable = false;
|
||||
g.rectBody.transformSave = false;
|
||||
g.rectBody.eventMode = 'none';
|
||||
g.off('transformstart', this.transformstart, this);
|
||||
}
|
||||
transformstart(e: GraphicTransformEvent) {
|
||||
|
@ -276,6 +276,7 @@ import { IbpBox } from 'src/graphics/ibpBox/IbpBox';
|
||||
import { PslBox } from 'src/graphics/pslBox/PslBox';
|
||||
import { CarWashing } from 'src/graphics/carWashing/CarWashing';
|
||||
import { GarageDoor } from 'src/graphics/garageDoor/GarageDoor';
|
||||
import { FloodGate } from 'src/graphics/floodGate/FloodGate';
|
||||
|
||||
const $q = useQuasar();
|
||||
const route = useRoute();
|
||||
@ -443,6 +444,7 @@ onMounted(() => {
|
||||
PslBox.Type,
|
||||
CarWashing.Type,
|
||||
GarageDoor.Type,
|
||||
FloodGate.Type,
|
||||
];
|
||||
switch (drawStore.categoryType) {
|
||||
case CategoryType.TH:
|
||||
@ -838,6 +840,9 @@ function oneClickRelateCentralizedStation() {
|
||||
const carWashings = drawApp.queryStore
|
||||
.queryByType<CarWashing>(CarWashing.Type)
|
||||
.filter((g) => containDeviceIds.includes(g.datas.linkSection));
|
||||
const floodGates = drawApp.queryStore
|
||||
.queryByType<FloodGate>(FloodGate.Type)
|
||||
.filter((g) => containDeviceIds.includes(g.datas.linkSection));
|
||||
const allSetCentralizedStationsDevice = [
|
||||
...containDevices,
|
||||
...signals,
|
||||
@ -845,6 +850,7 @@ function oneClickRelateCentralizedStation() {
|
||||
...axleCountings,
|
||||
...garageDoors,
|
||||
...carWashings,
|
||||
...floodGates,
|
||||
];
|
||||
allSetCentralizedStationsDevice.forEach(
|
||||
(g) => ((g as Signal).datas.centralizedStations = [])
|
||||
|
@ -54,11 +54,10 @@ export namespace graphicData {
|
||||
pslBoxs?: PslBox[];
|
||||
carWashings?: CarWashing[];
|
||||
garageDoors?: GarageDoor[];
|
||||
floodGates?: FloodGate[];
|
||||
garageDoorBoxes?: GarageDoorBox[];
|
||||
floodGates?: GarageDoor[];
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 32, 33, 34, 35, 37, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48], this.#one_of_decls);
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 32, 33, 34, 35, 37, 39, 40, 41, 42, 43, 44, 45, 46, 47], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("canvas" in data && data.canvas != undefined) {
|
||||
this.canvas = data.canvas;
|
||||
@ -186,9 +185,6 @@ export namespace graphicData {
|
||||
if ("floodGates" in data && data.floodGates != undefined) {
|
||||
this.floodGates = data.floodGates;
|
||||
}
|
||||
if ("garageDoorBoxes" in data && data.garageDoorBoxes != undefined) {
|
||||
this.garageDoorBoxes = data.garageDoorBoxes;
|
||||
}
|
||||
}
|
||||
}
|
||||
get canvas() {
|
||||
@ -450,17 +446,11 @@ export namespace graphicData {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 46, value);
|
||||
}
|
||||
get floodGates() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, FloodGate, 47) as FloodGate[];
|
||||
return pb_1.Message.getRepeatedWrapperField(this, GarageDoor, 47) as GarageDoor[];
|
||||
}
|
||||
set floodGates(value: FloodGate[]) {
|
||||
set floodGates(value: GarageDoor[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 47, value);
|
||||
}
|
||||
get garageDoorBoxes() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, GarageDoorBox, 48) as GarageDoorBox[];
|
||||
}
|
||||
set garageDoorBoxes(value: GarageDoorBox[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 48, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
canvas?: ReturnType<typeof Canvas.prototype.toObject>;
|
||||
Platforms?: ReturnType<typeof Platform.prototype.toObject>[];
|
||||
@ -503,8 +493,7 @@ export namespace graphicData {
|
||||
pslBoxs?: ReturnType<typeof PslBox.prototype.toObject>[];
|
||||
carWashings?: ReturnType<typeof CarWashing.prototype.toObject>[];
|
||||
garageDoors?: ReturnType<typeof GarageDoor.prototype.toObject>[];
|
||||
floodGates?: ReturnType<typeof FloodGate.prototype.toObject>[];
|
||||
garageDoorBoxes?: ReturnType<typeof GarageDoorBox.prototype.toObject>[];
|
||||
floodGates?: ReturnType<typeof GarageDoor.prototype.toObject>[];
|
||||
}): RtssGraphicStorage {
|
||||
const message = new RtssGraphicStorage({});
|
||||
if (data.canvas != null) {
|
||||
@ -631,10 +620,7 @@ export namespace graphicData {
|
||||
message.garageDoors = data.garageDoors.map(item => GarageDoor.fromObject(item));
|
||||
}
|
||||
if (data.floodGates != null) {
|
||||
message.floodGates = data.floodGates.map(item => FloodGate.fromObject(item));
|
||||
}
|
||||
if (data.garageDoorBoxes != null) {
|
||||
message.garageDoorBoxes = data.garageDoorBoxes.map(item => GarageDoorBox.fromObject(item));
|
||||
message.floodGates = data.floodGates.map(item => GarageDoor.fromObject(item));
|
||||
}
|
||||
return message;
|
||||
}
|
||||
@ -681,8 +667,7 @@ export namespace graphicData {
|
||||
pslBoxs?: ReturnType<typeof PslBox.prototype.toObject>[];
|
||||
carWashings?: ReturnType<typeof CarWashing.prototype.toObject>[];
|
||||
garageDoors?: ReturnType<typeof GarageDoor.prototype.toObject>[];
|
||||
floodGates?: ReturnType<typeof FloodGate.prototype.toObject>[];
|
||||
garageDoorBoxes?: ReturnType<typeof GarageDoorBox.prototype.toObject>[];
|
||||
floodGates?: ReturnType<typeof GarageDoor.prototype.toObject>[];
|
||||
} = {};
|
||||
if (this.canvas != null) {
|
||||
data.canvas = this.canvas.toObject();
|
||||
@ -808,10 +793,7 @@ export namespace graphicData {
|
||||
data.garageDoors = this.garageDoors.map((item: GarageDoor) => item.toObject());
|
||||
}
|
||||
if (this.floodGates != null) {
|
||||
data.floodGates = this.floodGates.map((item: FloodGate) => item.toObject());
|
||||
}
|
||||
if (this.garageDoorBoxes != null) {
|
||||
data.garageDoorBoxes = this.garageDoorBoxes.map((item: GarageDoorBox) => item.toObject());
|
||||
data.floodGates = this.floodGates.map((item: GarageDoor) => item.toObject());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@ -902,9 +884,7 @@ export namespace graphicData {
|
||||
if (this.garageDoors.length)
|
||||
writer.writeRepeatedMessage(46, this.garageDoors, (item: GarageDoor) => item.serialize(writer));
|
||||
if (this.floodGates.length)
|
||||
writer.writeRepeatedMessage(47, this.floodGates, (item: FloodGate) => item.serialize(writer));
|
||||
if (this.garageDoorBoxes.length)
|
||||
writer.writeRepeatedMessage(48, this.garageDoorBoxes, (item: GarageDoorBox) => item.serialize(writer));
|
||||
writer.writeRepeatedMessage(47, this.floodGates, (item: GarageDoor) => item.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -1038,10 +1018,7 @@ export namespace graphicData {
|
||||
reader.readMessage(message.garageDoors, () => pb_1.Message.addToRepeatedWrapperField(message, 46, GarageDoor.deserialize(reader), GarageDoor));
|
||||
break;
|
||||
case 47:
|
||||
reader.readMessage(message.floodGates, () => pb_1.Message.addToRepeatedWrapperField(message, 47, FloodGate.deserialize(reader), FloodGate));
|
||||
break;
|
||||
case 48:
|
||||
reader.readMessage(message.garageDoorBoxes, () => pb_1.Message.addToRepeatedWrapperField(message, 48, GarageDoorBox.deserialize(reader), GarageDoorBox));
|
||||
reader.readMessage(message.floodGates, () => pb_1.Message.addToRepeatedWrapperField(message, 47, GarageDoor.deserialize(reader), GarageDoor));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
@ -8055,6 +8032,7 @@ export namespace graphicData {
|
||||
code?: string;
|
||||
linkSection?: number;
|
||||
centralizedStations?: number[];
|
||||
refPslMapCode?: string;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4], this.#one_of_decls);
|
||||
@ -8071,6 +8049,9 @@ export namespace graphicData {
|
||||
if ("centralizedStations" in data && data.centralizedStations != undefined) {
|
||||
this.centralizedStations = data.centralizedStations;
|
||||
}
|
||||
if ("refPslMapCode" in data && data.refPslMapCode != undefined) {
|
||||
this.refPslMapCode = data.refPslMapCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
get common() {
|
||||
@ -8100,11 +8081,18 @@ export namespace graphicData {
|
||||
set centralizedStations(value: number[]) {
|
||||
pb_1.Message.setField(this, 4, value);
|
||||
}
|
||||
get refPslMapCode() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 5, "") as string;
|
||||
}
|
||||
set refPslMapCode(value: string) {
|
||||
pb_1.Message.setField(this, 5, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
|
||||
code?: string;
|
||||
linkSection?: number;
|
||||
centralizedStations?: number[];
|
||||
refPslMapCode?: string;
|
||||
}): GarageDoor {
|
||||
const message = new GarageDoor({});
|
||||
if (data.common != null) {
|
||||
@ -8119,6 +8107,9 @@ export namespace graphicData {
|
||||
if (data.centralizedStations != null) {
|
||||
message.centralizedStations = data.centralizedStations;
|
||||
}
|
||||
if (data.refPslMapCode != null) {
|
||||
message.refPslMapCode = data.refPslMapCode;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
@ -8127,6 +8118,7 @@ export namespace graphicData {
|
||||
code?: string;
|
||||
linkSection?: number;
|
||||
centralizedStations?: number[];
|
||||
refPslMapCode?: string;
|
||||
} = {};
|
||||
if (this.common != null) {
|
||||
data.common = this.common.toObject();
|
||||
@ -8140,6 +8132,9 @@ export namespace graphicData {
|
||||
if (this.centralizedStations != null) {
|
||||
data.centralizedStations = this.centralizedStations;
|
||||
}
|
||||
if (this.refPslMapCode != null) {
|
||||
data.refPslMapCode = this.refPslMapCode;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
@ -8154,6 +8149,8 @@ export namespace graphicData {
|
||||
writer.writeUint32(3, this.linkSection);
|
||||
if (this.centralizedStations.length)
|
||||
writer.writePackedUint32(4, this.centralizedStations);
|
||||
if (this.refPslMapCode.length)
|
||||
writer.writeString(5, this.refPslMapCode);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -8175,6 +8172,9 @@ export namespace graphicData {
|
||||
case 4:
|
||||
message.centralizedStations = reader.readPackedUint32();
|
||||
break;
|
||||
case 5:
|
||||
message.refPslMapCode = reader.readString();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
@ -8326,145 +8326,6 @@ export namespace graphicData {
|
||||
return CarWashing.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class FloodGate extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
common?: CommonInfo;
|
||||
code?: string;
|
||||
linkSection?: number;
|
||||
centralizedStations?: number[];
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("common" in data && data.common != undefined) {
|
||||
this.common = data.common;
|
||||
}
|
||||
if ("code" in data && data.code != undefined) {
|
||||
this.code = data.code;
|
||||
}
|
||||
if ("linkSection" in data && data.linkSection != undefined) {
|
||||
this.linkSection = data.linkSection;
|
||||
}
|
||||
if ("centralizedStations" in data && data.centralizedStations != undefined) {
|
||||
this.centralizedStations = data.centralizedStations;
|
||||
}
|
||||
}
|
||||
}
|
||||
get common() {
|
||||
return pb_1.Message.getWrapperField(this, CommonInfo, 1) as CommonInfo;
|
||||
}
|
||||
set common(value: CommonInfo) {
|
||||
pb_1.Message.setWrapperField(this, 1, value);
|
||||
}
|
||||
get has_common() {
|
||||
return pb_1.Message.getField(this, 1) != null;
|
||||
}
|
||||
get code() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
|
||||
}
|
||||
set code(value: string) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
get linkSection() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 3, 0) as number;
|
||||
}
|
||||
set linkSection(value: number) {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
}
|
||||
get centralizedStations() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 4, []) as number[];
|
||||
}
|
||||
set centralizedStations(value: number[]) {
|
||||
pb_1.Message.setField(this, 4, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
|
||||
code?: string;
|
||||
linkSection?: number;
|
||||
centralizedStations?: number[];
|
||||
}): FloodGate {
|
||||
const message = new FloodGate({});
|
||||
if (data.common != null) {
|
||||
message.common = CommonInfo.fromObject(data.common);
|
||||
}
|
||||
if (data.code != null) {
|
||||
message.code = data.code;
|
||||
}
|
||||
if (data.linkSection != null) {
|
||||
message.linkSection = data.linkSection;
|
||||
}
|
||||
if (data.centralizedStations != null) {
|
||||
message.centralizedStations = data.centralizedStations;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
|
||||
code?: string;
|
||||
linkSection?: number;
|
||||
centralizedStations?: number[];
|
||||
} = {};
|
||||
if (this.common != null) {
|
||||
data.common = this.common.toObject();
|
||||
}
|
||||
if (this.code != null) {
|
||||
data.code = this.code;
|
||||
}
|
||||
if (this.linkSection != null) {
|
||||
data.linkSection = this.linkSection;
|
||||
}
|
||||
if (this.centralizedStations != null) {
|
||||
data.centralizedStations = this.centralizedStations;
|
||||
}
|
||||
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_common)
|
||||
writer.writeMessage(1, this.common, () => this.common.serialize(writer));
|
||||
if (this.code.length)
|
||||
writer.writeString(2, this.code);
|
||||
if (this.linkSection != 0)
|
||||
writer.writeUint32(3, this.linkSection);
|
||||
if (this.centralizedStations.length)
|
||||
writer.writePackedUint32(4, this.centralizedStations);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): FloodGate {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new FloodGate();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
reader.readMessage(message.common, () => message.common = CommonInfo.deserialize(reader));
|
||||
break;
|
||||
case 2:
|
||||
message.code = reader.readString();
|
||||
break;
|
||||
case 3:
|
||||
message.linkSection = reader.readUint32();
|
||||
break;
|
||||
case 4:
|
||||
message.centralizedStations = reader.readPackedUint32();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): FloodGate {
|
||||
return FloodGate.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class Beacon extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
@ -10181,166 +10042,4 @@ export namespace graphicData {
|
||||
return OtherLine.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class GarageDoorBox extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
common?: CommonInfo;
|
||||
code?: string;
|
||||
refPslMapCode?: string;
|
||||
refGarageDoorId?: number;
|
||||
flip?: 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 ("common" in data && data.common != undefined) {
|
||||
this.common = data.common;
|
||||
}
|
||||
if ("code" in data && data.code != undefined) {
|
||||
this.code = data.code;
|
||||
}
|
||||
if ("refPslMapCode" in data && data.refPslMapCode != undefined) {
|
||||
this.refPslMapCode = data.refPslMapCode;
|
||||
}
|
||||
if ("refGarageDoorId" in data && data.refGarageDoorId != undefined) {
|
||||
this.refGarageDoorId = data.refGarageDoorId;
|
||||
}
|
||||
if ("flip" in data && data.flip != undefined) {
|
||||
this.flip = data.flip;
|
||||
}
|
||||
}
|
||||
}
|
||||
get common() {
|
||||
return pb_1.Message.getWrapperField(this, CommonInfo, 1) as CommonInfo;
|
||||
}
|
||||
set common(value: CommonInfo) {
|
||||
pb_1.Message.setWrapperField(this, 1, value);
|
||||
}
|
||||
get has_common() {
|
||||
return pb_1.Message.getField(this, 1) != null;
|
||||
}
|
||||
get code() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
|
||||
}
|
||||
set code(value: string) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
get refPslMapCode() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
|
||||
}
|
||||
set refPslMapCode(value: string) {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
}
|
||||
get refGarageDoorId() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 4, 0) as number;
|
||||
}
|
||||
set refGarageDoorId(value: number) {
|
||||
pb_1.Message.setField(this, 4, value);
|
||||
}
|
||||
get flip() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 5, false) as boolean;
|
||||
}
|
||||
set flip(value: boolean) {
|
||||
pb_1.Message.setField(this, 5, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
|
||||
code?: string;
|
||||
refPslMapCode?: string;
|
||||
refGarageDoorId?: number;
|
||||
flip?: boolean;
|
||||
}): GarageDoorBox {
|
||||
const message = new GarageDoorBox({});
|
||||
if (data.common != null) {
|
||||
message.common = CommonInfo.fromObject(data.common);
|
||||
}
|
||||
if (data.code != null) {
|
||||
message.code = data.code;
|
||||
}
|
||||
if (data.refPslMapCode != null) {
|
||||
message.refPslMapCode = data.refPslMapCode;
|
||||
}
|
||||
if (data.refGarageDoorId != null) {
|
||||
message.refGarageDoorId = data.refGarageDoorId;
|
||||
}
|
||||
if (data.flip != null) {
|
||||
message.flip = data.flip;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
|
||||
code?: string;
|
||||
refPslMapCode?: string;
|
||||
refGarageDoorId?: number;
|
||||
flip?: boolean;
|
||||
} = {};
|
||||
if (this.common != null) {
|
||||
data.common = this.common.toObject();
|
||||
}
|
||||
if (this.code != null) {
|
||||
data.code = this.code;
|
||||
}
|
||||
if (this.refPslMapCode != null) {
|
||||
data.refPslMapCode = this.refPslMapCode;
|
||||
}
|
||||
if (this.refGarageDoorId != null) {
|
||||
data.refGarageDoorId = this.refGarageDoorId;
|
||||
}
|
||||
if (this.flip != null) {
|
||||
data.flip = this.flip;
|
||||
}
|
||||
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_common)
|
||||
writer.writeMessage(1, this.common, () => this.common.serialize(writer));
|
||||
if (this.code.length)
|
||||
writer.writeString(2, this.code);
|
||||
if (this.refPslMapCode.length)
|
||||
writer.writeString(3, this.refPslMapCode);
|
||||
if (this.refGarageDoorId != 0)
|
||||
writer.writeUint32(4, this.refGarageDoorId);
|
||||
if (this.flip != false)
|
||||
writer.writeBool(5, this.flip);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): GarageDoorBox {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new GarageDoorBox();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
reader.readMessage(message.common, () => message.common = CommonInfo.deserialize(reader));
|
||||
break;
|
||||
case 2:
|
||||
message.code = reader.readString();
|
||||
break;
|
||||
case 3:
|
||||
message.refPslMapCode = reader.readString();
|
||||
break;
|
||||
case 4:
|
||||
message.refGarageDoorId = reader.readUint32();
|
||||
break;
|
||||
case 5:
|
||||
message.flip = reader.readBool();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): GarageDoorBox {
|
||||
return GarageDoorBox.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user