Merge remote-tracking branch 'origin/develop' into local-test
All checks were successful
CI / Docker-Build (push) Successful in 2m2s

This commit is contained in:
joylink_fanyuhong 2024-03-29 17:31:37 +08:00
commit 737e671e15
27 changed files with 655 additions and 1838 deletions

View File

@ -32,11 +32,6 @@
<path d="M14.4091 23V11.3636H18.3409C19.2538 11.3636 20 11.5284 20.5795 11.858C21.1629 12.1837 21.5947 12.625 21.875 13.1818C22.1553 13.7386 22.2955 14.3598 22.2955 15.0455C22.2955 15.7311 22.1553 16.3542 21.875 16.9148C21.5985 17.4754 21.1705 17.9223 20.5909 18.2557C20.0114 18.5852 19.2689 18.75 18.3636 18.75H15.5455V17.5H18.3182C18.9432 17.5 19.4451 17.392 19.8239 17.1761C20.2027 16.9602 20.4773 16.6686 20.6477 16.3011C20.822 15.9299 20.9091 15.5114 20.9091 15.0455C20.9091 14.5795 20.822 14.1629 20.6477 13.7955C20.4773 13.428 20.2008 13.1402 19.8182 12.9318C19.4356 12.7197 18.928 12.6136 18.2955 12.6136H15.8182V23H14.4091Z" fill="white"/>
<line y1="32" x2="35" y2="32" stroke="white" stroke-width="4"/>
</symbol>
<symbol id="icon-garage-door-box" viewBox="0 0 35 34" fill="none">
<rect x="1" y="1" width="33" height="32" stroke="white" stroke-width="2"/>
<path d="M17.1932 14C17.0838 13.6652 16.9396 13.3653 16.7607 13.1001C16.585 12.8317 16.3745 12.603 16.1293 12.4141C15.8873 12.2251 15.6122 12.081 15.304 11.9815C14.9957 11.8821 14.6577 11.8324 14.2898 11.8324C13.6866 11.8324 13.138 11.9882 12.6442 12.2997C12.1503 12.6113 11.7576 13.0703 11.4659 13.6768C11.1742 14.2834 11.0284 15.0275 11.0284 15.9091C11.0284 16.7907 11.1759 17.5348 11.4709 18.1413C11.7659 18.7479 12.1652 19.2069 12.669 19.5185C13.1728 19.83 13.7396 19.9858 14.3693 19.9858C14.9527 19.9858 15.4664 19.8615 15.9105 19.6129C16.358 19.361 16.706 19.0064 16.9545 18.549C17.2064 18.0883 17.3324 17.5464 17.3324 16.9233L17.7102 17.0028H14.6477V15.9091H18.5256V17.0028C18.5256 17.8414 18.3466 18.5705 17.9886 19.1903C17.634 19.8101 17.1435 20.2907 16.517 20.6321C15.8939 20.9702 15.178 21.1392 14.3693 21.1392C13.4678 21.1392 12.6757 20.9271 11.9929 20.5028C11.3134 20.0786 10.7831 19.4754 10.402 18.6932C10.0241 17.911 9.83523 16.983 9.83523 15.9091C9.83523 15.1037 9.94295 14.3795 10.1584 13.7365C10.3771 13.0902 10.6854 12.54 11.0831 12.0859C11.4808 11.6319 11.9515 11.2839 12.495 11.0419C13.0386 10.8 13.6368 10.679 14.2898 10.679C14.8267 10.679 15.3272 10.7602 15.7912 10.9226C16.2585 11.0817 16.6745 11.3087 17.0391 11.6037C17.407 11.8954 17.7135 12.245 17.9588 12.6527C18.2041 13.0571 18.3731 13.5062 18.4659 14H17.1932Z" fill="white"/>
<line y1="32" x2="35" y2="32" stroke="white" stroke-width="4"/>
</symbol>
<symbol id="icon-esb-button" viewBox="0 0 35 34" fill="none">
<rect x="1" y="1" width="33" height="32" stroke="white" stroke-width="2"/>
<line y1="32" x2="35" y2="32" stroke="white" stroke-width="4"/>
@ -83,7 +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">
<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: 13 KiB

After

Width:  |  Height:  |  Size: 12 KiB

@ -1 +1 @@
Subproject commit f9034ba53d9b201140e9e43dbe8f5b8faa21633a
Subproject commit f566f96c40882d7691c57de3f5c9989cde85b82c

View File

@ -139,18 +139,15 @@
drawStore.selectedGraphicType === ConcentrationDividingLine.Type
"
/>
<flood-gate-property
v-else-if="drawStore.selectedGraphicType === FloodGate.Type"
/>
<car-washing-property
v-else-if="drawStore.selectedGraphicType === CarWashing.Type"
></car-washing-property>
<garage-door-property
v-else-if="drawStore.selectedGraphicType === GarageDoor.Type"
></garage-door-property>
<garage-door-box-property
v-else-if="drawStore.selectedGraphicType === GarageDoorBox.Type"
></garage-door-box-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">
@ -229,14 +226,12 @@ import { TrackLogicSection } from 'src/graphics/trackLogicSection/TrackLogicSect
import MultipleSelectProperty from './properties/multipleSelectProperty.vue';
import { DepartureTimer } from 'src/graphics/departureTimer/DepartureTimer';
import DepartureTimerProperty from './properties/DepartureTimerProperty.vue';
import FloodGateProperty from './properties/FloodGateProperty.vue';
import { FloodGate } from 'src/graphics/floodGate/FloodGate';
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 GarageDoorBoxProperty from './properties/GarageDoorBoxProperty.vue';
import { GarageDoorBox } from 'src/graphics/garageDoorBox/GarageDoorBox';
import { FloodGate } from 'src/graphics/floodGate/FloodGate';
import FloodGateProperty from './properties/FloodGateProperty.vue';
const drawStore = useDrawStore();
</script>

