修正命令结束后未进行CmdEnd调用,导致历史记录异常, 添加某些实体的实体记录写入.临时移除ApplyMatrix在子实体中,#IJ5XE

pull/61/head
ChenX_AMD 7 years ago
parent 6a91df4193
commit 0eb8ceaf37

@ -205,30 +205,26 @@ export class DrawCircle implements Command
{
if (ptRes.StringResult == "3P")//三点画圆
{
this.DrawCicleUseThreePoint();
await this.DrawCicleUseThreePoint();
}
else if (ptRes.StringResult == "2P")//两点直径画圆
{
this.DrawCicleUseTwoPoint();
await this.DrawCicleUseTwoPoint();
}
else if (ptRes.StringResult == "T")//切点,切点半径画圆
{
this.DrawCicleUseCutoffPointAndRadious();
await this.DrawCicleUseCutoffPointAndRadious();
}
}
break;
case PromptStatus.OK:
{
this.DrawCircleUseRadious(ptRes.Value);//圆心半径画圆
await this.DrawCircleUseRadious(ptRes.Value);//圆心半径画圆
}
break;
default:
break;
}
app.m_Database.hm.EndCmd();
}
@ -248,8 +244,6 @@ export class DrawCircle implements Command
cir.Radius = disRes.Value;
else
cir.Erase();
app.m_Editor.ClearSnapEntity();
}
async DrawCicleUseTwoPoint()

