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; const buttonX = model.position.x - buttonD * ( model.width / 2 - 20); // platFormOffset.x - const buttonY = model.position.y + buttonD * (platFormOffset.y + buttonD * model.height / 2); this.stationPlatform = new Polygon({ zlevel: this.model.zlevel, z: this.model.z, _subType: 'StationPlatform', 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;