#include "stdafx.h" #include "SigmaView.h" #include "DrawBend.h" #include "SectionDoc.h" #include "Item.h" #include "ItemSelect.h" #include "ActionDeleteLayerItem.h" #include "ItemPointAdd.h" #include "ItemScaleEmbellish.h" //#include "./spdlog/spdlog.h" #include "ItemSolid.h" //#include "./spdlog/sinks/rotating_file_sink.h" #include "QTransformTracker.h" #include "ActionListItem.h" #include "ActionEmbellishItem.h" #include "ActionLayerRenameItem.h" #include "actionaddlayeritem.h" #include "ItemExportFile.h" // 获得范围内所有的图元,可以指定图层,图元类型,不指定则不加限制 extern "C" __declspec(dllexport) bool XyGetElementsByRange(CXy* pXy,POSITION posBorder, LPCTSTR layerName, int elementType, BYTE*& buffElement, int& buffLen) { COne* pOneBorder = pXy->GetAt(posBorder); CCurveEx *pBorder = (CCurveEx*)pOneBorder->value; CXyElementFilter filter; CString strLayerName(layerName); if (!strLayerName.IsEmpty()) { filter.addLayer(strLayerName, true); } if (elementType > 0) { filter.addType(elementType); } NBase::CPositionList lstResult; NBase::CPositionList lstSelection; pXy->GetElement(filter, lstSelection); for (POSITION pos = lstSelection.GetHeadPosition(); pos != nullptr; lstSelection.GetNext(pos)) { POSITION onePos = lstSelection.GetAt(pos); if (onePos == posBorder) { continue; } COne *pOne = pXy->GetAt(onePos); if (pOne->GetType() == DOUBLEFOX_CURVE) { CCurveEx* pCurve = (CCurveEx*)(pOne->GetValue()); int inside = pBorder->IsInside(*pCurve); if (inside == 0) { continue; } lstResult.AddTail(onePos); } else if (pOne->GetType() == DOUBLEFOX_POINT|| pOne->GetType() == DOUBLEFOX_XYZ) { CPointNameBase *pPoint = (CPointNameBase *)pOne->GetValue(); if (pBorder->IsInside(pPoint->x0, pPoint->y0)) { lstResult.AddTail(onePos); } } } if (lstResult.GetSize() > 0) { pXy->WriteMemory(buffElement, buffLen, lstResult, 3, 0); return true; } return false; } // 获得图层的所有图元 extern "C" __declspec(dllexport) BOOL GetDataByLayer(CSigmaView * pView, LPCTSTR layerName, BYTE*& buffElement, int& buffLen) { CXy* pxy = pView->m_pDoc->m_pXy; if (pxy == NULL) { return false; } CPositionList lst; pxy->GetElement(layerName, lst, 1); pxy->WriteMemory(buffElement, buffLen, lst, 3, 0); return true; }