修改代码
This commit is contained in:
parent
8f534ce10a
commit
e3341dcd04
@ -2,7 +2,7 @@ import * as zrUtil from 'zrender/src/core/util';
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import deviceType from './constant/deviceType';
|
||||
import shapefactory from './shape/factory';
|
||||
import Transform from './transform';
|
||||
import TransformHandle from './transformHandle';
|
||||
|
||||
class Painter {
|
||||
constructor(jmap) {
|
||||
@ -11,7 +11,7 @@ class Painter {
|
||||
this.$zr = jmap.getZr();
|
||||
|
||||
// 视图控制器
|
||||
this.$transform = new Transform(this, this.$zr);
|
||||
this.$transformHandle = new TransformHandle(this, this.$zr);
|
||||
|
||||
// 图层数据
|
||||
this.mapInstanceLevel = {};
|
||||
@ -63,7 +63,7 @@ class Painter {
|
||||
const type = device._type;
|
||||
const instance = shapefactory(type, device, this.$jmap);
|
||||
if (instance) {
|
||||
this.$transform.transformView(instance);
|
||||
this.$transformHandle.transformView(instance);
|
||||
device.instance = instance;
|
||||
this.mapInstanceLevel[type].add(instance);
|
||||
}
|
||||
@ -97,7 +97,7 @@ class Painter {
|
||||
* @param {*} zoom
|
||||
*/
|
||||
updateZoomTransform(zoom) {
|
||||
this.$transform.updateTransform(zoom);
|
||||
this.$transformHandle.updateTransform(zoom);
|
||||
}
|
||||
|
||||
/**
|
||||
|
50
src/jmap/shape/Signal/ESigDelay.js
Normal file
50
src/jmap/shape/Signal/ESigDelay.js
Normal file
@ -0,0 +1,50 @@
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import Text from 'zrender/src/graphic/Text';
|
||||
|
||||
class ESigDelay extends Group {
|
||||
constructor(model) {
|
||||
super();
|
||||
this.model = model;
|
||||
this.zlevel = model.zlevel;
|
||||
this.z = model.z;
|
||||
this._create();
|
||||
}
|
||||
|
||||
_create() {
|
||||
this.name = new Text({
|
||||
_subType: this.model._subType,
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
silent: this.model.silent || false,
|
||||
style: {
|
||||
x: this.model.x,
|
||||
y: this.model.y,
|
||||
text: this.model.text,
|
||||
textFont: this.model.textFont,
|
||||
textFill: this.model.textFill,
|
||||
textAlign: this.model.textAlign,
|
||||
textPosition: this.model.textPosition || 'inside',
|
||||
textVerticalAlign: this.model.textVerticalAlign || null
|
||||
}
|
||||
});
|
||||
this.add(this.name);
|
||||
}
|
||||
|
||||
setStyle(model) {
|
||||
this.name.setStyle(model);
|
||||
}
|
||||
|
||||
setColor(color) {
|
||||
this.name.setStyle('textFill', color);
|
||||
}
|
||||
|
||||
hide() {
|
||||
this.name.hide();
|
||||
}
|
||||
|
||||
show() {
|
||||
this.name.show();
|
||||
}
|
||||
}
|
||||
|
||||
export default ESigDelay;
|
50
src/jmap/shape/Signal/ESigName.js
Normal file
50
src/jmap/shape/Signal/ESigName.js
Normal file
@ -0,0 +1,50 @@
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import Text from 'zrender/src/graphic/Text';
|
||||
|
||||
class ESigName extends Group {
|
||||
constructor(model) {
|
||||
super();
|
||||
this.model = model;
|
||||
this.zlevel = model.zlevel;
|
||||
this.z = model.z;
|
||||
this._create();
|
||||
}
|
||||
|
||||
_create() {
|
||||
this.name = new Text({
|
||||
_subType: this.model._subType,
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
silent: this.model.silent || false,
|
||||
style: {
|
||||
x: this.model.x,
|
||||
y: this.model.y,
|
||||
text: this.model.text,
|
||||
textFont: this.model.textFont,
|
||||
textFill: this.model.textFill,
|
||||
textAlign: this.model.textAlign,
|
||||
textPosition: this.model.textPosition || 'inside',
|
||||
textVerticalAlign: this.model.textVerticalAlign || null
|
||||
}
|
||||
});
|
||||
this.add(this.name);
|
||||
}
|
||||
|
||||
setStyle(model) {
|
||||
this.name.setStyle(model);
|
||||
}
|
||||
|
||||
setColor(color) {
|
||||
this.name.setStyle('textFill', color);
|
||||
}
|
||||
|
||||
hide() {
|
||||
this.name.hide();
|
||||
}
|
||||
|
||||
show() {
|
||||
this.name.show();
|
||||
}
|
||||
}
|
||||
|
||||
export default ESigName;
|
@ -7,7 +7,9 @@ import ESigLmap from './ESigLmap';
|
||||
import ESigPass from './ESigPass';
|
||||
import ESigRoute from './ESigRoute';
|
||||
import ESigButton from './ESigButton';
|
||||
import ETextName from '../element/ETextName';
|
||||
import ESigDelay from './ESigDelay';
|
||||
import ESigName from './ESigName';
|
||||
// import Text from 'zrender/src/graphic/Text';
|
||||
import Group from 'zrender/src/container/Group';
|
||||
|
||||
class Signal extends Group {
|
||||
@ -62,12 +64,30 @@ class Signal extends Group {
|
||||
}
|
||||
|
||||
// 信号机名称
|
||||
this.sigName = new ETextName({
|
||||
const sigNameX = model.position.x + model.namePosition.x;
|
||||
const sigNameY = model.position.y + posit * (style.Signal.signalDistance + style.Section.sectionWidth + style.Signal.signalR * 2 + model.namePosition.y);
|
||||
// this.sigName = new Text({
|
||||
// zlevel: this.zlevel,
|
||||
// z: 1,
|
||||
// silent: model.silent || false,
|
||||
// style: {
|
||||
// x: sigNameX,
|
||||
// y: sigNameY,
|
||||
// text: model.name,
|
||||
// textFont: `bold ${style.Signal.signalTextFontSize} px ${style.textFontFormat}`,
|
||||
// textFill: style.Signal.sigTextGreen,
|
||||
// textAlign: 'middle',
|
||||
// textPosition: this.model.textPosition || 'inside',
|
||||
// textVerticalAlign: posit == 1 ? 'top' : 'bottom'
|
||||
// }
|
||||
// });
|
||||
|
||||
this.sigName = new ESigName({
|
||||
zlevel: this.zlevel,
|
||||
z: 1,
|
||||
style: style,
|
||||
x: model.position.x + model.namePosition.x,
|
||||
y: model.position.y + posit * (style.Signal.signalDistance + style.Section.sectionWidth + style.Signal.signalR * 2 + model.namePosition.y),
|
||||
x: sigNameX,
|
||||
y: sigNameY,
|
||||
text: model.name,
|
||||
textFont: `bold ${style.Signal.signalTextFontSize} px ${style.textFontFormat}`,
|
||||
textFill: style.Signal.sigTextGreen,
|
||||
@ -110,7 +130,7 @@ class Signal extends Group {
|
||||
const sigDelayH = style.Signal.signalSigDelayDirection ? this.count * style.Signal.signalR * 2 : -style.Signal.signalR * 2;
|
||||
const sigDelayX = endPoint.x + (style.Signal.signalSigDelayOffset.x + sigDelayH) * drict;
|
||||
const sigDelayY = endPoint.y - (style.Signal.signalSigDelayOffset.y) * posit;
|
||||
this.sigDelay = new ETextName({
|
||||
this.sigDelay = new ESigDelay({
|
||||
zlevel: this.zlevel,
|
||||
z: 1,
|
||||
style: style,
|
||||
@ -193,6 +213,7 @@ class Signal extends Group {
|
||||
// 封锁
|
||||
block() {
|
||||
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.signalLampRedColor);
|
||||
// this.sigName.setStyle('textFill', this.style.Signal.sectionBlockTextColor);
|
||||
this.sigName.setColor(this.style.Signal.sectionBlockTextColor);
|
||||
}
|
||||
|
||||
@ -269,6 +290,7 @@ class Signal extends Group {
|
||||
recover() {
|
||||
this.sigDelay.hide();
|
||||
this.sigPass.animationRecover();
|
||||
// this.sigName.setStyle('textFill', this.style.Signal.signalTextGreen);
|
||||
this.sigName.setColor(this.style.Signal.signalTextGreen);
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ export default {
|
||||
|
||||
// this.jmap.load({ skinVO: { code: '02' }, linkList: list });
|
||||
|
||||
getPublishMapDetail('02').then(resp => {
|
||||
getPublishMapDetail('03').then(resp => {
|
||||
this.jmap.load(resp.data);
|
||||
// this.jmap.setDefaultState();
|
||||
this.jmap.setLevelInvisible([deviceType.Link]);
|
||||
|
Loading…
Reference in New Issue
Block a user