公里标改为单个

This commit is contained in:
Yuan 2023-11-06 14:56:14 +08:00
parent 72f5f915c6
commit 0b624b8f7f
12 changed files with 41 additions and 139 deletions

View File

@ -24,48 +24,20 @@ const directionOptions = [
<div>公里标配置</div>
<q-input
outlined
v-model="kiloMarkerModel.kilometerSystem[0].coordinateSystem"
v-model="kiloMarkerModel.kilometerSystem.coordinateSystem"
@blur="onUpdate"
label="坐标系"
></q-input>
<q-input
outlined
v-model.number="kiloMarkerModel.kilometerSystem[0].kilometer"
v-model.number="kiloMarkerModel.kilometerSystem.kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
v-model="kiloMarkerModel.kilometerSystem[0].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
</q-item>
</q-list>
<q-list bordered separator class="rounded-borders">
<q-item no-wrap class="q-gutter-y-sm column">
<div>公里标配置</div>
<q-input
outlined
class="q-mt-lg"
v-model="kiloMarkerModel.kilometerSystem[1].coordinateSystem"
@blur="onUpdate"
label="坐标系"
></q-input>
<q-input
outlined
v-model.number="kiloMarkerModel.kilometerSystem[1].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
v-model="kiloMarkerModel.kilometerSystem[1].direction"
v-model="kiloMarkerModel.kilometerSystem.direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"

View File

@ -24,48 +24,20 @@ const directionOptions = [
<div>公里标配置</div>
<q-input
outlined
v-model="kiloMarkerModel.kilometerSystem[0].coordinateSystem"
v-model="kiloMarkerModel.kilometerSystem.coordinateSystem"
@blur="onUpdate"
label="坐标系"
></q-input>
<QInput
outlined
v-model.number="kiloMarkerModel.kilometerSystem[0].kilometer"
v-model.number="kiloMarkerModel.kilometerSystem.kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<QSelect
outlined
v-model="kiloMarkerModel.kilometerSystem[0].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></QSelect>
</q-item>
</q-list>
<q-list bordered separator class="rounded-borders">
<q-item no-wrap class="q-gutter-y-sm column">
<div>公里标配置</div>
<q-input
outlined
class="q-mt-lg"
v-model="kiloMarkerModel.kilometerSystem[1].coordinateSystem"
@blur="onUpdate"
label="坐标系"
></q-input>
<QInput
outlined
v-model.number="kiloMarkerModel.kilometerSystem[1].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<QSelect
outlined
v-model="kiloMarkerModel.kilometerSystem[1].direction"
v-model="kiloMarkerModel.kilometerSystem.direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"

View File

@ -21,14 +21,14 @@
<q-input
outlined
class="q-mt-sm"
v-model="turnoutModel.kilometerSystem[0].coordinateSystem"
v-model="turnoutModel.kilometerSystem.coordinateSystem"
@blur="onUpdate"
label="坐标系"
></q-input>
<q-input
outlined
class="q-mt-sm"
v-model.number="turnoutModel.kilometerSystem[0].kilometer"
v-model.number="turnoutModel.kilometerSystem.kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
@ -36,37 +36,7 @@
<q-select
outlined
class="q-mt-sm"
v-model="turnoutModel.kilometerSystem[0].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
</q-item>
</q-list>
<q-list bordered separator class="rounded-borders">
<q-item no-wrap class="q-gutter-y-sm column">
<div>公里标配置</div>
<q-input
outlined
class="q-mt-sm"
v-model="turnoutModel.kilometerSystem[1].coordinateSystem"
@blur="onUpdate"
label="坐标系"
></q-input>
<q-input
outlined
class="q-mt-sm"
v-model.number="turnoutModel.kilometerSystem[1].kilometer"
type="number"
@blur="onUpdate"
label="公里标2(mm):"
/>
<q-select
outlined
class="q-mt-sm"
v-model="turnoutModel.kilometerSystem[1].direction"
v-model="turnoutModel.kilometerSystem.direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"

View File

@ -31,18 +31,14 @@ export class CurvatureKiloMarkerData
set code(v: string) {
this.data.code = v;
}
get kilometerSystem(): KilometerSystem[] {
if (this.data.kilometerSystem.length < 2) {
this.data.kilometerSystem = Array(2)
.fill('')
.map(() => new graphicData.KilometerSystem());
get kilometerSystem(): KilometerSystem {
if (!this.data.kilometerSystem[0]) {
this.data.kilometerSystem[0] = new graphicData.KilometerSystem();
}
return this.data.kilometerSystem;
return this.data.kilometerSystem[0];
}
set kilometerSystem(value: KilometerSystem[]) {
this.data.kilometerSystem = value.map(
(v) => new graphicData.KilometerSystem(v)
);
set kilometerSystem(v: KilometerSystem) {
this.data.kilometerSystem[0] = new graphicData.KilometerSystem(v);
}
clone(): CurvatureKiloMarkerData {

View File

@ -31,18 +31,14 @@ export class SlopeKiloMarkerData
set code(v: string) {
this.data.code = v;
}
get kilometerSystem(): KilometerSystem[] {
if (this.data.kilometerSystem.length < 2) {
this.data.kilometerSystem = Array(2)
.fill('')
.map(() => new graphicData.KilometerSystem());
get kilometerSystem(): KilometerSystem {
if (!this.data.kilometerSystem[0]) {
this.data.kilometerSystem[0] = new graphicData.KilometerSystem();
}
return this.data.kilometerSystem;
return this.data.kilometerSystem[0];
}
set kilometerSystem(value: KilometerSystem[]) {
this.data.kilometerSystem = value.map(
(v) => new graphicData.KilometerSystem(v)
);
set kilometerSystem(v: KilometerSystem) {
this.data.kilometerSystem[0] = new graphicData.KilometerSystem(v);
}
clone(): SlopeKiloMarkerData {

View File

@ -123,7 +123,7 @@ export class TurnoutOperationPlugin extends GraphicInteractionPlugin<Turnout> {
const rp = item.getRelationParam(turnout);
return rp.getParam() == port;
});
const oKm = turnout.datas.kilometerSystem[0];
const oKm = turnout.datas.kilometerSystem;
let pKm;
if (findAc) {
const other = findAc.getOtherGraphic(turnout) as AxleCounting;
@ -140,7 +140,7 @@ export class TurnoutOperationPlugin extends GraphicInteractionPlugin<Turnout> {
});
if (findT) {
const other = findT.getOtherGraphic(turnout) as Turnout;
pKm = other.datas.kilometerSystem[0];
pKm = other.datas.kilometerSystem;
}
}
const d = getKmDistance(pKm, oKm);
@ -240,18 +240,14 @@ export class TurnoutData extends GraphicDataBase implements ITurnoutData {
set pcRef(ref: graphicData.RelatedRef) {
this.data.pcRef = ref;
}
get kilometerSystem(): KilometerSystem[] {
if (this.data.kilometerSystem.length < 2) {
this.data.kilometerSystem = Array(2)
.fill('')
.map(() => new graphicData.KilometerSystem());
get kilometerSystem(): KilometerSystem {
if (!this.data.kilometerSystem[0]) {
this.data.kilometerSystem[0] = new graphicData.KilometerSystem();
}
return this.data.kilometerSystem;
return this.data.kilometerSystem[0];
}
set kilometerSystem(value: KilometerSystem[]) {
this.data.kilometerSystem = value.map(
(v) => new graphicData.KilometerSystem(v)
);
set kilometerSystem(v: KilometerSystem) {
this.data.kilometerSystem[0] = new graphicData.KilometerSystem(v);
}
get index(): number {
return this.data.index;

View File

@ -78,13 +78,13 @@ export class CurvatureDraw extends GraphicDrawAssistant<
}
return (
refCurvatureKiloMarker?.datas.kilometerSystem[0].direction ==
refCurvatureKiloMarker?.datas.kilometerSystem.direction ==
dirSlop
);
});
const curvatureKiloMarkers = this.app.queryStore
.queryByType<CurvatureKiloMarker>(CurvatureKiloMarker.Type)
.filter((g) => g.datas.kilometerSystem[0]?.direction == dirSlop);
.filter((g) => g.datas.kilometerSystem?.direction == dirSlop);
curvatureKiloMarkers.sort((a, b) => a.position.x - b.position.x);
const curvatureKiloMarkersPos = curvatureKiloMarkers.map(
(g) => g.position.x

View File

@ -9,8 +9,8 @@ export const KiloMarkerConsts = {
export interface IKiloMarkerData extends GraphicData {
get code(): string; // 编号
set code(v: string);
get kilometerSystem(): KilometerSystem[];
set kilometerSystem(v: KilometerSystem[]);
get kilometerSystem(): KilometerSystem;
set kilometerSystem(v: KilometerSystem);
clone(): IKiloMarkerData;
copyFrom(data: IKiloMarkerData): void;
eq(other: IKiloMarkerData): boolean;

View File

@ -91,8 +91,8 @@ export class Slope extends JlGraphic {
this.datas.refDeviceId[1]
) as SlopeKiloMarker;
this.slopeLong.text =
slopeKiloMarkerR.datas.kilometerSystem[0]?.kilometer -
slopeKiloMarkerL.datas.kilometerSystem[0]?.kilometer;
slopeKiloMarkerR.datas.kilometerSystem.kilometer -
slopeKiloMarkerL.datas.kilometerSystem.kilometer;
this.slopeLong.position.set(centerPos.x, centerPos.y + 15);
}
loadRelations() {

View File

@ -75,12 +75,12 @@ export class SlopeDraw extends GraphicDrawAssistant<SlopeTemplate, ISlopeData> {
}
return (
refSlopeKiloMarker?.datas.kilometerSystem[0].direction == dirSlop
refSlopeKiloMarker?.datas.kilometerSystem.direction == dirSlop
);
});
const slopeKiloMarkers = this.app.queryStore
.queryByType<SlopeKiloMarker>(SlopeKiloMarker.Type)
.filter((g) => g.datas.kilometerSystem[0]?.direction == dirSlop);
.filter((g) => g.datas.kilometerSystem?.direction == dirSlop);
slopeKiloMarkers.sort((a, b) => a.position.x - b.position.x);
const slopeKiloMarkersPos = slopeKiloMarkers.map((g) => g.position.x);
//检验坡度有效性--是否有增加和删除

View File

@ -347,7 +347,7 @@ export class Train extends JlGraphic {
const rp = item.getRelationParam(dev as Turnout);
return rp.getParam() == this.states.devicePort;
});
const oKm = dev.datas.kilometerSystem[0];
const oKm = dev.datas.kilometerSystem;
let pKm;
if (findAc) {
const other = findAc.getOtherGraphic(dev) as AxleCounting;
@ -363,7 +363,7 @@ export class Train extends JlGraphic {
});
if (findT) {
const other = findT.getOtherGraphic(dev) as Turnout;
pKm = other.datas.kilometerSystem[0];
pKm = other.datas.kilometerSystem;
}
}
allLength = getKmDistance(pKm, oKm);

View File

@ -36,8 +36,8 @@ export interface ITurnoutData extends GraphicData {
set pbRef(ref: IRelatedRefData | undefined);
get pcRef(): IRelatedRefData | undefined;
set pcRef(ref: IRelatedRefData | undefined);
get kilometerSystem(): KilometerSystem[];
set kilometerSystem(v: KilometerSystem[]);
get kilometerSystem(): KilometerSystem;
set kilometerSystem(v: KilometerSystem);
get index(): number;
set index(v: number);
get paTrackSectionId(): string;