添加生成曲度
This commit is contained in:
parent
75990f65af
commit
4a96f250ef
@ -107,6 +107,9 @@
|
||||
<slope-property
|
||||
v-else-if="drawStore.selectedGraphicType === Slope.Type"
|
||||
></slope-property>
|
||||
<curvature-property
|
||||
v-else-if="drawStore.selectedGraphicType === Curvature.Type"
|
||||
></curvature-property>
|
||||
</q-card-section>
|
||||
</template>
|
||||
</q-card>
|
||||
@ -159,6 +162,8 @@ import CurvatureKiloMarkerProperty from './properties/CurvatureKiloMarkerPropert
|
||||
import { SlopeKiloMarker } from 'src/graphics/slopeKiloMarker/SlopeKiloMarker';
|
||||
import { Slope } from 'src/graphics/slope/Slope';
|
||||
import SlopeProperty from './properties/SlopeProperty.vue';
|
||||
import { Curvature } from 'src/graphics/curvature/Curvature';
|
||||
import CurvatureProperty from './properties/CurvatureProperty.vue';
|
||||
import { CurvatureKiloMarker } from 'src/graphics/curvatureKiloMarker/CurvatureKiloMarker';
|
||||
|
||||
const drawStore = useDrawStore();
|
||||
|
97
src/components/draw-app/properties/CurvatureProperty.vue
Normal file
97
src/components/draw-app/properties/CurvatureProperty.vue
Normal file
@ -0,0 +1,97 @@
|
||||
<template>
|
||||
<q-form class="q-gutter-sm">
|
||||
<q-input outlined readonly v-model="curvatureModel.id" label="id" hint="" />
|
||||
<q-input
|
||||
outlined
|
||||
readonly
|
||||
label="曲度方向"
|
||||
type="textarea"
|
||||
@blur="onUpdate"
|
||||
v-model="direction"
|
||||
lazy-rules
|
||||
autogrow
|
||||
/>
|
||||
<q-input
|
||||
outlined
|
||||
label="曲度半径"
|
||||
type="number"
|
||||
@blur="onUpdate"
|
||||
v-model.number="curvatureModel.curvatureNumber"
|
||||
lazy-rules
|
||||
autogrow
|
||||
/>
|
||||
<q-list bordered separator class="rounded-borders">
|
||||
<q-item>
|
||||
<q-item-section no-wrap class="q-gutter-y-sm column">
|
||||
<q-item-label> 关联的曲度公里标 </q-item-label>
|
||||
<div class="q-gutter-sm row">
|
||||
<q-chip
|
||||
v-for="item in curvatureKiloMarkerRelations"
|
||||
:key="item"
|
||||
square
|
||||
color="primary"
|
||||
text-color="white"
|
||||
>
|
||||
{{ item }}
|
||||
</q-chip>
|
||||
</div>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-form>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { CurvatureData } from 'src/drawApp/graphics/CurvatureInteraction';
|
||||
import { Curvature } from 'src/graphics/curvature/Curvature';
|
||||
import { CurvatureKiloMarker } from 'src/graphics/curvatureKiloMarker/CurvatureKiloMarker';
|
||||
import { useDrawStore } from 'src/stores/draw-store';
|
||||
import { computed, onMounted, reactive, ref, watch } from 'vue';
|
||||
|
||||
const drawStore = useDrawStore();
|
||||
const curvatureModel = reactive(new CurvatureData());
|
||||
const direction = ref('无曲度');
|
||||
|
||||
drawStore.$subscribe;
|
||||
watch(
|
||||
() => drawStore.selectedGraphic,
|
||||
(val) => {
|
||||
if (val && val.type == Curvature.Type) {
|
||||
curvatureModel.copyFrom(val.saveData() as CurvatureData);
|
||||
if (curvatureModel.curvatureNumber !== 0) {
|
||||
direction.value = curvatureModel.curvatureNumber > 0 ? '外侧' : '内侧';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
const curvature = drawStore.selectedGraphic as Curvature;
|
||||
if (curvature) {
|
||||
curvatureModel.copyFrom(curvature.saveData());
|
||||
if (curvatureModel.curvatureNumber !== 0) {
|
||||
direction.value = curvatureModel.curvatureNumber > 0 ? '外侧' : '内侧';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function onUpdate() {
|
||||
const curvature = drawStore.selectedGraphic as Curvature;
|
||||
if (curvature) {
|
||||
drawStore.getDrawApp().updateGraphicAndRecord(curvature, curvatureModel);
|
||||
}
|
||||
}
|
||||
|
||||
const curvatureKiloMarkerRelations = computed(() => {
|
||||
const curvature = drawStore.selectedGraphic as Curvature;
|
||||
const relations = curvature?.relationManage.getRelationsOfGraphicAndOtherType(
|
||||
curvature,
|
||||
CurvatureKiloMarker.Type
|
||||
);
|
||||
const ref = relations.map(
|
||||
(relation) =>
|
||||
`${relation.getOtherGraphic<CurvatureKiloMarker>(curvature).datas.id}`
|
||||
);
|
||||
return Array.from(new Set(ref));
|
||||
});
|
||||
</script>
|
@ -33,7 +33,7 @@
|
||||
<q-list bordered separator class="rounded-borders">
|
||||
<q-item>
|
||||
<q-item-section no-wrap class="q-gutter-y-sm column">
|
||||
<q-item-label> 关联的设备 </q-item-label>
|
||||
<q-item-label> 关联的坡度公里标 </q-item-label>
|
||||
<div class="q-gutter-sm row">
|
||||
<q-chip
|
||||
v-for="item in slopeKiloMarkerRelations"
|
||||
|
52
src/drawApp/graphics/CurvatureInteraction.ts
Normal file
52
src/drawApp/graphics/CurvatureInteraction.ts
Normal file
@ -0,0 +1,52 @@
|
||||
import * as pb_1 from 'google-protobuf';
|
||||
import { GraphicDataBase } from './GraphicDataBase';
|
||||
import { ICurvatureData, Curvature } from 'src/graphics/curvature/Curvature';
|
||||
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
||||
import { IPointData } from 'pixi.js';
|
||||
|
||||
export class CurvatureData extends GraphicDataBase implements ICurvatureData {
|
||||
constructor(data?: graphicData.Curvature) {
|
||||
let curvature;
|
||||
if (!data) {
|
||||
curvature = new graphicData.Curvature({
|
||||
common: GraphicDataBase.defaultCommonInfo(Curvature.Type),
|
||||
});
|
||||
} else {
|
||||
curvature = data;
|
||||
}
|
||||
super(curvature);
|
||||
}
|
||||
public get data(): graphicData.Curvature {
|
||||
return this.getData<graphicData.Curvature>();
|
||||
}
|
||||
get points(): IPointData[] {
|
||||
return this.data.points;
|
||||
}
|
||||
set points(points: IPointData[]) {
|
||||
this.data.points = points.map(
|
||||
(p) => new graphicData.Point({ x: p.x, y: p.y })
|
||||
);
|
||||
}
|
||||
get curvatureNumber(): number {
|
||||
return this.data.curvatureNumber;
|
||||
}
|
||||
set curvatureNumber(v: number) {
|
||||
this.data.curvatureNumber = v;
|
||||
}
|
||||
get refDeviceId(): string[] {
|
||||
return this.data.refDeviceId;
|
||||
}
|
||||
set refDeviceId(v: string[]) {
|
||||
this.data.refDeviceId = v;
|
||||
}
|
||||
|
||||
clone(): CurvatureData {
|
||||
return new CurvatureData(this.data.cloneMessage());
|
||||
}
|
||||
copyFrom(data: CurvatureData): void {
|
||||
pb_1.Message.copyInto(data.data, this.data);
|
||||
}
|
||||
eq(other: CurvatureData): boolean {
|
||||
return pb_1.Message.equals(this.data, other.data);
|
||||
}
|
||||
}
|
@ -127,6 +127,9 @@ import {
|
||||
} from 'src/graphics/curvatureKiloMarker/CurvatureKiloMarker';
|
||||
import { CurvatureKiloMarkerDrawAssistant } from 'src/graphics/curvatureKiloMarker/CurvatureKiloMarkerDrawAssistant';
|
||||
import { CurvatureKiloMarkerData } from './graphics/CurvatureKiloMarkerInteraction';
|
||||
import { Curvature, CurvatureTemplate } from 'src/graphics/curvature/Curvature';
|
||||
import { CurvatureData } from './graphics/CurvatureInteraction';
|
||||
import { CurvatureDraw } from 'src/graphics/curvature/CurvatureAssistant';
|
||||
|
||||
// export function fromStoragePoint(p: graphicData.Point): Point {
|
||||
// return new Point(p.x, p.y);
|
||||
@ -217,6 +220,7 @@ const showType = [
|
||||
SlopeKiloMarker.Type,
|
||||
Slope.Type,
|
||||
CurvatureKiloMarker.Type,
|
||||
Curvature.Type,
|
||||
];
|
||||
export const drawLayerList = [
|
||||
// 图层列表
|
||||
@ -265,6 +269,7 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp {
|
||||
| SlopeKiloMarkerDrawAssistant
|
||||
| SlopeDraw
|
||||
| CurvatureKiloMarkerDrawAssistant
|
||||
| CurvatureDraw
|
||||
)[] = [];
|
||||
if (draftType === 'Line') {
|
||||
drawAssistants = [
|
||||
@ -319,6 +324,7 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp {
|
||||
app,
|
||||
new CurvatureKiloMarkerTemplate(new CurvatureKiloMarkerData())
|
||||
),
|
||||
new CurvatureDraw(app, new CurvatureTemplate(new CurvatureData())),
|
||||
];
|
||||
DrawSignalInteraction.init(app);
|
||||
DrawStopPositionInteraction.init(app);
|
||||
@ -492,6 +498,9 @@ export function saveDrawDatas(app: JlDrawApp) {
|
||||
storage.curvatureKiloMarker.push(
|
||||
(curvatureKiloMarkerData as CurvatureKiloMarkerData).data
|
||||
);
|
||||
} else if (Curvature.Type === g.type) {
|
||||
const curvatureData = (g as Curvature).saveData();
|
||||
storage.curvatures.push((curvatureData as CurvatureData).data);
|
||||
}
|
||||
});
|
||||
const base64 = fromUint8Array(storage.serialize());
|
||||
@ -584,6 +593,9 @@ export async function loadDrawDatas(app: GraphicApp) {
|
||||
storage.slopes.forEach((slope) => {
|
||||
datas.push(new SlopeData(slope));
|
||||
});
|
||||
storage.curvatures.forEach((curvature) => {
|
||||
datas.push(new CurvatureData(curvature));
|
||||
});
|
||||
await app.loadGraphic(datas);
|
||||
} else {
|
||||
app.loadGraphic([]);
|
||||
|
115
src/graphics/curvature/Curvature.ts
Normal file
115
src/graphics/curvature/Curvature.ts
Normal file
@ -0,0 +1,115 @@
|
||||
import { Graphics, IPointData } from 'pixi.js';
|
||||
import {
|
||||
GraphicData,
|
||||
JlGraphic,
|
||||
JlGraphicTemplate,
|
||||
VectorText,
|
||||
calculateLineMidpoint,
|
||||
} from 'src/jl-graphic';
|
||||
import { KiloMarkerConsts } from '../kilometerMarker/KilometerMarker';
|
||||
export interface ICurvatureData extends GraphicData {
|
||||
get points(): IPointData[]; // 线坐标点
|
||||
set points(points: IPointData[]);
|
||||
get curvatureNumber(): number; // 曲度的值
|
||||
set curvatureNumber(v: number);
|
||||
get refDeviceId(): string[]; // 曲度关联的设备id
|
||||
set refDeviceId(v: string[]);
|
||||
clone(): ICurvatureData;
|
||||
copyFrom(data: ICurvatureData): void;
|
||||
eq(other: ICurvatureData): boolean;
|
||||
}
|
||||
|
||||
export const CurvatureConsts = {
|
||||
lineColor: '0xffffff',
|
||||
lineWidth: 2,
|
||||
};
|
||||
|
||||
export class Curvature extends JlGraphic {
|
||||
static Type = 'Curvature';
|
||||
lineGraphic: Graphics;
|
||||
curvatureNumber: VectorText;
|
||||
constructor() {
|
||||
super(Curvature.Type);
|
||||
this.lineGraphic = new Graphics();
|
||||
this.curvatureNumber = new VectorText();
|
||||
this.curvatureNumber.name = 'curvatureNumber';
|
||||
const vectorTexts = [this.curvatureNumber];
|
||||
vectorTexts.forEach((vectorText) => {
|
||||
vectorText.setVectorFontSize(14);
|
||||
vectorText.anchor.set(0.5);
|
||||
vectorText.style.fill = '0xffffff';
|
||||
vectorText.transformSave = true;
|
||||
});
|
||||
this.transformSave = true;
|
||||
this.addChild(this.lineGraphic);
|
||||
this.addChild(this.curvatureNumber);
|
||||
}
|
||||
|
||||
get datas(): ICurvatureData {
|
||||
return this.getDatas<ICurvatureData>();
|
||||
}
|
||||
doRepaint(): void {
|
||||
if (this.datas.points.length < 2) {
|
||||
throw new Error('Curvature坐标数据异常');
|
||||
}
|
||||
this.lineGraphic.clear();
|
||||
this.lineGraphic.lineStyle(
|
||||
CurvatureConsts.lineWidth,
|
||||
CurvatureConsts.lineColor
|
||||
);
|
||||
let distanceY = 0;
|
||||
if (this.datas.curvatureNumber !== 0) {
|
||||
distanceY =
|
||||
this.datas.curvatureNumber > 0
|
||||
? -KiloMarkerConsts.size / 2
|
||||
: KiloMarkerConsts.size / 2;
|
||||
}
|
||||
this.datas.points.forEach((p, i) => {
|
||||
if (i !== 0) {
|
||||
this.lineGraphic.lineTo(p.x, p.y + distanceY);
|
||||
} else {
|
||||
this.lineGraphic.moveTo(p.x, p.y + distanceY);
|
||||
}
|
||||
});
|
||||
//曲度值
|
||||
const text = Math.abs(this.datas.curvatureNumber);
|
||||
this.curvatureNumber.text = text ? `R-${text}` : '';
|
||||
const centerPos = calculateLineMidpoint(
|
||||
this.datas.points[0],
|
||||
this.datas.points[this.datas.points.length - 1]
|
||||
);
|
||||
this.curvatureNumber.position.set(
|
||||
centerPos.x,
|
||||
centerPos.y + distanceY - 15
|
||||
);
|
||||
}
|
||||
get linePoints(): IPointData[] {
|
||||
return this.datas.points;
|
||||
}
|
||||
set linePoints(points: IPointData[]) {
|
||||
const old = this.datas.clone();
|
||||
old.points = points;
|
||||
this.updateData(old);
|
||||
}
|
||||
loadRelations() {
|
||||
if (this.datas.refDeviceId.length) {
|
||||
this.datas.refDeviceId.forEach((id) => {
|
||||
const curvatureKiloMarker = this.queryStore.queryById(id);
|
||||
this.relationManage.addRelation(this, curvatureKiloMarker);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class CurvatureTemplate extends JlGraphicTemplate<Curvature> {
|
||||
constructor(dataTemplate: ICurvatureData) {
|
||||
super(Curvature.Type, {
|
||||
dataTemplate,
|
||||
});
|
||||
}
|
||||
new(): Curvature {
|
||||
const curvature = new Curvature();
|
||||
curvature.loadData(this.datas);
|
||||
return curvature;
|
||||
}
|
||||
}
|
165
src/graphics/curvature/CurvatureAssistant.ts
Normal file
165
src/graphics/curvature/CurvatureAssistant.ts
Normal file
@ -0,0 +1,165 @@
|
||||
import { FederatedPointerEvent, IHitArea, Point } from 'pixi.js';
|
||||
import {
|
||||
GraphicDrawAssistant,
|
||||
GraphicIdGenerator,
|
||||
GraphicInteractionPlugin,
|
||||
JlDrawApp,
|
||||
JlGraphic,
|
||||
linePoint,
|
||||
} from 'src/jl-graphic';
|
||||
|
||||
import {
|
||||
ICurvatureData,
|
||||
Curvature,
|
||||
CurvatureTemplate,
|
||||
CurvatureConsts,
|
||||
} from './Curvature';
|
||||
import { CurvatureKiloMarker } from '../curvatureKiloMarker/CurvatureKiloMarker';
|
||||
|
||||
export interface ICurvatureDrawOptions {
|
||||
newData: () => ICurvatureData;
|
||||
}
|
||||
export class CurvatureDraw extends GraphicDrawAssistant<
|
||||
CurvatureTemplate,
|
||||
ICurvatureData
|
||||
> {
|
||||
codeGraph: Curvature;
|
||||
constructor(app: JlDrawApp, template: CurvatureTemplate) {
|
||||
super(app, template, 'sym_o_circle', '不展示');
|
||||
this.codeGraph = this.graphicTemplate.new();
|
||||
this.container.addChild(this.codeGraph);
|
||||
CurvatureInteraction.init(app);
|
||||
}
|
||||
|
||||
bind(): void {
|
||||
super.bind();
|
||||
this.codeGraph.loadData(this.graphicTemplate.datas);
|
||||
this.codeGraph.doRepaint();
|
||||
}
|
||||
|
||||
clearCache(): void {
|
||||
//this.codeGraph.destroy();
|
||||
}
|
||||
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: ICurvatureData): boolean {
|
||||
data.transform = this.container.saveTransform();
|
||||
return true;
|
||||
}
|
||||
draw(graphics: CurvatureKiloMarker[], map: Map<string, number>) {
|
||||
if (
|
||||
map.has(`${graphics[0].id}+${graphics[1].id}`) ||
|
||||
map.has(`${graphics[1].id}+${graphics[0].id}`)
|
||||
)
|
||||
return;
|
||||
map.set(`${graphics[0].id}+${graphics[1].id}`, 1);
|
||||
const curvature = new Curvature();
|
||||
curvature.loadData(this.graphicTemplate.datas);
|
||||
curvature.datas.points = [graphics[0].position, graphics[1].position];
|
||||
curvature.id = GraphicIdGenerator.next();
|
||||
curvature.datas.refDeviceId = [graphics[0].id, graphics[1].id];
|
||||
this.storeGraphic(curvature);
|
||||
curvature.loadRelations();
|
||||
}
|
||||
oneGenerates() {
|
||||
const map = new Map();
|
||||
for (let dirSlop = 0; dirSlop < 2; dirSlop++) {
|
||||
const curvatures = this.app.queryStore
|
||||
.queryByType<Curvature>(Curvature.Type)
|
||||
.filter((g) => {
|
||||
let refCurvatureKiloMarker;
|
||||
try {
|
||||
refCurvatureKiloMarker = this.app.queryStore.queryById(
|
||||
g.datas.refDeviceId[0]
|
||||
) as CurvatureKiloMarker;
|
||||
} catch (error) {
|
||||
this.app.deleteGraphics(g);
|
||||
}
|
||||
|
||||
return (
|
||||
refCurvatureKiloMarker?.datas.kilometerSystem[0].direction ==
|
||||
dirSlop
|
||||
);
|
||||
});
|
||||
const curvatureKiloMarkers = this.app.queryStore
|
||||
.queryByType<CurvatureKiloMarker>(CurvatureKiloMarker.Type)
|
||||
.filter((g) => g.datas.kilometerSystem[0].direction == dirSlop);
|
||||
curvatureKiloMarkers.sort((a, b) => a.position.x - b.position.x);
|
||||
const curvatureKiloMarkersPos = curvatureKiloMarkers.map(
|
||||
(g) => g.position.x
|
||||
);
|
||||
//检验曲度有效性--是否有增加和删除
|
||||
curvatures.forEach((curvature) => {
|
||||
const pS = curvature.datas.points[0].x;
|
||||
const mapS = curvatureKiloMarkersPos.findIndex((x) => x == pS);
|
||||
const pE = curvature.datas.points[1].x;
|
||||
const mapE = curvatureKiloMarkersPos.findIndex((x) => x == pE);
|
||||
if (mapS !== -1 && mapE !== -1 && mapE - mapS == 1) {
|
||||
map.set(
|
||||
`${curvature.datas.refDeviceId[0]}+${curvature.datas.refDeviceId[1]}`,
|
||||
1
|
||||
);
|
||||
} else {
|
||||
this.app.deleteGraphics(curvature);
|
||||
}
|
||||
});
|
||||
for (let i = 0; i < curvatureKiloMarkers.length - 1; i++) {
|
||||
this.draw([curvatureKiloMarkers[i], curvatureKiloMarkers[i + 1]], map);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
class CurvatureGraphicHitArea implements IHitArea {
|
||||
curvature: Curvature;
|
||||
constructor(curvature: Curvature) {
|
||||
this.curvature = curvature;
|
||||
}
|
||||
contains(x: number, y: number): boolean {
|
||||
for (let i = 1; i < this.curvature.datas.points.length; i++) {
|
||||
const p1 = this.curvature.datas.points[i - 1];
|
||||
const p2 = this.curvature.datas.points[i];
|
||||
if (linePoint(p1, p2, { x, y }, CurvatureConsts.lineWidth)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export class CurvatureInteraction extends GraphicInteractionPlugin<Curvature> {
|
||||
static Name = 'Curvature_transform';
|
||||
constructor(app: JlDrawApp) {
|
||||
super(CurvatureInteraction.Name, app);
|
||||
}
|
||||
static init(app: JlDrawApp) {
|
||||
return new CurvatureInteraction(app);
|
||||
}
|
||||
filter(...grahpics: JlGraphic[]): Curvature[] | undefined {
|
||||
return grahpics
|
||||
.filter((g) => g.type === Curvature.Type)
|
||||
.map((g) => g as Curvature);
|
||||
}
|
||||
bind(g: Curvature): void {
|
||||
g.eventMode = 'static';
|
||||
g.cursor = 'pointer';
|
||||
g.scalable = true;
|
||||
g.draggable = false;
|
||||
g.transformSave = true;
|
||||
g.lineGraphic.eventMode = 'static';
|
||||
g.lineGraphic.cursor = 'pointer';
|
||||
g.lineGraphic.hitArea = new CurvatureGraphicHitArea(g);
|
||||
}
|
||||
unbind(g: Curvature): void {
|
||||
g.eventMode = 'none';
|
||||
g.lineGraphic.eventMode = 'none';
|
||||
g.lineGraphic.draggable = false;
|
||||
g.lineGraphic.selectable = false;
|
||||
g.lineGraphic.transformSave = false;
|
||||
}
|
||||
}
|
@ -74,7 +74,9 @@ export class Slope extends JlGraphic {
|
||||
}
|
||||
});
|
||||
//坡度值
|
||||
this.slopeNumber.text = parseFloat(this.datas.slopeNumber / 1000 + '');
|
||||
this.slopeNumber.text = Math.abs(
|
||||
parseFloat(this.datas.slopeNumber / 1000 + '')
|
||||
);
|
||||
const slopeNumberPosition = this.datas.childTransforms?.find(
|
||||
(t) => t.name === this.slopeNumber.name
|
||||
)?.transform.position;
|
||||
|
@ -46,6 +46,9 @@
|
||||
<q-item clickable v-close-popup @click="oneClickSlope">
|
||||
<q-item-section>一键生成坡度</q-item-section>
|
||||
</q-item>
|
||||
<q-item clickable v-close-popup @click="oneClickCurvature">
|
||||
<q-item-section>一键生成曲度</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-menu>
|
||||
</q-btn>
|
||||
@ -252,6 +255,8 @@ import { useQuasar } from 'quasar';
|
||||
import LayerControlDialog from 'src/components/draw-app/dialogs/LayerControlDialog.vue';
|
||||
import { drawLayerList } from 'src/drawApp/index';
|
||||
import { useLineStore } from 'src/stores/line-store';
|
||||
import { Curvature } from 'src/graphics/curvature/Curvature';
|
||||
import { CurvatureDraw } from 'src/graphics/curvature/CurvatureAssistant';
|
||||
|
||||
const $q = useQuasar();
|
||||
const route = useRoute();
|
||||
@ -442,6 +447,13 @@ function oneClickSlope() {
|
||||
.getDrawAssistant(Slope.Type) as SlopeDraw;
|
||||
slopeDraw.oneGenerates();
|
||||
}
|
||||
function oneClickCurvature() {
|
||||
//一键生成曲度
|
||||
const curvatureDraw = drawStore
|
||||
.getDrawApp()
|
||||
.getDrawAssistant(Curvature.Type) as CurvatureDraw;
|
||||
curvatureDraw.oneGenerates();
|
||||
}
|
||||
function oneClickLink() {
|
||||
drawStore.oneClickType = 'SectionLink';
|
||||
const draw = drawStore
|
||||
|
@ -33,9 +33,10 @@ export namespace graphicData {
|
||||
CalculateLink?: CalculateLink[];
|
||||
slopeKiloMarker?: SlopeKiloMarker[];
|
||||
curvatureKiloMarker?: CurvatureKiloMarker[];
|
||||
curvatures?: Curvature[];
|
||||
}) {
|
||||
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, 26], 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, 27], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("canvas" in data && data.canvas != undefined) {
|
||||
this.canvas = data.canvas;
|
||||
@ -100,6 +101,9 @@ export namespace graphicData {
|
||||
if ("curvatureKiloMarker" in data && data.curvatureKiloMarker != undefined) {
|
||||
this.curvatureKiloMarker = data.curvatureKiloMarker;
|
||||
}
|
||||
if ("curvatures" in data && data.curvatures != undefined) {
|
||||
this.curvatures = data.curvatures;
|
||||
}
|
||||
}
|
||||
}
|
||||
get canvas() {
|
||||
@ -231,6 +235,12 @@ export namespace graphicData {
|
||||
set curvatureKiloMarker(value: CurvatureKiloMarker[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 26, value);
|
||||
}
|
||||
get curvatures() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, Curvature, 27) as Curvature[];
|
||||
}
|
||||
set curvatures(value: Curvature[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 27, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
canvas?: ReturnType<typeof Canvas.prototype.toObject>;
|
||||
Platforms?: ReturnType<typeof Platform.prototype.toObject>[];
|
||||
@ -253,6 +263,7 @@ export namespace graphicData {
|
||||
CalculateLink?: ReturnType<typeof CalculateLink.prototype.toObject>[];
|
||||
slopeKiloMarker?: ReturnType<typeof SlopeKiloMarker.prototype.toObject>[];
|
||||
curvatureKiloMarker?: ReturnType<typeof CurvatureKiloMarker.prototype.toObject>[];
|
||||
curvatures?: ReturnType<typeof Curvature.prototype.toObject>[];
|
||||
}): RtssGraphicStorage {
|
||||
const message = new RtssGraphicStorage({});
|
||||
if (data.canvas != null) {
|
||||
@ -318,6 +329,9 @@ export namespace graphicData {
|
||||
if (data.curvatureKiloMarker != null) {
|
||||
message.curvatureKiloMarker = data.curvatureKiloMarker.map(item => CurvatureKiloMarker.fromObject(item));
|
||||
}
|
||||
if (data.curvatures != null) {
|
||||
message.curvatures = data.curvatures.map(item => Curvature.fromObject(item));
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
@ -343,6 +357,7 @@ export namespace graphicData {
|
||||
CalculateLink?: ReturnType<typeof CalculateLink.prototype.toObject>[];
|
||||
slopeKiloMarker?: ReturnType<typeof SlopeKiloMarker.prototype.toObject>[];
|
||||
curvatureKiloMarker?: ReturnType<typeof CurvatureKiloMarker.prototype.toObject>[];
|
||||
curvatures?: ReturnType<typeof Curvature.prototype.toObject>[];
|
||||
} = {};
|
||||
if (this.canvas != null) {
|
||||
data.canvas = this.canvas.toObject();
|
||||
@ -407,6 +422,9 @@ export namespace graphicData {
|
||||
if (this.curvatureKiloMarker != null) {
|
||||
data.curvatureKiloMarker = this.curvatureKiloMarker.map((item: CurvatureKiloMarker) => item.toObject());
|
||||
}
|
||||
if (this.curvatures != null) {
|
||||
data.curvatures = this.curvatures.map((item: Curvature) => item.toObject());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
@ -455,6 +473,8 @@ export namespace graphicData {
|
||||
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 (this.curvatures.length)
|
||||
writer.writeRepeatedMessage(27, this.curvatures, (item: Curvature) => item.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -527,6 +547,9 @@ export namespace graphicData {
|
||||
case 26:
|
||||
reader.readMessage(message.curvatureKiloMarker, () => pb_1.Message.addToRepeatedWrapperField(message, 26, CurvatureKiloMarker.deserialize(reader), CurvatureKiloMarker));
|
||||
break;
|
||||
case 27:
|
||||
reader.readMessage(message.curvatures, () => pb_1.Message.addToRepeatedWrapperField(message, 27, Curvature.deserialize(reader), Curvature));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
@ -4994,6 +5017,145 @@ export namespace graphicData {
|
||||
return Slope.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class Curvature extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
common?: CommonInfo;
|
||||
points?: Point[];
|
||||
curvatureNumber?: number;
|
||||
refDeviceId?: string[];
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 4], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("common" in data && data.common != undefined) {
|
||||
this.common = data.common;
|
||||
}
|
||||
if ("points" in data && data.points != undefined) {
|
||||
this.points = data.points;
|
||||
}
|
||||
if ("curvatureNumber" in data && data.curvatureNumber != undefined) {
|
||||
this.curvatureNumber = data.curvatureNumber;
|
||||
}
|
||||
if ("refDeviceId" in data && data.refDeviceId != undefined) {
|
||||
this.refDeviceId = data.refDeviceId;
|
||||
}
|
||||
}
|
||||
}
|
||||
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 points() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, Point, 2) as Point[];
|
||||
}
|
||||
set points(value: Point[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 2, value);
|
||||
}
|
||||
get curvatureNumber() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 3, 0) as number;
|
||||
}
|
||||
set curvatureNumber(value: number) {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
}
|
||||
get refDeviceId() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 4, []) as string[];
|
||||
}
|
||||
set refDeviceId(value: string[]) {
|
||||
pb_1.Message.setField(this, 4, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
|
||||
points?: ReturnType<typeof Point.prototype.toObject>[];
|
||||
curvatureNumber?: number;
|
||||
refDeviceId?: string[];
|
||||
}): Curvature {
|
||||
const message = new Curvature({});
|
||||
if (data.common != null) {
|
||||
message.common = CommonInfo.fromObject(data.common);
|
||||
}
|
||||
if (data.points != null) {
|
||||
message.points = data.points.map(item => Point.fromObject(item));
|
||||
}
|
||||
if (data.curvatureNumber != null) {
|
||||
message.curvatureNumber = data.curvatureNumber;
|
||||
}
|
||||
if (data.refDeviceId != null) {
|
||||
message.refDeviceId = data.refDeviceId;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
|
||||
points?: ReturnType<typeof Point.prototype.toObject>[];
|
||||
curvatureNumber?: number;
|
||||
refDeviceId?: string[];
|
||||
} = {};
|
||||
if (this.common != null) {
|
||||
data.common = this.common.toObject();
|
||||
}
|
||||
if (this.points != null) {
|
||||
data.points = this.points.map((item: Point) => item.toObject());
|
||||
}
|
||||
if (this.curvatureNumber != null) {
|
||||
data.curvatureNumber = this.curvatureNumber;
|
||||
}
|
||||
if (this.refDeviceId != null) {
|
||||
data.refDeviceId = this.refDeviceId;
|
||||
}
|
||||
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.points.length)
|
||||
writer.writeRepeatedMessage(2, this.points, (item: Point) => item.serialize(writer));
|
||||
if (this.curvatureNumber != 0)
|
||||
writer.writeSint32(3, this.curvatureNumber);
|
||||
if (this.refDeviceId.length)
|
||||
writer.writeRepeatedString(4, this.refDeviceId);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Curvature {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Curvature();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
reader.readMessage(message.common, () => message.common = CommonInfo.deserialize(reader));
|
||||
break;
|
||||
case 2:
|
||||
reader.readMessage(message.points, () => pb_1.Message.addToRepeatedWrapperField(message, 2, Point.deserialize(reader), Point));
|
||||
break;
|
||||
case 3:
|
||||
message.curvatureNumber = reader.readSint32();
|
||||
break;
|
||||
case 4:
|
||||
pb_1.Message.addToRepeatedField(message, 4, reader.readString());
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): Curvature {
|
||||
return Curvature.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class CalculateLink extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
|
Loading…
Reference in New Issue
Block a user