调整成都三显示

This commit is contained in:
fan 2020-03-13 15:06:14 +08:00
parent 6c52c3b56f
commit 264310f28e
7 changed files with 243 additions and 244 deletions

View File

@ -133,9 +133,9 @@ class SkinCode extends defaultStyle {
endColor: '#FFFFFF', // 尽头分隔符颜色 endColor: '#FFFFFF', // 尽头分隔符颜色
color: '#FFFFFF' // 区段边界符颜色 color: '#FFFFFF' // 区段边界符颜色
}, },
shuttleBack: { // 折返进路 (存在此对象 显示折返箭头) // shuttleBack: { // 折返进路 (存在此对象 显示折返箭头)
distance: 5 // 限速线距离区段距离 // distance: 5 // 限速线距离区段距离
}, // },
block: { block: {
special: false // 区段特殊显示 special: false // 区段特殊显示
}, },

View File

@ -2,41 +2,41 @@ import Path from 'zrender/src/graphic/Path';
// 成都三号线 折返进路 // 成都三号线 折返进路
export const EBackArrow = Path.extend({ export const EBackArrow = Path.extend({
type: 'EBackArrow', type: 'EBackArrow',
shape: { shape: {
points: null points: null
}, },
buildPath: function (ctx, shape) { buildPath: function (ctx, shape) {
const points = shape.points; const points = shape.points;
var r = shape.height; var r = shape.height;
var x = points.x + shape.drict * shape.width / 2; var x = points.x + shape.drict * shape.width / 2;
var y = points.y; var y = points.y;
ctx.moveTo(points.x - shape.drict * shape.width, points.y + shape.height); ctx.moveTo(points.x - shape.drict * shape.width, points.y + shape.height);
ctx.lineTo(points.x + shape.drict * shape.width / 2, points.y + shape.height); ctx.lineTo(points.x + shape.drict * shape.width / 2, points.y + shape.height);
if (shape.drict) { if (shape.drict) {
ctx.arc(x, y, r, Math.PI / 2, Math.PI * 3 / 2, true); ctx.arc(x, y, r, Math.PI / 2, Math.PI * 3 / 2, true);
} else { } else {
ctx.arc(x, y, r, Math.PI / 2, Math.PI * 3 / 2, false); ctx.arc(x, y, r, Math.PI / 2, Math.PI * 3 / 2, false);
} }
ctx.moveTo(points.x + shape.drict * shape.width / 2, points.y - shape.height); ctx.moveTo(points.x + shape.drict * shape.width / 2, points.y - shape.height);
ctx.lineTo(points.x - shape.drict * (shape.width - 5), points.y - shape.height); ctx.lineTo(points.x - shape.drict * (shape.width - 5), points.y - shape.height);
} }
}); });
// 箭头 // 箭头
export const EBackArrowTriangle = Path.extend({ export const EBackArrowTriangle = Path.extend({
type: 'EBackArrowTriangle', type: 'EBackArrowTriangle',
shape: { shape: {
points: null points: null
}, },
buildPath: function (ctx, shape) { buildPath: function (ctx, shape) {
const points = shape.points; const points = shape.points;
ctx.moveTo(points.x - shape.drict * (shape.width - 5), points.y - shape.height - 3); ctx.moveTo(points.x - shape.drict * (shape.width - 5), points.y - shape.height - 3);
if (shape.drict) { if (shape.drict) {
ctx.lineTo(points.x - shape.drict * shape.width, points.y - shape.height); ctx.lineTo(points.x - shape.drict * shape.width, points.y - shape.height);
} else { } else {
ctx.lineTo(points.x - shape.drict * shape.width, points.y - shape.height); ctx.lineTo(points.x - shape.drict * shape.width, points.y - shape.height);
} }
ctx.lineTo(points.x - shape.drict * (shape.width - 5), points.y - shape.height + 3); ctx.lineTo(points.x - shape.drict * (shape.width - 5), points.y - shape.height + 3);
} }
}); });

View File

