431 lines
11 KiB
C++
431 lines
11 KiB
C++
#ifndef PAI_FRAME_BASEFUN_H__
|
||
#define PAI_FRAME_BASEFUN_H__
|
||
|
||
#pragma once
|
||
// CBaseFunApp
|
||
// 有关此类实现的信息,请参阅 BaseFun.cpp
|
||
//
|
||
#include "BaseFunExport.h"
|
||
#include "CStringType.h"
|
||
//#include "ObjectArchive.h"
|
||
#ifndef NULL
|
||
#define NULL 0
|
||
#endif
|
||
|
||
#ifndef BOOL
|
||
#define BOOL bool
|
||
#endif
|
||
|
||
#ifndef FALSE
|
||
#define FALSE false
|
||
#endif
|
||
|
||
#ifndef TRUE
|
||
#define TRUE true
|
||
#endif
|
||
enum enumFilterType
|
||
{
|
||
fltWeak,
|
||
fltNormal,
|
||
fltStrong,
|
||
fltUDef,
|
||
fltNone,
|
||
};
|
||
BASEFUN_EXPORT float Filt(float* b, float* Fil);
|
||
|
||
BASEFUN_EXPORT void FilterCurve(
|
||
float* inpcurve,
|
||
enumFilterType Ftype,
|
||
int numrec,
|
||
float* fUDef,
|
||
float Empty);
|
||
BASEFUN_EXPORT float FilterValue(
|
||
float* inpcurve,
|
||
enumFilterType Ftype,
|
||
float* fUDef,
|
||
float Empty);
|
||
|
||
BASEFUN_EXPORT void FilterMatrixV(
|
||
float** inpcurve,
|
||
enumFilterType Ftype,
|
||
int numrec,
|
||
int numChannel,
|
||
float* fUDef,
|
||
float Empty);
|
||
BASEFUN_EXPORT void FilterMatrixH(
|
||
float** inpcurve,
|
||
enumFilterType Ftype,
|
||
int numrec,
|
||
int numChannel,
|
||
float* fUDef,
|
||
float Empty);
|
||
BASEFUN_EXPORT float Sigma(float* x,int Length, float dt, float Min = 0.0f);
|
||
BASEFUN_EXPORT float Sigma(float* x, float dt, int fromI, int toI, float Min = 0.0f);
|
||
|
||
//class CObjectArchive;
|
||
struct MD_STRUCT
|
||
{
|
||
public:
|
||
MD_STRUCT()
|
||
{
|
||
clear();
|
||
}
|
||
void clear()
|
||
{
|
||
m_size=0;
|
||
m_sdep=0;
|
||
m_edep=0;
|
||
m_rlev=0;
|
||
}
|
||
int size()
|
||
{
|
||
return m_size;
|
||
}
|
||
void copy(MD_STRUCT other)
|
||
{
|
||
m_size=other.m_size;
|
||
m_sdep=other.m_sdep;
|
||
m_edep=other.m_edep;
|
||
m_rlev=other.m_rlev;
|
||
}
|
||
int m_size;
|
||
float m_sdep;
|
||
float m_edep;
|
||
float m_rlev;
|
||
};
|
||
BASEFUN_EXPORT void DataSmooth(int cal,int mode,float *in,float *out,int n,int count);
|
||
|
||
BASEFUN_EXPORT float mean(vector<float>resultSet);
|
||
BASEFUN_EXPORT float stdev(vector<float>resultSet);
|
||
BASEFUN_EXPORT float GetMaxFreq(float m_min,float m_max,float *inFreq,int count);
|
||
BASEFUN_EXPORT int GetFreq(float*pVal,int size,float m_min,float m_max,int count,float *outFreq);
|
||
BASEFUN_EXPORT void LeastSquare(int size,float *x, float* y,float &a,float &b);
|
||
BASEFUN_EXPORT int Resamples(char *Data0,char *Data1,int N0,int N1,int RepCode,int CodeLen);
|
||
BASEFUN_EXPORT void CalculateLayer(double* DepthData,double* ResData,int nsamp,char* LayerPath,int LayerPathLeng,float MinDepth,float MaxDepth,float minLayerH);
|
||
BASEFUN_EXPORT int CalculateDataNo(double* data1,int nsamp1,double data);
|
||
BASEFUN_EXPORT void CalculateLayer(float* DepthData,float* ResData,int nsamp,char* LayerPath,int LayerPathLeng,float MinDepth,float MaxDepth,float minLayerH);
|
||
BASEFUN_EXPORT int CalculateDataNo(float* data1,int nsamp1,double data);
|
||
BASEFUN_EXPORT float* AutoCreateLayers(float *ldepth,float*grm,int lnsamp,float minceng,int &count,float gryz=5,int n=10,int isdellerr=true);
|
||
BASEFUN_EXPORT void valueperlayers(float *csdata,int cs,float *grm,float*dep,int mpoint,float *resc,float*res,float gryz,int isDelerr=true);
|
||
BASEFUN_EXPORT float lst(int code,int point,float *data,char *fieldname,char *formu,float *value,float rlev);
|
||
BASEFUN_EXPORT void CalTextAlign(int & hAlign, int &vAlign,bool isRot);
|
||
BASEFUN_EXPORT void removeStr(QString &des,QString bChar,QString EChar);
|
||
BASEFUN_EXPORT void removeStr(char*des,QString bChar,QString EChar);
|
||
|
||
///360度插值
|
||
BASEFUN_EXPORT double GetData(int repCode,char *buffer,int repLen);
|
||
BASEFUN_EXPORT void SetData(int repCode,char *buffer,double yy);
|
||
BASEFUN_EXPORT void CalTextWrap( QString &SrcText,double width,QFont font,QString &OutText,double &height,bool IsWellSectonHorizonLayout );
|
||
|
||
BASEFUN_EXPORT int Resamples(float *InData,float *OutData,float InN,float OutN);
|
||
BASEFUN_EXPORT int akima (float *x,float *y,int nx,float *c);
|
||
BASEFUN_EXPORT int cubspl (float x[],float y[],int nx,float c[]);
|
||
BASEFUN_EXPORT int spline(float x[],float y[], int n,float yp1, float ypn,float y2[]);
|
||
BASEFUN_EXPORT int intpol (float *x,float *y,int n,int m,float *u,float *v,int mode);
|
||
class DOUBLEPROPERTY
|
||
{
|
||
public:
|
||
DOUBLEPROPERTY(int size)
|
||
{
|
||
SetSize(size);
|
||
}
|
||
DOUBLEPROPERTY()
|
||
{
|
||
m_size=0;
|
||
m_vProperty=NULL;
|
||
}
|
||
~DOUBLEPROPERTY()
|
||
{
|
||
clear();
|
||
}
|
||
public:
|
||
//BASEFUN_EXPORT virtual bool Serialize( CObjectArchive &ar );
|
||
void resize(int size)
|
||
{
|
||
SetSize(size);
|
||
}
|
||
void copy(const DOUBLEPROPERTY *other)
|
||
{
|
||
m_size=other->m_size;
|
||
if(m_size>0) {
|
||
if(m_vProperty) delete m_vProperty;
|
||
m_vProperty=new double[m_size];
|
||
memmove(m_vProperty,other->m_vProperty,sizeof(double)*m_size);
|
||
}
|
||
else {
|
||
m_size=0;
|
||
if(m_vProperty) delete []m_vProperty;
|
||
m_vProperty=NULL;
|
||
}
|
||
}
|
||
|
||
void SetSize(int size)
|
||
{
|
||
if(size>0) {
|
||
if(m_vProperty) {
|
||
if(size!=m_size) {
|
||
double* old_mem = m_vProperty;//(float *)realloc(m_vProperty, sizeof(float)*size);
|
||
m_vProperty = new double[size];//new_mem;
|
||
if(size>m_size) {
|
||
memset(&m_vProperty[m_size],0,sizeof(double)*(size-m_size));
|
||
memmove(m_vProperty,old_mem,sizeof(double)*m_size);
|
||
}
|
||
delete []old_mem;
|
||
}
|
||
}
|
||
else {
|
||
m_vProperty =new double[size];
|
||
// (double *)malloc(sizeof(double)*size);
|
||
// memset(m_vProperty,0,sizeof(double)*size);
|
||
}
|
||
m_size=size;
|
||
}
|
||
else {
|
||
m_size=0;
|
||
delete []m_vProperty;
|
||
m_vProperty=NULL;
|
||
}
|
||
}
|
||
void clear()
|
||
{
|
||
m_size=0;
|
||
if(m_vProperty) {
|
||
delete []m_vProperty;
|
||
m_vProperty=NULL;
|
||
}
|
||
}
|
||
int size()
|
||
{
|
||
return m_size;
|
||
}
|
||
/* DOUBLEPROPERTY operator =(const DOUBLEPROPERTY &other)
|
||
{
|
||
m_size=other.m_size;
|
||
if(m_size>0) {
|
||
m_vProperty=new double[m_size];
|
||
memmove(m_vProperty,other.m_vProperty,sizeof(double)*m_size);
|
||
}
|
||
else {
|
||
m_size=0;
|
||
if(m_vProperty) delete m_vProperty;
|
||
m_vProperty=NULL;
|
||
}
|
||
}
|
||
*/
|
||
bool empty()
|
||
{
|
||
return !m_size;
|
||
}
|
||
int m_size;
|
||
double *m_vProperty;
|
||
} ;
|
||
class FLOATPROPERTY
|
||
{
|
||
public:
|
||
FLOATPROPERTY(int size)
|
||
{
|
||
SetSize(size);
|
||
}
|
||
FLOATPROPERTY()
|
||
{
|
||
m_size=0;
|
||
m_vProperty=NULL;
|
||
}
|
||
~FLOATPROPERTY()
|
||
{
|
||
clear();
|
||
}
|
||
public:
|
||
//BASEFUN_EXPORT virtual bool Serialize( CObjectArchive &ar );
|
||
void copy(const FLOATPROPERTY *other)
|
||
{
|
||
m_size=other->m_size;
|
||
if(m_size>0) {
|
||
if(m_vProperty) delete m_vProperty;
|
||
m_vProperty=new float[m_size];
|
||
memmove(m_vProperty,other->m_vProperty,sizeof(float)*m_size);
|
||
}
|
||
else {
|
||
m_size=0;
|
||
if(m_vProperty) delete m_vProperty;
|
||
m_vProperty=NULL;
|
||
}
|
||
}
|
||
void resize(int size)
|
||
{
|
||
SetSize(size);
|
||
}
|
||
void SetSize(int size)
|
||
{
|
||
if(size>0) {
|
||
if(m_vProperty) {
|
||
float* old_mem = m_vProperty;//(float *)realloc(m_vProperty, sizeof(float)*size);
|
||
m_vProperty = new float[size];//new_mem;
|
||
if(size>m_size) {
|
||
memset(&m_vProperty[m_size],0,sizeof(float)*(size-m_size));
|
||
memmove(m_vProperty,old_mem,sizeof(float)*m_size);
|
||
}
|
||
delete []old_mem;
|
||
}
|
||
else {
|
||
m_vProperty =new float[size];//(float *)malloc(sizeof(float)*size);
|
||
// memset(m_vProperty,0,sizeof(float)*size);
|
||
}
|
||
m_size=size;
|
||
}
|
||
else {
|
||
m_size=0;
|
||
if(m_vProperty) free(m_vProperty);
|
||
m_vProperty=NULL;
|
||
}
|
||
}
|
||
void clear()
|
||
{
|
||
static float*old=0;
|
||
m_size=0;
|
||
if((!old&&m_vProperty)||(old&&old!=m_vProperty)) {
|
||
old=m_vProperty;
|
||
delete []m_vProperty;
|
||
m_vProperty=NULL;
|
||
}
|
||
else {
|
||
m_vProperty=0;
|
||
}
|
||
}
|
||
int size()
|
||
{
|
||
return m_size;
|
||
}
|
||
FLOATPROPERTY operator =(const FLOATPROPERTY &other)
|
||
{
|
||
copy(&other);
|
||
}
|
||
FLOATPROPERTY operator =(FLOATPROPERTY &other)
|
||
{
|
||
copy(&other);
|
||
}
|
||
FLOATPROPERTY operator =(FLOATPROPERTY other)
|
||
{
|
||
copy(&other);
|
||
}
|
||
bool empty()
|
||
{
|
||
return !m_size;
|
||
}
|
||
int m_size;
|
||
float *m_vProperty;
|
||
} ;
|
||
class PFLOATPROPERTY
|
||
{
|
||
public:
|
||
PFLOATPROPERTY(int size)
|
||
{
|
||
SetSize(size);
|
||
}
|
||
PFLOATPROPERTY()
|
||
{
|
||
m_size=0;
|
||
m_vProperty=NULL;
|
||
}
|
||
~PFLOATPROPERTY()
|
||
{
|
||
clear();
|
||
}
|
||
public:
|
||
void copy(const PFLOATPROPERTY *other)
|
||
{
|
||
m_size=other->m_size;
|
||
m_vProperty=other->m_vProperty;
|
||
}
|
||
void resize(int size)
|
||
{
|
||
SetSize(size);
|
||
}
|
||
void SetSize(int size)
|
||
{
|
||
m_vProperty =NULL;//(float *)malloc(sizeof(float)*size);
|
||
m_size=size;
|
||
}
|
||
void clear()
|
||
{
|
||
m_size=0;
|
||
m_vProperty=NULL;
|
||
}
|
||
int size()
|
||
{
|
||
return m_size;
|
||
}
|
||
PFLOATPROPERTY operator =(const PFLOATPROPERTY &other)
|
||
{
|
||
copy(&other);
|
||
}
|
||
PFLOATPROPERTY operator =(PFLOATPROPERTY &other)
|
||
{
|
||
copy(&other);
|
||
}
|
||
PFLOATPROPERTY operator =(PFLOATPROPERTY other)
|
||
{
|
||
copy(&other);
|
||
}
|
||
bool empty()
|
||
{
|
||
return !m_size;
|
||
}
|
||
int m_size;
|
||
float *m_vProperty;
|
||
} ;
|
||
//#define PFLOATPROPERTY FLOATPROPERTY
|
||
typedef struct
|
||
{
|
||
char characterization[20];//信息描述
|
||
int SearchMode;//搜索域(0,全范围搜索;1,定位搜索;2,在第1搜索基础上,加偏移定位搜索)
|
||
int start;//起始点
|
||
int end;//终止点
|
||
char ValueType[10];//值类型
|
||
char ValueMin[20];//最小值
|
||
char ValueMax[20];//最大值
|
||
}TERM;
|
||
typedef struct
|
||
{
|
||
CString FormatName;
|
||
int TermNum;
|
||
TERM *m_Term;
|
||
}DATAFORMATMESSAGE;
|
||
int BASEFUN_EXPORT IsNumberic(QString src);
|
||
void BASEFUN_EXPORT PutScanDepthMes(char *Message,float sdep,float edep,char *outfilename=NULL);
|
||
void BASEFUN_EXPORT GetTranMes(char *p,float *x,float *y,float *outsdep,float *outedep);
|
||
void BASEFUN_EXPORT Procgress(float sdep,float edep,float rlev);
|
||
float BASEFUN_EXPORT pe_axp_(int *cc);
|
||
int BASEFUN_EXPORT int32_pe_axp_(int *number);
|
||
short int BASEFUN_EXPORTint16_pe_axp_(short int *number);
|
||
int BASEFUN_EXPORT GetBeginPosit(char *FileName,char* FormatName);
|
||
int BASEFUN_EXPORT GetPos(DATAFORMATMESSAGE ms,char *buf);
|
||
/*bool BASEFUN_EXPORT IsSuceed(DATAFORMATMESSAGE ms,char *buf);
|
||
void BASEFUN_EXPORT DataFormatMesBrowse(char *FileName,CStringArray &DllName);*/
|
||
char BASEFUN_EXPORT*GetBinDir(char *str);
|
||
CString BASEFUN_EXPORT GetBinDir();
|
||
|
||
//extern "C" bool PASCAL EXPORT Procgress(float sdep,float edep,float rlev);
|
||
CString BASEFUN_EXPORT GetRegDir(char *Name);
|
||
void BASEFUN_EXPORT CreateDir(char *buf);
|
||
bool BASEFUN_EXPORT HaveSameCurve(int Numlog,int *OutCurveNo,char **OutCurve);
|
||
bool BASEFUN_EXPORT IsNum(CString str);
|
||
bool BASEFUN_EXPORT MiddleSmooth(float* _SourceData,int Count,int WindowLen);
|
||
int BASEFUN_EXPORT GetVDLDefaultColor(QColor *crColor,int nColorNum,int iMode);
|
||
QStringList BASEFUN_EXPORT GetStringList(QByteArray line,bool IsSpa=1,bool IsTab=1,bool IsCom=1,bool IsSem=1,bool DelDubSpa=1);
|
||
QStringList BASEFUN_EXPORT GetStringList(QString line,bool IsSpa,bool IsTab,bool IsCom,bool IsSem,bool DelDubSpa);
|
||
void BASEFUN_EXPORT InstValue(float outsdep,float enddepth,std::vector<float> &md,std::vector<float> &_AryCurve,std::vector<float>&curAry,float rlev,int DataPoint,bool isAngle,bool isJG);
|
||
void BASEFUN_EXPORT qsort_int(char**datx,int left,int right,int idx,int len,int pos);
|
||
void BASEFUN_EXPORT qsort(char**datx,int left,int right,int idx,int len,int pos);
|
||
void BASEFUN_EXPORT qsort(QStringList &datx,float *daty,int left,int right,int idx);
|
||
|
||
extern "C" {
|
||
int BASEFUN_EXPORT binarySearch(float*darray, int n, float data,float err);
|
||
int BASEFUN_EXPORT bSearch(double*darray, int n, double data,double err);//
|
||
void BASEFUN_EXPORT fft842(int INN, int N, float *X, float *Y);
|
||
void BASEFUN_EXPORT r2tx(int NTHPO, float *CR0, float *CI0);
|
||
void BASEFUN_EXPORT r4tx(int NTHPO, float *CR0, float *CI0);
|
||
void BASEFUN_EXPORT r8tx(int NXTLT,int NTHPO,int LENGT,float *CR0,float *CI0);
|
||
}
|
||
#endif
|