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


C++ GmatBase::GetTypeName方法代码示例

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


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

示例1: SetGlobalObjectMap

//------------------------------------------------------------------------------
void CallFunction::SetGlobalObjectMap(std::map<wxString, GmatBase *> *map)
{
   #ifdef DEBUG_GLOBAL_OBJECT_MAP
   MessageInterface::ShowMessage
      (wxT("CallFunction::SetGlobalObjectMap() entered, mFunctionName='%s', ")
       wxT("map=<%p>\n"), mFunctionName.c_str(), map);
   #endif
   
   GmatCommand::SetGlobalObjectMap(map);
   
   // Now, find the function object
   GmatBase *mapObj = FindObject(mFunctionName);
   
   #ifdef DEBUG_GLOBAL_OBJECT_MAP
   MessageInterface::ShowMessage
      (wxT("   mapObj=<%p><%s>'%s'\n"), mapObj,
       mapObj ? mapObj->GetTypeName().c_str() : wxT("NULL"),
       mapObj ? mapObj->GetName().c_str() : wxT("NULL"));
   #endif
   
   if (mapObj == NULL)
   {
      //throw CommandException(wxT("CallFunction command cannot find Function ") +
      //         mFunctionName + wxT("\n"));
      ; // leave NULL for now
   }
   else
   {
      mFunction = (Function *)mapObj;
      
      #ifdef DEBUG_GLOBAL_OBJECT_MAP
      MessageInterface::ShowMessage
         (wxT("   mFunction=<%p><%s>\n"), mFunction, mFunction->GetName().c_str());
      #endif
      
      // Set only GmatFunction to FunctionManager (loj: 2008.09.03)
      if (mapObj->GetTypeName() == wxT("GmatFunction"))
         fm.SetFunction(mFunction);
   }
   fm.SetGlobalObjectMap(map);
   
   #ifdef DEBUG_GLOBAL_OBJECT_MAP
   MessageInterface::ShowMessage(wxT("CallFunction::SetGlobalObjectMap() exiting\n"));
   #endif
}
开发者ID:,项目名称:,代码行数:46,代码来源:

示例2: Initialize

//------------------------------------------------------------------------------
bool PenDown::Initialize()
{
   #ifdef DEBUG_PENDOWN
      MessageInterface::ShowMessage("PenDown::Initialize() entered\n");
   #endif
      
   PlotCommand::Initialize();
   
   GmatBase *sub;
   thePlotList.clear();
   
   for (unsigned int ii = 0; ii < plotNameList.size(); ii++)
   {
      if ((sub = FindObject(plotNameList.at(ii))) != NULL) 
      {
         if (sub->GetTypeName() == "XYPlot" ||
             sub->GetTypeName() == "OrbitView" ||
             sub->GetTypeName() == "GroundTrackPlot") 
            thePlotList.push_back((Subscriber*) sub);
         else
            throw CommandException(
               "Object named \"" + plotNameList.at(ii) +
               "\" should be an XYPlot, OrbitView or GroundTrackPlot to use the "
               "PenDown command for this object, but it is a " + 
               sub->GetTypeName());      
      }
      else 
      {
         MessageInterface::ShowMessage
            ("PenDown command cannot find Plot \"%s\"; command has no effect."
            "\n", (plotNameList.at(ii)).c_str());
         return false;
      }
   }
   
   #ifdef DEBUG_PENDOWN
      MessageInterface::ShowMessage
         ("   thePlotList.size()=%d\n", thePlotList.size());
      MessageInterface::ShowMessage("PenDown::Initialize() returning true\n");
   #endif
   return true;
}
开发者ID:rockstorm101,项目名称:GMAT,代码行数:43,代码来源:PenDown.cpp

示例3: Initialize

