|
|
|
@ -133,7 +133,13 @@ export class CADFactory
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function Factory(target: Object)
|
|
|
|
|
{
|
|
|
|
|
CADFactory.RegisterObject(target);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//所有cad对象的基类
|
|
|
|
|
@Factory
|
|
|
|
|
export class CADObject
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
@ -148,13 +154,9 @@ export class CADObject
|
|
|
|
|
SetDefaultDb(db: Database)
|
|
|
|
|
{
|
|
|
|
|
if (!this._db)
|
|
|
|
|
{
|
|
|
|
|
this._db = db;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
console.warn("警告:同一个对象无法重复设置默认db.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//private 私有的方法,暴露给Db的添加对象,方法使用.
|
|
|
|
@ -168,9 +170,7 @@ export class CADObject
|
|
|
|
|
this.objectId = db.AllocateId(this);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
console.warn("同一个对象无法重复设置到数据库中!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
@ -404,6 +404,7 @@ export class CADFile
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Factory
|
|
|
|
|
export class CreateObjectData extends CADObject
|
|
|
|
|
{
|
|
|
|
|
private cadFile: CADFile;
|
|
|
|
@ -442,6 +443,8 @@ export class CreateObjectData extends CADObject
|
|
|
|
|
{ }
|
|
|
|
|
//#endregion -----------------------------File End-----------------------------
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Factory
|
|
|
|
|
export class RemoveObjectData extends CADObject
|
|
|
|
|
{
|
|
|
|
|
private index: number;
|
|
|
|
@ -476,6 +479,7 @@ export class RemoveObjectData extends CADObject
|
|
|
|
|
//#endregion -----------------------------File End-----------------------------
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Factory
|
|
|
|
|
export class AllObjectData extends CADObject
|
|
|
|
|
{
|
|
|
|
|
file: CADFile;
|
|
|
|
@ -513,6 +517,7 @@ export class AllObjectData extends CADObject
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//对象集合.
|
|
|
|
|
@Factory
|
|
|
|
|
export class ObjectCollection<T> extends CADObject
|
|
|
|
|
{
|
|
|
|
|
objectCol: CADObject[] = [];
|
|
|
|
@ -600,6 +605,7 @@ export class ObjectCollection<T> extends CADObject
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//命令历史记录集合
|
|
|
|
|
@Factory
|
|
|
|
|
export class CommandHistoryRecord extends CADObject
|
|
|
|
|
{
|
|
|
|
|
constructor(cmdName?: string)
|
|
|
|
@ -716,6 +722,7 @@ export class CommandHistoryRecord extends CADObject
|
|
|
|
|
* @class HistoricRecord
|
|
|
|
|
* @extends {CADObject}
|
|
|
|
|
*/
|
|
|
|
|
@Factory
|
|
|
|
|
export class HistorycRecord extends CADObject
|
|
|
|
|
{
|
|
|
|
|
//指定撤销时所需要的数据
|
|
|
|
@ -747,7 +754,7 @@ export class HistorycRecord extends CADObject
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Factory
|
|
|
|
|
export class ObjectAllDataHistoryRecord extends HistorycRecord
|
|
|
|
|
{
|
|
|
|
|
obj: CADObject;
|
|
|
|
@ -772,6 +779,7 @@ export class ObjectAllDataHistoryRecord extends HistorycRecord
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//历史记录管理
|
|
|
|
|
@Factory
|
|
|
|
|
export class HistoricManage extends CADObject
|
|
|
|
|
{
|
|
|
|
|
curIndex: number = -1; //当前执行位置,也就是当前的状态, undo时,撤销当前状态,redo时,应用下一个状态
|
|
|
|
@ -888,7 +896,7 @@ export class HistoricManage extends CADObject
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Factory
|
|
|
|
|
export class Database
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
@ -959,7 +967,7 @@ export class Database
|
|
|
|
|
this.idMap.set(index, id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Factory
|
|
|
|
|
export class BlockTableRecord extends ObjectCollection<Entity>
|
|
|
|
|
{
|
|
|
|
|
constructor()
|
|
|
|
@ -987,11 +995,13 @@ export class BlockTableRecord extends ObjectCollection<Entity>
|
|
|
|
|
//#endregion-----------------------------File End-----------------------------
|
|
|
|
|
}
|
|
|
|
|
//所有图元的基类
|
|
|
|
|
@Factory
|
|
|
|
|
export class Entity extends CADObject
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//直线对象
|
|
|
|
|
@Factory
|
|
|
|
|
export class Line extends Entity
|
|
|
|
|
{
|
|
|
|
|
private startPoint: Vector3;
|
|
|
|
@ -1050,13 +1060,3 @@ export class Line extends Entity
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CADFactory.RegisterObject(Line);
|
|
|
|
|
CADFactory.RegisterObject(BlockTableRecord);
|
|
|
|
|
CADFactory.RegisterObject(CommandHistoryRecord);
|
|
|
|
|
CADFactory.RegisterObject(HistorycRecord);
|
|
|
|
|
CADFactory.RegisterObject(ObjectAllDataHistoryRecord);
|
|
|
|
|
CADFactory.RegisterObject(AllObjectData);
|
|
|
|
|
CADFactory.RegisterObject(RemoveObjectData);
|
|
|
|
|
CADFactory.RegisterObject(CreateObjectData);
|
|
|
|
|
|
|
|
|
|