ibp盘
This commit is contained in:
parent
bc9180d814
commit
7fd73dbf37
@ -12,11 +12,6 @@ deviceRender[deviceType.SquareButton] = {
|
|||||||
zlevel: 1
|
zlevel: 1
|
||||||
};
|
};
|
||||||
|
|
||||||
/** LampControl渲染配置*/
|
|
||||||
deviceRender[deviceType.LampControl] = {
|
|
||||||
zlevel: 1
|
|
||||||
};
|
|
||||||
|
|
||||||
/** WarnButton渲染配置*/
|
/** WarnButton渲染配置*/
|
||||||
deviceRender[deviceType.WarnButton] = {
|
deviceRender[deviceType.WarnButton] = {
|
||||||
zlevel: 1
|
zlevel: 1
|
||||||
@ -41,4 +36,9 @@ deviceRender[deviceType.Tip] = {
|
|||||||
deviceRender[deviceType.Background] = {
|
deviceRender[deviceType.Background] = {
|
||||||
zlevel: 0
|
zlevel: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** CircularLamp渲染配置 */
|
||||||
|
deviceRender[deviceType.CircularLamp] = {
|
||||||
|
zlevel: 1
|
||||||
|
};
|
||||||
export default deviceRender;
|
export default deviceRender;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
const deviceType = {
|
const deviceType = {
|
||||||
Text: 'Text',
|
Text: 'Text',
|
||||||
SquareButton: 'SquareButton',
|
SquareButton: 'SquareButton',
|
||||||
LampControl: 'LampControl',
|
|
||||||
WarnButton: 'WarnButton',
|
WarnButton: 'WarnButton',
|
||||||
Arrow: 'Arrow',
|
Arrow: 'Arrow',
|
||||||
RotatingButton: 'RotatingButton',
|
RotatingButton: 'RotatingButton',
|
||||||
Tip: 'Tip',
|
Tip: 'Tip',
|
||||||
Background: 'Background'
|
Background: 'Background',
|
||||||
|
CircularLamp: 'CircularLamp'
|
||||||
};
|
};
|
||||||
|
|
||||||
export default deviceType;
|
export default deviceType;
|
||||||
|
@ -33,6 +33,18 @@ const ibpData = {
|
|||||||
direction: '下行',
|
direction: '下行',
|
||||||
stationstandDirection: '车辆段方向'
|
stationstandDirection: '车辆段方向'
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
circularLampList: [
|
||||||
|
{
|
||||||
|
type: 'CircularLamp',
|
||||||
|
code: '1333_lamp',
|
||||||
|
point: {
|
||||||
|
x: 600,
|
||||||
|
y: 600
|
||||||
|
},
|
||||||
|
r: 40,
|
||||||
|
fillColor: '#332C22'
|
||||||
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -152,7 +152,6 @@ class IbpPan {
|
|||||||
|
|
||||||
localStore(code, val);
|
localStore(code, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var prop in elem) {
|
for (var prop in elem) {
|
||||||
if (elem[prop] != oDevice[prop]) {
|
if (elem[prop] != oDevice[prop]) {
|
||||||
Object.assign(oDevice, elem);
|
Object.assign(oDevice, elem);
|
||||||
@ -166,7 +165,6 @@ class IbpPan {
|
|||||||
update(list) {
|
update(list) {
|
||||||
(list || []).forEach(elem => {
|
(list || []).forEach(elem => {
|
||||||
const code = elem.code;
|
const code = elem.code;
|
||||||
const type = elem._type;
|
|
||||||
const oDevice = this.ibpDevice[code];
|
const oDevice = this.ibpDevice[code];
|
||||||
if (elem.dispose) {
|
if (elem.dispose) {
|
||||||
this.$painter.delete(oDevice);
|
this.$painter.delete(oDevice);
|
||||||
|
@ -29,11 +29,11 @@ class EventModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MouseController extends Eventful {
|
class MouseController extends Eventful {
|
||||||
constructor(jmap) {
|
constructor(ibp) {
|
||||||
super();
|
super();
|
||||||
this.$jmap = jmap;
|
this.$ibp = ibp;
|
||||||
this.$zr = jmap.getZr();
|
this.$zr = ibp.getZr();
|
||||||
this.events = jmap.getEvents();
|
this.events = ibp.getEvents();
|
||||||
this.initHandler(this.$zr);
|
this.initHandler(this.$zr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ class MouseController extends Eventful {
|
|||||||
const trainDetails = store.state.map.trainDetails;
|
const trainDetails = store.state.map.trainDetails;
|
||||||
if (trainDetails) {
|
if (trainDetails) {
|
||||||
if (newEm.deviceType != deviceType.Train || trainDetails.code != newEm.deviceCode) {
|
if (newEm.deviceType != deviceType.Train || trainDetails.code != newEm.deviceCode) {
|
||||||
var instance = (this.$jmap.getDeviceByCode(trainDetails.code) || {} ).instance;
|
var instance = (this.$ibp.getDeviceByCode(trainDetails.code) || {} ).instance;
|
||||||
instance && instance.removeTrainDetail && instance.removeTrainDetail();
|
instance && instance.removeTrainDetail && instance.removeTrainDetail();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -165,10 +165,10 @@ class MouseController extends Eventful {
|
|||||||
var newEm = new EventModel(e);
|
var newEm = new EventModel(e);
|
||||||
if ([1, 3].includes(e.which)) {
|
if ([1, 3].includes(e.which)) {
|
||||||
// 查找之前和当前鼠标选中的实例
|
// 查找之前和当前鼠标选中的实例
|
||||||
var oldDevice = this.$jmap.getDeviceByCode(oldEm.deviceCode) || {};
|
var oldDevice = this.$ibp.getDeviceByCode(oldEm.deviceCode) || {};
|
||||||
var newDevice = this.$jmap.getDeviceByCode(newEm.deviceCode) || {};
|
var newDevice = this.$ibp.getDeviceByCode(newEm.deviceCode) || {};
|
||||||
var oldInstance = (this.$jmap.getDeviceByCode(oldEm.deviceCode) || {}).instance || {};
|
var oldInstance = (this.$ibp.getDeviceByCode(oldEm.deviceCode) || {}).instance || {};
|
||||||
var newInstance = (this.$jmap.getDeviceByCode(newEm.deviceCode) || {}).instance || {};
|
var newInstance = (this.$ibp.getDeviceByCode(newEm.deviceCode) || {}).instance || {};
|
||||||
|
|
||||||
// 如果之前和当前选中的实例不一致
|
// 如果之前和当前选中的实例不一致
|
||||||
if (oldInstance != newInstance) {
|
if (oldInstance != newInstance) {
|
||||||
|
@ -6,7 +6,6 @@ class Arrow extends Group {
|
|||||||
constructor(model) {
|
constructor(model) {
|
||||||
super();
|
super();
|
||||||
this.model = model;
|
this.model = model;
|
||||||
console.log('----------', model);
|
|
||||||
this.create();
|
this.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import Group from 'zrender/src/container/Group';
|
import Group from 'zrender/src/container/Group';
|
||||||
import Arc from 'zrender/src/graphic/shape/Arc';
|
import Circle from 'zrender/src/graphic/shape/Circle';
|
||||||
import Text from 'zrender/src/graphic/Text';
|
import MouseController from '../mouseController';
|
||||||
import Rect from 'zrender/src/graphic/shape/Rect';
|
|
||||||
|
|
||||||
export default class CircularLamp extends Group {
|
export default class CircularLamp extends Group {
|
||||||
constructor(model) {
|
constructor(model) {
|
||||||
@ -13,6 +12,22 @@ export default class CircularLamp extends Group {
|
|||||||
}
|
}
|
||||||
|
|
||||||
create() {
|
create() {
|
||||||
|
this.lamp = new Circle({
|
||||||
|
zlevel: this.zlevel,
|
||||||
|
z: this.z,
|
||||||
|
shape: {
|
||||||
|
cx: this.model.point.x,
|
||||||
|
cy: this.model.point.y,
|
||||||
|
r: this.model.r
|
||||||
|
},
|
||||||
|
style: {
|
||||||
|
fill: this.model.fillColor
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.add(this.lamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
setCircularLampColor(color) {
|
||||||
|
this.lamp.setStyle('fill', color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
import Arrow from './arrow';
|
import Arrow from './arrow';
|
||||||
import deviceType from '../constant/deviceType';
|
import deviceType from '../constant/deviceType';
|
||||||
import Background from './background';
|
import Background from './background';
|
||||||
|
import CircularLamp from './circularLamp'
|
||||||
|
|
||||||
const ibpShape = {};
|
const ibpShape = {};
|
||||||
ibpShape[deviceType.Arrow] = Arrow;
|
ibpShape[deviceType.Arrow] = Arrow;
|
||||||
ibpShape[deviceType.Background] = Background;
|
ibpShape[deviceType.Background] = Background;
|
||||||
|
ibpShape[deviceType.CircularLamp] = CircularLamp;
|
||||||
|
|
||||||
function shapefactory(device, ibp) {
|
function shapefactory(device, ibp) {
|
||||||
console.log('device',device)
|
|
||||||
const type = device._type;
|
const type = device._type;
|
||||||
const shape = ibpShape[type];
|
const shape = ibpShape[type];
|
||||||
if (shape instanceof Function) {
|
if (shape instanceof Function) {
|
||||||
|
@ -2,8 +2,6 @@ import * as zrUtil from 'zrender/src/core/util';
|
|||||||
import * as matrix from 'zrender/src/core/matrix';
|
import * as matrix from 'zrender/src/core/matrix';
|
||||||
import deviceType from '../constant/deviceType';
|
import deviceType from '../constant/deviceType';
|
||||||
import deviceRender from '../constant/deviceRender';
|
import deviceRender from '../constant/deviceRender';
|
||||||
import Vue from 'vue';
|
|
||||||
import background from '../shape/background';
|
|
||||||
|
|
||||||
export function createTransform(opts) {
|
export function createTransform(opts) {
|
||||||
let transform = matrix.create();
|
let transform = matrix.create();
|
||||||
@ -47,7 +45,6 @@ export function parser(data, config) {
|
|||||||
|
|
||||||
Object.assign(data.background, config);
|
Object.assign(data.background, config);
|
||||||
ibpDevice[data.background.code] = createDevice(deviceType.Background, data.background, propConvert);
|
ibpDevice[data.background.code] = createDevice(deviceType.Background, data.background, propConvert);
|
||||||
console.log(data, '000',ibpDevice);
|
|
||||||
zrUtil.each(data.textList || [], elem => {
|
zrUtil.each(data.textList || [], elem => {
|
||||||
ibpDevice[elem.code] = createDevice(deviceType.Text, elem, propConvert);
|
ibpDevice[elem.code] = createDevice(deviceType.Text, elem, propConvert);
|
||||||
}, this);
|
}, this);
|
||||||
@ -56,8 +53,8 @@ export function parser(data, config) {
|
|||||||
ibpDevice[elem.code] = createDevice(deviceType.SquareButton, elem, propConvert);
|
ibpDevice[elem.code] = createDevice(deviceType.SquareButton, elem, propConvert);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.lampControlList || [], elem => {
|
zrUtil.each(data.circularLampList || [], elem => {
|
||||||
ibpDevice[elem.code] = createDevice(deviceType.LampControl, elem, propConvert);
|
ibpDevice[elem.code] = createDevice(deviceType.CircularLamp, elem, propConvert);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
zrUtil.each(data.warnButtonList || [], elem => {
|
zrUtil.each(data.warnButtonList || [], elem => {
|
||||||
|
Loading…
Reference in New Issue
Block a user