///////////////////////////////////////////////////////////////////////////////// // // This file is part of SACAMOS, cable models for EMI simulations in SPICE. // 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 - 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 // Foundation, either version 3 of the License, or (at your option) any later // version. // // SACAMOS is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License // for more details. // // A copy of the GNU General Public License version 3 can be found in the // file GNU_GPL_v3 in the root or at . // // wxWidgets is currently licenced under the "wxWindows Library Licence". // A copy of the wxWindows Library Licence, Version 3.1 can be found in the file // wxWindows_Library_Licence_v3-1 in the root or at: // // // The University of Nottingham can be contacted at: ggiemr@nottingham.ac.uk // // File Contents: // // NAME // BUNDLEBLDR.cpp // // DESCRIPTION // Cable bundle builder application // // AUTHOR(S) // Steve Greedy // ///////////////////////////////////////////////////////////////////////////////// #include "BUNDLEBLDR.h" #include "PLACE_CABLE.h" #include "MESH_LAPLACE.h" //#define debug 1 #include #include #include #include #include #include #include #define PI 3.14159265358979323846 using namespace std; //(*InternalHeaders(BUNDLEBLDR) #include #include #include //*) //(*IdInit(BUNDLEBLDR) const long BUNDLEBLDR::ID_STATICTEXT1 = wxNewId(); const long BUNDLEBLDR::ID_TEXTCTRL1 = wxNewId(); const long BUNDLEBLDR::ID_PANEL2 = wxNewId(); const long BUNDLEBLDR::ID_LISTBOX1 = wxNewId(); const long BUNDLEBLDR::ID_PANEL3 = wxNewId(); const long BUNDLEBLDR::ID_CHECKBOX1 = wxNewId(); const long BUNDLEBLDR::ID_STATICTEXT2 = wxNewId(); const long BUNDLEBLDR::ID_PANEL4 = wxNewId(); const long BUNDLEBLDR::ID_CHECKBOX2 = wxNewId(); const long BUNDLEBLDR::ID_COMBOBOX1 = wxNewId(); const long BUNDLEBLDR::ID_CHECKBOX3 = wxNewId(); const long BUNDLEBLDR::ID_STATICTEXT6 = wxNewId(); const long BUNDLEBLDR::ID_STATICTEXT7 = wxNewId(); const long BUNDLEBLDR::ID_TEXTCTRL4 = wxNewId(); const long BUNDLEBLDR::ID_STATICTEXT8 = wxNewId(); const long BUNDLEBLDR::ID_TEXTCTRL5 = wxNewId(); const long BUNDLEBLDR::ID_STATICTEXT13 = wxNewId(); const long BUNDLEBLDR::ID_TEXTCTRL9 = wxNewId(); const long BUNDLEBLDR::ID_STATICTEXT14 = wxNewId(); const long BUNDLEBLDR::ID_TEXTCTRL10 = wxNewId(); const long BUNDLEBLDR::ID_PANEL5 = wxNewId(); const long BUNDLEBLDR::ID_STATICTEXT11 = wxNewId(); const long BUNDLEBLDR::ID_CHECKBOX4 = wxNewId(); const long BUNDLEBLDR::ID_STATICTEXT3 = wxNewId(); const long BUNDLEBLDR::ID_TEXTCTRL2 = wxNewId(); const long BUNDLEBLDR::ID_STATICTEXT4 = wxNewId(); const long BUNDLEBLDR::ID_RADIOBUTTON1 = wxNewId(); const long BUNDLEBLDR::ID_RADIOBUTTON2 = wxNewId(); const long BUNDLEBLDR::ID_STATICTEXT5 = wxNewId(); const long BUNDLEBLDR::ID_TEXTCTRL3 = wxNewId(); const long BUNDLEBLDR::ID_STATICTEXT9 = wxNewId(); const long BUNDLEBLDR::ID_TEXTCTRL6 = wxNewId(); const long BUNDLEBLDR::ID_STATICTEXT10 = wxNewId(); const long BUNDLEBLDR::ID_TEXTCTRL7 = wxNewId(); const long BUNDLEBLDR::ID_PANEL6 = wxNewId(); const long BUNDLEBLDR::ID_NOTEBOOK1 = wxNewId(); const long BUNDLEBLDR::ID_BUTTON1 = wxNewId(); const long BUNDLEBLDR::ID_BUTTON2 = wxNewId(); const long BUNDLEBLDR::ID_BUTTON3 = wxNewId(); const long BUNDLEBLDR::ID_PANEL1 = wxNewId(); const long BUNDLEBLDR::ID_STATICTEXT12 = wxNewId(); const long BUNDLEBLDR::ID_TEXTCTRL8 = wxNewId(); const long BUNDLEBLDR::ID_SPINBUTTON1 = wxNewId(); //*) BEGIN_EVENT_TABLE(BUNDLEBLDR,wxDialog) //(*EventTable(BUNDLEBLDR) //*) END_EVENT_TABLE() BUNDLEBLDR::BUNDLEBLDR(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size) { //(*Initialize(BUNDLEBLDR) wxBoxSizer* BoxSizer4; wxStaticBoxSizer* StaticBoxSizer2; wxBoxSizer* BoxSizer6; wxFlexGridSizer* FlexGridSizer4; wxBoxSizer* BoxSizer5; wxBoxSizer* BoxSizer7; wxStaticBoxSizer* StaticBoxSizer4; wxFlexGridSizer* FlexGridSizer3; wxFlexGridSizer* FlexGridSizer5; wxFlexGridSizer* FlexGridSizer9; wxFlexGridSizer* FlexGridSizer2; wxBoxSizer* BoxSizer2; wxFlexGridSizer* FlexGridSizer7; wxStaticBoxSizer* StaticBoxSizer3; wxFlexGridSizer* FlexGridSizer8; wxBoxSizer* BoxSizer1; wxFlexGridSizer* FlexGridSizer6; wxStaticBoxSizer* StaticBoxSizer1; wxFlexGridSizer* FlexGridSizer1; wxBoxSizer* BoxSizer3; Create(parent, wxID_ANY, _("SACAMOS: CABLE BUNDLE BUILDER"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY")); FlexGridSizer1 = new wxFlexGridSizer(1, 2, 0, 0); FlexGridSizer1->AddGrowableCol(0); FlexGridSizer1->AddGrowableCol(1); FlexGridSizer1->AddGrowableRow(0); StaticBoxSizer4 = new wxStaticBoxSizer(wxVERTICAL, this, _("Bundle Specification")); FlexGridSizer3 = new wxFlexGridSizer(0, 1, 0, 0); FlexGridSizer3->AddGrowableRow(1); BoxSizer2 = new wxBoxSizer(wxHORIZONTAL); StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Bundle Name"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1")); BoxSizer2->Add(StaticText1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); TextCtrl1 = new wxTextCtrl(this, ID_TEXTCTRL1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL1")); BoxSizer2->Add(TextCtrl1, 2, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer3->Add(BoxSizer2, 1, wxALL|wxEXPAND, 5); BoxSizer5 = new wxBoxSizer(wxHORIZONTAL); Notebook1 = new wxNotebook(this, ID_NOTEBOOK1, wxDefaultPosition, wxSize(-1,380), 0, _T("ID_NOTEBOOK1")); Panel3 = new wxPanel(Notebook1, ID_PANEL3, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL3")); BoxSizer6 = new wxBoxSizer(wxVERTICAL); StaticBoxSizer2 = new wxStaticBoxSizer(wxVERTICAL, Panel3, _("Cable Component Browser")); BoxSizer7 = new wxBoxSizer(wxVERTICAL); Panel2 = new wxPanel(Panel3, ID_PANEL2, wxDefaultPosition, wxSize(300,140), wxTAB_TRAVERSAL, _T("ID_PANEL2")); BoxSizer7->Add(Panel2, 1, wxALL|wxEXPAND, 5); StaticBoxSizer2->Add(BoxSizer7, 1, wxALL|wxEXPAND, 5); BoxSizer6->Add(StaticBoxSizer2, 2, wxALL|wxEXPAND, 5); StaticBoxSizer3 = new wxStaticBoxSizer(wxVERTICAL, Panel3, _("Bundle Component Cables")); BoxSizer3 = new wxBoxSizer(wxVERTICAL); ListBox1 = new wxListBox(Panel3, ID_LISTBOX1, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("ID_LISTBOX1")); BoxSizer3->Add(ListBox1, 1, wxALL|wxEXPAND, 5); StaticBoxSizer3->Add(BoxSizer3, 1, wxALL|wxEXPAND, 5); BoxSizer6->Add(StaticBoxSizer3, 2, wxALL|wxEXPAND, 5); Panel3->SetSizer(BoxSizer6); BoxSizer6->Fit(Panel3); BoxSizer6->SetSizeHints(Panel3); Panel4 = new wxPanel(Notebook1, ID_PANEL4, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL4")); FlexGridSizer4 = new wxFlexGridSizer(0, 2, 0, 0); FlexGridSizer4->AddGrowableCol(1); CheckBox1 = new wxCheckBox(Panel4, ID_CHECKBOX1, _("Use Ground Plane"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX1")); CheckBox1->SetValue(false); FlexGridSizer4->Add(CheckBox1, 1, wxALL|wxALIGN_LEFT, 5); StaticText2 = new wxStaticText(Panel4, ID_STATICTEXT2, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT2")); FlexGridSizer4->Add(StaticText2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); Panel4->SetSizer(FlexGridSizer4); FlexGridSizer4->Fit(Panel4); FlexGridSizer4->SetSizeHints(Panel4); Panel5 = new wxPanel(Notebook1, ID_PANEL5, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL5")); FlexGridSizer5 = new wxFlexGridSizer(0, 2, 0, 0); CheckBox2 = new wxCheckBox(Panel5, ID_CHECKBOX2, _("Use Laplace"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX2")); CheckBox2->SetValue(false); FlexGridSizer5->Add(CheckBox2, 1, wxALL, 5); ComboBox1 = new wxComboBox(Panel5, ID_COMBOBOX1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("ID_COMBOBOX1")); FlexGridSizer5->Add(ComboBox1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); CheckBox3 = new wxCheckBox(Panel5, ID_CHECKBOX3, _("Refine Laplace Mesh"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX3")); CheckBox3->SetValue(false); CheckBox3->Disable(); FlexGridSizer5->Add(CheckBox3, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); StaticText6 = new wxStaticText(Panel5, ID_STATICTEXT6, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT6")); FlexGridSizer5->Add(StaticText6, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); StaticText7 = new wxStaticText(Panel5, ID_STATICTEXT7, _("Surface Mesh Constant"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT7")); FlexGridSizer5->Add(StaticText7, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); TextCtrl4 = new wxTextCtrl(Panel5, ID_TEXTCTRL4, _("3"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL4")); TextCtrl4->Disable(); FlexGridSizer5->Add(TextCtrl4, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); StaticText8 = new wxStaticText(Panel5, ID_STATICTEXT8, _("Boundary Constant"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT8")); FlexGridSizer5->Add(StaticText8, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); TextCtrl5 = new wxTextCtrl(Panel5, ID_TEXTCTRL5, _("3"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL5")); TextCtrl5->Disable(); FlexGridSizer5->Add(TextCtrl5, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); StaticText13 = new wxStaticText(Panel5, ID_STATICTEXT13, _("Max Mesh Edge Length"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT13")); FlexGridSizer5->Add(StaticText13, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); TextCtrl9 = new wxTextCtrl(Panel5, ID_TEXTCTRL9, _("1e-3"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL9")); TextCtrl9->Disable(); FlexGridSizer5->Add(TextCtrl9, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); StaticText14 = new wxStaticText(Panel5, ID_STATICTEXT14, _("Ground Plane Edge Length"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT14")); FlexGridSizer5->Add(StaticText14, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); TextCtrl10 = new wxTextCtrl(Panel5, ID_TEXTCTRL10, _("1e-3"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL10")); TextCtrl10->Disable(); FlexGridSizer5->Add(TextCtrl10, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); Panel5->SetSizer(FlexGridSizer5); FlexGridSizer5->Fit(Panel5); FlexGridSizer5->SetSizeHints(Panel5); Panel6 = new wxPanel(Notebook1, ID_PANEL6, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL6")); FlexGridSizer2 = new wxFlexGridSizer(0, 1, 0, 0); FlexGridSizer9 = new wxFlexGridSizer(0, 3, 0, 0); StaticText11 = new wxStaticText(Panel6, ID_STATICTEXT11, _("Use Filter Fitting Parameters"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT11")); FlexGridSizer9->Add(StaticText11, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); CheckBox4 = new wxCheckBox(Panel6, ID_CHECKBOX4, _("Yes"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX4")); CheckBox4->SetValue(false); FlexGridSizer9->Add(CheckBox4, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer2->Add(FlexGridSizer9, 1, wxALL|wxEXPAND, 5); FlexGridSizer6 = new wxFlexGridSizer(0, 2, 0, 0); StaticText3 = new wxStaticText(Panel6, ID_STATICTEXT3, _("Order for Filter Fitting "), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT3")); FlexGridSizer6->Add(StaticText3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); TextCtrl2 = new wxTextCtrl(Panel6, ID_TEXTCTRL2, _("-10"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL2")); TextCtrl2->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT)); FlexGridSizer6->Add(TextCtrl2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer2->Add(FlexGridSizer6, 1, wxALL|wxEXPAND, 5); FlexGridSizer7 = new wxFlexGridSizer(0, 3, 0, 0); StaticText4 = new wxStaticText(Panel6, ID_STATICTEXT4, _("Range Type"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT4")); FlexGridSizer7->Add(StaticText4, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); RadioButton1 = new wxRadioButton(Panel6, ID_RADIOBUTTON1, _("Lin"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_RADIOBUTTON1")); FlexGridSizer7->Add(RadioButton1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); RadioButton2 = new wxRadioButton(Panel6, ID_RADIOBUTTON2, _("Log"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_RADIOBUTTON2")); FlexGridSizer7->Add(RadioButton2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer2->Add(FlexGridSizer7, 1, wxALL|wxEXPAND, 5); FlexGridSizer8 = new wxFlexGridSizer(0, 2, 0, 0); StaticText5 = new wxStaticText(Panel6, ID_STATICTEXT5, _("Frequency min (Hz)"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT5")); FlexGridSizer8->Add(StaticText5, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); TextCtrl3 = new wxTextCtrl(Panel6, ID_TEXTCTRL3, _("1e3"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL3")); TextCtrl3->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT)); FlexGridSizer8->Add(TextCtrl3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); StaticText9 = new wxStaticText(Panel6, ID_STATICTEXT9, _("Frequecy max (Hz)"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT9")); FlexGridSizer8->Add(StaticText9, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); TextCtrl6 = new wxTextCtrl(Panel6, ID_TEXTCTRL6, _("1e9"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL6")); TextCtrl6->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT)); FlexGridSizer8->Add(TextCtrl6, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); StaticText10 = new wxStaticText(Panel6, ID_STATICTEXT10, _("Number of Frequencies"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT10")); FlexGridSizer8->Add(StaticText10, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); TextCtrl7 = new wxTextCtrl(Panel6, ID_TEXTCTRL7, _("12"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL7")); TextCtrl7->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT)); FlexGridSizer8->Add(TextCtrl7, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer2->Add(FlexGridSizer8, 1, wxALL|wxEXPAND, 5); Panel6->SetSizer(FlexGridSizer2); FlexGridSizer2->Fit(Panel6); FlexGridSizer2->SetSizeHints(Panel6); Notebook1->AddPage(Panel3, _("Bundle"), false); Notebook1->AddPage(Panel4, _("Ground Plane"), false); Notebook1->AddPage(Panel5, _("Laplace Solver"), false); Notebook1->AddPage(Panel6, _("Filter Fitting"), false); BoxSizer5->Add(Notebook1, 1, wxALL|wxEXPAND, 5); FlexGridSizer3->Add(BoxSizer5, 1, wxALL|wxEXPAND, 5); StaticBoxSizer4->Add(FlexGridSizer3, 8, wxALL|wxEXPAND, 5); BoxSizer1 = new wxBoxSizer(wxHORIZONTAL); Button1 = new wxButton(this, ID_BUTTON1, _("SAVE"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1")); BoxSizer1->Add(Button1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); Button2 = new wxButton(this, ID_BUTTON2, _("BUILD"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2")); BoxSizer1->Add(Button2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); Button3 = new wxButton(this, ID_BUTTON3, _("CLOSE"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON3")); BoxSizer1->Add(Button3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); StaticBoxSizer4->Add(BoxSizer1, 1, wxALL, 5); FlexGridSizer1->Add(StaticBoxSizer4, 1, wxALL|wxEXPAND, 5); StaticBoxSizer1 = new wxStaticBoxSizer(wxVERTICAL, this, _("2D Cross Section")); Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxSize(500,500), wxTAB_TRAVERSAL, _T("ID_PANEL1")); Panel1->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); StaticBoxSizer1->Add(Panel1, 9, wxALL|wxEXPAND, 5); BoxSizer4 = new wxBoxSizer(wxHORIZONTAL); StaticText12 = new wxStaticText(this, ID_STATICTEXT12, _("Cross Section xmax, ymax (m) = "), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT12")); BoxSizer4->Add(StaticText12, 4, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); TextCtrl8 = new wxTextCtrl(this, ID_TEXTCTRL8, _("0.030"), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER, wxDefaultValidator, _T("ID_TEXTCTRL8")); BoxSizer4->Add(TextCtrl8, 4, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); SpinButton1 = new wxSpinButton(this, ID_SPINBUTTON1, wxDefaultPosition, wxDefaultSize, wxSP_VERTICAL|wxSP_ARROW_KEYS, _T("ID_SPINBUTTON1")); SpinButton1->SetValue(50); SpinButton1->SetRange(0, 100); BoxSizer4->Add(SpinButton1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); StaticBoxSizer1->Add(BoxSizer4, 1, wxALL|wxALIGN_RIGHT, 5); FlexGridSizer1->Add(StaticBoxSizer1, 1, wxALL|wxEXPAND, 5); SetSizer(FlexGridSizer1); FlexGridSizer1->Fit(this); FlexGridSizer1->SetSizeHints(this); Connect(ID_CHECKBOX1,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&BUNDLEBLDR::OnCheckBox1Click); Connect(ID_COMBOBOX1,wxEVT_COMMAND_COMBOBOX_SELECTED,(wxObjectEventFunction)&BUNDLEBLDR::OnComboBox1Selected); Connect(ID_CHECKBOX3,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&BUNDLEBLDR::OnCheckBox3Click); Connect(ID_TEXTCTRL4,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&BUNDLEBLDR::OnTextCtrl4Text); Connect(ID_TEXTCTRL5,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&BUNDLEBLDR::OnTextCtrl5Text); Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&BUNDLEBLDR::OnButton1Click); Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&BUNDLEBLDR::OnButton2Click); Connect(ID_BUTTON3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&BUNDLEBLDR::OnButton3Click); Panel1->Connect(wxEVT_PAINT,(wxObjectEventFunction)&BUNDLEBLDR::OnPanel1Paint,0,this); Connect(ID_TEXTCTRL8,wxEVT_COMMAND_TEXT_ENTER,(wxObjectEventFunction)&BUNDLEBLDR::OnTextCtrl8TextEnter); Connect(ID_SPINBUTTON1,wxEVT_SCROLL_THUMBTRACK,(wxObjectEventFunction)&BUNDLEBLDR::OnSpinButton1Change); Connect(ID_SPINBUTTON1,wxEVT_SCROLL_LINEUP,(wxObjectEventFunction)&BUNDLEBLDR::OnSpinButton1ChangeUp); Connect(ID_SPINBUTTON1,wxEVT_SCROLL_LINEDOWN,(wxObjectEventFunction)&BUNDLEBLDR::OnSpinButton1ChangeDown); Connect(wxID_ANY,wxEVT_INIT_DIALOG,(wxObjectEventFunction)&BUNDLEBLDR::OnInit); //*) ListBox1->Connect(wxEVT_RIGHT_DOWN, wxMouseEventHandler(BUNDLEBLDR::OnListboxRDown), NULL, this); // Initialise the head node bundle_root = new Bundle; bundle_root->next = NULL; // Ths is the list bundle_list = bundle_root; // Load and populate file tree //PopulateTheDirectoryTree(PathToMOD); } BUNDLEBLDR::~BUNDLEBLDR() { //(*Destroy(BUNDLEBLDR) //*) } void BUNDLEBLDR::SetPathForDir(wxString Path, wxString Name) { PathToMOD << Path; MODname << Name; PopulateTheDirectoryTree(PathToMOD); } //========================================================================================================= // Build bundle from components selected from MOD //Select cable component for removal void BUNDLEBLDR::OnListboxRDown(wxMouseEvent& event) { int item = ListBox1->HitTest(event.GetPosition()); if ( item != wxNOT_FOUND ) { wxString strMessage; wxString strItem = ListBox1->GetString(item); strMessage = "Are you sure you wish to delete: "; strMessage = strMessage << strItem; // Confirm cable component deletion wxMessageDialog bb_ConfirmDelete (this, strMessage, _("Please confirm delete") ,wxYES_NO|wxCENTRE,wxDefaultPosition ); bb_ConfirmDelete.ShowModal(); removeElement(item); PopulateListControl(); } else wxMessageBox(_T("No Cable SELECTED"),_("Remove Cable Component")); event.Skip(); } //Add cable component to component list void BUNDLEBLDR::PopulateListControl(void) { ListBox1->Clear(); Button1->Enable(); Bundle *Current = bundle_root; while ( Current->next != NULL ) { ListBox1->Append(Current->CableType); Current = Current->next; } } //Delete cable component from component list void BUNDLEBLDR::removeElement(int ItemIndex) { Bundle *Current = bundle_root; Bundle *Previous = Current; // Look through the list for the item int i = 0; while( (Current!= NULL) && (i < ItemIndex) ) { Previous = Current; Current = Current->next; i++; } if ( Current == bundle_root) // Deleting the 1st item in the list { bundle_root = bundle_root->next; } else { Previous->next= Current->next; } delete Current; Button1->Enable(); } // Display MOD void BUNDLEBLDR::PopulateTheDirectoryTree (wxString Path) { int size_h, size_v; Panel2->GetSize(&size_h, &size_v ); tree2 = (wxSpecificDirCtrl *) NULL; tree2 = new wxSpecificDirCtrl (Panel2, -1, Path, wxDefaultPosition, wxSize(300, 140), wxSIMPLE_BORDER, "*.cable_spec", 0, _T("Directory Listing")); Connect(tree2->GetTreeCtrl()->GetId(),wxEVT_COMMAND_TREE_ITEM_ACTIVATED, (wxObjectEventFunction) (wxEventFunction)(wxCommandEventFunction) &BUNDLEBLDR::OnTreeSelectionChanged); //SetButtonState_FolderSelected(); } //========================================================================================================= //Capture component selection from MOD, position and display void BUNDLEBLDR::OnTreeSelectionChanged(wxTreeEvent& evt) { // A few file functions wxFileName fname (tree2->GetFilePath()); wxString File_Path = fname.GetPath(); wxString File_FullName = fname.GetFullName(); PLACE_CABLE *winPLACE_CABLE = new PLACE_CABLE(this); if ( winPLACE_CABLE->ShowModal() == wxID_OK ) { bundle_list->x_offset = winPLACE_CABLE->TextCtrl1->GetValue(); bundle_list->y_offset = winPLACE_CABLE->TextCtrl2->GetValue(); bundle_list->rot_theta = winPLACE_CABLE->TextCtrl3->GetValue(); bundle_list->CableType = File_FullName; // Create a new node additional cables bundle_list->next = new Bundle; // Set the current to the new one bundle_list = bundle_list->next; // Mark the NULL end of bundle component list bundle_list->next = NULL; }; ListBox1->Append(File_FullName); Button1->Enable(); DrawBundleCsection(); } // Initialise Draw Panel void BUNDLEBLDR::OnPanel1Paint(wxPaintEvent& event) { DrawPanel(); } void BUNDLEBLDR::DrawPanel() { double maxDimension; wxString maxXY = TextCtrl8->GetValue(); maxXY.ToDouble(&maxDimension); FormatPanel(maxDimension); } // Set Default Panel void BUNDLEBLDR::FormatPanel(double maxDimension) { int size_h, size_v; Panel1->GetSize(&size_h, &size_v ); wxString scale; scale << maxDimension/2.0; wxClientDC dc(Panel1); dc.Clear(); // Draw centre lines dc.SetPen( wxPen( wxColor(224,224,224),1 , wxDOT_DASH) ); dc.DrawLine( 0, size_v/2, size_h,size_v/2 ); dc.DrawLine( size_h/2, 0, size_h/2, size_v); dc.SetTextForeground(*wxBLACK); dc.DrawText("y=0", 5, (size_v/2)-15); dc.DrawText("x=0", (size_h/2)+5, size_v-20); // Draw ordinates dc.SetPen( wxPen( wxColor(255,0,0),1 ) ); dc.DrawCircle( wxPoint(5,size_v-10), 5 ); dc.DrawLine( 5, size_v-10, 30, size_v-10 ); dc.DrawLine( 5, size_v-10, 5, size_v-35); dc.DrawText("y", 10, size_v-45); dc.DrawText("x", 30, size_v-25); 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); } // Draw Bundle for Selected Components void BUNDLEBLDR::DrawBundleCsection() { bundle_list = bundle_root; wxString x, y, rot, cable; double maxDimension; wxString maxXY = TextCtrl8->GetValue(); maxXY.ToDouble(&maxDimension); FormatPanel(maxDimension); while ( bundle_list->next != NULL ) { cable = bundle_list->CableType; x = bundle_list->x_offset; y = bundle_list->y_offset; rot = bundle_list->rot_theta; DrawBundleCable(cable, x, y, rot); bundle_list = bundle_list->next; } } // Save bundle void BUNDLEBLDR::OnButton1Click(wxCommandEvent& event) { int IsError = 0; wxString fileName = TextCtrl1->GetValue(); TextCtrl1->SetBackgroundColour(wxColor(255,255,255)); if (fileName == "") { wxMessageBox("Please Specify a Cable Name" , _("Missing Cable Name")); return; } WriteBundleFile(fileName); Button1->Disable(); } void BUNDLEBLDR::WriteBundleFile(wxString fileName) { ofstream cableFile; wxString separator(wxFileName::GetPathSeparator()); wxString fullFileName = PathToMOD + separator + "BUNDLE" + separator + fileName + ".bundle_spec"; cableFile.open (fullFileName); if (cableFile.is_open()) { cableFile << "#MOD_cable_lib_dir" << "\n"; cableFile <<".." << separator << MODname << separator << "CABLE" << separator <<"\n"; cableFile << "#MOD_cable_lib_dir" << "\n"; cableFile <<".." << separator << MODname << separator << "BUNDLE" << separator <<"\n"; cableFile << ListBox1->GetCount() << " #Number of cables in bundle, cable list follows\n"; bundle_list = bundle_root; wxString x, y, rot, cable; while ( bundle_list->next != NULL ) { cable = bundle_list->CableType; //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 x = bundle_list->x_offset; y = bundle_list->y_offset; rot = bundle_list->rot_theta; cableFile << cable_name <<"\n"; cableFile << x << "\t" << y << "\t" << rot << "\n"; bundle_list = bundle_list->next; } if (CheckBox1->GetValue()) { cableFile << "ground_plane\n"; } else { cableFile <<"no_ground_plane\n"; } if (CheckBox4->GetValue()) { cableFile << TextCtrl2->GetValue() <<"\t # order for filter fitting\n"; if (RadioButton1) { cableFile << "lin # frequency range type for filter fitting type (lin or dB)"; } else { cableFile << "log # frequency range type for filter fitting type (lin or dB)"; } cableFile << TextCtrl3->GetValue() <<" "<< TextCtrl6->GetValue() <<" "<< TextCtrl7->GetValue() <<"\t # fmin fmax number_of_frequencies for filter fitting"; } if (CheckBox2->GetValue()) { cableFile << "use_laplace\n"; } else { cableFile << "no_laplace\n"; } if (CheckBox3->GetValue()) { cableFile << "Laplace_boundary_constant\n"; cableFile << TextCtrl4->GetValue() <<"\n"; cableFile << "Laplace_surface_mesh_constant\n"; cableFile << TextCtrl5->GetValue() <<"\n"; cableFile << "max_mesh_edge_length\n"; cableFile << TextCtrl9->GetValue() <<"\n"; if (CheckBox1->GetValue()) { cableFile << "gp_edge_length\n"; cableFile << TextCtrl10->GetValue() <<"\n"; } //CheckBox3 ->SetValue(false); } } cableFile.close(); } // Build Bundle Model void BUNDLEBLDR::OnButton2Click(wxCommandEvent& event) { //clean up directory clean_temp_files(); wxString fileName = TextCtrl1->GetValue(); wxString command_line; wxString separator(wxFileName::GetPathSeparator()); WriteBundleFile (TextCtrl1->GetValue()); std::stringstream stream; stream <<"." + separator << "cable_bundle_model_builder" << " " << ".." + separator + MODname + separator + "BUNDLE" + separator << fileName ; command_line << stream.str().c_str(); wxExecute (command_line,wxEXEC_SYNC); // Display Run Status RUN_STATUS *run_status_bundle = new RUN_STATUS(this); run_status_bundle->ShowModal(); DrawBundleCsection(); Button1->Enable(); if (CheckBox2->GetValue()) { wxString pattern(("*.msh.vtk")); wxString file; ComboBox1->Clear(); file = wxFindFirstFile(pattern); while ( !file.empty()) { wxString meshfile = file; size_t extindex = meshfile.find_last_of ("."); meshfile = meshfile.substr(0, extindex); extindex = meshfile.find_last_of ("."); meshfile = meshfile.substr(0, extindex); meshfile = meshfile.substr(2,meshfile.length()); ComboBox1->Append(meshfile); file = wxFindNextFile(); } CheckBox3->Enable(); } } void BUNDLEBLDR::OnButton3Click(wxCommandEvent& event) { //clean up directory clean_temp_files(); Close(); } void BUNDLEBLDR::OnCheckBox1Click(wxCommandEvent& event) { int size_h, size_v; Panel1->GetSize(&size_h, &size_v ); DrawBundleCsection(); TextCtrl10->Enable(); } void BUNDLEBLDR::OnCheckBox3Click(wxCommandEvent& event) { if (CheckBox3->GetValue()) { TextCtrl4->Enable(); TextCtrl5->Enable(); TextCtrl9->Enable(); } //WriteBundleFile (TextCtrl1->GetValue()); } void BUNDLEBLDR::OnComboBox1Selected(wxCommandEvent& event) { wxString meshToView; meshToView<GetValue(); draw_mesh(Panel1,meshToView, scale); MeshSelected = 1; TextCtrl8->Disable(); } void BUNDLEBLDR::OnTextCtrl4Text(wxCommandEvent& event) { TextCtrl4->SetForegroundColour(*wxBLACK); int IsError = 0; check_is_numeric(TextCtrl4, &IsError); } void BUNDLEBLDR::OnInit(wxInitDialogEvent& event) { TextCtrl4->SetForegroundColour(*wxLIGHT_GREY); TextCtrl5->SetForegroundColour(*wxLIGHT_GREY); } void BUNDLEBLDR::OnTextCtrl5Text(wxCommandEvent& event) { TextCtrl5->SetForegroundColour(*wxBLACK); int IsError = 0; check_is_numeric(TextCtrl5, &IsError); } void BUNDLEBLDR::OnSpinButton1Change(wxSpinEvent& event) { } void BUNDLEBLDR::OnTextCtrl8TextEnter(wxCommandEvent& event) { double maxDimension; wxString maxXY = TextCtrl8->GetValue(); maxXY.ToDouble(&maxDimension); if (MeshSelected == 1) { scale = scale + 0.1; wxString meshToView; meshToView<GetValue(); draw_mesh(Panel1,meshToView, scale); } else { DrawBundleCsection(); } } void BUNDLEBLDR::OnSpinButton1ChangeUp(wxSpinEvent& event) { double maxDimension; wxString maxXY = TextCtrl8->GetValue(); maxXY.ToDouble(&maxDimension); maxDimension = maxDimension + 0.001; maxXY = ""; maxXY << maxDimension; TextCtrl8 ->SetValue(maxXY); if (MeshSelected == 1) { scale = scale + 0.05; wxString meshToView; meshToView<GetValue(); draw_mesh(Panel1,meshToView, scale); } else { DrawBundleCsection(); } } void BUNDLEBLDR::OnSpinButton1ChangeDown(wxSpinEvent& event) { double maxDimension; wxString maxXY = TextCtrl8->GetValue(); maxXY.ToDouble(&maxDimension); maxDimension = maxDimension - 0.001; if (maxDimension <=0) maxDimension = 0; maxXY = ""; maxXY << maxDimension; TextCtrl8 ->SetValue(maxXY); 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(); } } //===================================================================================== // Draw routines void BUNDLEBLDR::DrawBundleCable(wxString cable, wxString x, wxString y, wxString rot) { wxString separator(wxFileName::GetPathSeparator()); double xCoord, yCoord, rotation, maxDimension; x.ToDouble(&xCoord); y.ToDouble(&yCoord); rot.ToDouble(&rotation); yCoord = -1.0 * yCoord; int size_h, size_v; Panel1->GetSize(&size_h, &size_v ); wxClientDC dc(Panel1); std::stringstream stream; stream << PathToMOD << separator << "CABLE"<< separator << cable; cable = (stream.str().c_str()); std::ifstream cableFile; cableFile.open (cable); std::string str; std::getline(cableFile, str); std::getline(cableFile, str); std::getline(cableFile, str); float scaleFactor = (size_h/2 * 1.0); wxString maxXY = TextCtrl8->GetValue(); maxXY.ToDouble(&maxDimension); if (str.compare("Cylindrical") == 0 ){ std::getline(cableFile, str); std::getline(cableFile, str); float conductor_radius, dielectric_radius; cableFile >> conductor_radius; std::getline(cableFile, str); //Read to end of line cableFile >> dielectric_radius; float dielectric_Scaledradius,conductor_Scaledradius, scaledxCoord, scaledyCoord; dielectric_Scaledradius = (dielectric_radius/maxDimension)*scaleFactor; conductor_Scaledradius = (conductor_radius/maxDimension)*scaleFactor; scaledxCoord = (xCoord/maxDimension)*scaleFactor; scaledyCoord = (yCoord/maxDimension)*scaleFactor; dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH)); dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2+scaledyCoord), dielectric_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2+scaledyCoord), conductor_Scaledradius ); } if (str.compare("Coax") == 0 ){ std::getline(cableFile, str); std::getline(cableFile, str); float inner_conductor_radius, shield_radius, outer_insulation, shield_thickness; cableFile >> inner_conductor_radius; std::getline(cableFile, str); //Read to end of line cableFile >> shield_radius; std::getline(cableFile, str); //Read to end of line cableFile >> outer_insulation; std::getline(cableFile, str); //Read to end of line std::getline(cableFile, str); //Read to end of line cableFile >> shield_thickness; float inner_conductor_Scaledradius, shield_Scaledradius, outer_Scaledinsulation, shield_Scaledthickness, scaledxCoord, scaledyCoord; outer_Scaledinsulation = (outer_insulation/maxDimension)*scaleFactor; shield_Scaledthickness = (shield_thickness/maxDimension)*scaleFactor; shield_Scaledradius = (shield_radius/maxDimension)*scaleFactor; inner_conductor_Scaledradius = (inner_conductor_radius/maxDimension)*scaleFactor; scaledxCoord = (xCoord/maxDimension)*scaleFactor; scaledyCoord = (yCoord/maxDimension)*scaleFactor; dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH)); dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2+scaledyCoord), outer_Scaledinsulation ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2+scaledyCoord), shield_Scaledthickness+shield_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxLIGHT_GREY, wxSOLID)); dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2+scaledyCoord), shield_Scaledradius ); 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 ); } if (str.compare("Twinax") == 0 ){ std::getline(cableFile, str); std::getline(cableFile, str); float inner_conductor_radius, inner_dielectric_radius, conductor_separation, shield_radius, shield_thickness, outer_dielectric_radius; cableFile >> inner_conductor_radius; std::getline(cableFile, str); //Read to end of line cableFile >> inner_dielectric_radius; std::getline(cableFile, str); //Read to end of line cableFile >> conductor_separation; std::getline(cableFile, str); //Read to end of line cableFile >> shield_radius; std::getline(cableFile, str); //Read to end of line cableFile >> shield_thickness; std::getline(cableFile, str); //Read to end of line cableFile >> outer_dielectric_radius; float outer_dielectric_Scaledradius, shield_Scaledthickness, shield_Scaledradius, inner_dielectric_Scaledradius, inner_conductor_Scaledradius, conductor_Scaledseparation, scaledxCoord, scaledyCoord; outer_dielectric_Scaledradius = (outer_dielectric_radius/maxDimension)*scaleFactor; shield_Scaledthickness = (shield_thickness/maxDimension)*scaleFactor; shield_Scaledradius = (shield_radius/maxDimension)*scaleFactor; inner_dielectric_Scaledradius = (inner_dielectric_radius/maxDimension)*scaleFactor; inner_conductor_Scaledradius = (inner_conductor_radius/maxDimension)*scaleFactor; conductor_Scaledseparation = (conductor_separation/maxDimension)*scaleFactor; scaledxCoord = 2*(xCoord/maxDimension)*scaleFactor; scaledyCoord = 2*(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.DrawCircle( wxPoint(size_h/2,size_v/2), outer_dielectric_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); dc.DrawCircle( wxPoint(size_h/2,size_v/2), shield_Scaledthickness+shield_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxLIGHT_GREY, wxSOLID)); dc.DrawCircle( wxPoint(size_h/2,size_v/2), shield_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxWHITE, wxSOLID)); dc.DrawCircle( wxPoint((size_h/2)+(conductor_Scaledseparation/2),size_v/2), inner_dielectric_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxWHITE, wxSOLID)); dc.DrawCircle( wxPoint((size_h/2)-(conductor_Scaledseparation/2),size_v/2), inner_dielectric_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); dc.DrawCircle( wxPoint((size_h/2)+(conductor_Scaledseparation/2),size_v/2), inner_conductor_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); dc.DrawCircle( wxPoint((size_h/2)-(conductor_Scaledseparation/2),size_v/2), inner_conductor_Scaledradius ); } if (str.compare("Twisted_pair") == 0 ){ std::getline(cableFile, str); std::getline(cableFile, str); float conductor_radius, conductor_separation, dielectric_radius; cableFile >> conductor_radius; std::getline(cableFile, str); //Read to end of line cableFile >> conductor_separation; std::getline(cableFile, str); //Read to end of line cableFile >> dielectric_radius; float conductor_Scaledradius, conductor_Scaledseparation, dielectric_Scaledradius, scaledxCoord, scaledyCoord; conductor_Scaledradius = (conductor_radius/maxDimension)*scaleFactor; conductor_Scaledseparation = (conductor_separation/maxDimension)*scaleFactor; dielectric_Scaledradius = (dielectric_radius/maxDimension)*scaleFactor; scaledxCoord = 2*(xCoord/maxDimension)*scaleFactor; scaledyCoord = 2*(yCoord/maxDimension)*scaleFactor; size_h = size_h + scaledxCoord; size_v = size_v + scaledyCoord; float wire_pos = (conductor_Scaledseparation/2)*0.707; dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); dc.DrawCircle( wxPoint(size_h/2-wire_pos,size_v/2-wire_pos), conductor_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH)); dc.DrawCircle( wxPoint(size_h/2-wire_pos,size_v/2-wire_pos), dielectric_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); dc.DrawCircle( wxPoint(size_h/2+wire_pos,size_v/2+wire_pos), conductor_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH)); dc.DrawCircle( wxPoint(size_h/2+wire_pos,size_v/2+wire_pos), dielectric_Scaledradius ); } if (str.compare("Shielded_twisted_pair") == 0 ){ std::getline(cableFile, str); std::getline(cableFile, str); float inner_conductor_radius, inner_conductor_separation, inner_dielectric_radius, shield_radius, shield_thickness, outer_dielectric_radius; cableFile >> inner_conductor_radius; std::getline(cableFile, str); //Read to end of line cableFile >> inner_dielectric_radius; std::getline(cableFile, str); //Read to end of line cableFile >> inner_conductor_separation; std::getline(cableFile, str); //Read to end of line cableFile >> shield_radius; std::getline(cableFile, str); //Read to end of line cableFile >> shield_thickness; std::getline(cableFile, str); //Read to end of line cableFile >> outer_dielectric_radius; float inner_conductor_Scaledradius, inner_conductor_Scaledseparation, inner_dielectric_Scaledradius, shield_Scaledradius, shield_Scaledthickness, outer_dielectric_Scaledradius, scaledxCoord, scaledyCoord; inner_conductor_Scaledradius = (inner_conductor_radius/maxDimension)*scaleFactor; inner_conductor_Scaledseparation = (inner_conductor_separation/maxDimension)*scaleFactor; inner_dielectric_Scaledradius = (inner_dielectric_radius/maxDimension)*scaleFactor; shield_Scaledradius = (shield_radius/maxDimension)*scaleFactor; shield_Scaledthickness = (shield_thickness/maxDimension)*scaleFactor; outer_dielectric_Scaledradius = (outer_dielectric_radius/maxDimension)*scaleFactor; scaledxCoord = (xCoord/maxDimension)*scaleFactor; scaledyCoord = (yCoord/maxDimension)*scaleFactor; size_h = size_h + scaledxCoord; size_v = size_v + scaledyCoord; float wire_pos = (inner_conductor_Scaledseparation/2)*0.707; dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH)); dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_dielectric_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); dc.DrawCircle( wxPoint(size_h/2,size_v/2), shield_Scaledthickness+shield_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxWHITE, wxSOLID)); dc.DrawCircle( wxPoint(size_h/2,size_v/2), shield_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH)); dc.DrawCircle( wxPoint(size_h/2-wire_pos,size_v/2-wire_pos), inner_dielectric_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); dc.DrawCircle( wxPoint(size_h/2-wire_pos,size_v/2-wire_pos), inner_conductor_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH)); dc.DrawCircle( wxPoint(size_h/2+wire_pos,size_v/2+wire_pos), inner_dielectric_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); dc.DrawCircle( wxPoint(size_h/2+wire_pos,size_v/2+wire_pos), inner_conductor_Scaledradius ); } if (str.compare("Spacewire") == 0 ){ std::getline(cableFile, str); std::getline(cableFile, str); float inner_conductor_radius, inner_conductor_separation, inner_dielectric_radius, inner_shield_radius, inner_shield_thickness, inner_shield_jacket_radius, shielded_twisted_pair_radius, outer_shield_radius, outer_shield_thickness, outer_dielectric_radius; cableFile >> inner_conductor_radius; std::getline(cableFile, str); //Read to end of line cableFile >> inner_dielectric_radius; std::getline(cableFile, str); //Read to end of line cableFile >> inner_conductor_separation; std::getline(cableFile, str); //Read to end of line cableFile >> inner_shield_radius; std::getline(cableFile, str); //Read to end of line cableFile >> inner_shield_thickness; std::getline(cableFile, str); //Read to end of line cableFile >> inner_shield_jacket_radius; std::getline(cableFile, str); //Read to end of line cableFile >> shielded_twisted_pair_radius; std::getline(cableFile, str); //Read to end of line cableFile >> outer_shield_radius; std::getline(cableFile, str); //Read to end of line cableFile >> outer_shield_thickness; std::getline(cableFile, str); //Read to end of line cableFile >> outer_dielectric_radius; float inner_conductor_Scaledradius, inner_dielectric_Scaledradius, inner_conductor_Scaledseparation, inner_shield_Scaledradius, inner_shield_Scaledthickness, inner_shield_jacket_Scaledradius, shielded_twisted_pair_Scaledradius, outer_shield_Scaledradius, outer_shield_Scaledthickness, outer_dielectric_Scaledradius, scaledxCoord, scaledyCoord; inner_conductor_Scaledradius = (inner_conductor_radius/maxDimension)*scaleFactor; inner_dielectric_Scaledradius = (inner_dielectric_radius/maxDimension)*scaleFactor; inner_conductor_Scaledseparation = (inner_conductor_separation/maxDimension)*scaleFactor; inner_shield_Scaledradius = (inner_shield_radius/maxDimension)*scaleFactor; inner_shield_Scaledthickness = (inner_shield_thickness/maxDimension)*scaleFactor; inner_shield_jacket_Scaledradius = (inner_shield_jacket_radius/maxDimension)*scaleFactor; shielded_twisted_pair_Scaledradius = (shielded_twisted_pair_radius/maxDimension)*scaleFactor; outer_shield_Scaledradius = (outer_shield_radius/maxDimension)*scaleFactor; outer_shield_Scaledthickness = (outer_shield_thickness/maxDimension)*scaleFactor; outer_dielectric_Scaledradius = (outer_dielectric_radius/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.DrawCircle( wxPoint(size_h/2,size_v/2), outer_dielectric_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_shield_Scaledthickness+outer_shield_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxWHITE, wxSOLID)); dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_shield_Scaledradius ); //TP Top dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH)); dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_Scaledradius)), inner_shield_jacket_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_Scaledradius)), inner_shield_Scaledthickness + inner_shield_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxWHITE, wxSOLID)); dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_Scaledradius)), inner_shield_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH)); dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2)), inner_dielectric_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH)); dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2)), inner_dielectric_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2)), inner_conductor_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2)), inner_conductor_Scaledradius ); //TP Left dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH)); dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius),size_v/2), inner_shield_jacket_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius),size_v/2), inner_shield_Scaledthickness + inner_shield_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxWHITE, wxSOLID)); dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius),size_v/2), inner_shield_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH)); dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2),size_v/2), inner_dielectric_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH)); dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2),size_v/2), inner_dielectric_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2),size_v/2), inner_conductor_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2),size_v/2), inner_conductor_Scaledradius ); //TP Bottom dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH)); dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_Scaledradius)), inner_shield_jacket_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_Scaledradius)), inner_shield_Scaledthickness + inner_shield_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxWHITE, wxSOLID)); dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_Scaledradius)), inner_shield_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH)); dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2)), inner_dielectric_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH)); dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2)), inner_dielectric_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2)), inner_conductor_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2)), inner_conductor_Scaledradius ); //TP Right dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH)); dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius),size_v/2), inner_shield_jacket_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius),size_v/2), inner_shield_Scaledthickness + inner_shield_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxWHITE, wxSOLID)); dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius),size_v/2), inner_shield_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH)); dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2),size_v/2), inner_dielectric_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH)); dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2),size_v/2), inner_dielectric_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2),size_v/2), inner_conductor_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2),size_v/2), inner_conductor_Scaledradius ); } if (str.compare("Overshield") == 0 ){ std::getline(cableFile, str); std::getline(cableFile, str); float overshield_radius, overshield_thickness; cableFile >> overshield_radius; std::getline(cableFile, str); //Read to end of line cableFile >> overshield_thickness; float overshield_Scaledradius, overshield_Scaledthickness, scaledxCoord, scaledyCoord; overshield_Scaledradius = (overshield_radius/maxDimension)*scaleFactor; overshield_Scaledthickness = (overshield_thickness/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, wxSOLID)); dc.DrawCircle( wxPoint(size_h/2,size_v/2), overshield_Scaledthickness+overshield_Scaledradius ); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxWHITE, wxSOLID)); dc.DrawCircle( wxPoint(size_h/2,size_v/2), overshield_Scaledradius ); } if (str.compare("flex_cable") == 0 ){ float dielectric_width, dielectric_height, conductor_rows; std::getline(cableFile, str); //Read to end of line std::getline(cableFile, str); //Read to end of line cableFile >> dielectric_width; std::getline(cableFile, str); //Read to end of line cableFile >> dielectric_height; std::getline(cableFile, str); //Read to end of line cableFile >> conductor_rows; std::getline(cableFile, str); //Read to end of line float scaled_dielectric_width, scaled_dielectric_height, scaledxCoord, scaledyCoord; float dx1,dy1,dx2,dy2,dx3,dy3,dx4,dy4, tempx, tempy, rotation_rad; scaled_dielectric_width = (dielectric_width/maxDimension) * scaleFactor; scaled_dielectric_height = (dielectric_height/maxDimension) * scaleFactor; scaledxCoord = xCoord/maxDimension * scaleFactor; scaledyCoord = yCoord/maxDimension * scaleFactor; rotation_rad = rotation * (PI/180.0); float s = sin(rotation_rad); float c = cos(rotation_rad); dx1 = -scaled_dielectric_width/2; dy1 = scaled_dielectric_height/2; tempx = dx1*c - dy1*s; tempy = dx1*s + dy1*c; dx1 = size_h/2 + tempx + scaledxCoord; dy1 = size_v/2 + tempy + scaledyCoord ; //point 3 dx2 = -scaled_dielectric_width/2; dy2 = -scaled_dielectric_height/2; tempx = dx2*c - dy2*s; tempy = dx2*s + dy2*c; dx2 = size_h/2 + tempx + scaledxCoord; dy2 = size_v/2 + tempy + scaledyCoord; //point 3 dx3 = scaled_dielectric_width/2; dy3 = -scaled_dielectric_height/2; tempx = dx3*c - dy3*s; tempy = dx3*s + dy3*c; dx3 = size_h/2 + tempx + scaledxCoord; dy3 = size_v/2 + tempy + scaledyCoord; //point 4 dx4 = scaled_dielectric_width/2; dy4 = scaled_dielectric_height/2; tempx = dx4*c - dy4*s; tempy = dx4*s + dy4*c; dx4 = size_h/2 + tempx + scaledxCoord; dy4 = size_v/2 + tempy + scaledyCoord; dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH)); dc.DrawLine(dx1, dy1, dx2, dy2); dc.DrawLine(dx2, dy2, dx3, dy3); dc.DrawLine(dx3, dy3, dx4, dy4); dc.DrawLine(dx4, dy4, dx1, dy1); float offset_x, offset_y, width, height,separation, conductors; for (int i = 0; i < conductor_rows;i++){ cableFile >> offset_x; std::getline(cableFile, str); //Read to end of line cableFile >> offset_y; std::getline(cableFile, str); //Read to end of line cableFile >> width; std::getline(cableFile, str); //Read to end of line cableFile >> height; std::getline(cableFile, str); //Read to end of line cableFile >> separation; std::getline(cableFile, str); //Read to end of line cableFile >> conductors; std::getline(cableFile, str); //Read to end of line float scaled_conductor_width = width/maxDimension * scaleFactor; float scaled_conductor_height = height/maxDimension * scaleFactor; float scaled_conductor_separation = separation/maxDimension * scaleFactor; float scaled_offset_x = offset_x/maxDimension * scaleFactor; float scaled_offset_y = offset_y/maxDimension * scaleFactor; //calculate conductor origin, top left corner: start at no.1 float x_origin = 0 - (scaled_conductor_width * conductors/2) - scaled_conductor_separation*(conductors - 1)/2 + scaled_offset_x; float y_origin = scaled_conductor_height/2 + scaled_offset_y; float cx1,cy1,cx2,cy2,cx3,cy3,cx4,cy4; dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxWHITE, wxSOLID)); for (int j = 0; j> conductors; std::getline(cableFile, str); //Read to end of line std::getline(cableFile, str); //Read to end of line cableFile >> conductor_radius; std::getline(cableFile, str); //Read to end of line cableFile >> conductor_pitch; std::getline(cableFile, str); //Read to end of line cableFile >> conductor_separation; std::getline(cableFile, str); //Read to end of line cableFile >> shell_offset; // float totalWidth = (conductors/2 * conductor_separation) + (2 * shell_offset) + (2 * conductor_radius); float conductor_Scaledradius, conductor_Scaledpitch, conductor_Scaledseparation, scaledxCoord, scaledyCoord; float x_origin, y_origin; scaleFactor = (size_h * 0.25); conductor_Scaledradius = (conductor_radius/maxDimension)*scaleFactor; conductor_Scaledpitch = (conductor_pitch/maxDimension)*scaleFactor; conductor_Scaledseparation = (conductor_separation/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, wxSOLID)); // Upper conductors & Shell int upper_conductors = conductors / 2; x_origin = (size_h/2) - (upper_conductors/2 * conductor_Scaledseparation); y_origin = (size_v/2) - (conductor_Scaledpitch); dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); dc.SetBrush(wxBrush(*wxBLACK)); for(int i=0;iGetValue()) { 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::OnPanel2Paint(wxPaintEvent& event) { } void BUNDLEBLDR::OnCheckListBox1Toggled(wxCommandEvent& event) { }