修改objectid 文档

pull/7/head
ChenX 7 years ago
parent 52c9fc85ef
commit 42ea8edf4f

@ -233,20 +233,29 @@ class ObjectId
{
private id: number;
private obj: CADObject;
private constructor()
//对外隐藏构造函数,如果需要构造一个id,请使用 Create 静态方法.
private constructor(index: number = -1, obj?: CADObject)
{
this.id = -1;
this.id = index;
this.obj = obj;
}
//创建一个id, 如果db中已经存在id,那么自动获得该id,如果不存在,new一个新的id,并且加入到db中
/*
id, dbid,id,,newid,db
使:
1.db
2..
3.redo
4.
*/
static Create(db: Database, index: number): ObjectId
{
let id = db.GetObjectId(index);
if (!id)
{
id = new ObjectId();
id = new ObjectId(index);
db.SetObjectId(index, id);
id.id = index;
}
return id;
}
@ -616,13 +625,22 @@ class Database
console.warn("警告:对象不属于该数据库!");
}
}
//获得指定索引的id,注意该id可能为空,如果需要创建,请使用 ObjectId.Create 如果需要自动分配 请使用 AllocateId
/*
private , ObjectId使.
id, id, , 使 ObjectId.Create,,使,AllocateId
*/
GetObjectId(index: number): ObjectId
{
return this.idMap.get(index);
}
//在id池中加入新建的id. 该方法暴露给 Objectid.Cretes使用.
/*
private , ObjectId使.
idid. Objectid.Cretes使.
*/
SetObjectId(index: number, id: ObjectId)
{
if (this.idMap.has(index))

Loading…
Cancel
Save