View File

@ -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;
}
});

View File

@ -18,6 +18,14 @@
@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
@ -39,12 +47,14 @@
<script setup lang="ts">
import { useFormData } from 'src/components/DrawAppFormUtils';
import { useDrawStore } from 'src/stores/draw-store';
import { onMounted, reactive } from 'vue';
import { Section } from 'src/graphics/section/Section';
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([]);
@ -53,8 +63,20 @@ 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);
@ -65,12 +87,12 @@ onMounted(() => {
});
});
});
const $q = useQuasar();
function removeStation(index: number) {
floodGateModel.centralizedStations.splice(index, 1);
onUpdate();
}
const $q = useQuasar();
function addStation() {
$q.dialog({
title: '',

View File

@ -1,78 +0,0 @@
<template>
<q-form>
<q-input
outlined
readonly
v-model="garageDoorBoxModel.id"
label="id"
hint=""
/>
<q-input
outlined
class="q-mt-sm"
v-model="garageDoorBoxModel.code"
@blur="onUpdate"
label="编号"
/>
<q-select
outlined
class="q-mt-sm"
style="margin-top: 10px"
v-model="garageDoorBoxModel.refGarageDoorId"
:options="garageDoorList"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="关联车库门"
></q-select>
<q-select
outlined
class="q-mt-sm"
@blur="onUpdate"
v-model="garageDoorBoxModel.refPslMapCode"
:options="pslNameList"
label="关联PSL地图"
/>
</q-form>
</template>
<script setup lang="ts">
import { GarageDoorBoxData } from 'src/drawApp/graphics/GarageDoorBoxInteraction';
import { useFormData } from 'src/components/DrawAppFormUtils';
import { useDrawStore } from 'src/stores/draw-store';
import { onMounted, reactive, ref } from 'vue';
import { getPublishList } from 'src/api/PublishApi';
import { PictureType } from 'src/protos/picture';
import { GarageDoor } from 'src/graphics/garageDoor/GarageDoor';
const { data: garageDoorBoxModel, onUpdate } = useFormData(
new GarageDoorBoxData(),
useDrawStore().getDrawApp()
);
const garageDoorList: { label: string; value: number }[] = reactive([]);
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 garageDoors = useDrawStore()
.getDrawApp()
.queryStore.queryByType<GarageDoor>(GarageDoor.Type);
garageDoors.forEach((p) => {
garageDoorList.push({
value: p.id,
label: `${p.datas.code}[${p.datas.id}]`,
});
});
});
</script>

View File

@ -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);

View File

@ -31,6 +31,9 @@
<garage-door-state
v-else-if="lineStore.selectedGraphicType === GarageDoor.Type"
></garage-door-state>
<flood-gate-state
v-else-if="lineStore.selectedGraphicType === FloodGate.Type"
></flood-gate-state>
</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 FloodGateState from './states/FloodGateState.vue';
const lineStore = useLineStore();
</script>

View 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: '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(() => {
console.log('1111111111');
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>

View File

