本文整理汇总了C++中GmatBase::TakeAction方法的典型用法代码示例。如果您正苦于以下问题:C++ GmatBase::TakeAction方法的具体用法?C++ GmatBase::TakeAction怎么用?C++ GmatBase::TakeAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GmatBase
的用法示例。
在下文中一共展示了GmatBase::TakeAction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Initialize
//------------------------------------------------------------------------------
bool Target::Initialize()
{
GmatBase *mapObj = NULL;
cloneCount = 0;
if ((mapObj = FindObject(solverName)) == NULL)
{
wxString errorString = wxT("Target command cannot find targeter \"");
errorString += solverName;
errorString += wxT("\"");
throw CommandException(errorString, Gmat::ERROR_);
}
// Clone the targeter for local use
#ifdef DEBUG_TARGET_INIT
MessageInterface::ShowMessage
(wxT("Target::Initialize() cloning mapObj <%p>'%s'\n"), mapObj,
mapObj->GetName().c_str());
MessageInterface::ShowMessage
(wxT("mapObj maxIter=%d\n"),
mapObj->GetIntegerParameter(mapObj->GetParameterID(wxT("MaximumIterations"))));
#endif
// Delete the old cloned solver
if (theSolver)
{
#ifdef DEBUG_MEMORY
MemoryTracker::Instance()->Remove
(theSolver, wxT("local solver", "Target::Initialize()"),
wxT("deleting local cloned solver"));
#endif
delete theSolver;
}
theSolver = (Solver *)(mapObj->Clone());
if (theSolver != NULL)
++cloneCount;
#ifdef DEBUG_MEMORY
MemoryTracker::Instance()->Add
(theSolver, theSolver->GetName(), wxT("Target::Initialize()"),
wxT("theSolver = (Solver *)(mapObj->Clone())"));
#endif
theSolver->TakeAction(wxT("ResetInstanceCount"));
mapObj->TakeAction(wxT("ResetInstanceCount"));
theSolver->TakeAction(wxT("IncrementInstanceCount"));
mapObj->TakeAction(wxT("IncrementInstanceCount"));
if (theSolver->GetStringParameter(wxT("ReportStyle")) == wxT("Debug"))
targeterInDebugMode = true;
theSolver->SetStringParameter(wxT("SolverMode"),
GetStringParameter(SOLVER_SOLVE_MODE));
theSolver->SetStringParameter(wxT("ExitMode"),
GetStringParameter(SOLVER_EXIT_MODE));
// Set the local copy of the targeter on each node
std::vector<GmatCommand*>::iterator node;
GmatCommand *current;
specialState = Solver::INITIALIZING;
for (node = branch.begin(); node != branch.end(); ++node)
{
current = *node;
#ifdef DEBUG_TARGET_COMMANDS
Integer nodeNum = 0;
#endif
while ((current != NULL) && (current != this))
{
#ifdef DEBUG_TARGET_COMMANDS
MessageInterface::ShowMessage(
wxT(" Target Command %d: %s\n"), ++nodeNum,
current->GetTypeName().c_str());
#endif
if ((current->GetTypeName() == wxT("Vary")) ||
(current->GetTypeName() == wxT("Achieve")))
current->SetRefObject(theSolver, Gmat::SOLVER, solverName);
current = current->GetNext();
}
}
bool retval = SolverBranchCommand::Initialize();
if (retval == true) {
// Targeter specific initialization goes here:
if (FindObject(solverName) == NULL)
{
wxString errorString = wxT("Target command cannot find targeter \"");
errorString += solverName;
errorString += wxT("\"");
throw CommandException(errorString);
}
retval = theSolver->Initialize();
}
targeterInFunctionInitialized = false;
//.........这里部分代码省略.........
示例2: SaveData
//------------------------------------------------------------------------------
// virtual void SaveData()
//------------------------------------------------------------------------------
void GroundTrackPlotPanel::SaveData()
{
#if DEBUG_PANEL_SAVE
MessageInterface::ShowMessage
("GroundTrackPlotPanel::SaveData() entered, mHasCentralBodyChanged=%d, "
" mHasObjectListChanged=%d\n mHasIntegerDataChanged=%d, "
"mHasTextureMapChanged=%d\n", mHasCentralBodyChanged, mHasObjectListChanged,
mHasIntegerDataChanged, mHasTextureMapChanged);
#endif
canClose = true;
std::string str1, str2;
Integer collectFreq = 0, updateFreq = 0, pointsToRedraw = 0;
//-----------------------------------------------------------------
// check values from text field
//-----------------------------------------------------------------
if (mHasIntegerDataChanged)
{
CheckInteger(collectFreq, mDataCollectFreqTextCtrl->GetValue().c_str(),
"DataCollectFrequency", "Integer Number > 0", false, true, true);
CheckInteger(updateFreq, mUpdatePlotFreqTextCtrl->GetValue().c_str(),
"UpdatePlotFrequency", "Integer Number > 0", false, true, true);
CheckInteger(pointsToRedraw, mNumPointsToRedrawTextCtrl->GetValue().c_str(),
"NumPointsToRedraw", "Integer Number >= 0", false, true, true, true);
}
if (!canClose)
return;
//-----------------------------------------------------------------
// save values to base, base code should do the range checking
//-----------------------------------------------------------------
GmatBase *clonedObj = mGroundTrackPlot->Clone();
try
{
if (mHasCentralBodyChanged)
{
std::string newCentralBody = mCentralBodyComboBox->GetValue().WX_TO_STD_STRING;
std::string newTexture = mTextureMapTextCtrl->GetValue().WX_TO_STD_STRING;
clonedObj->SetStringParameter("CentralBody", newCentralBody);
mHasCentralBodyChanged = false;
// Set mHasTextureMapChanged to true so that it can be validated below (LOJ: 2014.11.03)
mHasTextureMapChanged = true;
}
if (mHasObjectListChanged)
{
#if DEBUG_PANEL_SAVE
MessageInterface::ShowMessage(" Saving object list\n");
#endif
clonedObj->TakeAction("Clear");
int count = mObjectCheckListBox->GetCount();
for (int i = 0; i < count; i++)
{
if (mObjectCheckListBox->IsChecked(i))
{
std::string objName = mObjectCheckListBox->GetString(i).WX_TO_STD_STRING;
#ifdef DEBUG_PANEL_SAVE
MessageInterface::ShowMessage(" objName = '%s'\n", objName.c_str());
#endif
clonedObj->SetStringParameter("Add", objName);
}
}
mHasObjectListChanged = false;
}
if (mHasIntegerDataChanged)
{
#if DEBUG_PANEL_SAVE
MessageInterface::ShowMessage(" Saving Integer data\n");
#endif
clonedObj->SetIntegerParameter("DataCollectFrequency", collectFreq);
clonedObj->SetIntegerParameter("UpdatePlotFrequency", updateFreq);
clonedObj->SetIntegerParameter("NumPointsToRedraw", pointsToRedraw);
mHasIntegerDataChanged = false;
}
if (mHasDataOptionChanged)
{
#if DEBUG_PANEL_SAVE
MessageInterface::ShowMessage(" Saving drawing options\n");
#endif
clonedObj->SetBooleanParameter("ShowPlot", mShowPlotCheckBox->GetValue());
clonedObj->SetStringParameter("SolverIterations",
mSolverIterComboBox->GetValue().c_str());
mHasDataOptionChanged = false;
}
// Save texture map
if (mHasTextureMapChanged)
{
#if DEBUG_PANEL_SAVE
MessageInterface::ShowMessage(" Saving new texture map\n");
//.........这里部分代码省略.........