#pragma once #include "DataManagerGlobal.h" #include #include #include #include //#include #include #include "tangible_string_helper.h" #include "ModelData.h" /// /// 肋位/站位/坐标转换类 /// class DATAMANAGER_DLL_API_EXPORTS ChangeFSPos { private: static inline double Lbp = 0.0; static inline double stnap = 0.0; static inline double stnfp = 0.0; static inline double rfrno = 0.0; static inline int iframe = 1; static inline int nfrtab = 0; // 肋位数 static inline std::vector frno; // 肋位号 static inline std::vector frsp; // 肋距 static inline std::vector yfr; // 肋位号的纵向坐标位置 static inline double yreffr = 0.0; // 0号肋号位置 static inline double stationpos = 0.0; // 0号站号起始位置 static inline int nsp = 0; // 站数 static inline std::vector sno; // 站号 static inline std::vector ssp; // 站距 static inline std::vector ys; // 站号的纵向坐标位置 public: static inline std::string fn = "f4"; // #region 转换函数 // from Y coord to S(Station) or F(Frame) public: static void reset(); static void gpos_lpos(double gpos, int Ref, std::string &tlpos); static void lpos_gpos(const std::string &lpos, double &vgpos); // static void Frout(double gpos, ref double Vlpos, ref double Add) //{ // double Afrsp, Apos, Afr1; // int Afrno, Sign, I; // double[] Dfr1 = new double[nfrtab + 2]; // Vlpos = 0; // Add = 0; // if (nfrtab == 0) // { // throw new Exception("未定义肋位,清先定义肋位!"); // } // Sign = 2 * iframe - 1; // if (nfrtab == 0) // return; // double ystart = yfr[1]; // for (I = 2; I <= nfrtab; I++) // Dfr1[I] = Sign * (yfr[I] - ystart); // Dfr1[nfrtab + 1] = Dfr1[nfrtab - 1] + (frno[nfrtab] - frno[nfrtab - 1]) * frsp[nfrtab]; // Apos = Sign * (gpos - ystart); // Afr1 = Dfr1[2]; // Afrsp = frsp[1]; // Afrno = frno[1]; // for (I = 1; I <= (nfrtab); I++) // { // Afr1 = Dfr1[I + 1]; // Afrsp = frsp[I]; // Afrno = frno[I]; // if (Apos <= Afr1) // break; // } // if (I >nfrtab) // { // I = nfrtab; // } // Vlpos = Afrno + (Apos - Dfr1[I]) / Afrsp; // Add = Sign * FNFract((Vlpos)) * Afrsp; // if (Math.Abs(Math.Abs(Add) - Afrsp) < 0.0005) // { // Vlpos = Vlpos + 1; // Add = 0; // } // if (Math.Abs(Add) < 0.0005) Add = 0; // if (Math.Floor(Vlpos + 0.001) > Math.Floor(Vlpos)) // Vlpos = Vlpos + 0.00001; // Vlpos = Math.Floor(Vlpos); //} /// /// 纵坐标转换成肋位号 /// /// /// /// /// static bool Frout(double gpos, double &Vlpos, double &Add); static double FNFract(double X); static double FNFract_(double X); static void frin(double vlpos, double add, double &gpos, int iframe, double rfrno, double Yreffr, double nfrtab, std::vector &frno, std::vector &yfr, std::vector &frsp); static int fnmax(int X1, int X2); /// /// 纵坐标转换成站号 /// /// /// /// /// static bool Sout(double gpos, double &Vlpos, double &Add); /// /// 站号转换成纵坐标 /// /// /// /// static bool Sin(double vlpos, double add, double &gpos); static bool ResetS(double &vlpos, double &add); // #endregion // #region 对外接口 /// /// Y坐标表示 可输入以 "F"、"S","M"表示的坐标,返回纵向坐标位置 /// /// /// public: static double ShowX(const std::string &str); /// /// 返回肋位号表示(#...) /// /// 参数输入纵向坐标位置,不能输入含字母的数据 /// static std::string ShowF_Sharp(std::string &str); /// /// 返回肋位号表示(F...) /// /// 参数输入纵向坐标位置,不能输入含字母的数据 /// static std::string ShowF(std::string str); //'返回用站号表示的坐标, 参数输入纵向坐标位置,不能输入含字母的数据 static std::string ShowS(std::string str); //'返回用站号表示的坐标, 参数输入纵向坐标位置,不能输入含字母的数据 static std::string ShowNonPlusS(std::string &str); /// /// 获取肋位和站号计算所需数据 /// /// static void ChangeFSPos::SetSecConvert(ModelData *model); /// /// 获取肋位坐标集合 /// /// static std::vector GetFX(); /// /// 获取站位坐标集合 /// /// static std::vector GetSX(); // #endregion // #region 例子调用 /* ChangeFSPos cfspos = new ChangeFSPos(); cfspos.setSecConvert(); string a = cfspos.showY("F 1+0.023"); string b = cfspos.showF("123.123"); string c = cfspos.showS("205.222"); MessageBox.Show(textBox3.Text);*/ // #endregion };