#include "Stdafx.h" #include "OCCStructDataMD.h" using namespace std; class OffsetGenerate1 { public: OffsetGenerate1(void); ~OffsetGenerate1(void); public: //int HullID; //船壳ID //string StationNo[50]; //double StationPos[50]; //map mStationPos; //站的位置 CX //string WaterLineNo[50]; //double WaterLinePos[50]; //map mWaterLinePos;//水线位置 //string ProfileNO[20]; //double ProfilePos[20]; //map mProfilePos; //纵剖线位置 //int MainDeckID; //主甲板ID int UpperDeckID; //上甲板ID int FoldingLinesID[20]; //折角线 vector FoldingLines; int isBilge; //舭部是否升高 =0无 =1有 double BilgeHC; //舭部升高值 int ShipType; //船舶类型 =1 常规船型 =2 非对称船型 =4 隧道船型 int AsymmetricType; //非对称船型说明 =1 B1为右舷线型 B2为左舷线型 =-1 B2为右舷线型 B1为左舷线型 int SecBottom; //剖面底线 int Base; //基线 int Water; //水线 根据水线个数 和3进行组合 如 第13条水线 则为 313 int MainDeck; //主甲板 int UpperDeck;//上甲板 int FoldLine; //折角线 ,根据折角线个数 和6进行组合 如 第2条折角线 则为 62 int ProfileLine; //纵剖线,根据纵剖线个数 和7进行组合 如 第2条纵剖线 则为 72 /////////////////////////////////////////////////////////////////////////////////////////// vector curves; //曲线 /// /// 曲线与平面的交点 ///id定义规则 yc 20141223 /// id = abbbcddd /// a : 1 甲板 2 底线 3 基线 4 水线 /// b: 当 a=4时, bbb为水线号 /// c: 1艏部 2站 3艉部 /// d: 当c=2时,ddd为站号 /// map> OPoints; /// ///曲线的拐点[顺序延站号的递减方向记录] /// vector InflectionPoints; /// /// 曲线个数 /// int CurvesCount; ///记住纵剖面为0的纵剖线 Handle(Geom_Curve) CurProfile0; //半船壳 TopoDS_Shape halfShell; /////////// public: void GenerateOffset(); /// /// 计算站号对应的X坐标值 /// void CalculateStation(); /// /// 计算要取水线对应的Z坐标值 /// void CalculateWL(); /// /// 计算要取纵剖线对应的Y坐标值 /// void CalculateBL(); /// /// 标准型值表数据 /// void CalSTable(); /// /// 计算常规型值表数据 /// void CalRTable(); /// /// 计算非对称型值表数据 /// void CalATable(); /// /// 计算隧道型值表数据 /// vector CalTTable(); /// /// 计算水线或者纵剖线的点 /// /// 最大站点索引(全部为-1) /// 是半宽y还是高度z /// vector CalPoints(Handle_Geom_Curve curve,double df,double dl,int Flag = 0); vector CalPoints(int ID); vector CalPoints(Handle_Geom_Curve curve,gp_Pnt df,gp_Pnt dl); /// /// 计算CZ中每条水线与横剖面的交点的半宽集合 /// /// /// /// /// 计算特殊线半宽/高度 /// /// map>> CalSingleL(Geom_BSplineCurve curve); /// /// 特殊曲线上点的计算 /// /// 站号的索引 /// map> CalSPoints(Geom_BSplineCurve curve,int index = -1); /// /// 折角线的高度值--半宽计算(常规、非对称) /// /// map> CalFoldingL(Geom_BSplineCurve curve); /// /// 曲线的拐点与站号比较 /// 找出最接近的站号 /// /// 拐点集合 /// 最新近的站号索引 int FindNearStation(vector pnts); /// /// 自动拆分几何曲线(通过峰值、拐点) /// /// /// vector SplitGeomCurve(Handle(Geom_Curve) curve, vector& pnts); gp_Pln ZPlane(double z); gp_Pln YPlane(double y); gp_Pln XPlane(double x); gp_Pln YZPlane(double y, double z); void ExtracteLine(int SurfID,int Flag,double Pos,vector& CurL,vector& CurR); void ExtracteLine(int Flag,double Pos,vector& CurL,vector& CurR,vector& LPnts,vector& RPnts,int LType=0); // void ExtracteLine(Geom_BSplineCurve curve); vector ExtractePoint(Handle_Geom_Curve curve,int flag,double pos); void CalWaterLine(); //水线求点 void CalBaseLine(); //基线求点 vector CalSecBottomW(); Handle_Geom_Curve CalSecW(Handle_Geom_Curve cur); void CalMainDeck(); //主甲板 void CalUpperDeck();//上甲板 void CalDeck(); void CalAngularL(int foldingLinesID[]); //折角线 void CalSecLine(); //剖面底线 Handle_Geom_Curve CalSecWT(Handle_Geom_Curve cur); void CalProfile(); //纵剖面 int GetOffsetTableData(int upperDeckID, int foldingLinesID[], int isBilge, double BilgeHC, int shiptype, int asymmetricType, int ids[], int lens[], OffsetTablePoint *pnts); /// /// 获取曲线中直线段与曲线段的连接点 /// /// /// vector GetInflectionPoints(Handle(Geom_Curve) curve); vector GetIntersections(vector &edgeSet, vector &pointSet, int lev); vector GetEdgeSet(vector& edgeSet, double step , vector& pointSet); int GetOffsetTableData(int stationNum, double stations[],int waterlineNum,double waterlines[], int pNum[], OffsetTablePoint *pnts, OffsetTablePoint *zmaxPnts,double *zmins,OffsetTablePoint *yPnts); bool IsFindPoint(vector pSet, gp_Pnt p); /// /// 生成水线面,横剖面,纵剖面 /// /// -1 x平面 =-2 y平面 =-3 z平面 /// 位置 /// TopoDS_Face CreateFace(int flag, double pos); /// /// 求交线 /// /// /// /// vector GetSectionEdges(TopoDS_Shape shape1, TopoDS_Shape shape2); /// /// 与船壳面求交线 /// /// /// vector GetShellSectionEdges(TopoDS_Shape shape1); /// /// 线面求交点 /// /// /// vector GetSectionPoints(TopoDS_Edge edge, TopoDS_Face face); vector GetSectionPoints1(TopoDS_Edge edge, TopoDS_Shape face); vector CleanPoints(vector pSet, int flag, double pos); vector AddPoints(vector pSet1, vector pSet2); vector GetExtremePoints(vector pSet, int flag); void GetHalfShell(); int GetMarginLineleData(int lens[], OffsetTablePoint *pnts); };