Beispiel #1
0
//---------------------------------------------------------------------------
//  bool RenameRefObject(const Gmat::ObjectType type,
//                       const wxString &oldName, const wxString &newName)
//---------------------------------------------------------------------------
bool Variable::RenameRefObject(const Gmat::ObjectType type,
                               const wxString &oldName,
                               const wxString &newName)
{
   #ifdef DEBUG_RENAME
   MessageInterface::ShowMessage
      (wxT("Variable::RenameRefObject() type=%s, oldName=%s, newName=%s\n"),
       GetObjectTypeString(type).c_str(), oldName.c_str(), newName.c_str());
   #endif
   
   if (type != Gmat::PARAMETER && type != Gmat::COORDINATE_SYSTEM &&
       type != Gmat::SPACECRAFT && type != Gmat::CALCULATED_POINT)
      return true;
   
   // change expression if it has object name and .
   wxString tmpOldName = oldName + wxT(".");
   wxString::size_type pos = mExpr.find(tmpOldName);
   if (pos != mExpr.npos)
      mExpr = GmatStringUtil::Replace(mExpr, oldName, newName);
   
   #ifdef __ALLOW_SIMPLE_VAR_EXP__
   mParamDb->RenameParameter(oldName, newName);
   #endif
   
   RealVar::RenameRefObject(type, oldName, newName);
   return true;
}
Beispiel #2
0
//---------------------------------------------------------------------------
//  bool RenameRefObject(const Gmat::ObjectType type,
//                       const std::string &oldName, const std::string &newName)
//---------------------------------------------------------------------------
bool ObjectReferencedAxes::RenameRefObject(const Gmat::ObjectType type,
                                           const std::string &oldName,
                                           const std::string &newName)
{
   #ifdef DEBUG_RENAME
   MessageInterface::ShowMessage
      ("ObjectReferencedAxes::RenameRefObject() type=%s, oldName=%s, newName=%s\n",
       GetObjectTypeString(type).c_str(), oldName.c_str(), newName.c_str());
   #endif

   if (primaryName == oldName)
      primaryName = newName;

   if (secondaryName == oldName)
      secondaryName = newName;

   return AxisSystem::RenameRefObject(type, oldName, newName);
}
Beispiel #3
0
//---------------------------------------------------------------------------
//  bool RenameRefObject(const Gmat::ObjectType type,
//                       const std::string &oldName, const std::string &newName)
//---------------------------------------------------------------------------
bool GroundTrackPlot::RenameRefObject(const Gmat::ObjectType type,
                                      const std::string &oldName,
                                      const std::string &newName)
{
   #if DBGLVL_RENAME
   MessageInterface::ShowMessage
      ("GroundTrackPlot::RenameRefObject() type=%s, oldName=%s, newName=%s\n",
       GetObjectTypeString(type).c_str(), oldName.c_str(), newName.c_str());
   #endif
   
   if (type == Gmat::CELESTIAL_BODY)
   {
      // for central body name
      if (centralBodyName == oldName)
         centralBodyName = newName;
   }
   
   return OrbitPlot::RenameRefObject(type, oldName, newName);
}
Beispiel #4
0
//---------------------------------------------------------------------------
bool FiniteBurn::RenameRefObject(const Gmat::ObjectType type,
                                 const std::string &oldName,
                                 const std::string &newName)
{
#ifdef DEBUG_RENAME
    MessageInterface::ShowMessage
    ("FiniteBurn::RenameRefObject() type=%s, oldName=%s, newName=%s\n",
     GetObjectTypeString(type).c_str(), oldName.c_str(), newName.c_str());
#endif

    if (type == Gmat::HARDWARE)
    {
        for (UnsignedInt i=0; i<thrusterNames.size(); i++)
            if (thrusterNames[i] == oldName)
                thrusterNames[i] = newName;
    }

    return Burn::RenameRefObject(type, oldName, newName);
}
Beispiel #5
0
//------------------------------------------------------------------------------
bool BodyFixedPoint::SetRefObject(GmatBase *obj, const Gmat::ObjectType type,
                                 const std::string &name)
{
   if (obj == NULL)
      return false;

   #ifdef DEBUG_OBJECT_MAPPING
      MessageInterface::ShowMessage
         ("BodyFixedPoint::SetRefObject() this=%s, obj=<%p><%s>, type=<%d><%s> entered\n",
          GetName().c_str(), obj, obj->GetName().c_str(), (Integer) type,
          GetObjectTypeString(type).c_str());
   #endif

   switch (type)
   {
      case Gmat::SPACE_POINT:
      case Gmat::CELESTIAL_BODY:
         if (obj->GetName() == cBodyName)
         {
            theBody = (SpacePoint*)obj;
            // Let ancestors process this object as well

            #ifdef DEBUG_OBJECT_MAPPING
               MessageInterface::ShowMessage
                  ("BodyFixedPoint::Setting theBody to %s\n",
                   theBody->GetName().c_str());
            #endif

//            SpacePoint::SetRefObject(obj, type, name);
            return true;
         }
         break;

      default:
         break;
   }

   MessageInterface::ShowMessage("BodyFixedPoint::SetRefObject calling base for %s\n", name.c_str());

   // Not handled here -- invoke the next higher SetRefObject call
   return SpacePoint::SetRefObject(obj, type, name);
}
Beispiel #6
0
//------------------------------------------------------------------------------
bool Formation::RenameRefObject(const Gmat::ObjectType type,
                                const std::string &oldName,
                                const std::string &newName)
{
   #if DEBUG_RENAME
      MessageInterface::ShowMessage
         ("Formation::RenameRefObject() type=%s, oldName=%s, newName=%s\n",
          GetObjectTypeString(type).c_str(), oldName.c_str(), newName.c_str());
   #endif
   
   // Formation needs to know about spacecraft or other formation only
   if (type != Gmat::SPACECRAFT && type != Gmat::FORMATION )
      return true;
   
   //@todo replace any object name here
   for (UnsignedInt i=0; i<componentNames.size(); i++)
   {
      if (componentNames[i] == oldName)
         componentNames[i] = newName;
   }
   
   return true;
}