193 lines
3.7 KiB
C++
193 lines
3.7 KiB
C++
|
#pragma once
|
||
|
#include "InterfaceCal.h"
|
||
|
#include "Stdafx.h"
|
||
|
#include "TopAbs_ShapeEnum.hxx"
|
||
|
//#include "Handle_AIS_Shape.hxx" // XUEFENG DELETE 202009
|
||
|
#include "AIS_Shape.hxx" // XUEFENG ADDED 202009
|
||
|
//#include "OCCViewer.h"
|
||
|
#include "CutSurfaceAlgo.h"
|
||
|
#include "BRepOffsetAPI_Sewing.hxx"
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
extern OCCStructDataMD dataMD;
|
||
|
//extern OCCViewer myOCCViewer;
|
||
|
//vector<HullWaterPlane> vecHullWater;
|
||
|
|
||
|
|
||
|
InterfaceCal::InterfaceCal(void)
|
||
|
{
|
||
|
Init();
|
||
|
}
|
||
|
InterfaceCal::~InterfaceCal(void)
|
||
|
{}
|
||
|
|
||
|
bool InterfaceCal::CheckStep( vector<double> org, vector<double> val )
|
||
|
{
|
||
|
if(org.size() != val.size())
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
for(int i = 0; i < org.size(); i++)
|
||
|
{
|
||
|
if(org[i] != val[i])
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
bool InterfaceCal::CheckZStep( vector<double> step )
|
||
|
{
|
||
|
return CheckStep(zStep, step);
|
||
|
}
|
||
|
|
||
|
bool InterfaceCal::CheckXStep( vector<double> step )
|
||
|
{
|
||
|
return CheckStep(xStep, step);
|
||
|
}
|
||
|
|
||
|
bool InterfaceCal::CheckHeel( vector<double> step, vector<double> c, double max, double min, double dai )
|
||
|
{
|
||
|
bool bStep = CheckHeelStep(step);
|
||
|
bool bC= CheckHeelC(c);
|
||
|
bool bMax = (max == this->heelFMax);
|
||
|
bool bMin = (bMin == this->heelFMin);
|
||
|
bool bDai = (dai == this->heelDai);
|
||
|
|
||
|
return (bStep && bMin && bDai && bMax);
|
||
|
}
|
||
|
|
||
|
bool InterfaceCal::CheckTrim( vector<double> step, double max, double min, double dai )
|
||
|
{
|
||
|
bool bStep = CheckHeelStep(step);
|
||
|
bool bMax = (max == this->trimFMax);
|
||
|
bool bMin = (bMin == this->trimFMin);
|
||
|
bool bDai = (dai == this->trimDai);
|
||
|
|
||
|
return (bStep && bMin && bDai && bMax);
|
||
|
}
|
||
|
|
||
|
bool InterfaceCal::CheckHeelStep( vector<double> step )
|
||
|
{
|
||
|
return CheckStep(heelStep, step);
|
||
|
}
|
||
|
|
||
|
bool InterfaceCal::CheckHeelC(vector<double> step)
|
||
|
{
|
||
|
return CheckStep(heelC, step);
|
||
|
}
|
||
|
|
||
|
bool InterfaceCal::CheckTrimStep( vector<double> step )
|
||
|
{
|
||
|
return CheckStep(trimStep, step);
|
||
|
}
|
||
|
|
||
|
bool InterfaceCal::SetStep( vector<double>& org, vector<double> val )
|
||
|
{
|
||
|
org.clear();
|
||
|
for(int i = 0; i < val.size(); i++)
|
||
|
{
|
||
|
org.push_back(val[i]);
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
bool InterfaceCal::SetZStep( vector<double> step )
|
||
|
{
|
||
|
return SetStep(this->zStep, step);
|
||
|
}
|
||
|
|
||
|
bool InterfaceCal::SetHeel( vector<double> step, vector<double> c, double max, double min, double dai )
|
||
|
{
|
||
|
this->heelDai = dai;
|
||
|
this->heelFMax = max;
|
||
|
this->heelFMin = min;
|
||
|
return SetStep(this->heelStep, step) && SetStep(this->heelC, c);
|
||
|
}
|
||
|
|
||
|
bool InterfaceCal::SetXStep( vector<double> step )
|
||
|
{
|
||
|
return SetStep(this->xStep, step);
|
||
|
}
|
||
|
|
||
|
bool InterfaceCal::SetTrim( vector<double> step, double max, double min, double dai )
|
||
|
{
|
||
|
this->trimDai = dai;
|
||
|
this->trimFMax = max;
|
||
|
this->trimFMin = min;
|
||
|
return SetStep(this->trimStep, step);
|
||
|
}
|
||
|
|
||
|
bool InterfaceCal::IsDefineZStep()
|
||
|
{
|
||
|
return zStep.size() > 0;
|
||
|
}
|
||
|
|
||
|
bool InterfaceCal::IsDefineXStep()
|
||
|
{
|
||
|
return xStep.size() > 0;
|
||
|
}
|
||
|
|
||
|
bool InterfaceCal::IsDefineHeel()
|
||
|
{
|
||
|
return heelStep.size() > 0;
|
||
|
}
|
||
|
|
||
|
bool InterfaceCal::IsDefineTrim()
|
||
|
{
|
||
|
return trimStep.size() > 0;
|
||
|
}
|
||
|
|
||
|
void InterfaceCal::Init()
|
||
|
{
|
||
|
this->heelDai = -1;
|
||
|
this->heelFMax = -1;
|
||
|
this->heelFMin = -1;
|
||
|
this->trimFMax = -1;
|
||
|
this->trimFMin = -1;
|
||
|
this->trimDai = -1;
|
||
|
this->heelStep.clear();
|
||
|
this->trimStep.clear();
|
||
|
this->xStep.clear();
|
||
|
this->zStep.clear();
|
||
|
this->shipLength = 0;
|
||
|
this->shipWidth = 0;
|
||
|
this->t = 0;
|
||
|
}
|
||
|
|
||
|
bool InterfaceCal::CheckShipWidth( double val )
|
||
|
{
|
||
|
return abs(this->shipWidth - val) < 0.0001;
|
||
|
}
|
||
|
|
||
|
bool InterfaceCal::CheckShipLength( double val )
|
||
|
{
|
||
|
return abs(this->shipLength - val) < 0.0001;
|
||
|
}
|
||
|
|
||
|
bool InterfaceCal::CheckT( double val )
|
||
|
{
|
||
|
return abs(this->t - val) < 0.0001;
|
||
|
}
|
||
|
|
||
|
bool InterfaceCal::IsDefineBase()
|
||
|
{
|
||
|
return this->shipLength != 0 && this->shipWidth !=0;
|
||
|
}
|
||
|
|
||
|
bool InterfaceCal::SetBase( double w, double l ,double t )
|
||
|
{
|
||
|
this->shipWidth = w;
|
||
|
this->shipLength = l;
|
||
|
this->t = t;
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
bool InterfaceCal::IsDefineT()
|
||
|
{
|
||
|
return this->t !=0;
|
||
|
}
|