Esempio n. 1
0
//------------------------------------------------------------------------------
std::string ConsoleMessageReceiver::GetLogFileName()
{
   FileManager *fm = FileManager::Instance();
   std::string fname;
   try
   {
      if (logFileName == "")
      {
         fname = fm->GetFullPathname("LOG_FILE");
      }
      else
      {
         std::string outputPath = fm->GetPathname(FileManager::LOG_FILE);
         
         // add output path if there is no path
         if (logFileName.find("/") == logFileName.npos &&
             logFileName.find("\\") == logFileName.npos)
         {
            fname = outputPath + logFileName;
         }
      }
   }
   catch (BaseException &e)
   {
      ShowMessage
         ("**** ERROR **** " + e.GetFullMessage() + 
          "So setting log file name to GmatLog.txt");
      
      fname = "GmatLog.txt";
   }
   
   return fname;
}
//------------------------------------------------------------------------------
// virtual void LoadData()
//------------------------------------------------------------------------------
void RunScriptFolderDialog::LoadData()
{
   #ifdef DEBUG_RUN_SCRIPT_FOLDER_DIALOG
   MessageInterface::ShowMessage("RunScriptFolderDialog::LoadData() entered.\n");
   #endif
   
   wxString str;
   str.Printf("%d", mNumScriptsToRun);
   mNumScriptsToRunTextCtrl->SetValue(str);
   
   FileManager *fm = FileManager::Instance();
   wxString sep = fm->GetPathSeparator().c_str();
   
   try
   {
      mCurrOutDir = fm->GetFullPathname(FileManager::OUTPUT_PATH).c_str();
   }
   catch (BaseException &e)
   {
      MessageInterface::ShowMessage(e.GetFullMessage());
   }
   
   #ifdef DEBUG_RUN_SCRIPT_FOLDER_DIALOG
   MessageInterface::ShowMessage("   mCurrOutDir='%s'\n", mCurrOutDir.c_str());
   #endif
   
   mSaveScriptsDirTextCtrl->SetValue(mCurrOutDir + "AutoSave");
   mCurrOutDirTextCtrl->SetValue(mCurrOutDir);
   
   //=======================================================
   #ifdef __ENABLE_COMPARE__
   //=======================================================
   str.Printf("%g", mAbsTol);
   mAbsTolTextCtrl->SetValue(str);
   mCompareDirTextCtrl->SetValue(mCompareDir);
   mSaveFileTextCtrl->SetValue(mCompareDir + sep + "CompareNumericResults.txt");
   mSaveResultCheckBox->Disable();
   mSaveFileTextCtrl->Disable();
   mSaveBrowseButton->Disable();
   mSaveScriptsDirTextCtrl->Disable();
   mChangeSaveScriptsDirButton->Disable();
   //=======================================================
   #endif
   //=======================================================
   
   theOkButton->Enable();
   
   #ifdef DEBUG_RUN_SCRIPT_FOLDER_DIALOG
   MessageInterface::ShowMessage("RunScriptFolderDialog::LoadData() leaving.\n");
   #endif
}
Esempio n. 3
0
/**
 * Constructor
 *
 * @param frame			Parent frame
 * @param title			Title for the frame
 * @param x				window position x
 * @param y				window position y
 * @param w				window width
 * @param h				window height
 * @param mode			window mode ("Permanent", "Temporary")
 * @param type			text type ("Output", "Script")
 */
