You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

143 lines
4.2 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

//////////////////////////////////////////////////////////////////////////////
//文件 LayerClass.h
//主要功能:
//
//程序编写: 2005-12-07
/////////////////////////////////////////////////////////////////////////////
#pragma once
#include "afxcoll.h"
#include ".\name.h"
/**
* 图层列表类
*/
class CLayer;
class AFX_EXT_CLASS CLayerList : public CName
{
public:
CLayerList(CString strName);
CLayerList(void);
virtual ~CLayerList(void);
protected:
CPtrList value;
public:
virtual void Serialize(CArchive& ar, const short& ver);
virtual int Read(CFile& fr, const short& ver);
virtual void Write(CFile& fw, const short& ver);
virtual void ScaleProperty(double sx, double sy, BOOL bJudgeEditSatte=TRUE);
void SerializeLegend(CArchive& ar, const short &ver); //仅增加了写功能
void SerializeLayerName(CArchive& ar, const short& ver); //仅增加了写功能
void SerializeLayerState(CArchive& ar, const short& ver); //仅增加了写功能
int WriteLegend(CFile& fw, const short& ver, double cc=1.0);
void WriteLayerName(CFile& fw, const short& ver);
void WriteLayerState(CFile& fw, const short& ver);
void WriteLayerNameDML(CFile& fw, const short& ver, int nBaseTabNum, int isClosed);
void WriteLayerNameDML(CFile& fw, const short& ver, int nBaseTabNum);
void WriteDML(CFile& fw, const short& ver, int nBaseTabNum);
int WriteLegendDML(CFile& fw, const short& ver, double cc=1.0, int nBaseTabNum=1);
void WriteLayerNamePCG(CFile& fw, const short& ver, int nBaseTabNum, int isClosed);
void WriteLayerNamePCG(CFile& fw, const short& ver, int nBaseTabNum);
void WritePCG(CFile& fw, const short& ver, int nBaseTabNum);
int WriteLegendPCG(CFile& fw, const short& ver, double cc=1.0, int nBaseTabNum=1);
POSITION FindAdd(CString strName, bool* pbCreateNew = NULL); //先查找有没有该层,如果有则返回已有层的位置
POSITION Add(CLayer* pLayer); //不管列表中有没有该层,都往列表中增加
POSITION InsertAfter(POSITION posAfter, CLayer* pLayer);
POSITION InsertBefore(POSITION posBefore, CLayer* pLayer);
int Merge(CLayerList& cl, CPtrList* pAddedLayerList = NULL, bool bReplaceExistLayer = TRUE);
int ReplacePath(CString strOld, CString strNew);
int FindPath(CString strPathName, CString strFind);
POSITION FindLayer(CString strName, BOOL bIncludeSublayer = FALSE);
void FindLayers(CString strName, CPtrList& positions, BOOL bIncludeSublayer = FALSE);
int SetLayerState(CString sLayer, int state, BOOL bIncludeSubLayer);
int SetLayerState(int state); //设置该类下的所有类别的状态
void RemoveAll(BOOL bFreeMem=TRUE);
void RemoveAllLegend(void);
void RemoveAt(CString strLayerName);
void RemoveAt(POSITION pos);
void RemoveAt(CLayer* pLayer); //仅移走列表中的指针并不删除pLayer对象
CLayer* RemoveAtNoClear(POSITION pos);
CString GetPathName(POSITION pos);
CString GetClassName(void);
CPtrList* GetPtrList(void);
CLayer* GetAt(POSITION pos);
CLayer* GetNext(POSITION &pos);
CLayer* GetPrev(POSITION &pos);
CLayer* GetHead();
CLayer* GetTail();
POSITION GetHeadPosition();
POSITION GetTailPosition();
int GetCount(void);
void Standardization(CString &strLayerName);
int PositionNew(int bReplace=1);//定位修饰中的符号指针bReaplce=TRUE时表示符号不为空才重新定位否则不管是否为空都重新定位
void GetNewUsing(CStringList &list);
void operator=(CLayerList& lc);
int AddHeadLayer(LPCTSTR lpszLayerName); //在所有层名前再增加层名串,格式如:"NewLayer\\"、"NewLayer\\Test\\"
};
AFX_INLINE CPtrList* CLayerList::GetPtrList(void)
{
return &value;
}
AFX_INLINE CString CLayerList::GetClassName(void)
{
return name;
}
AFX_INLINE int CLayerList::GetCount(void)
{
return (int)value.GetCount();
}
AFX_INLINE POSITION CLayerList::GetHeadPosition()
{
return value.GetHeadPosition();
}
AFX_INLINE POSITION CLayerList::GetTailPosition()
{
return value.GetTailPosition();
}
AFX_INLINE CLayer* CLayerList::GetNext(POSITION &pos)
{
return (CLayer*)value.GetNext(pos);
}
AFX_INLINE CLayer* CLayerList::GetPrev(POSITION &pos)
{
return (CLayer*)value.GetPrev(pos);
}
AFX_INLINE CLayer* CLayerList::GetAt(POSITION pos)
{
return (CLayer*)value.GetAt(pos);
}
AFX_INLINE CLayer* CLayerList::GetHead()
{
return (CLayer*)value.GetHead();
}
AFX_INLINE CLayer* CLayerList::GetTail()
{
return (CLayer*)value.GetTail();
}