Esempio n. 1
0
//------------------------------------------------------------------------------
void OutputTree::OnCompareTextLines(wxCommandEvent &event)
{
   #ifdef DEBUG_COMPARE
   MessageInterface::ShowMessage("OutputTree::OnCompareTextLines() entered\n");
   #endif
   
   ReportFile *theReport =
      (ReportFile*) theGuiInterpreter->GetConfiguredObject(theSubscriberName.c_str());
   
   if (!theReport)
   {
      MessageInterface::ShowMessage
         ("OutputTree::OnCompareTextLines() The ReportFile: %s is NULL.\n",
          theSubscriberName.WX_TO_C_STRING);
      return;
   }
   
   std::string basefilename = theReport->GetFullPathFileName();
   StringArray colTitles = theReport->GetRefObjectNameArray(Gmat::PARAMETER);
   wxString filename1 =
      wxFileSelector("Choose a file to open", "", "", "report",
                     "Report files (*.report)|*.report|"
                     "Text files (*.txt)|*.txt|"
                     "Text ephemeris files (*.eph)|*.eph|"
                     "All files (*.*)|*.*");
   
   if (filename1.empty())
      return;
   
   int file1DiffCount = 0;
   int file2DiffCount = 0;
   int file3DiffCount = 0;
   
   StringArray output =
      GmatFileUtil::CompareTextLines(1, basefilename.c_str(), filename1.c_str(), "", "",
                                 file1DiffCount, file2DiffCount, file3DiffCount);
   
   ViewTextFrame *compWindow = GmatAppData::Instance()->GetCompareWindow();
   if (compWindow == NULL)
   {
      compWindow =
         new ViewTextFrame(GmatAppData::Instance()->GetMainFrame(),
                           _T("Compare Utility"), 50, 50, 800, 500, "Permanent");
      GmatAppData::Instance()->SetCompareWindow(compWindow);
      wxString msg;
      msg.Printf(_T("GMAT Build Date: %s %s\n\n"),  __DATE__, __TIME__);      
      compWindow->AppendText(msg);
   }
   
   compWindow->Show(true);
   
   for (unsigned int i=0; i<output.size(); i++)
      compWindow->AppendText(wxString(output[i].c_str()));
}
Esempio n. 2
0
//------------------------------------------------------------------------------
void OutputTree::OnCompareNumericColumns(wxCommandEvent &event)
{
   #ifdef DEBUG_COMPARE
   MessageInterface::ShowMessage("OutputTree::OnCompareNumericColumns() entered\n");
   #endif
   
   ReportFile *theReport =
      (ReportFile*) theGuiInterpreter->GetConfiguredObject(theSubscriberName.c_str());
   
   if (!theReport)
   {
      MessageInterface::ShowMessage
         ("OutputTree::OnCompareNumericColumns() The ReportFile: %s is NULL.\n",
          theSubscriberName.WX_TO_C_STRING);
      return;
   }
   
   std::string basefilename = theReport->GetFullPathFileName();
   StringArray colTitles = theReport->GetRefObjectNameArray(Gmat::PARAMETER);
   wxString filename1 =
      wxFileSelector("Choose a file to open", "", "", "report|eph|txt",
                     "Report files (*.report)|*.report|"
                     "Text files (*.txt)|*.txt|"
                     "Text ephemeris files (*.eph)|*.eph|"
                     "All files (*.*)|*.*");
   
   if (filename1.empty())
      return;
   
   Real tol = GmatFileUtil::COMPARE_TOLERANCE;
   wxString tolStr;
   tolStr.Printf("%e", tol);
   tolStr = wxGetTextFromUser("Enter absolute tolerance to be used in flagging: ",
                              "Tolerance", tolStr, this);
   
   if (!tolStr.ToDouble(&tol))
   {
      wxMessageBox("Entered Invalid Tolerance", "Error", wxOK, this);
      return;
   }
    
   StringArray output =
      GmatFileUtil::CompareNumericColumns(1, basefilename.c_str(), filename1.c_str(), "", "",
                                          tol);
   
   ViewTextFrame *compWindow = GmatAppData::Instance()->GetCompareWindow();
   if (compWindow == NULL)
   {
      compWindow = 
         new ViewTextFrame(GmatAppData::Instance()->GetMainFrame(),
                           _T("Compare Utility"), 50, 50, 800, 500, "Permanent");
      GmatAppData::Instance()->SetCompareWindow(compWindow);
      wxString msg;
      msg.Printf(_T("GMAT Build Date: %s %s\n\n"),  __DATE__, __TIME__);  
      compWindow->AppendText(msg);
   }
   
   compWindow->Show(true);
   
   for (unsigned int i=0; i<output.size(); i++)
   {
      compWindow->AppendText(wxString(output[i].c_str()));
      MessageInterface::ShowMessage(output[i].c_str());
   }
}