@ -547,11 +547,6 @@ export class Arc extends Curve
let geo = obj["geometry"] as ShapeGeometry;
this.UpdateGeometry(geo);
}
ApplyMatrix(m: Matrix4)
{
super.ApplyMatrix(m);
this.Update();
}
GetSnapPoints(): Array<THREE.Vector3>
{
return this.GetStretchPoints();

@ -62,19 +62,6 @@ export class Board extends Entity
this.Update();
}
ApplyMatrix(m: Matrix4)
{
this.WriteAllObjectRecord();
let coor = new CoordinateSystem();
coor.copyForm(this.m_Matrix);
coor.applyMatrix4(m);
this.m_Matrix.copy(coor.getMatrix4());
this.UpdatePostion();
}
Draw(renderType: RenderType): Object3D
{
let obj = super.Draw(renderType);

@ -216,12 +216,6 @@ export class Circle extends Curve
this.UpdateGeometry(geo);
}
ApplyMatrix(m: Matrix4)
{
super.ApplyMatrix(m);
this.Update();
}
GetSnapPoints(): Array<THREE.Vector3>
{
return this.GetStretchPoints();

@ -161,13 +161,6 @@ export class AlignedDimension extends Dimension
this.updateTwoArrows(objs[4], objs[5], pts[0], pts[1]);
}
ApplyMatrix(m: Matrix4)
{
this.StartPoint.applyMatrix4(m);
this.EndPoint.applyMatrix4(m);
this.LinePoint.applyMatrix4(m);
this.Update();
}
GetSnapPoints(): Array<THREE.Vector3>
{
return [this.StartPoint, this.EndPoint, ...this.GetDimPts(), this.TextPosition];

@ -337,15 +337,6 @@ export class LineAngularDimension extends Dimension
this.updateDimLine(l1, lineStartPt, extSpt);
this.updateDimLine(l2, lineEndPt, extEpt);
}
ApplyMatrix(m: Matrix4)
{
this.StartPoint1.applyMatrix4(m);
this.StartPoint2.applyMatrix4(m);
this.EndPoint1.applyMatrix4(m);
this.EndPoint2.applyMatrix4(m);
this.ArcPoint.applyMatrix4(m);
this.Update();
}
GetSnapPoints(): Array<THREE.Vector3>
{

@ -72,12 +72,6 @@ export class Ellipse extends Curve
this.m_Angle // aRotation
);
}
ApplyMatrix(m: Matrix4)
{
super.ApplyMatrix(m);
this.m_Center.applyMatrix4(m);
this.Update();
}
InitDrawObject(renderType: RenderType = RenderType.Wireframe): Object3D
{

@ -217,9 +217,12 @@ export class Entity extends CADObject
* @param {Matrix4} m
* @memberof Entity
*/
ApplyMatrix(m: Matrix4)
ApplyMatrix(m: Matrix4): this
{
this.WriteAllObjectRecord();
this.m_Matrix.multiplyMatrices(m, this.m_Matrix);
this.Update();
return this;
}
GetSnapPoints(): Array<THREE.Vector3>

@ -24,18 +24,6 @@ export class Light extends Entity
super();
}
ApplyMatrix(m: Matrix4)
{
this.WriteAllObjectRecord();
let coor = new CoordinateSystem();
coor.copyForm(this.m_Matrix);
coor.applyMatrix4(m);
this.m_Matrix.copy(coor.getMatrix4());
this.UpdatePostion();
}
protected UpdatePostion()
{
if (this.m_Light)

@ -78,13 +78,6 @@ export class Line extends Curve
return this.EndPoint.sub(this.StartPoint);
}
ApplyMatrix(m: Matrix4)
{
this.m_StartPoint.applyMatrix4(m);
this.m_EndPoint.applyMatrix4(m);
this.Update();
}
IntersectWith(curve: Curve, intType: IntersectOption): Vector3[]
{
if (curve instanceof Line)
@ -110,7 +103,7 @@ export class Line extends Curve
//Param
GetPointAtParam(param: number): Vector3
{
return this.StartPoint.add(this.GetFistDeriv(0).multiplyScalar(param));
return this.StartPoint.add(this.GetFistDeriv(0).multiplyScalar(param)).applyMatrix4(this.OCS);
}
GetParamAtPoint(pt: Vector3): number
{

@ -908,11 +908,11 @@ export class Polyline extends Curve
let d2 = this.m_LineData[FixIndex(i + 1, this.m_LineData)];
if (d1.bul == 0)
{
return new Line(Vec2DTo3D(d1.pt), Vec2DTo3D(d2.pt));
return new Line(Vec2DTo3D(d1.pt), Vec2DTo3D(d2.pt)).ApplyMatrix(this.OCS);
}
else
{
return new Arc().ParseFromBul(d1.pt, d2.pt, d1.bul);
return new Arc().ParseFromBul(d1.pt, d2.pt, d1.bul).ApplyMatrix(this.OCS);
}
}
// 组合多段线数组组合为一多段线
@ -1364,17 +1364,7 @@ export class Polyline extends Curve
geo.setFromPoints(curve.getPoints(50));
updateGeometry(plObj, geo);
}
ApplyMatrix(m: THREE.Matrix4)
{
let pt: Vector3;
this.m_LineData.forEach(data =>
{
pt = Vec2DTo3D(data.pt)
pt.applyMatrix4(m);
data.pt = new Vector2(pt.x, pt.y);
});
this.Update();
}
GetSnapPoints(): Array<THREE.Vector3>
{
let plList: Vector3[] = [];
@ -1389,6 +1379,7 @@ export class Polyline extends Curve
}
MoveSnapPoints(index: number, moveVec: Vector3)
{
this.WriteAllObjectRecord();
if (index % 2 === 0)
this.MoveStretchPoints([index], moveVec);
else
@ -1412,10 +1403,11 @@ export class Polyline extends Curve
}
GetStretchPoints(): Array<Vector3>
{
let ocs = this.OCS;
let plList: Vector3[] = [];
for (let data of this.m_LineData)
{
plList.push(Vec2DTo3D(data.pt));
plList.push(Vec2DTo3D(data.pt).applyMatrix4(ocs));
}
return plList;
}
@ -1430,6 +1422,7 @@ export class Polyline extends Curve
*/
MoveStretchPoints(indexList: Array<number>, vec: Vector3)
{
this.WriteAllObjectRecord();
let moveVc = new Vector2(vec.x, vec.y);
let ptCout = this.m_LineData.length;

@ -113,20 +113,6 @@ export class Region extends Entity
}
}
//在移动时应用矩阵变换
ApplyMatrix(m: THREE.Matrix4)
{
this.WriteAllObjectRecord();
for (let cu of this.m_CuList)
{
cu.ApplyMatrix(m);
}
for (let [, en] of this.m_DrawEntity)
{
en.applyMatrix(m);
}
}
//读写文件
ReadFile(file: CADFile)
{

@ -207,10 +207,6 @@ export class Text extends Entity
text.position.copy(this.TextPosition);
app.m_Viewer.m_bNeedUpdate = true;
}
ApplyMatrix(m: Matrix4)
{
this.TextPosition = this.TextPosition.applyMatrix4(m);
}
GetSnapPoints(): Array<THREE.Vector3>
{
return [this.TextPosition];

@ -44,7 +44,9 @@ export class CommandMachine
CommandEnd(cmdName: string)
{
this.m_CommandIng = false;
app.m_Database.hm.EndCmd();
app.m_Editor.m_CommandStore.isCmdIng = false;
app.m_Viewer.m_GripScene.UpdateAll();
app.m_Editor.ClearSnapEntity();
app.m_Editor.UpdateScreen();
}

@ -9,6 +9,7 @@ import { MoveMatrix } from '../Geometry/GeUtils';
import { InputState } from './../Common/InputState';
import { Editor, EditorService } from './Editor';
import { MouseControls } from './MouseControls';
import { commandMachine } from './CommandMachine';
export class SnapDragServices implements EditorService
@ -97,12 +98,9 @@ export class SnapDragServices implements EditorService
})
this.UpdateLastPoint();
this.UpdatePreLine();
app.m_Database.hm.EndCmd();
app.m_Editor.ClearSnapEntity();
app.m_Viewer.m_GripScene.UpdateAll();
app.m_Viewer.m_GripScene.visible = true;
app.m_Editor.m_CommandStore.isCmdIng = false;
commandMachine.CommandEnd("drag");
app.m_Viewer.m_GripScene.visible = true;
return true;
}

Loading…
Cancel
Save