//------------------------------------------------------------------------------
bool ClearPlot::Initialize()
{
   #ifdef DEBUG_CLEARPLOT
      MessageInterface::ShowMessage(wxT("ClearPlot::Initialize() entered\n"));
   #endif
      
   PlotCommand::Initialize();
   
   GmatBase *xy;
   thePlotList.clear();
   
   for (unsigned int ii = 0; ii < plotNameList.size(); ii++)
   {
      if ((xy = FindObject(plotNameList.at(ii))) != NULL) 
      {
         if (xy->GetTypeName() == wxT("XYPlot")) 
            thePlotList.push_back((XyPlot*) xy);
         else
            throw CommandException(
               wxT("Object named \"") + plotNameList.at(ii) + wxT("\" should be an XYPlot to use the ")
               wxT("ClearPlot command for this object, but it is a ") + 
               xy->GetTypeName());      
      }
      else 
      {
         MessageInterface::ShowMessage
            (wxT("ClearPlot command cannot find XY Plot \"%s\"; command has no effect.")
            wxT("\n"), (plotNameList.at(ii)).c_str());
         return false;
      }
   }
   
   #ifdef DEBUG_CLEARPLOT
      MessageInterface::ShowMessage("ClearPlot::Initialize() returning true\n");
   #endif
   return true;
}
开发者ID:,项目名称:,代码行数:38,代码来源:

示例4: OnHelp

//------------------------------------------------------------------------------
void GmatDialog::OnHelp(wxCommandEvent &event)
{
   #ifdef DEBUG_GMAT_DIALOG_HELP
   MessageInterface::ShowMessage
      ("GmatDialog::OnHelp() entered, mObject=<%p><%s>'%s'\n", mObject,
       mObject ? mObject->GetTypeName().c_str() : "NULL",
       mObject ? mObject->GetName().c_str() : "NULL");
   #endif
   
   wxString objLink;
   wxString sHTML;
   wxString baseHelpLink;
   char msgBuffer[255];
   
   // get the config object
   wxConfigBase *pConfig = wxConfigBase::Get();
   pConfig->SetPath(wxT("/Help"));
   if (mObject != NULL)
   {
      objLink = mObject->GetTypeName().c_str();
   }
   else
   {
      wxString prefix = "Scripting for ";
      objLink = GetName().c_str();
      if (objLink.Find(prefix) != wxNOT_FOUND)
		objLink = objLink.Mid(prefix.size());
      GmatBase *obj = theGuiInterpreter->GetConfiguredObject(objLink.c_str());
      if (obj != NULL)
         objLink = obj->GetTypeName().c_str();
   }
   
   wxHelpController *theHelpController = GmatAppData::Instance()->GetMainFrame()->GetHelpController();
	if (theHelpController != NULL)
	{
		#ifdef DEBUG_GMAT_DIALOG_HELP
		MessageInterface::ShowMessage
			("GmatPanel::OnHelp() theHelpController=<%p>\n   "
			"File to display=%s\n", theHelpController,
			s);
		#endif
		// displays chm, not html
		// see if there is an override for panel (e.g., PropSetupKeyword=Propagator)
		sHTML = objLink+".html";
		objLink = pConfig->Read(objLink+"Keyword", sHTML);

		if (!theHelpController->DisplaySection(objLink)) 
			theHelpController->DisplayContents();
	}
	else
	{
	   // get base help link if available
      baseHelpLink = pConfig->Read(_T("BaseHelpLink"),_T("http://gmat.sourceforge.net/docs/latest/html/%s.html"));
	   sprintf( msgBuffer, baseHelpLink.c_str(), objLink.WX_TO_C_STRING);
      
	   #ifdef DEBUG_GMAT_DIALOG_HELP
	   MessageInterface::ShowMessage
		  ("   objLink = '%s', baseHelpLink = '%s'\n   helpLink = '%s'\n",
		   objLink.c_str(), baseHelpLink.c_str(), msgBuffer);
	   #endif
      
	   // open separate window to show help
	   objLink = pConfig->Read(objLink, wxString(&msgBuffer[0]));
	   #ifdef DEBUG_GMAT_DIALOG_HELP
	   MessageInterface::ShowMessage("   actual help Link = '%s'\n", objLink.c_str());
	   #endif
      
      // if path is relative, try to append it to gmat root 
	   if (GmatFileUtil::IsPathRelative(objLink.c_str()))
	   {
			FileManager *fm = FileManager::Instance();
			if (GmatStringUtil::EndsWithPathSeparator(fm->GetRootPath()))
				objLink = fm->GetRootPath().c_str() + objLink;
			else
			{
			   wxString pathSep = GmatFileUtil::GetPathSeparator().c_str();
				objLink = fm->GetRootPath().c_str() + pathSep + objLink;
			}

	   }
	   wxLaunchDefaultBrowser(objLink);
	}
   
   #ifdef DEBUG_GMAT_DIALOG_HELP
   MessageInterface::ShowMessage("GmatDialog::OnHelp() leaving\n");
   #endif

}
开发者ID:rockstorm101,项目名称:GMAT,代码行数:89,代码来源:GmatDialog.cpp

