//------------------------------------------------------------------------------ // 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; #ifdef DEBUG_PERSISTENCE MessageInterface::ShowMessage("...... Now saving plot data to %s:\n", (sub->GetName()).c_str()); MessageInterface::ShowMessage(" Upper left = %12.10f %12.10f\n", upperLeft[0], upperLeft[1]); MessageInterface::ShowMessage(" Size = %12.10f %12.10f\n", childSize[0], childSize[1]); MessageInterface::ShowMessage(" RelativeZOrder = %d\n", relativeZOrder); #endif sub->SetRvectorParameter(sub->GetParameterID("UpperLeft"), upperLeft); sub->SetRvectorParameter(sub->GetParameterID("Size"), childSize); sub->SetIntegerParameter(sub->GetParameterID("RelativeZOrder"), relativeZOrder); sub->SetBooleanParameter(sub->GetParameterID("Maximized"), isMaximized); } else if (mItemType == GmatTree::MISSION_TREE_UNDOCKED) { // get the config object wxFileConfig *pConfig; pConfig = (wxFileConfig *) GmatAppData::Instance()->GetPersonalizationConfig(); std::stringstream location(""); location << upperLeft[0] << " " << upperLeft[1]; std::stringstream size(""); size << childSize[0] << " " << childSize[1]; pConfig->Write("/MissionTree/UpperLeft", location.str().c_str()); pConfig->Write("/MissionTree/Size", size.str().c_str()); pConfig->Write("/MissionTree/IsMaximized", isMaximized); pConfig->Write("/MissionTree/IsMinimized", isMinimized); } else if (mItemType == GmatTree::SCRIPT_FILE) { // get the config object wxFileConfig *pConfig; pConfig = (wxFileConfig *) GmatAppData::Instance()->GetPersonalizationConfig(); std::stringstream location(""); location << upperLeft[0] << " " << upperLeft[1]; std::stringstream size(""); size << childSize[0] << " " << childSize[1]; pConfig->Write("/ScriptEditor/UpperLeft", location.str().c_str()); pConfig->Write("/ScriptEditor/Size", size.str().c_str()); pConfig->Write("/ScriptEditor/IsMaximized", isMaximized); pConfig->Write("/ScriptEditor/IsMinimized", isMinimized); } }
//------------------------------------------------------------------------------ // bool SetStringParameter(const Integer id, const std::string &value) //------------------------------------------------------------------------------ bool GroundTrackPlot::SetStringParameter(const Integer id, const std::string &value) { #if DBGLVL_PARAM_STRING MessageInterface::ShowMessage ("GroundTrackPlot::SetStringParameter() this=<%p>'%s', id=%d<%s>, value='%s'\n", this, instanceName.c_str(), id, GetParameterText(id).c_str(), value.c_str()); #endif switch (id) { case COORD_SYSTEM: // script do not specify view coordinate system, so do nothing here // we want to create local body fixed coord system instead in Initialize() break; case CENTRAL_BODY: if (centralBodyName != value) { centralBodyName = value; // Since ground track data uses body fixed coordinates, name it here mViewCoordSysName = value + "Fixed"; // Get default texture map file for the new body FileManager *fm = FileManager::Instance(); std::string mapFile = GmatStringUtil::ToUpper(centralBodyName) + "_TEXTURE_FILE"; textureMapFileName = fm->GetFullPathname(mapFile); #if DBGLVL_PARAM_STRING MessageInterface::ShowMessage (" this = <%p>, textureMapFile changed to '%s'\n", this, textureMapFileName.c_str()); #endif } return true; case TEXTURE_MAP: textureMapFileName = value; return true; case SHOW_FOOT_PRINTS: { bool itemFound = false; int index = -1; for (int i = 0; i < FootPrintOptionCount; i++) { if (value == FOOT_PRINT_OPTION_TEXT[i]) { itemFound = true; index = i; break; } } if (itemFound) { footPrints = value; footPrintOption = (FootPrintOption)index; #if DBGLVL_PARAM_STRING MessageInterface::ShowMessage(" footPrintOption = %d\n", footPrintOption); #endif return true; } else { SubscriberException se; std::string options; for (int i = 0; i < FootPrintOptionCount - 1; i++) options = options + FOOT_PRINT_OPTION_TEXT[i] + " ,"; options = options + FOOT_PRINT_OPTION_TEXT[FootPrintOptionCount - 1]; se.SetDetails(errorMessageFormat.c_str(), value.c_str(), GetParameterText(id).c_str(), options.c_str()); throw se; } } default: ; // Intentional drop through so all paths return a value } return OrbitPlot::SetStringParameter(id, value); }