// Base.h: interface for the Base class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_BASE_H__09B0A739_BD82_4BA0_BF80_AFEEFADF35D1__INCLUDED_)
#define AFX_BASE_H__09B0A739_BD82_4BA0_BF80_AFEEFADF35D1__INCLUDED_
#include "io.h"
#include <direct.h>
#include "afxtempl.h"
#include "math.h"
#include "Resource.h"
#include "shlobj.h"
struct GeoPoint2 //float
{
float x;
float y;
float z;
float p;// 属性值,误差?权?都可以保存在这里
GeoPoint2()
{
x=y=z=p=0;
}
};
struct GeoPoint
{
double x;
double y;
double z;
double p;// 属性值,误差?权?都可以保存在这里
GeoPoint()
{
x=y=z=p=0;
}
};
#define _ATX_MAX_PEAKS 4
typedef struct tagAtxHomologous{
float x1, y1; // coordinates of the base point
float x2[_ATX_MAX_PEAKS], y2[_ATX_MAX_PEAKS]; // coordinates of the candidate points
int maxw[_ATX_MAX_PEAKS]; // correlation coefficients of the candidate points
int reli; // the reliable degree
int odpl; // the actual matching index
int pnum; // the number of candidate points, no more than 10
int id;
}AtxHomologous;
enum SS_TYPE
{
ST_DB, //database
ST_DT, //dem touch
ST_GS //general settings
};
struct ProblemItem
{
CString strDescription;
GeoPoint * gp;
int iNum;
int iServirity;
ProblemItem()
{
gp=NULL;
iNum=0;
}
};
struct ProblemList
{
int iNum;
ProblemItem *pi;
ProblemList()
{
iNum=0;
pi=NULL;
}
};
typedef struct tagAtxAeroMatchPara{
int correlation_size;
int search_size;
int correlation_threshold;
int feature_size;
}AtxAeroMatchPara;
struct Risidule
{
CString * pstrRMS;
int iNum;
Risidule()
{
pstrRMS=NULL;
iNum=0;
}
};
struct DemTouchSetting
{
float fInterval ;
COLORREF crCount ;//首曲线颜色
COLORREF crIndex ; //计曲线颜色
int iContourSize; //等高线宽度
int iPointStyle; //DEM点的类型
int iPointSize; //DEM点的大小
COLORREF crPoint;
COLORREF crActivePt;
COLORREF crEditedPt;
COLORREF crFeature;
COLORREF crTriangle;
COLORREF crImportVector;
int iSelLineSize;
CString strDemPath;
CString strDemFormat;
float fDemInterval;
CString strContourPath;
CString strContourFormat; //VirtuoZo CVF,DXF
GeoPoint hotPt; //ActiveGp
float fInput; //value of input
float fWheelStep ; //step value
float fAutoSaveInterval;
int iSmoothType ; //1 --gentle ,2-- moderate , 3 --harsh
float fStartX;
float fStartY;
float fEndX;
float fEndY;
int iIndexInterval;//计曲线中首曲线条数+1
int nSelectMode;
CString strRefOrtho ;
DemTouchSetting()
{
fInterval=5;
iIndexInterval = 5;
iPointSize = 2;
iContourSize=1;
fInput=0;
fWheelStep=0.5;
fAutoSaveInterval=-1; //=-1 .AutoSave disabled
iSmoothType = 1;
crCount = RGB(255,255,255);
crIndex = RGB(0,255,0);
crPoint = RGB(0,255,0);
crEditedPt = RGB(255,0,0);
crActivePt=RGB(255,255,255);
crImportVector=RGB(0,0,255);
crTriangle = RGB(255,255,0);
crFeature = RGB(255,255,255);
hotPt.x=hotPt.y=hotPt.z=0;
fStartX=fStartY=fEndX=fEndY=-99999.0;
nSelectMode = 0;
strRefOrtho="";
}
};
struct InitialParam //初始化参数
{
DemTouchSetting dts;
DBSetting dbs;
GeneralSetting gs;
};
struct FMImage //fiducial Mask image , image is always color
{
int iID;
float fStep[2]; //
int iMode;//0--- adjust xy, 1--- adjust X 1---adjust Y, 2---adjust Z
BYTE * imageBytes;
float imageX; //FormView上的FRAME 左下角坐标x
float imageY; //FormView上的FRAME 左下角坐标y
int imageHeight;
int imageWidth;
float focusX; //focus is current hot spot of fiducial
float focusY; //It is the scanner coordinate of original image
//focus will be set by GeoBuilderInterior
int iZoomRate ;//default zoom rate
RECT m_rc;//区域在缓冲区上的坐标
enum ShowState{SW_POINT,SW_RECT,SW_NONE} m_nShowState;//显示控制标志
double m_lfAngle;//显示旋转角,基于缓冲区中心旋转
LPTSTR m_lpszTitle;//可变窗口标题
BOOL bSmooth;
FMImage()
{
imageBytes=NULL;
m_nShowState = SW_POINT;
m_lfAngle = 0;
m_lpszTitle = NULL;
iZoomRate=-99;
// m_lpszTitle="ZOOM";
iMode=0;
bSmooth = TRUE;
}
};
struct GeoLine
{
GeoPoint * gp;
int iPtNum;
int iLineType;// index ,当等高线使用时,可以作为纪录计曲线,首曲线
};
struct DISTORTION
{
double fCoff[8]; //use 5 coffecient
double lfB1;
double lfB2;
double lfP1;
double lfP2;
bool bPixelCoord; //coordinate is based on pixel
bool bOriginLT; //origin is left top
bool m_bFormula2;
GeoPoint2 * gpDistor;
int iNum;
bool bIsReady;
DISTORTION()
{
gpDistor=NULL;
iNum=0;
for(int i=0;i<8;i++)
{
fCoff[i]=0;
}
lfP2=lfP1=lfB1=lfB2=0;
bPixelCoord=0;
bOriginLT=0;
m_bFormula2=0;
}
~DISTORTION()
{
if( gpDistor && 0!=iNum )
{
delete [] gpDistor;
gpDistor = NULL;
}
}
DISTORTION( const DISTORTION & dis )
{
*this = dis;
}
DISTORTION & operator = ( const DISTORTION & dis )
{
bIsReady = dis.bIsReady;
memcpy( fCoff,dis.fCoff,sizeof(double)*8);
lfP2=dis.lfP2;
lfP1=dis.lfP1;
lfB1=dis.lfB1;
lfB2=dis.lfB2;
bPixelCoord=dis.bPixelCoord;
bOriginLT=dis.bOriginLT;
m_bFormula2=dis.m_bFormula2;
// 如果需要的话,释放当前的内存
if( 0!= iNum && NULL!=gpDistor )
{
if( iNum<dis.iNum )
{
delete [] gpDistor;
gpDistor = NULL;
iNum = 0;
}
}
iNum = dis.iNum;
if( 0!=iNum && 100>iNum )// should not be max than 100
{
if( NULL == gpDistor )
gpDistor = new GeoPoint2 [iNum];
memcpy( gpDistor, dis.gpDistor, sizeof(GeoPoint2)*iNum );
}
else
iNum = 0;
return *this;
}
};
struct FiducialMask
{
int iFiducialNum;
int nID[10];//框标序号,和相机检校文件比较使用
double lfFid_x[10]; //框标坐标系
double lfFid_y[10];
double lfScan_x[10]; //扫描坐标系
double lfScan_y[10];
bool bIsReady;
bool bIsRMK; //RMK or CMR
FiducialMask()
{
iFiducialNum=0;
bIsReady=false;
for(int i=0;i<10;i++)
{
nID[i] = i+1;
lfFid_x[i]=lfFid_y[i]=lfScan_x[i]=lfScan_y[i]=-99999;//invliad flag
}
bIsRMK=false;
}
};
struct CAMERA
{
DISTORTION dp;
double lfXO;
double lfYO;
double lfFocus;
FiducialMask fm;
bool bIsReady;
CAMERA()
{
lfXO=lfYO=0;
bIsReady=false;
}
CAMERA( const CAMERA & cam )
{
*this = cam;
}
CAMERA & operator = ( const CAMERA & cam )
{
lfXO = cam.lfXO;
lfYO = cam.lfYO;
lfFocus = cam.lfFocus;
dp = cam.dp;
fm = cam.fm;
bIsReady = cam.bIsReady;
return *this;
}
};
//This is an item stored in fiducial mask library
struct FiducialMaskItem
{
ImagePara ip;
BYTE * pData;
bool bIsReady;
FiducialMaskItem()
{
pData=NULL;
bIsReady=false;
}
};
//
class Base
{
public:
Base();
virtual ~Base();
virtual bool Init(CoreObject * pCore,CString strID)
{
return true;
}
virtual bool Run( )
{
return true;
}
void StepIt()
{
}
void SetRange(int iStart,int iEnd)
{
}
void SetStep(int iStep)
{
}
void Output2(CString strMsg)
{
}
int m_nRunning;
void Output(CString strMsg);
void EmitInstalledMessage();
void RemoveBlank_Local(CString& strInput);
void LoadCameraParameter(CString strCamera,CAMERA& cam);
bool IsControlPt(CString& strID);
unsigned char * uclloc (int n);
double * dlloc (int n);
float *flloc (int n);
short *slloc (int n);
int *illoc (int n);
unsigned char * uccalloc (int n);
int *icalloc (int n);
short *scalloc (int n);
float *fcalloc (int n);
double *dcalloc (int n);
void dsolve (double* a,double* b,double* x,int n,int wide);
void dnrml (double* aa,int n,double bb,double* a,double* b);
void dldltban2 (double* l,double* d,double* b,double* x,int n,int wide);
void eliminate(double *A,double *b,int ii,int n);
int Gauss(double *A,double *b,int n);
void Affine(double *xs,double *ys,double *xd,double *yd,int n,double *a0,double *b0);
void dldltban1 (double* a,double* d,double* l,int n,int wide);
void dzero (double* x,int n);
double GetMin(float * lfData,int iNum);
double GetMax(float * lfData,int iNum);
double GetMin(double * lfData,int iNum);
double GetMax(double * lfData,int iNum);
double GetMin(int * lfData,int iNum);
int GetMax(int * lfData,int iNum);
CString FullPathToName(CString strInput);
CString FullPathToPath2(CString strInput);
CString FullPathToPath(CString strInput);
CString FullPathToName2(CString strInput);
CString NumberToString(float lfInput);
CString NumberToString(int lfInput);
CString NumberToString(double lfInput);
CString NumberToString(double lfInput,int iRopVersion);
void rotMat(double r[3][3], double k1, double k2, double k3);
void rotMat_opk1(double * r , double k1, double k2, double k3);
void rotMat_opk(double * r[3], double k1, double k2, double k3);
void rotMat(AOP& m_aop);
void _atx_mod_arc(double& arc);
void _atx_opk_rotate_matrix(double p, double w, double k, double* r);
void _atx_pok_rotate_matrix(double p, double w, double k, double* r);
void exlij(double *A,double *b,int li,int lj,int n);
int findlm(double *A,int ic,int n,double *maxx);
CString m_strBlockDir;
};
#endif // !defined(AFX_BASE_H__09B0A739_BD82_4BA0_BF80_AFEEFADF35D1__INCLUDED_)
9 个解决方案
#1
我试过将结构体定义在IDL。h里面但是会出现与规则dll里面重复定义情况 。不定义在提供接口时候不存在此类型。真是闹心
#2
新建ATL COM工程,然后把dll代码导入。接口定义COM类型,内部转换为dll结构体类型
#4
redui的SDK包是?没找到
#5
不在idl定义结构的话 。在接口中怎么返回我需要的结构啊?难道在定义一个接口专门用来存储结构??然后用接口分解出自己需要用到的数据?
#6
顶,关注下!!!
#7
我没有实现文件cpp只有头文件+lib dll,可以这样做吗?
#8
Resource.h 是什么?是资源文件使用的那个resource.h吗?
这个头文件是给其他人用的吗?
我勒个擦
这个头文件是给其他人用的吗?
我勒个擦
#9
我看了下代码,你这个程序居然在结构体里面增加了CString成员,这样程序很危险的
其实在COM组件中可以对外输出结构体的,方法如下:
1.声明结构体
typedef struct tagTagDriverAndIoAddressDefine
{
WCHAR A_DriverName[RDB_DRV_DRIVER_NAME_MAX_LEN+1];
WCHAR A_IO_Address[RDB_DRV_IO_ADDRESS_NAME_MAX_LEN+1];
}TagDriverAndIoAddressDefine;
这里一定要用到typdef,我也不知道为什么。
2.在你的接口函数中一定要有一个函数使用TagDriverAndIoAddressDefine作为函数参数
其实在COM组件中可以对外输出结构体的,方法如下:
1.声明结构体
typedef struct tagTagDriverAndIoAddressDefine
{
WCHAR A_DriverName[RDB_DRV_DRIVER_NAME_MAX_LEN+1];
WCHAR A_IO_Address[RDB_DRV_IO_ADDRESS_NAME_MAX_LEN+1];
}TagDriverAndIoAddressDefine;
这里一定要用到typdef,我也不知道为什么。
2.在你的接口函数中一定要有一个函数使用TagDriverAndIoAddressDefine作为函数参数
#1
我试过将结构体定义在IDL。h里面但是会出现与规则dll里面重复定义情况 。不定义在提供接口时候不存在此类型。真是闹心
#2
新建ATL COM工程,然后把dll代码导入。接口定义COM类型,内部转换为dll结构体类型
#3
#4
redui的SDK包是?没找到
#5
不在idl定义结构的话 。在接口中怎么返回我需要的结构啊?难道在定义一个接口专门用来存储结构??然后用接口分解出自己需要用到的数据?
#6
顶,关注下!!!
#7
我没有实现文件cpp只有头文件+lib dll,可以这样做吗?
#8
Resource.h 是什么?是资源文件使用的那个resource.h吗?
这个头文件是给其他人用的吗?
我勒个擦
这个头文件是给其他人用的吗?
我勒个擦
#9
我看了下代码,你这个程序居然在结构体里面增加了CString成员,这样程序很危险的
其实在COM组件中可以对外输出结构体的,方法如下:
1.声明结构体
typedef struct tagTagDriverAndIoAddressDefine
{
WCHAR A_DriverName[RDB_DRV_DRIVER_NAME_MAX_LEN+1];
WCHAR A_IO_Address[RDB_DRV_IO_ADDRESS_NAME_MAX_LEN+1];
}TagDriverAndIoAddressDefine;
这里一定要用到typdef,我也不知道为什么。
2.在你的接口函数中一定要有一个函数使用TagDriverAndIoAddressDefine作为函数参数
其实在COM组件中可以对外输出结构体的,方法如下:
1.声明结构体
typedef struct tagTagDriverAndIoAddressDefine
{
WCHAR A_DriverName[RDB_DRV_DRIVER_NAME_MAX_LEN+1];
WCHAR A_IO_Address[RDB_DRV_IO_ADDRESS_NAME_MAX_LEN+1];
}TagDriverAndIoAddressDefine;
这里一定要用到typdef,我也不知道为什么。
2.在你的接口函数中一定要有一个函数使用TagDriverAndIoAddressDefine作为函数参数