From 55679355dc3c7386bce108de096a48d7ece5f145 Mon Sep 17 00:00:00 2001 From: steve.greedy Date: Fri, 5 Oct 2018 14:53:20 +0100 Subject: [PATCH] Mesh Scaling --- GUI/SW1/SRC/BUNDLEBLDR.cpp | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------ GUI/SW1/SRC/BUNDLEBLDR.h | 4 +++- GUI/SW1/SRC/DCONN.cpp | 2 +- GUI/SW1/SRC/DCONN.h | 2 ++ GUI/SW1/SRC/MESH_LAPLACE.cpp | 6 ++++-- GUI/SW1/SRC/MESH_LAPLACE.h | 4 ++-- GUI/SW1/SRC/SPACEWIRE.cpp | 2 +- GUI/SW1/SRC/SPACEWIRE.h | 2 ++ GUI/SW1/SRC/SW1_GUIApp.h | 2 +- GUI/SW1/SRC/TP.cpp | 4 ++-- GUI/SW1/SRC/TP.h | 2 ++ GUI/SW1/SRC/TWINAX.cpp | 2 +- GUI/SW1/SRC/TWINAX.h | 2 ++ GUI/SW1/SRC/UTP.cpp | 4 ++-- GUI/SW1/SRC/UTP.h | 2 ++ GUI/SW1/SRC/resources/Build | 2 +- version_information.inc | 2 +- 17 files changed, 99 insertions(+), 27 deletions(-) diff --git a/GUI/SW1/SRC/BUNDLEBLDR.cpp b/GUI/SW1/SRC/BUNDLEBLDR.cpp index 950edf3..acb8446 100644 --- a/GUI/SW1/SRC/BUNDLEBLDR.cpp +++ b/GUI/SW1/SRC/BUNDLEBLDR.cpp @@ -334,7 +334,7 @@ void BUNDLEBLDR::OnListboxRDown(wxMouseEvent& event) wxString strMessage; wxString strItem = ListBox1->GetString(item); - strMessage = "Are you sure you wish to delete: "; + strMessage = "Are you sure you w DrawBundleCsection();ish to delete: "; strMessage = strMessage << strItem; // Confirm cable component deletion? wxMessageDialog bb_ConfirmDelete (this, strMessage, _("Please confirm delete") ,wxYES_NO|wxCENTRE,wxDefaultPosition ); @@ -355,7 +355,7 @@ void BUNDLEBLDR::PopulateListControl(void) { ListBox1->Clear(); - Button1->Enable(); + Button1->Enable(); DrawBundleCsection(); Bundle *Current = bundle_root; @@ -485,8 +485,11 @@ void BUNDLEBLDR::OnCheckListBox1Toggled(wxCommandEvent& event) void BUNDLEBLDR::OnPanel1Paint(wxPaintEvent& event) { + DrawPanel(); - DrawBundleCsection(); + //DrawBundleCsection(); + + } void BUNDLEBLDR::DrawPanel() @@ -667,7 +670,7 @@ void BUNDLEBLDR::DrawBundleCable(wxString cable, wxString x, wxString y, wxStrin dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2+scaledyCoord), inner_conductor_Scaledradius ); - DrawBundleCsection(); + } if (str.compare("Twinax") == 0 ){ @@ -1302,6 +1305,15 @@ void BUNDLEBLDR::DrawBundleCable(wxString cable, wxString x, wxString y, wxStrin } } + if(CheckBox1->GetValue()) + { + // Ground Plane + int size_hl, size_vl; + Panel1->GetSize(&size_hl, &size_vl ); + dc.SetPen( wxPen( (*wxBLACK) ,5 , wxSOLID) ); + dc.DrawLine( 0, size_vl/2, size_hl,size_vl/2 ); + } + } void BUNDLEBLDR::OnButton1Click(wxCommandEvent& event) @@ -1471,7 +1483,8 @@ void BUNDLEBLDR::OnButton2Click(wxCommandEvent& event) meshfile = meshfile.substr(0, extindex); extindex = meshfile.find_last_of ("."); - + int size_h, size_v; + Panel1->GetSize(&size_h, &size_v ); meshfile = meshfile.substr(0, extindex); meshfile = meshfile.substr(2,meshfile.length()); @@ -1523,9 +1536,11 @@ void BUNDLEBLDR::OnComboBox1Selected(wxCommandEvent& event) { wxString meshToView; meshToView<GetValue(); - draw_mesh(Panel1,meshToView); + draw_mesh(Panel1,meshToView, scale); MeshSelected = 1; + + TextCtrl8->Disable(); } void BUNDLEBLDR::OnTextCtrl4Text(wxCommandEvent& event) @@ -1557,9 +1572,11 @@ void BUNDLEBLDR::OnSpinButton1Change(wxSpinEvent& event) maxXY.ToDouble(&maxDimension); - FormatPanel(maxDimension); - - DrawBundleCsection(); + if (MeshSelected == 0) + { + FormatPanel(maxDimension); + DrawBundleCsection(); + } } @@ -1573,7 +1590,20 @@ void BUNDLEBLDR::OnTextCtrl8TextEnter(wxCommandEvent& event) FormatPanel(maxDimension); - DrawBundleCsection(); + + if (MeshSelected == 1) + { + scale = scale + 0.1; + + wxString meshToView; + meshToView<GetValue(); + draw_mesh(Panel1,meshToView, scale); + } + + else + { + DrawBundleCsection(); + } } @@ -1595,7 +1625,20 @@ void BUNDLEBLDR::OnSpinButton1ChangeUp(wxSpinEvent& event) FormatPanel(maxDimension); - DrawBundleCsection(); + if (MeshSelected == 1) + { + scale = scale + 0.05; + + wxString meshToView; + meshToView<GetValue(); + draw_mesh(Panel1,meshToView, scale); + } + + else + { + DrawBundleCsection(); + } + } void BUNDLEBLDR::OnSpinButton1ChangeDown(wxSpinEvent& event) @@ -1618,6 +1661,21 @@ void BUNDLEBLDR::OnSpinButton1ChangeDown(wxSpinEvent& event) FormatPanel(maxDimension); - DrawBundleCsection(); + + if (MeshSelected == 1) + { + scale = scale - 0.05; + + if (scale <= 0.05) scale = 0.05; + + wxString meshToView; + meshToView<GetValue(); + draw_mesh(Panel1,meshToView, scale); + } + + else + { + DrawBundleCsection(); + } } diff --git a/GUI/SW1/SRC/BUNDLEBLDR.h b/GUI/SW1/SRC/BUNDLEBLDR.h index 1525dfb..04779a4 100644 --- a/GUI/SW1/SRC/BUNDLEBLDR.h +++ b/GUI/SW1/SRC/BUNDLEBLDR.h @@ -148,7 +148,9 @@ class BUNDLEBLDR: public wxDialog wxString MESH_PARAM1; wxString MESH_PARAM2; - int MeshSelected; + int MeshSelected = 0; + + float scale = 1.0; //(*Declarations(BUNDLEBLDR) diff --git a/GUI/SW1/SRC/DCONN.cpp b/GUI/SW1/SRC/DCONN.cpp index a8dc36a..f9f596e 100644 --- a/GUI/SW1/SRC/DCONN.cpp +++ b/GUI/SW1/SRC/DCONN.cpp @@ -576,7 +576,7 @@ void DCONN::OnComboBox1Selected(wxCommandEvent& event) { wxString meshToView; meshToView<GetValue(); - draw_mesh(Panel1,meshToView); + draw_mesh(Panel1,meshToView, scale); } void DCONN::OnCheckBox2Click(wxCommandEvent& event) diff --git a/GUI/SW1/SRC/DCONN.h b/GUI/SW1/SRC/DCONN.h index bc811b3..fbfd705 100644 --- a/GUI/SW1/SRC/DCONN.h +++ b/GUI/SW1/SRC/DCONN.h @@ -94,6 +94,8 @@ class DCONN: public wxDialog wxString MESH_PARAM1; wxString MESH_PARAM2; + float scale = 1.0; + //(*Declarations(DCONN) wxTextCtrl* TextCtrl4; wxStaticText* StaticText2; diff --git a/GUI/SW1/SRC/MESH_LAPLACE.cpp b/GUI/SW1/SRC/MESH_LAPLACE.cpp index d88ff0b..5fa3bc2 100644 --- a/GUI/SW1/SRC/MESH_LAPLACE.cpp +++ b/GUI/SW1/SRC/MESH_LAPLACE.cpp @@ -41,7 +41,7 @@ #include "MESH_LAPLACE.h" -void draw_mesh(wxPanel *Panel, wxString mesh_to_draw) +void draw_mesh(wxPanel *Panel, wxString mesh_to_draw, float zoom) { wxClientDC dc(Panel); dc.Clear(); @@ -108,6 +108,8 @@ void draw_mesh(wxPanel *Panel, wxString mesh_to_draw) dc.SetPen( wxPen( *wxBLUE)); + scale = scale * zoom; + int i, polygon_edges, v1, v2, v3; v1 = 0; @@ -135,7 +137,7 @@ void draw_mesh(wxPanel *Panel, wxString mesh_to_draw) meshFile.close(); } -void zoom_mesh(wxPanel *Panel, wxString mesh_to_draw) +void zoom_mesh(wxPanel *Panel, wxString mesh_to_draw, float zoom) { wxClientDC dc(Panel); diff --git a/GUI/SW1/SRC/MESH_LAPLACE.h b/GUI/SW1/SRC/MESH_LAPLACE.h index 28cbe4f..9d9543e 100644 --- a/GUI/SW1/SRC/MESH_LAPLACE.h +++ b/GUI/SW1/SRC/MESH_LAPLACE.h @@ -87,8 +87,8 @@ using namespace std; // DECLARE_EVENT_TABLE() //}; -void draw_mesh(wxPanel *Panel, wxString mesh_to_draw); -void zoom_mesh(wxPanel *Panel, wxString mesh_to_draw); +void draw_mesh(wxPanel *Panel, wxString mesh_to_draw, float scale); +void zoom_mesh(wxPanel *Panel, wxString mesh_to_draw, float scale); //class MESH_LAPLACE: public wxDialog //{ diff --git a/GUI/SW1/SRC/SPACEWIRE.cpp b/GUI/SW1/SRC/SPACEWIRE.cpp index 6b8f195..a9eee2d 100644 --- a/GUI/SW1/SRC/SPACEWIRE.cpp +++ b/GUI/SW1/SRC/SPACEWIRE.cpp @@ -1624,7 +1624,7 @@ void SPACEWIRE::OnComboBox1Selected(wxCommandEvent& event) { wxString meshToView; meshToView<GetValue(); - draw_mesh(Panel1,meshToView); + draw_mesh(Panel1,meshToView, scale); } void SPACEWIRE::OnCheckBox3Click(wxCommandEvent& event) diff --git a/GUI/SW1/SRC/SPACEWIRE.h b/GUI/SW1/SRC/SPACEWIRE.h index df92288..93203bd 100644 --- a/GUI/SW1/SRC/SPACEWIRE.h +++ b/GUI/SW1/SRC/SPACEWIRE.h @@ -90,6 +90,8 @@ class SPACEWIRE: public wxDialog void spacewireSchematic(); void OnHighlightSchematic(wxCommandEvent & event); + float scale = 1.0; + wxString FD_ESR1; wxString FD_ESR2; wxString FD_ESR3; diff --git a/GUI/SW1/SRC/SW1_GUIApp.h b/GUI/SW1/SRC/SW1_GUIApp.h index e643473..7b531e9 100644 --- a/GUI/SW1/SRC/SW1_GUIApp.h +++ b/GUI/SW1/SRC/SW1_GUIApp.h @@ -68,7 +68,7 @@ class SW1_GUIApp : public wxApp wxBitmap splashimage; std::string SACAMOS_V_NUMBER = "SPICE_CABLE_MODEL_BUILDER_version=\"v4.0.0\""; - std::string SACAMOS_V_DATE = "SPICE_CABLE_MODEL_BUILDER_date=\"27th September 2018\""; + std::string SACAMOS_V_DATE = "SPICE_CABLE_MODEL_BUILDER_date=\"5th October 2018\""; diff --git a/GUI/SW1/SRC/TP.cpp b/GUI/SW1/SRC/TP.cpp index 5d57f09..de0b41e 100644 --- a/GUI/SW1/SRC/TP.cpp +++ b/GUI/SW1/SRC/TP.cpp @@ -1158,7 +1158,7 @@ void TP::OnPanel4MouseWheel(wxMouseEvent& event) wxClientDC dc(Panel4); dc.Clear(); - zoom_mesh(Panel4,fileName); + zoom_mesh(Panel4,fileName,scale); } @@ -1166,7 +1166,7 @@ void TP::OnComboBox1Selected(wxCommandEvent& event) { wxString meshToView; meshToView<GetValue(); - draw_mesh(Panel4,meshToView); + draw_mesh(Panel4,meshToView, scale); } void TP::OnCheckBox4Click(wxCommandEvent& event) diff --git a/GUI/SW1/SRC/TP.h b/GUI/SW1/SRC/TP.h index 57c8c3e..103f147 100644 --- a/GUI/SW1/SRC/TP.h +++ b/GUI/SW1/SRC/TP.h @@ -91,6 +91,8 @@ class TP: public wxDialog void tpSchematic(); void OnHighlightSchematic(wxCommandEvent & event); + float scale = 1.0; + wxString FD_ESR1; wxString FD_ESR2; wxString FD_ESR3; diff --git a/GUI/SW1/SRC/TWINAX.cpp b/GUI/SW1/SRC/TWINAX.cpp index e18d4e0..bd356f5 100644 --- a/GUI/SW1/SRC/TWINAX.cpp +++ b/GUI/SW1/SRC/TWINAX.cpp @@ -1140,7 +1140,7 @@ void TWINAX::OnComboBox1Selected(wxCommandEvent& event) { wxString meshToView; meshToView<GetValue(); - draw_mesh(Panel1,meshToView); + draw_mesh(Panel1,meshToView, scale); } void TWINAX::OnCheckBox3Click(wxCommandEvent& event) diff --git a/GUI/SW1/SRC/TWINAX.h b/GUI/SW1/SRC/TWINAX.h index c3e11d1..aa4ae4d 100644 --- a/GUI/SW1/SRC/TWINAX.h +++ b/GUI/SW1/SRC/TWINAX.h @@ -91,6 +91,8 @@ class TWINAX: public wxDialog void twinaxSchematic(); void OnHighlightSchematic(wxCommandEvent & event); + float scale = 1.0; + wxString FD_ESR1; wxString FD_ESR2; wxString FD_ESR3; diff --git a/GUI/SW1/SRC/UTP.cpp b/GUI/SW1/SRC/UTP.cpp index 998374a..40d2c9c 100644 --- a/GUI/SW1/SRC/UTP.cpp +++ b/GUI/SW1/SRC/UTP.cpp @@ -688,14 +688,14 @@ void UTP::OnPanel1MouseWheel(wxMouseEvent& event) wxClientDC dc(Panel1); dc.Clear(); - zoom_mesh(Panel1,fileName); + zoom_mesh(Panel1,fileName, scale); } void UTP::OnComboBox1Selected(wxCommandEvent& event) { wxString meshToView; meshToView<GetValue(); - draw_mesh(Panel1,meshToView); + draw_mesh(Panel1,meshToView, scale); } void UTP::EditExistingCable() diff --git a/GUI/SW1/SRC/UTP.h b/GUI/SW1/SRC/UTP.h index 46ad8bb..367b4fe 100644 --- a/GUI/SW1/SRC/UTP.h +++ b/GUI/SW1/SRC/UTP.h @@ -92,6 +92,8 @@ class UTP: public wxDialog void utpSchematic(); void OnHighlightSchematic(wxCommandEvent & event); + float scale = 1.0; + wxString FD_ESR1; wxString FD_ESR2; wxString FD_ESR3; diff --git a/GUI/SW1/SRC/resources/Build b/GUI/SW1/SRC/resources/Build index 7fd51cd..12d9a62 100644 --- a/GUI/SW1/SRC/resources/Build +++ b/GUI/SW1/SRC/resources/Build @@ -1,6 +1,6 @@ GUI: Version: v4.0.0 -Date: 27th September 2018 +Date: 5th October 2018 SPICE_CABLE_MODEL_BUILDER Version: v4.0.0 diff --git a/version_information.inc b/version_information.inc index eaacfd6..7fc07df 100644 --- a/version_information.inc +++ b/version_information.inc @@ -1,2 +1,2 @@ SPICE_CABLE_MODEL_BUILDER_version="v4.0.0" -SPICE_CABLE_MODEL_BUILDER_date="27th September 2018" +SPICE_CABLE_MODEL_BUILDER_date="5th October 2018" -- libgit2 0.21.2