|
|
|
|
|
#pragma once
|
|
|
|
|
|
#include "item.h"
|
|
|
|
|
|
#include "GridAlgoInterpolator.h"
|
|
|
|
|
|
|
|
|
|
|
|
namespace NItem
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
#define MESH_DEFAULT 0
|
|
|
|
|
|
#define MESH_CREATE_CONTOUR 1
|
|
|
|
|
|
#define MESH_EDIT_NODE 2 //<2F><><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5>༭
|
|
|
|
|
|
#define MESH_HISTOGRAM 3 //ͳ<><CDB3>ͼ
|
|
|
|
|
|
#define MESH_GET_RANGE 4 //<2F><><EFBFBD><EFBFBD>Zֵ<5A><D6B5>Χ,<2C>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>Чֵ
|
|
|
|
|
|
#define MESH_GRID_SMOOTH 5 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CItemMesh : public CItem
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
CItemMesh(CSigmaDoc* ppDoc);
|
|
|
|
|
|
virtual ~CItemMesh(void);
|
|
|
|
|
|
//CDC* m_pDrawDC;
|
|
|
|
|
|
//virtual void OnDraw(CXyDC* pDC);
|
|
|
|
|
|
void OnLButtonDown(CDC * pDC, UINT nFlags, CPoint point, int vk) override;
|
|
|
|
|
|
int OnMouseMove(CDC * pDC, UINT nFlags, CPoint point) override;
|
|
|
|
|
|
void SetPos(POSITION pos) override;
|
|
|
|
|
|
CMesh* GetMesh(void);
|
|
|
|
|
|
|
|
|
|
|
|
void SaveAs(COne* pOne, LPCTSTR filePath, int index);
|
|
|
|
|
|
void SaveAsOnlyData(COne* pOne, LPCTSTR filePath);
|
|
|
|
|
|
wchar_t * GetInformationForGeneratingContour();
|
|
|
|
|
|
bool CreateContour(COne* pOne, char * infoString);
|
|
|
|
|
|
//BOOL InitPropertyGridMesh(CXTPPropertyGrid& grid);
|
|
|
|
|
|
bool GridPointNoExist(UINT nFlags, CPoint point);
|
|
|
|
|
|
CString GetGridValue(UINT nFlags, CPoint point);
|
|
|
|
|
|
//ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
bool GridSmooth(COne* pOne, double coefficient, int smoothNumber);
|
|
|
|
|
|
void OnDraw(CXyDC* pDC) override;
|
|
|
|
|
|
void OnDraw(CXyDC* pXyDC, CDC* pDC) override;
|
|
|
|
|
|
void EditNode(CSigmaView* pView, CDC *pDC, CRect rt);
|
|
|
|
|
|
bool FindNodeLocation(CDC *pDC, CPoint point, int& locationX, int& locationY);
|
|
|
|
|
|
void Histogram(void);
|
|
|
|
|
|
void ConfirmGridBtn();
|
|
|
|
|
|
int GetEditMode(void);
|
|
|
|
|
|
//<2F><>һ<EFBFBD><D2BB>
|
|
|
|
|
|
bool GridNormalization(COne* pOne);
|
|
|
|
|
|
|
|
|
|
|
|
bool GridGenerationBoundary(COne* pOne);
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
bool RBFGridExpansion(COne* pOne, int dx_left, int dx_right, int dy_top, int dy_bottom,
|
|
|
|
|
|
int maskRadius, double smoothing, int neighbors, int type, int numStep);
|
|
|
|
|
|
|
|
|
|
|
|
bool IDWGridExpansion(COne* pOne, int dx_left, int dx_right, int dy_top, int dy_bottom,
|
|
|
|
|
|
int maskRadius, int k, int p, int numStep);
|
|
|
|
|
|
|
|
|
|
|
|
CPositionList m_posAddList;
|
|
|
|
|
|
|
|
|
|
|
|
//for histogram
|
|
|
|
|
|
void SetHistogramRange(double zmin, double zmax);
|
|
|
|
|
|
int DeleteSelected(void);
|
|
|
|
|
|
void DrawNode(CXyDC* pDC);
|
|
|
|
|
|
void DrawNode(CXyDC* pDC, CRect rect);
|
|
|
|
|
|
void SetZValueOfNodeSelected(double v);
|
|
|
|
|
|
bool SetZOfGridPoint(double z, int row, int column);
|
|
|
|
|
|
void GetAreaAndValueForSelected(double minZ, double maxZ, double * areaOut, double * volumeOut);
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
struct ExpContext {
|
|
|
|
|
|
int oldNx, oldNy;
|
|
|
|
|
|
double oldX0, oldY0, dX, dY;
|
|
|
|
|
|
int newNx, newNy;
|
|
|
|
|
|
double newX0, newY0;
|
|
|
|
|
|
int dx_left, dx_right, dy_top, dy_bottom;
|
|
|
|
|
|
double zmin, zmax;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> & <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
bool PrepareGrid(COne* pOne, int dx_l, int dx_r, int dy_t, int dy_b,
|
|
|
|
|
|
ExpContext& ctx, CDimension2D*& pDfgNew,
|
|
|
|
|
|
std::vector<unsigned char>& baseMask,
|
|
|
|
|
|
std::vector<NItem::AlgoPoint>& validPoints);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2: <20><><EFBFBD><EFBFBD> Mask <20><><EFBFBD>ռ<EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>
|
|
|
|
|
|
void CollectTargets(const ExpContext& ctx, int maskRadius,
|
|
|
|
|
|
const std::vector<unsigned char>& baseMask,
|
|
|
|
|
|
std::vector<double>& xq, std::vector<double>& yq,
|
|
|
|
|
|
std::vector<int>& tIdx);
|
|
|
|
|
|
|
|
|
|
|
|
// һά<D2BB><CEAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㷨<EFBFBD><E3B7A8><EFBFBD><EFBFBD> ComputeDilatedMask <20><><EFBFBD><EFBFBD>)
|
|
|
|
|
|
void Dilate1D_Line(const std::vector<unsigned char>& in, std::vector<unsigned char>& out,
|
|
|
|
|
|
int width, int height, int radius, bool is_horizontal);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ͺ<EFBFBD><CDBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Mask
|
|
|
|
|
|
void ComputeDilatedMask(int nx, int ny, int radius,
|
|
|
|
|
|
const std::vector<unsigned char>& input,
|
|
|
|
|
|
std::vector<unsigned char>& output);
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
CDC * pDrawerDC;
|
|
|
|
|
|
//for histogram
|
|
|
|
|
|
void DrawHistogram(CXyDC* pDC);
|
|
|
|
|
|
bool ParseInformationOfCreatingContour(char * infoStr);
|
|
|
|
|
|
CSize8 m_zrange; //Zֵ<5A><D6B5>Χ
|
|
|
|
|
|
BOOL m_bDrawRangeZ;
|
|
|
|
|
|
//CDlgHistogram *m_pHistogramDlg;
|
|
|
|
|
|
|
|
|
|
|
|
CColorBase color;
|
|
|
|
|
|
int typeIndex; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ͣ<EFBFBD><EFBFBD><CDB8><EFBFBD><EFBFBD>
|
|
|
|
|
|
long m_levelAlpha; //<><CDB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>0-255<35><35>
|
|
|
|
|
|
CString name;
|
|
|
|
|
|
int modeFun; //ƫ<><C6AB><EFBFBD><EFBFBD>
|
|
|
|
|
|
int GetFunctionIdea(DWORD nFunMode);
|
|
|
|
|
|
DWORD GetFunctionMode(int nFunIdea);
|
|
|
|
|
|
|
|
|
|
|
|
int m_nDimensionSel; //ά<><CEAC><EFBFBD><EFBFBD>0=2D<32><44>1=3D
|
|
|
|
|
|
|
|
|
|
|
|
BOOL m_bReversal = FALSE;
|
|
|
|
|
|
BOOL m_bRuler = FALSE;
|
|
|
|
|
|
BOOL m_bUpdateRuler = FALSE;
|
|
|
|
|
|
CPoint2D m_point;
|
|
|
|
|
|
|
|
|
|
|
|
BOOL m_bShowColorPane;
|
|
|
|
|
|
|
|
|
|
|
|
int m_RulerIdea; //<2F><>ˮƽƽ<C6BD><C6BD>,ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD>,<2C><>ֱƽ<D6B1><C6BD>,<2C><>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD>
|
|
|
|
|
|
int GetRulerIdea(DWORD nMode);
|
|
|
|
|
|
DWORD GetRulerMode(int nIdea);
|
|
|
|
|
|
|
|
|
|
|
|
int m_nSelect;
|
|
|
|
|
|
|
|
|
|
|
|
//for create contour
|
|
|
|
|
|
double m_contourStep;
|
|
|
|
|
|
long m_contourMarkStep;
|
|
|
|
|
|
CString m_strLayerMark;
|
|
|
|
|
|
CString m_strLayerOther;
|
|
|
|
|
|
int m_nFaultageMode;
|
|
|
|
|
|
CString m_strFaultageFile;
|
|
|
|
|
|
CString m_strFaultageLayer;
|
|
|
|
|
|
|
|
|
|
|
|
//for node edit
|
|
|
|
|
|
BOOL m_bDrawPrevPoint;
|
|
|
|
|
|
CPoint2D m_ptPrevPoint;
|
|
|
|
|
|
void DrawFocus(CPoint2D point);
|
|
|
|
|
|
|
|
|
|
|
|
//for get Z range
|
|
|
|
|
|
CSize8 m_szInvalidateValueZ;
|
|
|
|
|
|
BOOL m_bResetZ = FALSE;
|
|
|
|
|
|
|
|
|
|
|
|
//for smooth
|
|
|
|
|
|
double m_smoothcoef; //ƽ<><C6BD>ϵ<EFBFBD><CFB5>
|
|
|
|
|
|
long m_smthtimes; //ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
CRect clientRect;
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
};
|