From 6bb7c1b4dcb1b910049dd319ec542bd3b17ca940 Mon Sep 17 00:00:00 2001 From: Zoe Date: Fri, 3 Aug 2018 09:35:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9D=BF=E4=BB=B6=E5=A4=B9?= =?UTF-8?q?=E7=82=B9=E6=8B=89=E4=BC=B8,=E6=B8=85=E7=90=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/DatabaseServices/Board.ts | 21 ++++++++++++--------- src/DatabaseServices/Polyline.ts | 7 ------- src/DatabaseServices/Shape.ts | 10 ---------- 3 files changed, 12 insertions(+), 26 deletions(-) diff --git a/src/DatabaseServices/Board.ts b/src/DatabaseServices/Board.ts index 8686ae5ce..7237777fc 100644 --- a/src/DatabaseServices/Board.ts +++ b/src/DatabaseServices/Board.ts @@ -11,7 +11,6 @@ import { Entity } from './Entity'; import { Line } from './Line'; import { DbPhysicalMaterial } from './PhysicalMaterial'; import { Shape } from './Shape'; -import { app } from '../ApplicationServices/Application'; export enum BoardType { @@ -173,9 +172,13 @@ export class Board extends Entity { return this.m_Name; } + Explode() + { + return this.m_Shape.Explode().map(cu => cu.ApplyMatrix(this.OCS)); + } GetSnapPoints(): Array { - let pts = this.m_Shape.GetSnapPoints(); + let pts = this.m_Shape.Outline.Curve.GetSnapPoints(); pts = pts.concat(pts.map(p => { let vec = this.Normal.applyMatrix4(new Matrix4().extractRotation(this.OCSInv)).multiplyScalar(-this.m_Thickness); @@ -197,26 +200,26 @@ export class Board extends Entity return i; }) + let cur = this.m_Shape.Outline.Curve; + let vl = vec.clone(); vl.applyMatrix4(new Matrix4().extractRotation(this.OCSInv)); let refAxis = new Vector3(1); - let derv = this.m_Shape.Outline.Curve.GetFistDeriv(pts[indexList[0]]); + let derv = cur.GetFistDeriv(pts[indexList[0]]); if (vl.angleTo(refAxis) < Math.PI / 4 || vl.angleTo(refAxis) > Math.PI * 3 / 4) vl.setY(0); else vl.setX(0); - if (indexList[0] & 1) + if ((indexList[0] & 1) && + !equaln(vl.angleTo(derv), Math.PI / 2)) { - if (!equaln(vl.angleTo(derv), Math.PI / 2)) - { - return; - } + return; } - this.m_Shape.MoveSnapPoints([indexList[0]], vl); + cur.MoveSnapPoints(indexList.slice(0, indexList.length / 2), vl); this.Update(); } diff --git a/src/DatabaseServices/Polyline.ts b/src/DatabaseServices/Polyline.ts index c2bccabb1..cafb35e78 100644 --- a/src/DatabaseServices/Polyline.ts +++ b/src/DatabaseServices/Polyline.ts @@ -413,13 +413,6 @@ export class Polyline extends Curve return cu.GetFistDeriv(this.GetCurveParamAtParam(param)); } - private copyPolyline(plData: PolylineProps[]): Polyline - { - let pl = this.Clone() as Polyline; - pl.LineData = plData; - return pl; - } - GetSplitCurves(param: number[] | number): Array { //参数需要转化为参数数组 diff --git a/src/DatabaseServices/Shape.ts b/src/DatabaseServices/Shape.ts index fb555b5c7..5a87628f0 100644 --- a/src/DatabaseServices/Shape.ts +++ b/src/DatabaseServices/Shape.ts @@ -4,7 +4,6 @@ import { CADFile } from './CADFile'; import { Contour } from './Contour'; import { Curve } from './Curve'; import { Polyline } from './Polyline'; -import { Vector3 } from 'three'; export class Shape { @@ -49,15 +48,6 @@ export class Shape this.UpdateShape(); return this.m_Shape; } - GetSnapPoints(): Array - { - return this.Outline.Curve.GetSnapPoints(); - } - MoveSnapPoints(indexList: Array, vec: Vector3) - { - this.m_Outline.Curve.MoveSnapPoints(indexList, vec); - this.UpdateShape(); - } Explode() { let cus: Curve[] = [];