?? cell.h
字號:
////////////////////////////////////////////
// cell.h
///////////////////////////////////////////
#ifndef _CELL_H
#define _CELL_H
//-------------------------------------------------------------
// header files ...
#include "BaseFunc.h"
#include "Layer.h"
#include "MyHeap.h"
//-------------------------------------------------------------
const int LAYER_TOP = -1; // 缺省刪除頂層LAYER的標志
////////////////////////////////////////////////////////////////////////
const int MASK_SEARCHED = 0x80; // searched flag
const int MASK_ROLECOUNT = 0x7F; // count of role
const int MASK_MASK = 0x0001; // layer mask
const int MASK_ALTITUDE = 0xFFFE; // layer alt
const int MAX_IDXLAYER = 0xFFFF; // 附加層CELL數(shù)量
const int IDXLAYER_NONE = USHORT(-1);
const int DEFAULT_FLOORATTR = 0; // 缺省的地表屬性
const int ALTITUDE_LIMIT = 32767; // 極限高度(用于非法高度)
#pragma pack(push)
#pragma pack(1)
class CCell
{
private:
// DEQUE_LAYER m_setLayer;
// bool m_bSearched;
USHORT m_idxLayer; // <= 65534, -1: invalid
SHORT m_nAlt2Mask; // alt*2 and m_bMasked
UCHAR m_nCountFlag; // rule count and m_bSearched
public:
CCell(CLayer* pLayer);
~CCell();
static CCell* CreateNew(CLayer* pLayer);
bool Create(int nAlt, DWORD dwMask);
void Destory();
public: //
ULONG Release() { delete this; return 0; }
public:
int GetFloorAttr(DEQUE2_LAYER& set2Layer);
DWORD GetFloorMask(DEQUE2_LAYER& set2Layer);
int GetFloorAlt(DEQUE2_LAYER& set2Layer);
int GetSurfaceAlt();
void FullMask() { m_nAlt2Mask |= MASK_MASK; }
//...
void IncRole(int nVal = 1) { if ((m_nCountFlag&MASK_ROLECOUNT)+nVal<=MASK_ROLECOUNT) m_nCountFlag = (m_nCountFlag&MASK_ROLECOUNT) + nVal; }
void DecRole(int nVal = 1) { if ((m_nCountFlag&MASK_ROLECOUNT)>=nVal) m_nCountFlag = (m_nCountFlag&MASK_ROLECOUNT) - nVal; }
int GetRoleAmount() { return (m_nCountFlag&MASK_ROLECOUNT); }
public:
int GetLayerAmount(DEQUE2_LAYER& set2Layer); // 得到層次數(shù)量
CLayer* Getlayer(DEQUE2_LAYER& set2Layer, int nIndex); //★ 不能取第0層 // 取得層次
void AddLayer(DEQUE2_LAYER& set2Layer, CLayer* pLayer); // 添加層次
bool DelLayer(DEQUE2_LAYER& set2Layer, int nIndex = LAYER_TOP); //★ 不能刪除第0層 // 刪除層次
// BOOL AddLogicLayer(CLayer* pLayer, CLayer* pBaseLayer); // 添加邏輯層次
// BOOL DelLogicLayer(int nIndex); // 刪除邏輯層次
BOOL BeSearched(){return (m_nCountFlag&MASK_SEARCHED) != 0;}
void SetSearchFlag(bool bSearched){if(bSearched) m_nCountFlag |= MASK_SEARCHED; else m_nCountFlag &= (~MASK_SEARCHED);}
protected:
MYHEAP_DECLARATION(s_heap)
};
#pragma pack(pop)
//-------------------------------------------------------------
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -