184 lines
6.5 KiB
C++
184 lines
6.5 KiB
C++
#ifndef _DBREGION_H
|
|
#define _DBREGION_H
|
|
|
|
class TDbRegion;
|
|
#define ERROR_REGION 0x00001//位置出错
|
|
#define HALF_REGION 0x00002//计算半面积
|
|
//区域
|
|
class TARCH_EXP TDbRegion: public TDbEntity
|
|
{
|
|
DECLARE_TENTBASE();
|
|
ACRX_DECLARE_MEMBERS(TDbRegion);
|
|
private:
|
|
const static Adesk::UInt8 g_nVersion;
|
|
public:
|
|
enum RegionType
|
|
{
|
|
kAllRegion=-1, //全局虚拟地块,无边界
|
|
kTotalRegion=0, //总地块
|
|
kSubRegion=1, //分地块
|
|
kBuildRegion=2, //建筑外轮廓
|
|
|
|
kBuilding=51, //计算全面积的建筑单体
|
|
kBalcony=52, //计算半面积的建筑单体
|
|
kUnderground=53, //地下室轮廓
|
|
kGreenland=54, //绿地
|
|
kPackingZone=55 //停车位
|
|
};
|
|
protected:
|
|
XPoly2D m_polyOutline;//边界
|
|
|
|
XString m_sName; //名称
|
|
XString m_sType; //用途类型
|
|
RegionType m_nType; //类型
|
|
Adesk::UInt32 m_nFlag;//标记
|
|
|
|
double m_nElevation; //标高
|
|
|
|
AcDbSoftPointerId m_idParent; //父区域,IsKindOf(TDbRegion)
|
|
SqTable<AcDbSoftPointerId> m_lstSubRegion;//子区域,IsKindOf(TDbRegion)
|
|
public:
|
|
public:
|
|
TDbRegion();
|
|
TDbRegion(AcDbObjectId idBlock);
|
|
public:
|
|
//Qurey
|
|
LPCTSTR GetName()const{return m_sName;}//ok
|
|
LPCTSTR GetType()const{return m_sType;}//ok
|
|
double GetArea()const;
|
|
XPoly2D GetOutline()const{return m_polyOutline;}//ok
|
|
bool IsInclude(const TDbRegion®ion)const{return m_polyOutline.IsRegionInclude(region.GetOutline());}//ok
|
|
bool IsOverlap(const TDbRegion®ion)const{return m_polyOutline.IsRegionOverlap(region.GetOutline());}//ok
|
|
AcDbObjectId GetParentId()const{return m_idParent;}//ok
|
|
bool IsSubRegion()const{return !m_idParent.isNull();}//ok
|
|
long GetSubRegionNum()const{return m_lstSubRegion.GetLength();}//ok
|
|
AcDbObjectId GetSubRegionId(long i)const{return m_lstSubRegion.GetAt(i);}//ok
|
|
double GetElevation()const{return m_nElevation;}//ok
|
|
bool IsErrorRegion()const{return (m_nFlag&ERROR_REGION)!=0;}//ok
|
|
void GetAllSubRegionId(AcDbObjectIdArray &ids)const;
|
|
void IndicateChild(Adesk::UInt16 color)const;
|
|
|
|
//edit
|
|
void SetOutline(const XPoly2D& poly){assertWriteEnabled();m_polyOutline=poly;}//ok
|
|
void SetName(LPCTSTR s){assertWriteEnabled();m_sName=s;}//ok
|
|
void SetType(LPCTSTR s){assertWriteEnabled();m_sType=s;}//ok
|
|
void SetErrorFlag(bool bSet=true)
|
|
{
|
|
assertWriteEnabled();
|
|
if(bSet)
|
|
m_nFlag|=ERROR_REGION;
|
|
else
|
|
m_nFlag&=~ERROR_REGION;
|
|
}
|
|
|
|
//internal use
|
|
void SetParentId(AcDbObjectId id){assertWriteEnabled();m_idParent=id;}//ok
|
|
void ClearSubRegion(){assertWriteEnabled();m_lstSubRegion.Clear();}//ok
|
|
long AppendSubRegion(AcDbObjectId id){assertWriteEnabled();return m_lstSubRegion.FindOrAddTail(id);}//ok
|
|
bool RemoveSubRegion(AcDbObjectId id){assertWriteEnabled();return m_lstSubRegion.FindAndDel(id)>0;}//ok
|
|
void ValidateRegionShip();
|
|
void ResetRegionShip();
|
|
bool CheckIn(TDbRegion*pChild);
|
|
|
|
//overridable
|
|
virtual bool CanInclude(const TDbRegion& region)const;
|
|
virtual bool CanOverlap(const TDbRegion& region)const;
|
|
|
|
// Override from AcDbEntity
|
|
virtual Acad::ErrorStatus subGetClassID(CLSID* pClsid) const;
|
|
virtual Acad::ErrorStatus dwgInFields (AcDbDwgFiler*);
|
|
virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler*) const;
|
|
virtual Acad::ErrorStatus dxfInFields (AcDbDxfFiler*);
|
|
virtual Acad::ErrorStatus dxfOutFields(AcDbDxfFiler*) const;
|
|
virtual Acad::ErrorStatus subTransformBy(const AcGeMatrix3d& xform);
|
|
virtual Acad::ErrorStatus subGetGripPoints(AcGePoint3dArray& gripPoints,
|
|
AcDbIntArray& osnapModes,
|
|
AcDbIntArray& geomIds) const;
|
|
virtual Acad::ErrorStatus subMoveGripPointsAt(const AcDbIntArray& indices,
|
|
const AcGeVector3d& offset);
|
|
|
|
|
|
// Override from TEntityBase
|
|
virtual BOOL IsValid() const;
|
|
virtual int GetFirstVersion()const{return 7;}//ok
|
|
virtual void CopyPropertiesFrom(AcDbEntity *pSrcEntity, unsigned gMatchFlag);
|
|
virtual Acad::ErrorStatus ExplodeOrDraw2d(XExplodeDraw &dc) const;
|
|
virtual Acad::ErrorStatus ExplodeOrDraw3d(XExplodeDraw &dc) const;
|
|
virtual void GetTips(DList<TObjInfoUnit> &) const; //取动态属性显示数据
|
|
virtual Acad::ErrorStatus GetGripText(int i, CString &cs) const;
|
|
virtual int GetCtrlToggleIndex()const{return 4;}//ok
|
|
};
|
|
////建筑单体
|
|
//class TDbBuildingShape:public TDbRegion
|
|
//{
|
|
// DECLARE_TENTBASE();
|
|
// ACRX_DECLARE_MEMBERS(TDbBuildingShape);
|
|
//private:
|
|
// const static Adesk::UInt8 g_nVersion;
|
|
//
|
|
//protected:
|
|
// double m_nHeight;
|
|
// int m_nFirstFloor,m_nFloorNum;
|
|
//public:
|
|
// TDbBuildingShape();
|
|
//public:
|
|
// //Qurey
|
|
// double GetHeight()const{return m_nHeight;}//ok
|
|
//
|
|
// //edit
|
|
// void SetHeight(double h){assertWriteEnabled();m_nHeight=h;}//ok
|
|
//
|
|
// //overridable
|
|
// virtual bool CanInclude(const TDbRegion& region)const;
|
|
// virtual bool CanOverlap(const TDbRegion& region)const;
|
|
//
|
|
// // Override from AcDbEntity
|
|
// virtual Acad::ErrorStatus getClassID(CLSID* pClsid) const;
|
|
// virtual Acad::ErrorStatus dwgInFields (AcDbDwgFiler*);
|
|
// virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler*) const;
|
|
// virtual Acad::ErrorStatus dxfInFields (AcDbDxfFiler*);
|
|
// virtual Acad::ErrorStatus dxfOutFields(AcDbDxfFiler*) const;
|
|
//
|
|
// // Override from TEntityBase
|
|
// virtual BOOL IsValid() const;
|
|
// virtual void CopyPropertiesFrom(AcDbEntity *pSrcEntity, unsigned gMatchFlag);
|
|
// virtual Acad::ErrorStatus ExplodeOrDraw3d(XExplodeDraw &dc) const;
|
|
// virtual void GetTips(DList<TObjInfoUnit> &) const; //取动态属性显示数据
|
|
//};
|
|
////停车位
|
|
//class TDbCarRegion:public TDbRegion
|
|
//{
|
|
// DECLARE_TENTBASE();
|
|
// ACRX_DECLARE_MEMBERS(TDbCarRegion);
|
|
//private:
|
|
// const static Adesk::UInt8 g_nVersion;
|
|
//protected:
|
|
//
|
|
//public:
|
|
// TDbCarRegion();
|
|
//public:
|
|
// //Qurey
|
|
// double GetHeight()const{return m_nHeight;}//ok
|
|
//
|
|
// //edit
|
|
// void SetHeight(double h){assertWriteEnabled();m_nHeight=h;}//ok
|
|
//
|
|
// //overridable
|
|
// virtual bool CanInclude(const TDbRegion& region)const;
|
|
// virtual bool CanOverlap(const TDbRegion& region)const;
|
|
//
|
|
// // Override from AcDbEntity
|
|
// virtual Acad::ErrorStatus getClassID(CLSID* pClsid) const;
|
|
// virtual Acad::ErrorStatus dwgInFields (AcDbDwgFiler*);
|
|
// virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler*) const;
|
|
// virtual Acad::ErrorStatus dxfInFields (AcDbDxfFiler*);
|
|
// virtual Acad::ErrorStatus dxfOutFields(AcDbDxfFiler*) const;
|
|
//
|
|
// // Override from TEntityBase
|
|
// virtual BOOL IsValid() const;
|
|
// virtual void CopyPropertiesFrom(AcDbEntity *pSrcEntity, unsigned gMatchFlag);
|
|
// virtual Acad::ErrorStatus ExplodeOrDraw2d(XExplodeDraw &dc) const;
|
|
// virtual void GetTips(DList<TObjInfoUnit> &) const; //取动态属性显示数据
|
|
//};
|
|
|
|
#endif |