|
|
|
|
|
#include "stdafx.h"
|
|
|
|
|
|
#include "SigmaView.h"
|
|
|
|
|
|
#include "SectionDoc.h"
|
|
|
|
|
|
#include "ActionSortItem.h"
|
|
|
|
|
|
#include "ItemSelect.h"
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD><C8A1>Ҫǿ<D2AA>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD>б<EFBFBD> (Mask + AboveMask)
|
|
|
|
|
|
void GetMaskAndTopObjects(CSigmaDoc* pDoc, CPositionList& listOut)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!pDoc || !pDoc->m_pXy) return;
|
|
|
|
|
|
|
|
|
|
|
|
CPositionList listMask;
|
|
|
|
|
|
CPositionList listTop;
|
|
|
|
|
|
|
|
|
|
|
|
auto pDraw = pDoc->GetDraw(); // <20><>ȡ<EFBFBD><C8A1>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>
|
|
|
|
|
|
CPtrList* values = pDraw->GetValueList();
|
|
|
|
|
|
POSITION pos = values->GetHeadPosition();
|
|
|
|
|
|
while (pos)
|
|
|
|
|
|
{
|
|
|
|
|
|
POSITION curr = pos;
|
|
|
|
|
|
COne* pOne = (COne*)(values->GetNext(pos));
|
|
|
|
|
|
if (pOne && pOne->m_pLayer)
|
|
|
|
|
|
{
|
|
|
|
|
|
auto role = pOne->m_pLayer->GetMaskRole();
|
|
|
|
|
|
if (role == CLayer::ELayerMaskRole::Mask)
|
|
|
|
|
|
{
|
|
|
|
|
|
listMask.AddTail(curr);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (role == CLayer::ELayerMaskRole::AboveMask)
|
|
|
|
|
|
{
|
|
|
|
|
|
listTop.AddTail(curr);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!listMask.IsEmpty()) listOut.AddTail(&listMask);
|
|
|
|
|
|
if (!listTop.IsEmpty()) listOut.AddTail(&listTop);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//order:0=<3D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ 1=<3D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ 2=<3D><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB> 3=<3D><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
|
|
|
int DisplayOrder_Set(CSigmaView * pView, int order)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (order < 0 || order > 3) return -1;
|
|
|
|
|
|
if (pView == NULL || pView->m_pDoc == NULL) return -1;
|
|
|
|
|
|
|
|
|
|
|
|
CPositionList seletionSet;
|
|
|
|
|
|
pView->m_pDoc->GetSelectionSet(seletionSet);
|
|
|
|
|
|
|
|
|
|
|
|
CString strLayer = pView->m_pDoc->GetSelectedElementLayer(seletionSet);
|
|
|
|
|
|
if (strLayer == "Layer:\\<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD>")
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
|
|
// ִ<><D6B4><EFBFBD>û<EFBFBD><C3BB>IJ<EFBFBD><C4B2><EFBFBD> (<28><><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|
|
|
|
|
CActionSortItem* pUserAction = new CActionSortItem(pView->m_pDoc, ID_OBJECT_MOVETOFRONT, seletionSet, order);
|
|
|
|
|
|
if (pUserAction)
|
|
|
|
|
|
{
|
|
|
|
|
|
pView->m_pDoc->SetActionItem(pUserAction);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ơ<EFBFBD><C6A1><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
CLayer* pMaskLayer = pView->m_pDoc->m_pXy->FindLayer("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD>");
|
|
|
|
|
|
if (pMaskLayer == nullptr)
|
|
|
|
|
|
{
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CPositionList listFix;
|
|
|
|
|
|
GetMaskAndTopObjects(pView->m_pDoc, listFix);
|
|
|
|
|
|
if (!listFix.IsEmpty())
|
|
|
|
|
|
{
|
|
|
|
|
|
CActionSortItem* pFixAction = new CActionSortItem(pView->m_pDoc, ID_OBJECT_MOVETOFRONT, listFix, 0);
|
|
|
|
|
|
if (pFixAction)
|
|
|
|
|
|
{
|
|
|
|
|
|
pView->m_pDoc->SetActionItem(pFixAction);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|