CigiBaseEntityCtrl.cpp

Go to the documentation of this file.
00001 
00047 #define _EXPORT_CCL_
00048 
00049 #include "CigiBaseEntityCtrl.h"
00050 #include "CigiExceptions.h"
00051 
00052 // Animation State conversion Tables
00053 const CigiBaseEntityCtrl::AnimationStateGrp CigiBaseEntityCtrl::ToV1[10] =
00054 {
00055    DeactivateUnload, // Stop
00056    Deactivate,       // Pause
00057    LoadActivate,     // Play
00058    Continue,         // Continue
00059    NoAction,         // NoAction
00060    Load,             // Load
00061    LoadActivate,     // LoadActivate
00062    Activate,         // Activate
00063    Deactivate,       // Deactivate
00064    DeactivateUnload  // DeactivateUnload
00065 };
00066 
00067 const CigiBaseEntityCtrl::AnimationStateGrp CigiBaseEntityCtrl::ToV3[10] =
00068 {
00069    Stop,      // Stop
00070    Pause,     // Pause
00071    Play,      // Play
00072    Continue,  // Continue
00073    NoAction,  // NoAction
00074    Stop,      // Load
00075    Play,      // LoadActivate
00076    Play,      // Activate
00077    Pause,     // Deactivate
00078    Stop       // DeactivateUnload
00079 };
00080 
00081 // ====================================================================
00082 // Construction/Destruction
00083 // ====================================================================
00084 
00085 // ================================================
00086 // CigiBaseEntityCtrl
00087 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00088 CigiBaseEntityCtrl::CigiBaseEntityCtrl()
00089 {
00090 
00091 }
00092 
00093 // ================================================
00094 // ~CigiBaseEntityCtrl
00095 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00096 CigiBaseEntityCtrl::~CigiBaseEntityCtrl()
00097 {
00098 
00099 }
00100 
00101 
00102 // ====================================================================
00103 // Conversion Control
00104 // ====================================================================
00105 
00106 
00107 // ================================================
00108 // GetCnvt
00109 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00110 int CigiBaseEntityCtrl::GetCnvt(CigiVersionID &CnvtVersion,
00111                                 CigiCnvtInfoType::Type &CnvtInfo)
00112 {
00113    CnvtInfo.ProcID = CigiProcessType::ProcEntity;
00114 
00115    // All versions of this packet have the same packet id number
00116    CnvtInfo.CnvtPacketID = CIGI_ENTITY_CTRL_PACKET_ID_V3;
00117 
00118    return(CIGI_SUCCESS);
00119 }
00120 
00121 
00122 // ====================================================================
00123 // Accessors
00124 // ====================================================================
00125 
00126 // ================================================
00127 // CigiBaseEntityCtrl
00128 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00129 int CigiBaseEntityCtrl::SetPitch(const float PitchIn, bool bndchk)
00130 {
00131 
00132 #ifndef CIGI_NO_BND_CHK
00133    if(bndchk && ((PitchIn < -90.0f)||(PitchIn > 90.0f)))
00134    {
00135 #ifndef CIGI_NO_EXCEPT
00136       throw CigiValueOutOfRangeException("Pitch",(double)PitchIn,-90.0,90.0);
00137 #endif
00138       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00139    }
00140 #endif
00141 
00142    Pitch = PitchIn;
00143 
00144    return(CIGI_SUCCESS);
00145 
00146 }
00147 
00148 // ================================================
00149 // CigiBaseEntityCtrl
00150 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00151 int CigiBaseEntityCtrl::SetRoll(const float RollIn, bool bndchk)
00152 {
00153 
00154 #ifndef CIGI_NO_BND_CHK
00155    if(bndchk && ((RollIn < -180.0f)||(RollIn > 180.0f)))
00156    {
00157 #ifndef CIGI_NO_EXCEPT
00158       throw CigiValueOutOfRangeException("Roll",(double)RollIn,-180.0,180.0);
00159 #endif
00160       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00161    }
00162 #endif
00163 
00164    Roll = RollIn;
00165 
00166    return(CIGI_SUCCESS);
00167 
00168 }
00169 
00170 // ================================================
00171 // SetLat
00172 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00173 int CigiBaseEntityCtrl::SetLat(const double Lat, bool bndchk)
00174 {
00175 
00176 #ifndef CIGI_NO_BND_CHK
00177    if(bndchk && ((Lat < -90.0f)||(Lat > 90.0f)))
00178    {
00179 #ifndef CIGI_NO_EXCEPT
00180       throw CigiValueOutOfRangeException("Lat",Lat,-90.0,90.0);
00181 #endif
00182       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00183    }
00184 #endif
00185 
00186    LatOrXoff = Lat;
00187 
00188    return(CIGI_SUCCESS);
00189 
00190 }
00191 
00192 // ================================================
00193 // SetLon
00194 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00195 int CigiBaseEntityCtrl::SetLon(const double Lon, bool bndchk)
00196 {
00197 
00198 #ifndef CIGI_NO_BND_CHK
00199    if(bndchk && ((Lon < -180.0f)||(Lon > 180.0f)))
00200    {
00201 #ifndef CIGI_NO_EXCEPT
00202       throw CigiValueOutOfRangeException("Lon",Lon,-180.0,180.0);
00203 #endif
00204       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00205    }
00206 #endif
00207 
00208    LonOrYoff = Lon;
00209 
00210    return(CIGI_SUCCESS);
00211 
00212 }
00213 
00214 
00215 // ================================================
00216 // SetAttachState
00217 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00218 int CigiBaseEntityCtrl::SetAttachState(const AttachStateGrp AttachStateIn, bool bndchk)
00219 {
00220 
00221 #ifndef CIGI_NO_BND_CHK
00222    if(bndchk && ((AttachStateIn < 0)||(AttachStateIn > 1)))
00223    {
00224 #ifndef CIGI_NO_EXCEPT
00225       throw CigiValueOutOfRangeException("AttachState",AttachStateIn,0,1);
00226 #endif
00227       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00228    }
00229 #endif
00230 
00231    AttachState = AttachStateIn;
00232 
00233    return(CIGI_SUCCESS);
00234 
00235 }
00236 
00237 // ================================================
00238 // SetCollisionDetectEn
00239 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00240 int CigiBaseEntityCtrl::SetCollisionDetectEn(const CollisionDetectGrp CollisionDetectEnIn, bool bndchk)
00241 {
00242 
00243 #ifndef CIGI_NO_BND_CHK
00244    if(bndchk && ((CollisionDetectEnIn < 0)||(CollisionDetectEnIn > 1)))
00245    {
00246 #ifndef CIGI_NO_EXCEPT
00247       throw CigiValueOutOfRangeException("CollisionDetectEn",CollisionDetectEnIn,0,1);
00248 #endif
00249       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00250    }
00251 #endif
00252 
00253    CollisionDetectEn = CollisionDetectEnIn;
00254 
00255    return(CIGI_SUCCESS);
00256 
00257 }
00258 
00259 

Generated on Wed Apr 29 08:59:57 2009 for CCL by  doxygen 1.4.7