예제 #1
0
//------------------------------------------------------------------------------
void OutputTree::OnCompareNumericValues(wxCommandEvent &event)
{
   //MessageInterface::ShowMessage("OutputTree::OnCompareNumericValues() entered\n");

   ReportFile *theReport =
      (ReportFile*) theGuiInterpreter->GetConfiguredObject(theSubscriberName.c_str());

   if (!theReport)
   {
      MessageInterface::ShowMessage
         (wxT("OutputTree::OnCompareNumericValues() The ReportFile: %s is NULL.\n"),
          theSubscriberName.c_str());
      return;
   }
   
   wxString filename1 = theReport->GetPathAndFileName();
   StringArray colTitles = theReport->GetRefObjectNameArray(Gmat::PARAMETER);
   wxString filename2 =
      wxFileSelector(wxT("Choose a file to open"), wxT(""), wxT(""), wxT("report"),
                     wxT("Report files (*.report)|*.report|")
                     wxT("Text files (*.txt)|*.txt|All files (*.*)|*.*"));
   
   if (filename2.empty())
      return;
   
   Real tol = GmatFileUtil::CompareAbsTol;
   wxString tolStr;
   tolStr.Printf(wxT("%e"), tol);
   tolStr = wxGetTextFromUser(wxT("Enter absolute tolerance to be used in flagging: "),
                              wxT("Tolerance"), tolStr, this);
   
   if (!tolStr.ToDouble(&tol))
   {
      wxMessageBox(wxT("Entered Invalid Tolerance"), wxT("Error"), wxOK, this);
      return;
   }
   
   StringArray output =
      GmatFileUtil::Compare(filename1.c_str(), filename2.c_str(), colTitles, tol);
   
   ViewTextFrame *compWindow = GmatAppData::Instance()->GetCompareWindow();
   if (compWindow == NULL)
   {
      compWindow = 
         new ViewTextFrame(GmatAppData::Instance()->GetMainFrame(),
                           wxT("Compare Utility"), 50, 50, 800, 500, wxT("Permanent"));
      GmatAppData::Instance()->SetCompareWindow(compWindow);
      wxString msg;
      msg.Printf(wxT("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()));
}
예제 #2
0
//------------------------------------------------------------------------------
void OutputTree::OnCompareTextLines(wxCommandEvent &event)
{
   //MessageInterface::ShowMessage("OutputTree::OnCompareTextLines() entered\n");

   ReportFile *theReport =
      (ReportFile*) theGuiInterpreter->GetConfiguredObject(theSubscriberName.c_str());
   
   if (!theReport)
   {
      MessageInterface::ShowMessage
         (wxT("OutputTree::OnCompareTextLines() The ReportFile: %s is NULL.\n"),
          theSubscriberName.c_str());
      return;
   }
   
   wxString filename1 = theReport->GetPathAndFileName();
   StringArray colTitles = theReport->GetRefObjectNameArray(Gmat::PARAMETER);
   wxString filename2 =
      wxFileSelector(wxT("Choose a file to open"), wxT(""), wxT(""), wxT("report"),
                     wxT("Report files (*.report)|*.report|")
                     wxT("Text files (*.txt)|*.txt|All files (*.*)|*.*"));
   
   if (filename2.empty())
      return;
   
   int file1DiffCount = 0;
   int file2DiffCount = 0;
   int file3DiffCount = 0;
   
   StringArray output =
      GmatFileUtil::CompareLines(1, filename1.c_str(), filename2.c_str(), wxT(""), wxT(""),
                                 file1DiffCount, file2DiffCount, file3DiffCount);
   
   ViewTextFrame *compWindow = GmatAppData::Instance()->GetCompareWindow();
   if (compWindow == NULL)
   {
      compWindow =
         new ViewTextFrame(GmatAppData::Instance()->GetMainFrame(),
                           wxT("Compare Utility"), 50, 50, 800, 500, wxT("Permanent"));
      GmatAppData::Instance()->SetCompareWindow(compWindow);
      wxString msg;
      msg.Printf(wxT("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()));
}