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.
140 lines
3.8 KiB
C++
140 lines
3.8 KiB
C++
#include "stdafx.h"
|
|
#include "DrawModel\BaseLib.h"
|
|
#include "DrawOperator\DrawLib.h"
|
|
|
|
#include <string>
|
|
|
|
#include "../FaultAmplitudeLib/FaultAmplitudeCreator.h"
|
|
#include "../BaseLib/GDfdMap.h"
|
|
#include "../DrawerIO/DrawerIO.h"
|
|
|
|
using namespace std;
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
//bool OpenFile(LPCTSTR lpszFileName, CXy* pXy);
|
|
//void Serialize(CArchive& ar, CXy* pXy);
|
|
|
|
extern "C" __declspec(dllexport)
|
|
bool CreateFaultAmplitude(LPCTSTR inputFile, LPCTSTR resultFile, LPCTSTR statisticFile,
|
|
LPCTSTR faultLayer, bool calByStep, double calStep
|
|
, double divideValue, double pillarWidth, double pillarScale, double textHeight
|
|
, int heighColor, int lowColor
|
|
, bool bLocalFltDirect
|
|
, bool bWithIncline, double inclineScale, int inclineColor // 断层倾角
|
|
, LPCTSTR surveyLayer, LPCTSTR faultNames) {
|
|
CFaultAmplitudeCreator faCreator;
|
|
//MessageBox(nullptr, inputFile, "openFile", 0);
|
|
if (faCreator.ReadDfdMap(inputFile) == false)
|
|
{
|
|
return false;
|
|
}
|
|
//MessageBox(nullptr, "Opened", "openFile", 0);
|
|
// 打开输入文件
|
|
CDrawerIO drawerIo;
|
|
CXy* pXy = new CXy;
|
|
pXy->m_bRealTimeDraw = false;
|
|
if (drawerIo.OpenFile(inputFile, pXy) == false) {
|
|
delete pXy;
|
|
return false;
|
|
}
|
|
//MessageBox(nullptr, "drawerIo.OpenFile", "openFile", 0);
|
|
CPtrList* pDataAll = pXy->GetValueList();
|
|
POSITION pos = pDataAll->GetHeadPosition();
|
|
|
|
int nEleType = 0;
|
|
COne *pOne;
|
|
CMesh* pMesh = nullptr;
|
|
bool bSuccess = false;
|
|
while (pos)
|
|
{
|
|
pOne = (COne *)(pDataAll->GetNext(pos));
|
|
nEleType = pOne->GetType();
|
|
// 网格
|
|
if (nEleType == DOUBLEFOX_MESH)
|
|
{
|
|
pMesh = (CMesh*)pOne->value;
|
|
CGrid* pGrid = pMesh->GetMesh();
|
|
faCreator.CreateDfg(pGrid->xnum(), pGrid->ynum(), pGrid->xmin(), pGrid->ymin(), pGrid->dx(), pGrid->dy()
|
|
, ((CDimension2D*)pGrid)->u);
|
|
faCreator.SetZRange(pGrid->range[0], pGrid->range[1]);
|
|
bSuccess = true;
|
|
break;
|
|
}
|
|
}
|
|
delete pXy;
|
|
|
|
faCreator.SetOutPaths(resultFile, statisticFile);
|
|
|
|
faCreator.m_strFltLayer = faultLayer;
|
|
faCreator.m_strSurveyLayer = surveyLayer;
|
|
//faCreator.m_strFltNameFile = m_strFltNameFile; // 断层名称文件
|
|
faCreator.m_iCalcMethod = calByStep?0:1; // 0=
|
|
faCreator.m_pillarStep = (float)calStep; //
|
|
faCreator.m_thresholdValue = divideValue; //
|
|
faCreator.m_clrLow = lowColor; //小
|
|
faCreator.m_clrHigh = heighColor; // 大
|
|
faCreator.m_PillarWidth = pillarWidth; // 柱
|
|
faCreator.m_PillarHeightRatio = pillarScale;
|
|
faCreator.m_TextHeight = textHeight; // 文字
|
|
faCreator.m_strFltNames = faultNames; // 断层名称
|
|
faCreator.m_bLocalFltDirect = bLocalFltDirect; // 柱子方向
|
|
faCreator.m_bWithIncline = bWithIncline; //
|
|
faCreator.m_inclineScale = inclineScale;
|
|
faCreator.m_clrIncline = inclineColor;
|
|
|
|
return faCreator.Execute();
|
|
}
|
|
//
|
|
//bool OpenFile(LPCTSTR lpszFileName, CXy* pXy)
|
|
//{
|
|
// if (pXy->ReadOtherWithExtension(lpszFileName))
|
|
// {
|
|
// return true;
|
|
// }
|
|
// CFile file;
|
|
// if (file.Open(lpszFileName, CFile::modeRead))
|
|
// {
|
|
// // m_FileName = lpszFileName;
|
|
// CArchive ar(&file, CArchive::load);
|
|
// Serialize(ar, pXy);
|
|
// ar.Close();
|
|
// }
|
|
// else
|
|
// {
|
|
// return false;
|
|
// }
|
|
// file.Close();
|
|
// return true;
|
|
//}
|
|
//
|
|
//void Serialize(CArchive& ar, CXy* pXy)
|
|
//{
|
|
// if (ar.IsStoring()) {}
|
|
// else
|
|
// {
|
|
// if (pXy == nullptr) pXy = new CXy;
|
|
// pXy->m_bRealTimeDraw = false;
|
|
// CString name = ar.GetFile()->GetFileName();
|
|
// name.MakeLower();
|
|
// CSplitPath sp(name);
|
|
//
|
|
// CString ext = sp.GetExtension();
|
|
// //ar.m_pDocument = this; // set back-pointer in archive
|
|
// if (ext == _T(".dfb") || ext == _T(".dft"))
|
|
// {
|
|
// pXy->m_version = pXy->DFB_ReadVersion(ar);
|
|
// pXy->DFB_ReadEncrypt(ar, pXy->m_version);
|
|
// if (pXy->IsEncrypted()) {
|
|
// }
|
|
// pXy->DFB_Serialize(ar, pXy->m_version);
|
|
// }
|
|
// else if (ext == ".dml" || ext == ".xml")
|
|
// pXy->DML_Read2(*(ar.GetFile()));
|
|
// else if (ext == ".pcg")
|
|
// pXy->PCG_Read2(*(ar.GetFile()));
|
|
// else
|
|
// pXy->DFD_Read2(*(ar.GetFile()));
|
|
// }
|
|
//}
|