Files
EgtMachKernel/CamData.cpp
T
Dario Sassi bff983e12c EgtMachKernel :
- prime modifiche per tagli inclinati su esterno archi.
2020-01-20 06:52:47 +00:00

743 lines
22 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2015-2016
//----------------------------------------------------------------------------
// File : CamData.cpp Data : 24.02.16 Versione : 1.6n8
// Contenuto : Implementazione informazioni Cam di ogni movimento.
//
//
//
// Modifiche : 10.06.15 DS Creazione modulo.
// 24.02.16 DS Versione 2 (aggiunti m_nMove e m_ptCen).
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "CamData.h"
#include "/EgtDev/Include/EGkGeomDB.h"
#include "/EgtDev/Include/EGkUserObjFactory.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGnStringKeyVal.h"
using namespace std ;
//----------------------------------------------------------------------------
static int CAM_PARAM_V1 = 10 ;
static string CAM_CORR = "Corr" ;
static string CAM_TDIR = "TDir" ;
static string CAM_CDIR = "CDir" ;
static string CAM_ADIR = "ADir" ;
static string CAM_PBAS = "PBas" ;
static string CAM_FEED = "Feed" ;
static string CAM_FLAG = "Flg" ;
static string CAM_AXSTS = "AxS" ;
static string CAM_AXMSK = "AxM" ;
static string CAM_AXVAL = "AxV" ;
static int CAM_PARAM_V2 = 16 ;
static string CAM_MOVE = "Move" ;
static string CAM_PCEN = "PCen" ;
static string CAM_ACEN = "ACen" ;
static string CAM_AXMC = "AxMC" ;
static string CAM_AXMR = "AxMR" ;
static string CAM_AXAC = "AxAC" ;
static int CAM_PARAM_V3 = 18 ;
static string CAM_NDIR = "NDir" ;
static string CAM_AXND = "AxND" ;
static int CAM_PARAM_V4 = 19 ;
static string CAM_NDLT = "NDlt" ;
static int CAM_PARAM_V5 = 20 ;
static string CAM_BDIR = "BDir" ;
static int CAM_PARAM_V6 = 21 ;
static string CAM_INDEX = "Idx" ;
static int CAM_PARAM_V7 = 22 ;
static string CAM_ORIGFEED = "OrFeed" ;
static int CAM_TOTPARAM =CAM_PARAM_V7 ;
//----------------------------------------------------------------------------
USEROBJ_REGISTER( "EMkCamData", CamData) ;
//----------------------------------------------------------------------------
const string&
CamData::GetClassName( void) const
{
return USEROBJ_GETNAME( CamData) ;
}
//----------------------------------------------------------------------------
CamData*
CamData::Clone( void) const
{
// alloco oggetto
CamData* pCam = new(nothrow) CamData ;
// eseguo copia dei dati
if ( pCam != nullptr) {
try {
pCam->m_nOwnerId = GDB_ID_NULL ;
pCam->m_pGeomDB = nullptr ;
pCam->m_nMove = m_nMove ;
pCam->m_nCorre = m_nCorre ;
pCam->m_vtTool = m_vtTool ;
pCam->m_vtCorr = m_vtCorr ;
pCam->m_vtAux = m_vtAux ;
pCam->m_ptEnd = m_ptEnd ;
pCam->m_ptCen = m_ptCen ;
pCam->m_dAngCen = m_dAngCen ;
pCam->m_vtN = m_vtN ;
pCam->m_dDeltaN = m_dDeltaN ;
pCam->m_dFeed = m_dFeed ;
pCam->m_dOrigFeed = m_dOrigFeed ;
pCam->m_nFlag = m_nFlag ;
pCam->m_nIndex = m_nIndex ;
pCam->m_nAxesStatus = m_nAxesStatus ;
pCam->m_nAxesMask = m_nAxesMask ;
pCam->m_vMachAxes = m_vMachAxes ;
pCam->m_ptMachCen = m_ptMachCen ;
pCam->m_dMachRad = m_dMachRad ;
pCam->m_dMachAngCen = m_dMachAngCen ;
pCam->m_vtMachN = m_vtMachN ;
pCam->m_vtBackAux = m_vtBackAux ;
}
catch( ...) {
delete pCam ;
return nullptr ;
}
}
// ritorno l'oggetto
return pCam ;
}
//----------------------------------------------------------------------------
bool
CamData::Dump( string& sOut, bool bMM, const char* szNewLine) const
{
sOut += GetClassName() + "[mm]" + szNewLine ;
sOut += CAM_MOVE + "=" + ToString( m_nMove) + szNewLine ;
sOut += CAM_CORR + "=" + ToString( m_nCorre) + szNewLine ;
sOut += CAM_TDIR + "=" + ToString( m_vtTool) + szNewLine ;
sOut += CAM_CDIR + "=" + ToString( m_vtCorr) + szNewLine ;
sOut += CAM_ADIR + "=" + ToString( m_vtAux) + szNewLine ;
sOut += CAM_PBAS + "=" + ToString( m_ptEnd) + szNewLine ;
sOut += CAM_PCEN + "=" + ToString( m_ptCen) + szNewLine ;
sOut += CAM_ACEN + "=" + ToString( m_dAngCen) + szNewLine ;
sOut += CAM_NDIR + "=" + ToString( m_vtN) + szNewLine ;
sOut += CAM_FEED + "=" + ToString( m_dFeed) + szNewLine ;
if ( m_dOrigFeed >= 0)
sOut += CAM_ORIGFEED + "=" + ToString( m_dOrigFeed) + szNewLine ;
sOut += CAM_FLAG + "=" + ToString( m_nFlag) + szNewLine ;
sOut += CAM_INDEX + "=" + ToString( m_nIndex) + szNewLine ;
sOut += CAM_AXSTS + "=" + ToString( m_nAxesStatus) + szNewLine ;
sOut += CAM_AXMSK + "=" + ToString( m_nAxesMask) + szNewLine ;
sOut += CAM_AXVAL + "=" + ToString( m_vMachAxes) + szNewLine ;
sOut += CAM_AXMC + "=" + ToString( m_ptMachCen) + szNewLine ;
sOut += CAM_AXMR + "=" + ToString( m_dMachRad) + szNewLine ;
sOut += CAM_AXAC + "=" + ToString( m_dMachAngCen) + szNewLine ;
sOut += CAM_AXND + "=" + ToString( m_vtMachN) + szNewLine ;
sOut += CAM_NDLT + "=" + ToString( m_dDeltaN) + szNewLine ;
sOut += CAM_BDIR + "=" + ToString( m_vtBackAux) + szNewLine ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::SetOwner( int nId, IGeomDB* pGDB)
{
m_nOwnerId = nId ;
m_pGeomDB = pGDB ;
return ( m_nOwnerId != GDB_ID_NULL && m_pGeomDB != nullptr) ;
}
//----------------------------------------------------------------------------
int
CamData::GetOwner( void) const
{
return m_nOwnerId ;
}
//----------------------------------------------------------------------------
IGeomDB*
CamData::GetGeomDB( void) const
{
return m_pGeomDB ;
}
//----------------------------------------------------------------------------
bool
CamData::Save( int nBaseId, STRVECTOR& vString) const
{
try {
vString.insert( vString.begin(), CAM_TOTPARAM, "") ;
int k = - 1 ;
vString[++k] = CAM_CORR + "=" + ToString( m_nCorre) ;
vString[++k] = CAM_TDIR + "=" + ToString( m_vtTool) ;
vString[++k] = CAM_CDIR + "=" + ToString( m_vtCorr) ;
vString[++k] = CAM_ADIR + "=" + ToString( m_vtAux) ;
vString[++k] = CAM_PBAS + "=" + ToString( m_ptEnd) ;
vString[++k] = CAM_FEED + "=" + ToString( m_dFeed) ;
vString[++k] = CAM_FLAG + "=" + ToString( m_nFlag) ;
vString[++k] = CAM_AXSTS + "=" + ToString( m_nAxesStatus) ;
vString[++k] = CAM_AXMSK + "=" + ToString( m_nAxesMask) ;
vString[++k] = CAM_AXVAL + "=" + ToString( m_vMachAxes) ;
// parametri aggiunti V2
vString[++k] = CAM_MOVE + "=" + ToString( m_nMove) ;
vString[++k] = CAM_PCEN + "=" + ToString( m_ptCen) ;
vString[++k] = CAM_ACEN + "=" + ToString( m_dAngCen) ;
vString[++k] = CAM_AXMC + "=" + ToString( m_ptMachCen) ;
vString[++k] = CAM_AXMR + "=" + ToString( m_dMachRad) ;
vString[++k] = CAM_AXAC + "=" + ToString( m_dMachAngCen) ;
// parametri aggiunti V3
vString[++k] = CAM_NDIR + "=" + ToString( m_vtN) ;
vString[++k] = CAM_AXND + "=" + ToString( m_vtMachN) ;
// parametri aggiunti V4
vString[++k] = CAM_NDLT + "=" + ToString( m_dDeltaN) ;
// parametri aggiunti V5
vString[++k] = CAM_BDIR + "=" + ToString( m_vtBackAux) ;
// parametri aggiunti V6
vString[++k] = CAM_INDEX + "=" + ToString( m_nIndex) ;
// parametri aggiunti V7
vString[++k] = CAM_ORIGFEED + "=" + ToString( m_dOrigFeed) ;
}
catch( ...) {
return false ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::Load( const STRVECTOR& vString, int nBaseGdbId)
{
if ( int( vString.size()) < CAM_PARAM_V1)
return false ;
int k = - 1 ;
if ( ! GetVal( vString[++k], CAM_CORR, m_nCorre) ||
! GetVal( vString[++k], CAM_TDIR, m_vtTool) ||
! GetVal( vString[++k], CAM_CDIR, m_vtCorr) ||
! GetVal( vString[++k], CAM_ADIR, m_vtAux) ||
! GetVal( vString[++k], CAM_PBAS, m_ptEnd) ||
! GetVal( vString[++k], CAM_FEED, m_dFeed) ||
! GetVal( vString[++k], CAM_FLAG, m_nFlag) ||
! GetVal( vString[++k], CAM_AXSTS, m_nAxesStatus) ||
! GetVal( vString[++k], CAM_AXMSK, m_nAxesMask) ||
! GetVal( vString[++k], CAM_AXVAL, m_vMachAxes))
return false ;
// parametri aggiunti V2
if ( int( vString.size()) >= CAM_PARAM_V2) {
if ( ! GetVal( vString[++k], CAM_MOVE, m_nMove) ||
! GetVal( vString[++k], CAM_PCEN, m_ptCen) ||
! GetVal( vString[++k], CAM_ACEN, m_dAngCen) ||
! GetVal( vString[++k], CAM_AXMC, m_ptMachCen) ||
! GetVal( vString[++k], CAM_AXMR, m_dMachRad) ||
! GetVal( vString[++k], CAM_AXAC, m_dMachAngCen))
return false ;
}
else {
m_nMove = ( m_dFeed < EPS_SMALL ? 0 : 1) ;
m_ptCen = ORIG ;
m_dAngCen = 0 ;
m_ptMachCen = ORIG ;
m_dMachRad = 0 ;
}
// parametri aggiunti V3
if ( int( vString.size()) >= CAM_PARAM_V3) {
if ( ! GetVal( vString[++k], CAM_NDIR, m_vtN) ||
! GetVal( vString[++k], CAM_AXND, m_vtMachN))
return false ;
}
else {
m_vtN = Z_AX ;
m_vtMachN = Z_AX ;
}
// parametri aggiunti V4
if ( int( vString.size()) >= CAM_PARAM_V4) {
if ( ! GetVal( vString[++k], CAM_NDLT, m_dDeltaN))
return false ;
}
else {
m_dDeltaN = 0 ;
}
// parametri aggiunti V5
if ( int( vString.size()) >= CAM_PARAM_V5) {
if ( ! GetVal( vString[++k], CAM_BDIR, m_vtBackAux))
return false ;
}
else {
m_vtBackAux = V_NULL ;
}
// parametri aggiunti V6
if ( int( vString.size()) >= CAM_PARAM_V6) {
if ( ! GetVal( vString[++k], CAM_INDEX, m_nIndex))
return false ;
}
else {
m_nIndex = 0 ;
}
// parametri aggiunti V7
if ( int( vString.size()) >= CAM_PARAM_V7) {
if ( ! GetVal( vString[++k], CAM_ORIGFEED, m_dOrigFeed))
return false ;
}
else {
m_dOrigFeed = -1 ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::GetDrawPolyLines( POLYLINELIST& lstPL) const
{
bool bToDraw = false ;
// se vettore fresa non nullo
if ( ! m_vtTool.IsSmall()) {
bToDraw = true ;
// aggiungo polilinea alla lista
lstPL.emplace_back() ;
PolyLine& PL = lstPL.back() ;
// dimensioni
const double TLEN = 40 ;
const double ALEN = 4 ;
// inserisco disegno nella polilinea
PL.AddUPoint( 0, m_ptEnd) ;
Point3d ptTip = m_ptEnd + m_vtTool * TLEN ;
PL.AddUPoint( 1, ptTip) ;
// aggiungo simil-freccia
Frame3d frF ;
frF.Set( ptTip, m_vtTool) ;
Point3d ptP2 = ORIG + Vector3d( ALEN, 0, -ALEN) ;
ptP2.ToGlob( frF) ;
PL.AddUPoint( 2, ptP2) ;
Point3d ptP3 = ORIG + Vector3d( -ALEN, 0, -ALEN) ;
ptP3.ToGlob( frF) ;
PL.AddUPoint( 3, ptP3) ;
PL.AddUPoint( 4, ptTip) ;
Point3d ptP5 = ORIG + Vector3d( 0, ALEN, -ALEN) ;
ptP5.ToGlob( frF) ;
PL.AddUPoint( 5, ptP5) ;
Point3d ptP6 = ORIG + Vector3d( 0, -ALEN, -ALEN) ;
ptP6.ToGlob( frF) ;
PL.AddUPoint( 6, ptP6) ;
PL.AddUPoint( 6, ptTip) ;
}
// se vettore correzione non nullo
if ( ! m_vtCorr.IsSmall()) {
bToDraw = true ;
// aggiungo polilinea alla lista
lstPL.emplace_back() ;
PolyLine& PL = lstPL.back() ;
// dimensioni
const double CLEN = 20 ;
const double ALEN = 2 ;
// inserisco disegno nella polilinea
PL.AddUPoint( 0, m_ptEnd) ;
Point3d ptTip = m_ptEnd + m_vtCorr * CLEN ;
PL.AddUPoint( 1, ptTip) ;
// aggiungo simil-freccia
Frame3d frF ;
if ( m_vtTool. IsSmall())
frF.Set( ptTip, m_vtCorr) ;
else
frF.Set( ptTip, m_vtCorr, m_vtTool) ;
Point3d ptP2 = ORIG + Vector3d( 0, ALEN, 0) ;
ptP2.ToGlob( frF) ;
PL.AddUPoint( 2, ptP2) ;
Point3d ptP3 = ORIG + Vector3d( 0, ALEN, - ALEN) ;
ptP3.ToGlob( frF) ;
PL.AddUPoint( 3, ptP3) ;
Point3d ptP4 = ORIG + Vector3d( 0, 0, - ALEN) ;
ptP4.ToGlob( frF) ;
PL.AddUPoint( 4, ptP4) ;
}
// se vettore ausiliario non nullo
if ( ! m_vtAux.IsSmall()) {
bToDraw = true ;
// aggiungo polilinea alla lista
lstPL.emplace_back() ;
PolyLine& PL = lstPL.back() ;
// dimensioni
const double CLEN = 20 ;
const double ALEN = 2 ;
// inserisco disegno nella polilinea
PL.AddUPoint( 0, m_ptEnd) ;
Point3d ptTip = m_ptEnd + m_vtAux * CLEN ;
PL.AddUPoint( 1, ptTip) ;
// aggiungo simil-freccia
Frame3d frF ;
if ( m_vtTool. IsSmall())
frF.Set( ptTip, m_vtAux) ;
else
frF.Set( ptTip, m_vtAux, m_vtTool) ;
Point3d ptP2 = ORIG + Vector3d( 0, ALEN, - 0.5 * ALEN) ;
ptP2.ToGlob( frF) ;
PL.AddUPoint( 2, ptP2) ;
Point3d ptP3 = ORIG + Vector3d( 0, 0, - ALEN) ;
ptP3.ToGlob( frF) ;
PL.AddUPoint( 3, ptP3) ;
}
return bToDraw ;
}
//----------------------------------------------------------------------------
bool
CamData::Translate( const Vector3d& vtMove)
{
m_ptEnd.Translate( vtMove) ;
m_ptCen.Translate( vtMove) ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng)
{
if ( ! m_ptEnd.Rotate( ptAx, vtAx, dCosAng, dSinAng))
return false ;
if ( ! m_ptCen.Rotate( ptAx, vtAx, dCosAng, dSinAng))
return false ;
if ( ! m_vtTool.Rotate( vtAx, dCosAng, dSinAng))
return false ;
if ( ! m_vtCorr.Rotate( vtAx, dCosAng, dSinAng))
return false ;
if ( ! m_vtAux.Rotate( vtAx, dCosAng, dSinAng))
return false ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ)
{
if ( ! m_ptEnd.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ))
return false ;
if ( ! m_ptCen.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ))
return false ;
if ( ! m_vtTool.IsSmall()) {
if ( ! m_vtTool.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) || ! m_vtTool.Normalize())
return false ;
}
if ( ! m_vtCorr.IsSmall()) {
double dLen = m_vtCorr.Len() ;
if ( ! m_vtCorr.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) || ! m_vtCorr.Normalize())
return false ;
m_vtCorr *= dLen ;
}
if ( ! m_vtAux.IsSmall()) {
if ( ! m_vtAux.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) || ! m_vtAux.Normalize())
return false ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
{
if ( ! m_ptEnd.Mirror( ptOn, vtNorm))
return false ;
if ( ! m_ptCen.Mirror( ptOn, vtNorm))
return false ;
m_dAngCen = - m_dAngCen ;
if ( ! m_vtTool.Mirror( vtNorm))
return false ;
if ( ! m_vtCorr.Mirror( vtNorm))
return false ;
if ( ! m_vtAux.Mirror( vtNorm))
return false ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff)
{
if ( ! m_ptEnd.Shear( ptOn, vtNorm, vtDir, dCoeff))
return false ;
if ( ! m_ptCen.Shear( ptOn, vtNorm, vtDir, dCoeff))
return false ;
if ( ! m_vtTool.IsSmall()) {
if ( ! m_vtTool.Shear( vtNorm, vtDir, dCoeff) || ! m_vtTool.Normalize())
return false ;
}
if ( ! m_vtCorr.IsSmall()) {
double dLen = m_vtCorr.Len() ;
if ( ! m_vtCorr.Shear( vtNorm, vtDir, dCoeff) || ! m_vtCorr.Normalize())
return false ;
m_vtCorr *= dLen ;
}
if ( ! m_vtAux.IsSmall()) {
if ( ! m_vtAux.Shear( vtNorm, vtDir, dCoeff) || ! m_vtAux.Normalize())
return false ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::ToGlob( const Frame3d& frRef)
{
if ( ! m_ptEnd.ToGlob( frRef))
return false ;
if ( ! m_ptCen.ToGlob( frRef))
return false ;
if ( ! m_vtTool.ToGlob( frRef))
return false ;
if ( ! m_vtCorr.ToGlob( frRef))
return false ;
if ( ! m_vtAux.ToGlob( frRef))
return false ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::ToLoc( const Frame3d& frRef)
{
if ( ! m_ptEnd.ToLoc( frRef))
return false ;
if ( ! m_ptCen.ToLoc( frRef))
return false ;
if ( ! m_vtTool.ToLoc( frRef))
return false ;
if ( ! m_vtCorr.ToLoc( frRef))
return false ;
if ( ! m_vtAux.ToLoc( frRef))
return false ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::LocToLoc( const Frame3d& frOri, const Frame3d& frDest)
{
if ( ! m_ptEnd.LocToLoc( frOri, frDest))
return false ;
if ( ! m_ptCen.LocToLoc( frOri, frDest))
return false ;
if ( ! m_vtTool.LocToLoc( frOri, frDest))
return false ;
if ( ! m_vtCorr.LocToLoc( frOri, frDest))
return false ;
if ( ! m_vtAux.LocToLoc( frOri, frDest))
return false ;
return true ;
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
CamData::CamData( void)
{
m_nOwnerId = GDB_ID_NULL ;
m_pGeomDB = nullptr ;
m_nMove = 0 ;
m_nCorre = 0 ;
m_dAngCen = 0 ;
m_dDeltaN = 0 ;
m_dFeed = 0 ;
m_dOrigFeed = -1 ;
m_nFlag = 0 ;
m_nIndex = 0 ;
m_nAxesStatus = AS_NONE ;
m_nAxesMask = 0x00 ;
m_vMachAxes.reserve( 8) ;
m_dMachRad = 0 ;
m_dMachAngCen = 0 ;
}
//----------------------------------------------------------------------------
bool
CamData::SetMoveType( int nMove)
{
m_nMove = nMove ;
ResetObjGraphics() ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::SetToolDir( const Vector3d& vtDir)
{
m_vtTool = vtDir ;
ResetObjGraphics() ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::SetCorrDir( const Vector3d& vtDir)
{
m_vtCorr = vtDir ;
ResetObjGraphics() ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::SetAuxDir( const Vector3d& vtDir)
{
m_vtAux = vtDir ;
ResetObjGraphics() ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::SetEndPoint( const Point3d& ptEnd)
{
m_ptEnd = ptEnd ;
ResetObjGraphics() ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::SetCenter( const Point3d& ptCen)
{
m_ptCen = ptCen ;
ResetObjGraphics() ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::SetAngCen( double dAngCen)
{
m_dAngCen = dAngCen ;
ResetObjGraphics() ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::SetNormDir( const Vector3d& vtDir)
{
m_vtN = vtDir ;
ResetObjGraphics() ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::SetDeltaN( double dDeltaN)
{
m_dDeltaN = dDeltaN ;
ResetObjGraphics() ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::SetFeed( double dFeed)
{
m_dFeed = dFeed ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::SetOrigFeed( double dOrigFeed)
{
m_dOrigFeed = dOrigFeed ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::SetFlag( int nFlag)
{
m_nFlag = nFlag ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::SetIndex( int nIndex)
{
m_nIndex = nIndex ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::SetAxes( int nStatus, const DBLVECTOR& vAxVal)
{
if ( nStatus != AS_OK && nStatus != AS_OUTSTROKE && nStatus != AS_DIR_ERR && nStatus != AS_ERR)
return false ;
m_nAxesStatus = nStatus ;
m_vMachAxes = vAxVal ;
m_nAxesMask = ( 1 << vAxVal.size()) - 1 ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::ChangeAxesMask( int nMask)
{
m_nAxesMask = ( nMask & (( 1 << m_vMachAxes.size()) - 1)) ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::SetAxesCen( const Point3d ptAxCen)
{
if ( ! IsArc())
return false ;
m_ptMachCen = ptAxCen ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::SetAxesRad( double dRad)
{
if ( ! IsArc())
return false ;
m_dMachRad = dRad ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::SetAxesAngCen( double dAngCen)
{
if ( ! IsArc())
return false ;
m_dMachAngCen = dAngCen ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::SetAxesNormDir( const Vector3d& vtDir)
{
if ( ! IsArc())
return false ;
m_vtMachN = vtDir ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::SetBackAuxDir( const Vector3d& vtDir)
{
m_vtBackAux = vtDir ;
return true ;
}
//----------------------------------------------------------------------------
void
CamData::ResetObjGraphics( void)
{
if ( m_pGeomDB == nullptr)
return ;
IGeoObj* pGeo = m_pGeomDB->GetGeoObj( m_nOwnerId) ;
if ( pGeo == nullptr)
return ;
IObjGraphics* pGraph = pGeo->GetObjGraphics() ;
if ( pGraph == nullptr)
return ;
pGraph->Reset() ;
}