464 lines
12 KiB
C++
464 lines
12 KiB
C++
//-----------------------------------------------------------------------------+
|
|
// Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd.
|
|
// = FileName : TEntityBase.h
|
|
// = Version : ver2.0
|
|
// = Author : Xlc
|
|
// = CreateDate : 2002-09-09
|
|
// = Description: 上华基本对象基础类的声明
|
|
// = Maintainers:
|
|
//
|
|
//-----------------------------------------------------------------------------+
|
|
#ifndef _TENTITYBASE_H_
|
|
#define _TENTITYBASE_H_
|
|
|
|
#ifndef _TDPTRLIST_H_
|
|
#include "TDPtrList.h"
|
|
#endif
|
|
|
|
#ifndef _TENTITYFIELDS_H_
|
|
#include "TEntityFields.h"
|
|
#endif
|
|
|
|
#ifndef _TOBJINFOUNIT_H_
|
|
#include "TObjInfoUnit.h"
|
|
#endif
|
|
|
|
#ifndef _TTEXTPOSITION_H_
|
|
#include "TTextPosition.h"
|
|
#endif
|
|
|
|
#ifndef _TWCSTRING_H_
|
|
#include "TWCString.h"
|
|
#endif
|
|
|
|
#ifndef _TACSTRING_H_
|
|
#include "TACString.h"
|
|
#endif
|
|
|
|
#ifndef _TGGIEXPLODEDRAWBASE_H_
|
|
#include "TGGiExplodeDrawBase.h"
|
|
#endif
|
|
|
|
#ifndef _TGGIDRAWSTREAMBASE_H_
|
|
#include "TGGiDrawStreamBase.h"
|
|
#endif
|
|
|
|
#ifndef _TGGEPOLY2D_H_
|
|
#include "TGGePoly2D.h"
|
|
#endif
|
|
|
|
#ifndef _TADSGEPOINT3D_H_
|
|
#include "TADSGePoint3d.h"
|
|
#endif
|
|
|
|
#ifndef _SECTIONSTRUCTDEF_H_
|
|
#include "SectionStructDef.h"
|
|
#endif
|
|
|
|
#ifndef _TDBXDATAMAP_H__
|
|
#include "TDbXDataMap.h"
|
|
#endif
|
|
|
|
typedef int (*TConvertTextPtr)(const TCHAR *pszText, TCString &sResult, void *pData); //RTNORM/RTERROR/RTNONE
|
|
|
|
class TSubText;
|
|
class TTextRange;
|
|
|
|
#if ADS > 15
|
|
|
|
#ifndef _TSPTABLE_H_
|
|
#include "TSPTable.h"
|
|
#endif
|
|
|
|
#include "TDbGrip.h"
|
|
#endif
|
|
|
|
// 上华基本对象基础类
|
|
class TConfigBase;
|
|
class GEOAPI TEntityBase
|
|
{
|
|
public:
|
|
|
|
enum ExplodeOrDrawType
|
|
{
|
|
kExplode = 0,
|
|
kWroldDraw = 1,
|
|
kViewportDraw = 2,
|
|
};
|
|
|
|
enum DrawType
|
|
{
|
|
k2Dand3D = 0,
|
|
k2DOnly = 1,
|
|
k3DOnly = 2,
|
|
};
|
|
|
|
//绘制、分解
|
|
virtual Acad::ErrorStatus ExplodeOrDraw2d(TGGiExplodeDrawBase &dc) const;
|
|
|
|
virtual Acad::ErrorStatus ExplodeOrDraw3d(TGGiExplodeDrawBase &dc) const;
|
|
|
|
//自动裁剪支持
|
|
virtual bool OnExplodeOrDraw(TGGiDrawStreamBase &dc)const;
|
|
|
|
//是否被裁剪
|
|
virtual bool IsClipMe(const TEntityBase* pEnt = NULL)const;
|
|
|
|
//是否只裁剪外部
|
|
virtual bool IsClipOut()const;
|
|
|
|
//是否去裁剪
|
|
virtual bool IsMeClip()const;
|
|
|
|
virtual Acad::ErrorStatus GetClipBoundary(TGGePoly2D& poly)const;
|
|
|
|
//格式刷支持
|
|
virtual void CopyPropertiesFrom(AcDbEntity *pSrcEntity, unsigned gMatchFlag);
|
|
|
|
//对象编辑支持
|
|
virtual AecObjectEditMethod GetEditMethod() const;
|
|
|
|
//等比缩放
|
|
virtual void UnionScale(double nScale);
|
|
|
|
//包围盒
|
|
virtual Acad::ErrorStatus GetExtents2d(TADSGePoint3d &ptLow, TADSGePoint3d &ptUp) const;
|
|
|
|
virtual Acad::ErrorStatus GetExtents(TADSGePoint3d &ptLow, TADSGePoint3d &ptUp) const;
|
|
|
|
//降级保存支持
|
|
virtual int GetFirstVersion()const;
|
|
|
|
virtual Acad::ErrorStatus DownGradeSave(int nDrawMode, AcDbVoidPtrArray &entSet, BOOL *bErase);
|
|
|
|
//属性查询
|
|
virtual DrawType GetDrawType() const;
|
|
|
|
//是否为模型
|
|
virtual bool IsModelEntity() const;
|
|
|
|
virtual BOOL IsValid() const;
|
|
|
|
virtual const TCHAR *GetDefaultLayer() const;
|
|
|
|
//取动态属性显示数据
|
|
virtual void GetTips(TDPtrList<TObjInfoUnit> &lstInfo) const;
|
|
|
|
//实例查询
|
|
virtual AcDbObjectId GetOwnerId() const;
|
|
|
|
virtual const AcDbEntity * GetMe() const = 0;
|
|
|
|
//繁简转换支持
|
|
virtual int ConvertText(TConvertTextPtr ptr, void *pData = NULL);
|
|
|
|
//文字查找替换支持
|
|
//返回发现的位置,同时posStart往前移动(以便继续找下一个使用),
|
|
virtual TTextPosition FindSubText(const TCHAR *sSubText, TTextPosition &posStart, TTextRange *pRange = NULL) const;
|
|
|
|
//返回下一次查找的开始位置
|
|
virtual TTextPosition ReplaceSubText(const TTextPosition &posRep, const TCHAR *sRepText, TTextRange *pRange = NULL);
|
|
|
|
//文字在位编辑支持
|
|
virtual long GetSubTextNum()const;
|
|
|
|
//基类不处理bVert
|
|
virtual long GetNextSubTextIndex(long i,bool bVert = false,bool bPre = false)const;
|
|
|
|
virtual TSubText* HitTestText(TADSGePoint3d pt)const;
|
|
|
|
virtual TSubText* GetSubText(long iText)const;
|
|
|
|
virtual void SetSubText(long i,CString sText);
|
|
|
|
//文字复位支持
|
|
virtual void ResetTextPos();
|
|
|
|
//Poly路径对象支持
|
|
virtual Acad::ErrorStatus GetPathPoly(TGGePoly2D &poly,AcGeVector3d&vt)const;
|
|
|
|
virtual Acad::ErrorStatus SetPathPoly(const TGGePoly2D &poly,const AcGeVector3d&vt);
|
|
|
|
//用于绑定其它路径对象
|
|
virtual Acad::ErrorStatus GetBindPath(TGGePoly2D &poly,AcGeVector3d&vt)const;
|
|
|
|
//夹点拉伸模式
|
|
virtual int GetCtrlToggleIndex()const;
|
|
|
|
virtual Acad::ErrorStatus GetGripText(int i, CString &cs) const;
|
|
|
|
//add by xlc on 100610 添加统一标高接口
|
|
virtual bool UnifyElevation(double dElevation = 0.0);
|
|
|
|
#if ADS > 15 //夹点动态输入支持
|
|
|
|
//创建夹点和夹点参数,在getGripsPoints时调用
|
|
virtual void CreateGrip();
|
|
|
|
//根据对象数据更新指定夹点参数
|
|
virtual Acad::ErrorStatus EntityToDim(long iGrip,long iDim,const AcDbEntity*pEnt);
|
|
|
|
//由特定夹点参数更新对象数据
|
|
virtual Acad::ErrorStatus DimToEntity(long iGrip,long iDim,double newValue,const AcGeVector3d& offset);
|
|
|
|
#endif
|
|
|
|
//add by xlc on 101026
|
|
virtual bool GetStandardFaceBody(AcDbVoidPtrArray& arFacePtrs) const;
|
|
|
|
virtual bool GetSafeProtectedSpace(AcDbVoidPtrArray& arFacePtrs) const;
|
|
|
|
// 注意 GetSection内不应将std::vector<TObjSectionRecord>参数清空
|
|
virtual bool GetSection(const AcDbFace &face, const AcGeVector3d &vtPlaneSecDir, std::vector<TObjSectionRecord> §ionRecord, AcDbVoidPtrArray& arFillPtrs) const;
|
|
|
|
// sg modify 120117,根据以工程方式组装部分导出XML的要求,增加一个形参,各个对象自己负责根据矩阵进行坐标变换
|
|
// virtual CString GetXml() const;
|
|
virtual CString GetXml(const AcGeMatrix3d& mat) const;
|
|
|
|
// 2015/7/30增加两个导出接口,分别导出到 pkpm 和 pdms by gjm
|
|
virtual CString Tg2PKPM(const AcGeMatrix3d& mat) const;
|
|
virtual CString Tg2PDMS(const AcGeMatrix3d& mat) const;
|
|
|
|
// 查询绘制分解函数被谁调用的
|
|
TEntityBase::ExplodeOrDrawType GetExplodeOrDrawType() const ;
|
|
|
|
//对象操作代理函数
|
|
Adesk::UInt32 ViewportDrawLogicalFlags(AcGiViewportDraw * vd, Adesk::UInt32 nFlag);
|
|
|
|
Adesk::UInt32 SetAttributes(AcGiDrawableTraits * traits, Adesk::UInt32 nFlag);
|
|
|
|
// 相当于worldDraw
|
|
Adesk::Boolean WorldDraw(AcGiWorldDraw *pWd);
|
|
|
|
// 为了支持依赖于视窗的显示, 相当于viewportDraw
|
|
void ViewportDraw(AcGiViewportDraw* pMode);
|
|
|
|
void Close();
|
|
|
|
Acad::ErrorStatus Explode(AcDbVoidPtrArray& entitySet) const;
|
|
|
|
//禁止ACGI和图块生成
|
|
Acad::ErrorStatus SimpleExplode(AcDbVoidPtrArray& entitySet) const;
|
|
|
|
void ListInfo() const;
|
|
|
|
Acad::ErrorStatus GetExtents(TADSGePoint3d &ptCen, double *nX = NULL, double *nY = NULL, double *nZ = NULL) const;
|
|
|
|
Acad::ErrorStatus GetOsnapPoints(
|
|
AcDb::OsnapMode osnapMode,
|
|
INT_PTR gsSelectionMark,
|
|
const AcGePoint3d& ptPick,
|
|
const AcGePoint3d& lastPoint,
|
|
const AcGeMatrix3d& viewXform,
|
|
AcGePoint3dArray& snapPoints,
|
|
AcDbIntArray& geomIds) const;
|
|
|
|
Acad::ErrorStatus GetOsnapPoints(
|
|
AcDb::OsnapMode osnapMode,
|
|
INT_PTR gsSelectionMark,
|
|
const AcGePoint3d& ptPick,
|
|
const AcGePoint3d& lastPoint,
|
|
const AcGeMatrix3d& viewXform,
|
|
AcGePoint3dArray& snapPoints,
|
|
AcDbIntArray& geomIds,
|
|
const AcGeMatrix3d &insertionMat) const;
|
|
|
|
Acad::ErrorStatus IntersectWith(const AcDbEntity* ent,
|
|
AcDb::Intersect intType,
|
|
AcGePoint3dArray& points,
|
|
INT_PTR thisGsMarker,
|
|
INT_PTR otherGsMarker) const;
|
|
|
|
Acad::ErrorStatus IntersectWith(const AcDbEntity* ent,
|
|
AcDb::Intersect intType,
|
|
const AcGePlane& projPlane,
|
|
AcGePoint3dArray& points,
|
|
INT_PTR thisGsMarker,
|
|
INT_PTR otherGsMarker) const;
|
|
|
|
Acad::ErrorStatus DwgInFields (AcDbDwgFiler*);
|
|
|
|
Acad::ErrorStatus DwgOutFields(AcDbDwgFiler*) const;
|
|
|
|
Acad::ErrorStatus DxfInFields (AcDbDxfFiler*);
|
|
|
|
Acad::ErrorStatus DxfOutFields(AcDbDxfFiler*) const;
|
|
|
|
// T20专业数据[可读写2013-9-23]
|
|
virtual TDbXDataMap* GetSpecialtyData();
|
|
|
|
// T20读的方式获取专业数据
|
|
virtual TDbXDataMap* GetSpecialtyDataReadOnly() const;
|
|
|
|
//T20直接 数据存取
|
|
virtual BOOL SetAt(LPCTSTR pszKey,TXData& XData);
|
|
virtual BOOL GetAt(LPCTSTR pszKey,TXData& XData) const;
|
|
|
|
//普通数据
|
|
BOOL &GetCtrlToggle()const;
|
|
|
|
void ToggleCtrl();
|
|
|
|
// 取模型比例
|
|
double GetPScale() const;
|
|
|
|
void SetPScale(double scale);
|
|
|
|
double GetLayoutRotation() const;
|
|
|
|
void SetLayoutRotation(double nRot);
|
|
|
|
BOOL IsLayoutRotated() const;
|
|
|
|
// 从模型中取粗线宽度并换算成为模型空间尺寸
|
|
double GetModelThick() const;
|
|
|
|
int GetDrawMode() const;
|
|
TConfigBase* GetConfigBase();
|
|
|
|
// 从模型中填充方式
|
|
BOOL IsBoldLine() const;
|
|
|
|
BOOL IsSolidFill() const;
|
|
|
|
//根据当前视图和全局的绘图模式确定分解的方式:DRAW_2D/DRAW_3D
|
|
int GetExplodeMode() const;
|
|
|
|
//裁剪数据
|
|
void AppendClipId(const AcDbObjectId& id);
|
|
|
|
void AppendClippedId(const AcDbObjectId& id);
|
|
|
|
void RemoveClipId(const AcDbObjectId& id);
|
|
|
|
void RemoveClippedId(const AcDbObjectId& id);
|
|
|
|
void ResetClipShip();
|
|
|
|
void ResetClippedShip();
|
|
|
|
void ValidateClipShip(LPVOID pResver = NULL,LPVOID pResver2 = NULL);//更新主动裁剪关系
|
|
|
|
void ValidateClippedShip(LPVOID pResver = NULL,LPVOID pResver2 = NULL);//更新被裁剪关系
|
|
|
|
//动态扩展数据
|
|
const TEntityFields & GetFields()const;
|
|
|
|
TEntityFields& Fields();
|
|
|
|
//辅助操作
|
|
bool IsIntersectWith(const AcDbEntity*pEnt,bool bFrame=false)const;
|
|
|
|
double Wcs2Layout(double nAngWcs) const; //Wcs角度转为布局角度
|
|
|
|
double Layout2Wcs(double nAngLay) const; //布局角度转为Wcs角度
|
|
|
|
double NormalViewAngle(double nAngWcs) const; //在布局时正常观察的WCS角度
|
|
|
|
//夹点操作
|
|
#if ADS>15
|
|
AcGePoint3d GetGripPoint(long iGrip)const;
|
|
|
|
long GetGripNum()const;
|
|
|
|
TDbGrip* GetGrip(long i)const;
|
|
|
|
TDbGripDim* GetGripDim(long iGrip,long iDim);
|
|
|
|
void ClearGrip();
|
|
|
|
void UpdateDim(long iGrip,const AcDbEntity*pEnt=NULL);//更新夹点参数和关联动态标注
|
|
|
|
void GripStatus(const AcDb::GripStat status);
|
|
|
|
Acad::ErrorStatus GetGripPoints(AcDbGripDataPtrArray& grips,
|
|
const double curViewUnitSize,
|
|
const int gripSize,
|
|
const AcGeVector3d& curViewDir,
|
|
const int bitflags) const;
|
|
|
|
Acad::ErrorStatus MoveGripPointsAt(const AcDbVoidPtrArray& appData,
|
|
const AcGeVector3d& offset,
|
|
const int bitflags);
|
|
#endif
|
|
|
|
//类型转换
|
|
static TEntityBase* Cast(const AcDbObject*pEnt);
|
|
|
|
#if ADS > 15//夹点处理
|
|
|
|
static const TCHAR* GripToolTip(AcDbGripData* pThis);
|
|
|
|
static bool GripWorldDraw(AcDbGripData* pThis, AcGiWorldDraw* pWd,
|
|
const AcDbObjectId& entId, AcDbGripOperations::DrawType type,
|
|
AcGePoint3d* imageGripPoint, double dGripSize);
|
|
|
|
static void GripViewportDraw(AcDbGripData* pThis, AcGiViewportDraw* pWd,
|
|
const AcDbObjectId& entId, AcDbGripOperations::DrawType type,
|
|
AcGePoint3d* imageGripPoint, int gripSize);
|
|
|
|
static void GripHoverDimension(AcDbGripData* pThis, const AcDbObjectId& entId,
|
|
double dimScale, AcDbDimDataPtrArray& dimData);
|
|
|
|
static void GripHotDimension(AcDbGripData* pThis, const AcDbObjectId& entId,
|
|
double dimScale, AcDbDimDataPtrArray& dimData);
|
|
|
|
static AcGeVector3d DimDataSetValue(AcDbDimData* pThis,AcDbEntity* pEnt, double newValue,const AcGeVector3d& offset);
|
|
|
|
#endif
|
|
|
|
protected:
|
|
|
|
TEntityBase();
|
|
// virtual ~TEntityBase();
|
|
|
|
INT_PTR GetQuickMarker() const;
|
|
|
|
//实例查询
|
|
virtual AcDbEntity * GetMe() = 0;
|
|
|
|
|
|
protected://驻留DWG的数据
|
|
|
|
//相对于图纸的比例
|
|
double m_nPaperScale;
|
|
|
|
//布局转角
|
|
double m_nLayoutRotation;
|
|
|
|
//绘制函数被调用方式
|
|
ExplodeOrDrawType m_eExplodeOrDrawType;
|
|
|
|
//TArch7
|
|
//裁剪自身的邻接对象,如柱
|
|
TDPtrList<AcDbSoftPointerId> m_lstClipId;
|
|
|
|
//被自身裁剪的对象,如楼梯
|
|
TDPtrList<AcDbSoftPointerId> m_lstClippedId;
|
|
|
|
//TArch8
|
|
//动态数据,树状查询
|
|
TEntityFields m_allFields;
|
|
//wlw t20正式版时放开
|
|
//T20
|
|
TDbXDataMap m_XDataMap; //2013.8.29 动态数据
|
|
|
|
//不驻留DWG的数据
|
|
#if ADS>15
|
|
|
|
//所有夹点,未选中时为空
|
|
TSPTable<TDbGrip> m_allGrip;
|
|
|
|
#endif
|
|
|
|
private:
|
|
INT_PTR m_nQuickMarker;
|
|
const static Adesk::UInt8 g_nVersion;
|
|
//
|
|
// private:
|
|
// int GetDispMethod(int nDrawMode, int nDrawType) const;
|
|
// void GetTrueTextExtent(const AcDbEntity*pEnt,TGGePoly2D &polyExt) const;
|
|
|
|
};
|
|
|
|
#endif |