西安二号线绘图 站台 扣车 代码调整

This commit is contained in:
joylink_cuiweidong 2020-04-17 16:39:42 +08:00
parent 795ad48e32
commit 211db36aca
5 changed files with 102 additions and 19 deletions

View File

@ -254,12 +254,14 @@ class SkinCode extends defaultStyle {
detainCar: { // 扣车
position: -1, // 扣车标识在站台上显示方向
text: 'H', // 扣车显示内容
offset: {x: -8, y: 13}, // 扣车偏移量
offset: {x: 8, y: 0}, // 扣车偏移量
centerTrainColor: 'white', // 中心扣车颜色
andCenterTrainColor: 'red', // 车站+中心扣车颜色
detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色
fontSize: 10,
fontWeight: 'normal'
fontWeight: 'normal',
circleWidth:14, // 西安二号线特殊样式 圆圈的宽度
special:true // 西安二号线特殊样式
},
stopTime: { // 停站时间
position: 1, // 停站时间方向

View File

@ -294,7 +294,7 @@ class Jlmap {
}
showStationHandlePsd(oDevice, stationCode) {
const standDevice = this.mapDevice[oDevice.standCode];
if (standDevice.deviceStationCode === stationCode || !stationCode) {
if (standDevice && standDevice.deviceStationCode === stationCode || !stationCode) {
this.$painter.updateSpecialShowStation(oDevice, true);
} else {
this.$painter.updateSpecialShowStation(oDevice, false);

View File

@ -0,0 +1,67 @@
import Group from 'zrender/src/container/Group';
import Circle from 'zrender/src/graphic/shape/Circle';
import Line from 'zrender/src/graphic/shape/Line';
class EDetainCircle extends Group {
constructor(model) {
super();
this.model = model;
this.create();
}
create() {
const model = this.model;
const style = this.model.style;
this.detainCircle = new Circle({
zlevel: model.zlevel,
z: model.z,
shape: {
cx: model.x,
cy: model.y,
r: model.radius
},
style:{
lineWidth:2,
stroke:style.sidelineColor
}
});
this.line1 = new Line({
zlevel: model.zlevel,
z: model.z,
shape:{
x1:model.x - model.radius * 0.7,
y1:model.y - model.radius * 0.7,
x2:model.x + model.radius * 0.7,
y2:model.y + model.radius * 0.7
},
style:{
lineWidth:2,
stroke:style.sidelineColor
}
});
this.line2 = new Line({
zlevel: model.zlevel,
z: model.z,
shape:{
x1:model.x - model.radius * 0.7,
y1:model.y + model.radius * 0.7,
x2:model.x + model.radius * 0.7,
y2:model.y - model.radius * 0.7
},
style:{
lineWidth:2,
stroke:style.sidelineColor
}
});
this.add(this.detainCircle);
this.add(this.line1);
this.add(this.line2);
}
setColor(color) {
this.detainCircle.setStyle('stroke', color);
this.line1.setStyle('stroke', color);
}
}
export default EDetainCircle;

View File

@ -12,6 +12,7 @@ import EHighlight from '../element/EHighlight';
import ETrainStop from './ETrainStop';
import ETrainDepart from './ETrainDepart';
import EControl from '../element/EControl';
import EDetainCircle from './EDetainCircle';
import {isShowThePrdType} from '../../utils/handlePath';
class StationStand extends Group {
@ -131,21 +132,34 @@ class StationStand extends Group {
this.add(this.reentry);
}
/** 站台扣车*/
const detainD = model.right ? 1 : -1;
const detainX = model.position.x - style.StationStand.detainCar.position * detainD * (style.StationStand.detainCar.offset.x - model.width / 2);
const detainY = model.position.y + detainD * (style.StationStand.detainCar.offset.y - model.height / 2);
this.detain = new EDetain({
zlevel: this.zlevel,
z: this.z,
style: style,
x: detainX,
y: detainY,
width: model.width,
inside: model.inside,
right: model.right
});
this.add(this.detain);
if (style.StationStand.detainCar.special) {
const detainD = model.right ? 1 : -1;
this.detainCircle = new EDetainCircle({
zlevel: this.zlevel,
z: this.z,
style: style,
x: model.position.x + (model.width / 2) * detainD + detainD * style.StationStand.detainCar.offset.x + detainD * style.StationStand.detainCar.circleWidth / 2,
y: model.position.y,
radius:style.StationStand.detainCar.circleWidth / 2
});
this.add(this.detainCircle);
} else {
/** 站台扣车*/
const detainD = model.right ? 1 : -1;
const detainX = model.position.x - style.StationStand.detainCar.position * detainD * (style.StationStand.detainCar.offset.x - model.width / 2);
const detainY = model.position.y + detainD * (style.StationStand.detainCar.offset.y - model.height / 2);
this.detain = new EDetain({
zlevel: this.zlevel,
z: this.z,
style: style,
x: detainX,
y: detainY,
width: model.width,
inside: model.inside,
right: model.right
});
this.add(this.detain);
}
/** 停站时间*/
if (style.StationStand.stopTime.offset) {

View File

@ -5,7 +5,7 @@
<progress-bar ref="progressBar" />
<zoom-box v-if="!isScreen" :scale-rate="dataZoom.scaleRate" @setShrink="setShrink" @setMagnify="setMagnify" />
<show-mode v-if="isDesign" :local-station-show="localStationShow" @setShowMode="setShowMode" />
<switch-station v-show="isDesign && (showMode === '03') && localStationShow" ref="switchStation" :concentration-station-list="concentrationStationList" @setShowStation="setShowStation" />
<switch-station v-if="isDesign && (showMode === '03') && localStationShow" ref="switchStation" :concentration-station-list="concentrationStationList" @setShowStation="setShowStation" />
<div v-if="show" class="zoom-view" :style="{ width: width +'px'}">
<el-form :model="dataZoom" label-width="80px" size="mini" inline>
<el-form-item :label="$t(`global.offset`)">