Merge branch 'master' of https://git.code.tencent.com/xian-ncc-da/xian-ncc-da-client
This commit is contained in:
commit
ddbf5936be
@ -81,6 +81,9 @@
|
||||
<axle-counting-property
|
||||
v-else-if="drawStore.selectedGraphicType === AxleCounting.Type"
|
||||
></axle-counting-property>
|
||||
<separator-property
|
||||
v-else-if="drawStore.selectedGraphicType === Separator.Type"
|
||||
></separator-property>
|
||||
</q-card-section>
|
||||
</template>
|
||||
</q-card>
|
||||
@ -108,12 +111,13 @@ import TurnoutProperty from './properties/TurnoutProperty.vue';
|
||||
import SectionProperty from './properties/SectionProperty.vue';
|
||||
import RunLineProperty from './properties/RunLineProperty.vue';
|
||||
import PathLineProperty from './properties/PathLineProperty.vue';
|
||||
import SeparatorProperty from './properties/SeparatorProperty.vue';
|
||||
import { Link } from 'src/graphics/link/Link';
|
||||
import { Rect } from 'src/graphics/rect/Rect';
|
||||
import { Platform } from 'src/graphics/platform/Platform';
|
||||
import { Station } from 'src/graphics/station/Station';
|
||||
import { StationLine } from 'src/graphics/stationLine/StationLine';
|
||||
import { Train } from 'src/graphics/train/Train';
|
||||
// import { Train } from 'src/graphics/train/Train';
|
||||
import { useDrawStore } from 'src/stores/draw-store';
|
||||
import { IscsFan } from 'src/graphics/iscs-fan/IscsFan';
|
||||
import { Signal } from 'src/graphics/signal/Signal';
|
||||
@ -123,6 +127,7 @@ import { Section } from 'src/graphics/section/Section';
|
||||
import { TrainWindow } from 'src/graphics/trainWindow/TrainWindow';
|
||||
import { PathLine } from 'src/graphics/pathLine/PathLine';
|
||||
import { AxleCounting } from 'src/graphics/axleCounting/AxleCounting';
|
||||
import { Separator } from 'src/graphics/separator/Separator';
|
||||
|
||||
const drawStore = useDrawStore();
|
||||
</script>
|
||||
|
@ -16,14 +16,23 @@
|
||||
lazy-rules
|
||||
autogrow
|
||||
/>
|
||||
<q-select
|
||||
outlined
|
||||
style="margin-top: 10px"
|
||||
v-model="kilometerSystem.coordinateSystem"
|
||||
:options="CoordinateSystemOptions"
|
||||
:map-options="true"
|
||||
:emit-value="true"
|
||||
@update:model-value="onUpdate"
|
||||
label="坐标系"
|
||||
></q-select>
|
||||
<q-input
|
||||
outlined
|
||||
label="公里标"
|
||||
type="textarea"
|
||||
style="margin-top: 10px"
|
||||
v-model.number="kilometerSystem.kilometer"
|
||||
type="number"
|
||||
@blur="onUpdate"
|
||||
v-model="axleCountingModel.kilometerCode"
|
||||
lazy-rules
|
||||
autogrow
|
||||
label="公里标(mm):"
|
||||
/>
|
||||
<q-list bordered separator class="rounded-borders">
|
||||
<q-item>
|
||||
@ -72,6 +81,13 @@ import { computed, onMounted, reactive, watch } from 'vue';
|
||||
|
||||
const drawStore = useDrawStore();
|
||||
const axleCountingModel = reactive(new AxleCountingData());
|
||||
const kilometerSystem = reactive({ coordinateSystem: '', kilometer: 0 });
|
||||
|
||||
const CoordinateSystemOptions = [
|
||||
{ label: '车辆段', value: 'DEPOT' },
|
||||
{ label: '停车场', value: 'PARKING_LOT' },
|
||||
{ label: '正线', value: 'MAIN_LINE' },
|
||||
];
|
||||
|
||||
drawStore.$subscribe;
|
||||
watch(
|
||||
@ -79,6 +95,11 @@ watch(
|
||||
(val) => {
|
||||
if (val && val.type == AxleCounting.Type) {
|
||||
axleCountingModel.copyFrom(val.saveData() as AxleCountingData);
|
||||
if (axleCountingModel.kilometerSystem) {
|
||||
kilometerSystem.coordinateSystem =
|
||||
axleCountingModel.kilometerSystem.coordinateSystem;
|
||||
kilometerSystem.kilometer = axleCountingModel.kilometerSystem.kilometer;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
@ -87,11 +108,20 @@ onMounted(() => {
|
||||
const axleCounting = drawStore.selectedGraphic as AxleCounting;
|
||||
if (axleCounting) {
|
||||
axleCountingModel.copyFrom(axleCounting.saveData());
|
||||
if (axleCountingModel.kilometerSystem) {
|
||||
kilometerSystem.coordinateSystem =
|
||||
axleCountingModel.kilometerSystem.coordinateSystem;
|
||||
kilometerSystem.kilometer = axleCountingModel.kilometerSystem.kilometer;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function onUpdate() {
|
||||
const axleCounting = drawStore.selectedGraphic as AxleCounting;
|
||||
axleCountingModel.kilometerSystem = {
|
||||
coordinateSystem: kilometerSystem.coordinateSystem,
|
||||
kilometer: kilometerSystem.kilometer,
|
||||
};
|
||||
if (axleCounting) {
|
||||
drawStore
|
||||
.getDrawApp()
|
||||
|
63
src/components/draw-app/properties/SeparatorProperty.vue
Normal file
63
src/components/draw-app/properties/SeparatorProperty.vue
Normal file
@ -0,0 +1,63 @@
|
||||
<template>
|
||||
<q-form>
|
||||
<q-input outlined readonly v-model="separatorModel.id" label="id" hint="" />
|
||||
|
||||
<q-select
|
||||
v-if="showType"
|
||||
outlined
|
||||
style="margin-top: 10px"
|
||||
v-model="separatorModel.separatorType"
|
||||
:options="typeOptions"
|
||||
:map-options="true"
|
||||
:emit-value="true"
|
||||
@update:model-value="onUpdate"
|
||||
label="分隔符方向"
|
||||
></q-select>
|
||||
</q-form>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { SeparatorData } from 'src/drawApp/graphics/SeparatorInteraction';
|
||||
import { Separator } from 'src/graphics/separator/Separator';
|
||||
import { useDrawStore } from 'src/stores/draw-store';
|
||||
import { computed, onMounted, reactive, watch } from 'vue';
|
||||
|
||||
const drawStore = useDrawStore();
|
||||
const separatorModel = reactive(new SeparatorData());
|
||||
|
||||
const typeOptions = [
|
||||
{ label: '左方向', value: 'endA' },
|
||||
{ label: '右方向', value: 'endB' },
|
||||
];
|
||||
|
||||
const showType = computed(() => {
|
||||
const find = typeOptions.find((item) => {
|
||||
return item.value == separatorModel.separatorType;
|
||||
});
|
||||
return !!find;
|
||||
});
|
||||
|
||||
drawStore.$subscribe;
|
||||
watch(
|
||||
() => drawStore.selectedGraphic,
|
||||
(val) => {
|
||||
if (val && val.type == Separator.Type) {
|
||||
separatorModel.copyFrom(val.saveData() as SeparatorData);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
const Separator = drawStore.selectedGraphic as Separator;
|
||||
if (Separator) {
|
||||
separatorModel.copyFrom(Separator.saveData());
|
||||
}
|
||||
});
|
||||
|
||||
function onUpdate() {
|
||||
const Separator = drawStore.selectedGraphic as Separator;
|
||||
if (Separator) {
|
||||
drawStore.getDrawApp().updateGraphicAndRecord(Separator, separatorModel);
|
||||
}
|
||||
}
|
||||
</script>
|
@ -10,14 +10,23 @@
|
||||
lazy-rules
|
||||
autogrow
|
||||
/>
|
||||
<q-select
|
||||
outlined
|
||||
style="margin-top: 10px"
|
||||
v-model="kilometerSystem.coordinateSystem"
|
||||
:options="CoordinateSystemOptions"
|
||||
:map-options="true"
|
||||
:emit-value="true"
|
||||
@update:model-value="onUpdate"
|
||||
label="坐标系"
|
||||
></q-select>
|
||||
<q-input
|
||||
outlined
|
||||
label="公里标"
|
||||
type="textarea"
|
||||
style="margin-top: 10px"
|
||||
v-model.number="kilometerSystem.kilometer"
|
||||
type="number"
|
||||
@blur="onUpdate"
|
||||
v-model="stationModel.kilometerCode"
|
||||
lazy-rules
|
||||
autogrow
|
||||
label="公里标(mm):"
|
||||
/>
|
||||
<q-select
|
||||
outlined
|
||||
@ -55,6 +64,13 @@ enum showSelectData {
|
||||
true = '是',
|
||||
false = '否',
|
||||
}
|
||||
const kilometerSystem = reactive({ coordinateSystem: '', kilometer: 0 });
|
||||
|
||||
const CoordinateSystemOptions = [
|
||||
{ label: '车辆段', value: 'DEPOT' },
|
||||
{ label: '停车场', value: 'PARKING_LOT' },
|
||||
{ label: '正线', value: 'MAIN_LINE' },
|
||||
];
|
||||
|
||||
drawStore.$subscribe;
|
||||
watch(
|
||||
@ -68,6 +84,11 @@ watch(
|
||||
concentrationStations.value = (showSelectData as never)[
|
||||
stationModel.concentrationStations + ''
|
||||
];
|
||||
if (stationModel.kilometerSystem) {
|
||||
kilometerSystem.coordinateSystem =
|
||||
stationModel.kilometerSystem.coordinateSystem;
|
||||
kilometerSystem.kilometer = stationModel.kilometerSystem.kilometer;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
@ -80,6 +101,11 @@ onMounted(() => {
|
||||
concentrationStations.value = (showSelectData as never)[
|
||||
stationModel.concentrationStations + ''
|
||||
];
|
||||
if (stationModel.kilometerSystem) {
|
||||
kilometerSystem.coordinateSystem =
|
||||
stationModel.kilometerSystem.coordinateSystem;
|
||||
kilometerSystem.kilometer = stationModel.kilometerSystem.kilometer;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -88,6 +114,10 @@ function onUpdate() {
|
||||
stationModel.concentrationStations = JSON.parse(
|
||||
(showSelect as never)[concentrationStations.value]
|
||||
);
|
||||
stationModel.kilometerSystem = {
|
||||
coordinateSystem: kilometerSystem.coordinateSystem,
|
||||
kilometer: kilometerSystem.kilometer,
|
||||
};
|
||||
const station = drawStore.selectedGraphic as Station;
|
||||
if (station) {
|
||||
drawStore.getDrawApp().updateGraphicAndRecord(station, stationModel);
|
||||
|
@ -5,6 +5,7 @@ import {
|
||||
} from 'src/graphics/axleCounting/AxleCounting';
|
||||
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
||||
import { GraphicDataBase } from './GraphicDataBase';
|
||||
import { KilometerSystem } from 'src/graphics/signal/Signal';
|
||||
|
||||
export class AxleCountingData
|
||||
extends GraphicDataBase
|
||||
@ -31,17 +32,17 @@ export class AxleCountingData
|
||||
set code(v: string) {
|
||||
this.data.code = v;
|
||||
}
|
||||
get kilometerCode(): string {
|
||||
return this.data.kilometerCode;
|
||||
get kilometerSystem(): KilometerSystem {
|
||||
return this.data.kilometerSystem;
|
||||
}
|
||||
set kilometerCode(v: string) {
|
||||
this.data.kilometerCode = v;
|
||||
set kilometerSystem(v: KilometerSystem) {
|
||||
this.data.kilometerSystem = new graphicData.KilometerSystem(v);
|
||||
}
|
||||
get axleCountingRef(): graphicData.RelatedRef[] {
|
||||
return this.data.axleCountingRef;
|
||||
}
|
||||
set axleCountingRef(points: graphicData.RelatedRef[]) {
|
||||
this.data.axleCountingRef=points
|
||||
this.data.axleCountingRef = points;
|
||||
}
|
||||
clone(): AxleCountingData {
|
||||
return new AxleCountingData(this.data.cloneMessage());
|
||||
|
43
src/drawApp/graphics/SeparatorInteraction.ts
Normal file
43
src/drawApp/graphics/SeparatorInteraction.ts
Normal file
@ -0,0 +1,43 @@
|
||||
import * as pb_1 from 'google-protobuf';
|
||||
import { ISeparatorData, Separator } from 'src/graphics/separator/Separator';
|
||||
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
||||
import { GraphicDataBase } from './GraphicDataBase';
|
||||
|
||||
export class SeparatorData extends GraphicDataBase implements ISeparatorData {
|
||||
constructor(data?: graphicData.Separator) {
|
||||
let separator;
|
||||
if (!data) {
|
||||
separator = new graphicData.Separator({
|
||||
common: GraphicDataBase.defaultCommonInfo(Separator.Type),
|
||||
});
|
||||
} else {
|
||||
separator = data;
|
||||
}
|
||||
super(separator);
|
||||
}
|
||||
|
||||
public get data(): graphicData.Separator {
|
||||
return this.getData<graphicData.Separator>();
|
||||
}
|
||||
get code(): string {
|
||||
return this.data.code;
|
||||
}
|
||||
set code(v: string) {
|
||||
this.data.code = v;
|
||||
}
|
||||
get separatorType(): string {
|
||||
return this.data.separatorType;
|
||||
}
|
||||
set separatorType(v: string) {
|
||||
this.data.separatorType = v;
|
||||
}
|
||||
clone(): SeparatorData {
|
||||
return new SeparatorData(this.data.cloneMessage());
|
||||
}
|
||||
copyFrom(data: SeparatorData): void {
|
||||
pb_1.Message.copyInto(data.data, this.data);
|
||||
}
|
||||
eq(other: SeparatorData): boolean {
|
||||
return pb_1.Message.equals(this.data, other.data);
|
||||
}
|
||||
}
|
@ -15,6 +15,7 @@ import {
|
||||
JlGraphic,
|
||||
} from 'src/jl-graphic';
|
||||
import { DisplayObject, FederatedMouseEvent } from 'pixi.js';
|
||||
import { KilometerSystem } from 'src/graphics/signal/Signal';
|
||||
|
||||
export class StationData extends GraphicDataBase implements IStationData {
|
||||
constructor(data?: graphicData.Station) {
|
||||
@ -38,11 +39,11 @@ export class StationData extends GraphicDataBase implements IStationData {
|
||||
set code(v: string) {
|
||||
this.data.code = v;
|
||||
}
|
||||
get kilometerCode(): string {
|
||||
return this.data.kilometerCode;
|
||||
get kilometerSystem(): KilometerSystem {
|
||||
return this.data.kilometerSystem;
|
||||
}
|
||||
set kilometerCode(v: string) {
|
||||
this.data.kilometerCode = v;
|
||||
set kilometerSystem(v: KilometerSystem) {
|
||||
this.data.kilometerSystem = new graphicData.KilometerSystem(v);
|
||||
}
|
||||
get hasControl(): boolean {
|
||||
return this.data.hasControl;
|
||||
@ -164,12 +165,10 @@ export class StationOperateInteraction extends GraphicInteractionPlugin<Station>
|
||||
powerUnlockConfig.handler = () => {
|
||||
station.states.ipRtuStusInLocalCtrl = true;
|
||||
station.doRepaint();
|
||||
console.log(2222);
|
||||
};
|
||||
chainConfig.handler = () => {
|
||||
station.states.ipRtuStusDown = true;
|
||||
station.doRepaint();
|
||||
console.log(2222);
|
||||
};
|
||||
removeChainConfig.handler = () => {
|
||||
console.log(2222);
|
||||
|
@ -4,6 +4,14 @@ import { graphicData } from 'src/protos/stationLayoutGraphics';
|
||||
import { GraphicDataBase, GraphicStateBase } from './GraphicDataBase';
|
||||
import { state } from 'src/protos/device_status';
|
||||
import { train } from 'src/protos/train';
|
||||
import { MenuItemOptions } from 'src/jl-graphic/ui/Menu';
|
||||
import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu';
|
||||
import {
|
||||
GraphicApp,
|
||||
GraphicInteractionPlugin,
|
||||
JlGraphic,
|
||||
} from 'src/jl-graphic';
|
||||
import { DisplayObject, FederatedMouseEvent } from 'pixi.js';
|
||||
|
||||
export class TrainData extends GraphicDataBase implements ITrainData {
|
||||
constructor(data?: graphicData.Train) {
|
||||
@ -202,3 +210,87 @@ class StateTrain extends train.TrainInfo {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const negativeDirectionConfig: MenuItemOptions = {
|
||||
name: '反方向运行',
|
||||
};
|
||||
const HoldTrainConfig: MenuItemOptions = {
|
||||
name: '扣车',
|
||||
};
|
||||
const openDoorConfig: MenuItemOptions = {
|
||||
name: '开门',
|
||||
};
|
||||
const editGroupConfig: MenuItemOptions = {
|
||||
name: '修改车组号',
|
||||
};
|
||||
const TrainOperateMenu: ContextMenu = ContextMenu.init({
|
||||
name: '列车操作菜单',
|
||||
groups: [
|
||||
{
|
||||
items: [
|
||||
negativeDirectionConfig,
|
||||
HoldTrainConfig,
|
||||
openDoorConfig,
|
||||
editGroupConfig,
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export class TrainOperateInteraction extends GraphicInteractionPlugin<Train> {
|
||||
static Name = 'train_operate_menu';
|
||||
constructor(app: GraphicApp) {
|
||||
super(TrainOperateInteraction.Name, app);
|
||||
app.registerMenu(TrainOperateMenu);
|
||||
}
|
||||
static init(app: GraphicApp) {
|
||||
return new TrainOperateInteraction(app);
|
||||
}
|
||||
filter(...grahpics: JlGraphic[]): Train[] | undefined {
|
||||
return grahpics.filter((g) => g.type === Train.Type).map((g) => g as Train);
|
||||
}
|
||||
bind(g: Train): void {
|
||||
g.eventMode = 'static';
|
||||
g.cursor = 'pointer';
|
||||
g.selectable = true;
|
||||
g.on('_rightclick', this.onContextMenu, this);
|
||||
}
|
||||
|
||||
unbind(g: Train): void {
|
||||
g.selectable = false;
|
||||
g.eventMode = 'none';
|
||||
g.off('_rightclick', this.onContextMenu, this);
|
||||
}
|
||||
|
||||
onContextMenu(e: FederatedMouseEvent) {
|
||||
const target = e.target as DisplayObject;
|
||||
const train = target.getGraphic() as Train;
|
||||
this.app.updateSelected(train);
|
||||
negativeDirectionConfig.handler = () => {
|
||||
const mode = train.states.mode;
|
||||
if (!train.states.mode.ipModeTrainDirUp) {
|
||||
mode.ipModeTrainDirUp = true;
|
||||
mode.ipModeTrainDirDown = false;
|
||||
} else if (!train.states.mode.ipModeTrainDirDown) {
|
||||
mode.ipModeTrainDirUp = false;
|
||||
mode.ipModeTrainDirDown = true;
|
||||
}
|
||||
train.chagneDirection();
|
||||
};
|
||||
HoldTrainConfig.handler = () => {
|
||||
train.states.mode.ipModeTrainHolded =
|
||||
!train.states.mode.ipModeTrainHolded;
|
||||
train.chagneState();
|
||||
};
|
||||
openDoorConfig.handler = () => {
|
||||
train.states.mode.ipModeTrainDoorOpen =
|
||||
!train.states.mode.ipModeTrainDoorOpen;
|
||||
train.chagneState();
|
||||
};
|
||||
editGroupConfig.handler = () => {
|
||||
train.states.trainId = '022';
|
||||
train.doRepaint();
|
||||
};
|
||||
TrainOperateMenu.open(e.global);
|
||||
}
|
||||
}
|
||||
|
@ -79,6 +79,9 @@ import { PathLine, PathLineTemplate } from 'src/graphics/pathLine/PathLine';
|
||||
import { PathLineDraw } from 'src/graphics/pathLine/PathLineDrawAssistant';
|
||||
import { PathLineData } from './graphics/PathLineInteraction';
|
||||
import { toStorageTransform } from './graphics/GraphicDataBase';
|
||||
import { SeparatorDraw } from 'src/graphics/separator/SeparatorDrawAssistant';
|
||||
import { Separator, SeparatorTemplate } from 'src/graphics/separator/Separator';
|
||||
import { SeparatorData } from './graphics/SeparatorInteraction';
|
||||
|
||||
// export function fromStoragePoint(p: graphicData.Point): Point {
|
||||
// return new Point(p.x, p.y);
|
||||
@ -165,6 +168,7 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp {
|
||||
| TrainDraw
|
||||
| OneClickGenerateDraw
|
||||
| AxleCountingDraw
|
||||
| SeparatorDraw
|
||||
)[] = [];
|
||||
if (draftType === 'Line') {
|
||||
drawAssistants = [
|
||||
@ -189,6 +193,7 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp {
|
||||
app,
|
||||
new AxleCountingTemplate(new AxleCountingData())
|
||||
),
|
||||
new SeparatorDraw(app, new SeparatorTemplate(new SeparatorData())),
|
||||
];
|
||||
DrawSignalInteraction.init(app);
|
||||
} else {
|
||||
@ -305,6 +310,9 @@ export function saveDrawDatas(app: JlDrawApp) {
|
||||
} else if (AxleCounting.Type === g.type) {
|
||||
const axleCountingData = (g as AxleCounting).saveData();
|
||||
storage.axleCountings.push((axleCountingData as AxleCountingData).data);
|
||||
} else if (Separator.Type === g.type) {
|
||||
const separatorData = (g as Separator).saveData();
|
||||
storage.separators.push((separatorData as SeparatorData).data);
|
||||
}
|
||||
});
|
||||
const base64 = fromUint8Array(storage.serialize());
|
||||
@ -375,6 +383,9 @@ export async function loadDrawDatas(app: GraphicApp) {
|
||||
storage.axleCountings.forEach((axleCounting) => {
|
||||
datas.push(new AxleCountingData(axleCounting));
|
||||
});
|
||||
storage.separators.forEach((separator) => {
|
||||
datas.push(new SeparatorData(separator));
|
||||
});
|
||||
app.loadGraphic(datas);
|
||||
} else {
|
||||
app.loadGraphic([]);
|
||||
|
@ -7,12 +7,13 @@ import {
|
||||
VectorText,
|
||||
} from 'src/jl-graphic';
|
||||
import { IRelatedRefData, protoPort2Data } from '../CommonGraphics';
|
||||
import { KilometerSystem } from '../signal/Signal';
|
||||
|
||||
export interface IAxleCountingData extends GraphicData {
|
||||
get code(): string; // 编号
|
||||
set code(v: string);
|
||||
get kilometerCode(): string; // 公里标
|
||||
set kilometerCode(v: string);
|
||||
get kilometerSystem(): KilometerSystem;
|
||||
set kilometerSystem(v: KilometerSystem);
|
||||
get axleCountingRef(): IRelatedRefData[]; //关联的设备
|
||||
set axleCountingRef(ref: IRelatedRefData[]);
|
||||
clone(): IAxleCountingData;
|
||||
|
@ -109,7 +109,7 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
|
||||
}
|
||||
axleCounting.id = GraphicIdGenerator.next();
|
||||
axleCounting.datas.axleCountingRef = [refData2, refData1];
|
||||
axleCounting.code = `${graphic.code}-${port}+${refGraphic.code}-${refPort}`;
|
||||
axleCounting.datas.code = `${graphic.datas.code}-${port}+${refGraphic.datas.code}-${refPort}`;
|
||||
this.storeGraphic(axleCounting);
|
||||
axleCounting.loadRelations();
|
||||
}
|
||||
@ -136,7 +136,7 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
|
||||
}
|
||||
axleCounting.id = GraphicIdGenerator.next();
|
||||
axleCounting.datas.axleCountingRef = [refData];
|
||||
axleCounting.code = `${graphic.code}-${port}`;
|
||||
axleCounting.datas.code = `${graphic.datas.code}-${port}`;
|
||||
this.storeGraphic(axleCounting);
|
||||
axleCounting.loadRelations();
|
||||
}
|
||||
|
90
src/graphics/separator/Separator.ts
Normal file
90
src/graphics/separator/Separator.ts
Normal file
@ -0,0 +1,90 @@
|
||||
import { Color, Graphics } from 'pixi.js';
|
||||
import { GraphicData, JlGraphic, JlGraphicTemplate } from 'src/jl-graphic';
|
||||
|
||||
export interface ISeparatorData extends GraphicData {
|
||||
get code(): string; // 编号
|
||||
set code(v: string);
|
||||
get separatorType(): string; // 类型
|
||||
set separatorType(v: string);
|
||||
clone(): ISeparatorData;
|
||||
copyFrom(data: ISeparatorData): void;
|
||||
eq(other: ISeparatorData): boolean;
|
||||
}
|
||||
|
||||
export enum separatorTypeEnum {
|
||||
turnout = 'turnout', // 道岔分隔符
|
||||
endA = 'endA', // A端尽头分隔符
|
||||
endB = 'endB', // B端尽头分隔符
|
||||
section = 'section', // 区段分隔符
|
||||
}
|
||||
|
||||
export const SeparatorConsts = {
|
||||
height: 15,
|
||||
lineWidth: 2,
|
||||
lineColor: '0x617799',
|
||||
circleColor: '0xEF0200',
|
||||
radius: 5,
|
||||
};
|
||||
|
||||
export class Separator extends JlGraphic {
|
||||
static Type = 'Separator';
|
||||
rectGraphic: Graphics = new Graphics();
|
||||
circleGraphic: Graphics = new Graphics();
|
||||
constructor() {
|
||||
super(Separator.Type);
|
||||
this.addChild(this.rectGraphic);
|
||||
this.addChild(this.circleGraphic);
|
||||
}
|
||||
get datas(): ISeparatorData {
|
||||
return this.getDatas<ISeparatorData>();
|
||||
}
|
||||
doRepaint(): void {
|
||||
const rectGraphic = this.rectGraphic;
|
||||
rectGraphic.clear();
|
||||
if (!this.datas.separatorType) {
|
||||
this.datas.separatorType = separatorTypeEnum.endA;
|
||||
}
|
||||
const typeArr = ['section', 'turnout'];
|
||||
if (typeArr.includes(this.datas.separatorType)) {
|
||||
rectGraphic.lineStyle(
|
||||
SeparatorConsts.lineWidth,
|
||||
new Color(SeparatorConsts.lineColor)
|
||||
);
|
||||
rectGraphic.moveTo(0, -SeparatorConsts.height / 2);
|
||||
rectGraphic.lineTo(0, SeparatorConsts.height / 2);
|
||||
if (this.datas.separatorType == 'turnout') {
|
||||
this.circleGraphic.lineStyle(1, SeparatorConsts.circleColor);
|
||||
this.circleGraphic.drawCircle(0, 0, SeparatorConsts.radius);
|
||||
}
|
||||
}
|
||||
const endTypeArr = ['endA', 'endB'];
|
||||
if (endTypeArr.includes(this.datas.separatorType)) {
|
||||
let d = SeparatorConsts.radius;
|
||||
if (this.datas.separatorType == 'endB') {
|
||||
d = -d;
|
||||
}
|
||||
rectGraphic.lineStyle(
|
||||
SeparatorConsts.lineWidth,
|
||||
new Color(SeparatorConsts.lineColor)
|
||||
);
|
||||
rectGraphic.moveTo(0, 0);
|
||||
rectGraphic.lineTo(-d, 0);
|
||||
rectGraphic.lineTo(-d, -d);
|
||||
rectGraphic.lineTo(-d * 3, -d);
|
||||
rectGraphic.moveTo(-d, 0);
|
||||
rectGraphic.lineTo(-d, d);
|
||||
rectGraphic.lineTo(-d * 3, d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class SeparatorTemplate extends JlGraphicTemplate<Separator> {
|
||||
constructor(dataTemplate: ISeparatorData) {
|
||||
super(Separator.Type, {
|
||||
dataTemplate,
|
||||
});
|
||||
}
|
||||
new(): Separator {
|
||||
return new Separator();
|
||||
}
|
||||
}
|
239
src/graphics/separator/SeparatorDrawAssistant.ts
Normal file
239
src/graphics/separator/SeparatorDrawAssistant.ts
Normal file
@ -0,0 +1,239 @@
|
||||
import { FederatedPointerEvent, IHitArea, Point } from 'pixi.js';
|
||||
import {
|
||||
GraphicDrawAssistant,
|
||||
GraphicIdGenerator,
|
||||
GraphicInteractionPlugin,
|
||||
GraphicRelationParam,
|
||||
JlDrawApp,
|
||||
JlGraphic,
|
||||
linePoint,
|
||||
} from 'src/jl-graphic';
|
||||
import { Section } from '../section/Section';
|
||||
import {
|
||||
ISeparatorData,
|
||||
Separator,
|
||||
SeparatorConsts,
|
||||
SeparatorTemplate,
|
||||
separatorTypeEnum,
|
||||
} from './Separator';
|
||||
import { SeparatorData } from 'src/drawApp/graphics/SeparatorInteraction';
|
||||
import { Turnout } from '../turnout/Turnout';
|
||||
|
||||
export class SeparatorDraw extends GraphicDrawAssistant<
|
||||
SeparatorTemplate,
|
||||
ISeparatorData
|
||||
> {
|
||||
SeparatorGraph: Separator;
|
||||
constructor(app: JlDrawApp, template: SeparatorTemplate) {
|
||||
super(app, template, 'sym_o_square', '不展示');
|
||||
this.SeparatorGraph = this.graphicTemplate.new();
|
||||
this.container.addChild(this.SeparatorGraph);
|
||||
SeparatorInteraction.init(app);
|
||||
}
|
||||
|
||||
bind(): void {
|
||||
super.bind();
|
||||
this.SeparatorGraph.loadData(this.graphicTemplate.datas);
|
||||
this.SeparatorGraph.doRepaint();
|
||||
}
|
||||
|
||||
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: ISeparatorData): boolean {
|
||||
data.transform = this.container.saveTransform();
|
||||
return true;
|
||||
}
|
||||
oneGenerates() {
|
||||
const SeparatorAll = this.app.queryStore.queryByType<Separator>(
|
||||
Separator.Type
|
||||
);
|
||||
this.app.deleteGraphics(...SeparatorAll);
|
||||
const rMap = new Map();
|
||||
const sections = this.app.queryStore.queryByType<Section>(Section.Type);
|
||||
const turnouts = this.app.queryStore.queryByType<Turnout>(Turnout.Type);
|
||||
function setKey(gr: GraphicRelationParam): string {
|
||||
let key = '';
|
||||
key = `${gr.g.id}_${gr.param}`;
|
||||
return key;
|
||||
}
|
||||
sections.forEach((section) => {
|
||||
const allR = section.relationManage.getRelationsOfGraphic(section);
|
||||
const port: string[] = [];
|
||||
allR.forEach((relation, index) => {
|
||||
const r = relation.getRelationParam(section);
|
||||
port.push(r.param);
|
||||
const other = relation.getOtherRelationParam(section);
|
||||
if (!rMap.has(setKey(r))) {
|
||||
rMap.set(setKey(r), { ...r });
|
||||
}
|
||||
if (!rMap.has(setKey(other))) {
|
||||
rMap.set(setKey(other), { ...other, repetition: true });
|
||||
}
|
||||
if (index == allR.length - 1) {
|
||||
if (!port.includes('A')) {
|
||||
rMap.set(`${section.id}_A`, {
|
||||
g: section,
|
||||
param: 'A',
|
||||
separatorType: separatorTypeEnum.endA,
|
||||
});
|
||||
}
|
||||
if (!port.includes('B')) {
|
||||
rMap.set(`${section.id}_B`, {
|
||||
g: section,
|
||||
param: 'B',
|
||||
separatorType: separatorTypeEnum.endB,
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
turnouts.forEach((turnout) => {
|
||||
const allR = turnout.relationManage.getRelationsOfGraphic(turnout);
|
||||
const port: string[] = [];
|
||||
allR.forEach((relation, index) => {
|
||||
const r = relation.getRelationParam(turnout);
|
||||
port.push(r.param);
|
||||
const other = relation.getOtherRelationParam(turnout);
|
||||
if (!rMap.has(setKey(r))) {
|
||||
let t = separatorTypeEnum.section;
|
||||
if (r.param == 'C' && other.param == 'C') {
|
||||
t = separatorTypeEnum.turnout;
|
||||
}
|
||||
rMap.set(setKey(r), {
|
||||
...r,
|
||||
separatorType: t,
|
||||
});
|
||||
}
|
||||
if (!rMap.has(setKey(other))) {
|
||||
let t = separatorTypeEnum.section;
|
||||
if (r.param == 'C' && other.param == 'C') {
|
||||
t = separatorTypeEnum.turnout;
|
||||
}
|
||||
rMap.set(setKey(other), {
|
||||
...other,
|
||||
separatorType: t,
|
||||
repetition: true,
|
||||
});
|
||||
}
|
||||
if (index == allR.length - 1) {
|
||||
if (!port.includes('A')) {
|
||||
rMap.set(`${turnout.id}_A`, {
|
||||
g: turnout,
|
||||
param: 'A',
|
||||
separatorType: separatorTypeEnum.endB,
|
||||
});
|
||||
}
|
||||
if (!port.includes('B')) {
|
||||
rMap.set(`${turnout.id}_B`, {
|
||||
g: turnout,
|
||||
param: 'B',
|
||||
separatorType: separatorTypeEnum.endA,
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
rMap.forEach((item) => {
|
||||
if (!item.repetition) {
|
||||
const sType = item.separatorType || separatorTypeEnum.section;
|
||||
const separator = new Separator();
|
||||
const data = new SeparatorData();
|
||||
data.separatorType = sType;
|
||||
separator.loadData(data);
|
||||
let p;
|
||||
if (item.g.type == Section.Type) {
|
||||
p = item.g.getStartPoint();
|
||||
if (item.param == 'B') {
|
||||
p = item.g.getEndPoint();
|
||||
}
|
||||
} else if (item.g.type == Turnout.Type) {
|
||||
const ps = item.g.getPortPoints();
|
||||
let l = 2;
|
||||
if (item.param == 'A') {
|
||||
l = 0;
|
||||
} else if (item.param == 'B') {
|
||||
l = 1;
|
||||
}
|
||||
p = ps[l][0];
|
||||
}
|
||||
const tps = item.g.localToCanvasPoint(p);
|
||||
separator.position.set(tps.x, tps.y);
|
||||
separator.id = GraphicIdGenerator.next();
|
||||
this.storeGraphic(separator);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//碰撞检测
|
||||
export class SeparatorGraphicHitArea implements IHitArea {
|
||||
separator: Separator;
|
||||
constructor(separator: Separator) {
|
||||
this.separator = separator;
|
||||
}
|
||||
contains(x: number, y: number): boolean {
|
||||
let contains = false;
|
||||
const p = new Point(x, y);
|
||||
const typeArr = ['section', 'turnout'];
|
||||
const endTypeArr = ['endA', 'endB'];
|
||||
let d = SeparatorConsts.radius;
|
||||
if (typeArr.includes(this.separator.datas.separatorType)) {
|
||||
const tolerance = SeparatorConsts.lineWidth;
|
||||
const p1 = new Point(0, -SeparatorConsts.height / 2);
|
||||
const p2 = new Point(0, SeparatorConsts.height / 2);
|
||||
contains = contains || linePoint(p1, p2, p, tolerance);
|
||||
return contains;
|
||||
} else if (endTypeArr.includes(this.separator.datas.separatorType)) {
|
||||
if (this.separator.datas.separatorType == 'endB') {
|
||||
d = -d;
|
||||
}
|
||||
const tolerance = SeparatorConsts.lineWidth;
|
||||
const p1 = new Point(0, 0);
|
||||
const p2 = new Point(-d, 0);
|
||||
const p3 = new Point(-d, -d);
|
||||
const p4 = new Point(-d * 3, -d);
|
||||
const p5 = new Point(-d, d);
|
||||
const p6 = new Point(-d * 3, d);
|
||||
contains = contains || linePoint(p1, p2, p, tolerance);
|
||||
contains = contains || linePoint(p2, p3, p, tolerance);
|
||||
contains = contains || linePoint(p3, p4, p, tolerance);
|
||||
contains = contains || linePoint(p2, p5, p, tolerance);
|
||||
contains = contains || linePoint(p5, p6, p, tolerance);
|
||||
}
|
||||
return contains;
|
||||
}
|
||||
}
|
||||
|
||||
export class SeparatorInteraction extends GraphicInteractionPlugin<Separator> {
|
||||
static Name = 'Separator_transform';
|
||||
constructor(app: JlDrawApp) {
|
||||
super(SeparatorInteraction.Name, app);
|
||||
}
|
||||
static init(app: JlDrawApp) {
|
||||
return new SeparatorInteraction(app);
|
||||
}
|
||||
filter(...grahpics: JlGraphic[]): Separator[] | undefined {
|
||||
return grahpics
|
||||
.filter((g) => g.type === Separator.Type)
|
||||
.map((g) => g as Separator);
|
||||
}
|
||||
bind(g: Separator): void {
|
||||
g.eventMode = 'static';
|
||||
g.cursor = 'pointer';
|
||||
g.scalable = true;
|
||||
g.rotatable = true;
|
||||
g.rectGraphic.hitArea = new SeparatorGraphicHitArea(g);
|
||||
}
|
||||
unbind(g: Separator): void {
|
||||
g.eventMode = 'none';
|
||||
g.scalable = false;
|
||||
g.rotatable = false;
|
||||
}
|
||||
}
|
@ -6,12 +6,13 @@ import {
|
||||
JlGraphicTemplate,
|
||||
VectorText,
|
||||
} from 'src/jl-graphic';
|
||||
import { KilometerSystem } from '../signal/Signal';
|
||||
|
||||
export interface IStationData extends GraphicData {
|
||||
get code(): string; // 编号
|
||||
set code(v: string);
|
||||
get kilometerCode(): string; // 公里标
|
||||
set kilometerCode(v: string);
|
||||
get kilometerSystem(): KilometerSystem;
|
||||
set kilometerSystem(v: KilometerSystem);
|
||||
get hasControl(): boolean; /// 是否有控制
|
||||
set hasControl(v: boolean);
|
||||
get concentrationStations(): boolean; ////是否集中站
|
||||
@ -174,16 +175,18 @@ export class Station extends JlGraphic {
|
||||
codeGraph.style.fill = stationConsts.codeColor;
|
||||
codeGraph.setVectorFontSize(stationConsts.codeFontSize);
|
||||
codeGraph.anchor.set(0.5);
|
||||
const kilometerCode = this.datas?.kilometerCode || 12345.67;
|
||||
if (Math.floor(Number(kilometerCode)).toString().length > 3) {
|
||||
const kiloBit = Math.floor(Number(kilometerCode) / 1000).toString();
|
||||
const kilometerCode = this.datas.kilometerSystem?.kilometer || 12345678;
|
||||
if (Math.floor(kilometerCode * 1000).toString().length > 3) {
|
||||
const kiloBit = Math.floor(Number(kilometerCode) / 1000000).toString();
|
||||
kilometerGraph.text =
|
||||
'K' +
|
||||
kiloBit +
|
||||
'+' +
|
||||
kilometerCode.toString().substring(kiloBit.length);
|
||||
(
|
||||
Number(kilometerCode.toString().substring(kiloBit.length)) / 1000
|
||||
).toFixed(3);
|
||||
} else {
|
||||
kilometerGraph.text = kilometerCode;
|
||||
kilometerGraph.text = (kilometerCode * 1000).toFixed(3);
|
||||
}
|
||||
kilometerGraph.style.fill = stationConsts.kilometerCodeColor;
|
||||
kilometerGraph.setVectorFontSize(stationConsts.kilometerCodeFontSize);
|
||||
|
@ -178,6 +178,8 @@ import { errorNotify, successNotify } from 'src/utils/CommonNotify';
|
||||
import { saveAsDraft } from 'src/api/DraftApi';
|
||||
import { ApiError } from 'src/boot/axios';
|
||||
import { OneClickGenerate } from 'src/graphics/trainWindow/oneClickDrawAssistant';
|
||||
import { Separator } from 'src/graphics/separator/Separator';
|
||||
import { SeparatorDraw } from 'src/graphics/separator/SeparatorDrawAssistant';
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
@ -303,6 +305,10 @@ function buildRelations() {
|
||||
}
|
||||
|
||||
function oneClickGeneration() {
|
||||
const separatorDraw = drawStore
|
||||
.getDrawApp()
|
||||
.getDrawAssistant(Separator.Type) as SeparatorDraw;
|
||||
separatorDraw.oneGenerates();
|
||||
drawStore.getDrawApp().interactionPlugin(OneClickGenerate.Type).resume();
|
||||
}
|
||||
|
||||
|
@ -25,9 +25,10 @@ export namespace graphicData {
|
||||
polygons?: Polygon[];
|
||||
trainWindows?: TrainWindow[];
|
||||
axleCountings?: AxleCounting[];
|
||||
separators?: Separator[];
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17], this.#one_of_decls);
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("canvas" in data && data.canvas != undefined) {
|
||||
this.canvas = data.canvas;
|
||||
@ -80,6 +81,9 @@ export namespace graphicData {
|
||||
if ("axleCountings" in data && data.axleCountings != undefined) {
|
||||
this.axleCountings = data.axleCountings;
|
||||
}
|
||||
if ("separators" in data && data.separators != undefined) {
|
||||
this.separators = data.separators;
|
||||
}
|
||||
}
|
||||
}
|
||||
get canvas() {
|
||||
@ -187,6 +191,12 @@ export namespace graphicData {
|
||||
set axleCountings(value: AxleCounting[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 17, value);
|
||||
}
|
||||
get separators() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, Separator, 18) as Separator[];
|
||||
}
|
||||
set separators(value: Separator[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 18, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
canvas?: ReturnType<typeof Canvas.prototype.toObject>;
|
||||
links?: ReturnType<typeof Link.prototype.toObject>[];
|
||||
@ -205,6 +215,7 @@ export namespace graphicData {
|
||||
polygons?: ReturnType<typeof Polygon.prototype.toObject>[];
|
||||
trainWindows?: ReturnType<typeof TrainWindow.prototype.toObject>[];
|
||||
axleCountings?: ReturnType<typeof AxleCounting.prototype.toObject>[];
|
||||
separators?: ReturnType<typeof Separator.prototype.toObject>[];
|
||||
}): RtssGraphicStorage {
|
||||
const message = new RtssGraphicStorage({});
|
||||
if (data.canvas != null) {
|
||||
@ -258,6 +269,9 @@ export namespace graphicData {
|
||||
if (data.axleCountings != null) {
|
||||
message.axleCountings = data.axleCountings.map(item => AxleCounting.fromObject(item));
|
||||
}
|
||||
if (data.separators != null) {
|
||||
message.separators = data.separators.map(item => Separator.fromObject(item));
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
@ -279,6 +293,7 @@ export namespace graphicData {
|
||||
polygons?: ReturnType<typeof Polygon.prototype.toObject>[];
|
||||
trainWindows?: ReturnType<typeof TrainWindow.prototype.toObject>[];
|
||||
axleCountings?: ReturnType<typeof AxleCounting.prototype.toObject>[];
|
||||
separators?: ReturnType<typeof Separator.prototype.toObject>[];
|
||||
} = {};
|
||||
if (this.canvas != null) {
|
||||
data.canvas = this.canvas.toObject();
|
||||
@ -331,6 +346,9 @@ export namespace graphicData {
|
||||
if (this.axleCountings != null) {
|
||||
data.axleCountings = this.axleCountings.map((item: AxleCounting) => item.toObject());
|
||||
}
|
||||
if (this.separators != null) {
|
||||
data.separators = this.separators.map((item: Separator) => item.toObject());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
@ -371,6 +389,8 @@ export namespace graphicData {
|
||||
writer.writeRepeatedMessage(16, this.trainWindows, (item: TrainWindow) => item.serialize(writer));
|
||||
if (this.axleCountings.length)
|
||||
writer.writeRepeatedMessage(17, this.axleCountings, (item: AxleCounting) => item.serialize(writer));
|
||||
if (this.separators.length)
|
||||
writer.writeRepeatedMessage(18, this.separators, (item: Separator) => item.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -431,6 +451,9 @@ export namespace graphicData {
|
||||
case 17:
|
||||
reader.readMessage(message.axleCountings, () => pb_1.Message.addToRepeatedWrapperField(message, 17, AxleCounting.deserialize(reader), AxleCounting));
|
||||
break;
|
||||
case 18:
|
||||
reader.readMessage(message.separators, () => pb_1.Message.addToRepeatedWrapperField(message, 18, Separator.deserialize(reader), Separator));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
@ -1799,7 +1822,7 @@ export namespace graphicData {
|
||||
code?: string;
|
||||
hasControl?: boolean;
|
||||
concentrationStations?: boolean;
|
||||
kilometerCode?: string;
|
||||
kilometerSystem?: KilometerSystem;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
@ -1816,8 +1839,8 @@ export namespace graphicData {
|
||||
if ("concentrationStations" in data && data.concentrationStations != undefined) {
|
||||
this.concentrationStations = data.concentrationStations;
|
||||
}
|
||||
if ("kilometerCode" in data && data.kilometerCode != undefined) {
|
||||
this.kilometerCode = data.kilometerCode;
|
||||
if ("kilometerSystem" in data && data.kilometerSystem != undefined) {
|
||||
this.kilometerSystem = data.kilometerSystem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1848,18 +1871,21 @@ export namespace graphicData {
|
||||
set concentrationStations(value: boolean) {
|
||||
pb_1.Message.setField(this, 4, value);
|
||||
}
|
||||
get kilometerCode() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 5, "") as string;
|
||||
get kilometerSystem() {
|
||||
return pb_1.Message.getWrapperField(this, KilometerSystem, 6) as KilometerSystem;
|
||||
}
|
||||
set kilometerCode(value: string) {
|
||||
pb_1.Message.setField(this, 5, value);
|
||||
set kilometerSystem(value: KilometerSystem) {
|
||||
pb_1.Message.setWrapperField(this, 6, value);
|
||||
}
|
||||
get has_kilometerSystem() {
|
||||
return pb_1.Message.getField(this, 6) != null;
|
||||
}
|
||||
static fromObject(data: {
|
||||
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
|
||||
code?: string;
|
||||
hasControl?: boolean;
|
||||
concentrationStations?: boolean;
|
||||
kilometerCode?: string;
|
||||
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>;
|
||||
}): Station {
|
||||
const message = new Station({});
|
||||
if (data.common != null) {
|
||||
@ -1874,8 +1900,8 @@ export namespace graphicData {
|
||||
if (data.concentrationStations != null) {
|
||||
message.concentrationStations = data.concentrationStations;
|
||||
}
|
||||
if (data.kilometerCode != null) {
|
||||
message.kilometerCode = data.kilometerCode;
|
||||
if (data.kilometerSystem != null) {
|
||||
message.kilometerSystem = KilometerSystem.fromObject(data.kilometerSystem);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
@ -1885,7 +1911,7 @@ export namespace graphicData {
|
||||
code?: string;
|
||||
hasControl?: boolean;
|
||||
concentrationStations?: boolean;
|
||||
kilometerCode?: string;
|
||||
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>;
|
||||
} = {};
|
||||
if (this.common != null) {
|
||||
data.common = this.common.toObject();
|
||||
@ -1899,8 +1925,8 @@ export namespace graphicData {
|
||||
if (this.concentrationStations != null) {
|
||||
data.concentrationStations = this.concentrationStations;
|
||||
}
|
||||
if (this.kilometerCode != null) {
|
||||
data.kilometerCode = this.kilometerCode;
|
||||
if (this.kilometerSystem != null) {
|
||||
data.kilometerSystem = this.kilometerSystem.toObject();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@ -1916,8 +1942,8 @@ export namespace graphicData {
|
||||
writer.writeBool(3, this.hasControl);
|
||||
if (this.concentrationStations != false)
|
||||
writer.writeBool(4, this.concentrationStations);
|
||||
if (this.kilometerCode.length)
|
||||
writer.writeString(5, this.kilometerCode);
|
||||
if (this.has_kilometerSystem)
|
||||
writer.writeMessage(6, this.kilometerSystem, () => this.kilometerSystem.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -1939,8 +1965,8 @@ export namespace graphicData {
|
||||
case 4:
|
||||
message.concentrationStations = reader.readBool();
|
||||
break;
|
||||
case 5:
|
||||
message.kilometerCode = reader.readString();
|
||||
case 6:
|
||||
reader.readMessage(message.kilometerSystem, () => message.kilometerSystem = KilometerSystem.deserialize(reader));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
@ -2214,7 +2240,7 @@ export namespace graphicData {
|
||||
constructor(data?: any[] | {
|
||||
common?: CommonInfo;
|
||||
code?: string;
|
||||
kilometerCode?: string;
|
||||
kilometerSystem?: KilometerSystem;
|
||||
axleCountingRef?: RelatedRef[];
|
||||
}) {
|
||||
super();
|
||||
@ -2226,8 +2252,8 @@ export namespace graphicData {
|
||||
if ("code" in data && data.code != undefined) {
|
||||
this.code = data.code;
|
||||
}
|
||||
if ("kilometerCode" in data && data.kilometerCode != undefined) {
|
||||
this.kilometerCode = data.kilometerCode;
|
||||
if ("kilometerSystem" in data && data.kilometerSystem != undefined) {
|
||||
this.kilometerSystem = data.kilometerSystem;
|
||||
}
|
||||
if ("axleCountingRef" in data && data.axleCountingRef != undefined) {
|
||||
this.axleCountingRef = data.axleCountingRef;
|
||||
@ -2249,11 +2275,14 @@ export namespace graphicData {
|
||||
set code(value: string) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
get kilometerCode() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
|
||||
get kilometerSystem() {
|
||||
return pb_1.Message.getWrapperField(this, KilometerSystem, 3) as KilometerSystem;
|
||||
}
|
||||
set kilometerCode(value: string) {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
set kilometerSystem(value: KilometerSystem) {
|
||||
pb_1.Message.setWrapperField(this, 3, value);
|
||||
}
|
||||
get has_kilometerSystem() {
|
||||
return pb_1.Message.getField(this, 3) != null;
|
||||
}
|
||||
get axleCountingRef() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, RelatedRef, 4) as RelatedRef[];
|
||||
@ -2264,7 +2293,7 @@ export namespace graphicData {
|
||||
static fromObject(data: {
|
||||
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
|
||||
code?: string;
|
||||
kilometerCode?: string;
|
||||
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>;
|
||||
axleCountingRef?: ReturnType<typeof RelatedRef.prototype.toObject>[];
|
||||
}): AxleCounting {
|
||||
const message = new AxleCounting({});
|
||||
@ -2274,8 +2303,8 @@ export namespace graphicData {
|
||||
if (data.code != null) {
|
||||
message.code = data.code;
|
||||
}
|
||||
if (data.kilometerCode != null) {
|
||||
message.kilometerCode = data.kilometerCode;
|
||||
if (data.kilometerSystem != null) {
|
||||
message.kilometerSystem = KilometerSystem.fromObject(data.kilometerSystem);
|
||||
}
|
||||
if (data.axleCountingRef != null) {
|
||||
message.axleCountingRef = data.axleCountingRef.map(item => RelatedRef.fromObject(item));
|
||||
@ -2286,7 +2315,7 @@ export namespace graphicData {
|
||||
const data: {
|
||||
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
|
||||
code?: string;
|
||||
kilometerCode?: string;
|
||||
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>;
|
||||
axleCountingRef?: ReturnType<typeof RelatedRef.prototype.toObject>[];
|
||||
} = {};
|
||||
if (this.common != null) {
|
||||
@ -2295,8 +2324,8 @@ export namespace graphicData {
|
||||
if (this.code != null) {
|
||||
data.code = this.code;
|
||||
}
|
||||
if (this.kilometerCode != null) {
|
||||
data.kilometerCode = this.kilometerCode;
|
||||
if (this.kilometerSystem != null) {
|
||||
data.kilometerSystem = this.kilometerSystem.toObject();
|
||||
}
|
||||
if (this.axleCountingRef != null) {
|
||||
data.axleCountingRef = this.axleCountingRef.map((item: RelatedRef) => item.toObject());
|
||||
@ -2311,8 +2340,8 @@ export namespace graphicData {
|
||||
writer.writeMessage(1, this.common, () => this.common.serialize(writer));
|
||||
if (this.code.length)
|
||||
writer.writeString(2, this.code);
|
||||
if (this.kilometerCode.length)
|
||||
writer.writeString(3, this.kilometerCode);
|
||||
if (this.has_kilometerSystem)
|
||||
writer.writeMessage(3, this.kilometerSystem, () => this.kilometerSystem.serialize(writer));
|
||||
if (this.axleCountingRef.length)
|
||||
writer.writeRepeatedMessage(4, this.axleCountingRef, (item: RelatedRef) => item.serialize(writer));
|
||||
if (!w)
|
||||
@ -2331,7 +2360,7 @@ export namespace graphicData {
|
||||
message.code = reader.readString();
|
||||
break;
|
||||
case 3:
|
||||
message.kilometerCode = reader.readString();
|
||||
reader.readMessage(message.kilometerSystem, () => message.kilometerSystem = KilometerSystem.deserialize(reader));
|
||||
break;
|
||||
case 4:
|
||||
reader.readMessage(message.axleCountingRef, () => pb_1.Message.addToRepeatedWrapperField(message, 4, RelatedRef.deserialize(reader), RelatedRef));
|
||||
@ -3955,4 +3984,120 @@ export namespace graphicData {
|
||||
C = 2
|
||||
}
|
||||
}
|
||||
export class Separator extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
common?: CommonInfo;
|
||||
code?: string;
|
||||
separatorType?: 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;
|
||||
}
|
||||
if ("separatorType" in data && data.separatorType != undefined) {
|
||||
this.separatorType = data.separatorType;
|
||||
}
|
||||
}
|
||||
}
|
||||
get common() {
|
||||
return pb_1.Message.getWrapperField(this, CommonInfo, 1) as CommonInfo;
|
||||
}
|
||||
set common(value: CommonInfo) {
|
||||
pb_1.Message.setWrapperField(this, 1, value);
|
||||
}
|
||||
get has_common() {
|
||||
return pb_1.Message.getField(this, 1) != null;
|
||||
}
|
||||
get code() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
|
||||
}
|
||||
set code(value: string) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
get separatorType() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
|
||||
}
|
||||
set separatorType(value: string) {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
|
||||
code?: string;
|
||||
separatorType?: string;
|
||||
}): Separator {
|
||||
const message = new Separator({});
|
||||
if (data.common != null) {
|
||||
message.common = CommonInfo.fromObject(data.common);
|
||||
}
|
||||
if (data.code != null) {
|
||||
message.code = data.code;
|
||||
}
|
||||
if (data.separatorType != null) {
|
||||
message.separatorType = data.separatorType;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
|
||||
code?: string;
|
||||
separatorType?: string;
|
||||
} = {};
|
||||
if (this.common != null) {
|
||||
data.common = this.common.toObject();
|
||||
}
|
||||
if (this.code != null) {
|
||||
data.code = this.code;
|
||||
}
|
||||
if (this.separatorType != null) {
|
||||
data.separatorType = this.separatorType;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.has_common)
|
||||
writer.writeMessage(1, this.common, () => this.common.serialize(writer));
|
||||
if (this.code.length)
|
||||
writer.writeString(2, this.code);
|
||||
if (this.separatorType.length)
|
||||
writer.writeString(3, this.separatorType);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Separator {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Separator();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
reader.readMessage(message.common, () => message.common = CommonInfo.deserialize(reader));
|
||||
break;
|
||||
case 2:
|
||||
message.code = reader.readString();
|
||||
break;
|
||||
case 3:
|
||||
message.separatorType = reader.readString();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): Separator {
|
||||
return Separator.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user