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.
kev/Drawer/SSBase/WellPoleLib/WellCommonFunction.h

114 lines
7.2 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#ifndef WellCOMMONFUNCTION_H
#define WellCOMMONFUNCTION_H
#pragma once
#include "NGraphExtend.h"
#include "WellStructDefine.h"
#include "xyDCExt.h"
#include "WellSymbolLibUtility.h"
namespace nsWellPoleFunc
{
extern AFX_EXT_API CString SetUnityTitleCRLF(CString &title); //将\r 或\n 等处理成标准的\r\n
extern AFX_EXT_API void SetUnityFontWidth_Height(GDFLOGFONTEXT& gdffont,BOOL bHbase = FALSE);
extern AFX_EXT_API void WellExtentObjMoveToPoint(CXyDC* pDC, double ptx,double pty, std::vector<COne*>& wellExtendObjs);
extern AFX_EXT_API BOOL GetLineWithSegmentPt(BOOL bV, double k, double lpx, double lpy,
double sx1, double sy1, double sx2, double sy2, double &rx, double &ry);
extern AFX_EXT_API double getPointsLength(dfPoint* ptArrs, int num);
extern AFX_EXT_API double getTwoPtLength(double x1, double y1, double x2, double y2);
extern AFX_EXT_API void WriteDML_Head_Xmlns(CFile& fw);
extern AFX_EXT_API void WriteDML_Head_Version(CFile& fw);
extern AFX_EXT_API void SetSymbolDrawForXy(CXy* pXy);
extern AFX_EXT_API void PtRotatePt(float angle, float x1, float y1, float centerX, float centerY, float &rX, float & rY);//顺时针旋转
extern AFX_EXT_API CRect8 GetCurveExRect(CCurveEx curve);
extern bool RectContainRect(CRect8& ContainRect, CRect8& smallRect);
extern AFX_EXT_API void GetLineRect(CPoint2D Spt, CPoint2D Ept, CPoint2D *ptarr, double width);
extern AFX_EXT_API CPoint2D GetVPt_Line(double x1, double y1, double x2, double y2, double ptx, double pty);
extern AFX_EXT_API BOOL GetVPt_LineSegment(double x1, double y1, double x2, double y2, double ptx, double pty, double &rtx, double &rty);
extern AFX_EXT_API CPoint2D GetPtAlongVector(double startx, double starty, double endx, double endy, double l, int startid);
extern BOOL IsKey(CString& strKey, LPCTSTR strValue);
extern AFX_EXT_API CPoint2D GetPtV_Vector(double ox, double oy, double startx, double starty, double endx, double endy, double l, int oid);
extern AFX_EXT_API void MakeStrToArr1(CString str, CStringArray &StrArr, CString splitStr);
extern int CurveGetCoordinate(CCurve*pCurve, int& nIndex, double location, CPoint3D& pt, bool bCalcZ = true);
extern AFX_EXT_API BOOL LineIntersect(CPoint2D &tp, CPoint2D down, CPoint2D local, CPoint2D tp1, CPoint2D tp2);
extern int Log_Aidepth_Initial_Value(double fValue);
extern AFX_EXT_API int GetVersionValue();
extern AFX_EXT_API void SetVersionValue(int nVesion);
extern float GetCurveNull();
extern void SetCurveNull(float value);
// 岩性相关的函数
//根据颜色名称得到得到颜色RGB
extern COLORREF WINAPI GetColorFromName(CString strColor);
//根据颜色RGB得到得到颜色名称
extern CString GetCodeFromName(CString strColor);
//根据岩性名称和前缀得到占的宽度
extern double GetWidthFromLithName(CString strLith, CString strFront, CString strOil);
//根据流体获得颜色
extern "C" AFX_EXT_API COLORREF WINAPI GetColorFromFluid(CString strFluid);
extern"C" AFX_EXT_API COLORREF GetMarkColor(CXy* pMark); //从一个符号中获取颜色
//2014-06-17add旧版pcg中线style转成新版pcg中线style
extern CString PCG_PennStyleTostrStyle(int style);
//表格相关的
extern "C" AFX_EXT_API int WINAPI PCG_ReadLocation(CFile &fr, CXmlParse& xp, const short &ver, double& fValue);
extern "C" AFX_EXT_API int WINAPI PCG_ReadBorder(CXmlParse& xp, const short &ver, int& nClr, int& nWidth);
extern "C" AFX_EXT_API int WINAPI PCG_ReadCell(CFile &fr, CXmlParse& xp, const short &ver, CELLSTRUCT*& pCell);
extern "C" AFX_EXT_API int WINAPI PCG_ReadColor(CXmlParse& xp, const short &ver, int& index, COLORREF& clr);
//井、图道相关
extern "C" AFX_EXT_API int WINAPI PCG_ReadFont(CXmlParse& xp, const short &ver, GDFLOGFONTEXT &gdffont);
extern "C" AFX_EXT_API int WINAPI PCG_ReadPen(CXmlParse& xp, const short &ver, GDFLOGPENEXT &gdfpen, BOOL& bClrPre);
extern "C" AFX_EXT_API int WINAPI PCG_ReadTitle(CFile &fr, const short& ver, CString &title, GDFLOGFONTEXT &gdffont, BOOL bRatioWH = FALSE);
extern int PCG_ReadGrid(CFile &fr, const short &ver, double& spacemaj, GDFLOGPENEXT &gdfpenmaj, double& spacemin, GDFLOGPENEXT &gdfpenmin);
extern AFX_EXT_API int WINAPI PCG_ReadToEndElement(CFile &fr, const short& ver, CString endStr);
extern void PCG_WriteTitleWell(CFile &fw, int nBaseTabNum, CString &title, GDFLOGFONTEXT &gdffont);
//extern void PCG_WriteFontStyle(CFile &fw,int nBaseTabNum,GDFLOGFONT &gdffont,int spaceNum);
extern "C" AFX_EXT_API void WINAPI PCG_WriteFontStyle(CFile &fw, int nBaseTabNum, GDFLOGFONTEXT &gdffont, CString strFont = "FontStyle");
extern "C" AFX_EXT_API void WINAPI PCG_WriteFont(CFile &fw, int nBaseTabNum, GDFLOGFONTEXT &gdffont);
extern AFX_EXT_API double WINAPI TransformPoundToPixel(double fPound);
extern AFX_EXT_API double WINAPI TransformPixelToPound(double fPixel);
extern void PCG_WriteWellTemplateTitle(CFile &fw, int nBaseTabNum);
//PCG_StrToStrArr从pcg文件中读取的文本字符串转化为字符串数组
extern "C" AFX_EXT_API void WINAPI PCG_StrToStrArr(CString str, CStringArray& strArr, CString strSeparator);
//上下标格式转换
extern AFX_EXT_API CString WINAPI PCG_ReadText(CString str);
extern AFX_EXT_API CString WINAPI PCG_WriteText(CString str);
extern AFX_EXT_API int PCG_ReadLargeValue(CStringArray& strArr, CFile &fr);
extern AFX_EXT_API COLORREF PCG_IndexToColor(int index);
extern AFX_EXT_API CString Bool2Str(bool boolVal);
extern AFX_EXT_API CString Bool2Str(BOOL boolVal);
extern CString GetShowLithologyName(int id);
extern CString GetShowSymbolName(int id);
extern AFX_EXT_API BOOL Image_Decode(CImageInsert* pImageIn, uint8_t* buffer, uint32_t size, uint32_t imagetype, CRect8 rect, uint32_t mode = 0); // mode=0,是否等比例缩放
extern AFX_EXT_API BOOL Image_Encode(CImageInsert* pImageIn, BYTE*& buffer, DWORD& size);
extern AFX_EXT_API BOOL LineExtendIntersect(CPoint2D &tp, CPoint2D down, CPoint2D local, CPoint2D tp1, CPoint2D tp2);
//表格相关的
extern "C" AFX_EXT_API int WINAPI PCG_ReadLocation1( CKXmlParse& xp, const short &ver, double& fValue);
extern "C" AFX_EXT_API int WINAPI PCG_ReadBorder1(CKXmlParse& xp, const short &ver, int& nClr, int& nWidth);
extern "C" AFX_EXT_API int WINAPI PCG_ReadCell1(CKXmlParse& xp, const short &ver, CELLSTRUCT*& pCell);
extern "C" AFX_EXT_API int WINAPI PCG_ReadColor1(CKXmlParse& xp, const short &ver, int& index, COLORREF& clr);
//井、图道相关
extern "C" AFX_EXT_API int WINAPI PCG_ReadFont1(CKXmlParse& xp, const short &ver, GDFLOGFONTEXT &gdffont);
extern "C" AFX_EXT_API int WINAPI PCG_ReadPen1(CKXmlParse& xp, const short &ver, GDFLOGPENEXT &gdfpen ,BOOL& bClrPre); //卡奔的颜色是#XXxxxxxx样式bClrPre是说明前两个字符串是否是FF,否则为00
extern "C" AFX_EXT_API int WINAPI PCG_ReadTitle1(CKXmlParse& xp, const short& ver, CString &title, GDFLOGFONTEXT &gdffont, BOOL bRatioWH = FALSE);
extern int PCG_ReadGrid1(CKXmlParse& xp, const short &ver, double& spacemaj, GDFLOGPENEXT &gdfpenmaj, double& spacemin, GDFLOGPENEXT &gdfpenmin);
extern AFX_EXT_API int WINAPI PCG_ReadToEndElement1(CKXmlParse& xp, const short& ver, CString endStr);
extern AFX_EXT_API int PCG_ReadLargeValue1(std::vector<CString>& strArr, CKXmlParse& xp ,BOOL bPictureData = FALSE);
//extern AFX_EXT_API CString GB2312ToUTF_8(char *pText, int pLen);
//extern AFX_EXT_API CString UTF_8ToGB2312(char *pText, int pLen);
};
using namespace nsWellPoleFunc;
#endif