|
|
#include "pch.h"
|
|
|
#include "AppFunc.h"
|
|
|
#include "Interface.h"
|
|
|
|
|
|
typedef void(*CPPCallbackMousePos)(double mouseX, double mouseY);
|
|
|
typedef void(*CPPCallbackViewStatus)(double pX, double pY, double scale);
|
|
|
|
|
|
CPPCallbackMousePos mouseMoveEvent = nullptr;
|
|
|
CPPCallbackViewStatus viewStatusEvent = nullptr;
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void SetMouseMoveEvent(CPPCallbackMousePos callback) {
|
|
|
mouseMoveEvent = callback;
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void SetViewStatusEvent(CPPCallbackViewStatus callback) {
|
|
|
viewStatusEvent = callback;
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_InitView(void* hwnd, LPCTSTR imagePath)
|
|
|
{
|
|
|
char caImagePath[256];
|
|
|
memset(caImagePath, 0, sizeof(char) * 256);
|
|
|
|
|
|
CString strImgPath(imagePath);
|
|
|
if (!strImgPath.IsEmpty()) {
|
|
|
strncpy_s(caImagePath, imagePath, strImgPath.GetLength());
|
|
|
}
|
|
|
Func_InitView(hwnd, caImagePath);
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_InitViewWithColor(void* hwnd, int r, int g, int b)
|
|
|
{
|
|
|
Func_InitViewWithColor(hwnd, r, g, b);
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_RenderView()
|
|
|
{
|
|
|
Func_RenderView();
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_ZoomView()
|
|
|
{
|
|
|
Func_ZoomView();
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
int Editor_CreateMesh(CXy* pXy, LPCTSTR contourLayer, LPCTSTR faultLayer, LPCTSTR pointLayer, LPCTSTR otherLineLayer) {
|
|
|
|
|
|
// 将网格 z 值小于 0 的设置为 0
|
|
|
POSITION meshPos = pXy->FindFirstElement(DOUBLEFOX_MESH);
|
|
|
if (meshPos == nullptr)
|
|
|
{
|
|
|
return 0;
|
|
|
}
|
|
|
COne *pOne = pXy->GetAt(meshPos);
|
|
|
CMesh* pMesh = (CMesh*)(pOne->GetValue());
|
|
|
CDimension3D* pDimension = pMesh->GetDfg();
|
|
|
int numx = pDimension->xnum();
|
|
|
int numy = pDimension->ynum();
|
|
|
double dx0 = pDimension->xmin();
|
|
|
double dy0 = pDimension->ymin();
|
|
|
double dStepX = pDimension->dx();
|
|
|
double dStepY = pDimension->dy();
|
|
|
double* pU = pDimension->u;
|
|
|
// 设置Z值范围
|
|
|
Func_SetZRange(pDimension->range[0], pDimension->range[1]);
|
|
|
|
|
|
//int nReturn = Func_LoadFile("C:\\temp\\k12.kev");
|
|
|
int nReturn = Func_CreateMesh(numx, numy, dx0, dy0, dStepX, dStepY, pU);
|
|
|
|
|
|
// 设置颜色
|
|
|
vector<ColorItem> colors;
|
|
|
int nColorCount = pMesh->color.GetCount();
|
|
|
for (int i = 0; i < nColorCount; i++) {
|
|
|
CColorItem colorMesh = pMesh->color.GetColorItem(i);
|
|
|
ColorItem colorItem;
|
|
|
colorItem.r = colorMesh.R();
|
|
|
colorItem.g = colorMesh.G();
|
|
|
colorItem.b = colorMesh.B();
|
|
|
colorItem.a = 1;
|
|
|
colorItem.c = colorMesh.m_bContinue;
|
|
|
colorItem.val = colorMesh.z;
|
|
|
colors.push_back(colorItem);
|
|
|
}
|
|
|
Func_SetColorList(colors);
|
|
|
|
|
|
// 设置断层
|
|
|
std::vector<PlineList> vecFault;
|
|
|
TakeLayerLines(pXy, faultLayer, vecFault, false);
|
|
|
if (vecFault.size() > 0)
|
|
|
{
|
|
|
Func_SetFaultList(vecFault, false);
|
|
|
}
|
|
|
|
|
|
// 设置等值线
|
|
|
std::vector<PlineList> vecContour;
|
|
|
TakeLayerLines(pXy, contourLayer, vecContour, true);
|
|
|
if (vecContour.size() > 0) {
|
|
|
Func_SetContourList(vecContour);
|
|
|
}
|
|
|
|
|
|
// 设置其它线
|
|
|
std::vector<PlineList> vecOtherLines;
|
|
|
TakeLayerLines(pXy, otherLineLayer, vecOtherLines, false);
|
|
|
if (vecOtherLines.size() > 0)
|
|
|
{
|
|
|
Func_SetOtherLines(vecOtherLines[0]);
|
|
|
}
|
|
|
|
|
|
// 设置控制点
|
|
|
if (pointLayer && lstrlen(pointLayer) > 0)
|
|
|
{
|
|
|
std::vector<ControlPoint2d> ptControl;
|
|
|
NBase::CPositionList lstPoint;
|
|
|
pXy->GetElement(pointLayer, lstPoint, true, false);
|
|
|
if (lstPoint.GetCount() > 0)
|
|
|
{
|
|
|
POSITION pos = lstPoint.GetHeadPosition();
|
|
|
POSITION pt;
|
|
|
std::string strLayer;
|
|
|
while (pos) {
|
|
|
pt = lstPoint.GetNext(pos);
|
|
|
COne *pOne = (COne *)pXy->GetAt(pt);
|
|
|
if (pOne->GetType() != DOUBLEFOX_POINT) {
|
|
|
continue;
|
|
|
}
|
|
|
CPointNameEx* pPoint = (CPointNameEx*)(pOne->GetValue());
|
|
|
Point2D pt(pPoint->x0, pPoint->y0);
|
|
|
CString cstrName = pPoint->GetName();
|
|
|
std::string strName;
|
|
|
strName.assign(cstrName.GetBuffer(), cstrName.GetLength());
|
|
|
ControlPoint2d cpt2d(pt, pPoint->z0, strName);
|
|
|
cstrName.ReleaseBuffer();
|
|
|
ptControl.push_back(cpt2d);
|
|
|
}
|
|
|
}
|
|
|
if (ptControl.size() > 0)
|
|
|
{
|
|
|
Func_SetControlPoint(ptControl);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
Func_ShowMesh(true);
|
|
|
Func_ShowMeshVertex(false);
|
|
|
Func_ZoomView();
|
|
|
return nReturn;
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_StartCommand() {
|
|
|
Func_StartCommand();
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_EndCommand() {
|
|
|
Func_EndCommand();
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_StrechUp(int ipx, int ipy, float rad, float per, int type, float wellrad =0) {
|
|
|
Func_StrechUp(ipx, ipy, rad, per, type, wellrad);
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_StrechDown(int ipx, int ipy, float rad, float per, int type, float wellrad = 0) {
|
|
|
Func_PushDown(ipx, ipy, rad, per, type, wellrad);
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_DragAway(int startx, int starty, int endx, int endy, float rad, float per, int type, float wellrad = 0)
|
|
|
{
|
|
|
Func_DragAway(startx, starty, endx, endy, rad, per, type, wellrad);
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_Smooth(int ipx, int ipy, float rad, float per, int type, float wellrad = 0)
|
|
|
{
|
|
|
Func_Smooth(ipx, ipy, rad, per, type, wellrad);
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_DrawCircle(int ipx, int ipy, float rad) {
|
|
|
Func_DrawCircle(ipx, ipy, rad);
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_ClearCircle() {
|
|
|
Func_ClearCircle();
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_OffsetFault()
|
|
|
{
|
|
|
Func_OffsetFault();
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_FreeAll() {
|
|
|
Func_FreeAll();
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
bool Editor_CanUndo()
|
|
|
{
|
|
|
return Func_CanUndo();
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
bool Editor_CanRedo()
|
|
|
{
|
|
|
return Func_CanRedo();
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_Undo() {
|
|
|
Func_Undo();
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_Redo() {
|
|
|
Func_Redo();
|
|
|
}
|
|
|
bool HaveCurveViewName(CLayer* pLayer) {
|
|
|
CHowToViewCurve* pHowToView = pLayer->HowToViewCurve;
|
|
|
if (pHowToView == nullptr || pHowToView->GetCount() == 0) {
|
|
|
return false;
|
|
|
}
|
|
|
for (int i = 0; i < pHowToView->GetCount(); i++) {
|
|
|
CCurveView* pView = pHowToView->GetAt(i);
|
|
|
if (pView->GetType() == CurveInName || pView->GetType() == CurveInNameAny) {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_DeleteArray(int64_t* array)
|
|
|
{
|
|
|
delete[] array;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 智能等网数据回写
|
|
|
*
|
|
|
* \param pXy 图件
|
|
|
* \param curveLayer 要写入的图层
|
|
|
* \param destroyArray 要移除的图元 POSITION,该图元并未被移除,要调用需要上层进行处理,同时还需要调用 Editor_DeleteArray 释放内存
|
|
|
* \param destroyLength 要移除的
|
|
|
* \param insertedArray 插入的图元 POSITION,图元已经插入,需要调用 Editor_DeleteArray 释放内存
|
|
|
* \param insertedLength
|
|
|
* \param layerName 等值线标注图层
|
|
|
* \param layerNoName 等值线无标注图层
|
|
|
* \return
|
|
|
*/
|
|
|
extern "C" __declspec(dllexport)
|
|
|
bool Editor_PushbackData(CXy * pXy, LPCTSTR curveLayer, int64_t** destroyArray, int64_t& destroyLength, int64_t** insertedArray, int64_t& insertedLength,
|
|
|
LPCTSTR layerName, LPCTSTR layerNoName) {
|
|
|
double* pValues = Func_GetValue();
|
|
|
double zMin = Func_GetZMin();
|
|
|
double zMax = Func_GetZMax();
|
|
|
|
|
|
POSITION meshPos = pXy->FindFirstElement(DOUBLEFOX_MESH);
|
|
|
if (meshPos == nullptr)
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
COne *pOne = pXy->GetAt(meshPos);
|
|
|
CMesh* pMesh = (CMesh*)(pOne->GetValue());
|
|
|
//CDimension3D* pDimension = pMesh->GetDfg();
|
|
|
CSize size = pMesh->size();
|
|
|
for (int i = 0; i < size.cx; i++) {
|
|
|
for (int j = 0; j < size.cy; j++)
|
|
|
{
|
|
|
((CMeshBase *)pMesh)->SetValue(i, j, pValues[i + j * size.cx]);
|
|
|
}
|
|
|
}
|
|
|
pMesh->SetM(zMin, zMax);
|
|
|
|
|
|
// 设置颜色
|
|
|
//double dZMinOld = 0;
|
|
|
//double dZMaxOld = 0;
|
|
|
//pMesh->color.GetZRange(dZMinOld, dZMaxOld);
|
|
|
//CArray<CColorItem, CColorItem> ColorList;
|
|
|
//vector<ColorItem> colors;
|
|
|
//int nColorCount = pMesh->color.GetCount();
|
|
|
//for (int i = 0; i < nColorCount; i++) {
|
|
|
// CColorItem colorMesh = pMesh->color.GetColorItem(i);
|
|
|
// colorMesh.z = zMin + ((zMax - zMin) * (colorMesh.z - dZMinOld) / (dZMaxOld - dZMinOld));
|
|
|
// ColorList.Add(colorMesh);
|
|
|
//}
|
|
|
//pMesh->color.SetZRange(zMin, zMax);
|
|
|
//pMesh->color.SetColor(ColorList);
|
|
|
//pMesh->UpdateColorRuler();
|
|
|
//pMesh->GetBitmap();
|
|
|
|
|
|
// 获取旧的颜色范围
|
|
|
double dZMinOld = 0;
|
|
|
double dZMaxOld = 0;
|
|
|
pMesh->color.GetZRange(dZMinOld, dZMaxOld);
|
|
|
|
|
|
// 如果旧范围和新范围不同,只更新范围,不重分配颜色
|
|
|
if (fabs(dZMinOld - zMin) > 1e-6 || fabs(dZMaxOld - zMax) > 1e-6)
|
|
|
{
|
|
|
pMesh->color.SetZRange(zMin, zMax);
|
|
|
//pMesh->UpdateColorRuler();
|
|
|
}
|
|
|
pMesh->GetBitmap();
|
|
|
|
|
|
// 等值线
|
|
|
CLayer* pLayerName = nullptr;
|
|
|
CLayer* pLayerNoName = nullptr;
|
|
|
|
|
|
pLayerName = pXy->FindLayer(layerName);
|
|
|
pLayerNoName = pXy->FindLayer(layerNoName);
|
|
|
|
|
|
if (pLayerName == nullptr || pLayerNoName == nullptr)
|
|
|
{
|
|
|
CPtrList lstLayer;
|
|
|
pXy->FindLayers(curveLayer, lstLayer, true);
|
|
|
POSITION posPos = lstLayer.GetHeadPosition();
|
|
|
while (posPos != nullptr)
|
|
|
{
|
|
|
CLayer* pLayerFind = (CLayer*)lstLayer.GetNext(posPos);
|
|
|
bool bViewName = HaveCurveViewName(pLayerFind);
|
|
|
if (bViewName)
|
|
|
{
|
|
|
pLayerName = pLayerFind;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
pLayerNoName = pLayerFind;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (pLayerNoName == nullptr&& pLayerName == nullptr) {
|
|
|
pLayerNoName = pXy->FindAddLayer(curveLayer);
|
|
|
pLayerName = pLayerNoName;
|
|
|
}
|
|
|
else if (pLayerName == nullptr) {
|
|
|
pLayerName = pLayerNoName;
|
|
|
}
|
|
|
else if (pLayerNoName == nullptr) {
|
|
|
pLayerNoName = pLayerName;
|
|
|
}
|
|
|
|
|
|
NBase::CPositionList lstPos;
|
|
|
pXy->GetElement(curveLayer, lstPos, true, false);
|
|
|
// 获取插入位置
|
|
|
POSITION posInsert = pXy->GetValueList()->GetTailPosition();
|
|
|
if (lstPos.GetCount() > 0) {
|
|
|
posInsert = lstPos.GetHead();
|
|
|
//POSITION pos = lstPos.GetHeadPosition();
|
|
|
//POSITION pt;
|
|
|
//while (pos) {
|
|
|
// pt = lstPos.GetNext(pos);
|
|
|
// pXy->RemoveAt(pt);
|
|
|
//}
|
|
|
}
|
|
|
|
|
|
std::vector<PlineList> contourList;
|
|
|
Func_GetContourList(contourList);
|
|
|
|
|
|
std::vector<POSITION> insertedPositions;
|
|
|
insertedPositions.clear();
|
|
|
|
|
|
for (int i = 0; i < contourList.size(); i++) {
|
|
|
PlineList lstLine = contourList[i];
|
|
|
std::string strLayerName = lstLine.GetName();
|
|
|
//CLayer * pLayer = pXy->FindAddLayer(strLayerName.c_str());
|
|
|
double dLayerValue = lstLine.GetValue();
|
|
|
CString strValue;
|
|
|
strValue.Format("%lg", dLayerValue);
|
|
|
vector<PlineList::Polyline2d> vctLine = lstLine.GetPaths();
|
|
|
for (int j = 0; j < vctLine.size(); j++) {
|
|
|
PlineList::Polyline2d line = vctLine[j];
|
|
|
|
|
|
CPointList pointList;
|
|
|
for (int k = 0; k < line.size(); k++)
|
|
|
{
|
|
|
dfPoint point;
|
|
|
point.x0 = line[k].x();
|
|
|
point.y0 = line[k].y();
|
|
|
pointList.AddTail(point);
|
|
|
}
|
|
|
|
|
|
CCurveEx* pCurve = new CCurveEx();
|
|
|
pCurve->SetPoints(pointList, 2);
|
|
|
pCurve->SetName(strValue);
|
|
|
|
|
|
//POSITION pos = pXy->AddElement(pCurve, DOUBLEFOX_CURVE);
|
|
|
POSITION pos = pXy->InsertElementAfter(posInsert, pCurve, DOUBLEFOX_CURVE);
|
|
|
insertedPositions.push_back(pos);
|
|
|
COne* pOne = pXy->GetAt(pos);
|
|
|
CLayer * pLayer = pLayerName;
|
|
|
if (strLayerName == "无标注") {
|
|
|
pLayer = pLayerNoName;
|
|
|
}
|
|
|
pOne->SetLayer(pLayer);
|
|
|
|
|
|
posInsert = pos;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 标记要被删除的图元
|
|
|
destroyLength = lstPos.GetCount();
|
|
|
*destroyArray = new int64_t[destroyLength];
|
|
|
|
|
|
int32_t destroyIndex = 0;
|
|
|
for (POSITION pos = lstPos.GetHeadPosition(); pos != nullptr; lstPos.GetNext(pos))
|
|
|
{
|
|
|
POSITION pt = lstPos.GetAt(pos);
|
|
|
(*destroyArray)[destroyIndex++] = reinterpret_cast<int64_t>(pt);
|
|
|
}
|
|
|
|
|
|
|
|
|
// 标记要新插入的图元
|
|
|
insertedLength = insertedPositions.size();
|
|
|
*insertedArray = new int64_t[insertedLength];
|
|
|
|
|
|
int32_t insertedIndex = 0;
|
|
|
for (POSITION pos : insertedPositions)
|
|
|
{
|
|
|
(*insertedArray)[insertedIndex++] = reinterpret_cast<int64_t>(pos);
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_ShowMesh(bool visible)
|
|
|
{
|
|
|
Func_ShowMesh(visible);
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_ShowMeshVertex(bool bShow)
|
|
|
{
|
|
|
Func_ShowMeshVertex(bShow);
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_ShowIsopleth(bool visible)
|
|
|
{
|
|
|
Func_ShowIsopleth(visible);
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_ShowControlPoint(bool visible) {
|
|
|
Func_ShowControlPoint(visible);
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_ShowFault(bool visible)
|
|
|
{
|
|
|
Func_ShowFault(visible);
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_ShowBound(bool visible) {
|
|
|
Func_ShowBound(visible);
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_ShowOtherLines(bool visible) {
|
|
|
Func_ShowOtherLines(visible);
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_GetProperty(double& isopStep, int& markStep, double& minIsop, double& maxIsop,
|
|
|
double& zMin, double& zMax) {
|
|
|
Func_GetProperty(isopStep, markStep, minIsop, maxIsop, zMin, zMax);
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_SetProperty(double isopStep, int markStep, double minIsop, double maxIsop,
|
|
|
double zMin, double zMax)
|
|
|
{
|
|
|
Func_SetProperty(isopStep, markStep, minIsop, maxIsop, zMin, zMax);
|
|
|
}
|
|
|
bool HaveCurveViewName(CXy* pxy, COne* pOne) {
|
|
|
CHowToViewCurve* pHowToView = pOne->GetLayer()->HowToViewCurve;
|
|
|
if (pHowToView == nullptr || pHowToView->GetCount()==0) {
|
|
|
return false;
|
|
|
}
|
|
|
for (int i = 0; i < pHowToView->GetCount(); i++) {
|
|
|
CCurveView* pView = pHowToView->GetAt(i);
|
|
|
if (pView->GetType() == CurveInName || pView->GetType() == CurveInNameAny) {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
void TakeLayerLines(CXy * pXy, const LPCTSTR &layerName, std::vector<PlineList> &vecPline, bool isContour)
|
|
|
{
|
|
|
if (layerName == nullptr || lstrlen(layerName) == 0)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
NBase::CPositionList lstFault;
|
|
|
pXy->GetElement(layerName, lstFault, true, false);
|
|
|
|
|
|
if (lstFault.GetCount() > 0) {
|
|
|
|
|
|
POSITION pos = lstFault.GetHeadPosition();
|
|
|
POSITION pt;
|
|
|
std::string strLayer;
|
|
|
while (pos) {
|
|
|
pt = lstFault.GetNext(pos);
|
|
|
COne *pOne = (COne *)pXy->GetAt(pt);
|
|
|
if (pOne->GetType() != DOUBLEFOX_CURVE) {
|
|
|
continue;
|
|
|
}
|
|
|
bool bViewName = HaveCurveViewName(pXy, pOne);
|
|
|
if (bViewName == true) {
|
|
|
strLayer = "标注";
|
|
|
}
|
|
|
else {
|
|
|
strLayer = "无标注";
|
|
|
}
|
|
|
CCurveEx* pCurve = (CCurveEx*)(pOne->GetValue());
|
|
|
CString cstrName = pCurve->GetName();
|
|
|
PlineList::Polyline2d pline2D;
|
|
|
|
|
|
if (isContour)
|
|
|
{ // 等值线,设置Z值和图层
|
|
|
|
|
|
if (cstrName.IsEmpty())
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
double z = _tcstod(cstrName, nullptr);
|
|
|
bool bFind = false;
|
|
|
for (size_t i = 0; i < vecPline.size(); i++) {
|
|
|
auto contourList = vecPline[i];
|
|
|
if (abs(contourList.GetValue() - z) < 1E-5) {
|
|
|
contourList.AddPath(pline2D);
|
|
|
bFind = true;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
if (bFind == false) {
|
|
|
CString cstrLayer = pOne->GetLayer()->GetName();
|
|
|
//std::string strLayer = CT2A(cstrLayer);
|
|
|
PlineList lineList;
|
|
|
lineList.AddPath(pline2D);
|
|
|
lineList.SetValue(z);
|
|
|
lineList.SetName(strLayer);
|
|
|
vecPline.push_back(lineList);
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
for (int i = 0; i < pCurve->num; i++)
|
|
|
{
|
|
|
Point2D point{ pCurve->x[i], pCurve->y[i] };
|
|
|
pline2D.push_back(point);
|
|
|
}
|
|
|
if (vecPline.size() == 0) {
|
|
|
PlineList lineList;
|
|
|
vecPline.push_back(lineList);
|
|
|
}
|
|
|
|
|
|
PlineList& lineList = vecPline[0];
|
|
|
lineList.AddPath(pline2D);
|
|
|
//lineList.SetName(strLayer);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#pragma region 二期功能接口
|
|
|
//井点Z值绑定功能
|
|
|
//这个功能支持undo/redo,可以在调用之前加Func_StartCommand,调用结束加Func_EndCommand
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_WellAdaptiveAdjust(float rad, float range, float miu)
|
|
|
{
|
|
|
Func_WellAdaptiveAdjust(rad, range, miu);
|
|
|
}
|
|
|
|
|
|
//开启查看Z值
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_EnablePickMeshZ(bool bEnable)
|
|
|
{
|
|
|
Func_EnablePickMeshZ(bEnable);
|
|
|
}
|
|
|
|
|
|
//设置井点文字颜色
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_SetWellColor(int r = 255, int g = 255, int b = 255)
|
|
|
{
|
|
|
Func_SetWellColor(r, g, b);
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_SetWellTxtSize(float size)
|
|
|
{
|
|
|
Func_SetWellTxtSize(size);
|
|
|
}
|
|
|
//填充断层
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_EnableFillFault(bool bEnable)
|
|
|
{
|
|
|
Func_EnableFillFault(bEnable);
|
|
|
}
|
|
|
|
|
|
//过滤等值线
|
|
|
//这个功能支持undo/redo,可以在调用之前加Func_StartCommand,调用结束加Func_EndCommand
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_FilterMesh(float throld)
|
|
|
{
|
|
|
Func_FilterMesh(throld);
|
|
|
}
|
|
|
|
|
|
//打开/退出绘制多边形(可以在多边形操作窗口初始化的时候打开,窗口关闭的时候退出)
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_EnableDrawPolygon(bool bEnable)
|
|
|
{
|
|
|
Func_EnableDrawPolygon(bEnable);
|
|
|
}
|
|
|
|
|
|
//多边形拉升
|
|
|
//闭合多边形后,就可以调用了
|
|
|
//per:强度,wellRad:井点约束半径。默认为0,表示不约束
|
|
|
//这个功能支持undo/redo,可以在调用之前加Func_StartCommand,调用结束加Func_EndCommand
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_StretchUpPolygon(float per, bool state, float wellRad = 0)
|
|
|
{
|
|
|
Func_StretchlUpPolygon(per, state, wellRad);
|
|
|
}
|
|
|
|
|
|
//多边形下压,用法同上
|
|
|
//这个功能支持undo/redo,可以在调用之前加Func_StartCommand,调用结束加Func_EndCommand
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_PushDownPolygon(float per, bool state, float wellRad = 0)
|
|
|
{
|
|
|
Func_PushDownPolygon(per, state, wellRad);
|
|
|
}
|
|
|
|
|
|
//多边形平滑,用法同上
|
|
|
//这个功能支持undo/redo,可以在调用之前加Func_StartCommand,调用结束加Func_EndCommand
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_SmoothPolygon(float per, bool state, float wellRad = 0)
|
|
|
{
|
|
|
Func_SmoothPolygon(per, state, wellRad);
|
|
|
}
|
|
|
|
|
|
//网格优化,用法同Func_StrechUp
|
|
|
//这个功能支持undo/redo,可以在调用之前加Func_StartCommand,调用结束加Func_EndCommand
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_OptimizeMesh(int startx, int starty, int endx, int endy, float rad, float per)
|
|
|
{
|
|
|
Func_OptimizeMesh(startx, starty, endx, endy, rad, per);
|
|
|
}
|
|
|
//获取显示位置
|
|
|
//(px,py)表示窗口左上角对应网格上的坐标
|
|
|
// scale表示网格缩放比例(一个像素多少米)
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_GetViewPos(double& px, double& py, double& scale)
|
|
|
{
|
|
|
Func_GetViewPos(px, py, scale);
|
|
|
}
|
|
|
|
|
|
//设置显示位置
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_SetViewPos(double px, double py, double scale)
|
|
|
{
|
|
|
Func_SetViewPos(px, py, scale);
|
|
|
}
|
|
|
|
|
|
//获取鼠标位置
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_GetMousePos(double& px, double& py)
|
|
|
{
|
|
|
Func_GetMousePos(px, py);
|
|
|
}
|
|
|
|
|
|
//设置鼠标位置
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_SetMousePos(double px, double py)
|
|
|
{
|
|
|
Func_SetMousePos(px, py);
|
|
|
}
|
|
|
#pragma endregion
|
|
|
|
|
|
//表达式检测
|
|
|
extern "C" __declspec(dllexport)
|
|
|
bool Editor_CompileExpressionZ(LPCTSTR expressionString)
|
|
|
{
|
|
|
char expressionStr[256];
|
|
|
memset(expressionStr, 0, sizeof(char) * 256);
|
|
|
|
|
|
CString str(expressionString);
|
|
|
if (!str.IsEmpty()) {
|
|
|
strncpy_s(expressionStr, expressionString, str.GetLength());
|
|
|
}
|
|
|
|
|
|
bool state = Func_CompileExpressionZ(expressionStr);
|
|
|
return state;
|
|
|
}
|
|
|
|
|
|
//Z值运算
|
|
|
extern "C" __declspec(dllexport)
|
|
|
bool Editor_CalculateZByExpression(LPCTSTR expressionString)
|
|
|
{
|
|
|
char expressionStr[256];
|
|
|
memset(expressionStr, 0, sizeof(char) * 256);
|
|
|
|
|
|
CString str(expressionString);
|
|
|
if (!str.IsEmpty()) {
|
|
|
strncpy_s(expressionStr, expressionString, str.GetLength());
|
|
|
}
|
|
|
|
|
|
bool state = Func_CalculateZByExpression(expressionStr);
|
|
|
return state;
|
|
|
}
|
|
|
|
|
|
//获取最小Z值
|
|
|
extern "C" __declspec(dllexport)
|
|
|
double Editor_GetZMin()
|
|
|
{
|
|
|
return Func_GetZMin();
|
|
|
}
|
|
|
|
|
|
//获取最大Z值
|
|
|
extern "C" __declspec(dllexport)
|
|
|
double Editor_GetZMax()
|
|
|
{
|
|
|
return Func_GetZMax();
|
|
|
}
|
|
|
|
|
|
//设置显示小数位数
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_SetDecimalNumber(int num)
|
|
|
{
|
|
|
Func_SetDecimalNumber(num);
|
|
|
}
|
|
|
|
|
|
//获取显示的小数位数
|
|
|
extern "C" __declspec(dllexport)
|
|
|
int Editor_GetDecimalNumber()
|
|
|
{
|
|
|
return Func_GetDecimalNumber();
|
|
|
}
|
|
|
|
|
|
//设置断层控制状态
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_SetFaultControlState(bool state)
|
|
|
{
|
|
|
Func_SetFaultControlState(state);
|
|
|
}
|
|
|
|
|
|
//获取断层控制状态
|
|
|
extern "C" __declspec(dllexport)
|
|
|
bool Editor_GetFaultControlState()
|
|
|
{
|
|
|
return Func_GetFaultControlState();
|
|
|
}
|
|
|
|
|
|
//井点校正
|
|
|
extern "C" __declspec(dllexport)
|
|
|
bool Editor_RectificationMeshWellCompute(double deltaz, int type, double factor)
|
|
|
{
|
|
|
return Func_RectificationMeshWellCompute(deltaz, type, factor);
|
|
|
}
|
|
|
|
|
|
//井点校正 线程终止
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_MeshWellThreadStop()
|
|
|
{
|
|
|
Func_MeshWellThreadStop();
|
|
|
}
|
|
|
|
|
|
//井点校正 进度
|
|
|
extern "C" __declspec(dllexport)
|
|
|
int Editor_GetWellRectificationProgress()
|
|
|
{
|
|
|
return Func_GetWellRectificationProgress();
|
|
|
}
|
|
|
|
|
|
//刷新界面
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void Editor_UpdateObjectView()
|
|
|
{
|
|
|
return Func_UpdateObjectView();
|
|
|
}
|
|
|
|