南京二号线 区段绘图 调整

This commit is contained in:
joylink_cuiweidong 2020-12-18 16:28:42 +08:00
parent c8487b6e60
commit 465e6a5d08
2 changed files with 60 additions and 13 deletions

View File

@ -1,6 +1,5 @@
import defaultStyle from '../defaultStyle';
import deviceType from '../../constant/deviceType';
import { TRUE } from 'node-sass';
class SkinCode extends defaultStyle {
constructor() {
@ -134,7 +133,7 @@ class SkinCode extends defaultStyle {
width: 3, // 物理区段分隔符宽度
logicWidth:1.5, // 逻辑区段分隔符宽度
endWidth: 3.5, // 尽头分隔符宽度
endColor: '#3F3F3F', // 尽头分隔符颜色
endColor: '#C0C0C0', // 尽头分隔符颜色
color: '#000', // 区段边界符颜色
halfHeight: 5, // 区段分隔符高度的一半
isLikeT:true // 特殊类型尽头分隔 类似与右躺着的T

View File

@ -28,7 +28,8 @@ export default class ESeparator extends Group {
y: model.points[0].y
},
sepType: model.sepTypeLeft,
drict: -1 // 方向
drict: -1, // 方向
type:model.type // 区段类型
});
/** 创建右侧分隔符*/
@ -40,25 +41,27 @@ export default class ESeparator extends Group {
y: model.points[model.points.length - 1].y
},
sepType: model.sepTypeRight,
drict: 1 // 方向
drict: 1, // 方向
type:model.type // 区段类型
});
this.add(this.lPartition);
this.add(this.rPartition);
}
}
createModel(modelData, points, lineWidth, stroke) {
createModel(modelData, points, lineWidth, stroke, rotation) {
const partition = new Polyline({
zlevel: this.zlevel,
z: this.z,
origin: [modelData.point.x, modelData.point.y],
rotation: Math.PI * 2 - Math.atan2(modelData.traingle.absy, modelData.traingle.absx) * modelData.traingle.drictx * modelData.traingle.dricty,
rotation: rotation || Math.PI * 2 - Math.atan2(modelData.traingle.absy, modelData.traingle.absx) * modelData.traingle.drictx * modelData.traingle.dricty,
shape: {
points: points
},
style: {
lineWidth: lineWidth || this.style.Section.separator.width,
stroke: stroke || this.style.Section.separator.color
// fill:stroke || this.style.Section.separator.color
}
});
return partition;
@ -112,11 +115,46 @@ export default class ESeparator extends Group {
if (modelData && style && modelData.traingle) {
let partition = null;
if (type === '01') { // 普通分割
const points = [
let points = [];
const lineWidth = 0;
// const tanRate = modelData.traingle.getTanRate();
// if (modelData.type == '03' && tanRate != 0 && tanRate != 1) {
// points = [
// [modelData.point.x,
// modelData.point.y + modelData.drict * (style.Section.separator.halfHeight) / 2],
// [modelData.point.x - modelData.drict * (style.Section.separator.halfHeight) / tanRate,
// modelData.point.y - modelData.drict * (style.Section.separator.halfHeight) / 2],
// [modelData.point.x,
// modelData.point.y - modelData.drict * (style.Section.separator.halfHeight) / 2],
// [modelData.point.x + modelData.drict * (style.Section.separator.halfHeight) / tanRate,
// modelData.point.y + modelData.drict * (style.Section.separator.halfHeight) / 2],
// [modelData.point.x,
// modelData.point.y + modelData.drict * (style.Section.separator.halfHeight) / 2]
// // 待处理
// // [modelData.point.x - (style.Section.separator.halfHeight) * modelData.traingle.getSinRate() / 2,
// // modelData.point.y - (style.Section.separator.halfHeight) * modelData.traingle.getCosRate() / 2],
// // [modelData.point.x + (style.Section.separator.halfHeight) / modelData.traingle.getCosRate() / 2,
// // modelData.point.y - (style.Section.separator.halfHeight) * modelData.traingle.getCosRate() / 2],
// // [modelData.point.x, modelData.point.y]
// // [modelData.point.x + (style.Section.separator.halfHeight) * modelData.traingle.getSinRate(),
// // modelData.point.y + (style.Section.separator.halfHeight) * modelData.traingle.getCosRate()]
// // [modelData.point.x - (style.Section.separator.halfHeight) * modelData.traingle.getSinRate() / 2,
// // modelData.point.y + (style.Section.separator.halfHeight) * modelData.traingle.getCosRate() / 2],
// // [modelData.point.x - (style.Section.separator.halfHeight) * modelData.traingle.getSinRate() / 2,
// // modelData.point.y + (style.Section.separator.halfHeight) * modelData.traingle.getCosRate() / 2]
// ];
// console.log(points, '11111111111111111');
// lineWidth = 1;
// const stroke = style.Section.separator.color;
// partition = this.createModel(modelData, points, lineWidth, stroke);
// } else {
points = [
[modelData.point.x, modelData.point.y - (style.Section.separator.halfHeight)],
[modelData.point.x, modelData.point.y + (style.Section.separator.halfHeight)]
];
// lineWidth = modelData.type == '02' ? style.Section.separator.logicWidth : style.Section.separator.width;
partition = this.createModel(modelData, points);
// }
} else if (type === '02') { // 单侧分割符
const points = [
[modelData.point.x + modelData.drict * (style.Section.separator.halfHeight), modelData.point.y - (style.Section.separator.halfHeight * 1.5)],
@ -125,12 +163,22 @@ export default class ESeparator extends Group {
];
partition = this.createModel(modelData, points);
} else if (type === '03') { // 尽头分隔符
const points = [
[modelData.point.x + modelData.drict * (style.Section.separator.halfHeight) * 1.2, modelData.point.y - (style.Section.separator.halfHeight * 1.2)],
[modelData.point.x, modelData.point.y - (style.Section.separator.halfHeight * 1.2)],
[modelData.point.x, modelData.point.y + (style.Section.separator.halfHeight * 1.2)],
[modelData.point.x + modelData.drict * (style.Section.separator.halfHeight) * 1.2, modelData.point.y + (style.Section.separator.halfHeight * 1.2)]
];
let points = [];
if (style.Section.separator.isLikeT) {
points = [
[modelData.point.x + modelData.drict * style.Section.separator.width, modelData.point.y],
[modelData.point.x + modelData.drict * (style.Section.separator.width + style.Section.separator.halfHeight * 1.2), modelData.point.y],
[modelData.point.x + modelData.drict * (style.Section.separator.width + style.Section.separator.halfHeight * 1.2), modelData.point.y - style.Section.separator.halfHeight * 1.2],
[modelData.point.x + modelData.drict * (style.Section.separator.width + style.Section.separator.halfHeight * 1.2), modelData.point.y + style.Section.separator.halfHeight * 1.2]
];
} else {
points = [
[modelData.point.x + modelData.drict * (style.Section.separator.halfHeight) * 1.2, modelData.point.y - (style.Section.separator.halfHeight * 1.2)],
[modelData.point.x, modelData.point.y - (style.Section.separator.halfHeight * 1.2)],
[modelData.point.x, modelData.point.y + (style.Section.separator.halfHeight * 1.2)],
[modelData.point.x + modelData.drict * (style.Section.separator.halfHeight) * 1.2, modelData.point.y + (style.Section.separator.halfHeight * 1.2)]
];
}
const lineWidth = style.Section.separator.endWidth;
const stroke = style.Section.separator.endColor;
partition = this.createModel(modelData, points, lineWidth, stroke);