add: random signal;
change: update control view
This commit is contained in:
parent
25e4a64ea0
commit
c356285fe2
11
ChangeLog.md
11
ChangeLog.md
@ -1,3 +1,12 @@
|
|||||||
## Change Log
|
## Change Log
|
||||||
### 3.21-3.27
|
### 3.21-3.27
|
||||||
* `Visio`的`UML`类图初步制作
|
* `Visio`的`UML`类图初步制作
|
||||||
|
* 随机信号的生成[^1]
|
||||||
|
|
||||||
|
### 5.24
|
||||||
|
* 随机信号的完善
|
||||||
|
|
||||||
|
### 5.30
|
||||||
|
* control view
|
||||||
|
|
||||||
|
[^1]: Xiao M, Hu R, Ge L Q, et al. Study of a full-digital multi-waveform nuclear pulse signal generator[J]. Applied Radiation and Isotopes, 2022, 179: 110028.
|
@ -16,7 +16,6 @@ IMPLEMENT_DYNCREATE(CControlView, CFormView)
|
|||||||
CControlView::CControlView()
|
CControlView::CControlView()
|
||||||
: CFormView(IDD_DIALOG_CONTROL)
|
: CFormView(IDD_DIALOG_CONTROL)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CControlView::~CControlView()
|
CControlView::~CControlView()
|
||||||
@ -29,6 +28,7 @@ void CControlView::DoDataExchange(CDataExchange* pDX)
|
|||||||
}
|
}
|
||||||
|
|
||||||
BEGIN_MESSAGE_MAP(CControlView, CFormView)
|
BEGIN_MESSAGE_MAP(CControlView, CFormView)
|
||||||
|
ON_WM_SIZE()
|
||||||
END_MESSAGE_MAP()
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
@ -50,3 +50,16 @@ void CControlView::Dump(CDumpContext& dc) const
|
|||||||
|
|
||||||
|
|
||||||
// CControlView 消息处理程序
|
// CControlView 消息处理程序
|
||||||
|
|
||||||
|
|
||||||
|
void CControlView::OnSize(UINT nType, int cx, int cy)
|
||||||
|
{
|
||||||
|
CFormView::OnSize(nType, cx, cy);
|
||||||
|
CRect rect;
|
||||||
|
GetClientRect(&rect); // 获取当前客户区view大小
|
||||||
|
|
||||||
|
CSize size;
|
||||||
|
size.cx = rect.right - rect.left;
|
||||||
|
size.cy = rect.bottom - rect.top;
|
||||||
|
SetScrollSizes(MM_HIMETRIC, size); // 将CScrollView的大小设置为当前客户区大小
|
||||||
|
}
|
@ -28,6 +28,7 @@ protected:
|
|||||||
|
|
||||||
DECLARE_MESSAGE_MAP()
|
DECLARE_MESSAGE_MAP()
|
||||||
public:
|
public:
|
||||||
|
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ protected:
|
|||||||
|
|
||||||
// 实现
|
// 实现
|
||||||
protected:
|
protected:
|
||||||
DECLARE_MESSAGE_MAP()
|
DECLARE_MESSAGE_MAP();
|
||||||
};
|
};
|
||||||
|
|
||||||
CAboutDlg::CAboutDlg() noexcept : CDialogEx(IDD_ABOUTBOX)
|
CAboutDlg::CAboutDlg() noexcept : CDialogEx(IDD_ABOUTBOX)
|
||||||
@ -174,6 +174,3 @@ void CMCAApp::OnAppAbout()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CMCAApp 消息处理程序
|
// CMCAApp 消息处理程序
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BIN
MCA/MCA.rc
BIN
MCA/MCA.rc
Binary file not shown.
@ -214,6 +214,9 @@
|
|||||||
<ResourceCompile Include="MCA.rc" />
|
<ResourceCompile Include="MCA.rc" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Include="..\.gitignore" />
|
||||||
|
<None Include="..\ChangeLog.md" />
|
||||||
|
<None Include="..\README.md" />
|
||||||
<None Include="res\MCA.rc2" />
|
<None Include="res\MCA.rc2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -13,6 +13,9 @@
|
|||||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="说明文件">
|
||||||
|
<UniqueIdentifier>{5f85e690-53f6-4e18-9b27-e5968d458c94}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="MCA.h">
|
<ClInclude Include="MCA.h">
|
||||||
@ -84,6 +87,15 @@
|
|||||||
<None Include="res\MCA.rc2">
|
<None Include="res\MCA.rc2">
|
||||||
<Filter>资源文件</Filter>
|
<Filter>资源文件</Filter>
|
||||||
</None>
|
</None>
|
||||||
|
<None Include="..\.gitignore">
|
||||||
|
<Filter>说明文件</Filter>
|
||||||
|
</None>
|
||||||
|
<None Include="..\ChangeLog.md">
|
||||||
|
<Filter>说明文件</Filter>
|
||||||
|
</None>
|
||||||
|
<None Include="..\README.md">
|
||||||
|
<Filter>说明文件</Filter>
|
||||||
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Image Include="res\MCADoc.ico">
|
<Image Include="res\MCADoc.ico">
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "framework.h"
|
#include "framework.h"
|
||||||
|
|
||||||
// SHARED_HANDLERS 可以在实现预览、缩略图和搜索筛选器句柄的
|
// SHARED_HANDLERS 可以在实现预览、缩略图和搜索筛选器句柄的
|
||||||
// ATL 项目中进行定义,并允许与该项目共享文档代码。
|
// ATL 项目中进行定义,并允许与该项目共享文档代码。
|
||||||
#ifndef SHARED_HANDLERS
|
#ifndef SHARED_HANDLERS
|
||||||
@ -12,6 +13,10 @@
|
|||||||
|
|
||||||
#include "MCADoc.h"
|
#include "MCADoc.h"
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string>
|
||||||
|
#include <algorithm>
|
||||||
#include <propkey.h>
|
#include <propkey.h>
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
@ -27,13 +32,45 @@ END_MESSAGE_MAP()
|
|||||||
|
|
||||||
|
|
||||||
// CMCADoc 构造/析构
|
// CMCADoc 构造/析构
|
||||||
|
|
||||||
CMCADoc::CMCADoc() noexcept
|
CMCADoc::CMCADoc() noexcept
|
||||||
{
|
{
|
||||||
|
FILE *stream_tmp;
|
||||||
|
int channel_id, channel_count;
|
||||||
|
|
||||||
|
srand((unsigned)time(NULL));
|
||||||
|
|
||||||
m_nChannelCount = new int[m_nChannelNum];
|
m_nChannelCount = new int[m_nChannelNum];
|
||||||
for (int i = 0; i < m_nChannelNum; i++)
|
for (int i = 0; i < m_nChannelNum; i++) m_nChannelCount[i] = 0;
|
||||||
|
|
||||||
|
freopen_s(&stream_tmp, "data/Co60.txt", "r", stdin);
|
||||||
|
for (int i = 0; i < 1024; i++)
|
||||||
{
|
{
|
||||||
m_nChannelCount[i] = 0;
|
scanf_s("%d,%d", &channel_id, &channel_count);
|
||||||
|
es_Co60[i] = channel_count;
|
||||||
|
if (i > 0) es_Co60[i] += es_Co60[i-1];
|
||||||
|
}
|
||||||
|
fclose(stdin);
|
||||||
|
freopen_s(&stream_tmp, "data/Cs137.txt", "r", stdin);
|
||||||
|
for (int i = 0; i < 1024; i++)
|
||||||
|
{
|
||||||
|
scanf_s("%d,%d", &channel_id, &channel_count);
|
||||||
|
es_Cs137[i] = channel_count;
|
||||||
|
if (i > 0) es_Cs137[i] += es_Cs137[i-1];
|
||||||
|
}
|
||||||
|
fclose(stdin);
|
||||||
|
freopen_s(&stream_tmp, "data/Na22.txt", "r", stdin);
|
||||||
|
for (int i = 0; i < 1024; i++)
|
||||||
|
{
|
||||||
|
scanf_s("%d,%d", &channel_id, &channel_count);
|
||||||
|
es_Na22[i] = channel_count;
|
||||||
|
if (i > 0) es_Na22[i] += es_Na22[i-1];
|
||||||
|
}
|
||||||
|
fclose(stdin);
|
||||||
|
for (int i = 0; i < 1024; i++)
|
||||||
|
{
|
||||||
|
es_Co60[i] /= es_Co60[1023];
|
||||||
|
es_Cs137[i] /= es_Cs137[1023];
|
||||||
|
es_Na22[i] /= es_Na22[1023];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,11 +89,7 @@ BOOL CMCADoc::OnNewDocument()
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// CMCADoc 序列化
|
// CMCADoc 序列化
|
||||||
|
|
||||||
void CMCADoc::Serialize(CArchive& ar)
|
void CMCADoc::Serialize(CArchive& ar)
|
||||||
{
|
{
|
||||||
if (ar.IsStoring())
|
if (ar.IsStoring())
|
||||||
@ -70,7 +103,6 @@ void CMCADoc::Serialize(CArchive& ar)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SHARED_HANDLERS
|
#ifdef SHARED_HANDLERS
|
||||||
|
|
||||||
// 缩略图的支持
|
// 缩略图的支持
|
||||||
void CMCADoc::OnDrawThumbnail(CDC& dc, LPRECT lprcBounds)
|
void CMCADoc::OnDrawThumbnail(CDC& dc, LPRECT lprcBounds)
|
||||||
{
|
{
|
||||||
@ -124,7 +156,6 @@ void CMCADoc::SetSearchContent(const CString& value)
|
|||||||
#endif // SHARED_HANDLERS
|
#endif // SHARED_HANDLERS
|
||||||
|
|
||||||
// CMCADoc 诊断
|
// CMCADoc 诊断
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
void CMCADoc::AssertValid() const
|
void CMCADoc::AssertValid() const
|
||||||
{
|
{
|
||||||
@ -139,3 +170,21 @@ void CMCADoc::Dump(CDumpContext& dc) const
|
|||||||
|
|
||||||
|
|
||||||
// CMCADoc 命令
|
// CMCADoc 命令
|
||||||
|
double CMCADoc::uniform()
|
||||||
|
{
|
||||||
|
int x = rand();
|
||||||
|
double y = (float)(x % 100) / 100;
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMCADoc::random_peaks(std::string name)
|
||||||
|
{
|
||||||
|
int K;
|
||||||
|
double eps = uniform();
|
||||||
|
|
||||||
|
if (name == "Co60") K = std::lower_bound(es_Co60, es_Co60 + 1024, eps) - es_Co60;
|
||||||
|
else if (name == "Cs137") K = std::lower_bound(es_Cs137, es_Cs137 + 1024, eps) - es_Cs137;
|
||||||
|
else K = std::lower_bound(es_Na22, es_Na22 + 1024, eps) - es_Na22;
|
||||||
|
|
||||||
|
m_nChannelCount[K] += 1;
|
||||||
|
}
|
14
MCA/MCADoc.h
14
MCA/MCADoc.h
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
class CMCADoc : public CDocument
|
class CMCADoc : public CDocument
|
||||||
{
|
{
|
||||||
@ -14,16 +15,27 @@ protected: // 仅从序列化创建
|
|||||||
|
|
||||||
// 特性
|
// 特性
|
||||||
public:
|
public:
|
||||||
int m_nChannelNum = 0;
|
int m_nChannelNum = 1024;
|
||||||
int *m_nChannelCount;
|
int *m_nChannelCount;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// reference spectrum
|
||||||
|
double es_Co60[1024] = {};
|
||||||
|
double es_Cs137[1024] = {};
|
||||||
|
double es_Na22[1024] = {};
|
||||||
|
|
||||||
// 操作
|
// 操作
|
||||||
public:
|
public:
|
||||||
|
void random_peaks(std::string name);
|
||||||
|
|
||||||
|
private:
|
||||||
|
double uniform();
|
||||||
|
|
||||||
// 重写
|
// 重写
|
||||||
public:
|
public:
|
||||||
virtual BOOL OnNewDocument();
|
virtual BOOL OnNewDocument();
|
||||||
virtual void Serialize(CArchive& ar);
|
virtual void Serialize(CArchive& ar);
|
||||||
|
|
||||||
#ifdef SHARED_HANDLERS
|
#ifdef SHARED_HANDLERS
|
||||||
virtual void InitializeSearchContent();
|
virtual void InitializeSearchContent();
|
||||||
virtual void OnDrawThumbnail(CDC& dc, LPRECT lprcBounds);
|
virtual void OnDrawThumbnail(CDC& dc, LPRECT lprcBounds);
|
||||||
|
@ -79,7 +79,7 @@ BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
|
|||||||
WS_CHILD | WS_VISIBLE, AFX_IDW_PANE_FIRST));
|
WS_CHILD | WS_VISIBLE, AFX_IDW_PANE_FIRST));
|
||||||
// 左侧窗口创建视图,第0行第0列
|
// 左侧窗口创建视图,第0行第0列
|
||||||
VERIFY(m_wndSplitter.CreateView(0, 0,
|
VERIFY(m_wndSplitter.CreateView(0, 0,
|
||||||
RUNTIME_CLASS(CControlView), CSize(240, 0), pContext));
|
RUNTIME_CLASS(CControlView), CSize(360, 0), pContext));
|
||||||
// 右侧窗口上下拆分,2行1列
|
// 右侧窗口上下拆分,2行1列
|
||||||
VERIFY(m_wndSplitter_2.CreateStatic(&m_wndSplitter, 2, 1,
|
VERIFY(m_wndSplitter_2.CreateStatic(&m_wndSplitter, 2, 1,
|
||||||
WS_CHILD | WS_VISIBLE, m_wndSplitter.IdFromRowCol(0, 1)));
|
WS_CHILD | WS_VISIBLE, m_wndSplitter.IdFromRowCol(0, 1)));
|
||||||
|
@ -8,6 +8,9 @@
|
|||||||
#define IDR_MCATYPE 130
|
#define IDR_MCATYPE 130
|
||||||
#define IDD_DIALOG1 310
|
#define IDD_DIALOG1 310
|
||||||
#define IDD_DIALOG_CONTROL 310
|
#define IDD_DIALOG_CONTROL 310
|
||||||
|
#define IDC_TREE1 1010
|
||||||
|
#define IDC_MFCSHELLTREE1 1013
|
||||||
|
#define IDC_MFCMASKEDEDIT1 1015
|
||||||
#define ID_32786 32786
|
#define ID_32786 32786
|
||||||
#define ID_32787 32787
|
#define ID_32787 32787
|
||||||
#define ID_32788 32788
|
#define ID_32788 32788
|
||||||
@ -33,14 +36,18 @@
|
|||||||
#define ID_BUTTON32809 32809
|
#define ID_BUTTON32809 32809
|
||||||
#define ID_BUTTON32810 32810
|
#define ID_BUTTON32810 32810
|
||||||
#define ID_BUTTON32811 32811
|
#define ID_BUTTON32811 32811
|
||||||
|
#define ID_32812 32812
|
||||||
|
#define ID_32813 32813
|
||||||
|
#define ID_32814 32814
|
||||||
|
#define ID_32815 32815
|
||||||
|
|
||||||
// Next default values for new objects
|
// Next default values for new objects
|
||||||
//
|
//
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 313
|
#define _APS_NEXT_RESOURCE_VALUE 313
|
||||||
#define _APS_NEXT_COMMAND_VALUE 32812
|
#define _APS_NEXT_COMMAND_VALUE 32816
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1008
|
#define _APS_NEXT_CONTROL_VALUE 1016
|
||||||
#define _APS_NEXT_SYMED_VALUE 310
|
#define _APS_NEXT_SYMED_VALUE 310
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
1024
MCA/data/Co60.txt
Normal file
1024
MCA/data/Co60.txt
Normal file
File diff suppressed because it is too large
Load Diff
1024
MCA/data/Cs137.txt
Normal file
1024
MCA/data/Cs137.txt
Normal file
File diff suppressed because it is too large
Load Diff
1024
MCA/data/Na22.txt
Normal file
1024
MCA/data/Na22.txt
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 15 KiB |
BIN
UML/Class.vsdx
BIN
UML/Class.vsdx
Binary file not shown.
Reference in New Issue
Block a user