COMPASSi/trunk/code/inc/OCC/OCCModeling/OffsetGenerate1.h

239 lines
8.2 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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<string,double> mStationPos; //站的位置 CX
//string WaterLineNo[50];
//double WaterLinePos[50];
//map<string,double> mWaterLinePos;//水线位置
//string ProfileNO[20];
//double ProfilePos[20];
//map<string,double> mProfilePos; //纵剖线位置
//int MainDeckID; //主甲板ID
int UpperDeckID; //上甲板ID
int FoldingLinesID[20]; //折角线
vector<Handle_Geom_BSplineCurve> 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<Handle_Geom_BSplineCurve> curves; //曲线
/// <summary>
/// 曲线与平面的交点
///id定义规则 yc 20141223
/// id = abbbcddd
/// a : 1 甲板 2 底线 3 基线 4 水线
/// b: 当 a=4时 bbb为水线号
/// c: 1艏部 2站 3艉部
/// d: 当c=2时ddd为站号
/// </summary>
map<int,vector<gp_Pnt>> OPoints;
/// <summary>
///曲线的拐点[顺序延站号的递减方向记录]
/// </summary>
vector<gp_Pnt> InflectionPoints;
/// <summary>
/// 曲线个数
/// </summary>
int CurvesCount;
///记住纵剖面为0的纵剖线
Handle(Geom_Curve) CurProfile0;
//半船壳
TopoDS_Shape halfShell;
///////////
public:
void GenerateOffset();
/// <summary>
/// 计算站号对应的X坐标值
/// </summary>
void CalculateStation();
/// <summary>
/// 计算要取水线对应的Z坐标值
/// </summary>
void CalculateWL();
/// <summary>
/// 计算要取纵剖线对应的Y坐标值
/// </summary>
void CalculateBL();
/// <summary>
/// 标准型值表数据
/// </summary>
void CalSTable();
/// <summary>
/// 计算常规型值表数据
/// </summary>
void CalRTable();
/// <summary>
/// 计算非对称型值表数据
/// </summary>
void CalATable();
/// <summary>
/// 计算隧道型值表数据
/// </summary>
vector<int> CalTTable();
/// <summary>
/// 计算水线或者纵剖线的点
/// </summary>
/// <param name="index">最大站点索引(全部为-1</param>
/// <param name="YZ">是半宽y还是高度z</param>
/// <returns></returns>
vector<gp_Pnt> CalPoints(Handle_Geom_Curve curve,double df,double dl,int Flag = 0);
vector<gp_Pnt> CalPoints(int ID);
vector<gp_Pnt> CalPoints(Handle_Geom_Curve curve,gp_Pnt df,gp_Pnt dl);
/// <summary>
/// 计算CZ中每条水线与横剖面的交点的半宽集合
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
/// <summary>
/// 计算特殊线半宽/高度
/// </summary>
/// <returns></returns>
map<int, map<int, vector<double>>> CalSingleL(Geom_BSplineCurve curve);
/// <summary>
/// 特殊曲线上点的计算
/// </summary>
/// <param name="index">站号的索引</param>
/// <returns></returns>
map<int, vector<double>> CalSPoints(Geom_BSplineCurve curve,int index = -1);
/// <summary>
/// 折角线的高度值--半宽计算(常规、非对称)
/// </summary>
/// <returns></returns>
map<int, vector<double>> CalFoldingL(Geom_BSplineCurve curve);
/// <summary>
/// 曲线的拐点与站号比较
/// 找出最接近的站号
/// </summary>
/// <param name="pnts">拐点集合</param>
/// <returns>最新近的站号索引</returns>
int FindNearStation(vector<gp_Pnt> pnts);
/// <summary>
/// 自动拆分几何曲线(通过峰值、拐点)
/// </summary>
/// <param name="curve"></param>
/// <returns></returns>
vector<Handle(Geom_Curve)> SplitGeomCurve(Handle(Geom_Curve) curve, vector<gp_Pnt>& 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<Handle(Geom_Curve)>& CurL,vector<Handle(Geom_Curve)>& CurR);
void ExtracteLine(int Flag,double Pos,vector<Handle(Geom_Curve)>& CurL,vector<Handle(Geom_Curve)>& CurR,vector<gp_Pnt>& LPnts,vector<gp_Pnt>& RPnts,int LType=0);
// void ExtracteLine(Geom_BSplineCurve curve);
vector<gp_Pnt> ExtractePoint(Handle_Geom_Curve curve,int flag,double pos);
void CalWaterLine(); //水线求点
void CalBaseLine(); //基线求点
vector<gp_Pnt> 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);
/// <summary>
/// 获取曲线中直线段与曲线段的连接点
/// </summary>
/// <param name="curve"></param>
/// <returns></returns>
vector<gp_Pnt> GetInflectionPoints(Handle(Geom_Curve) curve);
vector<gp_Pnt> GetIntersections(vector<TopoDS_Edge> &edgeSet, vector<gp_Pnt> &pointSet, int lev);
vector<TopoDS_Edge> GetEdgeSet(vector<TopoDS_Edge>& edgeSet, double step , vector<gp_Pnt>& pointSet);
int GetOffsetTableData(int stationNum, double stations[],int waterlineNum,double waterlines[], int pNum[], OffsetTablePoint *pnts, OffsetTablePoint *zmaxPnts,double *zmins,OffsetTablePoint *yPnts);
bool IsFindPoint(vector<gp_Pnt> pSet, gp_Pnt p);
/// <summary>
/// 生成水线面,横剖面,纵剖面
/// </summary>
/// <param name="flag"> -1 x平面 =-2 y平面 =-3 z平面 </param>
/// <param name="pos"> 位置 </param>
/// <returns></returns>
TopoDS_Face CreateFace(int flag, double pos);
/// <summary>
/// 求交线
/// </summary>
/// <param name="shape1"> </param>
/// <param name="shape2"> </param>
/// <returns></returns>
vector<TopoDS_Edge> GetSectionEdges(TopoDS_Shape shape1, TopoDS_Shape shape2);
/// <summary>
/// 与船壳面求交线
/// </summary>
/// <param name="shape1"> </param>
/// <returns></returns>
vector<TopoDS_Edge> GetShellSectionEdges(TopoDS_Shape shape1);
/// <summary>
/// 线面求交点
/// </summary>
/// <param name="shape1"> </param>
/// <returns></returns>
vector<gp_Pnt> GetSectionPoints(TopoDS_Edge edge, TopoDS_Face face);
vector<gp_Pnt> GetSectionPoints1(TopoDS_Edge edge, TopoDS_Shape face);
vector<gp_Pnt> CleanPoints(vector<gp_Pnt> pSet, int flag, double pos);
vector<gp_Pnt> AddPoints(vector<gp_Pnt> pSet1, vector<gp_Pnt> pSet2);
vector<gp_Pnt> GetExtremePoints(vector<gp_Pnt> pSet, int flag);
void GetHalfShell();
int GetMarginLineleData(int lens[], OffsetTablePoint *pnts);
};