调整线段画法

This commit is contained in:
zyy 2020-10-12 13:04:13 +08:00
parent 34fa34ba61
commit d27266ab7a
6 changed files with 96 additions and 81 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -190,7 +190,7 @@ deviceRender[deviceType.IscsText] = {
deviceRender[deviceType.IscsLine] = {
_type: deviceType.IscsLine,
zlevel: 1,
z: 5
z: 5
};
/** 矩形渲染配置 */
deviceRender[deviceType.IscsRect] = {

View File

@ -27,7 +27,7 @@ export default class line extends Group {
position: [model.points[0].x, model.points[0].y]
});
// 1101 垂直渐变 1110 水平渐变
let strokeColor = this.model.fillColor;
let fillColor = this.model.fillBackground;
if (model.isGradual) {
const offsetList = [];
model.modelList.forEach(item => {
@ -37,9 +37,9 @@ export default class line extends Group {
});
});
if (model.gradualShow == 'level') {
strokeColor = new zrender.LinearGradient(1, 1, 0, 1, offsetList);
fillColor = new zrender.LinearGradient(1, 1, 0, 1, offsetList);
} else {
strokeColor = new zrender.LinearGradient(1, 1, 1, 0, offsetList);
fillColor = new zrender.LinearGradient(1, 1, 1, 0, offsetList);
}
}
const modelPoints = [];
@ -52,17 +52,21 @@ export default class line extends Group {
});
this.iscsLine = new Polyline({
zlevel: model.zlevel,
z: model.z,
z2: model.z2||0,
z: model.z,
z2: model.z2 || 0,
draggable: false,
shape: {
points: modelPoints
},
style: {
lineWidth: this.model.lineWidth,
stroke: strokeColor
stroke: this.model.fillColor
}
});
console.log(this.model.fill);
if (fillColor) {
this.iscsLine.setStyle('fill', fillColor);
}
if (model.classify == 'dashed') {
this.iscsLine.setStyle('lineDash', [8, 6]);
}
@ -75,8 +79,8 @@ export default class line extends Group {
}
this.arrows = new Polygon({
zlevel: model.zlevel,
z: model.z,
z2: model.z2||0,
z: model.z,
z2: model.z2 || 0,
origin: [0, 0],
rotation: rotation,
shape: {
@ -103,8 +107,8 @@ export default class line extends Group {
const y = model.points[this.model.points.length - 1].y - model.points[this.model.points.length - 2].y;
this.arrows = new Polygon({
zlevel: model.zlevel,
z: model.z,
z2: model.z2||0,
z: model.z,
z2: model.z2 || 0,
origin: [x, y],
rotation: rotation,
shape: {

View File

@ -20,35 +20,37 @@ import blowerRedRight from '@/assets/iscs_picture/gufengji-red-r.png';
import blowerGrayRight from '@/assets/iscs_picture/gufengji-gray-r.png';
import iscsAPF from '@/assets/iscs_picture/iscs_APF.png';
import drum from '@/assets/iscs_picture/drum.png';
import exhaustFan from '@/assets/iscs_picture/exhaustFan.png'
import exhaustFan from '@/assets/iscs_picture/exhaustFan.png';
import waterCooler from '@/assets/iscs_picture/ZSDF533.png';
import textBgBluePoint from '@/assets/iscs_picture/textBgBluePoint.png';
import ventilationFan from '@/assets/iscs_picture/ventilationFan.png'
import ventilationFan from '@/assets/iscs_picture/ventilationFan.png';
import kongzhixiang from '@/assets/iscs_picture/iscs_kongzhixiang.png';
const pictureObj = {
'psdLeft': psdLeft,
'psdSystem': psdSystem,
'psdRight': psdRight,
'APF': iscsAPF,
'envPersonDoor': envPersonDoor,
'psdRight': psdRight,
'APF': iscsAPF,
'envPersonDoor': envPersonDoor,
's': fireBlue,
'a': fireRed,
hand,
fmBlue,
fmGray,
fmGreen,
airCond,
airCondMul,
setting,
blowerRedLeft,
blowerGrayLeft,
blowerRedRight,
blowerGrayRight,
drum,
exhaustFan,
waterCooler,
textBgBluePoint,
ventilationFan
'a': fireRed,
hand,
fmBlue,
fmGray,
fmGreen,
airCond,
airCondMul,
setting,
blowerRedLeft,
blowerGrayLeft,
blowerRedRight,
blowerGrayRight,
drum,
exhaustFan,
waterCooler,
textBgBluePoint,
ventilationFan,
kongzhixiang
};
export default class Picture extends Group {
constructor(device) {
@ -69,9 +71,9 @@ export default class Picture extends Group {
});
this.imageButton = new Image({
zlevel: model.zlevel,
z: model.z,
origin: [model.width/2, model.height/2],
rotation: (model.rotation||0)*Math.PI/180,
z: model.z,
origin: [model.width / 2, model.height / 2],
rotation: (model.rotation || 0) * Math.PI / 180,
style: {
x: 0,
y: 0,

View File

@ -1,11 +1,11 @@
<template>
<div style="overflow-y: scroll;height: calc(100% - 46px); width: 100%;">
<el-form ref="form" :rules="rules" :model="form" label-width="100px" style="width: 100%;padding: 10px 20px;">
<el-form-item label="图层:" prop="z2">
<el-form-item label="图层:" prop="z2">
<el-input-number v-model="form.z2" controls-position="right" :min="0" size="small" />
</el-form-item>
<el-form-item label="线段宽度:" prop="lineWidth">
<el-input-number v-model="form.lineWidth" controls-position="right" :min="1" :max="50" size="small" />
<el-input-number v-model="form.lineWidth" controls-position="right" :min="0" :max="50" size="small" />
</el-form-item>
<el-form-item label="类型:" prop="type">
<el-select v-model="form.classify" placeholder="请选择类型" size="small">
@ -43,7 +43,10 @@
</el-table-column>
</el-table>
</div>
<el-form-item v-if="!form.isGradual" label="线段颜色:" prop="fillColor">
<el-form-item v-if="!form.isGradual" label="线段填充色:" prop="fillColor">
<el-color-picker v-model="form.fillBackground" size="small" />
</el-form-item>
<el-form-item label="线段颜色:" prop="borderColor">
<el-color-picker v-model="form.fillColor" size="small" />
</el-form-item>
<el-form-item label="箭头显示:" prop="arrowShow">
@ -122,10 +125,11 @@ export default {
showDeleteButton: false,
form: {
classify:'solid',
code: '',
z2: 0,
code: '',
z2: 0,
lineWidth: '',
fillColor: '#fff',
fillBackground: '',
arrowShow: 'none',
arrowSize: 5,
points: [
@ -141,7 +145,7 @@ export default {
{ required: true, message: '请输入线段宽度', trigger: 'blur' }
],
fillColor: [
{ required: true, message: '请输入线段颜色', trigger: 'blur' }
{ required: true, message: '请输入线段边框颜色', trigger: 'blur' }
]
}
};
@ -158,10 +162,11 @@ export default {
this.buttonText = '修改';
this.showDeleteButton = true;
this.isUpdate = true;
this.form.code = model.code;
this.form.z2 = model.z2||0;
this.form.code = model.code;
this.form.z2 = model.z2 || 0;
this.form.lineWidth = model.lineWidth;
this.form.fillColor = model.fillColor;
this.form.fillBackground = model.fillBackground || '';
if (model.point1) {
this.form.points = [];
this.form.points.push(model.point1);
@ -189,10 +194,11 @@ export default {
const lineModel = {
points: this.form.points,
code: this.isUpdate ? this.form.code : getUID('IscsLine', this.iscs.iscsLineList),
_type: 'IscsLine',
z2: this.form.z2,
_type: 'IscsLine',
z2: this.form.z2,
lineWidth: this.form.lineWidth,
fillColor: this.form.fillColor,
fillBackground: this.form.fillBackground,
classify: this.form.classify,
arrowShow: this.form.arrowShow,
arrowSize: this.form.arrowSize,
@ -222,6 +228,7 @@ export default {
_type: 'IscsLine',
lineWidth: this.form.lineWidth,
fillColor: this.form.fillColor,
fillBackground: this.form.fillBackground,
classify: this.form.classify,
arrowShow: this.form.arrowShow,
arrowSize: this.form.arrowSize
@ -236,6 +243,7 @@ export default {
code: '',
lineWidth: '',
fillColor: '#fff',
fillBackground: '',
arrowShow: 'none',
arrowSize: 5,
points: [

View File

@ -9,9 +9,9 @@
<el-option v-for="(item, index) in typeList" :key="index" :label="item.name" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="旋转角度:" prop="rotation">
<el-input-number v-model="form.rotation" controls-position="right" size="small" />
</el-form-item>
<el-form-item label="旋转角度:" prop="rotation">
<el-input-number v-model="form.rotation" controls-position="right" size="small" />
</el-form-item>
<el-form-item label="宽度:" prop="width">
<el-input-number v-model="form.width" controls-position="right" :min="1" size="small" />
</el-form-item>
@ -50,36 +50,37 @@ export default {
type: '',
size: 10,
width: 50,
height: 50,
rotation: 0,
height: 50,
rotation: 0,
x: 10,
y: 10
},
typeList: [
{ name: '车头', value: 'psdLeft' },
{ name: '车尾', value: 'psdRight' },
{ name: '车厢', value: 'psdSystem' },
{ name: '人防门', value: 'envPersonDoor'},
{ name: '蓝色FIRE', value: 's'},
{ name: '红色FIRE', value: 'a'},
{ name: 'APF', value: 'APF'},
{ name: '手动阀', value: 'hand'},
{ name: '蓝色-阀门', value: 'fmBlue'},
{ name: '灰色-阀门', value: 'fmGray'},
{ name: '绿色-阀门', value: 'fmGreen'},
{ name: '空调', value: 'airCond'},
{ name: '多联空调', value: 'airCondMul'},
{ name: '管件', value: 'setting'},
{ name: '汽包', value: 'drum' },
{ name: '红色-左侧-鼓风机', value: 'blowerRedLeft'},
{ name: '灰色-左侧-鼓风机', value: 'blowerGrayLeft'},
{ name: '红色-右侧-鼓风机', value: 'blowerRedRight'},
{ name: '灰色-右侧-鼓风机', value: 'blowerGrayRight'},
{ name: '排风机', value: 'exhaustFan' },
{ name: '冷水机', value: 'waterCooler'},
{ name: '顶部排风机', value: 'ventilationFan'},
{ name: '文字蓝色背景', value: 'textBgBluePoint'}
],
{ name: '车厢', value: 'psdSystem' },
{ name: '人防门', value: 'envPersonDoor'},
{ name: '蓝色FIRE', value: 's'},
{ name: '红色FIRE', value: 'a'},
{ name: 'APF', value: 'APF'},
{ name: '手动阀', value: 'hand'},
{ name: '蓝色-阀门', value: 'fmBlue'},
{ name: '灰色-阀门', value: 'fmGray'},
{ name: '绿色-阀门', value: 'fmGreen'},
{ name: '空调', value: 'airCond'},
{ name: '多联空调', value: 'airCondMul'},
{ name: '管件', value: 'setting'},
{ name: '汽包', value: 'drum' },
{ name: '红色-左侧-鼓风机', value: 'blowerRedLeft'},
{ name: '灰色-左侧-鼓风机', value: 'blowerGrayLeft'},
{ name: '红色-右侧-鼓风机', value: 'blowerRedRight'},
{ name: '灰色-右侧-鼓风机', value: 'blowerGrayRight'},
{ name: '排风机', value: 'exhaustFan' },
{ name: '冷水机', value: 'waterCooler'},
{ name: '顶部排风机', value: 'ventilationFan'},
{ name: '文字蓝色背景', value: 'textBgBluePoint'},
{ name: '风井', value: 'kongzhixiang' }
],
rules: {
strokeColor: [
@ -105,8 +106,8 @@ export default {
this.isUpdate = true;
this.form.code = model.code;
this.form.type = model.type;
this.form.size = model.size;
this.form.rotation = model.rotation;
this.form.size = model.size;
this.form.rotation = model.rotation;
this.form.width = model.width;
this.form.height = model.height;
this.form.x = model.point.x;
@ -127,8 +128,8 @@ export default {
code: this.isUpdate ? this.form.code : getUID('IscsPicture', this.iscs.iscsPictureList),
_type: 'IscsPicture',
type: this.form.type,
size: this.form.size,
rotation: this.form.rotation,
size: this.form.size,
rotation: this.form.rotation,
width: this.form.width,
height: this.form.height
};
@ -148,8 +149,8 @@ export default {
code: this.form.code,
_type: 'IscsPicture',
type: this.form.type,
size: this.form.size,
rotation: this.form.rotation,
size: this.form.size,
rotation: this.form.rotation
};
this.$emit('deleteDataModel', rectModel);
},
@ -160,8 +161,8 @@ export default {
this.form = {
code: '',
type: '',
size: 10,
rotation: 0,
size: 10,
rotation: 0,
width: 50,
height: 50,
x: 10,