示例5: SaveChildPositionAndSize

//------------------------------------------------------------------------------
// void SaveChildPositionAndSize()
//------------------------------------------------------------------------------
void GmatMdiChildFrame::SaveChildPositionAndSize()
{
   if (mCanSaveLocation == false)
      return;

   if (IsIconized())
      return;
   
   // Get the position and size of the window first
   #ifdef __WXMAC__
      Integer screenWidth  = wxSystemSettings::GetMetric(wxSYS_SCREEN_X);
      Integer screenHeight = wxSystemSettings::GetMetric(wxSYS_SCREEN_Y);
   #else
      Integer screenWidth;
      Integer screenHeight;
      GmatAppData::Instance()->GetMainFrame()->GetActualClientSize(&screenWidth, &screenHeight, true);
      // Since GmatMainFrame::GetActualClientSize() subtracts one, add one here (LOJ: 2012.07.23)
      screenWidth++;
      screenHeight++;
   #endif

   bool isMinimized = IsIconized(), isMaximized = IsMaximized();
   if (isMinimized)	
	  Iconize(false);
   else if (isMaximized)
	  Maximize(false);

   int tmpX = -1, tmpY = -1;
   int tmpW = -1, tmpH = -1;
   GetPosition(&tmpX, &tmpY);
   GetSize(&tmpW, &tmpH);
   Rvector upperLeft(2, ((Real) tmpX /(Real)  screenWidth), ((Real) tmpY /(Real)  screenHeight));
   Rvector childSize(2,  ((Real) tmpW /(Real)  screenWidth), ((Real) tmpH /(Real)  screenHeight));

   if (isMinimized)	
	  Iconize();
   else if (isMaximized)
	  Maximize();


   #ifdef DEBUG_PERSISTENCE
   // ======================= begin temporary ==============================
   MessageInterface::ShowMessage("*** Size of SCREEN %s is: width = %d, height = %d\n",
                                 mChildName.WX_TO_C_STRING, screenWidth, screenHeight);
   MessageInterface::ShowMessage("Position of View plot %s is: x = %d, y = %d\n",
                                 mChildName.WX_TO_C_STRING, tmpX, tmpY);
   MessageInterface::ShowMessage("Size of View plot %s is: width = %d, height = %d\n",
                                 mChildName.WX_TO_C_STRING, tmpW, tmpH);
   // ======================= end temporary ==============================
   #endif

   if ((mItemType == GmatTree::OUTPUT_REPORT)  ||
       (mItemType == GmatTree::OUTPUT_CCSDS_OEM_FILE ) ||
       (mItemType == GmatTree::OUTPUT_ORBIT_VIEW) ||
       (mItemType == GmatTree::OUTPUT_XY_PLOT) ||
       (mItemType == GmatTree::OUTPUT_GROUND_TRACK_PLOT)
       // We'll want to add the event reports eventually, but they are not subscriber based
       //|| (mItemType == GmatTree::EVENT_REPORT)
       )
   {
      GmatBase *obj = theGuiInterpreter->GetConfiguredObject(mChildName.c_str());
      
      #ifdef DEBUG_FUNCTION
      // Check if child name is the configured object name
      MessageInterface::ShowMessage
         ("GmatMdiChildFrame::SaveChildPositionAndSize() the child '%s' %s a "
          "configured object, obj = <%p>[%s]'%s'\n", mChildName.WX_TO_C_STRING,
          obj ? "is" : "is not", obj, obj ? obj->GetTypeName().c_str() : "NULL",
          obj ? obj->GetName().c_str() : "NULL");
      #endif
      
      if (!obj)
      {
         // Just return if child is not a configured subscriber,ie,
         // plotting from GMAT function (LOJ: 2015.06.26)
         #ifdef DEBUG_FUNCTION
         MessageInterface::ShowMessage
            ("**** WARNING **** GmatMdiChildFrame::SaveChildPositionAndSize() "
             "will not save position and size for unconfigured subscriber '%s'\n",
             mChildName.WX_TO_C_STRING);
         #endif
         return;
      }
      else if (!obj->IsOfType("Subscriber"))
      {
         #ifdef DEBUG_PERSISTENCE
         MessageInterface::ShowMessage
            ("**** WARNING **** GmatMdiChildFrame::SaveChildPositionAndSize() "
             "cannot not save position and size for non-subscriber '%s'\n",
             mChildName.WX_TO_C_STRING);
         #endif
         SubscriberException se;
         se.SetDetails("Cannot set position and size for non-subscriber '%s'");
         throw se;
      }
      
      Subscriber *sub = (Subscriber*) obj;
//.........这里部分代码省略.........
开发者ID:rockstorm101,项目名称:GMAT,代码行数:101,代码来源:GmatMdiChildFrame.cpp

示例6: main

//------------------------------------------------------------------------------
// int main(int argc, char *argv[])
//------------------------------------------------------------------------------
int main(int argc, char *argv[])
{
   cout << "=-=-=-=-=-=-= TEST coordinate system ....." << endl;
   cout << " ------ number of objects instantiated = " << GmatBase::GetInstanceCount() << endl;
   
   cout.setf(ios::fixed);
   cout.precision(16);

   std::string eopFileName    = "/GMAT/dev/datafiles/EOPFiles/eopc04.62-now";
   std::string nutFileName    = "/GMAT/dev/datafiles/ITRF/NUTATION.DAT";
   std::string planFileName   = "/GMAT/dev/datafiles/ITRF/NUT85.DAT";
   std::string SLPFileName    = "/GMAT/dev/datafiles/mac/DBS_mn2000.dat";
   std::string DEFileName     = "/GMAT/dev/datafiles/DEascii/macp1941.405";
   std::string LeapFileName   = "/GMAT/dev/datafiles/tai-utcFiles/tai-utc.dat";
   
   cout << "\n==> First, test the AxisSystemFactory <==" << endl;
   AxisSystemFactory *asf = new AxisSystemFactory();
   cout << "AxisSystemFactory created .........." << endl;
   cout << " ------ number of objects instantiated = " << GmatBase::GetInstanceCount() << endl;
   std::string
      AXES_TYPE[13] =
   {
      "MJ2000Eq",
      "MJ2000Ec",
      "TOEEq",
      "TOEEc",
      "MOEEq",
      "MOEEc",
      "TODEq",
      "TODEc",
      "MODEq",
      "MODEc",
      "ObjectReferenced",
      "Equator",
      "BodyFixed",
   };
   
   AxisSystem *as;
   MJ2000EqAxes* mj;
   MJ2000EqAxes* mj2;
   //MJ2000EcAxes* mj2;
   std::string tmpStr = "";
   //for (int i = 0; i < 13 ; i++)
   for (int i = 0; i < 2 ; i++) // only do the first one, for now
   {
      tmpStr = AXES_TYPE[i] + "1";
      as = asf->CreateAxisSystem(AXES_TYPE[i], tmpStr);
      if (as) 
      {
         cout << "AxisSystem of type " << AXES_TYPE[i] << 
                  " was created with name " << tmpStr << endl;
         if (i > 1)       delete as; 
         else if (i == 0) mj   = (MJ2000EqAxes*) as;
         //else             mj2  = (MJ2000EcAxes*) as;
      }
      else    cout << "NO " << AXES_TYPE[i] << " AxisSystem created." << endl;
   }
   
   cout << " ------ number of objects instantiated = " << GmatBase::GetInstanceCount() << endl;
   if (mj)
   {
      cout << "MJ2000EqAxes object exists with name " << mj->GetName() << 
      " and type " << mj->GetTypeName() << endl;
   }
   mj2 = (MJ2000EqAxes*)(asf->CreateAxisSystem("MJ2000Eq","MJ2000Eq2"));
   if (mj2)
   {
      cout << "MJ20002 object exists with name " << mj2->GetName() << 
      " and type " << mj2->GetTypeName() << endl;
   }

   try
   {
      LeapSecsFileReader* ls     = new LeapSecsFileReader(LeapFileName);
      ls->Initialize();
      EopFile *eop               = new EopFile(eopFileName);
      eop->Initialize();
      ItrfCoefficientsFile* itrf = new ItrfCoefficientsFile(nutFileName, planFileName);
      itrf->Initialize();
      //bf->SetEopFile(eop);
      //bf->SetCoefficientsFile(itrf);
      TimeConverterUtil::SetLeapSecsFileReader(ls);
      TimeConverterUtil::SetEopFile(eop);
   }
   catch (BaseException &bbee)
   {
      cout << "ERROR !!!!! " << bbee.GetMessage() << endl;
   }
   
   SolarSystem*   ss;
   Star*          sol;
   Planet*        earth;
   Planet*        mars;
   Planet*        jupiter;
   Moon*          luna;
   std::string    j2000BN = "";
   SpacePoint*    j2000B  = NULL;
//.........这里部分代码省略.........
开发者ID:rockstorm101,项目名称:GMAT,代码行数:101,代码来源:TestCoord.cpp

示例7: VerifyAddHardware

//-------------------------------------------------------------------------
// This function is used to verify GroundStation's added hardware.
//
// return true if there is no error, false otherwise.
//-------------------------------------------------------------------------
// made changes by Tuan Nguyen
bool GroundStation::VerifyAddHardware()
{
   Gmat::ObjectType type;
   std::string subTypeName;
   GmatBase* obj;

   // 1. Verify all hardware in hardwareList are not NULL:
   for(ObjectArray::iterator i= hardwareList.begin(); i != hardwareList.end(); ++i)
   {
	   obj = (*i);
	   if (obj == NULL)
	   {
		   MessageInterface::ShowMessage("***Error***:One element of hardwareList = NULL\n");
		   return false;
	   }
   }

   // 2. Verify primary antenna to be in hardwareList:
   // 2.1. Create antenna list from hardwareList for searching:
   // extract all antenna from hardwareList and store to antennaList
   ObjectArray antennaList;
   for(ObjectArray::iterator i= hardwareList.begin(); i != hardwareList.end(); ++i)
   {
	  obj = (*i);
      subTypeName = obj->GetTypeName();
	  if (subTypeName == "Antenna")
		 antennaList.push_back(obj);
   }

   // 2.2. Verify primary antenna of Receiver, Transmitter, and Transponder:
   GmatBase* antenna;
   GmatBase* primaryAntenna;
   std::string primaryAntennaName;
   bool verify = true;
   for(ObjectArray::iterator i= hardwareList.begin(); i != hardwareList.end(); ++i)
   {
	  obj = (*i);
	  type = obj->GetType();
	  if (type == Gmat::HARDWARE)
	  {
         subTypeName = obj->GetTypeName();
         if ((subTypeName == "Transmitter")||
        	 (subTypeName == "Receiver")||
        	 (subTypeName == "Transponder"))
         {
    		 // Get primary antenna:
    		 primaryAntennaName = obj->GetRefObjectName(Gmat::HARDWARE);
    		 primaryAntenna = obj->GetRefObject(Gmat::HARDWARE,primaryAntennaName);

    		 bool check;
    		 if (primaryAntenna == NULL)
    		 {
    			 MessageInterface::ShowMessage
					 ("***Error***:primary antenna of %s in %s's AddHardware list is NULL \n",
					  obj->GetName().c_str(), this->GetName().c_str());
    			 check = false;
    		 }
    		 else
    		 {
    			 // Check primary antenna of transmitter, receiver, or transponder is in antenna list:
    			 check = false;
    			 for(ObjectArray::iterator j= antennaList.begin(); j != antennaList.end(); ++j)
    			 {
    				 antenna = (*j);
    				 if (antenna == primaryAntenna)
    				 {
    					 check = true;
    					 break;
    				 }
    				 else if (antenna->GetName() == primaryAntenna->GetName())
    				 {
    					 MessageInterface::ShowMessage
							 ("Primary antenna %s of %s is a clone of an antenna in %s's AddHardware\n",
							  primaryAntenna->GetName().c_str(), obj->GetName().c_str(), this->GetName().c_str());
    				 }
    			 }
            	 if (check == false)
            	 {
            		 // Display error message:
            		 MessageInterface::ShowMessage
							 ("***Error***:primary antenna of %s is not in %s's AddHardware\n",
							  obj->GetName().c_str(), this->GetName().c_str());
            	 }

        	 }

        	 verify = verify && check;
         }
	  }
   }

   return verify;
}
开发者ID:rockstorm101,项目名称:GMAT,代码行数:99,代码来源:GroundStation.cpp


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