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.
kev/Drawer/GVision/FaultDensityLib/FltDensityAnalyzer.h

83 lines
2.3 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
#include "../BaseLib/PublicFunctions.h"
#include "../BaseLib/BaseElements.h"
#include "../BaseLib/GDfdMap.h"
#include <map>
//断层密度分析统计
class AFX_EXT_CLASS CFltDensityAnalyzer
{
public:
CFltDensityAnalyzer();
~CFltDensityAnalyzer();
void ClearAll(void);
void ClearPolygons(void);
void ClearFlts(void);
//读取断层文件到m_fltmap
bool ReadFltFile(CString strFlt);
bool ReadBorderFile(CString strBd);
//密度分布和单元多边形目录
void SetOutputPaths( CString strDenDist,CString strCellPolygons);
void SetGrid(float dx, float dy);
//读取指定层位断层 如果strlayer为空则读取所有断层
bool ReadFlts(CString strLayer = "", bool bIncludingSubLayers = true);
//读取指定层位边界
bool ReadBorder(CString strLayerBd, bool bIncludingSubLayers = true);
double CalcDensity(); // 仅计算密度
bool Execute(void);//执行读取 分析 输出任务
bool CalcAverageDensity(void); //返回平均密度 条数/平方公里
//获取与rect相交 或包含,或被包含的断层个数,存入
int GetRectFlts(const GRect8& rect, vector<GPline*>& dstflts);
void GetGridFlts(void); //获取网格断层
int CreateGridRects(void);
//写出断层网格分布数据
void WriteGridFltsInfo(void);
//写出网格单元多边形和中心点
void WriteCellPolygons(void);
double GetAverageDensity() { return m_aveDensity; }
float GetFltLength(GPline* line);
int GetLayers(vector<CString>& strlayers);
public:
float m_minFltLength;
BOOL m_bCalcWithRealArea; //按照实际单元面积计算
CString m_fileLastOpen;
private:
typedef std::list<GPline*>::iterator FLTITER;
bool ReadBorder(void);
//判断pc2是否在pc1内部若是返回1若否返回-1部分在部分不在返回2
int IsInside(GPline& pc1, GPline& pc2);
//筛除边界外的断层
void RemoveInvalidFlts(void);
//写出平均密度
bool WriteAverageDensity(double dden, CString strAveDen);
std::list<GPline*> m_flts;
std::map<GPline*, GRect8> m_fltRects; //断层与对应包络矩形的map
GPline m_border;
CString m_strFltInput;
CString m_strBorder;
CString m_strOutputDensityAverage;
CString m_strOuputDensityDistribution;
CString m_strOutputCellPolygons;
float m_fDx;
float m_fDy;
vector<GRect8> m_grdRects;
vector<GPoint3D> m_grdCenters; //网格在边界内的多边形中心点
vector<int> m_grdFltNums; //网格与断层相交的条数
vector<GPline*> m_cellPolygons; //单元多边形
double m_aveDensity; //平均密度
protected:
GDfdMap m_fltMap; //断层图
};