曲度公里标
This commit is contained in:
parent
8d96293d78
commit
306f3abf97
@ -1 +1 @@
|
||||
Subproject commit 76917f9e01f4044559ac9c73aada199027da1db4
|
||||
Subproject commit c592e915a2a94767e60fba01e08fc4be570b35fb
|
@ -96,9 +96,14 @@
|
||||
<esb-button-property
|
||||
v-else-if="drawStore.selectedGraphicType === EsbButton.Type"
|
||||
></esb-button-property>
|
||||
<KiloMarkerProperty
|
||||
<SlopeKiloMarkerProperty
|
||||
v-else-if="drawStore.selectedGraphicType === SlopeKiloMarker.Type"
|
||||
/>
|
||||
<CurvatureKiloMarkerProperty
|
||||
v-else-if="
|
||||
drawStore.selectedGraphicType === CurvatureKiloMarker.Type
|
||||
"
|
||||
/>
|
||||
<slope-property
|
||||
v-else-if="drawStore.selectedGraphicType === Slope.Type"
|
||||
></slope-property>
|
||||
@ -149,10 +154,12 @@ import GatedBoxProperty from './properties/GatedBoxProperty.vue';
|
||||
import { GatedBox } from 'src/graphics/gatedBox/GatedBox';
|
||||
import EsbButtonProperty from './properties/EsbButtonProperty.vue';
|
||||
import { EsbButton } from 'src/graphics/esbButton/EsbButton';
|
||||
import KiloMarkerProperty from './properties/KiloMarkerProperty.vue';
|
||||
import SlopeKiloMarkerProperty from './properties/SlopeKiloMarkerProperty.vue';
|
||||
import CurvatureKiloMarkerProperty from './properties/CurvatureKiloMarkerProperty.vue';
|
||||
import { SlopeKiloMarker } from 'src/graphics/slopeKiloMarker/SlopeKiloMarker';
|
||||
import { Slope } from 'src/graphics/slope/Slope';
|
||||
import SlopeProperty from './properties/SlopeProperty.vue';
|
||||
import { CurvatureKiloMarker } from 'src/graphics/curvatureKiloMarker/CurvatureKiloMarker';
|
||||
|
||||
const drawStore = useDrawStore();
|
||||
</script>
|
||||
|
@ -0,0 +1,134 @@
|
||||
<script setup lang="ts">
|
||||
import { CurvatureKiloMarkerData } from 'src/drawApp/graphics/CurvatureKiloMarkerInteraction';
|
||||
import { CurvatureKiloMarker } from 'src/graphics/curvatureKiloMarker/CurvatureKiloMarker';
|
||||
import { useDrawStore } from 'src/stores/draw-store';
|
||||
import { reactive, shallowRef, watchEffect } from 'vue';
|
||||
|
||||
const drawStore = useDrawStore();
|
||||
const kiloMarkerModel = shallowRef(new CurvatureKiloMarkerData());
|
||||
const kilometerSystem = reactive([
|
||||
{
|
||||
coordinateSystem: '',
|
||||
kilometer: 0,
|
||||
direction: 0,
|
||||
},
|
||||
{
|
||||
coordinateSystem: '',
|
||||
kilometer: 0,
|
||||
direction: 0,
|
||||
},
|
||||
]);
|
||||
|
||||
const CoordinateSystemOptions = [
|
||||
{ label: '车辆段', value: 'DEPOT' },
|
||||
{ label: '停车场', value: 'PARKING_LOT' },
|
||||
{ label: '正线', value: 'MAIN_LINE' },
|
||||
{ label: '换线', value: 'TRANSFER' },
|
||||
];
|
||||
const directionOptions = [
|
||||
{ label: '上行', value: 0 },
|
||||
{ label: '下行', value: 1 },
|
||||
];
|
||||
watchEffect(() => {
|
||||
const kiloMarker = drawStore.selectedGraphic;
|
||||
if (kiloMarker && kiloMarker instanceof CurvatureKiloMarker) {
|
||||
kiloMarkerModel.value = kiloMarker.saveData();
|
||||
if (kiloMarkerModel.value.kilometerSystem.length > 0) {
|
||||
kilometerSystem.forEach((ks, i) => {
|
||||
ks.coordinateSystem =
|
||||
kiloMarkerModel.value.kilometerSystem[i].coordinateSystem;
|
||||
ks.kilometer = kiloMarkerModel.value.kilometerSystem[i].kilometer;
|
||||
ks.direction = kiloMarkerModel.value.kilometerSystem[i].direction;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const onUpdate = () => {
|
||||
const kiloMarker = drawStore.selectedGraphic as CurvatureKiloMarker;
|
||||
kiloMarkerModel.value.kilometerSystem = kilometerSystem.map((ks) => ({
|
||||
coordinateSystem: ks.coordinateSystem,
|
||||
kilometer: ks.kilometer,
|
||||
direction: ks.direction,
|
||||
}));
|
||||
if (kiloMarker) {
|
||||
drawStore
|
||||
.getDrawApp()
|
||||
.updateGraphicAndRecord(kiloMarker, kiloMarkerModel.value);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<q-form class="q-gutter-sm">
|
||||
<q-input
|
||||
outlined
|
||||
readonly
|
||||
v-model="kiloMarkerModel.id"
|
||||
label="id"
|
||||
hint=""
|
||||
/>
|
||||
<!-- <q-input
|
||||
outlined
|
||||
label="索引编号"
|
||||
type="textarea"
|
||||
@blur="onUpdate"
|
||||
v-model="logicSectionModel.index"
|
||||
lazy-rules
|
||||
autogrow
|
||||
/> -->
|
||||
<q-select
|
||||
outlined
|
||||
v-model="kilometerSystem[0].coordinateSystem"
|
||||
:options="CoordinateSystemOptions"
|
||||
:map-options="true"
|
||||
:emit-value="true"
|
||||
@update:model-value="onUpdate"
|
||||
label="坐标系"
|
||||
></q-select>
|
||||
<q-input
|
||||
outlined
|
||||
v-model.number="kilometerSystem[0].kilometer"
|
||||
type="number"
|
||||
@blur="onUpdate"
|
||||
label="公里标(mm):"
|
||||
/>
|
||||
<q-select
|
||||
outlined
|
||||
v-model="kilometerSystem[0].direction"
|
||||
:options="directionOptions"
|
||||
:map-options="true"
|
||||
:emit-value="true"
|
||||
@update:model-value="onUpdate"
|
||||
label="方向"
|
||||
></q-select>
|
||||
<q-select
|
||||
outlined
|
||||
class="q-mt-lg"
|
||||
v-model="kilometerSystem[1].coordinateSystem"
|
||||
:options="CoordinateSystemOptions"
|
||||
:map-options="true"
|
||||
:emit-value="true"
|
||||
@update:model-value="onUpdate"
|
||||
label="坐标系"
|
||||
></q-select>
|
||||
<q-input
|
||||
outlined
|
||||
v-model.number="kilometerSystem[1].kilometer"
|
||||
type="number"
|
||||
@blur="onUpdate"
|
||||
label="公里标(mm):"
|
||||
/>
|
||||
<q-select
|
||||
outlined
|
||||
v-model="kilometerSystem[1].direction"
|
||||
:options="directionOptions"
|
||||
:map-options="true"
|
||||
:emit-value="true"
|
||||
@update:model-value="onUpdate"
|
||||
label="方向"
|
||||
></q-select>
|
||||
</q-form>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
52
src/drawApp/graphics/CurvatureKiloMarkerInteraction.ts
Normal file
52
src/drawApp/graphics/CurvatureKiloMarkerInteraction.ts
Normal file
@ -0,0 +1,52 @@
|
||||
import * as pb_1 from 'google-protobuf';
|
||||
import { GraphicDataBase } from './GraphicDataBase';
|
||||
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
||||
import { KilometerSystem } from 'src/graphics/signal/Signal';
|
||||
import { IKiloMarkerData } from 'src/graphics/kilometerMarker/KilometerMarker';
|
||||
import { CurvatureKiloMarker } from 'src/graphics/curvatureKiloMarker/CurvatureKiloMarker';
|
||||
|
||||
export class CurvatureKiloMarkerData
|
||||
extends GraphicDataBase
|
||||
implements IKiloMarkerData
|
||||
{
|
||||
constructor(data?: graphicData.CurvatureKiloMarker) {
|
||||
let platform;
|
||||
if (!data) {
|
||||
platform = new graphicData.CurvatureKiloMarker({
|
||||
common: GraphicDataBase.defaultCommonInfo(CurvatureKiloMarker.Type),
|
||||
});
|
||||
} else {
|
||||
platform = data;
|
||||
}
|
||||
super(platform);
|
||||
}
|
||||
|
||||
public get data(): graphicData.CurvatureKiloMarker {
|
||||
return this.getData<graphicData.CurvatureKiloMarker>();
|
||||
}
|
||||
|
||||
get code(): string {
|
||||
return this.data.code;
|
||||
}
|
||||
set code(v: string) {
|
||||
this.data.code = v;
|
||||
}
|
||||
get kilometerSystem(): KilometerSystem[] {
|
||||
return this.data.kilometerSystem;
|
||||
}
|
||||
set kilometerSystem(value: KilometerSystem[]) {
|
||||
this.data.kilometerSystem = value.map(
|
||||
(v) => new graphicData.KilometerSystem(v)
|
||||
);
|
||||
}
|
||||
|
||||
clone(): CurvatureKiloMarkerData {
|
||||
return new CurvatureKiloMarkerData(this.data.cloneMessage());
|
||||
}
|
||||
copyFrom(data: CurvatureKiloMarkerData): void {
|
||||
pb_1.Message.copyInto(data.data, this.data);
|
||||
}
|
||||
eq(other: CurvatureKiloMarkerData): boolean {
|
||||
return pb_1.Message.equals(this.data, other.data);
|
||||
}
|
||||
}
|
@ -1,15 +1,13 @@
|
||||
import * as pb_1 from 'google-protobuf';
|
||||
import {
|
||||
ISlopeKiloMarkerData,
|
||||
SlopeKiloMarker,
|
||||
} from 'src/graphics/slopeKiloMarker/SlopeKiloMarker';
|
||||
import { SlopeKiloMarker } from 'src/graphics/slopeKiloMarker/SlopeKiloMarker';
|
||||
import { GraphicDataBase } from './GraphicDataBase';
|
||||
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
||||
import { KilometerSystem } from 'src/graphics/signal/Signal';
|
||||
import { IKiloMarkerData } from 'src/graphics/kilometerMarker/KilometerMarker';
|
||||
|
||||
export class SlopeKiloMarkerData
|
||||
extends GraphicDataBase
|
||||
implements ISlopeKiloMarkerData
|
||||
implements IKiloMarkerData
|
||||
{
|
||||
constructor(data?: graphicData.SlopeKiloMarker) {
|
||||
let platform;
|
||||
|
@ -121,6 +121,12 @@ import { SlopeDraw } from 'src/graphics/slope/SlopeAssistant';
|
||||
import { SlopeData } from './graphics/SlopeInteraction';
|
||||
import { Slope, SlopeTemplate } from 'src/graphics/slope/Slope';
|
||||
import { useLineStore } from 'src/stores/line-store';
|
||||
import {
|
||||
CurvatureKiloMarker,
|
||||
CurvatureKiloMarkerTemplate,
|
||||
} from 'src/graphics/curvatureKiloMarker/CurvatureKiloMarker';
|
||||
import { CurvatureKiloMarkerDrawAssistant } from 'src/graphics/curvatureKiloMarker/CurvatureKiloMarkerDrawAssistant';
|
||||
import { CurvatureKiloMarkerData } from './graphics/CurvatureKiloMarkerInteraction';
|
||||
|
||||
// export function fromStoragePoint(p: graphicData.Point): Point {
|
||||
// return new Point(p.x, p.y);
|
||||
@ -210,6 +216,7 @@ const showType = [
|
||||
TrainWindow.Type,
|
||||
SlopeKiloMarker.Type,
|
||||
Slope.Type,
|
||||
CurvatureKiloMarker.Type,
|
||||
];
|
||||
export const drawLayerList = [
|
||||
// 图层列表
|
||||
@ -257,6 +264,7 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp {
|
||||
| TransponderDraw
|
||||
| SlopeKiloMarkerDrawAssistant
|
||||
| SlopeDraw
|
||||
| CurvatureKiloMarkerDrawAssistant
|
||||
)[] = [];
|
||||
if (draftType === 'Line') {
|
||||
drawAssistants = [
|
||||
@ -307,6 +315,10 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp {
|
||||
new SlopeKiloMarkerTemplate(new SlopeKiloMarkerData())
|
||||
),
|
||||
new SlopeDraw(app, new SlopeTemplate(new SlopeData())),
|
||||
new CurvatureKiloMarkerDrawAssistant(
|
||||
app,
|
||||
new CurvatureKiloMarkerTemplate(new CurvatureKiloMarkerData())
|
||||
),
|
||||
];
|
||||
DrawSignalInteraction.init(app);
|
||||
DrawStopPositionInteraction.init(app);
|
||||
@ -475,6 +487,11 @@ export function saveDrawDatas(app: JlDrawApp) {
|
||||
} else if (Slope.Type === g.type) {
|
||||
const slopeData = (g as Slope).saveData();
|
||||
storage.slopes.push((slopeData as SlopeData).data);
|
||||
} else if (CurvatureKiloMarker.Type === g.type) {
|
||||
const curvatureKiloMarkerData = (g as CurvatureKiloMarker).saveData();
|
||||
storage.curvatureKiloMarker.push(
|
||||
(curvatureKiloMarkerData as CurvatureKiloMarkerData).data
|
||||
);
|
||||
}
|
||||
});
|
||||
const base64 = fromUint8Array(storage.serialize());
|
||||
@ -561,6 +578,9 @@ export async function loadDrawDatas(app: GraphicApp) {
|
||||
storage.slopeKiloMarker.forEach((slopeKiloMarker) => {
|
||||
datas.push(new SlopeKiloMarkerData(slopeKiloMarker));
|
||||
});
|
||||
storage.curvatureKiloMarker.forEach((curvatureKiloMarker) => {
|
||||
datas.push(new CurvatureKiloMarkerData(curvatureKiloMarker));
|
||||
});
|
||||
storage.slopes.forEach((slope) => {
|
||||
datas.push(new SlopeData(slope));
|
||||
});
|
||||
|
50
src/graphics/curvatureKiloMarker/CurvatureKiloMarker.ts
Normal file
50
src/graphics/curvatureKiloMarker/CurvatureKiloMarker.ts
Normal file
@ -0,0 +1,50 @@
|
||||
import { JlGraphic, JlGraphicTemplate } from 'src/jl-graphic';
|
||||
import {
|
||||
IKiloMarkerData,
|
||||
KiloMarkerConsts,
|
||||
KilometerMarker,
|
||||
} from '../kilometerMarker/KilometerMarker';
|
||||
|
||||
export class CurvatureKiloMarker extends JlGraphic {
|
||||
static Type = 'CurvatureKiloMarker';
|
||||
graphic: KilometerMarker;
|
||||
size = KiloMarkerConsts.size;
|
||||
|
||||
constructor() {
|
||||
super(CurvatureKiloMarker.Type);
|
||||
this.graphic = new KilometerMarker();
|
||||
this.addChild(this.graphic);
|
||||
}
|
||||
get datas(): IKiloMarkerData {
|
||||
return this.getDatas<IKiloMarkerData>();
|
||||
}
|
||||
doRepaint(): void {
|
||||
this.graphic.paint();
|
||||
}
|
||||
|
||||
getPoint(position: 'up' | 'down' | 'mid') {
|
||||
const p = this.transform.position.clone();
|
||||
if (position === 'up') {
|
||||
p.y -= this.size;
|
||||
return p;
|
||||
} else if (position === 'down') {
|
||||
p.y += this.size;
|
||||
return p;
|
||||
} else if (position === 'mid') {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class CurvatureKiloMarkerTemplate extends JlGraphicTemplate<CurvatureKiloMarker> {
|
||||
constructor(dataTemplate: IKiloMarkerData) {
|
||||
super(CurvatureKiloMarker.Type, {
|
||||
dataTemplate,
|
||||
});
|
||||
}
|
||||
new(): CurvatureKiloMarker {
|
||||
const curvatureKiloMarker = new CurvatureKiloMarker();
|
||||
curvatureKiloMarker.loadData(this.datas);
|
||||
return curvatureKiloMarker;
|
||||
}
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
import {
|
||||
GraphicApp,
|
||||
GraphicDrawAssistant,
|
||||
GraphicInteractionPlugin,
|
||||
JlDrawApp,
|
||||
JlGraphic,
|
||||
linePoint,
|
||||
} from 'src/jl-graphic';
|
||||
import { FederatedMouseEvent, IHitArea, Point } from 'pixi.js';
|
||||
import { IKiloMarkerData } from '../kilometerMarker/KilometerMarker';
|
||||
import {
|
||||
CurvatureKiloMarker,
|
||||
CurvatureKiloMarkerTemplate,
|
||||
} from './CurvatureKiloMarker';
|
||||
|
||||
export class KilometerMarkerHitArea implements IHitArea {
|
||||
kiloMarker: CurvatureKiloMarker;
|
||||
constructor(kiloMarker: CurvatureKiloMarker) {
|
||||
this.kiloMarker = kiloMarker;
|
||||
}
|
||||
contains(x: number, y: number): boolean {
|
||||
const { position } = this.kiloMarker.transform;
|
||||
return linePoint(
|
||||
this.kiloMarker.canvasToLocalPoint({ x: position.x, y: position.y - 50 }),
|
||||
this.kiloMarker.canvasToLocalPoint({ x: position.x, y: position.y + 50 }),
|
||||
{ x, y },
|
||||
2
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class CurvatureKiloMarkerDrawAssistant extends GraphicDrawAssistant<
|
||||
CurvatureKiloMarkerTemplate,
|
||||
IKiloMarkerData
|
||||
> {
|
||||
curvatureKiloMarker: CurvatureKiloMarker;
|
||||
|
||||
constructor(app: JlDrawApp, template: CurvatureKiloMarkerTemplate) {
|
||||
super(app, template, 'sym_o_golf_course', '曲度公里标');
|
||||
this.curvatureKiloMarker = this.graphicTemplate.new();
|
||||
this.container.addChild(this.curvatureKiloMarker);
|
||||
CurvatureKiloMarkerInteractionPlugin.init(app);
|
||||
}
|
||||
|
||||
onLeftDown(e: FederatedMouseEvent): void {
|
||||
this.createAndStore(true);
|
||||
}
|
||||
|
||||
redraw(cp: Point): void {
|
||||
const list = this.app.queryStore.queryByType<CurvatureKiloMarker>(
|
||||
CurvatureKiloMarker.Type
|
||||
);
|
||||
const ys = list.reduce<number[]>((prev, curr, i) => {
|
||||
const currentY = curr.datas.transform.position.y;
|
||||
if (!prev.includes(currentY)) {
|
||||
return [currentY, ...prev];
|
||||
} else {
|
||||
return prev;
|
||||
}
|
||||
}, []);
|
||||
if (list.length) {
|
||||
const matchY = ys.find(
|
||||
(y) => Math.abs(cp.y - y) <= this.curvatureKiloMarker.size
|
||||
);
|
||||
if (matchY) {
|
||||
this.container.position.set(cp.x, matchY);
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.container.position.set(cp.x, cp.y);
|
||||
}
|
||||
prepareData(data: IKiloMarkerData): boolean {
|
||||
data.transform = this.container.saveTransform();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
export class CurvatureKiloMarkerInteractionPlugin extends GraphicInteractionPlugin<CurvatureKiloMarker> {
|
||||
static Name = 'CurvatureKiloMarkerInteraction';
|
||||
|
||||
constructor(app: GraphicApp) {
|
||||
super(CurvatureKiloMarkerInteractionPlugin.Name, app);
|
||||
}
|
||||
static init(app: GraphicApp) {
|
||||
return new CurvatureKiloMarkerInteractionPlugin(app);
|
||||
}
|
||||
filter(...grahpics: JlGraphic[]): CurvatureKiloMarker[] | undefined {
|
||||
return grahpics.filter(
|
||||
(g): g is CurvatureKiloMarker => g instanceof CurvatureKiloMarker
|
||||
);
|
||||
}
|
||||
bind(g: CurvatureKiloMarker): void {
|
||||
g.graphic.eventMode = 'static';
|
||||
g.graphic.cursor = 'pointer';
|
||||
g.graphic.selectable = true;
|
||||
g.graphic.draggable = false;
|
||||
g.graphic.hitArea = new KilometerMarkerHitArea(g);
|
||||
}
|
||||
unbind(g: CurvatureKiloMarker): void {
|
||||
console.log(g);
|
||||
}
|
||||
}
|
@ -1,4 +1,20 @@
|
||||
import { Graphics } from 'pixi.js';
|
||||
import { KilometerSystem } from '../signal/Signal';
|
||||
import { GraphicData } from 'src/jl-graphic';
|
||||
|
||||
export const KiloMarkerConsts = {
|
||||
size: 50,
|
||||
};
|
||||
|
||||
export interface IKiloMarkerData extends GraphicData {
|
||||
get code(): string; // 编号
|
||||
set code(v: string);
|
||||
get kilometerSystem(): KilometerSystem[];
|
||||
set kilometerSystem(v: KilometerSystem[]);
|
||||
clone(): IKiloMarkerData;
|
||||
copyFrom(data: IKiloMarkerData): void;
|
||||
eq(other: IKiloMarkerData): boolean;
|
||||
}
|
||||
|
||||
export class KilometerMarker extends Graphics {
|
||||
constructor() {
|
||||
|
@ -1,20 +1,9 @@
|
||||
import { GraphicData, JlGraphic, JlGraphicTemplate } from 'src/jl-graphic';
|
||||
import { KilometerMarker } from '../kilometerMarker/KilometerMarker';
|
||||
import { KilometerSystem } from '../signal/Signal';
|
||||
|
||||
export const KiloMarkerConsts = {
|
||||
size: 50,
|
||||
};
|
||||
|
||||
export interface ISlopeKiloMarkerData extends GraphicData {
|
||||
get code(): string; // 编号
|
||||
set code(v: string);
|
||||
get kilometerSystem(): KilometerSystem[];
|
||||
set kilometerSystem(v: KilometerSystem[]);
|
||||
clone(): ISlopeKiloMarkerData;
|
||||
copyFrom(data: ISlopeKiloMarkerData): void;
|
||||
eq(other: ISlopeKiloMarkerData): boolean;
|
||||
}
|
||||
import { JlGraphic, JlGraphicTemplate } from 'src/jl-graphic';
|
||||
import {
|
||||
IKiloMarkerData,
|
||||
KiloMarkerConsts,
|
||||
KilometerMarker,
|
||||
} from '../kilometerMarker/KilometerMarker';
|
||||
|
||||
export class SlopeKiloMarker extends JlGraphic {
|
||||
static Type = 'SlopeKiloMarker';
|
||||
@ -26,8 +15,8 @@ export class SlopeKiloMarker extends JlGraphic {
|
||||
this.graphic = new KilometerMarker();
|
||||
this.addChild(this.graphic);
|
||||
}
|
||||
get datas(): ISlopeKiloMarkerData {
|
||||
return this.getDatas<ISlopeKiloMarkerData>();
|
||||
get datas(): IKiloMarkerData {
|
||||
return this.getDatas<IKiloMarkerData>();
|
||||
}
|
||||
doRepaint(): void {
|
||||
this.graphic.paint();
|
||||
@ -48,7 +37,7 @@ export class SlopeKiloMarker extends JlGraphic {
|
||||
}
|
||||
|
||||
export class SlopeKiloMarkerTemplate extends JlGraphicTemplate<SlopeKiloMarker> {
|
||||
constructor(dataTemplate: ISlopeKiloMarkerData) {
|
||||
constructor(dataTemplate: IKiloMarkerData) {
|
||||
super(SlopeKiloMarker.Type, {
|
||||
dataTemplate,
|
||||
});
|
||||
|
@ -6,12 +6,9 @@ import {
|
||||
JlGraphic,
|
||||
linePoint,
|
||||
} from 'src/jl-graphic';
|
||||
import {
|
||||
ISlopeKiloMarkerData,
|
||||
SlopeKiloMarker,
|
||||
SlopeKiloMarkerTemplate,
|
||||
} from './SlopeKiloMarker';
|
||||
import { SlopeKiloMarker, SlopeKiloMarkerTemplate } from './SlopeKiloMarker';
|
||||
import { FederatedMouseEvent, IHitArea, Point } from 'pixi.js';
|
||||
import { IKiloMarkerData } from '../kilometerMarker/KilometerMarker';
|
||||
|
||||
export class KilometerMarkerHitArea implements IHitArea {
|
||||
kiloMarker: SlopeKiloMarker;
|
||||
@ -31,7 +28,7 @@ export class KilometerMarkerHitArea implements IHitArea {
|
||||
|
||||
export class SlopeKiloMarkerDrawAssistant extends GraphicDrawAssistant<
|
||||
SlopeKiloMarkerTemplate,
|
||||
ISlopeKiloMarkerData
|
||||
IKiloMarkerData
|
||||
> {
|
||||
slopeKiloMarker: SlopeKiloMarker;
|
||||
|
||||
@ -69,7 +66,7 @@ export class SlopeKiloMarkerDrawAssistant extends GraphicDrawAssistant<
|
||||
}
|
||||
this.container.position.set(cp.x, cp.y);
|
||||
}
|
||||
prepareData(data: ISlopeKiloMarkerData): boolean {
|
||||
prepareData(data: IKiloMarkerData): boolean {
|
||||
data.transform = this.container.saveTransform();
|
||||
return true;
|
||||
}
|
||||
|
@ -32,9 +32,10 @@ export namespace graphicData {
|
||||
slopes?: Slope[];
|
||||
CalculateLink?: CalculateLink[];
|
||||
slopeKiloMarker?: SlopeKiloMarker[];
|
||||
curvatureKiloMarker?: CurvatureKiloMarker[];
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4, 5, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], this.#one_of_decls);
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4, 5, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("canvas" in data && data.canvas != undefined) {
|
||||
this.canvas = data.canvas;
|
||||
@ -96,6 +97,9 @@ export namespace graphicData {
|
||||
if ("slopeKiloMarker" in data && data.slopeKiloMarker != undefined) {
|
||||
this.slopeKiloMarker = data.slopeKiloMarker;
|
||||
}
|
||||
if ("curvatureKiloMarker" in data && data.curvatureKiloMarker != undefined) {
|
||||
this.curvatureKiloMarker = data.curvatureKiloMarker;
|
||||
}
|
||||
}
|
||||
}
|
||||
get canvas() {
|
||||
@ -221,6 +225,12 @@ export namespace graphicData {
|
||||
set slopeKiloMarker(value: SlopeKiloMarker[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 25, value);
|
||||
}
|
||||
get curvatureKiloMarker() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, CurvatureKiloMarker, 26) as CurvatureKiloMarker[];
|
||||
}
|
||||
set curvatureKiloMarker(value: CurvatureKiloMarker[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 26, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
canvas?: ReturnType<typeof Canvas.prototype.toObject>;
|
||||
Platforms?: ReturnType<typeof Platform.prototype.toObject>[];
|
||||
@ -242,6 +252,7 @@ export namespace graphicData {
|
||||
slopes?: ReturnType<typeof Slope.prototype.toObject>[];
|
||||
CalculateLink?: ReturnType<typeof CalculateLink.prototype.toObject>[];
|
||||
slopeKiloMarker?: ReturnType<typeof SlopeKiloMarker.prototype.toObject>[];
|
||||
curvatureKiloMarker?: ReturnType<typeof CurvatureKiloMarker.prototype.toObject>[];
|
||||
}): RtssGraphicStorage {
|
||||
const message = new RtssGraphicStorage({});
|
||||
if (data.canvas != null) {
|
||||
@ -304,6 +315,9 @@ export namespace graphicData {
|
||||
if (data.slopeKiloMarker != null) {
|
||||
message.slopeKiloMarker = data.slopeKiloMarker.map(item => SlopeKiloMarker.fromObject(item));
|
||||
}
|
||||
if (data.curvatureKiloMarker != null) {
|
||||
message.curvatureKiloMarker = data.curvatureKiloMarker.map(item => CurvatureKiloMarker.fromObject(item));
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
@ -328,6 +342,7 @@ export namespace graphicData {
|
||||
slopes?: ReturnType<typeof Slope.prototype.toObject>[];
|
||||
CalculateLink?: ReturnType<typeof CalculateLink.prototype.toObject>[];
|
||||
slopeKiloMarker?: ReturnType<typeof SlopeKiloMarker.prototype.toObject>[];
|
||||
curvatureKiloMarker?: ReturnType<typeof CurvatureKiloMarker.prototype.toObject>[];
|
||||
} = {};
|
||||
if (this.canvas != null) {
|
||||
data.canvas = this.canvas.toObject();
|
||||
@ -389,6 +404,9 @@ export namespace graphicData {
|
||||
if (this.slopeKiloMarker != null) {
|
||||
data.slopeKiloMarker = this.slopeKiloMarker.map((item: SlopeKiloMarker) => item.toObject());
|
||||
}
|
||||
if (this.curvatureKiloMarker != null) {
|
||||
data.curvatureKiloMarker = this.curvatureKiloMarker.map((item: CurvatureKiloMarker) => item.toObject());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
@ -435,6 +453,8 @@ export namespace graphicData {
|
||||
writer.writeRepeatedMessage(24, this.CalculateLink, (item: CalculateLink) => item.serialize(writer));
|
||||
if (this.slopeKiloMarker.length)
|
||||
writer.writeRepeatedMessage(25, this.slopeKiloMarker, (item: SlopeKiloMarker) => item.serialize(writer));
|
||||
if (this.curvatureKiloMarker.length)
|
||||
writer.writeRepeatedMessage(26, this.curvatureKiloMarker, (item: CurvatureKiloMarker) => item.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -504,6 +524,9 @@ export namespace graphicData {
|
||||
case 25:
|
||||
reader.readMessage(message.slopeKiloMarker, () => pb_1.Message.addToRepeatedWrapperField(message, 25, SlopeKiloMarker.deserialize(reader), SlopeKiloMarker));
|
||||
break;
|
||||
case 26:
|
||||
reader.readMessage(message.curvatureKiloMarker, () => pb_1.Message.addToRepeatedWrapperField(message, 26, CurvatureKiloMarker.deserialize(reader), CurvatureKiloMarker));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
@ -4716,7 +4739,7 @@ export namespace graphicData {
|
||||
return SlopeKiloMarker.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class TurningRadiusKiloMarker extends pb_1.Message {
|
||||
export class CurvatureKiloMarker extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
common?: CommonInfo;
|
||||
@ -4762,8 +4785,8 @@ export namespace graphicData {
|
||||
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
|
||||
code?: string;
|
||||
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>[];
|
||||
}): TurningRadiusKiloMarker {
|
||||
const message = new TurningRadiusKiloMarker({});
|
||||
}): CurvatureKiloMarker {
|
||||
const message = new CurvatureKiloMarker({});
|
||||
if (data.common != null) {
|
||||
message.common = CommonInfo.fromObject(data.common);
|
||||
}
|
||||
@ -4805,8 +4828,8 @@ export namespace graphicData {
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): TurningRadiusKiloMarker {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new TurningRadiusKiloMarker();
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): CurvatureKiloMarker {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new CurvatureKiloMarker();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
@ -4828,8 +4851,8 @@ export namespace graphicData {
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): TurningRadiusKiloMarker {
|
||||
return TurningRadiusKiloMarker.deserialize(bytes);
|
||||
static deserializeBinary(bytes: Uint8Array): CurvatureKiloMarker {
|
||||
return CurvatureKiloMarker.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class Slope extends pb_1.Message {
|
||||
@ -4980,6 +5003,7 @@ export namespace graphicData {
|
||||
aRelatedRef?: RelatedRef;
|
||||
bRelatedRef?: RelatedRef;
|
||||
devicePositions?: CalculateLink.DevicePosition[];
|
||||
index?: number;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 6], this.#one_of_decls);
|
||||
@ -5002,6 +5026,9 @@ export namespace graphicData {
|
||||
if ("devicePositions" in data && data.devicePositions != undefined) {
|
||||
this.devicePositions = data.devicePositions;
|
||||
}
|
||||
if ("index" in data && data.index != undefined) {
|
||||
this.index = data.index;
|
||||
}
|
||||
}
|
||||
}
|
||||
get common() {
|
||||
@ -5049,6 +5076,12 @@ export namespace graphicData {
|
||||
set devicePositions(value: CalculateLink.DevicePosition[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 6, value);
|
||||
}
|
||||
get index() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 7, 0) as number;
|
||||
}
|
||||
set index(value: number) {
|
||||
pb_1.Message.setField(this, 7, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
|
||||
points?: ReturnType<typeof Point.prototype.toObject>[];
|
||||
@ -5056,6 +5089,7 @@ export namespace graphicData {
|
||||
aRelatedRef?: ReturnType<typeof RelatedRef.prototype.toObject>;
|
||||
bRelatedRef?: ReturnType<typeof RelatedRef.prototype.toObject>;
|
||||
devicePositions?: ReturnType<typeof CalculateLink.DevicePosition.prototype.toObject>[];
|
||||
index?: number;
|
||||
}): CalculateLink {
|
||||
const message = new CalculateLink({});
|
||||
if (data.common != null) {
|
||||
@ -5076,6 +5110,9 @@ export namespace graphicData {
|
||||
if (data.devicePositions != null) {
|
||||
message.devicePositions = data.devicePositions.map(item => CalculateLink.DevicePosition.fromObject(item));
|
||||
}
|
||||
if (data.index != null) {
|
||||
message.index = data.index;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
@ -5086,6 +5123,7 @@ export namespace graphicData {
|
||||
aRelatedRef?: ReturnType<typeof RelatedRef.prototype.toObject>;
|
||||
bRelatedRef?: ReturnType<typeof RelatedRef.prototype.toObject>;
|
||||
devicePositions?: ReturnType<typeof CalculateLink.DevicePosition.prototype.toObject>[];
|
||||
index?: number;
|
||||
} = {};
|
||||
if (this.common != null) {
|
||||
data.common = this.common.toObject();
|
||||
@ -5105,6 +5143,9 @@ export namespace graphicData {
|
||||
if (this.devicePositions != null) {
|
||||
data.devicePositions = this.devicePositions.map((item: CalculateLink.DevicePosition) => item.toObject());
|
||||
}
|
||||
if (this.index != null) {
|
||||
data.index = this.index;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
@ -5123,6 +5164,8 @@ export namespace graphicData {
|
||||
writer.writeMessage(5, this.bRelatedRef, () => this.bRelatedRef.serialize(writer));
|
||||
if (this.devicePositions.length)
|
||||
writer.writeRepeatedMessage(6, this.devicePositions, (item: CalculateLink.DevicePosition) => item.serialize(writer));
|
||||
if (this.index != 0)
|
||||
writer.writeInt32(7, this.index);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -5150,6 +5193,9 @@ export namespace graphicData {
|
||||
case 6:
|
||||
reader.readMessage(message.devicePositions, () => pb_1.Message.addToRepeatedWrapperField(message, 6, CalculateLink.DevicePosition.deserialize(reader), CalculateLink.DevicePosition));
|
||||
break;
|
||||
case 7:
|
||||
message.index = reader.readInt32();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user