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.
176 lines
4.1 KiB
C++
176 lines
4.1 KiB
C++
|
|
// CcdDataImageProcessingDlg.h : 头文件
|
|
//
|
|
|
|
#pragma once
|
|
#include "afxwin.h"
|
|
#include <windows.h>
|
|
#include "FileMgr.h"
|
|
#include <map>
|
|
#include <vector>
|
|
#define WHITE RGB(255, 255, 255) // 定义 WHITE 颜色
|
|
|
|
// CCcdDataImageProcessingDlg 对话框
|
|
class CCcdDataImageProcessingDlg : public CDialogEx
|
|
{
|
|
// 构造
|
|
public:
|
|
CCcdDataImageProcessingDlg(CWnd* pParent = NULL); // 标准构造函数
|
|
|
|
// 对话框数据
|
|
#ifdef AFX_DESIGN_TIME
|
|
enum { IDD = IDD_CCDDATAIMAGEPROCESSING_DIALOG };
|
|
#endif
|
|
|
|
protected:
|
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
|
|
|
|
|
// 实现
|
|
protected:
|
|
HICON m_hIcon;
|
|
|
|
// 生成的消息映射函数
|
|
virtual BOOL OnInitDialog();
|
|
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
|
|
afx_msg void OnPaint();
|
|
afx_msg HCURSOR OnQueryDragIcon();
|
|
DECLARE_MESSAGE_MAP()
|
|
public:
|
|
CEdit m_MinEnergy1;
|
|
CEdit m_MaxEnergy1;
|
|
CEdit m_MinEnergy2;
|
|
CEdit m_MaxEnergy2;
|
|
CEdit m_MinEnergy3;
|
|
CEdit m_MaxEnergy3;
|
|
CEdit m_MinEnergy4;
|
|
CEdit m_MaxEnergy4;
|
|
CEdit m_MinEnergy5;
|
|
CEdit m_MaxEnergy5;
|
|
CEdit m_MinEnergy6;
|
|
CEdit m_MaxEnergy6;
|
|
CEdit m_MinEnergy7;
|
|
CEdit m_MaxEnergy7;
|
|
CEdit m_MinEnergy8;
|
|
CEdit m_MaxEnergy8;
|
|
CEdit m_MinEnergy9;
|
|
CEdit m_MaxEnergy9;
|
|
CEdit m_MinEnergy10;
|
|
CEdit m_MaxEnergy10;
|
|
|
|
CComboBox m_bEnergy1;
|
|
CComboBox m_bEnergy2;
|
|
CComboBox m_bEnergy3;
|
|
CComboBox m_bEnergy4;
|
|
CComboBox m_bEnergy5;
|
|
CComboBox m_bEnergy6;
|
|
CComboBox m_bEnergy7;
|
|
CComboBox m_bEnergy8;
|
|
CComboBox m_bEnergy9;
|
|
CComboBox m_bEnergy10;
|
|
|
|
CEdit m_ProportionEnergy1;
|
|
CEdit m_ProportionEnergy2;
|
|
CEdit m_ProportionEnergy3;
|
|
CEdit m_ProportionEnergy4;
|
|
CEdit m_ProportionEnergy5;
|
|
CEdit m_ProportionEnergy6;
|
|
CEdit m_ProportionEnergy7;
|
|
CEdit m_ProportionEnergy8;
|
|
CEdit m_ProportionEnergy9;
|
|
CEdit m_ProportionEnergy10;
|
|
|
|
CComboBox m_Color1;
|
|
CComboBox m_Color2;
|
|
CComboBox m_Color3;
|
|
CComboBox m_Color4;
|
|
CComboBox m_Color5;
|
|
CComboBox m_Color6;
|
|
CComboBox m_Color7;
|
|
CComboBox m_Color8;
|
|
CComboBox m_Color9;
|
|
CComboBox m_Color10;
|
|
|
|
CEdit m_CddDataPath;
|
|
CStatic m_StaticCtrl;
|
|
|
|
// 数据成员
|
|
std::vector<std::vector<std::string>> m_data; // 存储读取的数据
|
|
float m_minEnergy, m_maxEnergy;
|
|
float m_SumEnergy, m_NumEnergy;
|
|
float m_Scheme1, m_Scheme2, m_Scheme3, m_Scheme4, m_Scheme5, m_Scheme6, m_Scheme7, m_Scheme8, m_Scheme9, m_Scheme10;
|
|
public:
|
|
afx_msg void OnBnClickedImageInfoSaveButton();
|
|
afx_msg void OnBnClickedDlgMinButton();
|
|
afx_msg void OnBnClickedDlgMaxButton();
|
|
afx_msg void OnBnClickedImageGenerateButton();
|
|
afx_msg void OnBnClickedSlectPathButton();
|
|
afx_msg void OnBnClickedSaveImageButton();
|
|
|
|
public:
|
|
void OnInitEnergyCombo();
|
|
void OnInitEnergyInfo();
|
|
void OnInitCcdDataPath();
|
|
void UpProportionEnergy();
|
|
void OnInitAll();
|
|
void LoadEnergyDataFromFile(const CString& strFilePath);
|
|
void LoadData(CString cddDataPath);
|
|
void OnPaintCcd();
|
|
void SaveImage(const CString& savePath);
|
|
|
|
BOOL FileExists(const CString& strFilePath);
|
|
COLORREF GetColorFromEnergy(float energy);// 根据能量值设置颜色
|
|
};
|
|
|
|
|
|
// 颜色范围结构体
|
|
struct ColorRange {
|
|
float minEnergy;
|
|
float maxEnergy;
|
|
COLORREF color;
|
|
const int proportionEnergy;
|
|
ColorRange(float minE, float maxE, COLORREF col, const int proportionE)
|
|
: minEnergy(minE), maxEnergy(maxE), color(col), proportionEnergy(proportionE){}
|
|
};
|
|
|
|
// 颜色方案类
|
|
class ColorScheme {
|
|
public:
|
|
std::string name; // 方案的名称
|
|
std::vector<ColorRange> ranges; // 存储能量范围和对应的颜色
|
|
|
|
// 默认构造函数
|
|
ColorScheme() : name("") {}
|
|
|
|
// 带参数构造函数
|
|
ColorScheme(std::string schemeName) : name(schemeName) {}
|
|
|
|
// 添加能量范围
|
|
void addRange(float minEnergy, float maxEnergy, COLORREF color, const int proportionEnergy) {
|
|
ranges.push_back(ColorRange{ minEnergy, maxEnergy, color ,proportionEnergy});
|
|
}
|
|
|
|
// 根据能量值返回对应的颜色
|
|
COLORREF getColor(float energy);
|
|
};
|
|
|
|
// 颜色方案管理类
|
|
class ColorSchemeManager {
|
|
public:
|
|
std::map<std::string, ColorScheme> schemes;
|
|
ColorScheme* currentScheme;
|
|
|
|
ColorSchemeManager() : currentScheme(nullptr) {}
|
|
|
|
void addScheme(const std::string& name) {
|
|
schemes[name] = ColorScheme(name);
|
|
}
|
|
|
|
void setCurrentScheme(const std::string& name) {
|
|
currentScheme = &schemes[name];
|
|
}
|
|
};
|
|
|
|
extern ColorSchemeManager m_colorSchemeManager;
|
|
extern std::map<const int, int> m_proportionEnergy;
|