|
|
#pragma once
|
|
|
#include <vector>
|
|
|
#include <list>
|
|
|
#include "TBase/TObjectList.h"
|
|
|
#include "InterfaceElements.h"
|
|
|
|
|
|
|
|
|
|
|
|
/*@class: CVoronoi
|
|
|
* @desc: 用于生成voronoi图,支持断层
|
|
|
|
|
|
使用方法:
|
|
|
-----、文件方式:
|
|
|
1、//设置断层线闭合判定系数,默认首尾距离小于长度1/10为闭合(可跳过)
|
|
|
void SetFltClosingFraction(float fraction = 0.1);
|
|
|
2、调用生成函数
|
|
|
bool CreateMap(const CString& strWell, const CString& strFlt, const CString& strBorder, const CString& strOutput);
|
|
|
|
|
|
-----、内存方式:
|
|
|
1、//设置断层线闭合判定系数,默认首尾距离小于长度1/10为闭合(可跳过)
|
|
|
void SetFltClosingFraction(float fraction = 0.1);
|
|
|
2.//设置井点数据
|
|
|
void ReadWellData(std::vector<CWellPoint>& inputWells);
|
|
|
3.//生成龟背图,flts = 断层线, border = 边界
|
|
|
bool CreateMap(std::list<CPolyline>& flts, CPolyline& border);
|
|
|
4、将龟背图结果多边形输出到outputPolylines,返回多边形个数
|
|
|
int OutputResult(std::list<CPolyline>& outputPolylines);
|
|
|
|
|
|
* @date: 2023.3.11
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
class AFX_EXT_CLASS CVoronoiMap
|
|
|
{
|
|
|
public:
|
|
|
struct Edge
|
|
|
{
|
|
|
Edge(void):iw1(-1),iw2(-1){}
|
|
|
int iw1; //第一口井的序号
|
|
|
int iw2; //第二口井的序号
|
|
|
};
|
|
|
CVoronoiMap(void);
|
|
|
virtual ~CVoronoiMap(void);
|
|
|
//设置断层线闭合判定系数,默认首尾距离小于长度1/10为闭合
|
|
|
void SetFltClosingFraction(float fraction = 0.1);
|
|
|
|
|
|
//龟背图生成函数,strXyz为井点,strFlt = 断层, strBorder=边界文件,strout = 输出龟背图多边形
|
|
|
bool CreateMap(const CString& strWell, const CString& strFlt, const CString& strBorder, const CString& strOutput);
|
|
|
|
|
|
//读取井点文件,返回井点个数 格式为 "3dPoint 18019278,3596719,0 0 井x"
|
|
|
int ReadWellData(const CString& strWell);
|
|
|
//设置井点数据
|
|
|
void ReadWellData(std::vector<CWellPoint>& inputWells);
|
|
|
|
|
|
//如果已经读取完毕井点,可调用此函数生成龟背图,flts = 断层线, border = 边界
|
|
|
bool CreateMap(std::list<CPolyline>& flts, CPolyline& border);
|
|
|
//将龟背图结果多边形输出到outputPolylines,返回多边形个数
|
|
|
int OutputResult(std::list<CPolyline>& outputPolylines);
|
|
|
|
|
|
//将结果写入文件
|
|
|
bool WriteResult(CString strOutput);
|
|
|
//将结果写入文件
|
|
|
bool WriteResult(FILE* fw);
|
|
|
|
|
|
//清空m_voronoiCurves
|
|
|
void ClearVorMap(void);
|
|
|
//将生成龟背图的三角网边线全部输出到 outputTriangleLines 中
|
|
|
int OutputTriangleLines(std::list<CPolyline>& triangleLines);
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
bool CreateMap(TPtrList& flts, void* border);
|
|
|
//由给龟背图多边形包含的井点上名字
|
|
|
void AssignNames(void);
|
|
|
CWellPoint& GetWellPoint(int idx);
|
|
|
|
|
|
std::vector<CWellPoint> m_wellPoints; //所有井点
|
|
|
TPtrList m_resultPolygons; //生成的龟背图单元多边形
|
|
|
std::vector<Edge> m_edges; //龟背图所有井点和相邻井连线,即内部三角网中井点连线 2023.3.24
|
|
|
float m_fClosingFraction;
|
|
|
|
|
|
};
|
|
|
|