From 3d24aeb120829236b6ab1f46bad41d135765d88d Mon Sep 17 00:00:00 2001 From: steve.greedy Date: Fri, 10 Aug 2018 17:34:26 +0100 Subject: [PATCH] Modification to system calls --- GUI/SW1/SRC/BUNDLEBLDR.cpp | 160 ++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------ GUI/SW1/SRC/BUNDLEBLDR.h | 2 +- GUI/SW1/SRC/BUNDLE_SCHEMATIC.cpp | 7 ++++--- GUI/SW1/SRC/BUNDLE_SCHEMATIC.h | 4 +++- GUI/SW1/SRC/COAXIAL.cpp | 2 +- GUI/SW1/SRC/CYLINDRICAL.cpp | 2 +- GUI/SW1/SRC/DCONN.cpp | 2 +- GUI/SW1/SRC/EXPORT_SPICE.cpp | 16 +++++++++++----- GUI/SW1/SRC/FLEXCABLE.cpp | 2 +- GUI/SW1/SRC/OVERSHIELD.cpp | 2 +- GUI/SW1/SRC/RUN_STATUS.cpp | 8 ++++++-- GUI/SW1/SRC/SPACEWIRE.cpp | 2 +- GUI/SW1/SRC/SPICEMODEL.cpp | 23 ++++++++++++++++++----- GUI/SW1/SRC/TP.cpp | 2 +- GUI/SW1/SRC/TWINAX.cpp | 2 +- GUI/SW1/SRC/UTP.cpp | 2 +- 16 files changed, 74 insertions(+), 164 deletions(-) diff --git a/GUI/SW1/SRC/BUNDLEBLDR.cpp b/GUI/SW1/SRC/BUNDLEBLDR.cpp index a0c503e..8e333ce 100644 --- a/GUI/SW1/SRC/BUNDLEBLDR.cpp +++ b/GUI/SW1/SRC/BUNDLEBLDR.cpp @@ -423,7 +423,6 @@ void BUNDLEBLDR::PopulateTheDirectoryTree (wxString Path) "*.cable_spec", 0, _T("Directory Listing")); - // JIB Connect(tree->GetTreeCtrl()->GetId(),wxEVT_COMMAND_TREE_ITEM_ACTIVATED, (wxObjectEventFunction) (wxEventFunction)(wxCommandEventFunction) &BUNDLEBLDR::OnTreeSelectionChanged); @@ -559,6 +558,8 @@ void BUNDLEBLDR::FormatPanel(double maxDimension) void BUNDLEBLDR::DrawBundleCable(wxString cable, wxString x, wxString y, wxString rot) { + wxString separator(wxFileName::GetPathSeparator()); + double xCoord, yCoord, rotation, maxDimension; x.ToDouble(&xCoord); @@ -573,7 +574,7 @@ void BUNDLEBLDR::DrawBundleCable(wxString cable, wxString x, wxString y, wxStrin wxClientDC dc(Panel1); std::stringstream stream; - stream <GetValue(); maxXY.ToDouble(&maxDimension); -// wxString scale; -// scale << maxDimension/2.0; - -// dc.SetTextForeground(*wxBLUE); -// -// dc.DrawLine( size_h/2, size_v-50, size_h-size_h/4, size_v-50 ); -// dc.DrawLine( size_h/2, size_v-50, size_h/2, size_v-40 ); -// dc.DrawLine( size_h-size_h/4, size_v-50, size_h-size_h/4, size_v-40 ); -// -// dc.DrawText("scale (m)", (size_h/2+50), size_v-70); -// dc.DrawText(scale, (size_h/2+55), size_v-40); - if (str.compare("Cylindrical") == 0 ){ std::getline(cableFile, str); @@ -654,8 +638,6 @@ void BUNDLEBLDR::DrawBundleCable(wxString cable, wxString x, wxString y, wxStrin float inner_conductor_Scaledradius, shield_Scaledradius, outer_Scaledinsulation, shield_Scaledthickness, scaledxCoord, scaledyCoord; - //scaleFactor = (size_h * 0.5); - outer_Scaledinsulation = (outer_insulation/maxDimension)*scaleFactor; shield_Scaledthickness = (shield_thickness/maxDimension)*scaleFactor; shield_Scaledradius = (shield_radius/maxDimension)*scaleFactor; @@ -1096,8 +1078,6 @@ void BUNDLEBLDR::DrawBundleCable(wxString cable, wxString x, wxString y, wxStrin cableFile >> conductor_rows; std::getline(cableFile, str); //Read to end of line - //float scaleFactor = (size_h/dielectric_width) * 0.6; - float scaled_dielectric_width, scaled_dielectric_height, scaledxCoord, scaledyCoord; float dx1,dy1,dx2,dy2,dx3,dy3,dx4,dy4, tempx, tempy, rotation_rad; @@ -1113,14 +1093,6 @@ void BUNDLEBLDR::DrawBundleCable(wxString cable, wxString x, wxString y, wxStrin float s = sin(rotation_rad); float c = cos(rotation_rad); -// wxString point; -// -// point<< tempx <<", "<> conductors; -// std::getline(cableFile, str); //Read to end of line -// std::getline(cableFile, str); //Read to end of line -// cableFile >> conductor_width; -// std::getline(cableFile, str); //Read to end of line -// cableFile >> conductor_height; -// std::getline(cableFile, str); //Read to end of line -// cableFile >> conductor_separation; -// std::getline(cableFile, str); //Read to end of line -// cableFile >> dielectric_offset_x; -// std::getline(cableFile, str); //Read to end of line -// cableFile >> dielectric_offset_y; -// -// -// float conductor_Scaledwidth, -// conductor_Scaledheight, -// conductor_Scaledseparation, -// dielectric_Scaledoffset_x, -// //dielectric_Scaledoffset_y, -// totalScaledWidth, -// totalScaledHeight, -// scaledxCoord, -// scaledyCoord; -// -// -// float totalWidth = (conductors*conductor_width)+((conductors-1) * conductor_separation)+(dielectric_offset_x * 2); -// float totalHeight = (2 * dielectric_offset_y) + conductor_height; -// -// conductor_Scaledwidth = (conductor_width/maxDimension)*scaleFactor; -// conductor_Scaledheight = (conductor_height/maxDimension)*scaleFactor; -// conductor_Scaledseparation = (conductor_separation/maxDimension)*scaleFactor; -// dielectric_Scaledoffset_x = (dielectric_offset_x/maxDimension)*scaleFactor; -// //dielectric_Scaledoffset_y = (dielectric_offset_y/maxDimension)*scaleFactor; -// totalScaledHeight = (totalHeight/maxDimension)*scaleFactor; -// totalScaledWidth = (totalWidth/maxDimension)*scaleFactor; -// scaledxCoord = (xCoord/maxDimension)*scaleFactor; -// scaledyCoord = (yCoord/maxDimension)*scaleFactor; -// -// size_h = size_h + scaledxCoord; -// size_v = size_v + scaledyCoord; -// -// dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); -// dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH)); -// dc.DrawRectangle(wxPoint(size_h/2-totalScaledWidth/2, size_v/2-totalScaledHeight/2), wxSize(totalScaledWidth,totalScaledHeight)); -// -// float x_origin, y_origin; -// x_origin = (size_h/2 - totalScaledWidth/2)+dielectric_Scaledoffset_x; -// y_origin = size_v/2 - conductor_Scaledheight/2; -// -// dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); -// dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); -// -// for(int i=0;iGetCount() << " #Number of cables in bundle, cable list follows\n"; @@ -1459,7 +1346,7 @@ void BUNDLEBLDR::WriteBundleFile(wxString fileName) cable = bundle_list->CableType; - //Remove pesky file extension + //Remove file extension size_t lastindex = cable.find_last_of("."); wxString cable_name = cable.substr(0, lastindex); //at the moment here requires full path to file @@ -1536,29 +1423,26 @@ void BUNDLEBLDR::OnButton2Click(wxCommandEvent& event) wxString fileName = TextCtrl1->GetValue(); - WriteBundleFile (TextCtrl1->GetValue()); + wxString command_line; + + wxString separator(wxFileName::GetPathSeparator()); - //std::stringstream stream; + WriteBundleFile (TextCtrl1->GetValue()); - #ifdef UNIX - std::stringstream stream; - stream << "./cable_bundle_model_builder" - << " " - << MODname + "/BUNDLE/" - << fileName ; - #else std::stringstream stream; - stream << "\"..\\BIN\\cable_bundle_model_builder.exe\"" + stream <<"." + separator + << "cable_bundle_model_builder" << " " - << "..\\" + MODname + "\\CABLE\\" + << ".." + separator + MODname + separator + "BUNDLE" + separator << fileName ; - #endif - system(stream.str().c_str()); + command_line << stream.str().c_str(); + + wxExecute (command_line,wxEXEC_SYNC); // Display Run Status - RUN_STATUS *run_status = new RUN_STATUS(this); - run_status->ShowModal(); + RUN_STATUS *run_status_bundle = new RUN_STATUS(this); + run_status_bundle->ShowModal(); //Button1->Enable(); diff --git a/GUI/SW1/SRC/BUNDLEBLDR.h b/GUI/SW1/SRC/BUNDLEBLDR.h index 4c0f630..172d68e 100644 --- a/GUI/SW1/SRC/BUNDLEBLDR.h +++ b/GUI/SW1/SRC/BUNDLEBLDR.h @@ -4,7 +4,7 @@ // It was developed by the University of Nottingham and the Netherlands Aerospace // Centre (NLR) for ESA under contract number 4000112765/14/NL/HK. // -// Copyright (C) 2015 - 2017 University of Nottingham +// Copyright (C) 2015 - 2018 University of Nottingham // // SACAMOS is free software: you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the Free Software diff --git a/GUI/SW1/SRC/BUNDLE_SCHEMATIC.cpp b/GUI/SW1/SRC/BUNDLE_SCHEMATIC.cpp index 14aa0d7..9f95ae9 100644 --- a/GUI/SW1/SRC/BUNDLE_SCHEMATIC.cpp +++ b/GUI/SW1/SRC/BUNDLE_SCHEMATIC.cpp @@ -111,14 +111,15 @@ void draw_bundle(wxPanel *Panel, wxString Path, wxString bundle_to_draw) std::getline(bundleFile, bundle_str); wxString cable_spec(bundle_str); + wxString separator(wxFileName::GetPathSeparator()); + wxString cableFileName; - cableFileName << Path <<"\\"<<"CABLE"<<"\\"<> xCoord; bundleFile >> yCoord; - yCoord = -1.0 * yCoord; - std::getline(bundleFile, bundle_str); //Read to end of line std::ifstream cableFile; diff --git a/GUI/SW1/SRC/BUNDLE_SCHEMATIC.h b/GUI/SW1/SRC/BUNDLE_SCHEMATIC.h index 5786eb5..bf11306 100644 --- a/GUI/SW1/SRC/BUNDLE_SCHEMATIC.h +++ b/GUI/SW1/SRC/BUNDLE_SCHEMATIC.h @@ -4,7 +4,7 @@ // It was developed by the University of Nottingham and the Netherlands Aerospace // Centre (NLR) for ESA under contract number 4000112765/14/NL/HK. // -// Copyright (C) 2015 - 2017 University of Nottingham +// Copyright (C) 2015 - 2018 University of Nottingham // // SACAMOS is free software: you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the Free Software @@ -42,12 +42,14 @@ #include #include #include +#include // Standard Library Header Files #include #include #include #include +#include using namespace std; diff --git a/GUI/SW1/SRC/COAXIAL.cpp b/GUI/SW1/SRC/COAXIAL.cpp index 5079dfb..5288de1 100644 --- a/GUI/SW1/SRC/COAXIAL.cpp +++ b/GUI/SW1/SRC/COAXIAL.cpp @@ -407,7 +407,7 @@ void COAXIAL::OnButton2Click(wxCommandEvent& event) command_line << stream.str().c_str(); - wxExecute (command_line); + wxExecute (command_line, wxEXEC_SYNC); // Display Run Status RUN_STATUS *run_status = new RUN_STATUS(this); diff --git a/GUI/SW1/SRC/CYLINDRICAL.cpp b/GUI/SW1/SRC/CYLINDRICAL.cpp index ddeac81..db4e7a0 100644 --- a/GUI/SW1/SRC/CYLINDRICAL.cpp +++ b/GUI/SW1/SRC/CYLINDRICAL.cpp @@ -250,7 +250,7 @@ void CYLINDRICAL::OnButton2Click(wxCommandEvent& event) command_line << stream.str().c_str(); - wxExecute (command_line); + wxExecute (command_line, wxEXEC_SYNC); // Display Run Status RUN_STATUS *run_status = new RUN_STATUS(this); diff --git a/GUI/SW1/SRC/DCONN.cpp b/GUI/SW1/SRC/DCONN.cpp index 5c06dcb..4b59acf 100644 --- a/GUI/SW1/SRC/DCONN.cpp +++ b/GUI/SW1/SRC/DCONN.cpp @@ -255,7 +255,7 @@ void DCONN::OnButton2Click(wxCommandEvent& event) command_line << stream.str().c_str(); - wxExecute (command_line);; + wxExecute (command_line, wxEXEC_SYNC);; // Display Run Status RUN_STATUS *run_status = new RUN_STATUS(this); diff --git a/GUI/SW1/SRC/EXPORT_SPICE.cpp b/GUI/SW1/SRC/EXPORT_SPICE.cpp index 2f03d4c..e14cc0b 100644 --- a/GUI/SW1/SRC/EXPORT_SPICE.cpp +++ b/GUI/SW1/SRC/EXPORT_SPICE.cpp @@ -131,8 +131,10 @@ void EXPORT_SPICE::OnDirPickerCtrl2DirChanged(wxFileDirPickerEvent& event) void EXPORT_SPICE::OnButton1Click(wxCommandEvent& event) { + wxString separator(wxFileName::GetPathSeparator()); - wxString sacamos_sym_dir = "..\\" + MODname + "\\SPICE\\SYMBOL\\"; + //wxString sacamos_sym_dir = "..\\" + MODname + "\\SPICE\\SYMBOL\\"; + wxString sacamos_sym_dir = ".." + separator + MODname + separator +"SPICE" + separator +"SYMBOL" + separator; wxSetWorkingDirectory(sacamos_sym_dir); wxString file, pattern, export_notification; @@ -158,7 +160,8 @@ void EXPORT_SPICE::OnButton1Click(wxCommandEvent& event) wxString file_name = file_no_path.substr(0, lastindex); ng_sym_from = file_no_path; - ng_sym_to = ng_sym_dir + "\\" + file_no_path; + //ng_sym_to = ng_sym_dir + "\\" + file_no_path; + ng_sym_to = ng_sym_dir + separator + file_no_path; wxCopyFile(ng_sym_from, ng_sym_to); @@ -174,7 +177,8 @@ void EXPORT_SPICE::OnButton1Click(wxCommandEvent& event) { if (file_to_edit[i] == ("file=PATH_TO_TRANSMISSION_LINE_SUB_CIRCUITS/" + file_name + "_Ngspice.lib")) { - file_to_edit[i] = "file=" + pathToMOD + "\\SPICE\\" + file_name + "_Ngspice.lib"; + //file_to_edit[i] = "file=" + pathToMOD + "\\SPICE\\" + file_name + "_Ngspice.lib"; + file_to_edit[i] = "file=" + pathToMOD + separator + "SPICE" + separator + file_name + "_Ngspice.lib"; } file_to_edit.Write(); } @@ -208,7 +212,8 @@ void EXPORT_SPICE::OnButton1Click(wxCommandEvent& event) wxString file_name = file_no_path.substr(0, lastindex); lt_sym_from = file_no_path; - lt_sym_to = lt_sym_dir + "\\" + file_no_path; + //lt_sym_to = lt_sym_dir + "\\" + file_no_path; + lt_sym_to = lt_sym_dir + separator + file_no_path; wxCopyFile(lt_sym_from, lt_sym_to); @@ -224,7 +229,8 @@ void EXPORT_SPICE::OnButton1Click(wxCommandEvent& event) { if (file_to_edit[i] == ("SYMATTR ModelFile PATH_TO_TRANSMISSION_LINE_SUB_CIRCUITS/" + file_name + "_LTspice.lib")) { - file_to_edit[i] = "SYMATTR ModelFile " + pathToMOD + "\\SPICE\\" + file_name + "_LTspice.lib"; + //file_to_edit[i] = "SYMATTR ModelFile " + pathToMOD + "\\SPICE\\" + file_name + "_LTspice.lib"; + file_to_edit[i] = "SYMATTR ModelFile " + pathToMOD + separator + "SPICE" + separator + file_name + "_LTspice.lib"; } file_to_edit.Write(); } diff --git a/GUI/SW1/SRC/FLEXCABLE.cpp b/GUI/SW1/SRC/FLEXCABLE.cpp index 595d263..dee02dd 100644 --- a/GUI/SW1/SRC/FLEXCABLE.cpp +++ b/GUI/SW1/SRC/FLEXCABLE.cpp @@ -326,7 +326,7 @@ void FLEXCABLE::OnButton2Click(wxCommandEvent& event) command_line << stream.str().c_str(); - wxExecute (command_line); + wxExecute (command_line, wxEXEC_SYNC); // Display Run Status RUN_STATUS *run_status = new RUN_STATUS(this); diff --git a/GUI/SW1/SRC/OVERSHIELD.cpp b/GUI/SW1/SRC/OVERSHIELD.cpp index 91ad3c4..f171c0f 100644 --- a/GUI/SW1/SRC/OVERSHIELD.cpp +++ b/GUI/SW1/SRC/OVERSHIELD.cpp @@ -265,7 +265,7 @@ void OVERSHIELD::OnButton2Click(wxCommandEvent& event) command_line << stream.str().c_str(); - wxExecute (command_line); + wxExecute (command_line, wxEXEC_SYNC); // Display Run Status RUN_STATUS *run_status = new RUN_STATUS(this); diff --git a/GUI/SW1/SRC/RUN_STATUS.cpp b/GUI/SW1/SRC/RUN_STATUS.cpp index a3f8083..2b477da 100644 --- a/GUI/SW1/SRC/RUN_STATUS.cpp +++ b/GUI/SW1/SRC/RUN_STATUS.cpp @@ -84,8 +84,6 @@ void RUN_STATUS::DisplayRunStatus() wxString text; wxTextFile StatusFile; - //int lineCount = LicenseFile.GetLineCount(); - if (StatusFile.Open(RunStatusFile)) { for (int i = 0; iSetValue(text); } + if (!StatusFile.Open(RunStatusFile)) + { + DisplayRunStatus(); + } + + StatusFile.Close(); } diff --git a/GUI/SW1/SRC/SPACEWIRE.cpp b/GUI/SW1/SRC/SPACEWIRE.cpp index cf6a412..ed3efc4 100644 --- a/GUI/SW1/SRC/SPACEWIRE.cpp +++ b/GUI/SW1/SRC/SPACEWIRE.cpp @@ -520,7 +520,7 @@ void SPACEWIRE::OnButton2Click(wxCommandEvent& event) << ".." + separator + MODname + separator + "CABLE" + separator << fileName ; - wxExecute (command_line); + wxExecute (command_line, wxEXEC_SYNC); // Display Run Status RUN_STATUS *run_status = new RUN_STATUS(this); diff --git a/GUI/SW1/SRC/SPICEMODEL.cpp b/GUI/SW1/SRC/SPICEMODEL.cpp index 01f642d..36f73d1 100644 --- a/GUI/SW1/SRC/SPICEMODEL.cpp +++ b/GUI/SW1/SRC/SPICEMODEL.cpp @@ -390,15 +390,28 @@ void SPICEMODEL::OnButton2Click(wxCommandEvent& event) { //SPICE CABLE BUNDLE MODEL wxString fileName = TextCtrl1->GetValue(); - //wxString fineName = fileName; + wxString command_line; + + wxString separator(wxFileName::GetPathSeparator()); std::stringstream stream; - stream << "\"..\\BIN\\spice_cable_bundle_model_builder\"" + + stream <<"." + separator + << "spice_cable_bundle_model_builder" << " " - << "..\\" + MODname + "\\SPICE\\" - << fileName; + << ".." + separator + MODname + separator + "SPICE" + separator + << fileName ; + + + +// << "\"..\\BIN\\spice_cable_bundle_model_builder\"" +// << " " +// << "..\\" + MODname + "\\SPICE\\" +// << fileName; + + command_line << stream.str().c_str(); - system(stream.str().c_str()); + wxExecute (command_line, wxEXEC_SYNC); RUN_STATUS *run_status = new RUN_STATUS(this); run_status->ShowModal(); diff --git a/GUI/SW1/SRC/TP.cpp b/GUI/SW1/SRC/TP.cpp index 0dfac4c..5d57f09 100644 --- a/GUI/SW1/SRC/TP.cpp +++ b/GUI/SW1/SRC/TP.cpp @@ -479,7 +479,7 @@ void TP::OnButton2Click(wxCommandEvent& event) command_line << stream.str().c_str(); - wxExecute (command_line); + wxExecute (command_line, wxEXEC_SYNC); // Display Run Status RUN_STATUS *run_status = new RUN_STATUS(this); diff --git a/GUI/SW1/SRC/TWINAX.cpp b/GUI/SW1/SRC/TWINAX.cpp index 949980c..e18d4e0 100644 --- a/GUI/SW1/SRC/TWINAX.cpp +++ b/GUI/SW1/SRC/TWINAX.cpp @@ -454,7 +454,7 @@ void TWINAX::OnButton3Click(wxCommandEvent& event) command_line << stream.str().c_str(); - wxExecute (command_line); + wxExecute (command_line, wxEXEC_SYNC); // Display Run Status RUN_STATUS *run_status = new RUN_STATUS(this); diff --git a/GUI/SW1/SRC/UTP.cpp b/GUI/SW1/SRC/UTP.cpp index 6b7e2ac..998374a 100644 --- a/GUI/SW1/SRC/UTP.cpp +++ b/GUI/SW1/SRC/UTP.cpp @@ -329,7 +329,7 @@ void UTP::OnButton2Click(wxCommandEvent& event) command_line << stream.str().c_str(); - wxExecute (command_line); + wxExecute (command_line, wxEXEC_SYNC); ifstream runStatus; -- libgit2 0.21.2