@ -77,141 +77,141 @@ import Vue from 'vue';
// }); // });
export default class ELimitLines extends Group { export default class ELimitLines extends Group {
constructor(model) { constructor(model) {
super(); super();
this.model = model; this.model = model;
this.zlevel = model.zlevel; this.zlevel = model.zlevel;
this.z = model.z; this.z = model.z;
this.create(model); this.create(model);
} }
create(model) { create(model) {
/** 创建区段*/ /** 创建区段*/
if (model && model.points.length > 1) { if (model && model.points.length > 1) {
if (model.isCurve) { if (model.isCurve) {
const shape = {}; const shape = {};
for (let i = 1; i < (model.points.length - 1); i++) { for (let i = 1; i < (model.points.length - 1); i++) {
shape[`cpx${i}`] = model.points[i].x; shape[`cpx${i}`] = model.points[i].x;
shape[`cpy${i}`] = model.points[i].y; shape[`cpy${i}`] = model.points[i].y;
} }
shape[`x1`] = model.points[0].x; shape[`x1`] = model.points[0].x;
shape[`y1`] = model.points[0].y; shape[`y1`] = model.points[0].y;
shape[`x2`] = model.points[model.points.length - 1].x; shape[`x2`] = model.points[model.points.length - 1].x;
shape[`y2`] = model.points[model.points.length - 1].y; shape[`y2`] = model.points[model.points.length - 1].y;
this.add(new BezierCurve({ this.add(new BezierCurve({
isLine: true, isLine: true,
zlevel: this.zlevel, zlevel: this.zlevel,
progressive: model.progressive, progressive: model.progressive,
z: this.z, z: this.z,
culling: true, culling: true,
shape: shape, shape: shape,
position: model.position, position: model.position,
style: { style: {
lineWidth: model.style.Section.speedLimit.width, lineWidth: model.style.Section.speedLimit.width,
stroke: model.style.Section.speedLimit.lineColor, stroke: model.style.Section.speedLimit.lineColor,
fillOpacity: 0 fillOpacity: 0
} }
})); }));
} else { } else {
const swPadding = model.style.Switch.core.length; // 定位和反位时区段距离岔芯的距离 const swPadding = model.style.Switch.core.length; // 定位和反位时区段距离岔芯的距离
var switchWidth = model.style.Section.line.width + model.style.Section.line.beyondWidth; // 道岔宽度 var switchWidth = model.style.Section.line.width + model.style.Section.line.beyondWidth; // 道岔宽度
const beg = Object.assign({}, model.points[0]); const beg = Object.assign({}, model.points[0]);
const end = Object.assign({}, model.points[model.points.length - 1]); const end = Object.assign({}, model.points[model.points.length - 1]);
if (model.isSwitchSection && beg.y !== end.y) { if (model.isSwitchSection && beg.y !== end.y) {
const swch = Vue.prototype.$jlmap.mapDevice[model.switch.code]; // 获取道岔model 及状态数据 const swch = Vue.prototype.$jlmap.mapDevice[model.switch.code]; // 获取道岔model 及状态数据
if (swch && swch.instance) { if (swch && swch.instance) {
const traingle = new JTriangle(swch.intersection, swch.skew); const traingle = new JTriangle(swch.intersection, swch.skew);
if ((swch.intersection.x === beg.x) && (swch.intersection.y === beg.y) && !swch.normalPosition && swch.sectionCCode == model.code) { if ((swch.intersection.x === beg.x) && (swch.intersection.y === beg.y) && !swch.normalPosition && swch.sectionCCode == model.code) {
beg.x = beg.x + traingle.drictx * (swPadding + switchWidth) * traingle.getCotRate(); beg.x = beg.x + traingle.drictx * (swPadding + switchWidth) * traingle.getCotRate();
beg.y = beg.y + traingle.dricty * (swPadding + switchWidth); beg.y = beg.y + traingle.dricty * (swPadding + switchWidth);
} }
if ((swch.intersection.x === end.x) && (swch.intersection.y === end.y) && swch.normalPosition && swch.sectionCCode == model.code) { if ((swch.intersection.x === end.x) && (swch.intersection.y === end.y) && swch.normalPosition && swch.sectionCCode == model.code) {
end.x = end.x + traingle.drictx * (swPadding + switchWidth) * traingle.getCotRate(); end.x = end.x + traingle.drictx * (swPadding + switchWidth) * traingle.getCotRate();
end.y = end.y + traingle.dricty * (swPadding + switchWidth); end.y = end.y + traingle.dricty * (swPadding + switchWidth);
} }
} }
} }
if (model.points.length == 2) { if (model.points.length == 2) {
this.add(new Line({ this.add(new Line({
isLine: true, isLine: true,
zlevel: this.zlevel, zlevel: this.zlevel,
progressive: model.progressive, progressive: model.progressive,
z: this.z, z: this.z,
position: model.position, position: model.position,
shape: { shape: {
x1: beg.x, x1: beg.x,
y1: beg.y, y1: beg.y,
x2: end.x, x2: end.x,
y2: end.y y2: end.y
}, },
style: { style: {
lineWidth: model.style.Section.speedLimit.width, lineWidth: model.style.Section.speedLimit.width,
stroke: model.style.Section.speedLimit.lineColor stroke: model.style.Section.speedLimit.lineColor
} }
})); }));
} else { } else {
this.add(new Line({ this.add(new Line({
isLine: true, isLine: true,
zlevel: this.zlevel, zlevel: this.zlevel,
progressive: model.progressive, progressive: model.progressive,
z: this.z, z: this.z,
position: model.position, position: model.position,
shape: { shape: {
x1: beg.x, x1: beg.x,
y1: beg.y, y1: beg.y,
x2: model.points[1].x, x2: model.points[1].x,
y2: model.points[1].y y2: model.points[1].y
}, },
style: { style: {
lineWidth: model.style.Section.speedLimit.width, lineWidth: model.style.Section.speedLimit.width,
stroke: model.style.Section.speedLimit.lineColor stroke: model.style.Section.speedLimit.lineColor
} }
})); }));
for (let i = 1; i < (model.points.length - 2); i++) { for (let i = 1; i < (model.points.length - 2); i++) {
this.add(new Line({ this.add(new Line({
isLine: true, isLine: true,
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
progressive: model.progressive, progressive: model.progressive,
position: model.position, position: model.position,
shape: { shape: {
x1: model.points[i].x, x1: model.points[i].x,
y1: model.points[i].y, y1: model.points[i].y,
x2: model.points[i + 1].x, x2: model.points[i + 1].x,
y2: model.points[i + 1].y y2: model.points[i + 1].y
}, },
style: { style: {
lineWidth: model.style.Section.speedLimit.width, lineWidth: model.style.Section.speedLimit.width,
stroke: model.style.Section.speedLimit.lineColor stroke: model.style.Section.speedLimit.lineColor
} }
})); }));
} }
this.add(new Line({ this.add(new Line({
isLine: true, isLine: true,
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
position: model.position, position: model.position,
progressive: model.progressive, progressive: model.progressive,
shape: { shape: {
x1: model.points[model.points.length - 2].x, x1: model.points[model.points.length - 2].x,
y1: model.points[model.points.length - 2].y, y1: model.points[model.points.length - 2].y,
x2: end.x, x2: end.x,
y2: end.y y2: end.y
}, },
style: { style: {
lineWidth: model.style.Section.speedLimit.width, lineWidth: model.style.Section.speedLimit.width,
stroke: model.style.Section.speedLimit.lineColor stroke: model.style.Section.speedLimit.lineColor
} }
})); }));
} }
} }
} }
} }
} }

