添加注释

pull/68/head
Zoe 6 years ago
parent 2aa5308dc4
commit 4efde78d7a

@ -114,7 +114,9 @@ export class PolyOffestUtil
}
let newPlList: Array<Polyline> = [];
let startV = this.clonePlData(offResList[0].pl.LineData[0]);
let isStillClose = this.m_Polyline.IsClose;
//判断是否起始或者终止线是否发生变化
let isChangeOriginClose = this.m_Polyline.IsClose;
//直线获得斜率,圆弧获得圆弧方向
const getSlope = (pl: Polyline) =>
@ -145,11 +147,14 @@ export class PolyOffestUtil
if (i === offResList.length - 1)
{
if (this.m_Polyline.IsClose && isStillClose)
if (this.m_Polyline.IsClose && isChangeOriginClose)
laterLine = newPlList[0];
else
{
let frontLine = offResList[offResList.length - 1].pl;
let oldSlope = getSlope(frontLine);
let endV = this.clonePlData(frontLine.LineData[1]);
//如果原先不是闭合的,判断偏移后首尾是否相交,相交则连接
if (offResList.length >= 3)
@ -167,13 +172,15 @@ export class PolyOffestUtil
}
}
let pl = new Polyline([startV, endV]);
let par = frontLine.GetParamAtPoint(Vec2DTo3D(endV.pt));
let par1 = frontLine.GetParamAtPoint(Vec2DTo3D(startV.pt));
par > 0 && par1 < 1 && newPlList.push(pl);
let newSlope = getSlope(pl);
!isDisVail(oldSlope, newSlope) && newPlList.push(pl);
break;
}
}
if (!laterLine) return [];
//终点data
let endV = i === offResList.length - 1 ? laterLine.LineData[0] : this.clonePlData(laterLine.LineData[0]);
//交点
@ -260,9 +267,9 @@ export class PolyOffestUtil
if (equal(pl.StartPoint, pl.EndPoint) || isDisVail(oldSlope, newSlope))
{
if (isStillClose)
if (isChangeOriginClose)
{
isStillClose = !(offResList[i].index === 0 || offResList[i].index === this.m_Polyline.EndParam);
isChangeOriginClose = !(offResList[i].index === 0 || offResList[i].index === this.m_Polyline.EndParam);
}
continue;
}

Loading…
Cancel
Save