断相保护器
This commit is contained in:
parent
87e715569e
commit
3df4622900
@ -21,6 +21,12 @@
|
|||||||
<relay-property
|
<relay-property
|
||||||
v-if="relayCabinetStore.selectedGraphicType === Relay.Type"
|
v-if="relayCabinetStore.selectedGraphicType === Relay.Type"
|
||||||
></relay-property>
|
></relay-property>
|
||||||
|
<phaseFailureProtector-property
|
||||||
|
v-if="
|
||||||
|
relayCabinetStore.selectedGraphicType ===
|
||||||
|
PhaseFailureProtector.Type
|
||||||
|
"
|
||||||
|
></phaseFailureProtector-property>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</template>
|
</template>
|
||||||
</q-card>
|
</q-card>
|
||||||
@ -33,6 +39,8 @@ import RelayCabinetProperty from './properties/RelayCabinetProperty.vue';
|
|||||||
import { RelayCabinet } from 'src/graphics/relayCabinet/RelayCabinet';
|
import { RelayCabinet } from 'src/graphics/relayCabinet/RelayCabinet';
|
||||||
import RelayProperty from './properties/RelayProperty.vue';
|
import RelayProperty from './properties/RelayProperty.vue';
|
||||||
import { Relay } from 'src/graphics/relay/Relay';
|
import { Relay } from 'src/graphics/relay/Relay';
|
||||||
|
import PhaseFailureProtectorProperty from './properties/PhaseFailureProtectorProperty.vue';
|
||||||
|
import { PhaseFailureProtector } from 'src/graphics/phaseFailureProtector/PhaseFailureProtector';
|
||||||
import { useRelayCabinetStore } from 'src/stores/relayCabinet-store';
|
import { useRelayCabinetStore } from 'src/stores/relayCabinet-store';
|
||||||
|
|
||||||
const relayCabinetStore = useRelayCabinetStore();
|
const relayCabinetStore = useRelayCabinetStore();
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
<template>
|
||||||
|
<q-form class="q-gutter-md">
|
||||||
|
<q-input
|
||||||
|
outlined
|
||||||
|
readonly
|
||||||
|
v-model="phaseFailureProtectorModel.id"
|
||||||
|
label="id"
|
||||||
|
/>
|
||||||
|
<q-input
|
||||||
|
outlined
|
||||||
|
v-model="phaseFailureProtectorModel.code"
|
||||||
|
:emit-value="true"
|
||||||
|
@update:model-value="onUpdate"
|
||||||
|
label="编号"
|
||||||
|
lazy-rules
|
||||||
|
/>
|
||||||
|
</q-form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { PhaseFailureProtectorData } from 'src/drawApp/relayCabinetGraphics/PhaseFailureProtectorInteraction';
|
||||||
|
import { useRelayCabinetStore } from 'src/stores/relayCabinet-store';
|
||||||
|
import { useFormData } from 'src/components/relayCabinetAppFormUtils';
|
||||||
|
|
||||||
|
const relayCabinetStore = useRelayCabinetStore();
|
||||||
|
const { data: phaseFailureProtectorModel, onUpdate } = useFormData(
|
||||||
|
new PhaseFailureProtectorData(),
|
||||||
|
relayCabinetStore.getDrawApp()
|
||||||
|
);
|
||||||
|
</script>
|
@ -103,6 +103,7 @@ import {
|
|||||||
RelateRelaylistItem,
|
RelateRelaylistItem,
|
||||||
} from 'src/drawApp/relayCabinetLayoutApp';
|
} from 'src/drawApp/relayCabinetLayoutApp';
|
||||||
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
||||||
|
import { PhaseFailureProtector } from 'src/graphics/phaseFailureProtector/PhaseFailureProtector';
|
||||||
|
|
||||||
defineExpose({ editRelateRelays });
|
defineExpose({ editRelateRelays });
|
||||||
|
|
||||||
@ -138,7 +139,7 @@ watch(
|
|||||||
(val) => {
|
(val) => {
|
||||||
if (val && val.length > 0 && clickIndex !== null) {
|
if (val && val.length > 0 && clickIndex !== null) {
|
||||||
const selectFilter = relayCabinetStore.selectedGraphics?.filter(
|
const selectFilter = relayCabinetStore.selectedGraphics?.filter(
|
||||||
(g) => g.type == Relay.Type
|
(g) => g.type == Relay.Type || g.type == PhaseFailureProtector.Type
|
||||||
) as JlGraphic[];
|
) as JlGraphic[];
|
||||||
selectGraphic.push(...selectFilter);
|
selectGraphic.push(...selectFilter);
|
||||||
selectGraphic = Array.from(new Set(selectGraphic));
|
selectGraphic = Array.from(new Set(selectGraphic));
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
import * as pb_1 from 'google-protobuf';
|
||||||
|
import {
|
||||||
|
IPhaseFailureProtectorData,
|
||||||
|
PhaseFailureProtector,
|
||||||
|
} from 'src/graphics/phaseFailureProtector/PhaseFailureProtector';
|
||||||
|
import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics';
|
||||||
|
import { GraphicDataBase } from '../graphics/GraphicDataBase';
|
||||||
|
|
||||||
|
export class PhaseFailureProtectorData
|
||||||
|
extends GraphicDataBase
|
||||||
|
implements IPhaseFailureProtectorData
|
||||||
|
{
|
||||||
|
constructor(data?: relayCabinetGraphicData.PhaseFailureProtector) {
|
||||||
|
let phaseFailureProtector;
|
||||||
|
if (!data) {
|
||||||
|
phaseFailureProtector = new relayCabinetGraphicData.PhaseFailureProtector(
|
||||||
|
{
|
||||||
|
common: GraphicDataBase.defaultCommonInfo(PhaseFailureProtector.Type),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
phaseFailureProtector = data;
|
||||||
|
}
|
||||||
|
super(phaseFailureProtector);
|
||||||
|
}
|
||||||
|
|
||||||
|
public get data(): relayCabinetGraphicData.PhaseFailureProtector {
|
||||||
|
return this.getData<relayCabinetGraphicData.PhaseFailureProtector>();
|
||||||
|
}
|
||||||
|
|
||||||
|
get code(): string {
|
||||||
|
return this.data.code;
|
||||||
|
}
|
||||||
|
set code(v: string) {
|
||||||
|
this.data.code = v;
|
||||||
|
}
|
||||||
|
clone(): PhaseFailureProtectorData {
|
||||||
|
return new PhaseFailureProtectorData(this.data.cloneMessage());
|
||||||
|
}
|
||||||
|
copyFrom(data: PhaseFailureProtectorData): void {
|
||||||
|
pb_1.Message.copyInto(data.data, this.data);
|
||||||
|
}
|
||||||
|
eq(other: PhaseFailureProtectorData): boolean {
|
||||||
|
return pb_1.Message.equals(this.data, other.data);
|
||||||
|
}
|
||||||
|
}
|
@ -26,12 +26,6 @@ export class RelayData extends GraphicDataBase implements IRelayData {
|
|||||||
set code(v: string) {
|
set code(v: string) {
|
||||||
this.data.code = v;
|
this.data.code = v;
|
||||||
}
|
}
|
||||||
get model(): string {
|
|
||||||
return this.data.model;
|
|
||||||
}
|
|
||||||
set model(v: string) {
|
|
||||||
this.data.model = v;
|
|
||||||
}
|
|
||||||
get newModel(): relayCabinetGraphicData.Relay.ModelType {
|
get newModel(): relayCabinetGraphicData.Relay.ModelType {
|
||||||
return this.data.newModel;
|
return this.data.newModel;
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,12 @@ import { RelayCabinetDraw } from 'src/graphics/relayCabinet/RelayCabinetDrawAssi
|
|||||||
import { Relay, RelayTemplate } from 'src/graphics/relay/Relay';
|
import { Relay, RelayTemplate } from 'src/graphics/relay/Relay';
|
||||||
import { RelayData } from './relayCabinetGraphics/RelayInteraction';
|
import { RelayData } from './relayCabinetGraphics/RelayInteraction';
|
||||||
import { RelayDraw } from 'src/graphics/relay/RelayDrawAssistant';
|
import { RelayDraw } from 'src/graphics/relay/RelayDrawAssistant';
|
||||||
|
import {
|
||||||
|
PhaseFailureProtector,
|
||||||
|
PhaseFailureProtectorTemplate,
|
||||||
|
} from 'src/graphics/phaseFailureProtector/PhaseFailureProtector';
|
||||||
|
import { PhaseFailureProtectorData } from './relayCabinetGraphics/PhaseFailureProtectorInteraction';
|
||||||
|
import { PhaseFailureProtectorDraw } from 'src/graphics/phaseFailureProtector/PhaseFailureProtectorDrawAssistant';
|
||||||
|
|
||||||
const UndoOptions: MenuItemOptions = {
|
const UndoOptions: MenuItemOptions = {
|
||||||
name: '撤销',
|
name: '撤销',
|
||||||
@ -70,6 +76,10 @@ export function initDrawApp(): IDrawApp {
|
|||||||
const app = drawApp;
|
const app = drawApp;
|
||||||
new RelayCabinetDraw(app, new RelayCabinetTemplate(new RelayCabinetData()));
|
new RelayCabinetDraw(app, new RelayCabinetTemplate(new RelayCabinetData()));
|
||||||
new RelayDraw(app, new RelayTemplate(new RelayData()));
|
new RelayDraw(app, new RelayTemplate(new RelayData()));
|
||||||
|
new PhaseFailureProtectorDraw(
|
||||||
|
app,
|
||||||
|
new PhaseFailureProtectorTemplate(new PhaseFailureProtectorData())
|
||||||
|
);
|
||||||
|
|
||||||
// 画布右键菜单
|
// 画布右键菜单
|
||||||
app.registerMenu(DefaultCanvasMenu);
|
app.registerMenu(DefaultCanvasMenu);
|
||||||
@ -112,6 +122,15 @@ export function initDrawApp(): IDrawApp {
|
|||||||
relays.forEach((relay) => {
|
relays.forEach((relay) => {
|
||||||
relay.refDevice.text = map.get(relay.id) as string;
|
relay.refDevice.text = map.get(relay.id) as string;
|
||||||
});
|
});
|
||||||
|
const phaseFailureProtectors =
|
||||||
|
app.queryStore.queryByType<PhaseFailureProtector>(
|
||||||
|
PhaseFailureProtector.Type
|
||||||
|
);
|
||||||
|
phaseFailureProtectors.forEach((phaseFailureProtector) => {
|
||||||
|
phaseFailureProtector.refDevice.text = map.get(
|
||||||
|
phaseFailureProtector.id
|
||||||
|
) as string;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
app.on('destroy', async () => {
|
app.on('destroy', async () => {
|
||||||
refRelaysList = [];
|
refRelaysList = [];
|
||||||
@ -179,6 +198,12 @@ export function saveDrawDatas(app: IDrawApp) {
|
|||||||
const relayData = (g as Relay).saveData();
|
const relayData = (g as Relay).saveData();
|
||||||
storage.relays.push((relayData as RelayData).data);
|
storage.relays.push((relayData as RelayData).data);
|
||||||
}
|
}
|
||||||
|
if (PhaseFailureProtector.Type === g.type) {
|
||||||
|
const phaseFailureProtectorData = (g as PhaseFailureProtector).saveData();
|
||||||
|
storage.phaseFailureProtectors.push(
|
||||||
|
(phaseFailureProtectorData as PhaseFailureProtectorData).data
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
storage.deviceRelateRelayList.push(...refRelaysList);
|
storage.deviceRelateRelayList.push(...refRelaysList);
|
||||||
storage.UniqueIdPrefix = UniqueIdPrefix;
|
storage.UniqueIdPrefix = UniqueIdPrefix;
|
||||||
@ -208,6 +233,9 @@ export async function loadDrawDatas(): Promise<IGraphicStorage> {
|
|||||||
storage.relays.forEach((relay) => {
|
storage.relays.forEach((relay) => {
|
||||||
datas.push(new RelayData(relay));
|
datas.push(new RelayData(relay));
|
||||||
});
|
});
|
||||||
|
storage.phaseFailureProtectors.forEach((phaseFailureProtector) => {
|
||||||
|
datas.push(new PhaseFailureProtectorData(phaseFailureProtector));
|
||||||
|
});
|
||||||
storage.deviceRelateRelayList.forEach((relay) => {
|
storage.deviceRelateRelayList.forEach((relay) => {
|
||||||
refRelaysList.push(relay);
|
refRelaysList.push(relay);
|
||||||
});
|
});
|
||||||
|
98
src/graphics/phaseFailureProtector/PhaseFailureProtector.ts
Normal file
98
src/graphics/phaseFailureProtector/PhaseFailureProtector.ts
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
import { Color, Graphics, Rectangle } from 'pixi.js';
|
||||||
|
import {
|
||||||
|
GraphicData,
|
||||||
|
JlGraphic,
|
||||||
|
JlGraphicTemplate,
|
||||||
|
VectorText,
|
||||||
|
getRectangleCenter,
|
||||||
|
} from 'src/jl-graphic';
|
||||||
|
|
||||||
|
export interface IPhaseFailureProtectorData extends GraphicData {
|
||||||
|
get code(): string; // 编号
|
||||||
|
set code(v: string);
|
||||||
|
clone(): IPhaseFailureProtectorData;
|
||||||
|
copyFrom(data: IPhaseFailureProtectorData): void;
|
||||||
|
eq(other: IPhaseFailureProtectorData): boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const phaseFailureProtectorConsts = {
|
||||||
|
width: 16,
|
||||||
|
height: 16,
|
||||||
|
lineWidth: 3,
|
||||||
|
lineColor: '0xff0000',
|
||||||
|
};
|
||||||
|
export class PhaseFailureProtector extends JlGraphic {
|
||||||
|
static Type = 'PhaseFailureProtector';
|
||||||
|
phaseFailureProtectorGraphic: Graphics = new Graphics();
|
||||||
|
labelGraphic = new VectorText();
|
||||||
|
refDevice = new VectorText();
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super(PhaseFailureProtector.Type);
|
||||||
|
this.addChild(this.phaseFailureProtectorGraphic);
|
||||||
|
this.setTextGraphic(this.labelGraphic, 'label');
|
||||||
|
this.setTextGraphic(this.refDevice, 'refDevice');
|
||||||
|
this.addChild(this.labelGraphic);
|
||||||
|
this.addChild(this.refDevice);
|
||||||
|
}
|
||||||
|
|
||||||
|
get datas(): IPhaseFailureProtectorData {
|
||||||
|
return this.getDatas<IPhaseFailureProtectorData>();
|
||||||
|
}
|
||||||
|
doRepaint(): void {
|
||||||
|
this.labelGraphic.text = this.datas.code;
|
||||||
|
const labelPosition = this.datas.childTransforms?.find(
|
||||||
|
(t) => t.name === this.labelGraphic.name
|
||||||
|
)?.transform.position;
|
||||||
|
if (labelPosition) {
|
||||||
|
this.labelGraphic.position.set(labelPosition.x, labelPosition.y);
|
||||||
|
} else {
|
||||||
|
this.labelGraphic.position.set(0, 20);
|
||||||
|
}
|
||||||
|
this.refDevice.position.set(0, -20);
|
||||||
|
const phaseFailureProtectorGraphic = this.phaseFailureProtectorGraphic;
|
||||||
|
phaseFailureProtectorGraphic
|
||||||
|
.clear()
|
||||||
|
.lineStyle(
|
||||||
|
phaseFailureProtectorConsts.lineWidth,
|
||||||
|
new Color(phaseFailureProtectorConsts.lineColor)
|
||||||
|
);
|
||||||
|
phaseFailureProtectorGraphic.beginFill(
|
||||||
|
phaseFailureProtectorConsts.lineColor
|
||||||
|
);
|
||||||
|
phaseFailureProtectorGraphic.drawRect(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
phaseFailureProtectorConsts.width,
|
||||||
|
phaseFailureProtectorConsts.height
|
||||||
|
);
|
||||||
|
const rectP = new Rectangle(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
phaseFailureProtectorConsts.width,
|
||||||
|
phaseFailureProtectorConsts.height
|
||||||
|
);
|
||||||
|
phaseFailureProtectorGraphic.pivot = getRectangleCenter(rectP);
|
||||||
|
phaseFailureProtectorGraphic.endFill;
|
||||||
|
}
|
||||||
|
setTextGraphic(g: VectorText, name: string) {
|
||||||
|
g.setVectorFontSize(10);
|
||||||
|
g.anchor.set(0.5);
|
||||||
|
g.style.fill = '#0f0';
|
||||||
|
g.transformSave = true;
|
||||||
|
g.name = name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class PhaseFailureProtectorTemplate extends JlGraphicTemplate<PhaseFailureProtector> {
|
||||||
|
constructor(dataTemplate: IPhaseFailureProtectorData) {
|
||||||
|
super(PhaseFailureProtector.Type, {
|
||||||
|
dataTemplate,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
new(): PhaseFailureProtector {
|
||||||
|
const relay = new PhaseFailureProtector();
|
||||||
|
relay.loadData(this.datas);
|
||||||
|
return relay;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,127 @@
|
|||||||
|
import { FederatedPointerEvent, Point } from 'pixi.js';
|
||||||
|
import {
|
||||||
|
AbsorbableLine,
|
||||||
|
AbsorbablePosition,
|
||||||
|
GraphicDrawAssistant,
|
||||||
|
GraphicInteractionPlugin,
|
||||||
|
IDrawApp,
|
||||||
|
JlGraphic,
|
||||||
|
} from 'src/jl-graphic';
|
||||||
|
|
||||||
|
import {
|
||||||
|
IPhaseFailureProtectorData,
|
||||||
|
PhaseFailureProtector,
|
||||||
|
PhaseFailureProtectorTemplate,
|
||||||
|
} from './PhaseFailureProtector';
|
||||||
|
import { Relay } from '../relay/Relay';
|
||||||
|
|
||||||
|
export interface IPhaseFailureProtectorDrawOptions {
|
||||||
|
newData: () => IPhaseFailureProtectorData;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class PhaseFailureProtectorDraw extends GraphicDrawAssistant<
|
||||||
|
PhaseFailureProtectorTemplate,
|
||||||
|
IPhaseFailureProtectorData
|
||||||
|
> {
|
||||||
|
phaseFailureProtectorGraphic: PhaseFailureProtector;
|
||||||
|
|
||||||
|
constructor(app: IDrawApp, template: PhaseFailureProtectorTemplate) {
|
||||||
|
super(app, template, 'sym_o_square', '断相保护器PhaseFailureProtector');
|
||||||
|
this.phaseFailureProtectorGraphic = this.graphicTemplate.new();
|
||||||
|
this.container.addChild(this.phaseFailureProtectorGraphic);
|
||||||
|
phaseFailureProtectorInteraction.init(app);
|
||||||
|
}
|
||||||
|
bind(): void {
|
||||||
|
super.bind();
|
||||||
|
this.phaseFailureProtectorGraphic.loadData(this.graphicTemplate.datas);
|
||||||
|
this.phaseFailureProtectorGraphic.doRepaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
clearCache(): void {
|
||||||
|
//this.phaseFailureProtectorGraphic.clear();
|
||||||
|
}
|
||||||
|
onLeftDown(e: FederatedPointerEvent): void {
|
||||||
|
this.container.position.copyFrom(this.toCanvasCoordinates(e.global));
|
||||||
|
this.createAndStore(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
redraw(p: Point): void {
|
||||||
|
this.container.position.copyFrom(p);
|
||||||
|
}
|
||||||
|
prepareData(data: IPhaseFailureProtectorData): boolean {
|
||||||
|
data.transform = this.container.saveTransform();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建吸附位置
|
||||||
|
* @param polygon
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
function buildAbsorbablePositions(
|
||||||
|
phaseFailureProtectorCabinet: PhaseFailureProtector
|
||||||
|
): AbsorbablePosition[] {
|
||||||
|
const aps: AbsorbablePosition[] = [];
|
||||||
|
const relays = phaseFailureProtectorCabinet.queryStore.queryByType<Relay>(
|
||||||
|
Relay.Type
|
||||||
|
);
|
||||||
|
const phaseFailureProtectorCabinets =
|
||||||
|
phaseFailureProtectorCabinet.queryStore.queryByType<PhaseFailureProtector>(
|
||||||
|
PhaseFailureProtector.Type
|
||||||
|
);
|
||||||
|
const { width, height } = phaseFailureProtectorCabinet.getGraphicApp().canvas;
|
||||||
|
relays.forEach((relay) => {
|
||||||
|
const ps = relay.position;
|
||||||
|
const xs = new AbsorbableLine({ x: 0, y: ps.y }, { x: width, y: ps.y });
|
||||||
|
const ys = new AbsorbableLine({ x: ps.x, y: 0 }, { x: ps.x, y: height });
|
||||||
|
aps.push(xs, ys);
|
||||||
|
});
|
||||||
|
phaseFailureProtectorCabinets.forEach((other) => {
|
||||||
|
if (other.id == phaseFailureProtectorCabinet.id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const ps = other.position;
|
||||||
|
const xs = new AbsorbableLine({ x: 0, y: ps.y }, { x: width, y: ps.y });
|
||||||
|
const ys = new AbsorbableLine({ x: ps.x, y: 0 }, { x: ps.x, y: height });
|
||||||
|
aps.push(xs, ys);
|
||||||
|
});
|
||||||
|
return aps;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class phaseFailureProtectorInteraction extends GraphicInteractionPlugin<PhaseFailureProtector> {
|
||||||
|
static Name = 'phaseFailureProtector_transform';
|
||||||
|
constructor(app: IDrawApp) {
|
||||||
|
super(phaseFailureProtectorInteraction.Name, app);
|
||||||
|
}
|
||||||
|
static init(app: IDrawApp) {
|
||||||
|
return new phaseFailureProtectorInteraction(app);
|
||||||
|
}
|
||||||
|
filter(...grahpics: JlGraphic[]): PhaseFailureProtector[] | undefined {
|
||||||
|
return grahpics
|
||||||
|
.filter((g) => g.type === PhaseFailureProtector.Type)
|
||||||
|
.map((g) => g as PhaseFailureProtector);
|
||||||
|
}
|
||||||
|
bind(g: PhaseFailureProtector): void {
|
||||||
|
g.eventMode = 'static';
|
||||||
|
g.cursor = 'pointer';
|
||||||
|
g.labelGraphic.eventMode = 'static';
|
||||||
|
g.labelGraphic.selectable = true;
|
||||||
|
g.labelGraphic.draggable = true;
|
||||||
|
g.on('transformstart', this.move, this);
|
||||||
|
}
|
||||||
|
unbind(g: PhaseFailureProtector): void {
|
||||||
|
g.eventMode = 'none';
|
||||||
|
g.labelGraphic.eventMode = 'none';
|
||||||
|
g.labelGraphic.selectable = false;
|
||||||
|
g.labelGraphic.draggable = false;
|
||||||
|
g.off('transformstart', this.move, this);
|
||||||
|
}
|
||||||
|
move(): void {
|
||||||
|
const phaseFailureProtector = this.app
|
||||||
|
.selectedGraphics[0] as PhaseFailureProtector;
|
||||||
|
this.app.setOptions({
|
||||||
|
absorbablePositions: buildAbsorbablePositions(phaseFailureProtector),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -9,8 +9,6 @@ import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics';
|
|||||||
export interface IRelayData extends GraphicData {
|
export interface IRelayData extends GraphicData {
|
||||||
get code(): string; // 编号
|
get code(): string; // 编号
|
||||||
set code(v: string);
|
set code(v: string);
|
||||||
get model(): string; // 型号
|
|
||||||
set model(v: string);
|
|
||||||
get newModel(): relayCabinetGraphicData.Relay.ModelType; // 计轴、区段边界
|
get newModel(): relayCabinetGraphicData.Relay.ModelType; // 计轴、区段边界
|
||||||
set newModel(v: relayCabinetGraphicData.Relay.ModelType);
|
set newModel(v: relayCabinetGraphicData.Relay.ModelType);
|
||||||
clone(): IRelayData;
|
clone(): IRelayData;
|
||||||
|
@ -53,9 +53,9 @@ export class RelayDraw extends GraphicDrawAssistant<RelayTemplate, IRelayData> {
|
|||||||
*/
|
*/
|
||||||
function buildAbsorbablePositions(relayCabinet: Relay): AbsorbablePosition[] {
|
function buildAbsorbablePositions(relayCabinet: Relay): AbsorbablePosition[] {
|
||||||
const aps: AbsorbablePosition[] = [];
|
const aps: AbsorbablePosition[] = [];
|
||||||
const relayCabinets = relayCabinet.queryStore.queryByType<Relay>(Relay.Type);
|
const relays = relayCabinet.queryStore.queryByType<Relay>(Relay.Type);
|
||||||
const { width, height } = relayCabinet.getGraphicApp().canvas;
|
const { width, height } = relayCabinet.getGraphicApp().canvas;
|
||||||
relayCabinets.forEach((other) => {
|
relays.forEach((other) => {
|
||||||
if (other.id == relayCabinet.id) {
|
if (other.id == relayCabinet.id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -185,6 +185,7 @@ import { ApiError } from 'src/boot/axios';
|
|||||||
import { DialogChainObject, useQuasar } from 'quasar';
|
import { DialogChainObject, useQuasar } from 'quasar';
|
||||||
import { Relay } from 'src/graphics/relay/Relay';
|
import { Relay } from 'src/graphics/relay/Relay';
|
||||||
import { RelayCabinet } from 'src/graphics/relayCabinet/RelayCabinet';
|
import { RelayCabinet } from 'src/graphics/relayCabinet/RelayCabinet';
|
||||||
|
import { PhaseFailureProtector } from 'src/graphics/phaseFailureProtector/PhaseFailureProtector';
|
||||||
import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics';
|
import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics';
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
@ -264,7 +265,11 @@ onMounted(() => {
|
|||||||
} else {
|
} else {
|
||||||
relayCabinetStore.setDraftId(null);
|
relayCabinetStore.setDraftId(null);
|
||||||
}
|
}
|
||||||
const drawAssistantsTypes = [Relay.Type, RelayCabinet.Type];
|
const drawAssistantsTypes = [
|
||||||
|
RelayCabinet.Type,
|
||||||
|
Relay.Type,
|
||||||
|
PhaseFailureProtector.Type,
|
||||||
|
];
|
||||||
drawAssistantsTypes.forEach((type) => {
|
drawAssistantsTypes.forEach((type) => {
|
||||||
const drawAssistant = getDrawApp()?.getDrawAssistant(type);
|
const drawAssistant = getDrawApp()?.getDrawAssistant(type);
|
||||||
if (drawAssistant) {
|
if (drawAssistant) {
|
||||||
|
@ -14,9 +14,11 @@ export namespace relayCabinetGraphicData {
|
|||||||
relays?: Relay[];
|
relays?: Relay[];
|
||||||
deviceRelateRelayList?: DeviceRelateRelay[];
|
deviceRelateRelayList?: DeviceRelateRelay[];
|
||||||
UniqueIdPrefix?: UniqueIdType;
|
UniqueIdPrefix?: UniqueIdType;
|
||||||
|
phaseFailureProtectors?: PhaseFailureProtector[];
|
||||||
|
combinationtypeList?: Combinationtype[];
|
||||||
}) {
|
}) {
|
||||||
super();
|
super();
|
||||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4], this.#one_of_decls);
|
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 7, 8], this.#one_of_decls);
|
||||||
if (!Array.isArray(data) && typeof data == "object") {
|
if (!Array.isArray(data) && typeof data == "object") {
|
||||||
if ("canvas" in data && data.canvas != undefined) {
|
if ("canvas" in data && data.canvas != undefined) {
|
||||||
this.canvas = data.canvas;
|
this.canvas = data.canvas;
|
||||||
@ -33,6 +35,12 @@ export namespace relayCabinetGraphicData {
|
|||||||
if ("UniqueIdPrefix" in data && data.UniqueIdPrefix != undefined) {
|
if ("UniqueIdPrefix" in data && data.UniqueIdPrefix != undefined) {
|
||||||
this.UniqueIdPrefix = data.UniqueIdPrefix;
|
this.UniqueIdPrefix = data.UniqueIdPrefix;
|
||||||
}
|
}
|
||||||
|
if ("phaseFailureProtectors" in data && data.phaseFailureProtectors != undefined) {
|
||||||
|
this.phaseFailureProtectors = data.phaseFailureProtectors;
|
||||||
|
}
|
||||||
|
if ("combinationtypeList" in data && data.combinationtypeList != undefined) {
|
||||||
|
this.combinationtypeList = data.combinationtypeList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
get canvas() {
|
get canvas() {
|
||||||
@ -71,12 +79,26 @@ export namespace relayCabinetGraphicData {
|
|||||||
get has_UniqueIdPrefix() {
|
get has_UniqueIdPrefix() {
|
||||||
return pb_1.Message.getField(this, 6) != null;
|
return pb_1.Message.getField(this, 6) != null;
|
||||||
}
|
}
|
||||||
|
get phaseFailureProtectors() {
|
||||||
|
return pb_1.Message.getRepeatedWrapperField(this, PhaseFailureProtector, 7) as PhaseFailureProtector[];
|
||||||
|
}
|
||||||
|
set phaseFailureProtectors(value: PhaseFailureProtector[]) {
|
||||||
|
pb_1.Message.setRepeatedWrapperField(this, 7, value);
|
||||||
|
}
|
||||||
|
get combinationtypeList() {
|
||||||
|
return pb_1.Message.getRepeatedWrapperField(this, Combinationtype, 8) as Combinationtype[];
|
||||||
|
}
|
||||||
|
set combinationtypeList(value: Combinationtype[]) {
|
||||||
|
pb_1.Message.setRepeatedWrapperField(this, 8, value);
|
||||||
|
}
|
||||||
static fromObject(data: {
|
static fromObject(data: {
|
||||||
canvas?: ReturnType<typeof dependency_1.graphicData.Canvas.prototype.toObject>;
|
canvas?: ReturnType<typeof dependency_1.graphicData.Canvas.prototype.toObject>;
|
||||||
relayCabinets?: ReturnType<typeof RelayCabinet.prototype.toObject>[];
|
relayCabinets?: ReturnType<typeof RelayCabinet.prototype.toObject>[];
|
||||||
relays?: ReturnType<typeof Relay.prototype.toObject>[];
|
relays?: ReturnType<typeof Relay.prototype.toObject>[];
|
||||||
deviceRelateRelayList?: ReturnType<typeof DeviceRelateRelay.prototype.toObject>[];
|
deviceRelateRelayList?: ReturnType<typeof DeviceRelateRelay.prototype.toObject>[];
|
||||||
UniqueIdPrefix?: ReturnType<typeof UniqueIdType.prototype.toObject>;
|
UniqueIdPrefix?: ReturnType<typeof UniqueIdType.prototype.toObject>;
|
||||||
|
phaseFailureProtectors?: ReturnType<typeof PhaseFailureProtector.prototype.toObject>[];
|
||||||
|
combinationtypeList?: ReturnType<typeof Combinationtype.prototype.toObject>[];
|
||||||
}): RelayCabinetGraphicStorage {
|
}): RelayCabinetGraphicStorage {
|
||||||
const message = new RelayCabinetGraphicStorage({});
|
const message = new RelayCabinetGraphicStorage({});
|
||||||
if (data.canvas != null) {
|
if (data.canvas != null) {
|
||||||
@ -94,6 +116,12 @@ export namespace relayCabinetGraphicData {
|
|||||||
if (data.UniqueIdPrefix != null) {
|
if (data.UniqueIdPrefix != null) {
|
||||||
message.UniqueIdPrefix = UniqueIdType.fromObject(data.UniqueIdPrefix);
|
message.UniqueIdPrefix = UniqueIdType.fromObject(data.UniqueIdPrefix);
|
||||||
}
|
}
|
||||||
|
if (data.phaseFailureProtectors != null) {
|
||||||
|
message.phaseFailureProtectors = data.phaseFailureProtectors.map(item => PhaseFailureProtector.fromObject(item));
|
||||||
|
}
|
||||||
|
if (data.combinationtypeList != null) {
|
||||||
|
message.combinationtypeList = data.combinationtypeList.map(item => Combinationtype.fromObject(item));
|
||||||
|
}
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
toObject() {
|
toObject() {
|
||||||
@ -103,6 +131,8 @@ export namespace relayCabinetGraphicData {
|
|||||||
relays?: ReturnType<typeof Relay.prototype.toObject>[];
|
relays?: ReturnType<typeof Relay.prototype.toObject>[];
|
||||||
deviceRelateRelayList?: ReturnType<typeof DeviceRelateRelay.prototype.toObject>[];
|
deviceRelateRelayList?: ReturnType<typeof DeviceRelateRelay.prototype.toObject>[];
|
||||||
UniqueIdPrefix?: ReturnType<typeof UniqueIdType.prototype.toObject>;
|
UniqueIdPrefix?: ReturnType<typeof UniqueIdType.prototype.toObject>;
|
||||||
|
phaseFailureProtectors?: ReturnType<typeof PhaseFailureProtector.prototype.toObject>[];
|
||||||
|
combinationtypeList?: ReturnType<typeof Combinationtype.prototype.toObject>[];
|
||||||
} = {};
|
} = {};
|
||||||
if (this.canvas != null) {
|
if (this.canvas != null) {
|
||||||
data.canvas = this.canvas.toObject();
|
data.canvas = this.canvas.toObject();
|
||||||
@ -119,6 +149,12 @@ export namespace relayCabinetGraphicData {
|
|||||||
if (this.UniqueIdPrefix != null) {
|
if (this.UniqueIdPrefix != null) {
|
||||||
data.UniqueIdPrefix = this.UniqueIdPrefix.toObject();
|
data.UniqueIdPrefix = this.UniqueIdPrefix.toObject();
|
||||||
}
|
}
|
||||||
|
if (this.phaseFailureProtectors != null) {
|
||||||
|
data.phaseFailureProtectors = this.phaseFailureProtectors.map((item: PhaseFailureProtector) => item.toObject());
|
||||||
|
}
|
||||||
|
if (this.combinationtypeList != null) {
|
||||||
|
data.combinationtypeList = this.combinationtypeList.map((item: Combinationtype) => item.toObject());
|
||||||
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
serialize(): Uint8Array;
|
serialize(): Uint8Array;
|
||||||
@ -135,6 +171,10 @@ export namespace relayCabinetGraphicData {
|
|||||||
writer.writeRepeatedMessage(4, this.deviceRelateRelayList, (item: DeviceRelateRelay) => item.serialize(writer));
|
writer.writeRepeatedMessage(4, this.deviceRelateRelayList, (item: DeviceRelateRelay) => item.serialize(writer));
|
||||||
if (this.has_UniqueIdPrefix)
|
if (this.has_UniqueIdPrefix)
|
||||||
writer.writeMessage(6, this.UniqueIdPrefix, () => this.UniqueIdPrefix.serialize(writer));
|
writer.writeMessage(6, this.UniqueIdPrefix, () => this.UniqueIdPrefix.serialize(writer));
|
||||||
|
if (this.phaseFailureProtectors.length)
|
||||||
|
writer.writeRepeatedMessage(7, this.phaseFailureProtectors, (item: PhaseFailureProtector) => item.serialize(writer));
|
||||||
|
if (this.combinationtypeList.length)
|
||||||
|
writer.writeRepeatedMessage(8, this.combinationtypeList, (item: Combinationtype) => item.serialize(writer));
|
||||||
if (!w)
|
if (!w)
|
||||||
return writer.getResultBuffer();
|
return writer.getResultBuffer();
|
||||||
}
|
}
|
||||||
@ -159,6 +199,12 @@ export namespace relayCabinetGraphicData {
|
|||||||
case 6:
|
case 6:
|
||||||
reader.readMessage(message.UniqueIdPrefix, () => message.UniqueIdPrefix = UniqueIdType.deserialize(reader));
|
reader.readMessage(message.UniqueIdPrefix, () => message.UniqueIdPrefix = UniqueIdType.deserialize(reader));
|
||||||
break;
|
break;
|
||||||
|
case 7:
|
||||||
|
reader.readMessage(message.phaseFailureProtectors, () => pb_1.Message.addToRepeatedWrapperField(message, 7, PhaseFailureProtector.deserialize(reader), PhaseFailureProtector));
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
reader.readMessage(message.combinationtypeList, () => pb_1.Message.addToRepeatedWrapperField(message, 8, Combinationtype.deserialize(reader), Combinationtype));
|
||||||
|
break;
|
||||||
default: reader.skipField();
|
default: reader.skipField();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -393,6 +439,99 @@ export namespace relayCabinetGraphicData {
|
|||||||
JZXC_H18 = 8
|
JZXC_H18 = 8
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
export class PhaseFailureProtector extends pb_1.Message {
|
||||||
|
#one_of_decls: number[][] = [];
|
||||||
|
constructor(data?: any[] | {
|
||||||
|
common?: dependency_1.graphicData.CommonInfo;
|
||||||
|
code?: string;
|
||||||
|
}) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
get common() {
|
||||||
|
return pb_1.Message.getWrapperField(this, dependency_1.graphicData.CommonInfo, 1) as dependency_1.graphicData.CommonInfo;
|
||||||
|
}
|
||||||
|
set common(value: dependency_1.graphicData.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);
|
||||||
|
}
|
||||||
|
static fromObject(data: {
|
||||||
|
common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>;
|
||||||
|
code?: string;
|
||||||
|
}): PhaseFailureProtector {
|
||||||
|
const message = new PhaseFailureProtector({});
|
||||||
|
if (data.common != null) {
|
||||||
|
message.common = dependency_1.graphicData.CommonInfo.fromObject(data.common);
|
||||||
|
}
|
||||||
|
if (data.code != null) {
|
||||||
|
message.code = data.code;
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
toObject() {
|
||||||
|
const data: {
|
||||||
|
common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>;
|
||||||
|
code?: string;
|
||||||
|
} = {};
|
||||||
|
if (this.common != null) {
|
||||||
|
data.common = this.common.toObject();
|
||||||
|
}
|
||||||
|
if (this.code != null) {
|
||||||
|
data.code = this.code;
|
||||||
|
}
|
||||||
|
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 (!w)
|
||||||
|
return writer.getResultBuffer();
|
||||||
|
}
|
||||||
|
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): PhaseFailureProtector {
|
||||||
|
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new PhaseFailureProtector();
|
||||||
|
while (reader.nextField()) {
|
||||||
|
if (reader.isEndGroup())
|
||||||
|
break;
|
||||||
|
switch (reader.getFieldNumber()) {
|
||||||
|
case 1:
|
||||||
|
reader.readMessage(message.common, () => message.common = dependency_1.graphicData.CommonInfo.deserialize(reader));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
message.code = reader.readString();
|
||||||
|
break;
|
||||||
|
default: reader.skipField();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
serializeBinary(): Uint8Array {
|
||||||
|
return this.serialize();
|
||||||
|
}
|
||||||
|
static deserializeBinary(bytes: Uint8Array): PhaseFailureProtector {
|
||||||
|
return PhaseFailureProtector.deserialize(bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
export class DeviceRelateRelay extends pb_1.Message {
|
export class DeviceRelateRelay extends pb_1.Message {
|
||||||
#one_of_decls: number[][] = [];
|
#one_of_decls: number[][] = [];
|
||||||
constructor(data?: any[] | {
|
constructor(data?: any[] | {
|
||||||
|
Loading…
Reference in New Issue
Block a user