本文整理汇总了C++中CoordinateSystem::SetSolarSystem方法的典型用法代码示例。如果您正苦于以下问题:C++ CoordinateSystem::SetSolarSystem方法的具体用法?C++ CoordinateSystem::SetSolarSystem怎么用?C++ CoordinateSystem::SetSolarSystem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CoordinateSystem
的用法示例。
在下文中一共展示了CoordinateSystem::SetSolarSystem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RunTest
//------------------------------------------------------------------------------
//int RunTest(TestOutput &out)
//------------------------------------------------------------------------------
int RunTest(TestOutput &out)
{
Real realVal;
Real expResult;
// for SolarSystem, internal CoordinateSystem
SolarSystem *ssPtr = new SolarSystem("MySolarSystem");
// set J2000Body for Earth
CelestialBody *earthPtr = ssPtr->GetBody("Earth");
std::string j2000BodyName = "Earth";
CelestialBody *j2000Body = earthPtr;
earthPtr->SetJ2000BodyName(j2000BodyName);
earthPtr->SetJ2000Body(j2000Body);
// for CoordinateSystem - EarthMJ2000Eq
CoordinateSystem *csPtr = new CoordinateSystem("CoordinateSystem", "EarthMJ2000Eq");
AxisSystem *mj2000EqAxis = new MJ2000EqAxes("MJ2000Eq");
csPtr->SetRefObject(mj2000EqAxis, Gmat::AXIS_SYSTEM, mj2000EqAxis->GetName());
csPtr->SetSolarSystem(ssPtr);
csPtr->SetStringParameter("Origin", "Earth");
csPtr->SetStringParameter("J2000Body", "Earth");
csPtr->SetRefObject(earthPtr, Gmat::SPACE_POINT, "Earth");
csPtr->Initialize();
// for CoordinateSystem - EarthMJ2000Ec
CoordinateSystem *eccsPtr = new CoordinateSystem("CoordinateSystem", "EarthMJ2000Ec");
AxisSystem *ecAxis = new MJ2000EcAxes("MJ2000Ec");
eccsPtr->SetRefObject(ecAxis, Gmat::AXIS_SYSTEM, ecAxis->GetName());
eccsPtr->SetSolarSystem(ssPtr);
eccsPtr->SetStringParameter("Origin", "Earth");
eccsPtr->SetStringParameter("J2000Body", "Earth");
eccsPtr->SetRefObject(earthPtr, Gmat::SPACE_POINT, "Earth");
eccsPtr->Initialize();
// set SLP file to SolarSystem
std::string slpFileName = "C:\\projects\\gmat\\files\\planetary_ephem\\slp\\mn2000.pc";
SlpFile *theSlpFile = new SlpFile(slpFileName);
ssPtr->SetSource(Gmat::SLP);
ssPtr->SetSourceFile(theSlpFile);
// for Spacecraft
Spacecraft *scPtr = new Spacecraft("MySpacecraft");
scPtr->SetRefObject(csPtr, Gmat::COORDINATE_SYSTEM);
//---------------------------------------------------------------------------
out.Put("======================================== test BplaneParameters\n");
//---------------------------------------------------------------------------
out.Put("=================================== Test with default spacecraft orbit");
out.Put("========== state = ", scPtr->GetCartesianState().ToString());
out.Put("============================== test BdotT()");
BdotT *btParam = new BdotT();
btParam->SetSolarSystem(ssPtr);
btParam->SetInternalCoordSystem(csPtr);
btParam->SetRefObjectName(Gmat::COORDINATE_SYSTEM, "EarthMJ2000Eq");
btParam->SetRefObject(csPtr, Gmat::COORDINATE_SYSTEM, "EarthMJ2000Eq");
btParam->SetRefObjectName(Gmat::SPACECRAFT, "MySpacecraft");
btParam->SetRefObject(scPtr, Gmat::SPACECRAFT, "MySpacecraft");
btParam->Initialize();
out.Put("num RefObjects = ", btParam->GetNumRefObjects());
out.Put("----- test btParam->EvaluateReal()");
out.Put("----- Should get an exception due to non-hyperbolic orbit");
realVal = btParam->EvaluateReal();
out.Put("============================== test BdotR()");
BdotR *brParam = new BdotR();
brParam->SetSolarSystem(ssPtr);
brParam->SetInternalCoordSystem(csPtr);
brParam->SetRefObjectName(Gmat::COORDINATE_SYSTEM, "EarthMJ2000Eq");
brParam->SetRefObject(csPtr, Gmat::COORDINATE_SYSTEM, "EarthMJ2000Eq");
brParam->SetRefObjectName(Gmat::SPACECRAFT, "MySpacecraft");
brParam->SetRefObject(scPtr, Gmat::SPACECRAFT, "MySpacecraft");
brParam->Initialize();
out.Put("num RefObjects = ", brParam->GetNumRefObjects());
out.Put("----- test brParam->EvaluateReal()");
out.Put("----- Should get an exception due to non-hyperbolic orbit");
realVal = brParam->EvaluateReal();
out.Put("");
out.Put("=================================== Test in EarthMJ2000Ec");
BdotT *btecParam = new BdotT();
btecParam->SetSolarSystem(ssPtr);
btecParam->SetInternalCoordSystem(csPtr);
btecParam->SetRefObjectName(Gmat::COORDINATE_SYSTEM, "EarthMJ2000Ec");
btecParam->SetRefObject(eccsPtr, Gmat::COORDINATE_SYSTEM, "EarthMJ2000Ec");
btecParam->SetRefObjectName(Gmat::SPACECRAFT, "MySpacecraft");
btecParam->SetRefObject(scPtr, Gmat::SPACECRAFT, "MySpacecraft");
out.Put("----- test btParam->EvaluateReal()");
out.Put("----- Should get an exception due to non-hyperbolic orbit");
realVal = btecParam->EvaluateReal();
//.........这里部分代码省略.........