|
|
|
|
|
// dllmain.cpp : <20><><EFBFBD><EFBFBD> DLL <20>ij<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>̡<EFBFBD>
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
|
|
#include <afxwin.h>
|
|
|
|
|
|
#include <afxdllx.h>
|
|
|
|
|
|
#include "FltDensityAnalyzer.h"
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
|
#define new DEBUG_NEW
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
static AFX_EXTENSION_MODULE FaultDensityLibDLL = { NULL, NULL };
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" int APIENTRY
|
|
|
|
|
|
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
|
|
|
|
|
|
{
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> lpReserved<65><64><EFBFBD>뽫<EFBFBD><EBBDAB><EFBFBD>Ƴ<EFBFBD>
|
|
|
|
|
|
UNREFERENCED_PARAMETER(lpReserved);
|
|
|
|
|
|
|
|
|
|
|
|
if (dwReason == DLL_PROCESS_ATTACH)
|
|
|
|
|
|
{
|
|
|
|
|
|
TRACE0("FaultDensityLib.DLL <20><><EFBFBD>ڳ<EFBFBD>ʼ<EFBFBD><CABC>!\n");
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>չ DLL һ<><D2BB><EFBFBD>Գ<EFBFBD>ʼ<EFBFBD><CABC>
|
|
|
|
|
|
if (!AfxInitExtensionModule(FaultDensityLibDLL, hInstance))
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD> DLL <20><><EFBFBD>뵽<EFBFBD><EBB5BD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>
|
|
|
|
|
|
// ע<><D7A2>: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ DLL <20><>
|
|
|
|
|
|
// MFC <20><><EFBFBD><EFBFBD> DLL (<28><> ActiveX <20>ؼ<EFBFBD>)<29><>ʽ<EFBFBD><CABD><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD>
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> MFC Ӧ<>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD> DllMain <20><><EFBFBD>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
|
|
|
|
|
|
// <20>Ӵ<EFBFBD><D3B4><EFBFBD>չ DLL <20><><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD><EFBFBD>С<EFBFBD> ʹ<>ô<EFBFBD><C3B4><EFBFBD>չ DLL <20><>
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD> DLL Ȼ<><C8BB>Ӧ<EFBFBD><D3A6>ʽ
|
|
|
|
|
|
// <20><><EFBFBD>øú<C3B8><C3BA><EFBFBD><EFBFBD>Գ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ DLL<4C><4C> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
// CDynLinkLibrary <20><><EFBFBD>ḽ<F3B2BBBB>ӵ<EFBFBD>
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD> DLL <20><><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>
|
|
|
|
|
|
// <20><><EFBFBD>⡣
|
|
|
|
|
|
|
|
|
|
|
|
new CDynLinkLibrary(FaultDensityLibDLL);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (dwReason == DLL_PROCESS_DETACH)
|
|
|
|
|
|
{
|
|
|
|
|
|
TRACE0("FaultDensityLib.DLL <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ!\n");
|
|
|
|
|
|
|
|
|
|
|
|
// <20>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮ǰ<D6AE><C7B0>ֹ<EFBFBD>ÿ<EFBFBD>
|
|
|
|
|
|
AfxTermExtensionModule(FaultDensityLibDLL);
|
|
|
|
|
|
}
|
|
|
|
|
|
return 1; // ȷ<><C8B7>
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
|
|
|
double CalculateFaultDensity(LPCTSTR drawFile, LPCTSTR faultLayer, LPCTSTR borderLayer
|
|
|
|
|
|
, double gridWidth, double gridHeight, double minFltLength
|
|
|
|
|
|
, bool includeSubLayers, bool byRealArea
|
|
|
|
|
|
, LPCTSTR distributionFile, LPCTSTR polygonsFile)
|
|
|
|
|
|
{
|
|
|
|
|
|
CFltDensityAnalyzer fda;
|
|
|
|
|
|
|
|
|
|
|
|
fda.ReadFltFile(drawFile);
|
|
|
|
|
|
fda.ReadFlts(faultLayer, includeSubLayers);
|
|
|
|
|
|
fda.ReadBorder(borderLayer);
|
|
|
|
|
|
|
|
|
|
|
|
fda.SetOutputPaths(distributionFile, polygonsFile);
|
|
|
|
|
|
fda.SetGrid(gridWidth, gridHeight);
|
|
|
|
|
|
fda.m_minFltLength = minFltLength;
|
|
|
|
|
|
fda.m_bCalcWithRealArea = byRealArea;
|
|
|
|
|
|
double dReturn = fda.CalcDensity();
|
|
|
|
|
|
if (distributionFile != NULL) {
|
|
|
|
|
|
fda.WriteGridFltsInfo();
|
|
|
|
|
|
}
|
|
|
|
|
|
if (polygonsFile != NULL) {
|
|
|
|
|
|
fda.WriteCellPolygons();
|
|
|
|
|
|
}
|
|
|
|
|
|
return dReturn;
|
|
|
|
|
|
}
|