?? contour.h
字號:
// Contour.h: interface for the CContour class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_CONTOUR_H__7ED2ACCB_E944_4543_AF11_2762F561CF69__INCLUDED_)
#define AFX_CONTOUR_H__7ED2ACCB_E944_4543_AF11_2762F561CF69__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "ContourValues.h"
#include "GeoStruct.h"
#include "GeoData.h"
/*===================等值線類=============================*/
// CContour
//該類用于保存等值線坐標,管理等值線值,等值線追蹤,等值線繪制,等等....
//
//管理和編輯等值線值時,引用CContourValues類來完成
//在生成等值線時,引用CContourTracer等值線追蹤類來完成追蹤
//在等值線繪制時,引用CContourDrawer繪制器來繪制
//
/*==============================================================*/
typedef CArray<CGeoPoint,CGeoPoint&> CCurve; //一條等值線曲線
typedef CTypedPtrList<CPtrList, CCurve*> CCurveList; //等值線曲線鏈表(給定某值的等值線不限于一條)
typedef CTypedPtrArray<CPtrArray,CCurveList*> CContourArray;
#include "ContourDrawer.h"
class CContour
{
public:
CContour(CGeoData* pOwner=NULL);
~CContour();
//----等值線值的相關操作-------------
int GetNumberOfValues();
void AddContourValue(float newVal);
void DeleteContourValue(float oldVal);
void ReplaceContourValue(float oldVal, float newVal);
void GenerateContourValues(int numContours, float valStart, float valEnd);
CValueList& GetValueList();
float GetValue(int i);
void SetValueList(CValueList& list);
void GenerateDefaultContourValues();
void EditContourLevels(); //編輯等值線
//----------------------------
void GenerateContours();
void RemoveAllContours();
//----------和數據相關聯---------
void SetDataOwner(CGeoData* pOwner)
{
ASSERT(pOwner!=NULL); m_pDataOwner = pOwner;
}
CGeoData* GetDataOwner()
{
return m_pDataOwner;
}
//-----追蹤結果---------
CContourArray& GetContours()
{
return m_Contours;
}
//-----繪制相關---------------
void Draw(CDC* pDC,const CRect& drawRect);
BOOL IsHavingContours(){ return m_Contours.GetSize()>0;}
void ModifyColorTable(){ASSERT(m_pContourDrawer!=NULL);m_pContourDrawer->ModifyColorTable();}
BOOL IsGeneratingAgain(){return m_bReGenerated;}
private:
CContourValues m_contourValues; //管理等值線值
CContourArray m_Contours; //等值線追蹤結果放在此中
//CContourTracer* m_pContourTracer;
CContourDrawer* m_pContourDrawer;
CGeoData* m_pDataOwner;
BOOL m_bReGenerated; //指示繪制器是否需要重新生成Contour繪制對象的標志
private:
CContour(const CContour& rhs); //not implimented
CContour& operator=(const CContour& rhs);//not implimented
};
inline int CContour::GetNumberOfValues()
{
return m_contourValues.GetNumberOfValues();
}
inline void CContour::AddContourValue(float newVal)
{
m_contourValues.AddValue(newVal);
}
inline void CContour::DeleteContourValue(float oldVal)
{
m_contourValues.DeleteValue(oldVal);
}
inline void CContour::ReplaceContourValue(float oldVal, float newVal)
{
m_contourValues.ReplaceValue(oldVal,newVal);
}
inline void CContour::GenerateContourValues(int numContours, float valStart, float valEnd)
{
m_contourValues.GenerateValues(numContours,valStart,valEnd);
}
inline CValueList& CContour::GetValueList()
{
return m_contourValues.GetValueList();
}
inline float CContour::GetValue(int i)
{
return m_contourValues.GetValue(i);
}
inline void CContour::SetValueList(CValueList& list)
{
m_contourValues.RemoveAllValues();
POSITION pos = list.GetHeadPosition();
while(pos!=NULL)
{
m_contourValues.AddValue(list.GetNext(pos));
}
}
#endif // !defined(AFX_CONTOUR_H__7ED2ACCB_E944_4543_AF11_2762F561CF69__INCLUDED_)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -