#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 vecHullWater; InterfaceCal::InterfaceCal(void) { Init(); } InterfaceCal::~InterfaceCal(void) {} bool InterfaceCal::CheckStep( vector org, vector 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 step ) { return CheckStep(zStep, step); } bool InterfaceCal::CheckXStep( vector step ) { return CheckStep(xStep, step); } bool InterfaceCal::CheckHeel( vector step, vector 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 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 step ) { return CheckStep(heelStep, step); } bool InterfaceCal::CheckHeelC(vector step) { return CheckStep(heelC, step); } bool InterfaceCal::CheckTrimStep( vector step ) { return CheckStep(trimStep, step); } bool InterfaceCal::SetStep( vector& org, vector val ) { org.clear(); for(int i = 0; i < val.size(); i++) { org.push_back(val[i]); } return true; } bool InterfaceCal::SetZStep( vector step ) { return SetStep(this->zStep, step); } bool InterfaceCal::SetHeel( vector step, vector 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 step ) { return SetStep(this->xStep, step); } bool InterfaceCal::SetTrim( vector 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; }