====== XEdge ====== **//Inherited from//** [[class::domain::xgeometry|XGeometry]], **//Inherited by//** NULL **//Friend class//** GeometryManager, **//Description//** XEdge封装了几何边的数据及其方法,其类型标识名为“CGEOEDGE”(以CGEO为前缀)。几何边由线单元离散构成,在拓扑上一般最多包含2个顶点,也可能只包含一个顶点(闭合边),或者0个顶点(比如一个圆)。XEdge从XGeometry继承并重新实现了适用于边的方法。 **//Members//** * XBoundBox [[xedge#m_dboundbox|m_dBoundBox]] * const XVertex * [[xedge#m_pendvertex0|m_pEndVertex0]] * const XVertex * [[xedge#m_pendvertex1|m_pEndVertex1]] * const XNode * [[xedge#m_pfirstnode|m_pFirstNode]] * const XNode * [[xedge#m_plastnode|m_pLastNode]] * XMemPool * [[xedge#m_phashpool|m_pHashPool]] * XItemPtrArray [[xedge#m_upperlist|m_UpperList]] * XRenderData [[xedge#m_renderdata|m_RenderData]] * XRenderData [[xedge#m_elemencodedata|m_ElemEncodeData]] * RGBAColor [[xedge#m_bakcolor|m_BakColor]] **//Public interface//** * [[xedge#xedge1|XEdge]](ulong id,XMemPool * pHashPool = 0) * [[xedge#~xedge|~XEdge]]() * void [[xedge#updateboundbox|updateBoundbox]]() * real [[xedge#getlength|getLength]]() const * real [[xedge#getnorm2|getNorm2]]()const * bool [[xedge#isclosed|isClosed]]() const * const XVertex * [[xedge#getendvertex0|getEndVertex0]]() const * const XVertex * [[xedge#getendvertex1|getEndVertex1]]() const * ulong [[xedge#getendvertexid0|getEndVertexID0]]() const * ulong [[xedge#getendvertexid1|getEndVertexID1]]() const * const XNode * [[xedge#getendnode0|getEndNode0]]() const * const XNode * [[xedge#getendnode1|getEndNode1]]() const * const XGeometry * [[xedge#getupperentity|getUpperEntity]](int index) const * bool [[xedge#isupperentity|isUpperEntity]](const XGeometry * pFace)const * void [[xedge#addupperentity|addUpperEntity]](const XGeometry * pFace) * void [[xedge#removeupperentity|removeUpperEntity]](const XGeometry *pFace) * void [[xedge#buildrenderdata_withindex|buildRenderData_WithIndex]](const float * rvalue = NULL) * void [[xedge#buildrenderdatafvm|buildRenderDataFVM]]() * void [[xedge#buildrenderdata|buildRenderData]]() * void [[xedge#updaterenderdata|updateRenderData]](const float * colorValue, int colorLoc, const float * deformX, const float * deformY, const float * deformZ, const int * colorIndex = NULL) * const XRenderData * [[xedge#getrenderdata|getRenderData]]() const * void [[xedge#clear|clear]](ClearFlag f = Clear_All) * const XBoundBox & [[xedge#getboundbox|getBoundBox]]() const * void [[xedge#normalizeboundbox|normalizeBoundBox]](const real * origin, real scale) * void [[xedge#restoreboundbox|restoreBoundBox]](const real * origin, real scale) * void [[xedge#copyboundbox|copyBoundBox]](const XEdge * e) * ulong [[xedge#getchildcount|getChildCount]]() const * const XGeometry * [[xedge#getchildentity|getChildEntity]](ulong id)const * int [[xedge#getuppercount|getUpperCount]]() const * void [[xedge#write|write]](XBinaryIO * io)const * ErrorCode [[xedge#read|read]](GeometryManager * esmgr, XBinaryIO * io) * void [[xedge#updateafterrenumber|updateAfterRenumber]](TypeID tid = DItem_Element) * void [[xedge#backupcolor|backupColor]]() * void [[xedge#recovercolor|recoverColor]]() * void [[xedge#getcenter|getCenter]](real * c) const * bool [[xedge#isloop|isLoop]]() const **//Protected interface//** * void [[xedge#attachchildentity|attachChildEntity]](const XGeometry * pEntity) * void [[xedge#detachchildentity|detachChildEntity]](ulong id) * void [[xedge#setendvertex0|setEndVertex0]](const XVertex * pVertex) * void [[xedge#setendvertex1|setEndVertex1]](const XVertex * pVertex) **//Private interface//** * void [[xedge#buildglindex|buildGLIndex]]() * void [[xedge#buildvertex|buildVertex]]() ---- {{anchor:m_dboundbox}} **XBoundBox m_dBoundBox** 几何边的包围盒 {{anchor:m_pendvertex0}} **const XVertex * m_pEndVertex0** 几何边的第一个端顶点 {{anchor:m_pendvertex1}} **const XVertex * m_pEndVertex1** 几何边的第二个端顶点 {{anchor:m_pfirstnode}} **const XNode * m_pFirstNode** 几何边的第一个节点 {{anchor:m_plastnode}} **const XNode * m_pLastNode** 几何边的最后一个节点 {{anchor:m_phashpool}} **XMemPool * m_pHashPool** 几何边对象用到的内存池 {{anchor:m_upperlist}} **XItemPtrArray m_UpperList** 几何边的父拓扑对象数组 {{anchor:m_renderdata}} **XRenderData m_RenderData** 几何边的视图数据 {{anchor:m_bakcolor}} **RGBAColor m_BakColor** 几何边的颜色备份,用于修改颜色时保存旧的颜色以方便恢复之前的颜色。 ---- {{anchor:xedge1}} **XEdge(ulong id,XMemPool * pHashPool = 0)** *function: 构造函数 *parameters: - [i]ulong id: 对象ID - [i]XMemPool * pHashPool = 0: 内存池 *return value: 无 {{anchor:~xedge}} **~XEdge()** *function: 析构函数 *parameters: NULL *return value: 无 {{anchor:updateboundbox}} **void updateBoundbox()** *function: 更新几何边的包围盒 *parameters: NULL *return value: 无 {{anchor:getlength}} **real getLength() const** *function: 计算几何边的长度 *parameters: NULL *return value: 几何边的长度 {{anchor:getnorm2}} **real getNorm2()const** *function: 计算几何边的第二范数 *parameters: NULL *return value: 几何边的第二范数 {{anchor:isclosed}} **bool isClosed() const** *function: 判断几何边是否为闭合边 *parameters: NULL *return value: 几何边为闭合边时返回true,否则返回false {{anchor:getendvertex0}} **const XVertex * getEndVertex0() const** *function: 获取几何边的第一个端顶点 *parameters: NULL *return value: 几何边的第一个端顶点 {{anchor:getendvertex1}} **const XVertex * getEndVertex1() const** *function: 获取几何边的第二个端顶点 *parameters: NULL *return value: 几何边的第二个端顶点 {{anchor:getendvertexid0}} **ulong getEndVertexID0() const** *function: 获取几何边的第一个端顶点ID *parameters: NULL *return value: 几何边的第一个端顶点ID,如不存在返回0 {{anchor:getendvertexid1}} **ulong getEndVertexID1() const** *function: 获取几何边的第二个端顶点ID *parameters: NULL *return value: 几何边的第二个端顶点ID,如不存在返回0 {{anchor:getendnode0}} **const XNode * getEndNode0() const** *function: 获取几何边的第一个端顶点所在的节点 *parameters: NULL *return value: 几何边的第一个端顶点所在的节点,如不存在返回0 {{anchor:getendnode1}} **const XNode * getEndNode1() const** *function: 获取几何边的第二个端顶点所在的节点 *parameters: NULL *return value: 几何边的第二个端顶点所在的节点,如不存在返回0 {{anchor:getupperentity}} **const XGeometry * getUpperEntity(int index) const** *function: 重新实现XGeometry的getUpperEntity方法,获取第index个父拓扑对象 *parameters: - [i]int index: 父拓扑对象序号 *return value: 父拓扑对象 {{anchor:isupperentity}} **bool isUpperEntity(const XGeometry * pFace)const ** *function: 判断pFace是否为几何边对象的父拓扑对象 *parameters: - [i]const XGeometry * pFace: 几何拓扑对象 *return value: pFace为几何边对象的父拓扑对象返回true,否则返回false {{anchor:addupperentity}} **void addUpperEntity(const XGeometry * pFace)** *function: 添加父拓扑对象 *parameters: - [i]const XGeometry * pFace: 父拓扑对象 *return value: 无 {{anchor:removeupperentity}} **void removeUpperEntity(const XGeometry *pFace)** *function: 删除父拓扑对象 *parameters: - [i]const XGeometry *pFace: 父拓扑对象 *return value: 无 {{anchor:buildrenderdatafvm}} **void buildRenderDataFVM()** *function: 构建有限体积法下的几何边渲染视图数据 *parameters: NULL *return value: 无 {{anchor:buildrenderdata}} **void buildRenderData()** *function: 构建几何边的渲染视图数据 *parameters: NULL *return value: 无 {{anchor:updaterenderdata}} **void updateRenderData(const float * colorValue, int colorLoc, const float * deformX, const float * deformY, const float * deformZ, const int * colorIndex = NULL)** *function: 更新几何边的渲染视图数据 *parameters: - [i]const float * colorValue: 渲染数值地址 - [i] int colorLoc: 渲染数值的位置(积分点、单元节点或节点) - [i] const float * deformX: X变形分量数组地址 - [i] const float * deformY: Y变形分量数组地址 - [i] const float * deformZ: Z变形分量数组地址 - [i] const int * elemNodeIndex = NULL: 单元节点数组索引 *return value: 无 {{anchor:getrenderdata}} **const XRenderData * getRenderData() const** *function: 获取几何边的渲染视图数据 *parameters: NULL *return value: 无 {{anchor:clear}} **void clear(ClearFlag f = Clear_All)** *function: 清空几何边的数据 *parameters: - [i]ClearFlag f = Clear_All: 清空标记 *return value: 无 {{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:copyboundbox}} **void copyBoundBox(const XEdge * e)** *function: 拷贝几何面对象的包围盒 *parameters: - [i]const XEdge * e: 参考几何边对象 *return value: 无 {{anchor:getchildcount}} **ulong getChildCount() const** *function: 获取子拓扑对象个数 *parameters: NULL *return value: 子拓扑对象个数 {{anchor:getchildentity}} **const XGeometry * getChildEntity(ulong id)const** *function: 获取指定ID的子拓扑对象 *parameters: - [i]ulong id: 子拓扑对象ID *return value: 如包含指定ID的子拓扑对象,返回该对象,否则返回空 {{anchor:getuppercount}} **int getUpperCount() const** *function: 获取父拓扑对象的个数 *parameters: NULL *return value: 父拓扑对象的个数 {{anchor:write}} **void write(XBinaryIO * io)const** *function: 将几何边对象写入到二进制文件中 *parameters: - [i]XBinaryIO * io: 二进制文件句柄 *return value: 无 {{anchor:read}} **ErrorCode read(GeometryManager * esmgr, XBinaryIO * io)** *function: 从二进制文件中读取几何对象数据 *parameters: - [i]GeometryManager * esmgr: 几何对象管理器 - [i] XBinaryIO * io: 二进制文件句柄 *return value: 成功读取返回Error_None,否则返回相应错误码 {{anchor:updateafterrenumber}} **void updateAfterRenumber(TypeID tid = DItem_Element)** *function: 在对模型对象重编号之后调用,用以更新对重编号对象的引用 *parameters: - [i]TypeID tid = DItem_Element: 重编号的对象类型 *return value: 无 {{anchor:backupcolor}} **void backupColor()** *function: 备份颜色 *parameters: NULL *return value: 无 {{anchor:recovercolor}} **void recoverColor()** *function: 恢复备份颜色 *parameters: NULL *return value: 无 {{anchor:getcenter}} **void getCenter(real * c) const** *function: 计算几何边的中心 *parameters: - [i]real * c: 中心坐标 *return value: 无 {{anchor:isloop}} **bool isLoop() const** *function: 是否为闭合曲线 *parameters: NULL *return value: 是闭合曲线返回true,否则返回false ---- {{anchor:attachchildentity}} **void attachChildEntity(const XGeometry * pEntity)** *function: 绑定几何边对象与子拓扑对象的从属关系 *parameters: - [i]const XGeometry * pEntity: 子拓扑对象 *return value: 无 {{anchor:detachchildentity}} **void detachChildEntity(ulong id)** *function: 解除几何边对象与子拓扑对象的从属关系 *parameters: - [i]ulong id: 子拓扑对象ID *return value: 无 {{anchor:setendvertex0}} **void setEndVertex0(const XVertex * pVertex)** *function: 设置第一个端顶点 *parameters: - [i]const XVertex * pVertex: 顶点对象 *return value: 无 {{anchor:setendvertex1}} **void setEndVertex1(const XVertex * pVertex)** *function: 设置第二个端顶点 *parameters: - [i]const XVertex * pVertex: 顶点对象 *return value: 无