当前位置: 首页>>代码示例>>C++>>正文


C++ CoordinateSystem::SetRefObject方法代码示例

本文整理汇总了C++中CoordinateSystem::SetRefObject方法的典型用法代码示例。如果您正苦于以下问题:C++ CoordinateSystem::SetRefObject方法的具体用法?C++ CoordinateSystem::SetRefObject怎么用?C++ CoordinateSystem::SetRefObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CoordinateSystem的用法示例。


在下文中一共展示了CoordinateSystem::SetRefObject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: while

//------------------------------------------------------------------------------
void Publisher::SetDataMJ2000EqOrigin(CelestialBody *cb)
{
   if (cb == NULL)
      return;
   
   #if DBGLVL_PUBLISHER_DATA_REP
   MessageInterface::ShowMessage
      ("Publisher::SetDataMJ2000EqOrigin() cb=%s<%p>\n", cb->GetName().c_str(),
       cb);
   #endif
   
   dataMJ2000EqOrigin = cb;
   std::string originName = cb->GetName();
   std::string csName = originName + "MJ2000Eq";
      
   std::map<std::string, CoordinateSystem*>::iterator csIter =
      coordSysMap.find(csName);
   
   if (coordSysMap.find(csName) != coordSysMap.end())
   {
      // set coordinate system from the map
      dataCoordSystem = coordSysMap.find(csName)->second;
   }
   else
   {
      // check as local name
      csName = "Local-" + csName;
      if (coordSysMap.find(csName) != coordSysMap.end())
         dataCoordSystem = coordSysMap.find(csName)->second;
      else
      {
         // Create coordinate system if not exist
         CoordinateSystem *newCs = (CoordinateSystem*)internalCoordSystem->Clone();
         newCs->SetName(csName);
         newCs->SetStringParameter("Origin", originName);
         newCs->SetRefObject(cb, Gmat::CELESTIAL_BODY, originName);
         newCs->Initialize();
         coordSysMap[csName] = newCs;
         dataCoordSystem = newCs;
         
         #if DBGLVL_PUBLISHER_DATA_REP
         MessageInterface::ShowMessage
            ("   ===> %s not found in the map, so created <%p>\n", csName.c_str(),
             newCs);
         #endif
      }
   }
   
   // set to subscribers
   std::list<Subscriber*>::iterator current = subscriberList.begin();
   while (current != subscriberList.end())
   {
      (*current)->SetDataMJ2000EqOrigin(cb);
      (*current)->SetDataCoordSystem(dataCoordSystem);
      current++;
   }
}
开发者ID:rockstorm101,项目名称:GMAT,代码行数:58,代码来源:Publisher.cpp

示例2: 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();
//.........这里部分代码省略.........
开发者ID:rockstorm101,项目名称:GMAT,代码行数:101,代码来源:TestBplaneParam.cpp


注:本文中的CoordinateSystem::SetRefObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。