修改代码

This commit is contained in:
ival 2019-07-15 10:06:07 +08:00
parent 9aa0121c62
commit dcdf45f0b3
6 changed files with 1225 additions and 2 deletions

View File

@ -2,10 +2,46 @@ import deviceType from './deviceType';
const deviceRender = {};
/** link状态配置*/
/** link渲染配置*/
deviceRender[deviceType.Link] = {
zlevel: 1,
zlevel: 0,
progressive: 1
};
/** Section渲染配置*/
deviceRender[deviceType.Section] = {
zlevel: 1,
progressive: 2,
}
/** Signal渲染配置*/
deviceRender[deviceType.Signal] = {
zlevel: 1,
progressive: 3,
}
/** Switch渲染配置*/
deviceRender[deviceType.Switch] = {
zlevel: 3,
progressive: 5,
}
/** Station渲染配置*/
deviceRender[deviceType.Station] = {
zlevel: 1,
progressive: 4,
}
/** StationStand渲染配置*/
deviceRender[deviceType.StationStand] = {
zlevel: 1,
progressive: 5,
}
/** StationControl渲染配置*/
deviceRender[deviceType.StationControl] = {
zlevel: 1,
progressive: 4,
}
export default deviceRender;

View File

@ -13,6 +13,50 @@ fuzhouSkin[deviceType.Link] = {
linkTextColor: '#FFFFFF'
}
fuzhouSkin[deviceType.Signal] = {
/** 信号机宽度 */
signalR: 6.5,
/** 灯柱宽度*/
signalLampStandardWidth: 1.5,
/** 设备距离区段的距离*/
signalDistance: 13,
/** 信号灯按钮边线*/
signalButtonDashColor: '#C0C0C0', //'#C0C0C0'
/** 信号灯按钮颜色*/
signalButtonColor: 'darkgreen',
/** 信号灯按钮闪烁颜色*/
signalButtonLightenColor: '#E4EF50',
/** 信号灯字体红色*/
signalTextRed: '#C00808',
/** 信号灯字体绿色*/
signalTextGreen: '#00FF00',
/** 信号灯灯柱颜色*/
signalLampStandardColor: '#FFFFFF',
/** 信号灯灰色*/
signalLampGrayColor: '#7F7F7F',
/** 信号灯绿色*/
signalLampGreenColor: '#00FF00',
/** 信号灯黄色*/
signalLampYellowColor: '#FFFF00',
/** 信号灯白色*/
signalLampWhiteColor: '#FFFFFF',
/** 信号灯蓝色*/
signalLampBlueColor: '#0000FF',
}
/** 皮肤配置*/
const deviceSkin = {

1033
src/jmap/shape/Signal.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,13 @@
import deviceType from '../config/deviceType';
import Link from './Link';
import Section from './Link';
import Signal from './Signal';
/** 图库*/
const mapShape = {};
mapShape[deviceType.Link] = Link;
mapShape[deviceType.Section] = Section;
mapShape[deviceType.Signal] = Signal;
function shapefactory(type, device, style) {
const shape = mapShape[type];

View File

@ -0,0 +1,102 @@
import Path from 'zrender/src/graphic/Path';
/** 指向箭头坐标*/
export function arrows(modelX, modelY, length, radius) {
return [
[modelX - length, modelY],
[modelX - length + radius / 1.5, modelY - radius / 1.2],
[modelX - length + radius / 1.5, modelY - radius / 3],
[modelX + length, modelY - radius / 3],
[modelX + length, modelY + radius / 3],
[modelX - length + radius / 1.5, modelY + radius / 3],
[modelX - length + radius / 1.5, modelY + radius / 1.2]
];
}
/** 指向三角形坐标*/
export function triangular(modelX, modelY, drict, radius) {
return [
[modelX, modelY],
[modelX - drict * (radius + 2), modelY - radius],
[modelX - drict * (radius + 2), modelY + radius]
];
}
/** 屏蔽门手电筒*/
export function flashlight(modelX, modelY, drict, width, height, offsetx, offsety, beyond) {
return [
[modelX + drict * (offsetx), modelY + drict * offsety - (height + beyond) / 2],
[modelX + drict * (offsetx + beyond), modelY + drict * offsety - height / 2],
[modelX + drict * (offsetx + beyond + width), modelY + drict * offsety - height / 2],
[modelX + drict * (offsetx + beyond + width), modelY + drict * offsety + height / 2],
[modelX + drict * (offsetx + beyond), modelY + drict * offsety + height / 2],
[modelX + drict * (offsetx), modelY + drict * offsety + (height + beyond) / 2],
];
}
/** 区段限速体带方向*/
export function limitArrows(modelX, modelY, drict, radius) {
return [
[modelX + drict * radius, modelY - radius],
[modelX + drict * radius, modelY + radius],
[modelX - drict * radius, modelY + radius],
[modelX - drict * radius * 1.8, modelY],
[modelX - drict * radius, modelY - radius]
]
}
/** 区段折返标记*/
export function turnbackArrows(modelX, modelY, drict, width, height) {
return [
[modelX - drict * (width - 1), modelY + height],
[modelX + drict * width / 2, modelY + height],
[modelX + drict * width / 2, modelY - height],
[modelX - drict * (width - 3), modelY - height],
]
}
export var Ugraph = Path.extend({
type: 'ugraph',
shape: {
points: null,
counterclockwise: true,
},
style: {
stroke: '#000',
fill: null
},
buildPath: function (ctx, shape) {
var points = shape.points;
var r = Math.abs(points[1][1] - points[2][1]) / 2;
var x = Math.abs(points[1][0] + points[2][0]) / 2;
var y = Math.abs(points[1][1] + points[2][1]) / 2;
ctx.moveTo(points[0][0], points[0][1]);
ctx.lineTo(points[1][0], points[1][1]);
shape.counterclockwise && ctx.arc(x, y, r, Math.PI / 2, Math.PI * 3 / 2, false);
shape.counterclockwise || ctx.arc(x, y, r, Math.PI / 2, -Math.PI / 2, true);
ctx.moveTo(points[2][0], points[2][1]);
ctx.lineTo(points[3][0], points[3][1]);
ctx.closePath(); var points = shape.points;
var r = Math.abs(points[1][1] - points[2][1]) / 2;
var x = Math.abs(points[1][0] + points[2][0]) / 2;
var y = Math.abs(points[1][1] + points[2][1]) / 2;
ctx.moveTo(points[0][0], points[0][1]);
ctx.lineTo(points[1][0], points[1][1]);
shape.counterclockwise && ctx.arc(x, y, r, Math.PI / 2, Math.PI * 3 / 2, false);
shape.counterclockwise || ctx.arc(x, y, r, Math.PI / 2, -Math.PI / 2, true);
ctx.moveTo(points[2][0], points[2][1]);
ctx.lineTo(points[3][0], points[3][1]);
ctx.closePath();
}
});

View File

@ -19,6 +19,10 @@ export function parser(data, defaultStateDict) {
zrUtil.each(data.linkList || [], (elem) => {
mapDevice[elem.code] = deviceFactory(deviceType.Link, defaultStateDict, elem);
});
zrUtil.each(data.signalList || [], (elem) => {
mapDevice[elem.code] = deviceFactory(deviceType.Signal, defaultStateDict, elem);
});
}
return mapDevice;