|
IMxDrawDatabase::ObjectIdToObject
实体id返回实体对象,具体详细如下:
参数 | 说明 | [in] LONGLONG lId | 实体id | JS代码中绘一个直线,得到直线id,再调该得到直线对象,然写扩展数据的例子。
- function DoCommandEventFunc(iCmd)
- {
- if (iCmd == 1)
- {
- var mxOcx = document.all.item("MxDrawXCtrl");
- mxOcx.focus();
- var point1 = mxOcx.GetPoint(null,"n 点取开始点:");
- if(point1 == null)
- {
- return;
- }
- var point2 = mxOcx.GetPoint(point1,"n 点取结束点:");
- if(point1 == null)
- {
- return;
- }
- // 直线的id
- var lineId = mxOcx.DrawLine(point1.x,point1.y,point2.x,point2.y);
-
- // 为新写的直线写一个字符串扩展数据
- var database = mxOcx.GetDatabase();
- var ent = database.ObjectIdToObject(lineId);
-
- if(ent == null)
- {
- return;
- }
- var exData = mxOcx.Call("Mx_NewResbuf","");
- exData.AddString("TestApp",1001);
- exData.AddString("用户的扩展数据内容。。。",1000);
- ent.SetXData(exData);
-
- }
- }
复制代码
|
|