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.
kev/Drawer/Module/GeoSigmaDraw/InterfaceDisplayOrder.cpp

80 lines
2.0 KiB
C++

1 month ago
#include "stdafx.h"
#include "SigmaView.h"
#include "SectionDoc.h"
#include "ActionSortItem.h"
#include "ItemSelect.h"
1 month ago
// <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);
}
1 month ago
//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)
{
1 month ago
if (order < 0 || order > 3) return -1;
if (pView == NULL || pView->m_pDoc == NULL) return -1;
1 month ago
CPositionList seletionSet;
pView->m_pDoc->GetSelectionSet(seletionSet);
1 month ago
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)
1 month ago
{
1 month ago
pView->m_pDoc->SetActionItem(pUserAction);
1 month ago
}
1 month ago
// <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)
1 month ago
{
return 1;
}
1 month ago
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;
1 month ago
}