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.

86 lines
2.5 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 <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;
};