@ -83,7 +83,7 @@ const list: KeyType[] = [
{ label: '车库门索引', key: 'id' },
{ label: '车库门名称', key: 'code', formatFn: getNameFormat },
{ label: '车库门关闭', key: 'mgj', formatFn: getName },
{ label: '状态丢失', key: 'stateLoss', formatFn: getName },
// { label: '', key: 'stateLoss', formatFn: getName },
{ label: '车库门强制', key: 'param', formatFn: getForceName },
{ label: '设置故障', key: 'param', formatFn: getFaultName },
];
@ -127,8 +127,9 @@ function getForceName() {
}
function getFaultName() {
if (garageDoorFault.value == 1) return '是';
return '否';
if (garageDoorFault.value == request.Ckm.Fault.FA_State_Loss)
return '状态丢失';
return '无';
}
function initGarageDoorState(garageDoor: GarageDoor) {
@ -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,

View File

@ -9,7 +9,7 @@ function getHost(): string {
// return '192.168.3.7:9091';
// return '192.168.3.47:9091';
// return '192.168.3.37:9091';
// return '192.168.33.207:9091'; // 张骞
return '192.168.33.207:9091'; // 张骞
// return '192.168.33.93:9091';
// return '192.168.3.37:9091'; //卫志宏
// return 'test.joylink.club/bjrtsts-service'; // 测试

View File

@ -24,7 +24,6 @@ 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';
import { GarageDoorBox } from 'src/graphics/garageDoorBox/GarageDoorBox';
export const drawCommonLayerList = [
// 图层列表 默认显示的图层defaultShow: true
@ -60,7 +59,6 @@ export const drawCommonLayerList = [
defaultShow: true,
},
{ label: '车库门', value: GarageDoor.Type, defaultShow: true },
{ label: '防淹门', value: FloodGate.Type, defaultShow: true },
{ label: '洗车机', value: CarWashing.Type, defaultShow: true },
{ label: '车库门设置', value: GarageDoorBox.Type, defaultShow: true },
{ label: '防淹门', value: FloodGate.Type, defaultShow: true },
];

View File

@ -96,15 +96,6 @@ import {
GatedBoxData,
DrawGatedBoxInteraction,
} from './graphics/GatedBoxInteraction';
import {
GarageDoorBox,
GarageDoorBoxTemplate,
} from 'src/graphics/garageDoorBox/GarageDoorBox';
import {
GarageDoorBoxData,
DrawGarageDoorBoxInteraction,
} from './graphics/GarageDoorBoxInteraction';
import { GarageDoorBoxDraw } from 'src/graphics/garageDoorBox/GarageDoorBoxAssistant';
// import { EsbButton, EsbButtonTemplate } from 'src/graphics/esbButton/EsbButton';
// import {
// EsbButtonData,
@ -157,9 +148,6 @@ import {
CarWashingTemplate,
} from 'src/graphics/carWashing/CarWashing';
import { CarWashingDraw } from 'src/graphics/carWashing/CarWashingDrawAssistant';
import { FloodGateData } from './graphics/FloodGateInteraction';
import { FloodGate, FloodGateTemplate } from 'src/graphics/floodGate/FloodGate';
import { FloodGateDraw } from 'src/graphics/floodGate/FloodGateDrawAssistant';
import {
GarageDoorData,
GarageDoorState,
@ -169,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: '撤销',
@ -235,10 +226,6 @@ export function initCommonDrawApp(app: IDrawApp) {
new StopPositionDraw(app, new StopPositionTemplate(new StopPositionData()));
new SpksSwitchDraw(app, new SpksSwitchTemplate(new SpksSwitchData()));
new GatedBoxDraw(app, new GatedBoxTemplate(new GatedBoxData()));
new GarageDoorBoxDraw(
app,
new GarageDoorBoxTemplate(new GarageDoorBoxData())
);
// new EsbButtonDraw(
// app,
// new EsbButtonTemplate(new EsbButtonData(), new EsbButtonState())
@ -260,16 +247,18 @@ export function initCommonDrawApp(app: IDrawApp) {
new ConcentrationDividingLineTemplate(new ConcentrationDividingLineData())
);
new CarWashingDraw(app, new CarWashingTemplate(new CarWashingData()));
new FloodGateDraw(app, new FloodGateTemplate(new FloodGateData()));
new GarageDoorDraw(
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);
DrawGatedBoxInteraction.init(app);
DrawGarageDoorBoxInteraction.init(app);
// DrawEsbButtonInteraction.init(app);
// 画布右键菜单
@ -451,9 +440,6 @@ export function loadCommonDrawDatas(
storage.gateBoxs.forEach((gatedBox) => {
datas.push(new GatedBoxData(gatedBox));
});
storage.garageDoorBoxes.forEach((garageDoorBox) => {
datas.push(new GarageDoorBoxData(garageDoorBox));
});
// storage.esbButtons.forEach((esbButton) => {
// datas.push(new EsbButtonData(esbButton));
// });
@ -478,15 +464,15 @@ export function loadCommonDrawDatas(
storage.concentrationDividingLines.forEach((concentrationDividingLine) => {
datas.push(new ConcentrationDividingLineData(concentrationDividingLine));
});
storage.floodGates.forEach((flood) => {
datas.push(new FloodGateData(flood));
});
storage.carWashings.forEach((carWashing) => {
datas.push(new CarWashingData(carWashing));
});
storage.garageDoors.forEach((garageDoor) => {
datas.push(new GarageDoorData(garageDoor));
});
storage.floodGates.forEach((floodGate) => {
datas.push(new FloodGateData(floodGate));
});
return datas;
}
@ -546,11 +532,6 @@ export function saveCommonDrawDatas(app: IDrawApp) {
// } else if (EsbButton.Type === g.type) {
// const esbButtonData = (g as EsbButton).saveData();
// storage.esbButtons.push((esbButtonData as EsbButtonData).data);
} else if (GarageDoorBox.Type === g.type) {
const garageDoorBoxData = (g as GarageDoorBox).saveData();
storage.garageDoorBoxes.push(
(garageDoorBoxData as GarageDoorBoxData).data
);
} else if (Transponder.Type === g.type) {
const transponderData = (g as Transponder).saveData();
storage.transponders.push((transponderData as TransponderData).data);
@ -581,12 +562,12 @@ export function saveCommonDrawDatas(app: IDrawApp) {
} else if (g instanceof CarWashing) {
const carWashingData = g.saveData();
storage.carWashings.push((carWashingData as CarWashingData).data);
} else if (g instanceof FloodGate) {
const floodGateData = g.saveData();
storage.floodGates.push((floodGateData as FloodGateData).data);
} 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) => {

View File

@ -1,16 +1,33 @@
import * as pb_1 from 'google-protobuf';
import { FederatedMouseEvent } from 'pixi.js';
import { FloodGate, IFloodGateData } from 'src/graphics/floodGate/FloodGate';
import { GraphicInteractionPlugin, JlGraphic, IGraphicScene } from 'jl-graphic';
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 } from './GraphicDataBase';
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.FloodGate) {
constructor(data?: graphicData.GarageDoor) {
let floodGate;
if (!data) {
floodGate = new graphicData.FloodGate({
floodGate = new graphicData.GarageDoor({
common: GraphicDataBase.defaultCommonInfo(FloodGate.Type),
});
} else {
@ -19,8 +36,8 @@ export class FloodGateData extends GraphicDataBase implements IFloodGateData {
super(floodGate);
}
public get data(): graphicData.FloodGate {
return this.getData<graphicData.FloodGate>();
public get data(): graphicData.GarageDoor {
return this.getData<graphicData.GarageDoor>();
}
get code(): string {
return this.data.code;
@ -40,6 +57,12 @@ export class FloodGateData extends GraphicDataBase implements IFloodGateData {
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());
}
@ -51,35 +74,126 @@ export class FloodGateData extends GraphicDataBase implements IFloodGateData {
}
}
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 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(scene: IGraphicScene) {
super(FloodGateOperationInteraction.Name, scene);
constructor(app: IGraphicScene) {
super(FloodGateOperationInteraction.Name, app);
app.registerMenu(ckmOperateMenu);
}
static init(scene: IGraphicScene) {
return new FloodGateOperationInteraction(scene);
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.on('mousedown', this.onPress, this);
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.off('mousedown', this.onPress, this);
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);
}
onPress(e: FederatedMouseEvent) {
const g = e.target as FloodGate;
g.on('mouseleave', this.onRelease, this);
g.on('mouseup', this.onRelease, 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);
}
onRelease(e: FederatedMouseEvent) {
const g = e.target as FloodGate;
g.off('mouseleave', this.onRelease, this);
g.off('mouseup', this.onRelease, this);
onLeftClick(e: FederatedMouseEvent) {
const target = e.target as DisplayObject;
const floodGate = target.getGraphic() as FloodGate;
usePslStore().setPslParam(
floodGate.datas.id,
floodGate.datas.refPslMapCode
);
}
}

View File

@ -1,150 +0,0 @@
import * as pb_1 from 'google-protobuf';
import { DisplayObject, FederatedMouseEvent } from 'pixi.js';
import {
GarageDoorBox,
IGarageDoorBox,
} from 'src/graphics/garageDoorBox/GarageDoorBox';
import {
IGraphicApp,
GraphicInteractionPlugin,
JlGraphic,
IGraphicScene,
MenuItemOptions,
ContextMenu,
} from 'jl-graphic';
import { graphicData } from 'src/protos/stationLayoutGraphics';
import { GraphicDataBase } from './GraphicDataBase';
import { usePslStore } from 'src/stores/psl-store';
export class GarageDoorBoxData
extends GraphicDataBase
implements IGarageDoorBox
{
constructor(data?: graphicData.GarageDoorBox) {
let garageDoorBox;
if (!data) {
garageDoorBox = new graphicData.GarageDoorBox({
common: GraphicDataBase.defaultCommonInfo(GarageDoorBox.Type),
});
} else {
garageDoorBox = data;
}
super(garageDoorBox);
}
public get data(): graphicData.GarageDoorBox {
return this.getData<graphicData.GarageDoorBox>();
}
get code(): string {
return this.data.code;
}
set code(v: string) {
this.data.code = v;
}
get flip(): boolean {
return this.data.flip;
}
set flip(v: boolean) {
this.data.flip = v;
}
get refGarageDoorId(): number {
return this.data.refGarageDoorId;
}
set refGarageDoorId(v: number) {
this.data.refGarageDoorId = v;
}
get refPslMapCode(): string {
return this.data.refPslMapCode;
}
set refPslMapCode(v: string) {
this.data.refPslMapCode = v;
}
clone(): GarageDoorBoxData {
return new GarageDoorBoxData(this.data.cloneMessage());
}
copyFrom(data: GarageDoorBoxData): void {
pb_1.Message.copyInto(data.data, this.data);
}
eq(other: GarageDoorBoxData): boolean {
return pb_1.Message.equals(this.data, other.data);
}
}
const flipConfig: MenuItemOptions = {
name: '上下翻转',
};
const GarageDoorBoxEditMenu: ContextMenu = ContextMenu.init({
name: '设置车库门编辑菜单',
groups: [
{
items: [flipConfig],
},
],
});
export class DrawGarageDoorBoxInteraction extends GraphicInteractionPlugin<GarageDoorBox> {
static Name = 'garage_door_box_draw_right_menu';
constructor(app: IGraphicApp) {
super(DrawGarageDoorBoxInteraction.Name, app);
app.registerMenu(GarageDoorBoxEditMenu);
}
static init(app: IGraphicApp) {
return new DrawGarageDoorBoxInteraction(app);
}
filter(...grahpics: JlGraphic[]): GarageDoorBox[] | undefined {
return grahpics
.filter((g) => g.type === GarageDoorBox.Type)
.map((g) => g as GarageDoorBox);
}
bind(g: GarageDoorBox): void {
g.on('_rightclick', this.onContextMenu, this);
}
unbind(g: GarageDoorBox): void {
g.off('_rightclick', this.onContextMenu, this);
}
onContextMenu(e: FederatedMouseEvent) {
const target = e.target as DisplayObject;
const garageDoorBox = target.getGraphic() as GarageDoorBox;
this.app.updateSelected(garageDoorBox);
flipConfig.handler = () => {
garageDoorBox.datas.flip = !garageDoorBox.datas.flip;
garageDoorBox.repaint();
};
GarageDoorBoxEditMenu.open(e.global);
}
}
export class GarageDoorBoxOperateInteraction extends GraphicInteractionPlugin<GarageDoorBox> {
static Name = 'garage_door_box_operate_menu';
constructor(app: IGraphicScene) {
super(GarageDoorBoxOperateInteraction.Name, app);
}
static init(app: IGraphicScene) {
return new GarageDoorBoxOperateInteraction(app);
}
filter(...grahpics: JlGraphic[]): GarageDoorBox[] | undefined {
return grahpics
.filter((g) => g.type === GarageDoorBox.Type)
.map((g) => g as GarageDoorBox);
}
bind(g: GarageDoorBox): void {
g.eventMode = 'static';
g.cursor = 'pointer';
g.on('_leftclick', this.onLeftClick, this);
}
unbind(g: GarageDoorBox): void {
g.eventMode = 'none';
g.off('_leftclick', this.onLeftClick, this);
}
onLeftClick(e: FederatedMouseEvent) {
const target = e.target as DisplayObject;
const garageDoorBox = target.getGraphic() as GarageDoorBox;
usePslStore().setPslParam(
garageDoorBox.datas.id,
garageDoorBox.datas.refPslMapCode
);
}
}

View File

@ -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());
}
@ -95,13 +102,6 @@ export class GarageDoorState
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;
}
@ -149,13 +149,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 +180,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 +188,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
);
}
}

View File

@ -21,11 +21,6 @@ import {
Signal,
KilometerSystem,
} from 'src/graphics/signal/Signal';
import {
FloodGateData,
FloodGateOperationInteraction,
} from './graphics/FloodGateInteraction';
import { FloodGate, FloodGateTemplate } from 'src/graphics/floodGate/FloodGate';
import {
CarWashingData,
CarWashingOperationInteraction,
@ -129,11 +124,6 @@ import {
SpksSwitchOperationInteraction,
} from './graphics/SpksSwitchInteraction';
import { GatedBoxData } from './graphics/GatedBoxInteraction';
import { GarageDoorBoxData } from './graphics/GarageDoorBoxInteraction';
import {
GarageDoorBox,
GarageDoorBoxTemplate,
} from 'src/graphics/garageDoorBox/GarageDoorBox';
import {
EsbButtonData,
EsbButtonOperationInteraction,
@ -175,7 +165,6 @@ import {
} from 'src/graphics/trackLogicSection/TrackLogicSection';
import { TrackLogicSectionData } from './graphics/TrackLogicSectionInteraction';
import { GatedBoxOperateInteraction } from './graphics/GatedBoxInteraction';
import { GarageDoorBoxOperateInteraction } from './graphics/GarageDoorBoxInteraction';
import { CategoryType } from 'src/components/CategoryType';
import {
AutoReturnBox,
@ -199,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: '显示控制',
@ -262,9 +257,8 @@ export const layerList = [
{ label: '轨道逻辑区段', value: TrackLogicSection.Type, defaultShow: false },
{ label: '自动折返按钮箱', value: AutoReturnBox.Type, defaultShow: true },
{ label: '车库门', value: GarageDoor.Type, defaultShow: true },
{ label: '防淹门', value: FloodGate.Type, defaultShow: true },
{ label: '洗车机', value: CarWashing.Type, defaultShow: true },
{ label: '车库门设置', value: GarageDoorBox.Type, defaultShow: true },
{ label: '防淹门', value: FloodGate.Type, defaultShow: true },
];
let lineScene: IGraphicScene;
@ -335,8 +329,7 @@ export function initLineScene(lineApp: IGraphicApp, sceneName: string) {
),
new CarWashingTemplate(new CarWashingData()),
new GarageDoorTemplate(new GarageDoorData(), new GarageDoorState()),
new FloodGateTemplate(new FloodGateData()),
new GarageDoorBoxTemplate(new GarageDoorBoxData()),
new FloodGateTemplate(new FloodGateData(), new FloodGateState()),
];
lineScene.registerGraphicTemplates(...graphicTemplate);
SignalOperateInteraction.init(lineScene);
@ -356,7 +349,6 @@ export function initLineScene(lineApp: IGraphicApp, sceneName: string) {
CarWashingOperationInteraction.init(lineScene);
GarageDoorOperationInteraction.init(lineScene);
FloodGateOperationInteraction.init(lineScene);
GarageDoorBoxOperateInteraction.init(lineScene);
if (categoryType === CategoryType.TH) {
GatedBoxOperateInteraction.init(lineScene);
}
@ -467,6 +459,11 @@ function handleSubscribe(lineScene: IGraphicScene) {
states.push(new GarageDoorState(item));
}
});
storage.allStatus.fymStates.forEach((item) => {
if (item.id) {
states.push(new FloodGateState(item));
}
});
storage.allStatus.trainState.forEach((item) => {
// 列车
if (!item.show) {
@ -666,9 +663,6 @@ export async function loadLineDatas(): Promise<IGraphicStorage> {
storage.floodGates.forEach((floodGate) => {
datas.push(new FloodGateData(floodGate));
});
storage.garageDoorBoxes.forEach((garageDoorBox) => {
datas.push(new GarageDoorBoxData(garageDoorBox));
});
// const linkIdGenerator = new IdGenerator(Link.Type);
// storage.CalculateLink.forEach((link) => {
// const g = new LinkData(link);

View File

@ -16,8 +16,6 @@ import { GarageDoor } from '../garageDoor/GarageDoor';
import { CarWashing } from '../carWashing/CarWashing';
import { GarageDoorData } from 'src/drawApp/graphics/GarageDoorInteraction';
import { CarWashingData } from 'src/drawApp/graphics/CarWashingInteraction';
import { FloodGate } from '../floodGate/FloodGate';
import { FloodGateData } from 'src/drawApp/graphics/FloodGateInteraction';
//判断线段与线段有木有交点
export function isSegmentsIntersect(
@ -178,7 +176,6 @@ export function handleCentralizedStationsData(
[Transponder.Type, new TransponderData()],
[GarageDoor.Type, new GarageDoorData()],
[CarWashing.Type, new CarWashingData()],
[FloodGate.Type, new FloodGateData()],
]);
devices.forEach((device) => {
const data = dataMap.get(device.type);

View File

@ -1,11 +1,13 @@
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 {
@ -15,30 +17,47 @@ export interface IFloodGateData extends GraphicData {
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;
}
const floodGateConsts = {
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);
}
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;
@ -46,11 +65,15 @@ export class FloodGate extends JlGraphic {
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 = floodGateConsts.codeColor;
codeGraph.setVectorFontSize(floodGateConsts.codeFontSize);
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'
@ -64,28 +87,55 @@ export class FloodGate extends JlGraphic {
codeGraph.position.set(0, -30);
}
this.lineBody.clear();
this.lineBody.lineStyle(
floodGateConsts.bodyLineWidth,
floodGateConsts.bodyLineColor
);
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(
-floodGateConsts.bodyRectWidth / 2,
-floodGateConsts.bodyRectHeight / 2
-garageConsts.bodyRectWidth / 2,
-garageConsts.bodyRectHeight / 2
);
this.lineBody.lineTo(
floodGateConsts.bodyRectWidth / 2,
-floodGateConsts.bodyRectHeight / 2
garageConsts.bodyRectWidth / 2,
-garageConsts.bodyRectHeight / 2
);
this.lineBody.moveTo(
-floodGateConsts.bodyRectWidth / 2,
floodGateConsts.bodyRectHeight / 2
-garageConsts.bodyRectWidth / 2,
garageConsts.bodyRectHeight / 2
);
this.lineBody.lineTo(
floodGateConsts.bodyRectWidth / 2,
floodGateConsts.bodyRectHeight / 2
garageConsts.bodyRectWidth / 2,
garageConsts.bodyRectHeight / 2
);
this.lineBody.moveTo(0, -floodGateConsts.bodyRectHeight / 2);
this.lineBody.lineTo(0, floodGateConsts.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() {
@ -115,12 +165,13 @@ export class FloodGate extends JlGraphic {
}
export class FloodGateTemplate extends JlGraphicTemplate<FloodGate> {
constructor(dataTemplate: IFloodGateData) {
super(FloodGate.Type, { dataTemplate });
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;
}
}

View File

@ -1,4 +1,4 @@
import { DisplayObject, FederatedMouseEvent, Point } from 'pixi.js';
import { DisplayObject, FederatedMouseEvent, Point, IHitArea } from 'pixi.js';
import {
AbsorbableLine,
AbsorbablePosition,
@ -80,6 +80,21 @@ function buildAbsorbablePositions(floodGate: FloodGate): AbsorbablePosition[] {
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) {
@ -98,11 +113,17 @@ export class FloodGateInteraction extends GraphicInteractionPlugin<FloodGate> {
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 {
@ -114,6 +135,11 @@ export class FloodGateInteraction extends GraphicInteractionPlugin<FloodGate> {
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) {

View File

@ -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;
@ -29,8 +31,6 @@ export interface IGarageDoorState extends GraphicState {
set mgj(v: boolean);
get param(): request.CkmParam;
set param(v: request.CkmParam);
get stateLoss(): boolean; //状态丢失
set stateLoss(v: boolean);
}
const garageConsts = {
@ -42,17 +42,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 +117,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() {

View File

@ -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) {

View File

@ -1,110 +0,0 @@
import { Graphics } from 'pixi.js';
import {
GraphicData,
JlGraphic,
JlGraphicTemplate,
VectorText,
} from 'jl-graphic';
export interface IGarageDoorBox extends GraphicData {
get code(): string;
set code(v: string);
get flip(): boolean;
set flip(v: boolean);
get refGarageDoorId(): number;
set refGarageDoorId(v: number);
get refPslMapCode(): string;
set refPslMapCode(v: string);
clone(): IGarageDoorBox;
copyFrom(data: IGarageDoorBox): void;
eq(other: IGarageDoorBox): boolean;
}
const garageDoorBoxConsts = {
codeFontSize: 12,
codeColor: 0xffffff,
bodyLineColor: 0xffffff,
bodyLineWidth: 4,
bodyRectLineColor: 0xffffff,
bodyRectLineWidth: 2,
bodyRectWidth: 20,
bodyRectHeight: 20,
bodyColor: 0x000000,
};
export class GarageDoorBox extends JlGraphic {
static Type = 'garageDoorBox';
codeGraph: VectorText = new VectorText('');
rectBody: Graphics = new Graphics();
lineBody: Graphics = new Graphics();
textGraph: VectorText = new VectorText('G');
constructor() {
super(GarageDoorBox.Type);
this.addChild(this.codeGraph);
this.addChild(this.rectBody);
this.addChild(this.lineBody);
this.addChild(this.textGraph);
this.codeGraph.name = 'g_d_b_code';
}
get code(): string {
return this.datas.code;
}
get datas(): IGarageDoorBox {
return this.getDatas<IGarageDoorBox>();
}
doRepaint(): void {
const codeGraph = this.codeGraph;
codeGraph.text = this.datas.code;
codeGraph.style.fill = garageDoorBoxConsts.codeColor;
codeGraph.setVectorFontSize(garageDoorBoxConsts.codeFontSize);
const codeTransform = this.datas?.childTransforms?.find(
(item) => item.name === 'g_d_b_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(20, 0);
}
codeGraph.anchor.set(0.5);
this.textGraph.style.fill = garageDoorBoxConsts.codeColor;
this.textGraph.setVectorFontSize(garageDoorBoxConsts.codeFontSize);
this.textGraph.anchor.set(0.5);
this.rectBody.clear();
this.rectBody.beginFill(garageDoorBoxConsts.bodyColor, 0);
this.rectBody.lineStyle(
garageDoorBoxConsts.bodyRectLineWidth,
garageDoorBoxConsts.bodyRectLineColor
);
this.rectBody.drawRect(
-garageDoorBoxConsts.bodyRectWidth / 2,
-garageDoorBoxConsts.bodyRectHeight / 2,
garageDoorBoxConsts.bodyRectWidth,
garageDoorBoxConsts.bodyRectHeight
);
this.rectBody.endFill();
this.lineBody.clear();
const lineY = this.datas.flip
? garageDoorBoxConsts.bodyRectHeight / 2
: -garageDoorBoxConsts.bodyRectHeight / 2;
this.lineBody.lineStyle(
garageDoorBoxConsts.bodyLineWidth,
garageDoorBoxConsts.bodyLineColor
);
this.lineBody.moveTo(-garageDoorBoxConsts.bodyRectWidth / 2, lineY);
this.lineBody.lineTo(garageDoorBoxConsts.bodyRectWidth / 2, lineY);
}
}
export class GarageDoorBoxTemplate extends JlGraphicTemplate<GarageDoorBox> {
constructor(dataTemplate: IGarageDoorBox) {
super(GarageDoorBox.Type, { dataTemplate });
}
new(): GarageDoorBox {
const garageDoorBox = new GarageDoorBox();
garageDoorBox.loadData(this.datas);
return garageDoorBox;
}
}

View File

@ -1,132 +0,0 @@
import { DisplayObject, FederatedMouseEvent, Point } from 'pixi.js';
import {
AbsorbableLine,
AbsorbablePosition,
GraphicDrawAssistant,
GraphicInteractionPlugin,
GraphicTransformEvent,
IDrawApp,
JlGraphic,
} from 'jl-graphic';
import {
GarageDoorBox,
GarageDoorBoxTemplate,
IGarageDoorBox,
} from './GarageDoorBox';
export interface IGarageDoorBoxDrawOptions {
newData: () => IGarageDoorBox;
}
export class GarageDoorBoxDraw extends GraphicDrawAssistant<
GarageDoorBoxTemplate,
IGarageDoorBox
> {
_garageDoorBox: GarageDoorBox | null = null;
constructor(app: IDrawApp, template: GarageDoorBoxTemplate) {
super(
app,
template,
'svguse:../../drawIcon.svg#icon-garage-door-box',
'设置车库门GarageDoorBox'
);
GarageDoorBoxInteraction.init(app);
}
public get garageDoorBox(): GarageDoorBox {
if (!this._garageDoorBox) {
this._garageDoorBox = this.graphicTemplate.new();
this._garageDoorBox.loadData(this.graphicTemplate.datas);
this.container.addChild(this._garageDoorBox);
}
return this._garageDoorBox;
}
onLeftUp(e: FederatedMouseEvent): void {
this.container.position.copyFrom(this.toCanvasCoordinates(e.global));
this.createAndStore(true);
}
redraw(p: Point): void {
this.garageDoorBox.repaint();
this.container.position.set(p.x, p.y);
}
prepareData(data: IGarageDoorBox): boolean {
data.transform = this.container.saveTransform();
data.code = 'G';
return true;
}
}
/**
* 线
* @param garageDoorBox
*/
function buildAbsorbablePositions(
garageDoorBox: GarageDoorBox
): AbsorbablePosition[] {
const aps: AbsorbablePosition[] = [];
const garageDoorBoxs = garageDoorBox.queryStore.queryByType<GarageDoorBox>(
GarageDoorBox.Type
);
const canvas = garageDoorBox.getCanvas();
garageDoorBoxs.forEach((item) => {
if (item.id === garageDoorBox.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 GarageDoorBoxInteraction extends GraphicInteractionPlugin<GarageDoorBox> {
static Name = 'garage_door_box_transform';
constructor(app: IDrawApp) {
super(GarageDoorBoxInteraction.Name, app);
}
static init(app: IDrawApp) {
return new GarageDoorBoxInteraction(app);
}
filter(...grahpics: JlGraphic[]): GarageDoorBox[] | undefined {
return grahpics
.filter((g) => g.type === GarageDoorBox.Type)
.map((g) => g as GarageDoorBox);
}
bind(g: GarageDoorBox): void {
g.eventMode = 'static';
g.cursor = 'pointer';
g.scalable = true;
g.rotatable = true;
g.codeGraph.draggable = true;
g.codeGraph.selectable = true;
g.codeGraph.rotatable = true;
g.codeGraph.transformSave = true;
g.codeGraph.eventMode = 'static';
g.on('transformstart', this.transformstart, this);
}
unbind(g: GarageDoorBox): 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.off('transformstart', this.transformstart, this);
}
transformstart(e: GraphicTransformEvent) {
const target = e.target as DisplayObject;
const garageDoorBox = target.getGraphic() as GarageDoorBox;
garageDoorBox.getGraphicApp().setOptions({
absorbablePositions: buildAbsorbablePositions(garageDoorBox),
});
}
}

View File

@ -275,9 +275,8 @@ import { distance2, JlGraphic } from 'jl-graphic';
import { IbpBox } from 'src/graphics/ibpBox/IbpBox';
import { PslBox } from 'src/graphics/pslBox/PslBox';
import { CarWashing } from 'src/graphics/carWashing/CarWashing';
import { FloodGate } from 'src/graphics/floodGate/FloodGate';
import { GarageDoor } from 'src/graphics/garageDoor/GarageDoor';
import { GarageDoorBox } from 'src/graphics/garageDoorBox/GarageDoorBox';
import { FloodGate } from 'src/graphics/floodGate/FloodGate';
const $q = useQuasar();
const route = useRoute();
@ -444,9 +443,8 @@ onMounted(() => {
IbpBox.Type,
PslBox.Type,
CarWashing.Type,
FloodGate.Type,
GarageDoor.Type,
GarageDoorBox.Type,
FloodGate.Type,
];
switch (drawStore.categoryType) {
case CategoryType.TH:

View File

@ -6879,7 +6879,6 @@ export namespace state {
id?: number;
mgj?: boolean;
param?: dependency_3.request.CkmParam;
stateLoss?: boolean;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -6893,9 +6892,6 @@ export namespace state {
if ("param" in data && data.param != undefined) {
this.param = data.param;
}
if ("stateLoss" in data && data.stateLoss != undefined) {
this.stateLoss = data.stateLoss;
}
}
}
get id() {
@ -6919,17 +6915,10 @@ export namespace state {
get has_param() {
return pb_1.Message.getField(this, 3) != null;
}
get stateLoss() {
return pb_1.Message.getFieldWithDefault(this, 4, false) as boolean;
}
set stateLoss(value: boolean) {
pb_1.Message.setField(this, 4, value);
}
static fromObject(data: {
id?: number;
mgj?: boolean;
param?: ReturnType<typeof dependency_3.request.CkmParam.prototype.toObject>;
stateLoss?: boolean;
}): CkmState {
const message = new CkmState({});
if (data.id != null) {
@ -6941,9 +6930,6 @@ export namespace state {
if (data.param != null) {
message.param = dependency_3.request.CkmParam.fromObject(data.param);
}
if (data.stateLoss != null) {
message.stateLoss = data.stateLoss;
}
return message;
}
toObject() {
@ -6951,7 +6937,6 @@ export namespace state {
id?: number;
mgj?: boolean;
param?: ReturnType<typeof dependency_3.request.CkmParam.prototype.toObject>;
stateLoss?: boolean;
} = {};
if (this.id != null) {
data.id = this.id;
@ -6962,9 +6947,6 @@ export namespace state {
if (this.param != null) {
data.param = this.param.toObject();
}
if (this.stateLoss != null) {
data.stateLoss = this.stateLoss;
}
return data;
}
serialize(): Uint8Array;
@ -6977,8 +6959,6 @@ export namespace state {
writer.writeBool(2, this.mgj);
if (this.has_param)
writer.writeMessage(3, this.param, () => this.param.serialize(writer));
if (this.stateLoss != false)
writer.writeBool(4, this.stateLoss);
if (!w)
return writer.getResultBuffer();
}
@ -6997,9 +6977,6 @@ export namespace state {
case 3:
reader.readMessage(message.param, () => message.param = dependency_3.request.CkmParam.deserialize(reader));
break;
case 4:
message.stateLoss = reader.readBool();
break;
default: reader.skipField();
}
}
@ -7188,9 +7165,10 @@ export namespace state {
baliseState?: BaliseState[];
stationQc?: StationQc;
ckmStates?: CkmState[];
fymStates?: CkmState[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14], this.#one_of_decls);
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("trainState" in data && data.trainState != undefined) {
this.trainState = data.trainState;
@ -7234,6 +7212,9 @@ export namespace state {
if ("ckmStates" in data && data.ckmStates != undefined) {
this.ckmStates = data.ckmStates;
}
if ("fymStates" in data && data.fymStates != undefined) {
this.fymStates = data.fymStates;
}
}
}
get trainState() {
@ -7323,6 +7304,12 @@ export namespace state {
set ckmStates(value: CkmState[]) {
pb_1.Message.setRepeatedWrapperField(this, 14, value);
}
get fymStates() {
return pb_1.Message.getRepeatedWrapperField(this, CkmState, 15) as CkmState[];
}
set fymStates(value: CkmState[]) {
pb_1.Message.setRepeatedWrapperField(this, 15, value);
}
static fromObject(data: {
trainState?: ReturnType<typeof TrainMapState.prototype.toObject>[];
switchState?: ReturnType<typeof SwitchState.prototype.toObject>[];
@ -7338,6 +7325,7 @@ export namespace state {
baliseState?: ReturnType<typeof BaliseState.prototype.toObject>[];
stationQc?: ReturnType<typeof StationQc.prototype.toObject>;
ckmStates?: ReturnType<typeof CkmState.prototype.toObject>[];
fymStates?: ReturnType<typeof CkmState.prototype.toObject>[];
}): AllDevicesStatus {
const message = new AllDevicesStatus({});
if (data.trainState != null) {
@ -7382,6 +7370,9 @@ export namespace state {
if (data.ckmStates != null) {
message.ckmStates = data.ckmStates.map(item => CkmState.fromObject(item));
}
if (data.fymStates != null) {
message.fymStates = data.fymStates.map(item => CkmState.fromObject(item));
}
return message;
}
toObject() {
@ -7400,6 +7391,7 @@ export namespace state {
baliseState?: ReturnType<typeof BaliseState.prototype.toObject>[];
stationQc?: ReturnType<typeof StationQc.prototype.toObject>;
ckmStates?: ReturnType<typeof CkmState.prototype.toObject>[];
fymStates?: ReturnType<typeof CkmState.prototype.toObject>[];
} = {};
if (this.trainState != null) {
data.trainState = this.trainState.map((item: TrainMapState) => item.toObject());
@ -7443,6 +7435,9 @@ export namespace state {
if (this.ckmStates != null) {
data.ckmStates = this.ckmStates.map((item: CkmState) => item.toObject());
}
if (this.fymStates != null) {
data.fymStates = this.fymStates.map((item: CkmState) => item.toObject());
}
return data;
}
serialize(): Uint8Array;
@ -7477,6 +7472,8 @@ export namespace state {
writer.writeMessage(13, this.stationQc, () => this.stationQc.serialize(writer));
if (this.ckmStates.length)
writer.writeRepeatedMessage(14, this.ckmStates, (item: CkmState) => item.serialize(writer));
if (this.fymStates.length)
writer.writeRepeatedMessage(15, this.fymStates, (item: CkmState) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -7528,6 +7525,9 @@ export namespace state {
case 14:
reader.readMessage(message.ckmStates, () => pb_1.Message.addToRepeatedWrapperField(message, 14, CkmState.deserialize(reader), CkmState));
break;
case 15:
reader.readMessage(message.fymStates, () => pb_1.Message.addToRepeatedWrapperField(message, 15, CkmState.deserialize(reader), CkmState));
break;
default: reader.skipField();
}
}

File diff suppressed because it is too large Load Diff