|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
|
|
#include "Xy.h"
|
|
|
|
|
|
#include "unordered_dense.h"
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD>㣬<EFBFBD><EFBFBD><EFBFBD>ṩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>鹦<EFBFBD><EFBFBD>
|
|
|
|
|
|
*/
|
|
|
|
|
|
class LayerHelper
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
LayerHelper(const CXy& xy, const CString& layerName, bool includeSubLayer)
|
|
|
|
|
|
{
|
|
|
|
|
|
CString fullName = CLayerName(layerName).GetFullPathNameA();
|
|
|
|
|
|
fullName.MakeLower();
|
|
|
|
|
|
|
|
|
|
|
|
CClassList* pClassList = const_cast<CXy&>(xy).GetClassList();
|
|
|
|
|
|
POSITION classPos = pClassList->GetHeadPosition();
|
|
|
|
|
|
while (classPos != nullptr)
|
|
|
|
|
|
{
|
|
|
|
|
|
CLayerList* pLayerList = pClassList->GetNext(classPos);
|
|
|
|
|
|
assert(pLayerList != nullptr);
|
|
|
|
|
|
|
|
|
|
|
|
POSITION layerPos = pLayerList->GetHeadPosition();
|
|
|
|
|
|
while (layerPos != nullptr)
|
|
|
|
|
|
{
|
|
|
|
|
|
CLayer* pLayer = pLayerList->GetNext(layerPos);
|
|
|
|
|
|
assert(pLayer != nullptr);
|
|
|
|
|
|
|
|
|
|
|
|
if (CheckLayerPath(pLayer, fullName, includeSubLayer))
|
|
|
|
|
|
{
|
|
|
|
|
|
m_set.insert(pLayer);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool IsIncluedLayer(CLayer* pLayer) const
|
|
|
|
|
|
{
|
|
|
|
|
|
return m_set.find(pLayer) != m_set.end();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
bool CheckLayerPath(CLayer* pLayer, const CString& fullName, bool includeSubLayer) const
|
|
|
|
|
|
{
|
|
|
|
|
|
CString layerFullName = pLayer->GetPathName();
|
|
|
|
|
|
layerFullName.MakeLower();
|
|
|
|
|
|
|
|
|
|
|
|
if (!StartsWith(layerFullName, fullName))
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (layerFullName.GetLength() == fullName.GetLength())
|
|
|
|
|
|
{
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!includeSubLayer)
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return (layerFullName.GetLength() > fullName.GetLength() && layerFullName[fullName.GetLength()] == '\\');
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ankerl::unordered_dense::set<CLayer*> m_set;
|
|
|
|
|
|
};
|