#include "stdafx.h" #include "Legend.h" #include "ActionAddItem.h" #include "SigmaView.h" #include "Util.h" std::unique_ptr XyLegendCreate(CXy& xy, double x, double y, double width, int rows, LPCTSTR layerNames); extern "C" __declspec(dllexport) void LegendAdd(CSigmaView* pView, double x, double y, double width, int rows, LPCTSTR layerNames) { if (pView == nullptr || pView->m_pDoc == nullptr || pView->m_pDoc->m_pXy == nullptr) { TRACE("pView: 图件是空指针\n"); return; } if (rows <= 0) { TRACE("rows: 行数必须大小0\n"); return; } if (layerNames == nullptr) { TRACE("layerNames: 图层名不能是空指针\n"); return; } CXy& xy = *pView->m_pDoc->m_pXy; std::unique_ptr pOne = XyLegendCreate(xy, x, y, width, rows, layerNames); if (pOne) { COne* ptr = pOne.release(); xy.AddTailOne(ptr); pView->m_pDoc->SetActionItem(new CActionAddItem(pView->m_pDoc, IDS_STRING_ACTION_ADD, ptr)); } } extern "C" __declspec(dllexport) bool CreateLegendFull( CSigmaView* pView, LPCTSTR layerName, double xMin, double yMin, double xMax, double yMax) { if (pView == nullptr || pView->m_pDoc == nullptr || pView->m_pDoc->m_pXy == nullptr) { TRACE("%s: 非法 view 或者 document 指针\n", __FUNCTION__); return false; } }