93 lines
3.1 KiB
C++
93 lines
3.1 KiB
C++
//------------------------------------------------------------------------+
|
|
// Copyright (C), 1998-2011, Beijing Tangent Software Co. Ltd.
|
|
// = FileName : TDbExtentsZoneTable类
|
|
// = Version : ver1.0
|
|
// = Author : xlc
|
|
// = CreateDate : 2011-06-23
|
|
// = Description: 分区表类声明
|
|
// = Maintainers:
|
|
//
|
|
//------------------------------------------------------------------------+
|
|
#ifdef TASD
|
|
#ifndef _TDBEXTENTSZONETABLE_H_
|
|
#define _TDBEXTENTSZONETABLE_H_
|
|
|
|
#include "T3DimArray.h"
|
|
#include "TDbExtentsZoneTableRecord.h"
|
|
#include <vector>
|
|
|
|
// 辅助进行索引转换
|
|
struct SXYZInfo
|
|
{
|
|
int nX;
|
|
int nY;
|
|
int nZ;
|
|
};
|
|
|
|
class TDbExtentsZoneCell;
|
|
class TARCH_EXP TDbExtentsZoneTable : public AcDbObject
|
|
{
|
|
public:
|
|
|
|
ACDB_DECLARE_MEMBERS(TDbExtentsZoneTable);
|
|
|
|
static const Adesk::UInt8 g_nVersion; //当前版本
|
|
|
|
public:
|
|
|
|
TDbExtentsZoneTable(double dXAxis = 1000,double dYAxis = 1000,double dZAxis = 1000);
|
|
TDbExtentsZoneTable& operator = (const TDbExtentsZoneTable &table);
|
|
virtual ~TDbExtentsZoneTable();
|
|
|
|
virtual Acad::ErrorStatus dwgInFields(AcDbDwgFiler* pFiler);
|
|
virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler* pFiler) const;
|
|
|
|
//获得包围盒范围内的ID数组
|
|
int GetSelection(const AcGePoint3d &ptMin, const AcGePoint3d &ptMax, AcDbObjectIdArray& idArray);
|
|
int GetSelection2D(const AcGePoint3d &ptMin, const AcGePoint3d &ptMax, AcDbObjectIdArray& idArray);
|
|
|
|
//更新分区表
|
|
bool UpdatePartition(const AcDbObjectId &id, const AcDbExtents &ext);
|
|
bool UpdatePartition(const AcDbObjectId &id, const AcGeMatrix3d &xform); // 暂无实现
|
|
//添加分区单元
|
|
bool AddBoxZoneCell(TDbExtentsZoneCell& boxCell);
|
|
bool AddBoxZoneCell(const AcDbObjectId &id);
|
|
//设置空间大小
|
|
void SetExtents(const AcGePoint3d &ptMin,const AcGePoint3d &ptMax);
|
|
//移除分区表里的ID
|
|
void RemoveBoxZoneCell(const AcDbObjectId &id);
|
|
//创建分区表
|
|
void CreateTable();
|
|
//更新分区表
|
|
void UpdateTable(const AcGePoint3d &ptMin, const AcGePoint3d &ptMax);
|
|
//获得分区表的所有实体
|
|
void GetTableObjects(AcDbObjectIdArray &arIds);
|
|
//获得某一分区内实体id的个数
|
|
void GetTableEnt(const AcDbObjectId &id, int nQuadrant, int &nNum );
|
|
|
|
private:
|
|
|
|
//设置分区表位置,大小
|
|
void SetDimension(int nXOri, int nYOri, int nZOri,int nX, int nY, int nZ);
|
|
//移除分区表里的ID(nQuadrant为某区域)
|
|
void RemoveBoxZoneCell(const AcDbObjectId &id, int nQuadrant);
|
|
//将点转换对应分区表区域的索引值, bUp表示向上取整还是向下取整
|
|
void GetXYZ(const AcGePoint3d &pt, int &nX, int &nY, int &nZ, bool bUp = true);
|
|
Acad::ErrorStatus dwgInFields(AcDbDwgFiler* pFiler, int nQuadrant);
|
|
Acad::ErrorStatus dwgOutFields(AcDbDwgFiler* pFiler, int nQuadrant) const;
|
|
// 根据最大值点和最小值点计算表的原点和大小
|
|
void GetTableData(const AcGePoint3d &ptMin, const AcGePoint3d &ptMax, AcGePoint3d &ptOrigin, AcGePoint3d &ptSize);
|
|
// 获得分区表某一区域内所有的实体
|
|
void GetObjectIds(AcDbObjectIdArray &arIds, int nQuadrant);
|
|
|
|
public:
|
|
|
|
T3DimArray<TDbExtentsZoneTableRecord> m_pPartition; //分区表记录
|
|
AcDbExtents m_extents; //空间范围
|
|
double m_dXAxis; //三维空间坐标轴分割尺寸
|
|
double m_dYAxis; //三维空间坐标轴分割尺寸
|
|
double m_dZAxis; //三维空间坐标轴分割尺寸
|
|
|
|
};
|
|
#endif
|
|
#endif |