该类提供两个转换函数。该函数将矩阵应用于实体。该函数使实体能够返回自身的副本,并应用了转换。AcDbEntitytransformBy()getTransformedCopy() 如果实体是均匀缩放和正交的,则函数的默认实现将克隆该实体,然后在克隆的实体上调用该函数。(使用该函数确定输入矩阵是否均匀缩放和正交。AcDbEntity::getTransformedCopy()transformBy()AcGeMatrix3d::isUniScaledOrtho() 要修改默认行为,请覆盖自定义实体的沙函数,这些函数分别称为 byand。subGetTransformedCopy()subTransformBy()getTransformedCopy()transformBy() 自定义类覆盖函数和函数。当不均匀缩放时,它将成为折线。AsdkPolysubTransformBy()subGetTransformedCopy()AsdkPoly
Acad::ErrorStatus AsdkPoly::subTransformBy(const AcGeMatrix3d& xform) { // If we're dragging, we aren't really going to change our // data, so we don't want to make an undo recording nor do // we really care if the object's open for write. // if (mDragDataFlags & kCloneMeForDraggingCalled) { mDragDataFlags |= kUseDragCache; mDragPlaneNormal = mPlaneNormal; mDragElevation = mElevation; AcGeMatrix2d xform2d(xform.convertToLocal(mDragPlaneNormal, mDragElevation)); mDragCenter = mCenter; mDragCenter.transformBy(xform2d); mDragStartPoint = mStartPoint; mDragStartPoint.transformBy(xform2d); mDragPlaneNormal.normalize(); } else { assertWriteEnabled(); AcGeMatrix2d xform2d(xform.convertToLocal(mPlaneNormal, mElevation)); mCenter.transformBy(xform2d); mStartPoint.transformBy(xform2d); mPlaneNormal.normalize(); } return Acad::eOk; } // Transform points and create a polyline out of them. // Acad::ErrorStatus AsdkPoly::subGetTransformedCopy( const AcGeMatrix3d& mat, AcDbEntity*& ent) const { assertReadEnabled(); Acad::ErrorStatus es = Acad::eOk; AcGePoint3dArray vertexArray; if ((es = getVertices3d(vertexArray)) != Acad::eOk) { return es; } for (int i = 0; i < vertexArray.length(); i++) { vertexArray[i].transformBy(mat); } AcDbSpline *pSpline = NULL; if ((es = rx_makeSpline(vertexArray, pSpline)) != Acad::eOk) { return es; } assert(pSpline != NULL); pSpline->setPropertiesFrom(this); ent = pSpline; return es; } |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:22
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.