283 lines
10 KiB
C++
283 lines
10 KiB
C++
#pragma once
|
|||
|
|
|
||
|
|
#ifdef AECRXBASE_EXPORT
|
||
|
|
#define AECDLLIMPEXP __declspec(dllexport)
|
||
|
|
#else
|
||
|
|
#define AECDLLIMPEXP __declspec(dllimport)
|
||
|
|
#endif
|
||
|
|
|
||
|
|
class AECDLLIMPEXP AcGiDraw
|
||
|
|
{
|
||
|
|
protected:
|
||
|
|
AcGiDraw(void);
|
||
|
|
virtual ~AcGiDraw(void);
|
||
|
|
|
||
|
|
public:
|
||
|
|
|
||
|
|
virtual AcGiCommonDraw * GetCommonDraw() const = 0;
|
||
|
|
|
||
|
|
//设置绘制属性 -> AcGiSubEntityTraits
|
||
|
|
virtual void SetColor(const Adesk::UInt16 color) = 0;
|
||
|
|
virtual Adesk::UInt16 GetColor() const = 0;
|
||
|
|
|
||
|
|
virtual void SetTrueColor(const AcCmEntityColor& color) = 0;
|
||
|
|
virtual AcCmEntityColor GetTrueColor() const = 0;
|
||
|
|
|
||
|
|
virtual bool SetColorLayer(int nColor,const AcDbObjectId layerId) = 0;
|
||
|
|
|
||
|
|
virtual void SetLayer(const AcDbObjectId layerId) = 0;
|
||
|
|
virtual void SetLayer(LPCTSTR pszLayer) = 0;
|
||
|
|
virtual AcDbObjectId GetLayerId() const = 0;
|
||
|
|
#if ARX > 17
|
||
|
|
virtual AcCmTransparency SetTransparency(const AcCmTransparency& transparency) = 0;
|
||
|
|
#endif
|
||
|
|
|
||
|
|
virtual void SetLineType(const AcDbObjectId linetypeId) = 0;
|
||
|
|
virtual AcDbObjectId GetLineTypeId() const = 0;
|
||
|
|
|
||
|
|
virtual void SetFillType(const AcGiFillType fillType) = 0;
|
||
|
|
virtual AcGiFillType GetFillType() const = 0;
|
||
|
|
|
||
|
|
virtual void SetLineWeight(const AcDb::LineWeight lw) = 0;
|
||
|
|
virtual AcDb::LineWeight GetLineWeight() const = 0;
|
||
|
|
|
||
|
|
virtual void SetLineWidth(double dW) = 0;
|
||
|
|
virtual double GetLineWidth() const = 0;
|
||
|
|
|
||
|
|
virtual void SetLineTypeScale(double dScale = 1.0) = 0;
|
||
|
|
virtual double GetLineTypeScale() const = 0;
|
||
|
|
|
||
|
|
virtual void SetThickness(double dThickness) = 0;
|
||
|
|
virtual double GetThickness() const = 0;
|
||
|
|
|
||
|
|
virtual void SetPropertiesFrom(const AcDbEntity *pEnt) = 0;
|
||
|
|
virtual void SetSelectionMarker(int nMark) = 0;
|
||
|
|
|
||
|
|
virtual void SetTextStyle(const TCHAR * szStyle) = 0;
|
||
|
|
virtual void SetTextStyle(AcDbObjectId id) = 0;
|
||
|
|
virtual AcDbObjectId GetTextStyle() const = 0;
|
||
|
|
virtual AcDbObjectId GetTextStyle(const TCHAR * szStyle) const = 0;
|
||
|
|
|
||
|
|
virtual AcDbObjectId GetMaterialId() const = 0;
|
||
|
|
virtual Acad::ErrorStatus SetMaterial(AcDbObjectId idMaterial) = 0;
|
||
|
|
|
||
|
|
//设置2D 绘制面
|
||
|
|
virtual Acad::ErrorStatus SetDraw2DPlan(const AcGePlane& plan);
|
||
|
|
virtual Acad::ErrorStatus GetDraw2DPlan(AcGePlane& plan) const;
|
||
|
|
|
||
|
|
//原生Draw方法
|
||
|
|
virtual Adesk::Boolean DrawCircle( const AcGePoint3d& center,
|
||
|
|
const double radius,
|
||
|
|
const AcGeVector3d& normal) const = 0;
|
||
|
|
|
||
|
|
virtual Adesk::Boolean DrawCircle( const AcGePoint3d& pt1,
|
||
|
|
const AcGePoint3d& pt2,
|
||
|
|
const AcGePoint3d& pt3) const = 0;
|
||
|
|
|
||
|
|
virtual Adesk::Boolean DrawCircularArc(const AcGePoint3d& center,
|
||
|
|
const double radius,
|
||
|
|
const AcGeVector3d& normal,
|
||
|
|
const AcGeVector3d& startVector,
|
||
|
|
const double sweepAngle,
|
||
|
|
const AcGiArcType arcType = kAcGiArcSimple) const = 0;
|
||
|
|
|
||
|
|
virtual Adesk::Boolean DrawCircularArc(const AcGePoint3d& start,
|
||
|
|
const AcGePoint3d& point,
|
||
|
|
const AcGePoint3d& end,
|
||
|
|
const AcGiArcType arcType = kAcGiArcSimple) const = 0;
|
||
|
|
|
||
|
|
|
||
|
|
virtual Adesk::Boolean DrawPolyline(const Adesk::UInt32 nbPoints,const AcGePoint3d* pVertexList,const AcGeVector3d* pNormal = NULL) const = 0;
|
||
|
|
|
||
|
|
|
||
|
|
virtual Adesk::Boolean DrawPolygon(const Adesk::UInt32 nbPoints,const AcGePoint3d* pVertexList) const = 0;
|
||
|
|
|
||
|
|
virtual AcDbEntity* DrawMesh( const Adesk::UInt32 rows,
|
||
|
|
const Adesk::UInt32 columns,
|
||
|
|
const AcGePoint3d* pVertexList,
|
||
|
|
const AcGiEdgeData* pEdgeData = NULL,
|
||
|
|
const AcGiFaceData* pFaceData = NULL,
|
||
|
|
const AcGiVertexData* pVertexData = NULL) const = 0;
|
||
|
|
|
||
|
|
virtual AcDbEntity* DrawMeshS( const Adesk::UInt32 rows,
|
||
|
|
const Adesk::UInt32 columns,
|
||
|
|
const AcGePoint3d* pVertexList,
|
||
|
|
bool bHasSeal = false) const = 0;
|
||
|
|
|
||
|
|
virtual Adesk::Boolean DrawShell( const Adesk::UInt32 nbVertex,
|
||
|
|
const AcGePoint3d* pVertexList,
|
||
|
|
const Adesk::UInt32 faceListSize,
|
||
|
|
const Adesk::Int32* pFaceList,
|
||
|
|
const AcGiEdgeData* pEdgeData = NULL,
|
||
|
|
const AcGiFaceData* pFaceData = NULL,
|
||
|
|
const AcGiVertexData* pVertexData = NULL,
|
||
|
|
const struct resbuf* pResBuf = NULL) const = 0;
|
||
|
|
|
||
|
|
|
||
|
|
virtual Adesk::Boolean DrawText( const AcGePoint3d& position,
|
||
|
|
const AcGeVector3d& normal,
|
||
|
|
const AcGeVector3d& direction,
|
||
|
|
const double height,
|
||
|
|
const double width,
|
||
|
|
const double oblique,
|
||
|
|
const TCHAR* pMsg) const = 0;
|
||
|
|
|
||
|
|
|
||
|
|
virtual Adesk::Boolean DrawText( const AcGePoint3d& position,
|
||
|
|
const AcGeVector3d& normal,
|
||
|
|
const AcGeVector3d& direction,
|
||
|
|
const TCHAR* pMsg,
|
||
|
|
const Adesk::Int32 length,
|
||
|
|
const Adesk::Boolean raw,
|
||
|
|
const AcGiTextStyle &pTextStyle) const = 0;
|
||
|
|
|
||
|
|
virtual Adesk::Boolean DrawXline( const AcGePoint3d& one_xline_point,const AcGePoint3d& a_different_xline_point) const = 0;
|
||
|
|
|
||
|
|
virtual Adesk::Boolean DrawRay(const AcGePoint3d& rays_starting_point,const AcGePoint3d& a_different_ray_point) const = 0;
|
||
|
|
|
||
|
|
virtual Adesk::Boolean DrawPline(const AcDbPolyline& lwBuf,Adesk::UInt32 fromIndex = 0,Adesk::UInt32 numSegs = 0) const = 0;
|
||
|
|
|
||
|
|
enum TextAlignment
|
||
|
|
{
|
||
|
|
kUnknown=0, //未知
|
||
|
|
|
||
|
|
kTopLeft=1, //左上
|
||
|
|
|
||
|
|
kTopCenter=2, //中上
|
||
|
|
|
||
|
|
kTopRight=3, //右上
|
||
|
|
|
||
|
|
kMiddleLeft=4, //左中
|
||
|
|
|
||
|
|
kMiddleCenter=5, //正中
|
||
|
|
|
||
|
|
kMiddleRight=6, //右中
|
||
|
|
|
||
|
|
kBottomLeft=7, //左下
|
||
|
|
|
||
|
|
kBottomCenter=8, //中下
|
||
|
|
|
||
|
|
kBottomRight=9, //右下
|
||
|
|
|
||
|
|
kLeft=10, //左
|
||
|
|
|
||
|
|
kCenter=11, //中心
|
||
|
|
|
||
|
|
kRight=12, //右
|
||
|
|
|
||
|
|
kMiddle=13, //中间
|
||
|
|
|
||
|
|
kTextFit=14, //调整
|
||
|
|
};
|
||
|
|
|
||
|
|
virtual void DrawPolyline(AcDbPolyline &pline) = 0;
|
||
|
|
|
||
|
|
virtual void DrawLine(const AcGeLineSeg3d &ln, double nThickness = 0.0) = 0;
|
||
|
|
|
||
|
|
//二次包装应用绘制方法
|
||
|
|
virtual void DrawText(const TCHAR *pszContent,const AcGePoint3d& ptLocation,TextAlignment align,double nHeight,double dWidthFact,double dRotation,const TCHAR * pszStyle) = 0;
|
||
|
|
|
||
|
|
virtual void DrawTextFit(const TCHAR *pszText, const AcGePoint3d& pt1, const AcGePoint3d& pt2, double nTextHeight,const TCHAR * pszStyle) = 0;
|
||
|
|
|
||
|
|
virtual void DrawEntity(const AcDbEntity &ent)= 0;
|
||
|
|
|
||
|
|
virtual void DrawEntity(const AcDbEntity* ent)= 0;
|
||
|
|
|
||
|
|
public:
|
||
|
|
|
||
|
|
typedef struct Vertex3d
|
||
|
|
{
|
||
|
|
AcGePoint3d pt;
|
||
|
|
double dBulge;
|
||
|
|
}VERTEX3D,*PVertex3d;
|
||
|
|
|
||
|
|
typedef AcArray<Vertex3d> AcGiPoly2d;
|
||
|
|
|
||
|
|
virtual void DrawSolid(const AcGiPoly2d& polyOutline) = 0;
|
||
|
|
|
||
|
|
virtual AcDbHatch * DrawHatch(const AcGiPoly2d& polyOutline, const TCHAR *pszPattern, double nScale,double dRotation = 0.0) = 0;
|
||
|
|
|
||
|
|
// 根据给定的边界和凸起方向, 绘制三维外壳
|
||
|
|
virtual AcDbEntity* DrawMesh(const AcGiPoly2d& polyOut, const AcGeVector3d &vtOffset) = 0;
|
||
|
|
virtual AcDbEntity* DrawMesh(const AcGiPoly2d &polyRegion1, const AcGiPoly2d &polyRegion2) = 0;
|
||
|
|
|
||
|
|
// 根据给定的内外边界, 绘制三维外壳, 已经对区域进行离散
|
||
|
|
virtual void DrawShell(const AcGiPoly2d& polyOut, const AcArray<AcGiPoly2d*> &lstPolyIn) = 0;
|
||
|
|
|
||
|
|
virtual void DrawBody(const AcGiPoly2d &polySrc, const AcGeVector3d &vtOffset) = 0;
|
||
|
|
|
||
|
|
virtual void DrawBody(const AcGiPoly2d &polyOut, const AcGiPoly2d &polyIn, const AcGeVector3d &vtOffset) = 0;
|
||
|
|
|
||
|
|
virtual void DrawBody(const AcGiPoly2d &polyOut, const AcArray<AcGiPoly2d*> &lstHoles,const AcGeVector3d &vtOffset) = 0;
|
||
|
|
|
||
|
|
virtual void DrawFace(const AcGePoint3d* pVertexList,int nCount = 4) = 0;
|
||
|
|
|
||
|
|
virtual void DrawFace(const AcDbFace *pFace, const AcGeMatrix3d *mat = NULL) = 0;
|
||
|
|
|
||
|
|
virtual void DrawBlock(const AcDbBlockTableRecord &blockRec, const AcGePoint3d &ptInsert,const AcGeScale3d &scales, double nRot, BOOL bMakeBlock) = 0;
|
||
|
|
|
||
|
|
virtual void DrawBlock(const AcDbObjectId& idRec, const AcGePoint3d &ptInsert,const AcGeScale3d &scales, double nRot, BOOL bMakeBlock) = 0;
|
||
|
|
|
||
|
|
virtual AcDbEntity* DrawBox(const AcGePoint3d& ptOrg,const AcGeVector3d& vtX,const AcGeVector3d& vtY,const AcGeVector3d& vtZ) = 0;
|
||
|
|
|
||
|
|
virtual AcDbEntity* DrawCone( const AcGePoint3d &ptB , const double &Br , const AcGePoint3d &ptT , const double &Tr) = 0;
|
||
|
|
|
||
|
|
virtual AcDbEntity* DrawConeOff( const AcGePoint3d &ptB , const double &Br , const AcGePoint3d &ptT ,const AcGeVector3d& vtDir,const double &Tr) = 0;
|
||
|
|
|
||
|
|
virtual AcDbEntity* DrawConeOff(AcDbCurve* pPath,double dSD,double dED) = 0;
|
||
|
|
|
||
|
|
virtual AcDbEntity* DrawPipe(const AcGePoint3d& ptFrom, const AcGePoint3d& ptTo, double dRadius, double dThick, int nSegs = 20) = 0;
|
||
|
|
|
||
|
|
virtual AcDbEntity* DrawPipe(const AcDbCurve* pCurve,const AcDbRegion* pRegion,const AcGePoint3d& ptCenInRgn) = 0;
|
||
|
|
|
||
|
|
virtual AcDbEntity* DrawPipe(const AcDbCurve* pCurve,const AcDbPolyline* pRegion,const AcGePoint3d& ptCenInRgn) = 0;
|
||
|
|
|
||
|
|
virtual AcDbEntity* DrawPipe(const AcDbCurve *pCurve, double dR) = 0;
|
||
|
|
|
||
|
|
virtual AcDbEntity* DrawExclude(const AcGePoint3dArray& arSectionPtrs,const AcGeVector3d &vtPath) = 0;
|
||
|
|
|
||
|
|
virtual AcDbEntity* DrawExclude(const AcDbCurve *pPolyOut,const AcGeVector3d &vtPath) = 0;
|
||
|
|
|
||
|
|
virtual AcDbEntity* DrawRevolve(const AcDbLine& lnAxis,const AcGePoint3dArray& arSectionPtrs) = 0;
|
||
|
|
|
||
|
|
virtual AcDbEntity* DrawRevolve(const AcDbLine& lnAxis,const AcDbCurve *pSection) = 0;
|
||
|
|
|
||
|
|
virtual AcDbEntity* DrawRevolve(const AcDbLine& lnAxis,const AcDbRegion *pSection) = 0;
|
||
|
|
|
||
|
|
virtual AcDbEntity* DrawSphere(const AcGePoint3d &ptCenter, const double &dRadius) = 0;
|
||
|
|
|
||
|
|
virtual AcDbEntity* DrawLoft(const AcDbCurve *pTop , const AcDbCurve *pBottom , const AcDbLine *pLine) = 0;
|
||
|
|
|
||
|
|
//其他
|
||
|
|
virtual Adesk::Boolean pushModelTransform(const AcGeVector3d & vNormal) = 0;
|
||
|
|
virtual Adesk::Boolean pushModelTransform(const AcGeMatrix3d & xMat) = 0;
|
||
|
|
virtual Adesk::Boolean popModelTransform() = 0;
|
||
|
|
|
||
|
|
virtual void getModelToWorldTransform(AcGeMatrix3d&) const = 0;
|
||
|
|
virtual void getWorldToModelTransform(AcGeMatrix3d&) const = 0;
|
||
|
|
|
||
|
|
virtual void setExtents(AcGePoint3d *pNewExtents) const = 0;
|
||
|
|
|
||
|
|
virtual Adesk::Boolean draw(AcGiDrawable*) const = 0;
|
||
|
|
|
||
|
|
virtual Adesk::Boolean IsDragging() const = 0;
|
||
|
|
|
||
|
|
static AcGePoint3d Align2Base(AcGiDraw::TextAlignment nAlign, AcGePoint3d ptAlign, AcGePoint3d ext);
|
||
|
|
static AcGePoint3d Base2Align(AcGiDraw::TextAlignment nAlign, AcGePoint3d ptBase, AcGePoint3d ext);
|
||
|
|
|
||
|
|
public://临时缓存处理,DRAW不负责释放delete
|
||
|
|
void Add2dBuffer(AcDbEntity* pEnt);
|
||
|
|
void Add2dBuffer(const AcDbVoidPtrArray& arEntPtrs);
|
||
|
|
void Get2dBuffer(AcDbVoidPtrArray& arEntPtrs,bool bRemoveAllBuffer = true) const;
|
||
|
|
void Clear2dBuffer();
|
||
|
|
|
||
|
|
void Add3dBuffer(AcDbEntity* pEnt);
|
||
|
|
void Add3dBuffer(const AcDbVoidPtrArray& arEntPtrs);
|
||
|
|
void Get3dBuffer(AcDbVoidPtrArray& arEntPtrs,bool bRemoveAllBuffer = true) const;
|
||
|
|
void Clear3dBuffer();
|
||
|
|
private:
|
||
|
|
mutable AcDbVoidPtrArray m_p2DBufPtrs;//临时缓存 俯视图
|
||
|
|
mutable AcDbVoidPtrArray m_p3DBufPtrs;//临时缓存
|
||
|
|
protected:
|
||
|
|
AcGePlane m_plan;
|
||
|
|
};
|