====== XModel ====== **//Inherited from//** [[class::domain::nitem|NItem]], **//Inherited by//** NULL **//Friend class//** ModelManager, **//Description//** XModel封装了一个完整模型的所有信息。一个模型主要包含三个层次的信息,第一个层次是装配信息,即零部件与零部件的装配关系,便于用户对整个模型的访问与管理;第二个层次是几何拓扑信息,一个零部件包含若干顶层几何体,而顶层几何体又分别包含若干下一级几何体(如体包含若干面,面包含若干边,边包含最多两个顶点);第三个层次是网格信息,模型的几何面在视图上都以离散的三角片(三角单元)表达,几何边在视图上以离散的线段(线单元)表达,几何顶点以离散的点(点单元)表达,在截面视图上,以离散的体单元表达截面细节。可参考[[http://xdoc.com/doku.php?id=reference:modeling|模型的结构示意图]]。 XModel与大多数其他数据对象不一样,它本身包含了若干对象管理器,包括部件管理器、几何管理器、节点管理器、网格管理器,在一个模型内,部件(包括装配体)、几何实体(体、线、面、点)、节点、网格都有各自唯一的ID,这些管理器不能被XDocument直接访问,因此访问节点、网格、几何实体与部件都首先需要访问XModel,然后再通过XModel提供的接口访问具体的数据对象。 XT从底层构建了undo、redo机制,这套机制对访问和修改数据对象做了区分,其中访问通过getItem接口完成,数据的改动可通过3个接口完成,其中createItem用于增加数据,removeItem用于删除数据,checkOutItem用于修改已有的数据。XModel内部数据的访问和改动也完全遵守这套机制,createNode、createPart、createElement、createGeometry用于增加数据,removeNode、removeElement、removePart、removeGeometry用于删除数据,checkOutNode、checkOutElement、checkOutPart、checkOutGeometry用于修改已有的数据。 为了更方便的访问遍历特定拓扑类型的几何,XModel在几何管理器中为每个拓扑类型都构建了一套哈希表,通过指定拓扑类型,XModel就可以直接绑定其相应的访问迭代器。 XModel可以为不同部件设置不同的角色,不同角色的部件被置于不同的装配树根节点下,装配树根节点在创建XModel对象时自动生成,它的ID为0,因此不能通过ModelCompoenentManager来访问它,只能通过getAssemblyRoot接口访问。目前部件支持Normal和Auxiliary两种角色。 **//Members//** * XBoundBox [[xmodel#m_dboundbox|m_dBoundBox]] * const XAssembly * [[xmodel#m_passemblyroot|m_pAssemblyRoot]] * const XAssembly * [[xmodel#m_pauxiliaryroot|m_pAuxiliaryRoot]] * XMemPool * [[xmodel#m_phashpool|m_pHashPool]] * XMemPool * [[xmodel#m_pgeneralpool|m_pGeneralPool]] * real [[xmodel#m_dtscale|m_dTScale]] * bool [[xmodel#m_bgldataready|m_bGLDataReady]] * bool [[xmodel#m_bvisible|m_bVisible]] * int [[xmodel#m_idomainhdlidbase|m_iDomainHdlIDBase]] * OpnRecorder * [[xmodel#m_precorder|m_pRecorder]] * NodeManager * [[xmodel#m_pnodemgr|m_pNodeMgr]] * ElementManager * [[xmodel#m_pelemmgr|m_pElemMgr]] * GeometryManager * [[xmodel#m_pelsetmgr|m_pElsetMgr]] * PartManager * [[xmodel#m_ppartmgr|m_pPartMgr]] * PartSnapshotManager * [[xmodel#m_ppssmgr|m_pPSSMgr]] **//Public interface//** * [[xmodel#xmodel1|XModel]](ulong mid) * [[xmodel#~xmodel|~XModel]]() * void [[xmodel#init|init]](OpnRecorder * rec = NULL) * const XPart * [[xmodel#getpart|getPart]](ulong id)const * XNode * [[xmodel#checkoutnode|checkOutNode]](const XNode * n) * XElement * [[xmodel#checkoutelement|checkOutElement]](const XElement * e) * XElement * [[xmodel#checkoutelement|checkOutElement]](ulong id) * XPart * [[xmodel#checkoutpart|checkOutPart]](ulong id) * XPart * [[xmodel#checkoutpart|checkOutPart]](const XPart * p) * void [[xmodel#bindpartsnapshotmanager|bindPartSnapshotManager]](PartSnapshotManager * pssMgr) * PartManager * [[xmodel#getpartmanager|getPartManager]]() * NodeManager * [[xmodel#getnodemanager|getNodeManager]]() * ElementManager * [[xmodel#getelemmanager|getElemManager]]() * GeometryManager * [[xmodel#getgeometrymanager|getGeometryManager]]() * const XAssembly * [[xmodel#getassemblyroot|getAssemblyRoot]]() const * const XAssembly * [[xmodel#getauxiliaryroot|getAuxiliaryRoot]]() const * const XGeometry * [[xmodel#getgeometry|getGeometry]](ulong id)const * XGeometry * [[xmodel#checkoutgeometry|checkOutGeometry]](ulong id) * XGeometry * [[xmodel#checkoutgeometry|checkOutGeometry]](const XGeometry *g) * const ElementSet * [[xmodel#getelementset|getElementSet]](ulong id)const * void [[xmodel#bindpartiterator|bindPartIterator]](HashIterator * pIter) const * void [[xmodel#bindnodeiterator|bindNodeIterator]](HashIterator * pIter)const * void [[xmodel#bindelementiterator|bindElementIterator]](HashIterator * pIter)const * void [[xmodel#bindgeometryiterator|bindGeometryIterator]](HashIterator * pIter)const * void [[xmodel#bindgeometryiterator|bindGeometryIterator]](HashIterator * pIter,TypeID gt)const * void [[xmodel#removegeometry|removeGeometry]](const XGeometry * g) * void [[xmodel#removeelementset|removeElementSet]](const ElementSet * es) * XGeometry * [[xmodel#creategeometry|createGeometry]](TypeID t,ulong id = 0,XGeometry * parent = 0) * ElementSet [[xmodel#*createelementset|*createElementSet]](int entitySize = 8,ulong id = 0) * XNode * [[xmodel#createnode|createNode]](const real * coord,ulong nid = 0) * XAssembly * [[xmodel#createassembly|createAssembly]](const char * name, ulong id, XAssembly * parent, bool bAuxiliary = false) * XPart * [[xmodel#createpart|createPart]](const char * name, ulong id, XAssembly * parent, bool bAuxiliary = false) * void [[xmodel#removenode|removeNode]](const XNode * pNode) * void [[xmodel#movenode|moveNode]](const XNode * n, const real * coord) * NodePtr [[xmodel#getnode|getNode]](ulong id) const * XElement * [[xmodel#createelement|createElement]](TypeID et, const NodePtr* pNodes,ulong eid = 0,XGeometry * entity = 0, bool bUpdateNodeElemLink = true) * void [[xmodel#removeelement|removeElement]](XElement * pElement, bool bDeleteFreeNode = true) * void [[xmodel#replaceelemnode|replaceElemNode]](XElement* pElem,const XNode * old, const XNode * new_node,bool notDetachOld = false) * void [[xmodel#resetelemnodes|resetElemNodes]](XElement* pElem,const XNode ** ns) * void [[xmodel#setelemnode|setElemNode]](XElement* pElem,int index, const XNode * new_node) * void [[xmodel#updatenodeelementlink|updateNodeElementLink]](bool bKeepOld) * void [[xmodel#updatenodeelementlink|updateNodeElementLink]](vector * parts, bool bKeepOld) * void [[xmodel#updatenodeelementlink|updateNodeElementLink]](vector * geoms, bool bKeepOld) * void [[xmodel#addcellfacet|addCellFacet]](ElemPtr pFacet, XElement * cell) * void [[xmodel#removecellfacet|removeCellFacet]](ElemPtr facet, XElement * cell) * void [[xmodel#setpolylinenodes|setPolylineNodes]](const XNode ** ns, int cnt, XElement* pElem) * void [[xmodel#setpolygonnodes|setPolygonNodes]](const XNode ** ns, int cnt, XElement* pElem) * void [[xmodel#setcellfacets|setCellFacets]](const XElement ** facets, int cnt, XElement* pElem) * ElemPtr [[xmodel#getelement|getElement]](ulong id) const * void [[xmodel#removepart|removePart]](const XPart * pPart) * int [[xmodel#getpartcount|getPartCount]](bool bExcludeAsb = true) const * int [[xmodel#getelementcount|getElementCount]]()const * int [[xmodel#getnodecount|getNodeCount]]()const * int [[xmodel#getsurfaceelementcount|getSurfaceElementCount]]()const * int [[xmodel#getgeometrycount|getGeometryCount]](TypeID gt)const * int [[xmodel#getgeometrycount|getGeometryCount]]() const * int [[xmodel#getelementsetcount|getElementSetCount]]()const * void [[xmodel#attachelemtogeom|attachElemToGeom]](XGeometry * g, XElement * el) * void [[xmodel#detachelemfromgeom|detachElemFromGeom]](XGeometry * g, XElement * el) * void [[xmodel#attachparttoassembly|attachPartToAssembly]](XAssembly * asb, XPart * p) * void [[xmodel#detachpartfromassembly|detachPartFromAssembly]](XAssembly * asb, XPart * p) * void [[xmodel#attachpartsnapshot|attachPartSnapshot]](XPart * p, XPartSnapshot * asb) * void [[xmodel#detachpartsnapshot|detachPartSnapshot]](XPart * p, XPartSnapshot * asb) * void [[xmodel#attachgeomtopart|attachGeomToPart]](XGeometry * g, XPart * p) * void [[xmodel#detachgeomfrompart|detachGeomFromPart]](XGeometry * g, XPart * p) * void [[xmodel#attachgeomchild|attachGeomChild]](XGeometry * g, const XGeometry * child) * void [[xmodel#detachgeomchild|detachGeomChild]](XGeometry * g, const XGeometry * child) * void [[xmodel#clear|clear]]() * void [[xmodel#clearviewdata|clearViewData]]() * void [[xmodel#updateviewdata|updateViewData]]() * bool [[xmodel#isviewdataready|isViewDataReady]]() const * ulong [[xmodel#getnextgeometryid|getNextGeometryId]]() * ulong [[xmodel#getnextelementid|getNextElementId]]() * ulong [[xmodel#getnextnodeid|getNextNodeId]]() * const XBoundBox & [[xmodel#getboundbox|getBoundBox]]() const * void [[xmodel#normalizeboundbox|normalizeBoundBox]](const real * origin, real scale) * void [[xmodel#restoreboundbox|restoreBoundBox]](const real * origin, real scale) * void [[xmodel#updateboundbox|updateBoundBox]]() * void [[xmodel#setpartvisible|setPartVisible]](ulong id,bool bVisible) * void [[xmodel#setgeomvisible|setGeomVisible]](ulong id, bool bVisible) * XVertex* [[xmodel#getvertexbynode|getVertexByNode]](XNode * pNode) * void [[xmodel#createdefaultpart|createDefaultPart]]() * void [[xmodel#write|write]](XBinaryIO * io) const * void [[xmodel#writeforpost|writeForPost]](XBinaryIO * io) const * void [[xmodel#save|save]](const char * fname) const * bool [[xmodel#load|load]](const char * fname) * void [[xmodel#saveh5|saveH5]](const char * fname) const * bool [[xmodel#loadh5|loadH5]](const char * fname) * ErrorCode [[xmodel#read|read]](XBinaryIO * io) * ErrorCode [[xmodel#readforpost|readForPost]](XBinaryIO * io) * void [[xmodel#write|write]](XH5IO * io, H5Obj * grp) const * bool [[xmodel#read|read]](XH5IO * io, H5Obj * grp) * void [[xmodel#copy|copy]](XModel * mdl) * bool [[xmodel#isvisible|isVisible]]() const * void [[xmodel#setvisible|setVisible]](bool b) * void [[xmodel#updateafterrenumber|updateAfterRenumber]](TypeID tid) * void [[xmodel#setgldataready|setGLDataReady]](bool bReady) * real [[xmodel#getnormalizedscale|getNormalizedScale]]() * void [[xmodel#setnormalizedscale|setNormalizedScale]](real s) * OpnRecorder * [[xmodel#getrecorder|getRecorder]]() * void [[xmodel#updatefacecolorbypart|updateFaceColorByPart]](const XPart * p) * void [[xmodel#setgeomvisible|setGeomVisible]](const XGeometry * g, bool bVisible) **//Private interface//** * void [[xmodel#writenodes|writeNodes]](XBinaryIO * io) const * ErrorCode [[xmodel#readnodes|readNodes]](XBinaryIO * io,int cnt) * void [[xmodel#writeelements|writeElements]](XBinaryIO * io) const * ErrorCode [[xmodel#readelements|readElements]](XBinaryIO * io) * void [[xmodel#writeassembly|writeAssembly]](XBinaryIO * io, TreeNode * pItem = 0) const * ErrorCode [[xmodel#readassembly|readAssembly]](XBinaryIO * io, TreeNode * pItem = 0) * void [[xmodel#writenodesforpost|writeNodesForPost]](XBinaryIO * io) const * ErrorCode [[xmodel#readnodesforpost|readNodesForPost]](XBinaryIO * io,int cnt) * void [[xmodel#writeelementsforpost|writeElementsForPost]](XBinaryIO * io) const * ErrorCode [[xmodel#readelementsforpost|readElementsForPost]](XBinaryIO * io) ---- {{anchor:m_dboundbox}} **XBoundBox m_dBoundBox** 模型的包围盒 {{anchor:m_passemblyroot}} **const XAssembly * m_pAssemblyRoot** 模型装配树根节点 {{anchor:m_pauxiliaryroot}} **const XAssembly * m_pAuxiliaryRoot** 模型辅助树根节点 {{anchor:m_phashpool}} **XMemPool * m_pHashPool** 模型哈希内存池,被模型内部的各种管理器共享使用 {{anchor:m_pgeneralpool}} **XMemPool * m_pGeneralPool** 模型通用内存池 {{anchor:m_dtscale}} **real m_dTScale** 模型特征尺度,近似等于模型包围盒的最大尺寸,在很多计算的场合用于将坐标归一化处理 {{anchor:m_bgldataready}} **bool m_bGLDataReady** 模型视图数据是否构建好的标志 {{anchor:m_bvisible}} **bool m_bVisible** 模型是否可见 {{anchor:m_idomainhdlidbase}} **int m_iDomainHdlIDBase** 模型的起始域ID,由于模型内部的管理器并不是单一管理器,在需要undo、redo的场合,以该ID索引模型内部对象数据的变动。 {{anchor:m_precorder}} **OpnRecorder * m_pRecorder** 模型数据操作记录器 {{anchor:m_pnodemgr}} **NodeManager * m_pNodeMgr** 模型节点管理器,由模型构建,非单一管理器 {{anchor:m_pelemmgr}} **ElementManager * m_pElemMgr** 模型单元管理器,由模型构建,非单一管理器 {{anchor:m_pelsetmgr}} **GeometryManager * m_pElsetMgr** 模型几何管理器,由模型构建,非单一管理器 {{anchor:m_ppartmgr}} **PartManager * m_pPartMgr** 模型部件管理器,由模型构建,非单一管理器 {{anchor:m_ppssmgr}} **PartSnapshotManager * m_pPSSMgr** 部件快照管理器,单一管理器,外部构建 ---- {{anchor:xmodel1}} **XModel(ulong mid)** *function: 构造函数 *parameters: - [i]ulong mid: 模型ID *return value: 无 {{anchor:~xmodel}} **~XModel()** *function: 析构函数 *parameters: NULL *return value: 无 {{anchor:init}} **void init(OpnRecorder * rec = NULL)** *function: 初始化模型的域ID,以支持undo、redo操作。构建模型后必须显示调用。 *parameters: - [i]OpnRecorder * rec = NULL: 模型数据操作记录器,可为空(此时undo、redo将不被支持,可提高执行效率) *return value: 无 {{anchor:getpart}} **const XPart * getPart(ulong id)const ** *function: 访问模型部件 *parameters: - [i]ulong id: 部件ID *return value: 模型部件指针 {{anchor:checkoutnode}} **XNode * checkOutNode(const XNode * n) ** *function: 以可修改的模式访问模型节点 *parameters: - [i]const XNode * n: 节点常指针(不可修改) *return value: 节点指针(可修改) {{anchor:checkoutelement}} **XElement * checkOutElement(const XElement * e) ** *function: 以可修改的模式访问模型单元 *parameters: - [i]const XElement * e: 单元常指针(不可修改) *return value: 单元指针(可修改) {{anchor:checkoutelement}} **XElement * checkOutElement(ulong id)** *function: 以可修改的模式访问模型单元 *parameters: - [i]ulong id: 单元ID *return value: 单元指针(可修改) {{anchor:checkoutpart}} **XPart * checkOutPart(ulong id) ** *function: 以可修改的模式访问模型部件 *parameters: - [i]ulong id: 部件ID *return value: 部件指针(可修改) {{anchor:checkoutpart}} **XPart * checkOutPart(const XPart * p) ** *function: 以可修改的模式访问模型节点 *parameters: - [i]const XPart * p: 节点常指针(不可修改) *return value: 节点指针(可修改) {{anchor:bindpartsnapshotmanager}} **void bindPartSnapshotManager(PartSnapshotManager * pssMgr)** *function: 绑定部件快照管理器,用于在某些场景下构建部件快照 *parameters: - [i]PartSnapshotManager * pssMgr: 部件快照管理器 *return value: 无 {{anchor:getpartmanager}} **PartManager * getPartManager()** *function: 获取模型部件管理器 *parameters: NULL *return value: 模型部件管理器 {{anchor:getnodemanager}} **NodeManager * getNodeManager()** *function: 获取模型节点管理器 *parameters: NULL *return value: {{anchor:getelemmanager}} **ElementManager * getElemManager()** *function: 获取模型单元管理器 *parameters: NULL *return value: {{anchor:getgeometrymanager}} **GeometryManager * getGeometryManager()** *function: 获取模型几何管理器 *parameters: NULL *return value: {{anchor:getassemblyroot}} **const XAssembly * getAssemblyRoot() const** *function: 获取模型装配树根节点 *parameters: NULL *return value: 模型装配树根节点 {{anchor:getauxiliaryroot}} **const XAssembly * getAuxiliaryRoot() const** *function: 获取模型辅助树根节点 *parameters: NULL *return value: 模型辅助树根节点 {{anchor:getgeometry}} **const XGeometry * getGeometry(ulong id)const ** *function: 访问模型几何 *parameters: - [i]ulong id: 模型几何ID *return value: 模型几何指针(不可修改) {{anchor:checkoutgeometry}} **XGeometry * checkOutGeometry(ulong id) ** *function: 以可修改的模式访问模型几何 *parameters: - [i]ulong id: 模型几何ID *return value: 模型几何指针(可修改) {{anchor:checkoutgeometry}} **XGeometry * checkOutGeometry(const XGeometry *g) ** *function: 以可修改的模式访问模型几何 *parameters: - [i]const XGeometry *g: 模型几何指针(不可修改) *return value: 模型几何指针(可修改) {{anchor:bindpartiterator}} **void bindPartIterator(HashIterator * pIter) const** *function: 绑定模型部件遍历迭代器 *parameters: - [i]HashIterator * pIter: 部件遍历迭代器 *return value: 无 {{anchor:bindnodeiterator}} **void bindNodeIterator(HashIterator * pIter)const** *function: 绑定模型节点遍历迭代器 *parameters: - [i]HashIterator * pIter: 节点遍历迭代器 *return value: 无 {{anchor:bindelementiterator}} **void bindElementIterator(HashIterator * pIter)const** *function: 绑定模型单元遍历迭代器 *parameters: - [i]HashIterator * pIter: 单元遍历迭代器 *return value: 无 {{anchor:bindgeometryiterator}} **void bindGeometryIterator(HashIterator * pIter)const** *function: 绑定模型几何遍历迭代器 *parameters: - [i]HashIterator * pIter: 几何遍历迭代器 *return value: 无 {{anchor:bindgeometryiterator}} **void bindGeometryIterator(HashIterator * pIter,TypeID gt)const** *function: 指定拓扑类型绑定模型几何遍历迭代器,只有拓扑类型一致的几何会被遍历到 *parameters: - [i]HashIterator * pIter: 指定拓扑类型的遍历迭代器 - [i]TypeID gt: 拓扑类型 *return value: 无 {{anchor:removegeometry}} **void removeGeometry(const XGeometry * g)** *function: 删除模型几何对象 *parameters: - [i]const XGeometry * g: 模型几何对象 *return value: 无 {{anchor:creategeometry}} **XGeometry * createGeometry(TypeID t,ulong id = 0,XGeometry * parent = 0)** *function: 创建模型几何对象 *parameters: - [i]TypeID t: 拓扑类型 - [i]ulong id = 0: 几何ID,为0时将使用管理器记录的NextID - [i]XGeometry * parent = 0: 父拓扑 *return value: 模型几何对象 {{anchor:createnode}} **XNode * createNode(const real * coord,ulong nid = 0)** *function: 创建模型节点 *parameters: - [i]const real * coord: 节点坐标 - [i]ulong nid = 0: 节点ID,为0时将使用管理器记录的NextID *return value: 模型节点对象指针 {{anchor:createassembly}} **XAssembly * createAssembly(const char * name, ulong id, XAssembly * parent, bool bAuxiliary = false)** *function: 创建模型装配体 *parameters: - [i]const char * name: 装配体名字 - [i] ulong id: 装配体ID,为0时将使用部件管理器记录的NextID - [i] XAssembly * parent: 父装配体 - [i] bool bAuxiliary = false: 是否为辅助对象,默认否 *return value: 装配体对象指针 {{anchor:createpart}} **XPart * createPart(const char * name, ulong id, XAssembly * parent, bool bAuxiliary = false)** *function: 创建模型部件对象 *parameters: - [i]const char * name: 部件名字 - [i] ulong id: 部件ID,为0时将使用部件管理器记录的NextID - [i] XAssembly * parent: 父装配体,为空时父装配体自动被设置为相应的根节点 - [i] bool bAuxiliary = false: 是否为辅助对象,默认否 *return value: 模型部件对象指针 {{anchor:removenode}} **void removeNode(const XNode * pNode)** *function: 删除模型节点 *parameters: - [i]const XNode * pNode: 模型节点 *return value: 无 {{anchor:movenode}} **void moveNode(const XNode * n, const real * coord)** *function: 移动模型节点到新位置(自动更新与节点相关的视图数据) *parameters: - [i]const XNode * n: 模型节点 - [i] const real * coord: 新的坐标 *return value: 无 {{anchor:getnode}} **NodePtr getNode(ulong id) const** *function: 访问模型节点 *parameters: - [i]ulong id: 模型节点ID *return value: 模型节点指针(不可修改) {{anchor:createelement}} **XElement * createElement(TypeID et, const NodePtr* pNodes,ulong eid = 0,XGeometry * entity = 0, bool bUpdateNodeElemLink = true)** *function: 创建模型单元对象 *parameters: - [i]TypeID et: 单元类型 - [i] const NodePtr* pNodes: 单元节点指针数组 - [i]ulong eid = 0: 单元ID,为0时将使用单元管理器记录的NextID - [i]XGeometry * entity = 0: 单元所属几何对象 - [i] bool bUpdateNodeElemLink = true: 是否更新节点的单元链接表 *return value: 模型单元对象指针 {{anchor:removeelement}} **void removeElement(XElement * pElement, bool bDeleteFreeNode = true)** *function: 删除模型单元 *parameters: - [i]XElement * pElement: 单元指针 - [i] bool bDeleteFreeNode = true: 是否删除自由节点(节点的单元链接表为空) *return value: 无 {{anchor:replaceelemnode}} **void replaceElemNode(XElement* pElem,const XNode * old, const XNode * new_node,bool notDetachOld = false)** *function: 替换单元节点 *parameters: - [i]XElement* pElem: 单元指针 - [i]const XNode * old: 被替换的单元节点 - [i] const XNode * new_node: 替换后的单元节点 - [i]bool notDetachOld = false: 是否不解除替换前的节点单元绑定关系,默认解除 *return value: 无 {{anchor:resetelemnodes}} **void resetElemNodes(XElement* pElem,const XNode ** ns)** *function: 重置单元节点 *parameters: - [i]XElement* pElem: 单元指针 - [i]const XNode ** ns: 单元节点数组 *return value: 无 {{anchor:setelemnode}} **void setElemNode(XElement* pElem,int index, const XNode * new_node)** *function: 设置单元节点 *parameters: - [i]XElement* pElem: 单元指针 - [i]int index: 节点序号 - [i] const XNode * new_node: 单元节点指针 *return value: 无 {{anchor:updatenodeelementlink}} **void updateNodeElementLink(bool bKeepOld)** *function: 更新节点的单元链接表 *parameters: - [i]bool bKeepOld: 是否保持已有的单元链接表而不是完全重建 *return value: 无 {{anchor:updatenodeelementlink}} **void updateNodeElementLink(vector * parts, bool bKeepOld)** *function: 更新指定部件数组内节点的单元链接表 *parameters: - [i]vector * parts: 指定部件数组 - [i] bool bKeepOld: 是否保持已有的单元链接表而不是完全重建 *return value: 无 {{anchor:updatenodeelementlink}} **void updateNodeElementLink(vector * geoms, bool bKeepOld)** *function: 更新指定几何数组内节点的单元链接表 *parameters: - [i]vector * geoms: 指定几何数组 - [i] bool bKeepOld: 是否保持已有的单元链接表而不是完全重建 *return value: 无 {{anchor:addcellfacet}} **void addCellFacet(ElemPtr pFacet, XElement * cell)** *function: 为cell单元添加面单元(有限体积法中使用) *parameters: - [i]ElemPtr pFacet: 面单元(一般为Polygon或者Polyline单元) - [i] XElement * cell: Cell单元 *return value: 无 {{anchor:removecellfacet}} **void removeCellFacet(ElemPtr facet, XElement * cell)** *function: 删除Cell单元的面 *parameters: - [i]ElemPtr facet: Cell面单元(一般为Polygon或者Polyline单元) - [i] XElement * cell: Cell单元 *return value: 无 {{anchor:setpolylinenodes}} **void setPolylineNodes(const XNode ** ns, int cnt, XElement* pElem)** *function: 设置多折线单元的节点 *parameters: - [i]const XNode ** ns: 节点数组 - [i] int cnt: 节点个数 - [i] XElement* pElem:多折线单元指针 *return value: 无 {{anchor:setpolygonnodes}} **void setPolygonNodes(const XNode ** ns, int cnt, XElement* pElem)** *function: 设置多边形单元的节点 *parameters: - [i]const XNode ** ns: 节点数组 - [i] int cnt: 节点个数 - [i] XElement* pElem: 多边形单元指针 *return value: 无 {{anchor:setcellfacets}} **void setCellFacets(const XElement ** facets, int cnt, XElement* pElem)** *function: 设置Cell单元的面信息 *parameters: - [i]const XElement ** facets: Cell单元面数组 - [i] int cnt: 面的个数 - [i] XElement* pElem: Cell单元数组 *return value: 无 {{anchor:getelement}} **ElemPtr getElement(ulong id) const** *function: 访问模型单元 *parameters: - [i]ulong id: 单元ID *return value: 模型单元指针(不可修改) {{anchor:removepart}} **void removePart(const XPart * pPart)** *function: 删除模型部件 *parameters: - [i]const XPart * pPart: 模型部件指针 *return value: 无 {{anchor:getpartcount}} **int getPartCount(bool bExcludeAsb = true) const** *function: 获取模型部件个数 *parameters: - [i]bool bExcludeAsb = true: 是否包含装配体 *return value: 模型部件个数 {{anchor:getelementcount}} **int getElementCount()const** *function: 获取模型单元个数 *parameters: NULL *return value: 模型单元个数 {{anchor:getnodecount}} **int getNodeCount()const** *function: 获取模型节点个数 *parameters: NULL *return value: 模型节点个数 {{anchor:getsurfaceelementcount}} **int getSurfaceElementCount()const** *function: 获取模型面单元个数 *parameters: NULL *return value: 模型面单元个数 {{anchor:getgeometrycount}} **int getGeometryCount(TypeID gt)const** *function: 获取指定拓扑类型的模型几何对象个数 *parameters: - [i]TypeID gt: 拓扑类型 *return value: 模型几何对象个数 {{anchor:getgeometrycount}} **int getGeometryCount() const** *function: 获取全部模型几何对象个数 *parameters: NULL *return value: 全部模型几何对象个数 {{anchor:attachelemtogeom}} **void attachElemToGeom(XGeometry * g, XElement * el)** *function: 绑定几何对象与单元对象的从属关系 *parameters: - [i]XGeometry * g: 模型几何对象 - [i] XElement * el: 模型单元对象 *return value: 无 {{anchor:detachelemfromgeom}} **void detachElemFromGeom(XGeometry * g, XElement * el)** *function: 解除几何对象与单元对象的从属关系 *parameters: - [i]XGeometry * g: 模型几何对象 - [i] XElement * el: 模型单元对象 *return value: 无 {{anchor:attachparttoassembly}} **void attachPartToAssembly(XAssembly * asb, XPart * p)** *function: 绑定装配体与部件的从属关系 *parameters: - [i]XAssembly * asb: 模型装配体对象 - [i] XPart * p: 模型部件对象 *return value: 无 {{anchor:detachpartfromassembly}} **void detachPartFromAssembly(XAssembly * asb, XPart * p)** *function: 解除装配体与部件的从属关系 *parameters: - [i]XAssembly * asb: 模型装配体对象 - [i] XPart * p: 模型部件对象 *return value: 无 {{anchor:attachpartsnapshot}} **void attachPartSnapshot(XPart * p, XPartSnapshot * asb)** *function: 绑定部件与部件快照对象的从属关系 *parameters: - [i]XPart * p: 模型部件对象 - [i] XPartSnapshot * asb: 部件快照对象 *return value: 无 {{anchor:detachpartsnapshot}} **void detachPartSnapshot(XPart * p, XPartSnapshot * asb)** *function: 解除部件与部件快照对象的从属关系 *parameters: - [i]XPart * p: 模型部件对象 - [i] XPartSnapshot * asb: 部件快照对象 *return value: 无 {{anchor:attachgeomtopart}} **void attachGeomToPart(XGeometry * g, XPart * p)** *function: 绑定几何对象与部件对象的从属关系 *parameters: - [i]XGeometry * g: 模型几何对象 - [i] XPart * p: 模型部件对象 *return value: 无 {{anchor:detachgeomfrompart}} **void detachGeomFromPart(XGeometry * g, XPart * p)** *function: 解除几何对象与部件对象的从属关系 *parameters: - [i]XGeometry * g: 模型几何对象 - [i] XPart * p: 模型部件对象 *return value: 无 {{anchor:attachgeomchild}} **void attachGeomChild(XGeometry * g, const XGeometry * child)** *function: 绑定几何对象的拓扑从属关系 *parameters: - [i]XGeometry * g: 模型几何父对象 - [i] const XGeometry * child: 模型几何子对象 *return value: 无 {{anchor:detachgeomchild}} **void detachGeomChild(XGeometry * g, const XGeometry * child)** *function: 解除几何对象的拓扑从属关系 *parameters: - [i]XGeometry * g: 模型几何父对象 - [i] const XGeometry * child: 模型几何子对象 *return value: 无 {{anchor:clear}} **void clear()** *function: 清空模型并重置模型为初始状态 *parameters: NULL *return value: 无 {{anchor:clearviewdata}} **void clearViewData()** *function: 清空模型视图数据 *parameters: NULL *return value: 无 {{anchor:updateviewdata}} **void updateViewData()** *function: 更新构建模型视图数据 *parameters: NULL *return value: 无 {{anchor:isviewdataready}} **bool isViewDataReady() const** *function: 判断模型视图数据是否已准备好 *parameters: NULL *return value: 如已准备好返回true,否则返回false {{anchor:getnextgeometryid}} **ulong getNextGeometryId()** *function: 获取模型几何对象下一个可用的ID *parameters: NULL *return value: 模型几何对象下一个可用的ID {{anchor:getnextelementid}} **ulong getNextElementId()** *function: 获取模型单元对象下一个可用的ID *parameters: NULL *return value: 模型单元对象下一个可用的ID {{anchor:getnextnodeid}} **ulong getNextNodeId()** *function: 获取模型节点对象下一个可用的ID *parameters: NULL *return value: 模型节点对象下一个可用的ID {{anchor:getboundbox}} **const XBoundBox & getBoundBox() const** *function: 获取模型的包围盒 *parameters: NULL *return value: 模型的包围盒 {{anchor:normalizeboundbox}} **void normalizeBoundBox(const real * origin, real scale)** *function: 归一化模型包围盒 *parameters: - [i]const real * origin: 归一化基准点 - [i] real scale: 归一化系数 *return value: 无 {{anchor:restoreboundbox}} **void restoreBoundBox(const real * origin, real scale)** *function: 恢复模型包围盒(一般在归一化完成计算之后调用) *parameters: - [i]const real * origin: 归一化基准点 - [i] real scale: 归一化系数 *return value: 无 {{anchor:updateboundbox}} **void updateBoundBox()** *function: 更新模型包围盒 *parameters: NULL *return value: 无 {{anchor:setpartvisible}} **void setPartVisible(ulong id,bool bVisible)** *function: 设置部件的可见性 *parameters: - [i]ulong id: 部件ID - [i]bool bVisible: 是否可见 *return value: 无 {{anchor:setgeomvisible}} **void setGeomVisible(ulong id, bool bVisible)** *function: 设置几何对象的可见性 *parameters: - [i]ulong id: 几何对象ID - [i] bool bVisible: 是否可见 *return value: 无 {{anchor:getvertexbynode}} **XVertex* getVertexByNode(XNode * pNode)** *function: 获取节点上的几何顶点对象 *parameters: - [i]XNode * pNode: 模型节点对象 *return value: 如节点上由几何顶点存在,返回该几何对象,否则返回空 {{anchor:createdefaultpart}} **void createDefaultPart()** *function: 构建默认的模型部件,一般在导入网格(网格数据没有部件装配关系)后使用 *parameters: NULL *return value: 无 {{anchor:write}} **void write(XBinaryIO * io) const** *function: 将模型数据写入到二进制文件中 *parameters: - [i]XBinaryIO * io: 二进制文件句柄 *return value: {{anchor:save}} **void save(const char * fname) const** *function: 将模型数据保存到文件中 *parameters: - [i]const char * fname: 文件路径 *return value: 无 {{anchor:load}} **bool load(const char * fname)** *function: 从文件中载入模型数据 *parameters: - [i]const char * fname: 文件路径 *return value: 成功载入返回true,否则返回false {{anchor:saveh5}} **void saveH5(const char * fname) const** *function: 将模型数据保存到HDF5文件中 *parameters: - [i]const char * fname: HDF5文件路径 *return value: 无 {{anchor:loadh5}} **bool loadH5(const char * fname)** *function: 从HDF5文件中载入模型数据 *parameters: - [i]const char * fname: HDF5文件路径 *return value: 成功载入返回true,否则返回false {{anchor:read}} **ErrorCode read(XBinaryIO * io)** *function: 从二进制文件中读取模型数据 *parameters: - [i]XBinaryIO * io: 二进制文件句柄 *return value: 成功读取返回Error_None,否则返回相应错误码 {{anchor:write}} **void write(XH5IO * io, H5Obj * grp) const** *function: 将模型数据写入到HDF5文件中 *parameters: - [i]XH5IO * io: 二进制文件句柄 - [i] H5Obj * grp: 对应的HDF5节点 *return value: 无 {{anchor:read}} **bool read(XH5IO * io, H5Obj * grp)** *function: 从HDF5文件中读取模型数据 *parameters: - [i]XH5IO * io: HDF5文件句柄 - [i] H5Obj * grp: 对应的HDF5节点 *return value: 成功读取返回true,否则返回false {{anchor:copy}} **void copy(XModel * mdl)** *function: 将另外一个模型的数据复制到本模型中 *parameters: - [i]XModel * mdl: 被复制的模型对象 *return value: 无 {{anchor:isvisible}} **bool isVisible() const** *function: 模型是否可见 *parameters: NULL *return value: 模型可见返回true,否则返回false {{anchor:setvisible}} **void setVisible(bool b)** *function: 设置模型的可见性 *parameters: - [i]bool b: 是否可见 *return value: 无 {{anchor:updateafterrenumber}} **void updateAfterRenumber(TypeID tid)** *function: 在对模型对象重编号之后调用,用以更新对重编号对象的引用 *parameters: - [i]TypeID tid: 重编号的对象类型 *return value: {{anchor:setgldataready}} **void setGLDataReady(bool bReady)** *function: 设置模型视图数据是否准备完毕 *parameters: - [i]bool bReady: 模型视图数据是否准备完成 *return value: 无 {{anchor:getnormalizedscale}} **real getNormalizedScale()** *function: 获取模型归一化系数 *parameters: NULL *return value: 模型归一化系数 {{anchor:setnormalizedscale}} **void setNormalizedScale(real s)** *function: 设置模型归一化系数 *parameters: - [i]real s: 模型归一化系数 *return value: 无 {{anchor:getrecorder}} **OpnRecorder * getRecorder()** *function: 获取模型数据操作记录器 *parameters: NULL *return value: 模型数据操作记录器 {{anchor:updatefacecolorbypart}} **void updateFaceColorByPart(const XPart * p)** *function: 根据所属部件更新面的颜色 *parameters: - [i]const XPart * p: 模型部件对象 *return value:无 {{anchor:setgeomvisible}} **void setGeomVisible(const XGeometry * g, bool bVisible)** *function: 设置几何可见性 *parameters: - [i]const XGeometry * g: 模型几何对象 - [i] bool bVisible: 是否可见 *return value: 无 ---- {{anchor:writenodes}} **void writeNodes(XBinaryIO * io) const** *function: 将模型节点数据写入到二进制文件中 *parameters: - [i]XBinaryIO * io: 二进制文件句柄 *return value: 无 {{anchor:readnodes}} **ErrorCode readNodes(XBinaryIO * io,int cnt)** *function: 从二进制文件中读取模型节点数据 *parameters: - [i]XBinaryIO * io: 二进制文件句柄 - [i]int cnt: 节点个数 *return value: 成功读取返回Error_None, 否则返回相应错误码 {{anchor:writeelements}} **void writeElements(XBinaryIO * io) const** *function: 将模型单元数据写入到二进制文件中 *parameters: - [i]XBinaryIO * io: 二进制文件句柄 *return value: 无 {{anchor:readelements}} **ErrorCode readElements(XBinaryIO * io)** *function: 从二进制文件中读取模型单元数据 *parameters: - [i]XBinaryIO * io: 二进制文件句柄 *return value: 成功读取返回Error_None, 否则返回相应错误码 {{anchor:writeassembly}} **void writeAssembly(XBinaryIO * io, TreeNode * pItem = 0) const** *function: 将装配体数据写入到二进制文件中 *parameters: - [i]XBinaryIO * io: 二进制文件句柄 - [i] TreeNode * pItem = 0: 装配体对应的树节点 *return value: 无 {{anchor:readassembly}} **ErrorCode readAssembly(XBinaryIO * io, TreeNode * pItem = 0)** *function: 从二进制文件中读取装配体 *parameters: - [i]XBinaryIO * io: 二进制文件句柄 - [i] TreeNode * pItem = 0: 装配体对应的树节点 *return value: 成功读取返回Error_None, 否则返回相应错误码