信号机调整
This commit is contained in:
parent
2e1b356da9
commit
630ccfd016
@ -1,6 +1,6 @@
|
|||||||
const mapDeviceStyle = {
|
const mapDeviceStyle = {
|
||||||
'01': 'chengdu_01',
|
'01': 'chengdu_01',
|
||||||
// '01': 'xian_02'
|
// '01': 'xian_02',
|
||||||
'02': 'fuzhou_01',
|
'02': 'fuzhou_01',
|
||||||
'03': 'bejing_01',
|
'03': 'bejing_01',
|
||||||
'04': 'chengdu_03',
|
'04': 'chengdu_03',
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import Polyline from 'zrender/src/graphic/shape/Polyline';
|
import Polyline from 'zrender/src/graphic/shape/Polyline';
|
||||||
import Group from 'zrender/src/container/Group';
|
import Group from 'zrender/src/container/Group';
|
||||||
|
import Polygon from 'zrender/src/graphic/shape/Polygon';
|
||||||
|
|
||||||
class ESigPost extends Group {
|
class ESigPost extends Group {
|
||||||
constructor(model) {
|
constructor(model) {
|
||||||
@ -59,8 +60,37 @@ class ESigPost extends Group {
|
|||||||
this.hor && this.hor.setStyle({ stroke: color });
|
this.hor && this.hor.setStyle({ stroke: color });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* 灯柱变换为三角形并闪烁*/
|
||||||
setTerminalOptional() {
|
setTerminalOptional() {
|
||||||
|
this.triangle = new Polygon({
|
||||||
|
zlevel: this.model.zlevel,
|
||||||
|
z: this.model.z,
|
||||||
|
shape: {
|
||||||
|
points: [
|
||||||
|
[this.model.x, this.model.y + this.model.style.Signal.post.standardHeight * 1.2],
|
||||||
|
[this.model.x, this.model.y - this.model.style.Signal.post.standardHeight * 1.2],
|
||||||
|
[this.model.x + this.model.drict * this.model.style.Signal.post.standardLength * 1.2, this.model.y]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
style: {
|
||||||
|
fill: this.model.style.Signal.post.terminalOptional
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.add(this.triangle);
|
||||||
|
this.triangle.animateStyle(true)
|
||||||
|
.when(0, { fill: this.model.style.backgroundColor })
|
||||||
|
.when(1000, { fill: this.model.style.Signal.post.terminalOptional })
|
||||||
|
.when(2000, { fill: this.model.style.backgroundColor })
|
||||||
|
.start();
|
||||||
|
this.ver.hide();
|
||||||
|
this.hor.hide();
|
||||||
|
}
|
||||||
|
/* 关闭闪烁三角形并还原灯柱 */
|
||||||
|
removeTerminalOptional() {
|
||||||
|
this.triangle.stopAnimation(false);
|
||||||
|
this.triangle && this.remove(this.triangle);
|
||||||
|
this.ver.show();
|
||||||
|
this.hor.show();
|
||||||
}
|
}
|
||||||
getLampPosition(type) {
|
getLampPosition(type) {
|
||||||
const model = this.model;
|
const model = this.model;
|
||||||
|
@ -14,6 +14,7 @@ import EVirtualSignal from './EVirtualSignal';
|
|||||||
import ELowButton from './ELowButton';
|
import ELowButton from './ELowButton';
|
||||||
import {isShowThePrdType} from '../../utils/handlePath';
|
import {isShowThePrdType} from '../../utils/handlePath';
|
||||||
import Rect from 'zrender/src/graphic/shape/Rect';
|
import Rect from 'zrender/src/graphic/shape/Rect';
|
||||||
|
import Polygon from 'zrender/src/graphic/shape/Polygon';
|
||||||
|
|
||||||
class Signal extends Group {
|
class Signal extends Group {
|
||||||
constructor(model, style) {
|
constructor(model, style) {
|
||||||
@ -411,6 +412,7 @@ class Signal extends Group {
|
|||||||
this.sigDelay.hide();
|
this.sigDelay.hide();
|
||||||
this.sigAuto.animationRecover();
|
this.sigAuto.animationRecover();
|
||||||
this.sigRoute.hide();
|
this.sigRoute.hide();
|
||||||
|
this.sigBack && this.sigBack.hide();
|
||||||
this.sigName.setColor(this.style.Signal.text.defaultColor);
|
this.sigName.setColor(this.style.Signal.text.defaultColor);
|
||||||
this.sigPost.setColor(this.style.Signal.post.standardColor); // 设置底座默认颜色
|
this.sigPost.setColor(this.style.Signal.post.standardColor); // 设置底座默认颜色
|
||||||
if (this.style.Signal.lamp.guidName == 'chengdu_03') {
|
if (this.style.Signal.lamp.guidName == 'chengdu_03') {
|
||||||
@ -492,7 +494,32 @@ class Signal extends Group {
|
|||||||
this.add(this.highlight);
|
this.add(this.highlight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* 始端信号机选择后信号机变为三角形 */
|
||||||
|
setLampToTriangle() {
|
||||||
|
const endPoint = this.sigPost.getLampPosition(this.model.lampPostType);
|
||||||
|
const drict = this.model.right ? 1 : -1; // 朝向 右:左
|
||||||
|
this.lampTriangle = new Polygon({
|
||||||
|
zelvel: this.zlevel,
|
||||||
|
z: this.z,
|
||||||
|
shape: {
|
||||||
|
points: [
|
||||||
|
[endPoint.x, endPoint.y + this.style.Signal.lamp.radiusR],
|
||||||
|
[endPoint.x, endPoint.y - this.style.Signal.lamp.radiusR],
|
||||||
|
[endPoint.x + drict * this.style.Signal.lamp.radiusR * 1.4, endPoint.y]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
style: {
|
||||||
|
fill: this.style.Signal.lamp.redColor
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.add(this.lampTriangle);
|
||||||
|
this.lamps.forEach(item => { item.hide(); });
|
||||||
|
}
|
||||||
|
/* 始端信号机还原回正常形态 */
|
||||||
|
removeLampToTriangle() {
|
||||||
|
this.lampTriangle && this.remove(this.lampTriangle);
|
||||||
|
this.lamps.forEach(item => { item.show(); });
|
||||||
|
}
|
||||||
drawBatchSelected(selected, type) {
|
drawBatchSelected(selected, type) {
|
||||||
if (selected) {
|
if (selected) {
|
||||||
this.lamps && this.lamps.length && this.lamps.forEach(elem => {
|
this.lamps && this.lamps.length && this.lamps.forEach(elem => {
|
||||||
|
Loading…
Reference in New Issue
Block a user