View File

@ -3,70 +3,70 @@ import Line from 'zrender/src/graphic/shape/Line';
/** 延时释放*/ /** 延时释放*/
export default class ERelease extends Group { export default class ERelease extends Group {
constructor(model) { constructor(model) {
super(); super();
this.model = model; this.model = model;
this.isNew = false; this.isNew = false;
} }
create() { create() {
if (!this.isNew) { if (!this.isNew) {
const model = this.model; const model = this.model;
this.isNew = true; this.isNew = true;
this.lines = new Line({ this.lines = new Line({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
shape: model.shape, shape: model.shape,
progressive: model.progressive, progressive: model.progressive,
style: { style: {
lineWidth: model.lineWidth, lineWidth: model.lineWidth,
stroke: model.stroke stroke: model.stroke
} }
}); });
this.add(this.lines); this.add(this.lines);
} }
} }
setStyle(model) { setStyle(model) {
this.create(); this.create();
this.lines.setStyle(model); this.lines.setStyle(model);
} }
hide() { hide() {
this.create(); this.create();
this.lines.hide(); this.lines.hide();
} }
show() { show() {
this.create(); this.create();
this.lines.show(); this.lines.show();
} }
// 开始动画 // 开始动画
animateStyle(loop, animates) { animateStyle(loop, animates) {
this.create(); this.create();
if (animates && animates.length) { if (animates && animates.length) {
this.eachChild((child) => { this.eachChild((child) => {
if (child.animateStyle) { if (child.animateStyle) {
let an = child.animateStyle(loop); let an = child.animateStyle(loop);
animates.forEach(elem => { animates.forEach(elem => {
an = an.when(elem.time, elem.styles); an = an.when(elem.time, elem.styles);
}); });
an.start(); an.start();
} }
}); });
} }
} }
// 结束动画 // 结束动画
stopAnimation(flag) { stopAnimation(flag) {
this.create(); this.create();
this.eachChild((child) => { this.eachChild((child) => {
if (child.stopAnimation) { if (child.stopAnimation) {
child.stopAnimation(flag); child.stopAnimation(flag);
} }
}); });
} }
} }

