//------------------------------------------------------------------------------ // virtual void LoadData() //------------------------------------------------------------------------------ void ThrusterCoefficientDialog::LoadData() { Integer paramID = 0; int coefCount = Thruster::COEFFICIENT_COUNT; std::stringstream cStrings(""); std::stringstream kStrings(""); if (coefType == "C") { std::stringstream cStrings(""); for (Integer ii = 0; ii < coefCount; ii++) { cStrings << "C" << ii + 1; coefNames.push_back(cStrings.str()); cStrings.str(""); } paramID = theObject->GetParameterID("C_UNITS"); StringArray coefUnits = theObject->GetStringArrayParameter(paramID); for (Integer i = 0; i < coefCount; i++) { coefGrid->SetCellValue(i, 0, coefNames[i].c_str()); coefGrid->SetCellValue(i, 1, wxVariant(coefValues[i])); coefGrid->SetCellValue(i, 2, coefUnits[i].c_str()); } } else if (coefType == "K") { std::stringstream kStrings(""); for (Integer ii = 0; ii < coefCount; ii++) { kStrings << "K" << ii + 1; coefNames.push_back(kStrings.str()); kStrings.str(""); } paramID = theObject->GetParameterID("K_UNITS"); StringArray coefUnits = theObject->GetStringArrayParameter(paramID); for (Integer i = 0; i < coefCount; i++) { coefGrid->SetCellValue(i, 0, coefNames[i].c_str()); coefGrid->SetCellValue(i, 1, wxVariant(coefValues[i])); coefGrid->SetCellValue(i, 2, coefUnits[i].c_str()); } } }
//------------------------------------------------------------------------------ // void LoadData() //------------------------------------------------------------------------------ void BurnThrusterPanel::LoadData() { #ifdef DEBUG_BURNPANEL_LOAD MessageInterface::ShowMessage("BurnThrusterPanel::LoadData() entered\n"); #endif // Set object pointer for "Show Script" mObject = theObject; bool isImpBurn = false; if (theObject->GetType() == Gmat::IMPULSIVE_BURN) isImpBurn = true; if (isImpBurn) { thrustDir1 = "Element1"; thrustDir2 = "Element2"; thrustDir3 = "Element3"; } else { thrustDir1 = "ThrustDirection1"; thrustDir2 = "ThrustDirection2"; thrustDir3 = "ThrustDirection3"; } Integer paramID; try { paramID = theObject->GetParameterID("CoordinateSystem"); coordSysName = theObject->GetStringParameter(paramID); coordSysComboBox->SetValue(coordSysName.c_str()); paramID = theObject->GetParameterID("Origin"); std::string objName = theObject->GetStringParameter(paramID); originComboBox->SetValue(objName.c_str()); paramID = theObject->GetParameterID("Axes"); objName = theObject->GetStringParameter(paramID); axesComboBox->SetValue(objName.c_str()); paramID = theObject->GetParameterID(thrustDir1); elem1TextCtrl->SetValue(wxVariant(theObject->GetRealParameter(paramID))); paramID = theObject->GetParameterID(thrustDir2); elem2TextCtrl->SetValue(wxVariant(theObject->GetRealParameter(paramID))); paramID = theObject->GetParameterID(thrustDir3); elem3TextCtrl->SetValue(wxVariant(theObject->GetRealParameter(paramID))); paramID = theObject->GetParameterID("DecrementMass"); decMassCheckBox->SetValue((wxVariant(theObject->GetBooleanParameter(paramID)))); paramID = theObject->GetParameterID("GravitationalAccel"); gravityAccelTextCtrl->SetValue((wxVariant(theObject->GetRealParameter(paramID)))); paramID = theObject->GetParameterID("Tank"); StringArray tanks = theObject->GetStringArrayParameter(paramID); if (tanks.empty()) { if (theGuiManager->GetNumFuelTank() > 0) { tankComboBox->Insert("No Fuel Tank Selected", 0); tankComboBox->SetSelection(0); } } else { tankName = tanks[0]; tankComboBox->SetValue(STD_TO_WX_STRING(tankName.c_str())); isTankEmpty = false; } // Disable tank combo box if decrement mass is not checked if (!decMassCheckBox->IsChecked()) { // Tanks needed to apply nontrivial coefficients, so don't disable //tankLabel->Disable(); //tankComboBox->Disable(); // g is only used to decrement mass gravityAccelLabel->Disable(); gravityAccelTextCtrl->Disable(); gravityAccelUnit->Disable(); if (theObject->GetType() == Gmat::IMPULSIVE_BURN) { ispLabel->Disable(); ispTextCtrl->Disable(); ispUnit->Disable(); } } else { // g is required to decrement mass gravityAccelLabel->Enable(); gravityAccelTextCtrl->Enable(); gravityAccelUnit->Enable(); } if (theObject->IsOfType(Gmat::THRUSTER)) { if (theObject->IsOfType("ChemicalThruster")) { // Get the initial values for the coefficients Integer cParamID = 0; Integer kParamID = 0; Integer coefCount = ChemicalThruster::COEFFICIENT_COUNT; std::stringstream cStrings(""); std::stringstream kStrings(""); Real cVal, kVal; for (Integer ii = 0; ii < coefCount; ii++) { cStrings << "C" << ii + 1; cParamID = theObject->GetParameterID(cStrings.str()); cVal = theObject->GetRealParameter(cParamID); #ifdef DEBUG_BURNPANEL_LOAD MessageInterface::ShowMessage("Loading: %s = %lf\n", cStrings.str().c_str(), cVal); #endif cCoefs.push_back(cVal); cCoefNames.push_back(cStrings.str()); cStrings.str(""); } for (Integer ii = 0; ii < coefCount; ii++) { kStrings << "K" << ii + 1; kParamID = theObject->GetParameterID(kStrings.str()); kVal = theObject->GetRealParameter(kParamID); #ifdef DEBUG_BURNPANEL_LOAD MessageInterface::ShowMessage("Loading: %s = %lf\n", kStrings.str().c_str(), kVal); #endif kCoefs.push_back(kVal); kCoefNames.push_back(kStrings.str()); kStrings.str(""); } } else // Electric Thruster { // Get the initial values for the coefficients Integer tParamID = 0; Integer mfParamID = 0; Integer coefCount = ElectricThruster::ELECTRIC_COEFF_COUNT; std::stringstream tStrings(""); std::stringstream mfStrings(""); Real tVal, mfVal; for (Integer ii = 0; ii < coefCount; ii++) { tStrings << "ThrustCoeff" << ii + 1; tParamID = theObject->GetParameterID(tStrings.str()); tVal = theObject->GetRealParameter(tParamID); #ifdef DEBUG_BURNPANEL_LOAD MessageInterface::ShowMessage("Loading: %s = %lf\n", tStrings.str().c_str(), tVal); #endif tCoefs.push_back(tVal); tCoefNames.push_back(tStrings.str()); tStrings.str(""); } for (Integer ii = 0; ii < coefCount; ii++) { mfStrings << "MassFlowCoeff" << ii + 1; mfParamID = theObject->GetParameterID(mfStrings.str()); mfVal = theObject->GetRealParameter(mfParamID); #ifdef DEBUG_BURNPANEL_LOAD MessageInterface::ShowMessage("Loading: %s = %lf\n", mfStrings.str().c_str(), mfVal); #endif mfCoefs.push_back(mfVal); mfCoefNames.push_back(mfStrings.str()); mfStrings.str(""); } } } // Update Origin and Axes UpdateOriginAxes(); } catch (BaseException &e) { MessageInterface::PopupMessage(Gmat::ERROR_, e.GetFullMessage()); } #ifdef DEBUG_BURNPANEL_LOAD MessageInterface::ShowMessage("BurnThrusterPanel::LoadData() exiting\n"); #endif }