//---------------------------------------------------------------------------- // EgalTech 2015-2015 //---------------------------------------------------------------------------- // File : Disposition.h Data : 27.05.15 Versione : 1.6e7 // Contenuto : Dichiarazione della classe Disposition. // // // // Modifiche : 27.05.15 DS Creazione modulo. // // //---------------------------------------------------------------------------- #pragma once #include "Operation.h" //---------------------------------------------------------------------------- struct FixtureData { std::string sName ; // nome del dispositivo di bloccaggio int nId ; // identificativo Point3d ptPos ; // posizione nel riferimento tavola double dAng ; // angolo di rotazione attorno al centro double dMov ; // posizione eventuale parte mobile FixtureData( void) : sName(), nId( GDB_ID_NULL), ptPos(), dAng( 0), dMov( 0) {} FixtureData( const std::string& sN, int nI, const Point3d& ptP, double dA, double dM) : sName( sN), nId( nI), ptPos( ptP), dAng( dA), dMov( dM) {} } ; typedef std::vector FIXDATAVECTOR ; //---------------------------------------------------------------------------- struct MoveRawData { int nRawId ; // identificativo del grezzo int nType ; // tipo di movimento ( 1=MoveToCorner, 2=MoveToCenter, 3=Rotate) Point3d ptP ; // punto di riferimento / angoli di Eulero CAC' int nFlag ; // flag sottotipo movimento/rotazione enum { NONE = 0, COR = 1, CEN = 2, ROT = 3} ; MoveRawData( void) : nRawId( 0), nType( NONE), ptP(), nFlag( 0) {} MoveRawData( int nId, int nT, const Point3d& ptR, int nF) : nRawId( nId), nType( nT), ptP( ptR), nFlag( nF) {} } ; typedef std::vector MVRDATAVECTOR ; //---------------------------------------------------------------------------- class Disposition : public Operation { public : // IUserObj Disposition* Clone( void) const override ; const std::string& GetClassName( void) const override ; bool Dump( std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const override ; bool ToSave( void) const override { return true ; } bool Save( int nBaseId, STRVECTOR& vString) const override ; bool Load( const STRVECTOR& vString, int nBaseGdbId) override ; public : // Operation int GetType( void) const override { return OPER_DISP ; } bool IsEmpty( void) const override { return ( m_nShifts == 0) ; } protected : // Operation const std::string& GetToolName( void) const override ; const std::string& GetHeadName( void) const override ; int GetExitNbr( void) const override ; const std::string& GetToolTcPos( void) const override ; int GetSolCh( void) const override { return 0 ; } bool NeedPrevHome( void) const override ; public : Disposition( void) ; public : bool SetTable( const std::string& sTable) ; bool Apply( bool bVerifyTab) ; bool IsSetTableName( void) const { return ! m_sTabName.empty() ; } bool GetTable( std::string& sTable) const ; bool GetTableRef1( Point3d& ptRef1) const ; bool GetTableArea1( BBox3d& b3Area1) const ; int AddFixture( const std::string& sName, const Point3d& ptPos, double dAngDeg = 0, double dMov = 0, bool bAddToList = true) ; int GetFirstFixture( void) ; int GetNextFixture( int nId) ; bool MoveFixture( int nId, const Vector3d& vtMove) ; bool RotateFixture( int nId, double dDeltaAngDeg) ; bool MoveFixtureMobile( int nId, double dDeltaMov) ; bool PlaceFixture( int nId, const Point3d& ptPos, double dAngDeg, double dMov) ; bool RemoveFixture( int nId) ; bool MoveToCornerRawPart( int nRawId, const Point3d& ptP, int nFlag, bool bAddToList = true, bool bVerify = true) ; bool MoveToCenterRawPart( int nRawId, const Point3d& ptP, int nFlag, bool bAddToList = true, bool bVerify = true) ; bool MoveRawPart( int nRawId, const Vector3d& vtMove) ; bool RotateRawPart( int nRawId, const Vector3d& vtAx, double dAngRotDeg) ; bool ApplyRotationToRawPart( int nRawId, double dAngCDeg, double dAngADeg, double dAngC1Deg, bool bAddToList = true) ; bool RemoveRawPart( int nRawId) ; bool GetFixtureData( int nInd, std::string& sName, int& nId, Point3d& ptPos, double& dAngDeg, double& dMov) const ; bool GetMoveRawData( int nInd, int& nRawId, int& nType, Point3d& ptPos, int& nFlag) const ; bool SpecialApply( bool bRecalc) ; bool SpecialUpdate( void) ; bool GetToolData( std::string& sName, std::string& sHead, int& nExit, std::string& sTcPos) const ; bool GetSomeByHand( void) const { return m_bSomeByHand ; } private : bool InsertMoveInfoInList( int nRawId, int nType, const Point3d& ptP, int nFlag) ; private : bool m_bTabOk ; // flag di tavola verificata std::string m_sTabName ; // nome della tavola di appartenenza Point3d m_ptRef1 ; // origine 1 della tavola BBox3d m_b3Area1 ; // area utile 1 della tavola FIXDATAVECTOR m_vFixData ; // elenco posizionamento bloccaggi MVRDATAVECTOR m_vMvrData ; // elenco movimenti grezzi std::string m_sHead ; // eventuale testa usata per muovere i pezzi int m_nExit ; // eventuale uscita sulla testa std::string m_sTcPos ; // eventuale posizione nel cambiautensili int m_nShifts ; // numero eventuali spostamenti con testa bool m_bSomeByHand ; // presenza di operazioni manuali (anche in aggiunta ad automatiche) } ; //---------------------------------------------------------------------------- inline const Disposition* GetDisposition( const IUserObj* pUserObj) { return dynamic_cast( pUserObj) ; } inline Disposition* GetDisposition( IUserObj* pUserObj) { return dynamic_cast< Disposition*>( pUserObj) ; }