调整西安一三线路 导航名称显示流程

This commit is contained in:
zyy 2020-06-23 13:52:34 +08:00
parent 5984d0c7ac
commit 143325e6f6
5 changed files with 51 additions and 22 deletions

View File

@ -116,7 +116,7 @@ export default class Section extends Group {
const y = Math.min(model.points[0].y, model.points[model.points.length - 1].y) + Math.abs(model.points[model.points.length - 1].y - model.points[0].y) / 2;
const traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]);
const drict = model.trainPosType != '01' ? 1 : -1;
if (model.type == '01' && model.nameShow && style.Section.text.show) { // 物理区段名称
if (model.type == '01') { // 物理区段名称
const opposite = style.Section.text.opposite ? -1 : 1;
const tempx = x + traingle.getSin(style.Section.text.distance);
const tempy = y + traingle.getCos(style.Section.text.distance) * (style.Section.text.position || opposite * drict);
@ -137,7 +137,8 @@ export default class Section extends Group {
textVerticalAlign: style.Section.text.textVerticalAlign
});
this.add(this.name);
} else if (model.type == '02' && model.nameShow && style.Section.logicText.show) { // 逻辑区段
model.nameShow && style.Section.text.show ? this.name.show() : this.name.hide();
} else if (model.type == '02') { // 逻辑区段
const opposite = style.Section.logicText.opposite ? -1 : 1;
const tempx = x + traingle.getSin(style.Section.logicText.distance);
const tempy = y + traingle.getCos(style.Section.logicText.distance) * (style.Section.logicText.position || opposite * drict);
@ -158,7 +159,8 @@ export default class Section extends Group {
textVerticalAlign: style.Section.logicText.textVerticalAlign
});
this.add(this.name);
} else if (model.type == '04' && model.nameShow) { // 道岔计轴区段
model.nameShow && style.Section.logicText.show ? this.name.show() : this.name.hide();
} else if (model.type == '04') { // 道岔计轴区段
this.name = new ETextName({
zlevel: this.zlevel,
z: this.z + 2,
@ -176,10 +178,11 @@ export default class Section extends Group {
textVerticalAlign: style.Section.text.textVerticalAlign
});
this.add(this.name);
model.nameShow ? this.name.show() : this.name.hide();
}
/** 站台轨名称*/
if (model.standTrack && model.standTrackNameShow && style.Section.standText.show) {
if (model.standTrack) {
const opposite = style.Section.standText.opposite ? -1 : 1;
const tempx = x + traingle.getSin(style.Section.standText.distance);
const tempy = y + traingle.getCos(style.Section.standText.distance) * (style.Section.standText.position || opposite * drict);
@ -199,10 +202,11 @@ export default class Section extends Group {
textVerticalAlign: style.Section.standText.textVerticalAlign
});
this.add(this.standTrackText);
model.standTrackNameShow && style.Section.standText.show ? this.standTrackText.show() : this.standTrackText.hide();
}
/** 折返轨名称*/
if (model.reentryTrack && model.reentryTrackNameShow && style.Section.reentryText.show) {
if (model.reentryTrack) {
const opposite = style.Section.reentryText.opposite ? -1 : 1;
const tempx = x + traingle.getSin(style.Section.reentryText.distance);
const tempy = y + traingle.getCos(style.Section.reentryText.distance) * (style.Section.reentryText.position || opposite * drict);
@ -222,10 +226,11 @@ export default class Section extends Group {
textVerticalAlign: style.Section.reentryText.textVerticalAlign
});
this.add(this.reentryTrackText);
model.reentryTrackNameShow && style.Section.reentryText.show ? this.reentryTrackText.show() : this.reentryTrackText.hide();
}
/** 转换轨名称*/
if (model.transferTrack && model.transferTrackNameShow && style.Section.transferText.show) {
if (model.transferTrack) {
const opposite = style.Section.transferText.opposite ? -1 : 1;
const tempx = x + traingle.getSin(style.Section.transferText.distance);
const tempy = y + traingle.getCos(style.Section.transferText.distance) * (style.Section.transferText.position || opposite * drict);
@ -245,10 +250,11 @@ export default class Section extends Group {
textVerticalAlign: style.Section.transferText.textVerticalAlign
});
this.add(this.transferTrackText);
model.transferTrackNameShow && style.Section.transferText.show ? this.transferTrackText.show() : this.transferTrackText.hide();
}
/** 目的码名称*/
if (model.destinationCode && model.destinationNameShow && style.Section.destinationText.show) {
if (model.destinationCode) {
const opposite = style.Section.destinationText.opposite ? -1 : 1;
let tempx = x + traingle.getSin(style.Section.destinationText.distance);
let tempy = y + traingle.getCos(style.Section.destinationText.distance) * (style.Section.destinationText.position || opposite * drict);
@ -272,6 +278,7 @@ export default class Section extends Group {
textVerticalAlign: style.Section.destinationText.textVerticalAlign
});
this.add(this.destinationText);
model.destinationNameShow && style.Section.destinationText.show ? this.destinationText.show() : this.destinationText.hide();
}
}
@ -826,7 +833,7 @@ export default class Section extends Group {
getBoundingRect() {
if (this.section) {
return this.section.getBoundingRect();
} else {
} else if (this.name) {
return this.name.getBoundingRect();
}
}
@ -885,6 +892,22 @@ export default class Section extends Group {
item.show();
});
this.isShowShape = true;
if (this.name) {
this.model.nameShow && this.style.Section.text.show ? this.name.show() : this.name.hide();
}
if (this.transferTrackText) {
this.model.transferTrackNameShow && this.style.Section.transferText.show ? this.transferTrackText.show() : this.transferTrackText.hide();
}
if (this.standTrackText) {
this.model.standTrackNameShow && this.style.Section.standText.show ? this.standTrackText.show() : this.standTrackText.hide();
}
if (this.destinationText) {
this.model.destinationNameShow && this.style.Section.destinationText.show ? this.destinationText.show() : this.destinationText.hide();
}
if (this.reentryTrackText) {
this.model.reentryTrackNameShow && this.style.Section.reentryText.show ? this.reentryTrackText.show() : this.reentryTrackText.hide();
}
this.setState(this.model);
} else {
this.eachChild(item => {

View File

@ -543,12 +543,12 @@ class Signal extends Group {
recover() {
this.lamps.forEach(item=> { item.show(); });
this.sigName.setStyle({ textBorderWidth: 0 });
this.sigName.setColor(this.style.Signal.text.defaultColor);
this.setAutoClose();
this.sigDelay.hide();
this.sigAuto.animationRecover();
this.sigRoute.hide();
this.sigBack && this.sigBack.hide();
this.sigName.setColor(this.style.Signal.text.defaultColor);
this.sigPost.setColor(this.style.Signal.post.standardColor); // 设置底座默认颜色
if (this.style.Signal.lamp.guidName === 'singleRY') {
this.lamps[0].setStyle({ lineWidth: this.style.Signal.lamp.borderWidth });
@ -718,6 +718,7 @@ class Signal extends Group {
this.eachChild(item => {
item.show();
});
this.style.Signal.text.show && this.model.nameShow ? this.sigName.show() : this.sigName.hide();
this.isShowShape = true;
this.setState(this.model);
} else {

View File

@ -449,6 +449,9 @@ export default class Station extends Group {
this.eachChild(item => {
item.show();
});
if (this.mileageText) {
this.model.kmPostShow ? this.mileageText.show() : this.mileageText.hide();
}
this.isShowShape = true;
this.setState(this.model);
} else {

View File

@ -583,6 +583,9 @@ export default class Switch extends Group {
this.eachChild(item => {
item.show();
});
if (this.name) {
this.style.Switch.text.show && this.model.nameShow ? this.name.show() : this.name.hide();
}
this.isShowShape = true;
this.setState(this.model);
} else {

View File

@ -49,6 +49,7 @@
</el-col>
<el-col :span="10" :offset="4">
<el-checkbox dio :label="10">{{ $t('menu.menuDialog.destinationName') }}</el-checkbox>
<!-- 目的地名称 -->
</el-col>
</el-row>
<el-row>
@ -190,9 +191,10 @@ export default {
//
nameShow = false;
let standTrackNameShow = false;
let reentryTrackNameShow = false;
let transferTrackNameShow = false;
let standTrackNameShow = true;
let reentryTrackNameShow = true;
let transferTrackNameShow = true;
let destinationNameShow = true;
const sectionList = this.$store.getters['map/sectionList'];
if (sectionList && sectionList.length > 0) {
sectionList.forEach(elem => {
@ -214,21 +216,18 @@ export default {
}
//
if (elem.isStandTrack) {
standTrackNameShow = this.nameLevels.indexOf(2) !== -1;
}
//
if (elem.isReentryTrack) {
reentryTrackNameShow = this.nameLevels.indexOf(4) !== -1;
}
//
if (elem.isTransferTrack) {
transferTrackNameShow = this.nameLevels.indexOf(6) !== -1;
}
deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { nameShow, standTrackNameShow, reentryTrackNameShow, transferTrackNameShow }));
//
destinationNameShow = this.nameLevels.indexOf(10) !== -1;
deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { nameShow, standTrackNameShow, reentryTrackNameShow, transferTrackNameShow, destinationNameShow }));
});
}