2021-01-19 09:20:37 +08:00
|
|
|
import Group from 'zrender/src/container/Group';
|
|
|
|
import Polygon from 'zrender/src/graphic/shape/Polygon';
|
|
|
|
// import Text from 'zrender/src/graphic/Text';
|
|
|
|
|
|
|
|
class EStationPlatform extends Group {
|
|
|
|
constructor(model) {
|
|
|
|
super();
|
|
|
|
this.model = model;
|
|
|
|
this.create();
|
|
|
|
}
|
|
|
|
|
|
|
|
create() {
|
|
|
|
const model = this.model.modelData;
|
|
|
|
const style = this.model.style;
|
|
|
|
|
|
|
|
const buttonD = model.right ? 1 : -1;
|
|
|
|
const platFormOffset = model.inside ? style.StationStand.stationPlatform.insideOffset : style.StationStand.stationPlatform.outsideOffset;
|
2021-01-19 17:44:18 +08:00
|
|
|
const buttonX = model.position.x - buttonD * ( model.width / 2 - 20);
|
|
|
|
// platFormOffset.x -
|
2021-01-19 09:20:37 +08:00
|
|
|
const buttonY = model.position.y + buttonD * (platFormOffset.y + buttonD * model.height / 2);
|
|
|
|
this.stationPlatform = new Polygon({
|
|
|
|
zlevel: this.model.zlevel,
|
|
|
|
z: this.model.z,
|
2021-01-27 18:32:16 +08:00
|
|
|
_subType: 'StationPlatform',
|
2021-01-19 09:20:37 +08:00
|
|
|
position: [0, 0],
|
|
|
|
shape: {
|
|
|
|
points: [
|
|
|
|
[buttonX, buttonY],
|
|
|
|
[buttonX - buttonD * 20, buttonY],
|
|
|
|
[buttonX - buttonD * 20, buttonY - 10],
|
|
|
|
[buttonX - buttonD * 5, buttonY - 10],
|
|
|
|
[buttonX, buttonY - 5]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
style: {
|
|
|
|
fill: style.StationStand.stationPlatform.defaultColor
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.add(this.stationPlatform);
|
|
|
|
}
|
|
|
|
|
|
|
|
hideMode() {
|
|
|
|
this.stationPlatform && this.stationPlatform.hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
showMode() {
|
|
|
|
this.stationPlatform && this.stationPlatform.show();
|
|
|
|
}
|
|
|
|
setColor(color) {
|
|
|
|
this.stationPlatform && this.stationPlatform.setStyle({fill:color});
|
|
|
|
}
|
|
|
|
recover() {
|
|
|
|
const style = this.model.style;
|
|
|
|
this.setColor(style.StationStand.stationPlatform.defaultColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
setState(model) {
|
|
|
|
const style = this.model.style;
|
|
|
|
if (model.stationHoldTrain || model.centerHoldTrain) {
|
|
|
|
this.setColor(style.StationStand.stationPlatform.detainColor);
|
|
|
|
}
|
|
|
|
if (model.assignSkip || model.allSkip) {
|
|
|
|
this.setColor(style.StationStand.stationPlatform.jumpColor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default EStationPlatform;
|