Files
envi-code/SourceCode/Code2026/tg_shs/inc/geo/TEntitySet.h
T
gjm 164968b62e chore
把非utf8-bom编码的cpp/h文件改为 utf8 bom 编码, msvc识别utf8编码时,如果不是bom格式的,会使用当前cp_oem来解码.
2026-10-04 00:04:20 +08:00

351 lines
7.5 KiB
C++

//-------------------------------------------------------------------------------------------------------+
// Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd.
// = FileName : TEntitySet 类
// = Version : ver2.0
// = Author : wlw
// = CreateDate : 2002-09-09
// = Description: TEntitySet 声明
// = Maintainers:
//
//-------------------------------------------------------------------------------------------------------+
#ifndef _TENTITYSET_H_
#define _TENTITYSET_H_
#ifndef _TRBLIST_H_
#include "TRBList.h"
#endif
#ifndef _TADSGEPOINT3D_H_
#include "TADSGePoint3d.h"
#endif
#ifndef _TGROUPS_H_
#include "TGroups.h"
#endif
class TADSGePoint3d;
class TPickEntSet;
class GEOAPI TEntitySet : public TRBList
{
public:
TEntitySet();
TEntitySet(const ads_name n);
TEntitySet(const TEntitySet &ent);
TEntitySet(LPCTSTR handle);
~TEntitySet();
void operator = (const ads_name n);
void operator = (const TEntitySet &n);
int operator !() const;
void operator > (ads_name entother) const;
int operator == (const ads_name ent) const;
int operator == (const TEntitySet &ent) const;
operator TLong_ptr *();
operator void *();
// 下列函数没有采用ADS命名规则,不建议使用
int In(const TPickEntSet *pSelectionSet) const;
int Redraw(int mode = 1) const;
int RedrawAll(int mode = 1) const;
int Delete() const;
int Update() const;
int Erase() const;
// member functions about groups
int Make();
int Modify() const;
int _GetGroups();
// member functions that can get a TEntitySet Name;
int UserSelect(LPCTSTR prompt,ads_point pt);
int UserSelect(LPCTSTR prompt = NULL);
int UserSelect(LPCTSTR prompt,TADSGePoint3d &pt);
int FilterSelect(LPCTSTR prompt, const TRBList &mask, ads_point res);
int FilterSelect(LPCTSTR prompt, const TRBList &mask);
int FilterSelect1(ads_real distPrec, LPCTSTR prmpt, const TRBList &mask, ads_point res = NULL);
int GetLast();
int GetNext(const TEntitySet &et);
int CreateByHandle(LPCTSTR handle);
int Handent(LPCTSTR handle);
int handent(LPCTSTR handle);
int GetData(int cd,void *buf);
int SetData(int cd,...);
int Make(int,...);
int MakeEx(int, ...);
int GetNext();
// member functions to implement Extended Data Access;
static const TCHAR *ApplicationName;
static int AssignAppName(const TCHAR *s);
// 不建议使用
int GetGroups(int getEx = 1);
int GetGroups(const TCHAR *appName);
void FreeGroups();
// 采用ADS命名规则, 建议使用
int entgetx();
int entgetx(const TCHAR *appName);
int Match(const TRBList &exlist);
int MatchEx(const TGroups *tag, const TGroups *data);
int MatchEx(int tag, const TCHAR *data);
int MatchEx(int tag, int data) ;
int MatchEx(int tag, ads_real data);
int MatchEx(int tag, const TGroups * data);
int MatchBase(const TGroups &rb);
int MatchBase(const TRBList &baseList);
int GetExtend(ads_point lowPt, ads_point upPt, ads_matrix mat = NULL);
int GetExtend(ads_point cen, ads_real *x, ads_real *y, ads_real *z = NULL);
int Is(const TCHAR *entType);
int XTransform(ads_matrix mat);
int Move(const TADSGePoint3d & basept, TADSGePoint3d & res) const; //动态拖动
int Rotate(const TADSGePoint3d &src, ads_real *res = NULL) const;
int Scale(const TADSGePoint3d &src, ads_real *res = NULL) const;
TGroups * SearchByTagCode(int tag_code);
TGroups * SearchDataByTag(int tag);
// 扩充实体的操作
int GetInt (int tag_code, int &buf);
int GetReal(int tag_code, ads_real &buf);
int GetRString(int tag_cdoe,TCHAR *&buf);
int GetString (int tag_code,TCHAR *buf);
int GetPoint(int tag_code, TADSGePoint3d &buf);
int GetRBinary(int tag_code, short &nBufLen, const char * &buf);
int SetInt (int tag_code,int buf);
int SetReal(int tag_code,ads_real buf);
int SetString (int tag_code, const TCHAR *buf, int isHandle = 0);
int SetPoint(int tag_code, const TADSGePoint3d &buf);
int SetBinary(int tag_code, short nBufLen, const char * buf);
// API 2.0
// support simple type string & int & real
int SetExData(int tag_code,...);
int GetExData(int tag_code,void *buf);
// 删除指定的扩充实体数据
int DeleteTag(int tag_code);
int RemoveXData();
int SetStruct(void *buf,int len, int tag_code = EX_STRUCT);
int GetStruct(void *buf,int len, int tag_code = EX_STRUCT);
public:
ads_name name;
PGroups groupsEx;
private:
int CreateTag(void *buf,int tag_code,int type);
void _MakeExGroups();
};
typedef TEntitySet EntityEx;
inline void TEntitySet::operator = (const ads_name n)
{
FreeGroups();
name[0] = n[0];
name[1] = n[1];
}
inline void TEntitySet::operator = (const TEntitySet &n)
{
FreeGroups();
*this = n.name;
}
inline void TEntitySet::operator > (ads_name entother) const
{
*entother = *name;
entother[1] = name[1];
}
inline int TEntitySet::operator == (const ads_name ent) const
{
return *name == *ent && name[1] == ent[1];
}
inline int TEntitySet::operator == (const TEntitySet &ent) const
{
return *this == ent.name;
}
inline int TEntitySet::operator !() const
{
return !*name && !name[1];
// return ADSName::operator !();
}
inline TEntitySet::operator TLong_ptr *()
{
return name;
}
inline TEntitySet::operator void *()
{
return name;
}
inline TEntitySet::TEntitySet() : groupsEx(0)
{
*name = name[1] = 0;
}
inline TEntitySet::TEntitySet(const ads_name n): groupsEx(0)
{
name[0] = n[0];
name[1] = n[1];
}
inline TEntitySet::TEntitySet(const TEntitySet &ent): groupsEx(0)
{
name[0] = ent.name[0];
name[1] = ent.name[1];
}
inline TEntitySet::TEntitySet(LPCTSTR handle): groupsEx(0)
{
name[0] = name[1] = 0;
ads_handent((LPCTSTR)handle,name);
}
inline int TEntitySet::Delete() const
{
return ads_entdel(name);
}
inline int TEntitySet::UserSelect(LPCTSTR prompt,TADSGePoint3d &pt)
{
return UserSelect(prompt,(double*)&pt);
}
inline int TEntitySet::GetLast()
{
FreeGroups();
return (ads_entlast(name));
}
inline int TEntitySet::Modify() const
{
return (ads_entmod((struct resbuf *)groups));
}
inline int TEntitySet::Update() const
{
return (ads_entupd(name));
}
inline int TEntitySet::GetNext(const TEntitySet &et)
{
FreeGroups();
return (ads_entnext(et.name,name));
}
inline int TEntitySet::CreateByHandle(LPCTSTR handle)
{
return (ads_handent(handle,name));
}
inline int TEntitySet::UserSelect(LPCTSTR prompt,ads_point pt)
{
FreeGroups();
return (ads_entsel(prompt,name,pt));
}
inline int TEntitySet::UserSelect(LPCTSTR prompt)
{
FreeGroups();
ads_point pt;
return (ads_entsel(prompt,name,pt));
}
inline int TEntitySet::Redraw(int mode) const
{
return (ads_redraw(name,mode));
}
inline int TEntitySet::Handent(LPCTSTR handle)
{
FreeGroups();
return ads_handent((LPCTSTR)handle,name);
}
inline int TEntitySet::handent(LPCTSTR handle)
{
FreeGroups();
return ads_handent((LPTSTR)handle,name);
}
inline int TEntitySet::GetData(int cd,void *buf)
{
if (!groups)
{
_GetGroups();
}
return TRBList::GetData(cd,buf);
}
inline TGroups * TEntitySet::SearchDataByTag(int tag)
{
TGroups *rbTag = SearchByTagCode(tag);
if(!rbTag)
{
return NULL;
}
return rbTag->next;
}
inline int TEntitySet::GetNext()
{
TEntitySet e = *this;
return GetNext(e);
}
inline void TEntitySet::FreeGroups()
{
groupsEx = NULL;
TRBList::FreeGroups();
}
inline int TEntitySet::entgetx()
{
return GetGroups();
}
inline int TEntitySet::entgetx(const TCHAR *appName)
{
return GetGroups((TCHAR *)appName);
}
inline int TEntitySet::Is(const TCHAR *entType)
{
TCHAR eType[40];
if(GetData(0, eType) == RTNORM && _tcsicmp(eType, entType) == 0)
{
return 1;
}
return 0;
}
#endif