View File

@ -1,7 +1,7 @@
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import Line from 'zrender/src/graphic/shape/Line'; import Line from 'zrender/src/graphic/shape/Line';
import BezierCurve from 'zrender/src/graphic/shape/BezierCurve'; import BezierCurve from 'zrender/src/graphic/shape/BezierCurve';
import { import {
cubicSubdivide, cubicSubdivide,
quadraticAt, quadraticAt,
cubicAt, cubicAt,
@ -49,8 +49,8 @@ export default class ELines extends Group {
this.add(this.section); this.add(this.section);
} else { } else {
if (model.points.length == 2) { if (model.points.length == 2) {
const spaceX= (model.points[1].x - model.points[0].x) / 3; const spaceX = (model.points[1].x - model.points[0].x) / 3;
const spaceY= (model.points[1].y - model.points[0].y) / 3; const spaceY = (model.points[1].y - model.points[0].y) / 3;
this.sectionM = new Line({ this.sectionM = new Line({
isLine: true, isLine: true,
zlevel: this.zlevel, zlevel: this.zlevel,
@ -130,8 +130,7 @@ export default class ELines extends Group {
(isTangent ? cubicDerivativeAt : cubicAt)(shape.x1, shape.cpx1, shape.cpx2, shape.x2, t), (isTangent ? cubicDerivativeAt : cubicAt)(shape.x1, shape.cpx1, shape.cpx2, shape.x2, t),
(isTangent ? cubicDerivativeAt : cubicAt)(shape.y1, shape.cpy1, shape.cpy2, shape.y2, t) (isTangent ? cubicDerivativeAt : cubicAt)(shape.y1, shape.cpy1, shape.cpy2, shape.y2, t)
]; ];
} } else {
else {
return [ return [
(isTangent ? quadraticDerivativeAt : quadraticAt)(shape.x1, shape.cpx1, shape.x2, t), (isTangent ? quadraticDerivativeAt : quadraticAt)(shape.x1, shape.cpx1, shape.x2, t),
(isTangent ? quadraticDerivativeAt : quadraticAt)(shape.y1, shape.cpy1, shape.y2, t) (isTangent ? quadraticDerivativeAt : quadraticAt)(shape.y1, shape.cpy1, shape.y2, t)
@ -141,7 +140,7 @@ export default class ELines extends Group {
// 重新计算居中距离点 // 重新计算居中距离点
couvert(shape) { couvert(shape) {
let out = []; const out = [];
var x1 = shape.x1; var x1 = shape.x1;
var y1 = shape.y1; var y1 = shape.y1;
var x2 = shape.x2; var x2 = shape.x2;
@ -150,7 +149,7 @@ export default class ELines extends Group {
var cpy1 = shape.cpy1; var cpy1 = shape.cpy1;
var cpx2 = shape.cpx2; var cpx2 = shape.cpx2;
var cpy2 = shape.cpy2; var cpy2 = shape.cpy2;
cubicSubdivide( cubicSubdivide(
x1, cpx1, cpx2, x2, 0.3, out x1, cpx1, cpx2, x2, 0.3, out
); );
@ -159,7 +158,7 @@ export default class ELines extends Group {
x1, cpx1, cpx2, x2, 0.7, out x1, cpx1, cpx2, x2, 0.7, out
); );
var n_x2 = out[3]; var n_x2 = out[3];
cubicSubdivide( cubicSubdivide(
y1, cpy1, cpy2, y2, 0.3, out y1, cpy1, cpy2, y2, 0.3, out
); );
@ -168,20 +167,20 @@ export default class ELines extends Group {
y1, cpy1, cpy2, y2, 0.7, out y1, cpy1, cpy2, y2, 0.7, out
); );
var n_y2 = out[3]; var n_y2 = out[3];
var p = this.someVectorAt(shape, 0.5, true); var p = this.someVectorAt(shape, 0.5, true);
var v = vec2.normalize(p, p); var v = vec2.normalize(p, p);
var x0 = Math.sqrt((Math.pow(cpx1-x1, 2)+Math.pow(x2-cpx2, 2))/2, 2); var x0 = Math.sqrt((Math.pow(cpx1 - x1, 2) + Math.pow(x2 - cpx2, 2)) / 2, 2);
var y0 = Math.sqrt((Math.pow(cpy1-y1, 2)+Math.pow(y2-cpy2, 2))/2, 2); var y0 = Math.sqrt((Math.pow(cpy1 - y1, 2) + Math.pow(y2 - cpy2, 2)) / 2, 2);
return { return {
x1: n_x1, x1: n_x1,
y1: n_y1, y1: n_y1,
x2: n_x2, x2: n_x2,
y2: n_y2, y2: n_y2,
cpx1: (cpx1+cpx2)/2 + v[1]*x0*0.128, cpx1: (cpx1 + cpx2) / 2 + v[1] * x0 * 0.128,
cpy1: (cpy1+cpy2)/2 + v[0]*y0*0.128 cpy1: (cpy1 + cpy2) / 2 + v[0] * y0 * 0.128
}; };
} }
} }

View File

@ -76,12 +76,12 @@
<button :id="MixinCommand.functionButton.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(MixinCommand.functionButton.button.operation, 'MixinCommand')"> <button :id="MixinCommand.functionButton.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(MixinCommand.functionButton.button.operation, 'MixinCommand')">
<span style="color: black"> <span style="color: black">
<center> <center>
<b style="color:deepskyblue"></b> <b style="color:#4B4B99"></b>
<b style="color:burlywood"></b> <b style="color:#943E3E"></b>
</center> </center>
<center> <center>
<b style="color: red"></b> <b style="color:#E64BE6"></b>
<b style="color:forestgreen"></b> <b style="color:#4C994C"></b>
</center> </center>
</span> </span>
</button> </button>

View File

@ -3,9 +3,9 @@ export function getBaseUrl() {
let BASE_API; let BASE_API;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud'; BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪 // BASE_API = 'http://192.168.3.5:9000'; // 袁琪
BASE_API = 'http://192.168.3.6:9000'; // 旭强 // BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 张赛 // BASE_API = 'http://192.168.3.41:9000'; // 张赛
// BASE_API = 'http://192.168.3.82:9000'; // 杜康 // BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://b29z135112.zicp.vip';