调整西安二号线数据及皮肤配置

This commit is contained in:
zyy 2020-04-20 15:12:01 +08:00
parent 8af97b4aa2
commit a49a3bfaaf
8 changed files with 192 additions and 157 deletions

View File

@ -403,7 +403,7 @@ class SkinCode extends defaultStyle {
text: {
show: true, // 道岔名称显示
position: 0, // 区段名称位置 1 上面 -1 下面 0 对称
offset: {x: 0, y: 8}, // 道岔名称与区段距离
offset: { x: -15, y: 9 }, // 道岔名称与区段距离
fontSize: 11, // 字体大小
fontColor: '#C0C0C0', // 道岔名称颜色
fontWeight: 'normal', // 字体粗细

View File

@ -4,35 +4,30 @@
import Path from 'zrender/src/graphic/Path';
// 计轴
export const EAxle = Path.extend({
export default Path.extend({
type: 'EAxle',
_subType: '',
shape: {
// style: this.style,
// traingle: traingle11,
// drictx: 1,
// dricty: 1,
// point: this.model.points[0]
},
buildPath: function (ctx, model) {
if (model && model.style && model.traingle) {
const axleLength = 2 * model.style.Section.axle.radius;
const positionx = model.point.x + model.drictx * (model.traingle.getCos(axleLength) * 1.2);
const positiony = model.point.y + model.dricty * (model.traingle.getCos(axleLength) * 1.2);
buildPath: function (path, shape) {
if (shape && shape.style && shape.traingle) {
const axleLength = 2 * shape.style.Section.axle.radius;
// const positionx = shape.point.x + shape.drictx * (shape.traingle.getCos(axleLength) * 1.2);
// const positiony = shape.point.y + shape.dricty * (shape.traingle.getCos(axleLength) * 1.2);
const positionx = shape.point.x + shape.drictx * (shape.traingle.getCos(axleLength) * 1.05);
const positiony = shape.point.y + shape.dricty * (shape.traingle.getCos(axleLength) * 1.05);
// 圆弧
const arcX = positionx - model.dricty * model.traingle.getSin(axleLength);
const arcY = positiony + model.drictx * model.traingle.getSin(axleLength);
const arcR = model.style.Section.axle.radius;
ctx.arc(arcX, arcY, arcR, 0, 2 * Math.PI, false);
ctx.closePath();
const arcX = positionx - shape.dricty * shape.traingle.getSin(axleLength);
const arcY = positiony + shape.drictx * shape.traingle.getSin(axleLength);
const arcR = shape.style.Section.axle.radius;
path.arc(arcX, arcY, arcR, 0, 2 * Math.PI, false);
path.closePath();
const x1 = positionx - model.traingle.getCos(axleLength * model.multiple1) - model.dricty * model.traingle.getSin(axleLength);
const y1 = positiony + model.drictx * model.traingle.getSin(axleLength * model.multiple1) - model.traingle.getSin(axleLength);
const x2 = positionx + model.traingle.getCos(axleLength * model.multiple2) - model.dricty * model.traingle.getSin(axleLength);
const y2 = positiony + model.drictx * model.traingle.getSin(axleLength * model.multiple2) + model.traingle.getSin(axleLength);
ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2);
ctx.closePath();
const x1 = positionx - shape.traingle.getCos(axleLength * shape.multiple1) - shape.dricty * shape.traingle.getSin(axleLength);
const y1 = positiony + shape.drictx * shape.traingle.getSin(axleLength * shape.multiple1) - shape.traingle.getSin(axleLength);
const x2 = positionx + shape.traingle.getCos(axleLength * shape.multiple2) - shape.dricty * shape.traingle.getSin(axleLength);
const y2 = positiony + shape.drictx * shape.traingle.getSin(axleLength * shape.multiple2) + shape.traingle.getSin(axleLength);
path.moveTo(x1, y1);
path.lineTo(x2, y2);
path.closePath();
}
}
});
@ -49,9 +44,8 @@ export const EAxle = Path.extend({
// create(model) {
// if (model && model.style && model.traingle) {
// const axleLength = 2 * model.style.Section.axle.radius;
// const positionx = model.point.x + model.drictx * (model.traingle.getCos(axleLength));
// const positiony = model.point.y + model.dricty * (model.traingle.getCos(axleLength));
// const positionx = model.point.x + model.drictx * (model.traingle.getCos(axleLength) * 1.2);
// const positiony = model.point.y + model.dricty * (model.traingle.getCos(axleLength) * 1.2);
// this.line = new Line({
// zlevel: this.zlevel,
// z: this.z,
@ -63,7 +57,7 @@ export const EAxle = Path.extend({
// y2: positiony + model.drictx * model.traingle.getSin(axleLength) + model.traingle.getSin(axleLength)
// },
// style: {
// GBaseLineWidth: 1,
// GBaseLineWidth: 2,
// stroke: model.style.Section.axle.color
// }
// });

View File

@ -6,7 +6,7 @@ import ELines from './ELines'; // 创建多线条 曲线 (私有)
import EblockLines from './EblockLines'; // 区段封锁特有
import ESeparator from './ESeparator'; // 分隔符 (私有)
import EMouse from './EMouse';
import { EAxle } from './EAxle'; // 创建计轴
import EAxle from './EAxle'; // 创建计轴
import { EBackArrow, EBackArrowTriangle } from './EBackArrow'; // 折返进路箭头
import ELimitName from './ELimitName'; // 成都三号线 限速名称
import JTriangle from '../../utils/JTriangle';
@ -60,6 +60,7 @@ export default class Section extends Group {
multiple2: 1.5
},
style: {
lineWidth: 2,
fill: this.style.Section.axle.color,
stroke: this.style.Section.axle.color
}
@ -79,6 +80,7 @@ export default class Section extends Group {
multiple2: 1
},
style: {
lineWidth: 2,
fill: this.style.Section.axle.color,
stroke: this.style.Section.axle.color
}

View File

@ -103,8 +103,12 @@ export default {
this.timeDemon = setInterval(() => {
checkLoginLine();
}, 5000 * 60);
EventBus.$on('SELECTON', () => {
this.selected = null;
});
},
beforeDestroy() {
EventBus.$off('SELECTON');
this.clearAutoSave();
this.$store.dispatch('map/mapClear');
if (this.timeDemon) {
@ -310,11 +314,7 @@ export default {
saveMapEvent() { //
const map = this.$store.state.map.map;
// map.signalList.forEach(item => {
// if (!item.right) {
// item.namePosition = { x: 30, y: -14 };
// } else {
// item.namePosition = { x: -30, y: -14 };
// }
// item.lampPostType = '02';
// });
if (this.$refs.jlmapVisual && map && parseInt(this.$route.params.mapId)) {
if (this.verifySectionPoint(map)) {

View File

@ -64,7 +64,11 @@ export default {
SectionSepTypeList: [],
regionList: [],
viewSelect: false,
axlePositionList: [{value: 1, label: '下方显示'}, {value: 0, label: '不显示'}, {value: -1, label: '上方显示'}],
axlePositionList: [
{value: 1, label: '下方显示'},
{value: 0, label: '不显示'},
{value: -1, label: '上方显示'}
],
editModel: {
code: '',
name: '',
@ -129,7 +133,7 @@ export default {
'lineCode'
]),
form() {
const form = {
return {
labelWidth: '160px',
items: {
code: {
@ -211,7 +215,6 @@ export default {
}
}
};
return form;
},
rules() {
var validateAssociatedSection = (rule, value, callback) => {
@ -223,9 +226,9 @@ export default {
}
};
const rules = {
// code: [
// { required: true, message: this.$t('rules.selectEquipment'), trigger: 'change' }
// ],
code: [
{ required: true, message: this.$t('rules.selectEquipment'), trigger: 'change' }
],
name: [
{ required: true, message: this.$t('rules.pleaseEnterSectionName'), trigger: 'blur' }
],
@ -414,6 +417,8 @@ export default {
this.oldPoint = JSON.parse(JSON.stringify(selected.points));
this.oldLeftSectionCode = selected.leftSectionCode;
this.oldRightSectionCode = selected.rightSectionCode;
this.editModel.leftAxlePosition = selected.leftAxlePosition || 0; //
this.editModel.rightAxlePosition = selected.rightAxlePosition || 0; //
this.$refs.logicBlock.computedLogicSectionNumList(this.editModel.logicSectionNum);
if (this.field.toUpperCase() === 'splitSection'.toUpperCase()) {
this.$refs.splitOrMerge.addModel.splitOffsetMax = Math.sqrt(new JTriangle(selected.points[0], selected.points[selected.points.length - 1]).abspowz);
@ -463,7 +468,7 @@ export default {
},
//
edit() {
this.$refs['dataform'].validate((valid) => {
this.$refs['dataform'].validate(valid => {
if (valid) {
if (this.editModel.type === '03' && this.editModel.leftSectionCode && this.editModel.rightSectionCode) {
this.$messageBox('道岔区段应仅有一侧关联区段!');

View File

@ -70,6 +70,8 @@
<script>
import { getUID } from '@/jmapNew/utils/Uid';
import { deepAssign } from '@/utils/index';
import { EventBus } from '@/scripts/event-bus';
export default {
name: 'SplitOrMerge',
props: {
@ -139,6 +141,13 @@ export default {
}
};
},
watch: {
field(val) {
if (val) {
EventBus.$emit('SELECTON');
}
}
},
methods: {
hover(filed) {
this.$emit('hover', filed);

View File

@ -3,16 +3,16 @@
<div style="height: 100%;">
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-form ref="oprt1" :model="fromData" label-width="130px" size="mini" :rules="mergeRules">
<el-form-item label="关联区段" prop="relevanceSectionList">
<el-select v-model="fromData.relevanceSectionList" filterable multiple :placeholder="$t('rules.pleaseSelect')">
<el-form-item label="关联区段" prop="relevanceSwitchList">
<el-select v-model="fromData.relevanceSwitchList" filterable multiple :placeholder="$t('rules.pleaseSelect')">
<el-option
v-for="item in sectionList"
v-for="item in switchList"
:key="item.code"
:label="item.name + '(' + item.code + ')'"
:value="item.code"
/>
</el-select>
<el-button :type="field === 'relevanceSectionList' ? 'danger' : 'primary'" size="small" @click="hover('relevanceSectionList')">{{ $t('map.activate') }}</el-button>
<el-button :type="field === 'relevanceSwitchList' ? 'danger' : 'primary'" size="small" @click="hover('relevanceSwitchList')">{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item>
<el-button-group>
@ -27,6 +27,8 @@
import { deepAssign } from '@/utils/index';
import { mapGetters } from 'vuex';
import { getUID } from '@/jmapNew/utils/Uid';
import { EventBus } from '@/scripts/event-bus';
export default {
name: 'CreateAxle',
props:{
@ -38,9 +40,12 @@ export default {
data() {
return {
fromData: {
relevanceSectionList: []
relevanceSectionList: [],
relevanceSwitchList: []
},
mergeRules: {}
mergeRules: {
relevanceSwitchList: [{ required: true, message: '请选择关联道岔', trigger: 'change' }]
}
};
},
computed: {
@ -49,14 +54,31 @@ export default {
'switchList'
])
},
watch: {
field(val) {
if (val) {
EventBus.$emit('SELECTON');
}
}
},
methods:{
hover(field) {
this.$emit('hover', field);
},
createSwitchSectionManual() {
this.$refs.oprt1.validate((valid) => {
if (valid) {
const models = [];
this.hover(''); // field
const uid = getUID('T', this.sectionList);
let sectiona = [];
this.fromData.relevanceSectionList = [];
this.fromData.relevanceSwitchList.forEach(item => {
const switchModel = deepAssign({}, this.$store.getters['map/getDeviceByCode'](item));
this.fromData.relevanceSectionList.push(switchModel.sectionACode);
this.fromData.relevanceSectionList.push(switchModel.sectionBCode);
this.fromData.relevanceSectionList.push(switchModel.sectionCCode);
});
this.fromData.relevanceSectionList.forEach(item => {
const section = deepAssign({}, this.$store.getters['map/getDeviceByCode'](item));
section.parentCode = uid;
@ -118,9 +140,12 @@ export default {
});
this.$emit('updateMapModel', models);
this.fromData.relevanceSectionList = [];
this.fromData.relevanceSwitchList = [];
}
});
},
pushData(data) {
this.fromData.relevanceSectionList.push(data);
this.fromData.relevanceSwitchList.push(data);
}
}
};

View File

@ -60,11 +60,11 @@ export default {
this.$emit('fieldSelectSwitchSection', this.field);
},
deviceSelect(selected) {
if (this.field.toUpperCase() != 'relevanceSectionList'.toUpperCase() && selected && selected._type.toUpperCase() === 'Switch'.toUpperCase()) {
if (selected && selected._type.toUpperCase() === 'Switch'.toUpperCase() && this.field.toUpperCase() === 'relevanceSwitchList'.toUpperCase()) {
this.$refs.createAxle.pushData(selected.code);
} else if (selected && selected._type.toUpperCase() === 'Switch'.toUpperCase()) {
this.activeName = 'first';
this.$refs.switchModel.setModel(selected);
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'relevanceSectionList'.toUpperCase()) {
this.$refs.createAxle.pushData(selected.code);
}
},
findSectionDataByLinkCodeAndPoint(code, point) {