ViewTextFrame::ViewTextFrame(wxFrame *frame, const wxString& title,
                             int x, int y, int w, int h, const wxString &mode,
                             const wxString &type)
   : wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h),
             wxDEFAULT_FRAME_STYLE | wxFRAME_FLOAT_ON_PARENT)
{
   CreateStatusBar(2);
   mWindowMode = mode;
   mTextType = type;

   // Set additional style wxTE_RICH to Ctrl + mouse scroll wheel to decrease or
   // increase text size(loj: 2009.02.05)
   mTextCtrl = new wxTextCtrl(this, -1, _T(""), wxPoint(0, 0), wxSize(0, 0),
                              wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP | wxTE_RICH);
   mTextCtrl->SetMaxLength(320000);
   mTextCtrl->SetFont(GmatAppData::Instance()->GetFont());

#if wxUSE_MENUS
   // create a menu bar
   SetMenuBar(CreateMainMenu());
#endif // wxUSE_MENUS

   // Set icon if icon file is in the start up file
   FileManager *fm = FileManager::Instance();
   try
   {
      wxString iconfile = fm->GetFullPathname("MAIN_ICON_FILE").c_str();
      #if defined __WXMSW__
         SetIcon(wxIcon(iconfile, wxBITMAP_TYPE_ICO));
      #elif defined __WXGTK__
         SetIcon(wxIcon(iconfile, wxBITMAP_TYPE_XPM));
      #elif defined __WXMAC__
         SetIcon(wxIcon(iconfile, wxBITMAP_TYPE_PICT_RESOURCE));
      #endif
   }
   catch (GmatBaseException &)
   {
      //MessageInterface::ShowMessage(e.GetMessage());
   }

   CenterOnScreen(wxBOTH);
}
Esempio n. 4
0
//------------------------------------------------------------------------------
void GmatDialog::ShowData()
{
   // add items to middle sizer

   theDialogSizer->Add(theMiddleSizer, 1, wxGROW | wxALL, 1);
   theDialogSizer->Add(theBottomSizer, 0, wxGROW | wxALL, 1);

   // tells the enclosing window to adjust to the size of the sizer
   SetAutoLayout(TRUE);
   SetSizer(theDialogSizer); //use the sizer for layout
   theDialogSizer->Fit(this); //loj: if theParent is used it doesn't show the scroll bar
   theDialogSizer->SetSizeHints(this); //set size hints to honour minimum size

   // Set icon if icon file is in the start up file
   FileManager *fm = FileManager::Instance();
   try
   {
      wxString iconfile = fm->GetFullPathname(wxT("MAIN_ICON_FILE"));
      #if defined __WXMSW__
         SetIcon(wxIcon(iconfile, wxBITMAP_TYPE_ICO));
      #elif defined __WXGTK__
         SetIcon(wxIcon(iconfile, wxBITMAP_TYPE_XPM));
      #elif defined __WXMAC__
         SetIcon(wxIcon(iconfile, wxBITMAP_TYPE_PICT_RESOURCE));
      #endif
   }
   catch (GmatBaseException &)
   {
      //MessageInterface::ShowMessage(e.GetMessage());
   }

   CenterOnScreen(wxBOTH);

   // We want always enable OK button
   //theOkButton->Disable();
   //theHelpButton->Disable(); //loj: for future build

   LoadData();

}
Esempio n. 5
0
//------------------------------------------------------------------------------
GroundTrackPlot::GroundTrackPlot(const std::string &name)
   : OrbitPlot("GroundTrackPlot", name)
{
   // GmatBase data
   parameterCount = GroundTrackPlotParamCount;
   objectTypeNames.push_back("GroundTrackPlot");
   
   centralBody = NULL;
   centralBodyName = "Earth";
   mViewCoordSysName = "EarthFixed";
   footPrints = "None";
   
   // Set default texture map file from the startup file through the FileManager
   FileManager *fm = FileManager::Instance();
   textureMapFileName = fm->GetFullPathname("EARTH_TEXTURE_FILE");
   
   footPrintOption = FP_NONE;
   
   footPrintOptions.clear();
   for (UnsignedInt i = 0; i < FootPrintOptionCount; i++)
      footPrintOptions.push_back(FOOT_PRINT_OPTION_TEXT[i]);
}
Esempio n. 6
0
//------------------------------------------------------------------------------
// void OpenSolverTextFile();
//------------------------------------------------------------------------------
void Solver::OpenSolverTextFile()
{
   #ifdef DEBUG_SOLVER_INIT
   MessageInterface::ShowMessage
      (wxT("Solver::OpenSolverTextFile() entered, showProgress=%d, solverTextFile='%s', ")
       wxT("textFileOpen=%d"), showProgress, solverTextFile.c_str(), textFile.is_open());
   #endif
   
   if (!showProgress)
      return;
   
   FileManager *fm;
   fm = FileManager::Instance();
   wxString outPath = fm->GetFullPathname(FileManager::OUTPUT_PATH);
   wxString fullSolverTextFile = outPath + solverTextFile;
   
   if (textFile.is_open())
      textFile.close();
   
   #ifdef DEBUG_SOLVER_INIT
   MessageInterface::ShowMessage(wxT("   instanceNumber=%d\n"), instanceNumber);
   #endif
   
   if (instanceNumber == 1)
      textFile.open(fullSolverTextFile.char_str());
   else
      textFile.open(fullSolverTextFile.char_str(), std::ios::app);
   
   if (!textFile.is_open())
      throw SolverException(wxT("Error opening targeter text file ") +
                            solverTextFile);
   
   textFile.precision(16);
   
   #ifdef DEBUG_SOLVER_INIT
   MessageInterface::ShowMessage(wxT("Solver::OpenSolverTextFile() leaving\n"));
   #endif
}
Esempio n. 7
0
//------------------------------------------------------------------------------
AboutDialog::AboutDialog(wxWindow *parent, wxWindowID id, const wxString& title,
                         const wxPoint& pos, const wxSize& size, long style)
   : wxDialog(parent, id, title, pos, size, style, title)
{
   #ifdef DEBUG_ICONFILE
   MessageInterface::ShowMessage("AboutDialog::AboutDialog() entered\n");
   #endif
   wxBitmap bitmap;
   wxBitmapButton *aboutButton;
   
   // if icon file available, use it
   FileManager *fm = FileManager::Instance();
   std::string iconFile = (fm->GetFullPathname("ICON_PATH") + "GMATAboutIcon.png");
   #ifdef DEBUG_ICONFILE
   MessageInterface::ShowMessage("   About iconFile='%s'\n", iconFile.c_str());
   #endif
   if (fm->DoesFileExist(iconFile))
   {
      //bitmap.LoadFile(iconFile.c_str(), wxBITMAP_TYPE_JPEG);
      bitmap.LoadFile(iconFile.c_str(), wxBITMAP_TYPE_PNG);
      wxImage image = bitmap.ConvertToImage();
      #ifdef DEBUG_ICONFILE
      MessageInterface::ShowMessage("   Scaling and creating bitmap button\n");
      #endif
      bitmap = wxBitmap(image.Scale(100, 100), wxIMAGE_QUALITY_HIGH);
      aboutButton = new wxBitmapButton(this, -1, bitmap, wxDefaultPosition,
                                       wxSize(100, 100), wxBORDER_NONE);
   }
   else
   {
      MessageInterface::ShowMessage
         ("About GMAT icon file '%s' does not exist.\n", iconFile.c_str());
      aboutButton = new wxBitmapButton(this, -1, NULL, wxDefaultPosition,
                                       wxSize(100, 100));
   }
   
   #ifdef DEBUG_ICONFILE
   MessageInterface::ShowMessage("   Bitmap button created\n");
   #endif
   
   wxColourDatabase cdb;
   wxColour gmatColor = cdb.Find("NAVY");
      
   wxStaticLine *line1 = new wxStaticLine(this);
   wxStaticLine *line2 = new wxStaticLine(this);
   
   // title, build date   
   wxStaticText *gmatText =
      new wxStaticText(this, -1, "General Mission Analysis Tool");
   wxFont font1 = wxFont();
   
   #ifdef __WXMAC__
   font1.SetPointSize(20);
   #else
   font1.SetPointSize(11);
   #endif
   
   font1.SetWeight(wxFONTWEIGHT_BOLD);
   gmatText->SetOwnFont(font1);
   gmatText->SetOwnForegroundColour(gmatColor);
   
   wxString buildDate;
   buildDate.Printf("Build Date: %s %s\n", __DATE__, __TIME__);
   
   wxStaticText *buildText = new wxStaticText(this, -1, buildDate);
   
   #ifdef __WXMAC__
   font1.SetPointSize(12);
   #else
   font1.SetPointSize(8);
   #endif
   
   font1.SetWeight(wxFONTWEIGHT_LIGHT);
   buildText->SetFont(font1);
   
   // website and contact email
   wxStaticText *webText = new wxStaticText(this, -1, "Website: ");
   wxString gmatUrl = "http://gmat.gsfc.nasa.gov";
   wxHyperlinkCtrl *webLink = new wxHyperlinkCtrl(this, -1, gmatUrl, gmatUrl);
   wxStaticText *contactText = new wxStaticText(this, -1, "Contact: ");
   wxStaticText *emailText = new wxStaticText(this, -1, "*****@*****.**");
   
   wxFlexGridSizer *contactSizer = new wxFlexGridSizer(2);
   contactSizer->Add(webText, 0, wxALIGN_RIGHT|wxALL, 2);
   contactSizer->Add(webLink, 0, wxALIGN_LEFT|wxALL, 2);
   contactSizer->Add(contactText, 0, wxALIGN_RIGHT|wxALL, 2);
   contactSizer->Add(emailText, 0, wxALIGN_LEFT|wxALL, 2);
   
   wxBoxSizer *gmatSizer = new wxBoxSizer(wxVERTICAL);
   gmatSizer->Add(gmatText, 0, wxALIGN_CENTRE|wxALL, 4);
   gmatSizer->Add(buildText, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT, 4);
   gmatSizer->Add(3, 3);
   gmatSizer->Add(contactSizer, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT, 4);
   
   wxBoxSizer *topSizer = new wxBoxSizer(wxHORIZONTAL);
   topSizer->Add(aboutButton, 0, wxALIGN_CENTRE|wxALL, 4);
   topSizer->Add(gmatSizer, 0, wxALIGN_CENTRE|wxALL, 4);
   
   // licence and thrid party
   wxStaticText *licenceText = new wxStaticText(this, -1, " - Licensed under");
   //wxString agreement = "NASA Open Source Agreement";
   wxString agreement = "Apache License, Version 2.0";
   theLicenseLink =
      new wxHyperlinkCtrl(this, ID_HYPERLINK, agreement, "");
   wxBoxSizer *licenceSizer = new wxBoxSizer(wxHORIZONTAL);
   licenceSizer->Add(licenceText, 0, wxALIGN_CENTRE|wxALL, 1);
   licenceSizer->Add(theLicenseLink, 0, wxALIGN_CENTRE|wxALL, 1);
   
   wxString use;
   use = use + " - Uses " + wxVERSION_STRING + "\n";
   use = use + " - Uses TSPlot\n";
   //use = use + " - Uses Perl Compatible Regular Expressions\n";
   use = use + " - Uses JPL SPICE Library\n";
   use = use + " - Uses IAU SOFA Library\n";
   use = use + " - Planetary images courtesy of JPL/Caltech/USGS, Celestia \n";
   use = use + "   Motherlode, Bjorn Jonsson, and NASA World Wind";
   wxStaticText *useText = new wxStaticText(this, -1, use);
   
   wxBoxSizer *useSizer = new wxBoxSizer(wxVERTICAL);
   useSizer->Add(licenceSizer, 0, wxALIGN_LEFT|wxALL, 2);
   useSizer->Add(useText, 0, wxALIGN_CENTRE|wxALL, 4);
   
   // OK button
   theOkButton = new wxButton(this, ID_BUTTON_OK, "OK");
   
   // Add to page sizer and set sizer to this dialog
   wxBoxSizer *pageSizer = new wxBoxSizer(wxVERTICAL);
   pageSizer->Add(topSizer, 0, wxALIGN_CENTRE|wxALL, 4);
   pageSizer->Add(10, 10);
   pageSizer->Add(line1, 0, wxGROW|wxALIGN_CENTRE|wxLEFT|wxRIGHT, 20);
   pageSizer->Add(useSizer, 0, wxALIGN_CENTRE|wxALL, 4);
   pageSizer->Add(line2, 0, wxGROW|wxALIGN_CENTRE|wxLEFT|wxRIGHT, 20);
   pageSizer->Add(10, 10);
   pageSizer->Add(theOkButton, 0, wxALIGN_CENTRE|wxALL, 5);
   
   SetAutoLayout(TRUE);
   SetSizer(pageSizer);
   pageSizer->Fit(this);
   pageSizer->SetSizeHints(this);
   
   // Set icon if icon file is in the start up file
   try
   {
      wxString iconfile = fm->GetFullPathname("MAIN_ICON_FILE").c_str();
      #if defined __WXMSW__
         SetIcon(wxIcon(iconfile, wxBITMAP_TYPE_ICO));
      #elif defined __WXGTK__
         SetIcon(wxIcon(iconfile, wxBITMAP_TYPE_XPM));
      #elif defined __WXMAC__
         SetIcon(wxIcon(iconfile, wxBITMAP_TYPE_PICT_RESOURCE));
      #endif
   }
   catch (GmatBaseException &/*e*/)
   {
      //MessageInterface::ShowMessage(e.GetMessage());
   }
   
   CenterOnScreen(wxBOTH);
   
   #ifdef DEBUG_ICONFILE
   MessageInterface::ShowMessage("AboutDialog::AboutDialog() leaving\n");
   #endif
}
Esempio n. 8
0
//------------------------------------------------------------------------------
ViewTextDialog::ViewTextDialog(wxWindow *parent, const wxString& title,
                               bool isEditable, const wxPoint &pos,
                               const wxSize &size, long style)
   : wxDialog(parent, -1, title, pos, size, style, title)
{
   isTextEditable = isEditable;
   
   // create bottom buttons
   theOkButton =
      new wxButton(this, ID_BUTTON, wxT("OK"), wxDefaultPosition, wxDefaultSize, 0);
   
   if (isTextEditable)
      theCancelButton =
         new wxButton(this, ID_BUTTON, wxT("Cancel"), wxDefaultPosition, wxDefaultSize, 0);
   
   // adds the buttons to button sizer
   theButtonSizer = new wxBoxSizer(wxHORIZONTAL);
   theButtonSizer->Add(theOkButton, 0, wxALIGN_CENTER | wxALL, 2);
   if (isTextEditable)
      theButtonSizer->Add(theCancelButton, 0, wxALIGN_CENTER | wxALL, 2);
   
   theBottomSizer = new wxBoxSizer(wxVERTICAL);
   theBottomSizer->Add(theButtonSizer, 0, wxALIGN_CENTER | wxALL, 2);
   
   // Set additional style wxTE_RICH to Ctrl + mouse scroll wheel to decrease or
   // increase text size(loj: 2009.02.05)
   if (isTextEditable)
      theText = new wxTextCtrl(this, -1, wxT(""), wxDefaultPosition, size,
                               wxTE_PROCESS_ENTER);
   else
      theText = new wxTextCtrl(this, -1, wxT(""), wxDefaultPosition, size,
                               wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH);
   
   if (!isTextEditable)
      theText->SetMaxLength(320000);
   //theText->SetFont( GmatAppData::GetFont());
   
   // add items to middle sizer
   theMiddleSizer = new wxBoxSizer(wxVERTICAL);
   if (isTextEditable)
      theMiddleSizer->Add(theText, 0, wxGROW|wxALL, 2);
   else
      theMiddleSizer->Add(theText, 1, wxGROW|wxALL, 2);
   
   // add items to dialog sizer
   wxBoxSizer *dialogSizer = new wxBoxSizer(wxVERTICAL);
   if (isTextEditable)
   {
      dialogSizer->Add(theMiddleSizer, 0, wxGROW | wxALL, 1);
      dialogSizer->Add(theBottomSizer, 0, wxGROW | wxALL, 1);
   }
   else
   {
      dialogSizer->Add(theMiddleSizer, 1, wxGROW | wxALL, 1);
      dialogSizer->Add(theBottomSizer, 0, wxGROW | wxALL, 1);
   }
   
   
   // tells the enclosing window to adjust to the size of the sizer
   SetAutoLayout(TRUE);
   SetSizer(dialogSizer);
   dialogSizer->Fit(this);
   dialogSizer->SetSizeHints(this);
   
   // Set icon if icon file is in the start up file
   FileManager *fm = FileManager::Instance();
   try
   {
      wxString iconfile = fm->GetFullPathname(wxT("MAIN_ICON_FILE")).c_str();
      #if defined __WXMSW__
         SetIcon(wxIcon(iconfile, wxBITMAP_TYPE_ICO));
      #elif defined __WXGTK__
         SetIcon(wxIcon(iconfile, wxBITMAP_TYPE_XPM));
      #elif defined __WXMAC__
         SetIcon(wxIcon(iconfile, wxBITMAP_TYPE_PICT_RESOURCE));
      #endif
   }
   catch (GmatBaseException &)
   {
      //MessageInterface::ShowMessage(e.GetMessage());
   }
   
   if (!isTextEditable)
      CenterOnScreen(wxBOTH);
}
Esempio n. 9
0
// Read the star information from the file
void GLStars::ReadTextStars(){
   wxString buffer, TxtFilename;
   Real RightAscension;
   Real Declination;
   Real VisualMag;
   Real sinRA, cosRA, cosDec;
   int i;
   int index = 0;
   Real DegToRad = M_PI / 180.0;
   GLfloat VisMagStep = 0.0f;
   const GLfloat VSScale = 0.30f;
   const GLfloat StarDimmest = 0.02f;
   const GLfloat BaseScale = 9.0f;
   const GLfloat StarRange = 2.0;
        const GLfloat RangeFactor = 0.0;

   FileManager *fm = FileManager::Instance();
        TxtFilename = (fm->GetFullPathname(wxT("STAR_FILE"))).c_str();

   // Try opening the file
   wxTextFile StarsFile;
   if (!StarsFile.Open(TxtFilename)){
      wxString msg = wxT("Could not open Star Catalog at ");
      msg.Append(TxtFilename);
      MessageInterface::LogMessage(msg + wxT("\n"));
      return;
   }

   // The first line is the north star, so it gets special treatment
   buffer = StarsFile.GetFirstLine();
   // Gets its right ascension, declination, and magnitude from the star catalog
   GetStarValues(buffer, &RightAscension, &Declination, &VisualMag);

   // Calculate the position of the star...
   sinRA = sin(RightAscension * DegToRad);
   cosRA = cos(RightAscension * DegToRad);
   cosDec = cos(Declination * DegToRad);

   // ...and store it in our array. 
   StarsVA[0][CosRAcosDec] = StarRange * cosRA * cosDec;
   StarsVA[0][SinRAcosDec] = StarRange * sinRA * cosDec;
   StarsVA[0][SinDec] = StarRange * sin(Declination * DegToRad);
        StarsVA[0][Range] = RangeFactor;
   // Store the point size and the count of its group
   PointSize[index] = 8.0f;
   GroupCount[index] = 1;
   GroupIndex[index] = 0;
   index++;
   GroupIndex[index] = 1;

   // Parse through the whole file and repeat this process, storing the star in the appropriate group
   for (i = 1, buffer = StarsFile.GetNextLine(); i < MAXSTARS && !StarsFile.Eof(); i++, buffer = StarsFile.GetNextLine()){
      GetStarValues(buffer, &RightAscension, &Declination, &VisualMag);
      sinRA = sin(RightAscension * DegToRad);
      cosRA = cos(RightAscension * DegToRad);
      cosDec = cos(Declination * DegToRad);

      StarsVA[i][CosRAcosDec] = StarRange * cosRA * cosDec;
      StarsVA[i][SinRAcosDec] = StarRange * sinRA * cosDec;
      StarsVA[i][SinDec] = StarRange * sin(Declination * DegToRad);
                StarsVA[i][Range] = RangeFactor;

      if (VisualMag > VisMagStep){
         GroupCount[index] = i - GroupIndex[index];
         PointSize[index] = StarDimmest + ((BaseScale - VisMagStep) * VSScale);
         index++;
         if (index >= GROUPCOUNT)
            break;
         GroupIndex[index] = i;
         VisMagStep += STARSTEP;
      }
   }

   // Finalize the values and close the file
   GroupCount[index] = i - GroupIndex[index] - 1;
   PointSize[index] = StarDimmest + ((BaseScale - VisMagStep) * VSScale);
   LastGroupUsed = index;
   StarsFile.Close();

   // Store how many star positions we loaded from the file
   MaxDrawStars = i - 1;
}
Esempio n. 10
0
// Read in the star information for the constellations.
void GLStars::ReadTextConstellations(){
   wxString buffer, TxtFilename;
   Real RightAscension1, RightAscension2, Declination1, Declination2;
   Real sinRA, cosRA, cosDec;
   Real DegToRad = M_PI / 180.0;
   const GLfloat StarRange = 2.0;
        const GLfloat RangeFactor = 0.0;
   int i;

   FileManager *fm = FileManager::Instance();
   TxtFilename = (fm->GetFullPathname(wxT("CONSTELLATION_FILE"))).c_str();
   
   // Attempt to open the constellation file
   wxTextFile ConstellationFile;
   if (!ConstellationFile.Open(TxtFilename)){
      wxString msg = wxT("Could not open Constellation File at ");
      msg.Append(TxtFilename);
      MessageInterface::LogMessage(msg + wxT("\n"));
      return;
   }

   NumLines = 0;
   NumConstellations = 0;

   // Go through the file and store all of the star pairs that make up the constellation lines
   for (i = 0, buffer = ConstellationFile.GetNextLine(); i < MAXLINES && !ConstellationFile.Eof(); buffer = ConstellationFile.GetNextLine()){
      // Skip the comment lines
      if (buffer[0] == '#')
         continue;
      if (buffer[0] == 'N'){
         ConstellationIndex[NumConstellations][1] = i-1;
         NumConstellations++;
                 ConstellationNames[NumConstellations] = buffer.AfterFirst(' ');
         ConstellationIndex[NumConstellations][0] = i;
         continue;
      }
      // Retrieve the pair of Right Ascensions and Declinations from the line
      GetConstellationValues(buffer, &RightAscension1, &Declination1, &RightAscension2, &Declination2);
      // Convert the Right Ascensions from days to degrees
      RightAscension1 *= 15;
      RightAscension2 *= 15;

      // Calculate the star positions and store them in the array
      sinRA = sin(RightAscension1 * DegToRad);
      cosRA = cos(RightAscension1 * DegToRad);
      cosDec = cos(Declination1 * DegToRad);

      CLines[i][0] = StarRange * cosRA * cosDec;
      CLines[i][1] = StarRange * sinRA * cosDec;
      CLines[i][2] = StarRange * sin(Declination1 * DegToRad);
                CLines[i][3] = RangeFactor;

      sinRA = sin(RightAscension2 * DegToRad);
      cosRA = cos(RightAscension2 * DegToRad);
      cosDec = cos(Declination2 * DegToRad);

      CLines[i+1][0] = StarRange * cosRA * cosDec;
      CLines[i+1][1] = StarRange * sinRA * cosDec;
      CLines[i+1][2] = StarRange * sin(Declination2 * DegToRad);
                CLines[i+1][3] = RangeFactor;
      i+=2;
   }

   // Close the constellation file
   ConstellationFile.Close();

   // Store how many constellation line vertices we loaded in
   NumLines = i - 1;

   ConstellationIndex[NumConstellations][1] = i - 1;
}
Esempio n. 11
0
//------------------------------------------------------------------------------
// GmatMdiChildFrame::GmatMdiChildFrame(...)
//------------------------------------------------------------------------------
GmatMdiChildFrame::GmatMdiChildFrame(wxMDIParentFrame *parent, 
                                     const wxString &name,
                                     const wxString &title, 
                                     const GmatTree::ItemType type,
                                     wxWindowID id, 
                                     const wxPoint &pos, 
                                     const wxSize &size, 
                                     long style)
   : wxMDIChildFrame(parent, id, title, pos, size, style, name)
{
   #ifdef DEBUG_MDI_CHILD_FRAME
   MessageInterface::ShowMessage
      (wxT("GmatMdiChildFrame::GmatMdiChildFrame() entered, type=%d\n    ")
       wxT("name='%s'\n   title='%s'"), type, name.c_str(), title.c_str());
   #endif
   
   relativeZOrder          = maxZOrder++;
   usingSavedConfiguration = false;
   mPlotName = name;
   theParent = parent;
   mDirty = false;
   mOverrideDirty = false;
   mCanClose = true;
   mCanSaveLocation = true;
   mItemType = type;
   theScriptTextCtrl = NULL;
   theMenuBar = NULL;
   theAssociatedWin = NULL;
   
   GmatAppData *gmatAppData = GmatAppData::Instance();
   theGuiInterpreter = gmatAppData->GetGuiInterpreter();

   #ifdef __USE_STC_EDITOR__
   theEditor = NULL;
   #endif
   
   #ifdef __WXMAC__
   childTitle = title;
   #endif
   
   #ifdef __CREATE_CHILD_MENU_BAR__
      // create a menu bar, pass Window menu if Windows
      #ifdef __WXMSW__
         theMenuBar = new GmatMenuBar(mItemType, parent->GetWindowMenu());
      #else
         theMenuBar = new GmatMenuBar(mItemType, NULL);
      #endif
   
      #ifdef DEBUG_MENUBAR
      MessageInterface::ShowMessage
         (wxT("GmatMdiChildFrame::GmatMdiChildFrame() theMenuBarCreated %p\n"), theMenuBar);
      #endif
      
      // Commented out so that Window menu works for MdiChildFrame (loj: 2008.02.08)
      // Double Window menu appears when more than one child is open and cannot
      // delete theMenuBar in the destructor.
      //SetMenuBar(theMenuBar);
   #else
      theMenuBar = (GmatMenuBar*)(parent->GetMenuBar());      
   #endif
   
   // Enable Edit menu and tools if ScriptFile
   #ifdef DEBUG_UPDATE_GUI_ITEM
   MessageInterface::ShowMessage
      (wxT("GmatMdiChildFrame() constructor calling UpdateGuiItem()\n"));
   #endif
   UpdateGuiItem(1, 0);
   
   // Set icon if icon file is in the start up file
   FileManager *fm = FileManager::Instance();
   try
   {
      wxString iconfile = fm->GetFullPathname(wxT("MAIN_ICON_FILE")).c_str();
      #if defined __WXMSW__
         SetIcon(wxIcon(iconfile, wxBITMAP_TYPE_ICO));
      #elif defined __WXGTK__
         SetIcon(wxIcon(iconfile, wxBITMAP_TYPE_XPM));
      #elif defined __WXMAC__
         SetIcon(wxIcon(iconfile, wxBITMAP_TYPE_PICT_RESOURCE));
      #endif
   }
   catch (GmatBaseException &e)
   {
      MessageInterface::ShowMessage(e.GetFullMessage());
   }
}
Esempio n. 12
0
//------------------------------------------------------------------------------
// virtual void Create()
//------------------------------------------------------------------------------
void SetPathDialog::Create()
{
   #ifdef DEBUG_SETPATH_DIALOG_CREATE
   MessageInterface::ShowMessage(wxT("SetPathDialog::Create() entered.\n"));
   #endif
   
   FileManager *fm = FileManager::Instance();
   mStartupFilePath = (fm->GetFullStartupFilePath()).c_str();
   
   //----- read startup file
   wxButton *readButton =
      new wxButton(this, ID_BUTTON_READ, wxT("Read Other Startup File"),
                   wxDefaultPosition, wxDefaultSize, 0);
   wxStaticText *currFileText =
      new wxStaticText(this, -1, wxT("Current Startup File:"), 
                       wxDefaultPosition, wxDefaultSize, 0 );
   mReadFileTextCtrl =
      new wxTextCtrl(this, -1, wxT(""),
                     wxDefaultPosition, wxSize(350, 20), 0);
   mReadFileTextCtrl->Disable();
   
   //----- write startup file
   wxButton *saveButton =
      new wxButton(this, ID_BUTTON_SAVE, wxT("Save Current Startup File"),
                   wxDefaultPosition, wxDefaultSize, 0);
   mSaveFileTextCtrl =
      new wxTextCtrl(this, -1, wxT(""),
                     wxDefaultPosition, wxSize(350, 20), 0);
   mSaveFileTextCtrl->Disable();
   
   //----- add to sizer
   GmatStaticBoxSizer *startupSizer =
      new GmatStaticBoxSizer(wxVERTICAL, this, wxT("Startup File"));
   startupSizer->Add(readButton, 0, wxALIGN_LEFT|wxALL, 2);
   startupSizer->Add(currFileText, 0, wxALIGN_LEFT|wxALL, 2);
   startupSizer->Add(mReadFileTextCtrl, 0, wxALIGN_CENTER|wxGROW|wxALL, 2);
   startupSizer->Add(saveButton, 0, wxALIGN_LEFT|wxALL, 2);
   startupSizer->Add(mSaveFileTextCtrl, 0, wxALIGN_CENTER|wxGROW|wxALL, 2);
   
   //----- create Notebook
   mPathNotebook =
      new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize, wxGROW);
   
   StringArray gmatPaths = fm->GetAllGmatFunctionPaths();
   
   //----- add panels to notebook   
   mGmatFunPathPanel = new MultiPathSetupPanel(mPathNotebook, gmatPaths);
   mPathNotebook->AddPage(mGmatFunPathPanel, wxT("GMAT Function"));
   
   StringArray matlabPaths = fm->GetAllMatlabFunctionPaths();
   mMatlabPathPanel = new MultiPathSetupPanel(mPathNotebook, matlabPaths);
   mPathNotebook->AddPage(mMatlabPathPanel, wxT("MATLAB Function"));
   
   wxString outputPath = fm->GetFullPathname(wxT("OUTPUT_PATH"));
   
   #ifdef DEBUG_SETPATH_DIALOG_CREATE
   MessageInterface::ShowMessage(wxT("   outputPath='%s'\n"), outputPath.c_str());
   #endif
   
   mOutputPathPanel = new SinglePathSetupPanel(mPathNotebook, outputPath.c_str());
   mPathNotebook->AddPage(mOutputPathPanel, wxT("Output"));
   
   theMiddleSizer->Add(startupSizer, 0, wxALIGN_CENTER|wxGROW|wxALL, 5);
   theMiddleSizer->Add(mPathNotebook, 1, wxALIGN_CENTER|wxGROW|wxALL, 5);
}
Esempio n. 13
0
//------------------------------------------------------------------------------
// 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);
}
Esempio n. 14
0
//------------------------------------------------------------------------------
// void Create()
//------------------------------------------------------------------------------
void WelcomePanel::Create()
{
   #ifdef DEBUG_CREATE
   MessageInterface::ShowMessage("WelcomePanel::Create() entered\n");
   #endif
   
   wxStaticLine *line1;
   wxBitmap bitmap;
   wxBitmapButton *aboutButton;
   // Border size
   bsize = 4;
   
   // get the config object
   wxFileConfig *pConfig;
   
   // Load GMAT ICON
   FileManager *fm = FileManager::Instance();
   std::string iconFile = fm->GetFullPathname("ICON_PATH") + "GMATIcon.jpg";
   
   #ifdef DEBUG_CREATE
   MessageInterface::ShowMessage("WelcomePanel::Create() iconFile='%s'\n", iconFile.c_str());
   #endif
   
   if (GmatFileUtil::DoesFileExist(iconFile))
   {
      #ifdef DEBUG_CREATE
      MessageInterface::ShowMessage
         ("   Loading iconFile '%s'\n", iconFile.c_str());
      #endif
      bitmap = LoadBitmap( iconFile.c_str(), 200, 200 );
      aboutButton = new wxBitmapButton(this, -1, bitmap, wxDefaultPosition,
                          wxSize(200,200));
   }
   else
   {
      #ifdef DEBUG_CREATE
      MessageInterface::ShowMessage
         ("   the iconFile '%s' doesnot exist, so creating default\n", iconFile.c_str());
      #endif
      wxBitmap nullMap;
      aboutButton = new wxBitmapButton(this, -1, nullMap, wxDefaultPosition,
                           wxSize(200,200));
   }
   
   wxColourDatabase cdb;
   wxColour gmatColor = cdb.Find("NAVY");
   // title, build date
   wxStaticText *gmatText =
      new wxStaticText(this, -1, "General Mission Analysis Tool");
   wxFont font1 = wxFont();

   #ifdef __WXMAC__
   font1.SetPointSize(20);
   #else
   font1.SetPointSize(20);
   #endif

   font1.SetWeight(wxFONTWEIGHT_BOLD);
   gmatText->SetOwnFont(font1);
   gmatText->SetOwnForegroundColour(gmatColor);

   // website and contact email
   wxStaticText *webText = new wxStaticText(this, -1, "Website: ");
   wxString gmatUrl = "http://gmat.gsfc.nasa.gov";
   wxHyperlinkCtrl *webLink = new wxHyperlinkCtrl(this, -1, gmatUrl, gmatUrl);
   
   wxFlexGridSizer *contactSizer = new wxFlexGridSizer(2);
   contactSizer->Add(webText, 0, wxALIGN_RIGHT|wxALL, 2);
   contactSizer->Add(webLink, 0, wxALIGN_LEFT|wxALL, 2);
   
   wxBoxSizer *gmatTextSizer = new wxBoxSizer(wxVERTICAL);
   gmatTextSizer->Add(gmatText, 0, wxALIGN_LEFT|wxALL, bsize);
   gmatTextSizer->Add(3, 3);
   gmatTextSizer->Add(contactSizer, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT, bsize);
   
   wxBoxSizer *headerSizer = new wxBoxSizer(wxHORIZONTAL);
   headerSizer->Add(aboutButton, 0, wxALIGN_LEFT|wxALL, bsize);
   headerSizer->Add(gmatTextSizer, 0, wxALIGN_LEFT|wxALL, bsize);

   //-----------------------------------------------------------------
   // now Links and Resources
   //-----------------------------------------------------------------
   wxStaticText *resourcesText =
      new wxStaticText(this, -1, "Links and Resources");
   resourcesText->SetOwnFont(font1);
   resourcesText->SetOwnForegroundColour(gmatColor);
   wxBoxSizer *resourcesSizer = new wxBoxSizer(wxVERTICAL);
   resourcesSizer->Add(resourcesText, 0, wxALIGN_LEFT|wxALL, bsize);
   resourcesSizer->AddSpacer(bsize*2);
   // now Links
   pConfig = (wxFileConfig *) wxConfigBase::Get();
   wxString configLocWelcome = "/Welcome/Links";
   #ifdef __WXMAC__
      configLocWelcome = configLocWelcome + "/Online";
   #endif
   resourcesSizer->Add(FillGroup(pConfig, configLocWelcome, "", 3, ID_HELP, false),
                       0, wxALIGN_LEFT|wxALL, bsize*2);

   //-----------------------------------------------------------------
   // now Sample Projects
   //-----------------------------------------------------------------
   resourcesSizer->Add(FillGroup(pConfig, "/Welcome/Samples", "", 3, ID_FILE, false),
                       0, wxALIGN_LEFT|wxALL, bsize*2);

   //-----------------------------------------------------------------
   // now Getting Started
   //-----------------------------------------------------------------
   wxStaticText *getStartedText =
      new wxStaticText(this, -1, "Getting Started");
   getStartedText->SetOwnFont(font1);
   getStartedText->SetOwnForegroundColour(gmatColor);
   wxBoxSizer *gettingStartedSizer = new wxBoxSizer(wxVERTICAL);
   gettingStartedSizer->Add(getStartedText, 0, wxALIGN_LEFT|wxALL, bsize);
   gettingStartedSizer->AddSpacer(bsize*2);
   wxString configLoc = "/GettingStarted/Tutorials";
   #ifdef __WXMAC__
      configLoc = configLoc + "/Online";
   #endif
   gettingStartedSizer->Add(FillGroup(pConfig, configLoc, "/GettingStarted/Tutorials/Icons",
                                      1, ID_HELP, false), 0, wxALIGN_LEFT|wxALL, bsize*2);
   //gettingStartedSizer->AddSpacer(bsize*2);

   //-----------------------------------------------------------------
   // now recent scripts
   //-----------------------------------------------------------------
   wxStaticText *recentScriptsText =
      new wxStaticText(this, -1, "Recent Scripts");
   recentScriptsText->SetOwnFont(font1);
   recentScriptsText->SetOwnForegroundColour(gmatColor);
   wxBoxSizer *recentSizer = new wxBoxSizer(wxVERTICAL);
   recentSizer->Add(recentScriptsText, 0, wxALIGN_LEFT|wxALL, bsize);
   recentSizer->AddSpacer(bsize*2);
   // add the recent scripts
   pConfig = (wxFileConfig *) GmatAppData::Instance()->GetPersonalizationConfig();
   recentSizer->Add(FillGroup(pConfig, "/RecentFiles", "", 1, ID_BUTTON_RECENT, true, true),
                    0, wxALIGN_LEFT|wxALL, bsize*2);


   //-----------------------------------------------------------------
   // Now put it all together
   //-----------------------------------------------------------------
   wxBoxSizer *contentSizer = new wxBoxSizer(wxHORIZONTAL);
   contentSizer->Add(recentSizer, 0, wxALIGN_LEFT|wxALL, bsize*2);
   line1 = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL);
   contentSizer->Add(line1, 0, wxGROW|wxALIGN_CENTRE, 20);
   contentSizer->Add(gettingStartedSizer, 1, wxGROW|wxALIGN_LEFT|wxALL, bsize*2);

   wxSizer *theMiddleSizer = (wxSizer*)(new wxBoxSizer(wxVERTICAL));
   theMiddleSizer->Add(headerSizer, 0, wxALIGN_LEFT|wxGROW|wxALL, bsize*2);
   line1 = new wxStaticLine(this);
   theMiddleSizer->Add(line1, 0, wxEXPAND|wxALIGN_CENTRE, bsize*2);
   theMiddleSizer->Add(contentSizer, 1, wxGROW|wxALIGN_CENTRE|wxALL);
   line1 = new wxStaticLine(this);
   theMiddleSizer->Add(line1, 0, wxEXPAND|wxALIGN_CENTRE, bsize*2);
   theMiddleSizer->Add(resourcesSizer, 0, wxALIGN_LEFT|wxEXPAND|wxALL, bsize*2);
   line1 = new wxStaticLine(this);
   theMiddleSizer->Add(line1, 0, wxEXPAND|wxALIGN_CENTRE, bsize*2);

   wxCheckBox *cbShow = new wxCheckBox( this, ID_CHECKBOX, wxT("&Show Welcome Page On Startup"));
   wxString showWelcomePanel;
   pConfig->Read("/Main/ShowWelcomeOnStart", &showWelcomePanel, "true");
   cbShow->SetValue( showWelcomePanel.Lower() == "true" );
   theMiddleSizer->Add(cbShow, 0, wxALIGN_LEFT|wxALL, bsize*2);

   wxSizer *thePanelSizer = new wxBoxSizer(wxVERTICAL);
   thePanelSizer->Add(theMiddleSizer, 0, wxALIGN_LEFT|wxGROW|wxALL, bsize*2);
   SetSizer(thePanelSizer);
   thePanelSizer->SetSizeHints(this);
   
   // Set GMAT main icon
   GmatAppData::Instance()->SetIcon(this, "WelcomePanel");
   
   #ifdef DEBUG_CREATE
   MessageInterface::ShowMessage("WelcomePanel::Create() leaving\n");
   #endif
}
Esempio n. 15
0
//------------------------------------------------------------------------------
wxFlexGridSizer *WelcomePanel::FillGroup(wxFileConfig *config, wxString INIGroup,
                                         wxString INIIconGroup, int maxCols,
                                         wxWindowID id, bool isFileList, bool isReversed)
{
   #ifdef DEBUG_FILL_GROUP
   MessageInterface::ShowMessage
      ("WelcomePanel::FillGroup() entered, INIGroup='%s', INIIconGroup='%s', "
       "isFileList=%d\n", INIGroup.c_str(), INIIconGroup.c_str(), isFileList);
   #endif
   
   wxFlexGridSizer *aSizer;
   wxFlexGridSizer *aIconNTextSizer;
   wxArrayString linkLabels;
   wxArrayString linkURLs;
   wxArrayString linkIcons;
   size_t i;
   wxBitmapButton *abitmapButton = NULL;

   wxString aKey;
   wxString aValue;
   long dummy;
   int aCol = 1;
   wxHyperlinkCtrl *aButton;
   wxStaticLine *line1;
   
   // get the links from the config
   config->SetPath(INIGroup);
   // read filenames from config object
   if (config->GetFirstEntry(aKey, dummy))
   {
      if (isFileList)
	  {
		 if (isReversed)
			linkLabels.Insert(GmatFileUtil::ParseFileName(config->Read(aKey).c_str()).c_str(), 0);
		 else
			linkLabels.Add(GmatFileUtil::ParseFileName(config->Read(aKey).c_str()).c_str());
	  }
      else
	  {
		 if (isReversed)
			linkLabels.Insert(aKey, 0);
		 else
			linkLabels.Add(aKey);
	  }
      
      aValue = config->Read(aKey);
      if (isReversed)
		linkURLs.Insert(aValue,0);
	  else
		linkURLs.Add(aValue);
      
      #ifdef DEBUG_FILL_GROUP
      MessageInterface::ShowMessage("   aKey='%s', aValue='%s'\n", aKey.c_str(), aValue.c_str());
      #endif
      
      while (config->GetNextEntry(aKey, dummy))
      {
         if (isFileList)
		 {
			 if (isReversed)
				linkLabels.Insert(GmatFileUtil::ParseFileName(config->Read(aKey).c_str()).c_str(), 0);
			 else
				linkLabels.Add(GmatFileUtil::ParseFileName(config->Read(aKey).c_str()).c_str());
		 }
		 else
		 {
			 if (isReversed)
				linkLabels.Insert(aKey, 0);
			 else
				linkLabels.Add(aKey);
		 }
         
         aValue = config->Read(aKey);
         if (isReversed)
		    linkURLs.Insert(aValue,0);
		 else
			linkURLs.Add(aValue);
         
         #ifdef DEBUG_FILL_GROUP
         MessageInterface::ShowMessage("   aKey='%s', aValue='%s'\n", aKey.c_str(), aValue.c_str());
         #endif
      }
   }
   // go through all urls and use INIGROUP/Online if no helpcontroller and is not web url
   if (GmatAppData::Instance()->GetMainFrame()->GetHelpController() == NULL)
   {
	   config->SetPath(INIGroup + "/Online");
	   for (i=0; i<linkLabels.size(); i++)
	   {
		   if (!(linkURLs[i].Contains("\\") || linkURLs[i].Contains("/") || linkURLs[i].Contains(":") ))
		   {
			   aValue = config->Read(linkLabels[i]);
			   if (!aValue.IsEmpty())
				   linkURLs[i] = aValue;
		   }
	   }
   }

   // get the icons if section exists
   if (INIIconGroup != "")
   {
      config->SetPath(INIIconGroup);
      for (i=0; i<linkLabels.size(); i++)
         linkIcons.Add(config->Read(linkLabels[i]));
   }

   if (maxCols > 1)
   {
      maxCols = maxCols * 2;
      aSizer = new wxFlexGridSizer(maxCols, 10, 40);
   }
   else
      aSizer = new wxFlexGridSizer(maxCols, 10, 40);
   
   #ifdef DEBUG_FILL_GROUP
   MessageInterface::ShowMessage("   There are %d linkLables\n", linkLabels.size());
   #endif
   
   if (linkLabels.size() > 0)
   {
      FileManager *fm = FileManager::Instance();
      for (i=0; i<linkLabels.size(); i++)
      {
         aButton = new wxHyperlinkCtrl
            (this, id, linkLabels[i], linkURLs[i], wxDefaultPosition, wxDefaultSize,
             wxNO_BORDER|wxHL_ALIGN_CENTRE);
         aButton->SetToolTip(linkURLs[i]);
         if (linkIcons.size() > 0)
         {
            aIconNTextSizer = new wxFlexGridSizer(2, 20, 20);
            std::string fullPath = fm->GetFullPathname("ICON_PATH") + std::string(linkIcons[i].c_str());
            #ifdef DEBUG_FILL_GROUP
            MessageInterface::ShowMessage("   fullPath='%s'\n", fullPath.c_str());
            #endif
            if (GmatFileUtil::DoesFileExist(fullPath.c_str()))
            {
               wxBitmap bitmap = LoadBitmap( fullPath.c_str(), 50, 50 );
               abitmapButton = new wxBitmapButton(this, -1, bitmap, wxDefaultPosition,
                                                  wxSize(50,50));
            }
            else
            {
               MessageInterface::ShowMessage
                  ("*** WARNING *** Can't load image from file '%s'\n", fullPath.c_str());
               abitmapButton = NULL;
            }
            
            aIconNTextSizer->Add(abitmapButton, 0, wxALIGN_LEFT, bsize);
            aIconNTextSizer->Add(aButton, 0, wxALIGN_LEFT, bsize);
            aSizer->Add(aIconNTextSizer, 0, wxALIGN_LEFT, bsize*2);
         }
         else
            aSizer->Add(aButton, 0, wxALIGN_LEFT, bsize*3);
         aCol = (aCol + 1) % maxCols;
         if ((maxCols > 1) && (aCol < (maxCols-1)))
         {
            line1 = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL);
            aSizer->Add(line1, 0, wxALIGN_CENTRE, 20);
         }
         aCol = (aCol + 1) % maxCols;
      }
   }
   
   #ifdef DEBUG_FILL_GROUP
   MessageInterface::ShowMessage
      ("WelcomePanel::FillGroup() returning aSizer<%p>\n", aSizer);
   #endif
   
   return aSizer;
}
Esempio n. 16
0
//------------------------------------------------------------------------------
GmatFunction::GmatFunction(const wxString &name) :
   Function(wxT("GmatFunction"), name)
{
   mIsNewFunction = false;
   unusedGlobalObjectList = NULL;
   
   // for initial function path, use FileManager
   FileManager *fm = FileManager::Instance();
   wxString pathname;
   
   try
   {
      // if there is a function name, try to locate it
      if (name != wxT(""))
      {
         // Get path of first it is located
         pathname = fm->GetGmatFunctionPath(name + wxT(".gmf"));
         
         // gmat function uses whole path name
         pathname = pathname + name + wxT(".gmf");         
         functionPath = pathname;
         functionName = GmatFileUtil::ParseFileName(functionPath);
         
         // Remove path and .gmf
         functionName = GmatFileUtil::ParseFileName(functionPath);
         wxString::size_type dotIndex = functionName.find(wxT(".gmf"));
         functionName = functionName.substr(0, dotIndex);
      }
      else
      {
         // gmat function uses whole path name
         functionPath = fm->GetFullPathname(wxT("GMAT_FUNCTION_PATH"));    
      }
   }
   catch (GmatBaseException &e)
   {
      // Use exception to remove Visual C++ warning
      e.GetMessageType();
      #ifdef DEBUG_FUNCTION
      MessageInterface::ShowMessage(e.GetFullMessage());
      #endif
      
      // see if there is FUNCTION_PATH
      try
      {
         pathname = fm->GetFullPathname(wxT("FUNCTION_PATH"));
         functionPath = pathname;
      }
      catch (GmatBaseException &e)
      {
         // Use exception to remove Visual C++ warning
         e.GetMessageType();
         #ifdef DEBUG_FUNCTION
         MessageInterface::ShowMessage(e.GetFullMessage());
         #endif
      }
   }
   
   objectTypeNames.push_back(wxT("GmatFunction"));

   #ifdef DEBUG_FUNCTION
   MessageInterface::ShowMessage
      (wxT("   Gmat functionPath=<%s>\n"), functionPath.c_str());
   MessageInterface::ShowMessage
      (wxT("   Gmat functionName=<%s>\n"), functionName.c_str());
   #endif
}