//------------------------------------------------------------------------------ // void OnComboBoxChange(wxCommandEvent& event) //------------------------------------------------------------------------------ void GroundTrackPlotPanel::OnComboBoxChange(wxCommandEvent& event) { if (event.GetEventObject() == mSolverIterComboBox) { mHasDataOptionChanged = true; } else if (event.GetEventObject() == mCentralBodyComboBox) { mHasCentralBodyChanged = true; wxString bodyTexture; if (mCentralBodyComboBox->GetValue() == mCentralBody) { bodyTexture = mTextureFile; } else { // Update texture map to corresponding body CelestialBody *body = (CelestialBody*) theGuiInterpreter->GetConfiguredObject(mCentralBodyComboBox->GetValue().c_str()); Integer id = body->GetParameterID("TextureMapFileName"); bodyTexture = body->GetStringParameter(id).c_str(); } #ifdef DEBUG_CENTRAL_BODY MessageInterface::ShowMessage ("OnComboBoxChange(), bodyTexture = '%s'\n", bodyTexture.c_str()); #endif mTextureMapTextCtrl->SetValue(bodyTexture); mTextureMapTextCtrl->SetInsertionPointEnd(); } EnableUpdate(true); }
//------------------------------------------------------------------------------ // void OnHorizonReferenceComboBoxChange() //------------------------------------------------------------------------------ void GroundStationPanel::OnHorizonReferenceComboBoxChange(wxCommandEvent &event) { std::string horizon = horizonReferenceComboBox->GetValue().c_str(); std::string inputString; Real location1, location2, location3; if (horizon != currentHorizonReference) { std::string bodyName = centralBodyComboBox->GetValue().c_str(); // get a pointer to the celestial body CelestialBody *body = ss->GetBody(bodyName); if (!body) { std::string errmsg = "Cannot find body "; errmsg += bodyName + " needed for GroundStation panel update.\n"; throw GmatBaseException(errmsg); } Real meanRadius = body->GetRealParameter(body->GetParameterID("EquatorialRadius")); Real flattening = body->GetRealParameter(body->GetParameterID("Flattening")); // Convert location values to the appropriate values // Location 1 (Latitude) inputString = location1TextCtrl->GetValue(); CheckReal(location1, inputString, localGroundStation->GetStringParameter(BodyFixedPoint::LOCATION_LABEL_1), "Real Number"); // Location 2 (Longitude) inputString = location2TextCtrl->GetValue(); if (currentStateType != "Cartesian") CheckReal(location2, inputString, localGroundStation->GetStringParameter(BodyFixedPoint::LOCATION_LABEL_2), "Real Number >= 0.0", false, true, true, true); else CheckReal(location2, inputString, localGroundStation->GetStringParameter(BodyFixedPoint::LOCATION_LABEL_2), "Real Number"); // Location 3 (Altitude) inputString = location3TextCtrl->GetValue(); CheckReal(location3, inputString, localGroundStation->GetStringParameter(BodyFixedPoint::LOCATION_LABEL_3), "Real Number"); Rvector3 locInCurrent(location1, location2, location3); if (currentStateType == "Spherical") // latitude and longitude need to be passed in as radians { locInCurrent[0] *= GmatMathConstants::RAD_PER_DEG; locInCurrent[1] *= GmatMathConstants::RAD_PER_DEG; } //MessageInterface::ShowMessage(" ... Spherical to new horizon ... loc = %12.10f %12.10f %12.10f\n", // locInCurrent[0], locInCurrent[1], locInCurrent[2]); // ************************* Rvector3 locInNew = BodyFixedStateConverterUtil::Convert(locInCurrent, currentStateType, currentHorizonReference, currentStateType, horizon, flattening, meanRadius); //MessageInterface::ShowMessage(" ... result = %12.10f %12.10f %12.10f\n", // locInNew[0], locInNew[1], locInNew[2]); // ************************* location1 = locInNew[0]; location2 = locInNew[1]; location3 = locInNew[2]; if (currentStateType == "Spherical") // need to display DEGREES for latitude and longitude { location1 *= GmatMathConstants::DEG_PER_RAD; location2 *= GmatMathConstants::DEG_PER_RAD; } localGroundStation->SetStringParameter(BodyFixedPoint::HORIZON_REFERENCE, horizon); localGroundStation->SetRealParameter(BodyFixedPoint::LOCATION_1, location1); localGroundStation->SetRealParameter(BodyFixedPoint::LOCATION_2, location2); localGroundStation->SetRealParameter(BodyFixedPoint::LOCATION_3, location3); location1TextCtrl->SetValue(ToWxString(location1)); location2TextCtrl->SetValue(ToWxString(location2)); location3TextCtrl->SetValue(ToWxString(location3)); currentHorizonReference = horizon; } UpdateControls(); EnableUpdate(true); }