Blame view

GUI/SW1/SRC/BUNDLEBLDR.cpp 64.8 KB
886c558b   Steve Greedy   SACAMOS Public Re...
1
2
3
4
5
6
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
7ba34678   Steve Greedy   Update Copyright ...
7
// Copyright (C) 2015 - 2018 University of Nottingham
886c558b   Steve Greedy   SACAMOS Public Re...
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//
// 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 <http://www.gnu.org/licenses/>.
//
// 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:
// <https://www.wxwidgets.org/about/licence/>
//
// 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 <wx/msgdlg.h>
#include <wx/filename.h>
#include <wx/dcclient.h>
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>

dd86ff43   Steve Greedy   Updates to SW1
55
56
#define PI 3.14159265358979323846

886c558b   Steve Greedy   SACAMOS Public Re...
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
using namespace std;

//(*InternalHeaders(BUNDLEBLDR)
#include <wx/settings.h>
#include <wx/intl.h>
#include <wx/string.h>
//*)

//(*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();
dd86ff43   Steve Greedy   Updates to SW1
82
83
84
85
const long BUNDLEBLDR::ID_STATICTEXT13 = wxNewId();
const long BUNDLEBLDR::ID_TEXTCTRL9 = wxNewId();
const long BUNDLEBLDR::ID_STATICTEXT14 = wxNewId();
const long BUNDLEBLDR::ID_TEXTCTRL10 = wxNewId();
886c558b   Steve Greedy   SACAMOS Public Re...
86
const long BUNDLEBLDR::ID_PANEL5 = wxNewId();
d475f4d6   Steve Greedy   SW1 Update to v1.0.1
87
88
89
90
91
92
93
94
95
96
97
98
99
100
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();
886c558b   Steve Greedy   SACAMOS Public Re...
101
102
103
104
105
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();
55800c8b   Steve Greedy   Update to SW1
106
107
108
const long BUNDLEBLDR::ID_STATICTEXT12 = wxNewId();
const long BUNDLEBLDR::ID_TEXTCTRL8 = wxNewId();
const long BUNDLEBLDR::ID_SPINBUTTON1 = wxNewId();
886c558b   Steve Greedy   SACAMOS Public Re...
109
110
111
112
113
114
115
116
117
118
//*)

BEGIN_EVENT_TABLE(BUNDLEBLDR,wxDialog)
	//(*EventTable(BUNDLEBLDR)
	//*)
END_EVENT_TABLE()

BUNDLEBLDR::BUNDLEBLDR(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{
	//(*Initialize(BUNDLEBLDR)
55800c8b   Steve Greedy   Update to SW1
119
	wxBoxSizer* BoxSizer4;
886c558b   Steve Greedy   SACAMOS Public Re...
120
121
122
123
	wxStaticBoxSizer* StaticBoxSizer2;
	wxBoxSizer* BoxSizer6;
	wxFlexGridSizer* FlexGridSizer4;
	wxBoxSizer* BoxSizer5;
529d6552   Steve Greedy   SW1_GUI Bug fixes
124
	wxBoxSizer* BoxSizer7;
886c558b   Steve Greedy   SACAMOS Public Re...
125
126
127
	wxStaticBoxSizer* StaticBoxSizer4;
	wxFlexGridSizer* FlexGridSizer3;
	wxFlexGridSizer* FlexGridSizer5;
d475f4d6   Steve Greedy   SW1 Update to v1.0.1
128
129
	wxFlexGridSizer* FlexGridSizer9;
	wxFlexGridSizer* FlexGridSizer2;
886c558b   Steve Greedy   SACAMOS Public Re...
130
	wxBoxSizer* BoxSizer2;
d475f4d6   Steve Greedy   SW1 Update to v1.0.1
131
	wxFlexGridSizer* FlexGridSizer7;
886c558b   Steve Greedy   SACAMOS Public Re...
132
	wxStaticBoxSizer* StaticBoxSizer3;
d475f4d6   Steve Greedy   SW1 Update to v1.0.1
133
	wxFlexGridSizer* FlexGridSizer8;
886c558b   Steve Greedy   SACAMOS Public Re...
134
	wxBoxSizer* BoxSizer1;
d475f4d6   Steve Greedy   SW1 Update to v1.0.1
135
	wxFlexGridSizer* FlexGridSizer6;
886c558b   Steve Greedy   SACAMOS Public Re...
136
137
138
139
	wxStaticBoxSizer* StaticBoxSizer1;
	wxFlexGridSizer* FlexGridSizer1;
	wxBoxSizer* BoxSizer3;

529d6552   Steve Greedy   SW1_GUI Bug fixes
140
	Create(parent, wxID_ANY, _("SACAMOS: CABLE BUNDLE BUILDER"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY"));
886c558b   Steve Greedy   SACAMOS Public Re...
141
	FlexGridSizer1 = new wxFlexGridSizer(1, 2, 0, 0);
529d6552   Steve Greedy   SW1_GUI Bug fixes
142
	FlexGridSizer1->AddGrowableCol(0);
886c558b   Steve Greedy   SACAMOS Public Re...
143
144
145
146
	FlexGridSizer1->AddGrowableCol(1);
	FlexGridSizer1->AddGrowableRow(0);
	StaticBoxSizer4 = new wxStaticBoxSizer(wxVERTICAL, this, _("Bundle Specification"));
	FlexGridSizer3 = new wxFlexGridSizer(0, 1, 0, 0);
529d6552   Steve Greedy   SW1_GUI Bug fixes
147
	FlexGridSizer3->AddGrowableRow(1);
886c558b   Steve Greedy   SACAMOS Public Re...
148
149
150
151
152
153
154
155
156
157
158
	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"));
529d6552   Steve Greedy   SW1_GUI Bug fixes
159
160
161
162
	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);
886c558b   Steve Greedy   SACAMOS Public Re...
163
164
165
166
167
168
169
170
171
172
173
174
175
	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);
a399f76b   Steve Greedy   SW Updates
176
	CheckBox1 = new wxCheckBox(Panel4, ID_CHECKBOX1, _("Use Ground Plane"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX1"));
886c558b   Steve Greedy   SACAMOS Public Re...
177
178
179
180
181
182
183
184
185
	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);
a399f76b   Steve Greedy   SW Updates
186
	CheckBox2 = new wxCheckBox(Panel5, ID_CHECKBOX2, _("Use Laplace"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX2"));
886c558b   Steve Greedy   SACAMOS Public Re...
187
188
189
190
191
192
193
194
195
196
197
198
199
	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"));
dd86ff43   Steve Greedy   Updates to SW1
200
	TextCtrl4->Disable();
886c558b   Steve Greedy   SACAMOS Public Re...
201
202
203
204
	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"));
dd86ff43   Steve Greedy   Updates to SW1
205
	TextCtrl5->Disable();
886c558b   Steve Greedy   SACAMOS Public Re...
206
	FlexGridSizer5->Add(TextCtrl5, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
dd86ff43   Steve Greedy   Updates to SW1
207
208
209
210
211
212
213
214
215
216
	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);
886c558b   Steve Greedy   SACAMOS Public Re...
217
218
219
	Panel5->SetSizer(FlexGridSizer5);
	FlexGridSizer5->Fit(Panel5);
	FlexGridSizer5->SetSizeHints(Panel5);
d475f4d6   Steve Greedy   SW1 Update to v1.0.1
220
221
222
223
224
	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);
189467e4   Steve Greedy   First Public Release
225
	CheckBox4 = new wxCheckBox(Panel6, ID_CHECKBOX4, _("Yes"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX4"));
d475f4d6   Steve Greedy   SW1 Update to v1.0.1
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
	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);
886c558b   Steve Greedy   SACAMOS Public Re...
264
265
266
	Notebook1->AddPage(Panel3, _("Bundle"), false);
	Notebook1->AddPage(Panel4, _("Ground Plane"), false);
	Notebook1->AddPage(Panel5, _("Laplace Solver"), false);
d475f4d6   Steve Greedy   SW1 Update to v1.0.1
267
	Notebook1->AddPage(Panel6, _("Filter Fitting"), false);
886c558b   Steve Greedy   SACAMOS Public Re...
268
269
270
271
272
273
274
275
276
277
278
	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);
529d6552   Steve Greedy   SW1_GUI Bug fixes
279
	FlexGridSizer1->Add(StaticBoxSizer4, 1, wxALL|wxEXPAND, 5);
55800c8b   Steve Greedy   Update to SW1
280
	StaticBoxSizer1 = new wxStaticBoxSizer(wxVERTICAL, this, _("2D Cross Section"));
886c558b   Steve Greedy   SACAMOS Public Re...
281
282
	Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxSize(500,500), wxTAB_TRAVERSAL, _T("ID_PANEL1"));
	Panel1->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
55800c8b   Steve Greedy   Update to SW1
283
284
285
286
287
288
289
	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"));
a399f76b   Steve Greedy   SW Updates
290
	SpinButton1->SetValue(50);
55800c8b   Steve Greedy   Update to SW1
291
292
	SpinButton1->SetRange(0, 100);
	BoxSizer4->Add(SpinButton1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
529d6552   Steve Greedy   SW1_GUI Bug fixes
293
294
	StaticBoxSizer1->Add(BoxSizer4, 1, wxALL|wxALIGN_RIGHT, 5);
	FlexGridSizer1->Add(StaticBoxSizer1, 1, wxALL|wxEXPAND, 5);
886c558b   Steve Greedy   SACAMOS Public Re...
295
296
297
298
	SetSizer(FlexGridSizer1);
	FlexGridSizer1->Fit(this);
	FlexGridSizer1->SetSizeHints(this);

886c558b   Steve Greedy   SACAMOS Public Re...
299
	Connect(ID_CHECKBOX1,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&BUNDLEBLDR::OnCheckBox1Click);
886c558b   Steve Greedy   SACAMOS Public Re...
300
301
302
303
304
305
306
307
	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);
55800c8b   Steve Greedy   Update to SW1
308
309
310
311
	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);
886c558b   Steve Greedy   SACAMOS Public Re...
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
	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);
}

47cbb42e   Steve Greedy   Update SW1
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348

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
886c558b   Steve Greedy   SACAMOS Public Re...
349
350
351
352
353
354
355
356
357
void BUNDLEBLDR::OnListboxRDown(wxMouseEvent& event)
{
    int item = ListBox1->HitTest(event.GetPosition());

    if ( item != wxNOT_FOUND )
    {
        wxString strMessage;
        wxString strItem = ListBox1->GetString(item);

47cbb42e   Steve Greedy   Update SW1
358
        strMessage = "Are you sure you wish to delete: ";
886c558b   Steve Greedy   SACAMOS Public Re...
359
        strMessage = strMessage << strItem;
47cbb42e   Steve Greedy   Update SW1
360
361

        // Confirm cable component deletion
886c558b   Steve Greedy   SACAMOS Public Re...
362
363
364
365
        wxMessageDialog bb_ConfirmDelete (this, strMessage, _("Please confirm delete") ,wxYES_NO|wxCENTRE,wxDefaultPosition );

        bb_ConfirmDelete.ShowModal();

a399f76b   Steve Greedy   SW Updates
366
367
        removeElement(item);
        PopulateListControl();
886c558b   Steve Greedy   SACAMOS Public Re...
368
369
    }
    else
a399f76b   Steve Greedy   SW Updates
370

2e55c776   Steve Greedy   SW1_GUI Updates
371
        wxMessageBox(_T("No Cable SELECTED"),_("Remove Cable Component"));
886c558b   Steve Greedy   SACAMOS Public Re...
372
373
374
375

    event.Skip();
}

47cbb42e   Steve Greedy   Update SW1
376
377

//Add cable component to component list
886c558b   Steve Greedy   SACAMOS Public Re...
378
379
380
381
void BUNDLEBLDR::PopulateListControl(void)
{
    ListBox1->Clear();

47cbb42e   Steve Greedy   Update SW1
382
    Button1->Enable();
2e55c776   Steve Greedy   SW1_GUI Updates
383

886c558b   Steve Greedy   SACAMOS Public Re...
384
385
386
387
388
389
390
    Bundle *Current = bundle_root;

    while ( Current->next != NULL )
    {
        ListBox1->Append(Current->CableType);
        Current = Current->next;
    }
886c558b   Steve Greedy   SACAMOS Public Re...
391
392
}

47cbb42e   Steve Greedy   Update SW1
393
394

//Delete cable component from component list
886c558b   Steve Greedy   SACAMOS Public Re...
395
396
397
398
399
void BUNDLEBLDR::removeElement(int ItemIndex)
{

    Bundle *Current = bundle_root;
    Bundle *Previous = Current;
886c558b   Steve Greedy   SACAMOS Public Re...
400

a399f76b   Steve Greedy   SW Updates
401
    // Look through the list for the item
886c558b   Steve Greedy   SACAMOS Public Re...
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
    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;

2e55c776   Steve Greedy   SW1_GUI Updates
421
422
    Button1->Enable();

886c558b   Steve Greedy   SACAMOS Public Re...
423
424
425
}


47cbb42e   Steve Greedy   Update SW1
426
// Display MOD
886c558b   Steve Greedy   SACAMOS Public Re...
427
428
void BUNDLEBLDR::PopulateTheDirectoryTree (wxString Path)
{
2f8cca9d   Steve Greedy   Fix MOD display i...
429
    int size_h, size_v;
886c558b   Steve Greedy   SACAMOS Public Re...
430

886c558b   Steve Greedy   SACAMOS Public Re...
431
    Panel2->GetSize(&size_h, &size_v );
886c558b   Steve Greedy   SACAMOS Public Re...
432

529d6552   Steve Greedy   SW1_GUI Bug fixes
433
434
435
    tree2 = (wxSpecificDirCtrl *) NULL;

    tree2 =  new wxSpecificDirCtrl (Panel2, -1, Path,
2f8cca9d   Steve Greedy   Fix MOD display i...
436
            wxDefaultPosition,
529d6552   Steve Greedy   SW1_GUI Bug fixes
437
            wxSize(300, 140),
2f8cca9d   Steve Greedy   Fix MOD display i...
438
439
440
            wxSIMPLE_BORDER,
            "*.cable_spec", 0,
            _T("Directory Listing"));
886c558b   Steve Greedy   SACAMOS Public Re...
441

529d6552   Steve Greedy   SW1_GUI Bug fixes
442
443

    Connect(tree2->GetTreeCtrl()->GetId(),wxEVT_COMMAND_TREE_ITEM_ACTIVATED, (wxObjectEventFunction) (wxEventFunction)(wxCommandEventFunction) &BUNDLEBLDR::OnTreeSelectionChanged);
886c558b   Steve Greedy   SACAMOS Public Re...
444
445
446

    //SetButtonState_FolderSelected();
}
47cbb42e   Steve Greedy   Update SW1
447
//=========================================================================================================
886c558b   Steve Greedy   SACAMOS Public Re...
448
449


47cbb42e   Steve Greedy   Update SW1
450
//Capture component selection from MOD, position and display
886c558b   Steve Greedy   SACAMOS Public Re...
451
452
453
void BUNDLEBLDR::OnTreeSelectionChanged(wxTreeEvent& evt)
{
    // A few file functions
529d6552   Steve Greedy   SW1_GUI Bug fixes
454
    wxFileName fname (tree2->GetFilePath());
886c558b   Steve Greedy   SACAMOS Public Re...
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
    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;

    };

886c558b   Steve Greedy   SACAMOS Public Re...
479
480
    ListBox1->Append(File_FullName);

2e55c776   Steve Greedy   SW1_GUI Updates
481
482
    Button1->Enable();

886c558b   Steve Greedy   SACAMOS Public Re...
483
484
485
486
    DrawBundleCsection();

}

47cbb42e   Steve Greedy   Update SW1
487
// Initialise Draw Panel
886c558b   Steve Greedy   SACAMOS Public Re...
488
489
void BUNDLEBLDR::OnPanel1Paint(wxPaintEvent& event)
{
2e55c776   Steve Greedy   SW1_GUI Updates
490
    DrawPanel();
2e55c776   Steve Greedy   SW1_GUI Updates
491
492
493
494
}

void BUNDLEBLDR::DrawPanel()
{
55800c8b   Steve Greedy   Update to SW1
495
496
497
498
499
500
501
    double maxDimension;

    wxString maxXY = TextCtrl8->GetValue();

    maxXY.ToDouble(&maxDimension);

    FormatPanel(maxDimension);
886c558b   Steve Greedy   SACAMOS Public Re...
502
503
}

47cbb42e   Steve Greedy   Update SW1
504
// Set Default Panel
55800c8b   Steve Greedy   Update to SW1
505
506
void BUNDLEBLDR::FormatPanel(double maxDimension)

886c558b   Steve Greedy   SACAMOS Public Re...
507
508
509
510
{
    int size_h, size_v;
    Panel1->GetSize(&size_h, &size_v );

55800c8b   Steve Greedy   Update to SW1
511
512
513
    wxString scale;
    scale << maxDimension/2.0;

886c558b   Steve Greedy   SACAMOS Public Re...
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
    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);
55800c8b   Steve Greedy   Update to SW1
534
535
536
537
538
539
540
541
542

    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);
00c8775f   Steve Greedy   Update SW1
543
544


886c558b   Steve Greedy   SACAMOS Public Re...
545
546
}

47cbb42e   Steve Greedy   Update SW1
547
548
// Draw Bundle for Selected Components
void BUNDLEBLDR::DrawBundleCsection()
886c558b   Steve Greedy   SACAMOS Public Re...
549
{
47cbb42e   Steve Greedy   Update SW1
550
    bundle_list = bundle_root;
886c558b   Steve Greedy   SACAMOS Public Re...
551

47cbb42e   Steve Greedy   Update SW1
552
    wxString x, y, rot, cable;
886c558b   Steve Greedy   SACAMOS Public Re...
553

47cbb42e   Steve Greedy   Update SW1
554
    double maxDimension;
886c558b   Steve Greedy   SACAMOS Public Re...
555

47cbb42e   Steve Greedy   Update SW1
556
    wxString maxXY = TextCtrl8->GetValue();
886c558b   Steve Greedy   SACAMOS Public Re...
557

47cbb42e   Steve Greedy   Update SW1
558
    maxXY.ToDouble(&maxDimension);
886c558b   Steve Greedy   SACAMOS Public Re...
559

47cbb42e   Steve Greedy   Update SW1
560
    FormatPanel(maxDimension);
886c558b   Steve Greedy   SACAMOS Public Re...
561

886c558b   Steve Greedy   SACAMOS Public Re...
562

47cbb42e   Steve Greedy   Update SW1
563
564
565
566
567
568
    while ( bundle_list->next != NULL )
    {
        cable = bundle_list->CableType;
        x = bundle_list->x_offset;
        y = bundle_list->y_offset;
        rot = bundle_list->rot_theta;
886c558b   Steve Greedy   SACAMOS Public Re...
569

47cbb42e   Steve Greedy   Update SW1
570
        DrawBundleCable(cable, x, y, rot);
886c558b   Steve Greedy   SACAMOS Public Re...
571

47cbb42e   Steve Greedy   Update SW1
572
573
574
        bundle_list = bundle_list->next;
    }
}
886c558b   Steve Greedy   SACAMOS Public Re...
575

886c558b   Steve Greedy   SACAMOS Public Re...
576

886c558b   Steve Greedy   SACAMOS Public Re...
577

47cbb42e   Steve Greedy   Update SW1
578
579
580
581
// Save bundle
void BUNDLEBLDR::OnButton1Click(wxCommandEvent& event)
{
    int IsError = 0;
886c558b   Steve Greedy   SACAMOS Public Re...
582

47cbb42e   Steve Greedy   Update SW1
583
    wxString fileName = TextCtrl1->GetValue();
886c558b   Steve Greedy   SACAMOS Public Re...
584

47cbb42e   Steve Greedy   Update SW1
585
    TextCtrl1->SetBackgroundColour(wxColor(255,255,255));
886c558b   Steve Greedy   SACAMOS Public Re...
586

47cbb42e   Steve Greedy   Update SW1
587
588
589
590
591
    if (fileName == "")
    {
        wxMessageBox("Please Specify a Cable Name" , _("Missing Cable Name"));
        return;
    }
886c558b   Steve Greedy   SACAMOS Public Re...
592

47cbb42e   Steve Greedy   Update SW1
593
    WriteBundleFile(fileName);
886c558b   Steve Greedy   SACAMOS Public Re...
594

47cbb42e   Steve Greedy   Update SW1
595
596
    Button1->Disable();
}
886c558b   Steve Greedy   SACAMOS Public Re...
597

47cbb42e   Steve Greedy   Update SW1
598
599
600
601
void BUNDLEBLDR::WriteBundleFile(wxString fileName)
{
    ofstream cableFile;
    wxString separator(wxFileName::GetPathSeparator());
886c558b   Steve Greedy   SACAMOS Public Re...
602

47cbb42e   Steve Greedy   Update SW1
603
    wxString fullFileName = PathToMOD + separator + "BUNDLE" + separator + fileName + ".bundle_spec";
886c558b   Steve Greedy   SACAMOS Public Re...
604

47cbb42e   Steve Greedy   Update SW1
605
    cableFile.open (fullFileName);
886c558b   Steve Greedy   SACAMOS Public Re...
606

47cbb42e   Steve Greedy   Update SW1
607
608
609
    if (cableFile.is_open())
    {
        cableFile << "#MOD_cable_lib_dir" << "\n";
886c558b   Steve Greedy   SACAMOS Public Re...
610

47cbb42e   Steve Greedy   Update SW1
611
        cableFile <<".." << separator << MODname << separator << "CABLE" << separator <<"\n";
886c558b   Steve Greedy   SACAMOS Public Re...
612

47cbb42e   Steve Greedy   Update SW1
613
        cableFile << "#MOD_cable_lib_dir" << "\n";
886c558b   Steve Greedy   SACAMOS Public Re...
614

47cbb42e   Steve Greedy   Update SW1
615
        cableFile <<".." << separator << MODname << separator << "BUNDLE" << separator <<"\n";
886c558b   Steve Greedy   SACAMOS Public Re...
616

47cbb42e   Steve Greedy   Update SW1
617
        cableFile << ListBox1->GetCount() << " #Number of cables in bundle, cable list follows\n";
886c558b   Steve Greedy   SACAMOS Public Re...
618

47cbb42e   Steve Greedy   Update SW1
619
        bundle_list = bundle_root;
886c558b   Steve Greedy   SACAMOS Public Re...
620

47cbb42e   Steve Greedy   Update SW1
621
        wxString x, y, rot, cable;
886c558b   Steve Greedy   SACAMOS Public Re...
622

47cbb42e   Steve Greedy   Update SW1
623
624
        while ( bundle_list->next != NULL )
        {
886c558b   Steve Greedy   SACAMOS Public Re...
625

47cbb42e   Steve Greedy   Update SW1
626
            cable = bundle_list->CableType;
886c558b   Steve Greedy   SACAMOS Public Re...
627

47cbb42e   Steve Greedy   Update SW1
628
629
630
            //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
55679355   Steve Greedy   Mesh Scaling
631

47cbb42e   Steve Greedy   Update SW1
632
633
634
            x = bundle_list->x_offset;
            y = bundle_list->y_offset;
            rot = bundle_list->rot_theta;
886c558b   Steve Greedy   SACAMOS Public Re...
635

47cbb42e   Steve Greedy   Update SW1
636
637
            cableFile << cable_name <<"\n";
            cableFile << x << "\t" << y << "\t" << rot << "\n";
886c558b   Steve Greedy   SACAMOS Public Re...
638

47cbb42e   Steve Greedy   Update SW1
639
640
            bundle_list = bundle_list->next;
        }
886c558b   Steve Greedy   SACAMOS Public Re...
641

47cbb42e   Steve Greedy   Update SW1
642
643
644
645
646
647
648
649
        if (CheckBox1->GetValue())
        {
            cableFile << "ground_plane\n";
        }
        else
        {
            cableFile <<"no_ground_plane\n";
        }
886c558b   Steve Greedy   SACAMOS Public Re...
650

886c558b   Steve Greedy   SACAMOS Public Re...
651

47cbb42e   Steve Greedy   Update SW1
652
653
654
655
656
657
658
659
660
661
662
663
        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";
886c558b   Steve Greedy   SACAMOS Public Re...
664

47cbb42e   Steve Greedy   Update SW1
665
        }
886c558b   Steve Greedy   SACAMOS Public Re...
666

47cbb42e   Steve Greedy   Update SW1
667
668
669
670
671
672
673
674
        if (CheckBox2->GetValue())
        {
            cableFile << "use_laplace\n";
        }
        else
        {
            cableFile << "no_laplace\n";
        }
886c558b   Steve Greedy   SACAMOS Public Re...
675

47cbb42e   Steve Greedy   Update SW1
676
677
678
679
680
681
682
683
        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";
886c558b   Steve Greedy   SACAMOS Public Re...
684

47cbb42e   Steve Greedy   Update SW1
685
686
687
688
689
690
691
692
693
            if (CheckBox1->GetValue())
            {
                cableFile << "gp_edge_length\n";
                cableFile << TextCtrl10->GetValue() <<"\n";
            }
            //CheckBox3 ->SetValue(false);
        }
    }
    cableFile.close();
886c558b   Steve Greedy   SACAMOS Public Re...
694

47cbb42e   Steve Greedy   Update SW1
695
}
886c558b   Steve Greedy   SACAMOS Public Re...
696

47cbb42e   Steve Greedy   Update SW1
697
698
699
700
701
// Build Bundle Model
void BUNDLEBLDR::OnButton2Click(wxCommandEvent& event)
{
    //clean up directory
    clean_temp_files();
886c558b   Steve Greedy   SACAMOS Public Re...
702

47cbb42e   Steve Greedy   Update SW1
703
    wxString fileName = TextCtrl1->GetValue();
886c558b   Steve Greedy   SACAMOS Public Re...
704

47cbb42e   Steve Greedy   Update SW1
705
    wxString command_line;
886c558b   Steve Greedy   SACAMOS Public Re...
706

47cbb42e   Steve Greedy   Update SW1
707
    wxString separator(wxFileName::GetPathSeparator());
886c558b   Steve Greedy   SACAMOS Public Re...
708

47cbb42e   Steve Greedy   Update SW1
709
    WriteBundleFile (TextCtrl1->GetValue());
886c558b   Steve Greedy   SACAMOS Public Re...
710

47cbb42e   Steve Greedy   Update SW1
711
712
713
714
715
716
    std::stringstream stream;
    stream  <<"." + separator
            << "cable_bundle_model_builder"
            << " "
            << ".." + separator + MODname + separator + "BUNDLE" + separator
            << fileName ;
886c558b   Steve Greedy   SACAMOS Public Re...
717

47cbb42e   Steve Greedy   Update SW1
718
    command_line << stream.str().c_str();
886c558b   Steve Greedy   SACAMOS Public Re...
719

47cbb42e   Steve Greedy   Update SW1
720
    wxExecute (command_line,wxEXEC_SYNC);
886c558b   Steve Greedy   SACAMOS Public Re...
721

47cbb42e   Steve Greedy   Update SW1
722
723
724
    // Display Run Status
    RUN_STATUS *run_status_bundle = new RUN_STATUS(this);
    run_status_bundle->ShowModal();
886c558b   Steve Greedy   SACAMOS Public Re...
725

47cbb42e   Steve Greedy   Update SW1
726
	DrawBundleCsection();
886c558b   Steve Greedy   SACAMOS Public Re...
727

47cbb42e   Steve Greedy   Update SW1
728
    Button1->Enable();
886c558b   Steve Greedy   SACAMOS Public Re...
729

47cbb42e   Steve Greedy   Update SW1
730
731
732
733
    if (CheckBox2->GetValue())
    {
        wxString pattern(("*.msh.vtk"));
        wxString file;
886c558b   Steve Greedy   SACAMOS Public Re...
734

47cbb42e   Steve Greedy   Update SW1
735
        ComboBox1->Clear();
886c558b   Steve Greedy   SACAMOS Public Re...
736

47cbb42e   Steve Greedy   Update SW1
737
        file = wxFindFirstFile(pattern);
886c558b   Steve Greedy   SACAMOS Public Re...
738

47cbb42e   Steve Greedy   Update SW1
739
740
741
        while ( !file.empty())
        {
            wxString meshfile = file;
886c558b   Steve Greedy   SACAMOS Public Re...
742

47cbb42e   Steve Greedy   Update SW1
743
            size_t extindex = meshfile.find_last_of (".");
886c558b   Steve Greedy   SACAMOS Public Re...
744

47cbb42e   Steve Greedy   Update SW1
745
746
747
748
749
750
751
752
753
754
755
756
757
            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();
886c558b   Steve Greedy   SACAMOS Public Re...
758
    }
47cbb42e   Steve Greedy   Update SW1
759
	
886c558b   Steve Greedy   SACAMOS Public Re...
760

886c558b   Steve Greedy   SACAMOS Public Re...
761

47cbb42e   Steve Greedy   Update SW1
762
}
886c558b   Steve Greedy   SACAMOS Public Re...
763

47cbb42e   Steve Greedy   Update SW1
764
765
766
767
768
769
void BUNDLEBLDR::OnButton3Click(wxCommandEvent& event)
{
    //clean up directory
    clean_temp_files();
    Close();
}
886c558b   Steve Greedy   SACAMOS Public Re...
770

47cbb42e   Steve Greedy   Update SW1
771
772
773
774
void BUNDLEBLDR::OnCheckBox1Click(wxCommandEvent& event)
{
    int size_h, size_v;
    Panel1->GetSize(&size_h, &size_v );
886c558b   Steve Greedy   SACAMOS Public Re...
775

47cbb42e   Steve Greedy   Update SW1
776
	DrawBundleCsection();
886c558b   Steve Greedy   SACAMOS Public Re...
777

886c558b   Steve Greedy   SACAMOS Public Re...
778

47cbb42e   Steve Greedy   Update SW1
779
780
    TextCtrl10->Enable();
}
886c558b   Steve Greedy   SACAMOS Public Re...
781

47cbb42e   Steve Greedy   Update SW1
782
783
784
785
786
787
788
789
void BUNDLEBLDR::OnCheckBox3Click(wxCommandEvent& event)
{
    if (CheckBox3->GetValue())
    {
        TextCtrl4->Enable();
        TextCtrl5->Enable();
        TextCtrl9->Enable();
    }
886c558b   Steve Greedy   SACAMOS Public Re...
790

47cbb42e   Steve Greedy   Update SW1
791
792
    //WriteBundleFile (TextCtrl1->GetValue());
}
886c558b   Steve Greedy   SACAMOS Public Re...
793

47cbb42e   Steve Greedy   Update SW1
794
795
796
797
798
void BUNDLEBLDR::OnComboBox1Selected(wxCommandEvent& event)
{
    wxString meshToView;
    meshToView<<ComboBox1->GetValue();
    draw_mesh(Panel1,meshToView, scale);
886c558b   Steve Greedy   SACAMOS Public Re...
799

47cbb42e   Steve Greedy   Update SW1
800
    MeshSelected = 1;
886c558b   Steve Greedy   SACAMOS Public Re...
801

47cbb42e   Steve Greedy   Update SW1
802
803
    TextCtrl8->Disable();
}
886c558b   Steve Greedy   SACAMOS Public Re...
804

47cbb42e   Steve Greedy   Update SW1
805
806
807
808
809
810
void BUNDLEBLDR::OnTextCtrl4Text(wxCommandEvent& event)
{
    TextCtrl4->SetForegroundColour(*wxBLACK);
    int IsError = 0;
    check_is_numeric(TextCtrl4, &IsError);
}
886c558b   Steve Greedy   SACAMOS Public Re...
811

47cbb42e   Steve Greedy   Update SW1
812
813
814
815
816
void BUNDLEBLDR::OnInit(wxInitDialogEvent& event)
{
    TextCtrl4->SetForegroundColour(*wxLIGHT_GREY);
    TextCtrl5->SetForegroundColour(*wxLIGHT_GREY);
}
886c558b   Steve Greedy   SACAMOS Public Re...
817

47cbb42e   Steve Greedy   Update SW1
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
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<<ComboBox1->GetValue();
        draw_mesh(Panel1,meshToView, scale);
886c558b   Steve Greedy   SACAMOS Public Re...
846
847
    }

47cbb42e   Steve Greedy   Update SW1
848
849
850
851
    else
    {
            DrawBundleCsection();
    }
886c558b   Steve Greedy   SACAMOS Public Re...
852

47cbb42e   Steve Greedy   Update SW1
853
}
886c558b   Steve Greedy   SACAMOS Public Re...
854

47cbb42e   Steve Greedy   Update SW1
855
856
857
void BUNDLEBLDR::OnSpinButton1ChangeUp(wxSpinEvent& event)
{
    double maxDimension;
886c558b   Steve Greedy   SACAMOS Public Re...
858

47cbb42e   Steve Greedy   Update SW1
859
    wxString maxXY = TextCtrl8->GetValue();
886c558b   Steve Greedy   SACAMOS Public Re...
860

47cbb42e   Steve Greedy   Update SW1
861
    maxXY.ToDouble(&maxDimension);
886c558b   Steve Greedy   SACAMOS Public Re...
862

47cbb42e   Steve Greedy   Update SW1
863
    maxDimension = maxDimension + 0.001;
886c558b   Steve Greedy   SACAMOS Public Re...
864

47cbb42e   Steve Greedy   Update SW1
865
    maxXY = "";
886c558b   Steve Greedy   SACAMOS Public Re...
866

47cbb42e   Steve Greedy   Update SW1
867
    maxXY << maxDimension;
886c558b   Steve Greedy   SACAMOS Public Re...
868

47cbb42e   Steve Greedy   Update SW1
869
    TextCtrl8 ->SetValue(maxXY);
886c558b   Steve Greedy   SACAMOS Public Re...
870

886c558b   Steve Greedy   SACAMOS Public Re...
871

47cbb42e   Steve Greedy   Update SW1
872
873
874
    if (MeshSelected == 1)
    {
        scale = scale + 0.05;
886c558b   Steve Greedy   SACAMOS Public Re...
875

47cbb42e   Steve Greedy   Update SW1
876
877
878
879
        wxString meshToView;
        meshToView<<ComboBox1->GetValue();
        draw_mesh(Panel1,meshToView, scale);
    }
886c558b   Steve Greedy   SACAMOS Public Re...
880

47cbb42e   Steve Greedy   Update SW1
881
882
883
884
    else
    {
            DrawBundleCsection();
    }
886c558b   Steve Greedy   SACAMOS Public Re...
885

47cbb42e   Steve Greedy   Update SW1
886
}
886c558b   Steve Greedy   SACAMOS Public Re...
887

47cbb42e   Steve Greedy   Update SW1
888
889
890
void BUNDLEBLDR::OnSpinButton1ChangeDown(wxSpinEvent& event)
{
    double maxDimension;
886c558b   Steve Greedy   SACAMOS Public Re...
891

47cbb42e   Steve Greedy   Update SW1
892
    wxString maxXY = TextCtrl8->GetValue();
886c558b   Steve Greedy   SACAMOS Public Re...
893

47cbb42e   Steve Greedy   Update SW1
894
    maxXY.ToDouble(&maxDimension);
886c558b   Steve Greedy   SACAMOS Public Re...
895

47cbb42e   Steve Greedy   Update SW1
896
    maxDimension = maxDimension - 0.001;
886c558b   Steve Greedy   SACAMOS Public Re...
897

47cbb42e   Steve Greedy   Update SW1
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
    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<<ComboBox1->GetValue();
        draw_mesh(Panel1,meshToView, scale);
    }

    else
    {
            DrawBundleCsection();
    }
}
886c558b   Steve Greedy   SACAMOS Public Re...
923

886c558b   Steve Greedy   SACAMOS Public Re...
924

886c558b   Steve Greedy   SACAMOS Public Re...
925

886c558b   Steve Greedy   SACAMOS Public Re...
926

886c558b   Steve Greedy   SACAMOS Public Re...
927

886c558b   Steve Greedy   SACAMOS Public Re...
928

47cbb42e   Steve Greedy   Update SW1
929
930
//=====================================================================================
// Draw routines
886c558b   Steve Greedy   SACAMOS Public Re...
931

47cbb42e   Steve Greedy   Update SW1
932
933
934
void BUNDLEBLDR::DrawBundleCable(wxString cable, wxString x, wxString y, wxString rot)
{
    wxString separator(wxFileName::GetPathSeparator());
886c558b   Steve Greedy   SACAMOS Public Re...
935

47cbb42e   Steve Greedy   Update SW1
936
    double xCoord, yCoord, rotation, maxDimension;
886c558b   Steve Greedy   SACAMOS Public Re...
937

47cbb42e   Steve Greedy   Update SW1
938
939
940
    x.ToDouble(&xCoord);
    y.ToDouble(&yCoord);
    rot.ToDouble(&rotation);
886c558b   Steve Greedy   SACAMOS Public Re...
941

47cbb42e   Steve Greedy   Update SW1
942
    yCoord = -1.0 * yCoord;
886c558b   Steve Greedy   SACAMOS Public Re...
943

47cbb42e   Steve Greedy   Update SW1
944
945
    int size_h, size_v;
    Panel1->GetSize(&size_h, &size_v );
886c558b   Steve Greedy   SACAMOS Public Re...
946

47cbb42e   Steve Greedy   Update SW1
947
    wxClientDC dc(Panel1);
886c558b   Steve Greedy   SACAMOS Public Re...
948

47cbb42e   Steve Greedy   Update SW1
949
950
    std::stringstream stream;
    stream << PathToMOD << separator << "CABLE"<< separator << cable;
886c558b   Steve Greedy   SACAMOS Public Re...
951

47cbb42e   Steve Greedy   Update SW1
952
    cable = (stream.str().c_str());
886c558b   Steve Greedy   SACAMOS Public Re...
953

47cbb42e   Steve Greedy   Update SW1
954
955
    std::ifstream cableFile;
    cableFile.open (cable);
886c558b   Steve Greedy   SACAMOS Public Re...
956

47cbb42e   Steve Greedy   Update SW1
957
    std::string str;
886c558b   Steve Greedy   SACAMOS Public Re...
958

47cbb42e   Steve Greedy   Update SW1
959
960
961
    std::getline(cableFile, str);
    std::getline(cableFile, str);
    std::getline(cableFile, str);
886c558b   Steve Greedy   SACAMOS Public Re...
962

47cbb42e   Steve Greedy   Update SW1
963
    float scaleFactor = (size_h/2 * 1.0);
886c558b   Steve Greedy   SACAMOS Public Re...
964

47cbb42e   Steve Greedy   Update SW1
965
    wxString maxXY = TextCtrl8->GetValue();
886c558b   Steve Greedy   SACAMOS Public Re...
966

47cbb42e   Steve Greedy   Update SW1
967
    maxXY.ToDouble(&maxDimension);
886c558b   Steve Greedy   SACAMOS Public Re...
968

47cbb42e   Steve Greedy   Update SW1
969
    if (str.compare("Cylindrical") == 0 ){
886c558b   Steve Greedy   SACAMOS Public Re...
970
971
972
973

        std::getline(cableFile, str);
        std::getline(cableFile, str);

47cbb42e   Steve Greedy   Update SW1
974
        float conductor_radius, dielectric_radius;
886c558b   Steve Greedy   SACAMOS Public Re...
975

47cbb42e   Steve Greedy   Update SW1
976
        cableFile >> conductor_radius;
886c558b   Steve Greedy   SACAMOS Public Re...
977
        std::getline(cableFile, str); //Read to end of line
47cbb42e   Steve Greedy   Update SW1
978
        cableFile >> dielectric_radius;
886c558b   Steve Greedy   SACAMOS Public Re...
979

47cbb42e   Steve Greedy   Update SW1
980
        float dielectric_Scaledradius,conductor_Scaledradius, scaledxCoord, scaledyCoord;
886c558b   Steve Greedy   SACAMOS Public Re...
981

47cbb42e   Steve Greedy   Update SW1
982
983
        dielectric_Scaledradius = (dielectric_radius/maxDimension)*scaleFactor;
        conductor_Scaledradius  = (conductor_radius/maxDimension)*scaleFactor;
886c558b   Steve Greedy   SACAMOS Public Re...
984
985
986
        scaledxCoord = (xCoord/maxDimension)*scaleFactor;
        scaledyCoord = (yCoord/maxDimension)*scaleFactor;

47cbb42e   Steve Greedy   Update SW1
987
988
989
        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 );
886c558b   Steve Greedy   SACAMOS Public Re...
990
991
        dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
        dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
47cbb42e   Steve Greedy   Update SW1
992
        dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2+scaledyCoord), conductor_Scaledradius );
886c558b   Steve Greedy   SACAMOS Public Re...
993

886c558b   Steve Greedy   SACAMOS Public Re...
994
995
    }

47cbb42e   Steve Greedy   Update SW1
996
    if (str.compare("Coax") == 0 ){
886c558b   Steve Greedy   SACAMOS Public Re...
997

47cbb42e   Steve Greedy   Update SW1
998
999
        std::getline(cableFile, str);
        std::getline(cableFile, str);
886c558b   Steve Greedy   SACAMOS Public Re...
1000

47cbb42e   Steve Greedy   Update SW1
1001
1002
1003
        float inner_conductor_radius, shield_radius, outer_insulation, shield_thickness;

        cableFile >> inner_conductor_radius;
886c558b   Steve Greedy   SACAMOS Public Re...
1004
        std::getline(cableFile, str); //Read to end of line
47cbb42e   Steve Greedy   Update SW1
1005
        cableFile >> shield_radius;
886c558b   Steve Greedy   SACAMOS Public Re...
1006
        std::getline(cableFile, str); //Read to end of line
47cbb42e   Steve Greedy   Update SW1
1007
        cableFile >> outer_insulation;
886c558b   Steve Greedy   SACAMOS Public Re...
1008
        std::getline(cableFile, str); //Read to end of line
886c558b   Steve Greedy   SACAMOS Public Re...
1009
        std::getline(cableFile, str); //Read to end of line
47cbb42e   Steve Greedy   Update SW1
1010
        cableFile >> shield_thickness;
886c558b   Steve Greedy   SACAMOS Public Re...
1011

47cbb42e   Steve Greedy   Update SW1
1012
        float  inner_conductor_Scaledradius, shield_Scaledradius, outer_Scaledinsulation, shield_Scaledthickness, scaledxCoord, scaledyCoord;
886c558b   Steve Greedy   SACAMOS Public Re...
1013

47cbb42e   Steve Greedy   Update SW1
1014
1015
1016
1017
1018
1019
        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;
886c558b   Steve Greedy   SACAMOS Public Re...
1020

47cbb42e   Steve Greedy   Update SW1
1021
1022
1023
        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 );
886c558b   Steve Greedy   SACAMOS Public Re...
1024

47cbb42e   Steve Greedy   Update SW1
1025
1026
1027
        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 );
dd86ff43   Steve Greedy   Updates to SW1
1028

47cbb42e   Steve Greedy   Update SW1
1029
1030
1031
        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 );
dd86ff43   Steve Greedy   Updates to SW1
1032

47cbb42e   Steve Greedy   Update SW1
1033
1034
1035
        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 );
dd86ff43   Steve Greedy   Updates to SW1
1036

47cbb42e   Steve Greedy   Update SW1
1037
    }
dd86ff43   Steve Greedy   Updates to SW1
1038

47cbb42e   Steve Greedy   Update SW1
1039
   if (str.compare("Twinax") == 0 ){
dd86ff43   Steve Greedy   Updates to SW1
1040

47cbb42e   Steve Greedy   Update SW1
1041
1042
        std::getline(cableFile, str);
        std::getline(cableFile, str);
dd86ff43   Steve Greedy   Updates to SW1
1043

47cbb42e   Steve Greedy   Update SW1
1044
        float inner_conductor_radius, inner_dielectric_radius, conductor_separation, shield_radius, shield_thickness, outer_dielectric_radius;
dd86ff43   Steve Greedy   Updates to SW1
1045

47cbb42e   Steve Greedy   Update SW1
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
        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;
dd86ff43   Steve Greedy   Updates to SW1
1057

47cbb42e   Steve Greedy   Update SW1
1058
1059
1060
1061
1062
1063
1064
1065
        float   outer_dielectric_Scaledradius,
                            shield_Scaledthickness,
                            shield_Scaledradius,
                            inner_dielectric_Scaledradius,
                            inner_conductor_Scaledradius,
                            conductor_Scaledseparation,
                            scaledxCoord,
                            scaledyCoord;
dd86ff43   Steve Greedy   Updates to SW1
1066

47cbb42e   Steve Greedy   Update SW1
1067
1068
1069
1070
1071
1072
1073
1074
        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;
dd86ff43   Steve Greedy   Updates to SW1
1075

47cbb42e   Steve Greedy   Update SW1
1076
1077
        size_h = size_h + scaledxCoord;
        size_v = size_v + scaledyCoord;
dd86ff43   Steve Greedy   Updates to SW1
1078

47cbb42e   Steve Greedy   Update SW1
1079
1080
1081
        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 );
dd86ff43   Steve Greedy   Updates to SW1
1082

47cbb42e   Steve Greedy   Update SW1
1083
1084
1085
        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 );
dd86ff43   Steve Greedy   Updates to SW1
1086

47cbb42e   Steve Greedy   Update SW1
1087
1088
1089
        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 );
dd86ff43   Steve Greedy   Updates to SW1
1090

47cbb42e   Steve Greedy   Update SW1
1091
1092
1093
        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 );
886c558b   Steve Greedy   SACAMOS Public Re...
1094

47cbb42e   Steve Greedy   Update SW1
1095
1096
1097
        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 );
886c558b   Steve Greedy   SACAMOS Public Re...
1098
1099

        dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
47cbb42e   Steve Greedy   Update SW1
1100
1101
        dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
        dc.DrawCircle( wxPoint((size_h/2)+(conductor_Scaledseparation/2),size_v/2), inner_conductor_Scaledradius );
886c558b   Steve Greedy   SACAMOS Public Re...
1102

47cbb42e   Steve Greedy   Update SW1
1103
1104
1105
1106
        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 );
    }
886c558b   Steve Greedy   SACAMOS Public Re...
1107

47cbb42e   Steve Greedy   Update SW1
1108
    if (str.compare("Twisted_pair") == 0 ){
dd86ff43   Steve Greedy   Updates to SW1
1109

47cbb42e   Steve Greedy   Update SW1
1110
1111
        std::getline(cableFile, str);
        std::getline(cableFile, str);
dd86ff43   Steve Greedy   Updates to SW1
1112

47cbb42e   Steve Greedy   Update SW1
1113
1114
1115
1116
1117
1118
1119
        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;
dd86ff43   Steve Greedy   Updates to SW1
1120

47cbb42e   Steve Greedy   Update SW1
1121
        float  conductor_Scaledradius, conductor_Scaledseparation, dielectric_Scaledradius, scaledxCoord, scaledyCoord;
dd86ff43   Steve Greedy   Updates to SW1
1122

47cbb42e   Steve Greedy   Update SW1
1123
1124
1125
1126
1127
        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;
dd86ff43   Steve Greedy   Updates to SW1
1128

47cbb42e   Steve Greedy   Update SW1
1129
1130
        size_h = size_h + scaledxCoord;
        size_v = size_v + scaledyCoord;
dd86ff43   Steve Greedy   Updates to SW1
1131

47cbb42e   Steve Greedy   Update SW1
1132
        float wire_pos = (conductor_Scaledseparation/2)*0.707;
dd86ff43   Steve Greedy   Updates to SW1
1133

47cbb42e   Steve Greedy   Update SW1
1134
1135
1136
        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 );
dd86ff43   Steve Greedy   Updates to SW1
1137

dd86ff43   Steve Greedy   Updates to SW1
1138

47cbb42e   Steve Greedy   Update SW1
1139
1140
1141
        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 );
dd86ff43   Steve Greedy   Updates to SW1
1142

47cbb42e   Steve Greedy   Update SW1
1143
1144
1145
        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 );
dd86ff43   Steve Greedy   Updates to SW1
1146

47cbb42e   Steve Greedy   Update SW1
1147
1148
1149
1150
        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 );
    }
dd86ff43   Steve Greedy   Updates to SW1
1151

47cbb42e   Steve Greedy   Update SW1
1152
    if (str.compare("Shielded_twisted_pair") == 0 ){
dd86ff43   Steve Greedy   Updates to SW1
1153

47cbb42e   Steve Greedy   Update SW1
1154
1155
        std::getline(cableFile, str);
        std::getline(cableFile, str);
dd86ff43   Steve Greedy   Updates to SW1
1156

47cbb42e   Steve Greedy   Update SW1
1157
        float inner_conductor_radius, inner_conductor_separation, inner_dielectric_radius, shield_radius, shield_thickness, outer_dielectric_radius;
dd86ff43   Steve Greedy   Updates to SW1
1158

47cbb42e   Steve Greedy   Update SW1
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
        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;
886c558b   Steve Greedy   SACAMOS Public Re...
1170

47cbb42e   Steve Greedy   Update SW1
1171
1172
1173
1174
1175
1176
1177
1178
        float   inner_conductor_Scaledradius,
                inner_conductor_Scaledseparation,
                inner_dielectric_Scaledradius,
                shield_Scaledradius,
                shield_Scaledthickness,
                outer_dielectric_Scaledradius,
                scaledxCoord,
                scaledyCoord;
886c558b   Steve Greedy   SACAMOS Public Re...
1179

47cbb42e   Steve Greedy   Update SW1
1180
1181
1182
1183
1184
1185
1186
1187
        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;
886c558b   Steve Greedy   SACAMOS Public Re...
1188

47cbb42e   Steve Greedy   Update SW1
1189
1190
        size_h = size_h + scaledxCoord;
        size_v = size_v + scaledyCoord;
dd86ff43   Steve Greedy   Updates to SW1
1191

47cbb42e   Steve Greedy   Update SW1
1192
        float wire_pos = (inner_conductor_Scaledseparation/2)*0.707;
dd86ff43   Steve Greedy   Updates to SW1
1193

47cbb42e   Steve Greedy   Update SW1
1194
1195
1196
        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 );
dd86ff43   Steve Greedy   Updates to SW1
1197

47cbb42e   Steve Greedy   Update SW1
1198
1199
1200
        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 );
dd86ff43   Steve Greedy   Updates to SW1
1201

47cbb42e   Steve Greedy   Update SW1
1202
1203
1204
        dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
        dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
        dc.DrawCircle( wxPoint(size_h/2,size_v/2), shield_Scaledradius );
dd86ff43   Steve Greedy   Updates to SW1
1205

47cbb42e   Steve Greedy   Update SW1
1206
1207
1208
        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 );
dd86ff43   Steve Greedy   Updates to SW1
1209

47cbb42e   Steve Greedy   Update SW1
1210
1211
1212
        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 );
dd86ff43   Steve Greedy   Updates to SW1
1213

47cbb42e   Steve Greedy   Update SW1
1214
1215
1216
        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 );
886c558b   Steve Greedy   SACAMOS Public Re...
1217

47cbb42e   Steve Greedy   Update SW1
1218
1219
1220
        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 );
886c558b   Steve Greedy   SACAMOS Public Re...
1221
1222
    }

47cbb42e   Steve Greedy   Update SW1
1223
    if (str.compare("Spacewire") == 0 ){
886c558b   Steve Greedy   SACAMOS Public Re...
1224

47cbb42e   Steve Greedy   Update SW1
1225
1226
        std::getline(cableFile, str);
        std::getline(cableFile, str);
886c558b   Steve Greedy   SACAMOS Public Re...
1227

47cbb42e   Steve Greedy   Update SW1
1228
1229
1230
1231
1232
1233
        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;
886c558b   Steve Greedy   SACAMOS Public Re...
1234
        std::getline(cableFile, str); //Read to end of line
47cbb42e   Steve Greedy   Update SW1
1235
        cableFile >> inner_conductor_separation;
886c558b   Steve Greedy   SACAMOS Public Re...
1236
        std::getline(cableFile, str); //Read to end of line
47cbb42e   Steve Greedy   Update SW1
1237
        cableFile >> inner_shield_radius;
886c558b   Steve Greedy   SACAMOS Public Re...
1238
        std::getline(cableFile, str); //Read to end of line
47cbb42e   Steve Greedy   Update SW1
1239
        cableFile >> inner_shield_thickness;
886c558b   Steve Greedy   SACAMOS Public Re...
1240
        std::getline(cableFile, str); //Read to end of line
47cbb42e   Steve Greedy   Update SW1
1241
        cableFile >> inner_shield_jacket_radius;
886c558b   Steve Greedy   SACAMOS Public Re...
1242
        std::getline(cableFile, str); //Read to end of line
47cbb42e   Steve Greedy   Update SW1
1243
1244
1245
1246
1247
1248
1249
        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;
886c558b   Steve Greedy   SACAMOS Public Re...
1250

47cbb42e   Steve Greedy   Update SW1
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
                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,
886c558b   Steve Greedy   SACAMOS Public Re...
1261
1262
1263
                scaledxCoord,
                scaledyCoord;

47cbb42e   Steve Greedy   Update SW1
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
        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;
886c558b   Steve Greedy   SACAMOS Public Re...
1274
1275
1276
1277
1278
1279
1280
        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 ) );
47cbb42e   Steve Greedy   Update SW1
1281
1282
        dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
        dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_dielectric_Scaledradius );
886c558b   Steve Greedy   SACAMOS Public Re...
1283
1284

        dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
47cbb42e   Steve Greedy   Update SW1
1285
1286
        dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
        dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_shield_Scaledthickness+outer_shield_Scaledradius );
55679355   Steve Greedy   Mesh Scaling
1287

47cbb42e   Steve Greedy   Update SW1
1288
1289
1290
        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 );
886c558b   Steve Greedy   SACAMOS Public Re...
1291

47cbb42e   Steve Greedy   Update SW1
1292
1293
1294
1295
        //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 );
886c558b   Steve Greedy   SACAMOS Public Re...
1296

47cbb42e   Steve Greedy   Update SW1
1297
1298
1299
        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 );
886c558b   Steve Greedy   SACAMOS Public Re...
1300

47cbb42e   Steve Greedy   Update SW1
1301
1302
1303
        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 );
886c558b   Steve Greedy   SACAMOS Public Re...
1304

47cbb42e   Steve Greedy   Update SW1
1305
1306
1307
        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 );
886c558b   Steve Greedy   SACAMOS Public Re...
1308

47cbb42e   Steve Greedy   Update SW1
1309
1310
1311
        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 );
dd86ff43   Steve Greedy   Updates to SW1
1312

47cbb42e   Steve Greedy   Update SW1
1313
1314
1315
        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 );
dd86ff43   Steve Greedy   Updates to SW1
1316

47cbb42e   Steve Greedy   Update SW1
1317
1318
1319
        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 );
886c558b   Steve Greedy   SACAMOS Public Re...
1320

886c558b   Steve Greedy   SACAMOS Public Re...
1321

47cbb42e   Steve Greedy   Update SW1
1322
1323
1324
1325
        //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 );
886c558b   Steve Greedy   SACAMOS Public Re...
1326

47cbb42e   Steve Greedy   Update SW1
1327
1328
1329
        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 );
2a0d305e   Steve Greedy   Modifications to ...
1330

47cbb42e   Steve Greedy   Update SW1
1331
1332
1333
        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 );
2a0d305e   Steve Greedy   Modifications to ...
1334

47cbb42e   Steve Greedy   Update SW1
1335
1336
1337
        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 );
2a0d305e   Steve Greedy   Modifications to ...
1338

47cbb42e   Steve Greedy   Update SW1
1339
1340
1341
        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 );
2a0d305e   Steve Greedy   Modifications to ...
1342

47cbb42e   Steve Greedy   Update SW1
1343
1344
1345
        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 );
886c558b   Steve Greedy   SACAMOS Public Re...
1346

47cbb42e   Steve Greedy   Update SW1
1347
1348
1349
        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 );
886c558b   Steve Greedy   SACAMOS Public Re...
1350

47cbb42e   Steve Greedy   Update SW1
1351
1352
1353
1354
        //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 );
886c558b   Steve Greedy   SACAMOS Public Re...
1355

47cbb42e   Steve Greedy   Update SW1
1356
1357
1358
        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 );
886c558b   Steve Greedy   SACAMOS Public Re...
1359

47cbb42e   Steve Greedy   Update SW1
1360
1361
1362
        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 );
886c558b   Steve Greedy   SACAMOS Public Re...
1363

47cbb42e   Steve Greedy   Update SW1
1364
1365
1366
        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 );
886c558b   Steve Greedy   SACAMOS Public Re...
1367

47cbb42e   Steve Greedy   Update SW1
1368
1369
1370
        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 );
886c558b   Steve Greedy   SACAMOS Public Re...
1371

47cbb42e   Steve Greedy   Update SW1
1372
1373
1374
        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 );
886c558b   Steve Greedy   SACAMOS Public Re...
1375

47cbb42e   Steve Greedy   Update SW1
1376
1377
1378
        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 );
886c558b   Steve Greedy   SACAMOS Public Re...
1379

47cbb42e   Steve Greedy   Update SW1
1380
1381
1382
1383
        //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 );
886c558b   Steve Greedy   SACAMOS Public Re...
1384

47cbb42e   Steve Greedy   Update SW1
1385
1386
1387
        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 );
d475f4d6   Steve Greedy   SW1 Update to v1.0.1
1388

47cbb42e   Steve Greedy   Update SW1
1389
1390
1391
        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 );
d475f4d6   Steve Greedy   SW1 Update to v1.0.1
1392

47cbb42e   Steve Greedy   Update SW1
1393
1394
1395
        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 );
d475f4d6   Steve Greedy   SW1 Update to v1.0.1
1396

47cbb42e   Steve Greedy   Update SW1
1397
1398
1399
        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 );
886c558b   Steve Greedy   SACAMOS Public Re...
1400

47cbb42e   Steve Greedy   Update SW1
1401
1402
1403
        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 );
886c558b   Steve Greedy   SACAMOS Public Re...
1404

47cbb42e   Steve Greedy   Update SW1
1405
1406
1407
        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 );
886c558b   Steve Greedy   SACAMOS Public Re...
1408
    }
886c558b   Steve Greedy   SACAMOS Public Re...
1409

47cbb42e   Steve Greedy   Update SW1
1410
    if (str.compare("Overshield") == 0 ){
886c558b   Steve Greedy   SACAMOS Public Re...
1411

47cbb42e   Steve Greedy   Update SW1
1412
1413
        std::getline(cableFile, str);
        std::getline(cableFile, str);
886c558b   Steve Greedy   SACAMOS Public Re...
1414

47cbb42e   Steve Greedy   Update SW1
1415
        float overshield_radius, overshield_thickness;
886c558b   Steve Greedy   SACAMOS Public Re...
1416

47cbb42e   Steve Greedy   Update SW1
1417
1418
1419
        cableFile >> overshield_radius;
        std::getline(cableFile, str); //Read to end of line
        cableFile >> overshield_thickness;
886c558b   Steve Greedy   SACAMOS Public Re...
1420

3d24aeb1   Steve Greedy   Modification to s...
1421

47cbb42e   Steve Greedy   Update SW1
1422
        float overshield_Scaledradius, overshield_Scaledthickness, scaledxCoord, scaledyCoord;
dd86ff43   Steve Greedy   Updates to SW1
1423

47cbb42e   Steve Greedy   Update SW1
1424
1425
1426
1427
        overshield_Scaledradius     = (overshield_radius/maxDimension)*scaleFactor;
        overshield_Scaledthickness  = (overshield_thickness/maxDimension)*scaleFactor;
        scaledxCoord = (xCoord/maxDimension)*scaleFactor;
        scaledyCoord = (yCoord/maxDimension)*scaleFactor;
2a0d305e   Steve Greedy   Modifications to ...
1428

47cbb42e   Steve Greedy   Update SW1
1429
1430
        size_h = size_h + scaledxCoord;
        size_v = size_v + scaledyCoord;
886c558b   Steve Greedy   SACAMOS Public Re...
1431

47cbb42e   Steve Greedy   Update SW1
1432
1433
1434
        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 );
3d24aeb1   Steve Greedy   Modification to s...
1435

47cbb42e   Steve Greedy   Update SW1
1436
1437
1438
1439
        dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
        dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
        dc.DrawCircle( wxPoint(size_h/2,size_v/2), overshield_Scaledradius );
    }
886c558b   Steve Greedy   SACAMOS Public Re...
1440

47cbb42e   Steve Greedy   Update SW1
1441
    if (str.compare("flex_cable") == 0 ){
886c558b   Steve Greedy   SACAMOS Public Re...
1442

47cbb42e   Steve Greedy   Update SW1
1443
        float dielectric_width, dielectric_height, conductor_rows;
886c558b   Steve Greedy   SACAMOS Public Re...
1444

47cbb42e   Steve Greedy   Update SW1
1445
1446
1447
1448
1449
1450
1451
1452
        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
886c558b   Steve Greedy   SACAMOS Public Re...
1453

47cbb42e   Steve Greedy   Update SW1
1454
        float scaled_dielectric_width, scaled_dielectric_height, scaledxCoord, scaledyCoord;
886c558b   Steve Greedy   SACAMOS Public Re...
1455

47cbb42e   Steve Greedy   Update SW1
1456
        float dx1,dy1,dx2,dy2,dx3,dy3,dx4,dy4, tempx, tempy, rotation_rad;
55800c8b   Steve Greedy   Update to SW1
1457

47cbb42e   Steve Greedy   Update SW1
1458
1459
        scaled_dielectric_width = (dielectric_width/maxDimension) * scaleFactor;
        scaled_dielectric_height = (dielectric_height/maxDimension) * scaleFactor;
886c558b   Steve Greedy   SACAMOS Public Re...
1460

47cbb42e   Steve Greedy   Update SW1
1461
1462
        scaledxCoord = xCoord/maxDimension * scaleFactor;
        scaledyCoord = yCoord/maxDimension * scaleFactor;
886c558b   Steve Greedy   SACAMOS Public Re...
1463

47cbb42e   Steve Greedy   Update SW1
1464
        rotation_rad = rotation * (PI/180.0);
886c558b   Steve Greedy   SACAMOS Public Re...
1465

47cbb42e   Steve Greedy   Update SW1
1466
1467
        float s = sin(rotation_rad);
        float c = cos(rotation_rad);
886c558b   Steve Greedy   SACAMOS Public Re...
1468

47cbb42e   Steve Greedy   Update SW1
1469
1470
        dx1 = -scaled_dielectric_width/2;
        dy1 = scaled_dielectric_height/2;
55800c8b   Steve Greedy   Update to SW1
1471

47cbb42e   Steve Greedy   Update SW1
1472
1473
        tempx = dx1*c - dy1*s;
        tempy = dx1*s + dy1*c;
55800c8b   Steve Greedy   Update to SW1
1474

47cbb42e   Steve Greedy   Update SW1
1475
1476
        dx1 = size_h/2 + tempx + scaledxCoord;
        dy1 = size_v/2 + tempy + scaledyCoord ;
886c558b   Steve Greedy   SACAMOS Public Re...
1477

47cbb42e   Steve Greedy   Update SW1
1478
1479
1480
        //point 3
        dx2 = -scaled_dielectric_width/2;
        dy2 = -scaled_dielectric_height/2;
886c558b   Steve Greedy   SACAMOS Public Re...
1481

47cbb42e   Steve Greedy   Update SW1
1482
1483
        tempx = dx2*c - dy2*s;
        tempy = dx2*s + dy2*c;
886c558b   Steve Greedy   SACAMOS Public Re...
1484

47cbb42e   Steve Greedy   Update SW1
1485
1486
        dx2 = size_h/2 + tempx + scaledxCoord;
        dy2 = size_v/2 + tempy + scaledyCoord;
886c558b   Steve Greedy   SACAMOS Public Re...
1487

47cbb42e   Steve Greedy   Update SW1
1488
1489
1490
        //point 3
        dx3 =  scaled_dielectric_width/2;
        dy3 = -scaled_dielectric_height/2;
886c558b   Steve Greedy   SACAMOS Public Re...
1491

47cbb42e   Steve Greedy   Update SW1
1492
1493
        tempx = dx3*c - dy3*s;
        tempy = dx3*s + dy3*c;
dd86ff43   Steve Greedy   Updates to SW1
1494

47cbb42e   Steve Greedy   Update SW1
1495
1496
        dx3 = size_h/2 + tempx + scaledxCoord;
        dy3 = size_v/2 + tempy + scaledyCoord;
886c558b   Steve Greedy   SACAMOS Public Re...
1497

47cbb42e   Steve Greedy   Update SW1
1498
1499
1500
        //point 4
        dx4 = scaled_dielectric_width/2;
        dy4 = scaled_dielectric_height/2;
dd86ff43   Steve Greedy   Updates to SW1
1501

47cbb42e   Steve Greedy   Update SW1
1502
1503
        tempx = dx4*c - dy4*s;
        tempy = dx4*s + dy4*c;
886c558b   Steve Greedy   SACAMOS Public Re...
1504

47cbb42e   Steve Greedy   Update SW1
1505
1506
        dx4 = size_h/2 + tempx + scaledxCoord;
        dy4 = size_v/2 + tempy + scaledyCoord;
dd86ff43   Steve Greedy   Updates to SW1
1507

55679355   Steve Greedy   Mesh Scaling
1508

47cbb42e   Steve Greedy   Update SW1
1509
1510
        dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
        dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
886c558b   Steve Greedy   SACAMOS Public Re...
1511

47cbb42e   Steve Greedy   Update SW1
1512
1513
1514
1515
        dc.DrawLine(dx1, dy1, dx2, dy2);
        dc.DrawLine(dx2, dy2, dx3, dy3);
        dc.DrawLine(dx3, dy3, dx4, dy4);
        dc.DrawLine(dx4, dy4, dx1, dy1);
886c558b   Steve Greedy   SACAMOS Public Re...
1516

47cbb42e   Steve Greedy   Update SW1
1517
        float offset_x, offset_y, width, height,separation, conductors;
886c558b   Steve Greedy   SACAMOS Public Re...
1518

47cbb42e   Steve Greedy   Update SW1
1519
1520
1521
        for (int i = 0; i < conductor_rows;i++){
            cableFile >> offset_x;
            std::getline(cableFile, str); //Read to end of line
55800c8b   Steve Greedy   Update to SW1
1522

47cbb42e   Steve Greedy   Update SW1
1523
1524
            cableFile >> offset_y;
            std::getline(cableFile, str); //Read to end of line
55800c8b   Steve Greedy   Update to SW1
1525

47cbb42e   Steve Greedy   Update SW1
1526
1527
            cableFile >> width;
            std::getline(cableFile, str); //Read to end of line
55800c8b   Steve Greedy   Update to SW1
1528

47cbb42e   Steve Greedy   Update SW1
1529
1530
            cableFile >> height;
            std::getline(cableFile, str); //Read to end of line
55800c8b   Steve Greedy   Update to SW1
1531

47cbb42e   Steve Greedy   Update SW1
1532
1533
            cableFile >> separation;
            std::getline(cableFile, str); //Read to end of line
55800c8b   Steve Greedy   Update to SW1
1534

47cbb42e   Steve Greedy   Update SW1
1535
1536
            cableFile >> conductors;
            std::getline(cableFile, str); //Read to end of line
dd86ff43   Steve Greedy   Updates to SW1
1537

55800c8b   Steve Greedy   Update to SW1
1538

47cbb42e   Steve Greedy   Update SW1
1539
1540
1541
1542
1543
            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;
55800c8b   Steve Greedy   Update to SW1
1544

47cbb42e   Steve Greedy   Update SW1
1545
1546
1547
            //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;
55800c8b   Steve Greedy   Update to SW1
1548

47cbb42e   Steve Greedy   Update SW1
1549
            float cx1,cy1,cx2,cy2,cx3,cy3,cx4,cy4;
55800c8b   Steve Greedy   Update to SW1
1550

47cbb42e   Steve Greedy   Update SW1
1551
1552
            dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
            dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
55800c8b   Steve Greedy   Update to SW1
1553

47cbb42e   Steve Greedy   Update SW1
1554
            for (int j = 0; j<conductors; j++){
55679355   Steve Greedy   Mesh Scaling
1555

47cbb42e   Steve Greedy   Update SW1
1556
1557
1558
                //point 1
                cx1 = x_origin + j * (scaled_conductor_width + scaled_conductor_separation);
                cy1 = y_origin;
55679355   Steve Greedy   Mesh Scaling
1559

47cbb42e   Steve Greedy   Update SW1
1560
1561
                tempx = cx1*c - cy1*s;
                tempy = cx1*s + cy1*c;
55679355   Steve Greedy   Mesh Scaling
1562

47cbb42e   Steve Greedy   Update SW1
1563
1564
                cx1 = tempx + scaledxCoord + size_h/2;
                cy1 = tempy + scaledyCoord + size_v/2;
55800c8b   Steve Greedy   Update to SW1
1565

47cbb42e   Steve Greedy   Update SW1
1566
1567
1568
                //point 3
                cx2 = x_origin + j * (scaled_conductor_width + scaled_conductor_separation);
                cy2 = y_origin - scaled_conductor_height;
55800c8b   Steve Greedy   Update to SW1
1569

47cbb42e   Steve Greedy   Update SW1
1570
1571
                tempx = cx2*c - cy2*s;
                tempy = cx2*s + cy2*c;
55800c8b   Steve Greedy   Update to SW1
1572

47cbb42e   Steve Greedy   Update SW1
1573
1574
                cx2 = tempx + scaledxCoord + size_h/2;
                cy2 = tempy + scaledyCoord + size_v/2;
55800c8b   Steve Greedy   Update to SW1
1575

47cbb42e   Steve Greedy   Update SW1
1576
1577
1578
                //point 3
                cx3 = x_origin + scaled_conductor_width + j * (scaled_conductor_width + scaled_conductor_separation);
                cy3 = y_origin - scaled_conductor_height;
55800c8b   Steve Greedy   Update to SW1
1579

47cbb42e   Steve Greedy   Update SW1
1580
1581
                tempx = cx3*c - cy3*s;
                tempy = cx3*s + cy3*c;
55800c8b   Steve Greedy   Update to SW1
1582

47cbb42e   Steve Greedy   Update SW1
1583
1584
                cx3 = tempx + scaledxCoord + size_h/2;
                cy3 = tempy + scaledyCoord + size_v/2;
55800c8b   Steve Greedy   Update to SW1
1585

47cbb42e   Steve Greedy   Update SW1
1586
1587
1588
                //point 4
                cx4 = x_origin + scaled_conductor_width + j * (scaled_conductor_width + scaled_conductor_separation);
                cy4 = y_origin;
55800c8b   Steve Greedy   Update to SW1
1589

47cbb42e   Steve Greedy   Update SW1
1590
1591
                tempx = cx4*c - cy4*s;
                tempy = cx4*s + cy4*c;
55800c8b   Steve Greedy   Update to SW1
1592

47cbb42e   Steve Greedy   Update SW1
1593
1594
                cx4 = tempx + scaledxCoord + size_h/2;
                cy4 = tempy + scaledyCoord + size_v/2;
55800c8b   Steve Greedy   Update to SW1
1595

47cbb42e   Steve Greedy   Update SW1
1596
1597
1598
1599
1600
1601
                dc.DrawLine(cx1, cy1, cx2, cy2);
                dc.DrawLine(cx2, cy2, cx3, cy3);
                dc.DrawLine(cx3, cy3, cx4, cy4);
                dc.DrawLine(cx4, cy4, cx1, cy1);
            }
        }
55679355   Steve Greedy   Mesh Scaling
1602

55679355   Steve Greedy   Mesh Scaling
1603
1604
    }

47cbb42e   Steve Greedy   Update SW1
1605
    if (str.compare("Dconnector") == 0 ){
55679355   Steve Greedy   Mesh Scaling
1606

47cbb42e   Steve Greedy   Update SW1
1607
        float conductors, conductor_radius, conductor_pitch, conductor_separation, shell_offset;
55800c8b   Steve Greedy   Update to SW1
1608

47cbb42e   Steve Greedy   Update SW1
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
        cableFile >> 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;
55800c8b   Steve Greedy   Update to SW1
1619

47cbb42e   Steve Greedy   Update SW1
1620
//        float totalWidth = (conductors/2 * conductor_separation) + (2 * shell_offset) + (2 * conductor_radius);
55800c8b   Steve Greedy   Update to SW1
1621

47cbb42e   Steve Greedy   Update SW1
1622
1623
1624
1625
1626
        float   conductor_Scaledradius,
                conductor_Scaledpitch,
                conductor_Scaledseparation,
                scaledxCoord,
                scaledyCoord;
55800c8b   Steve Greedy   Update to SW1
1627

55800c8b   Steve Greedy   Update to SW1
1628

47cbb42e   Steve Greedy   Update SW1
1629
        float x_origin, y_origin;
55800c8b   Steve Greedy   Update to SW1
1630

47cbb42e   Steve Greedy   Update SW1
1631
        scaleFactor = (size_h * 0.25);
55800c8b   Steve Greedy   Update to SW1
1632

47cbb42e   Steve Greedy   Update SW1
1633
1634
1635
        conductor_Scaledradius = (conductor_radius/maxDimension)*scaleFactor;
        conductor_Scaledpitch = (conductor_pitch/maxDimension)*scaleFactor;
        conductor_Scaledseparation = (conductor_separation/maxDimension)*scaleFactor;
55800c8b   Steve Greedy   Update to SW1
1636

47cbb42e   Steve Greedy   Update SW1
1637
1638
        scaledxCoord = (xCoord/maxDimension)*scaleFactor;
        scaledyCoord = (yCoord/maxDimension)*scaleFactor;
55800c8b   Steve Greedy   Update to SW1
1639

47cbb42e   Steve Greedy   Update SW1
1640
1641
1642
1643
1644
        size_h = size_h + scaledxCoord;
        size_v = size_v + scaledyCoord;

        dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
        dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
55800c8b   Steve Greedy   Update to SW1
1645

47cbb42e   Steve Greedy   Update SW1
1646
1647
1648
1649
        // 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);
55679355   Steve Greedy   Mesh Scaling
1650

47cbb42e   Steve Greedy   Update SW1
1651
1652
        dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
        dc.SetBrush(wxBrush(*wxBLACK));
55679355   Steve Greedy   Mesh Scaling
1653

47cbb42e   Steve Greedy   Update SW1
1654
        for(int i=0;i<upper_conductors;i++){
55679355   Steve Greedy   Mesh Scaling
1655

47cbb42e   Steve Greedy   Update SW1
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
            dc.DrawCircle( wxPoint(x_origin,y_origin), conductor_Scaledradius );
            x_origin = x_origin + (conductor_Scaledpitch);
        }
        // Lower conductors
        int lower_conductors = (conductors / 2) - 1;
        x_origin = (size_h/2) - (lower_conductors/2 * conductor_Scaledseparation) + conductor_Scaledseparation/2;
        y_origin = (size_v/2) + (conductor_Scaledpitch); // This isn't correct!!

        for(int i=0;i<lower_conductors;i++){

            dc.DrawCircle( wxPoint(x_origin,y_origin), conductor_Scaledradius );
            x_origin = x_origin + (conductor_Scaledpitch);
        }
55679355   Steve Greedy   Mesh Scaling
1669
1670
    }

47cbb42e   Steve Greedy   Update SW1
1671
1672
1673

	// Draw Ground Plane if Selected
    if(CheckBox1->GetValue())
55679355   Steve Greedy   Mesh Scaling
1674
    {
47cbb42e   Steve Greedy   Update SW1
1675
1676
1677
1678
        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 );
55679355   Steve Greedy   Mesh Scaling
1679
    }
47cbb42e   Steve Greedy   Update SW1
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690

}


void BUNDLEBLDR::OnPanel2Paint(wxPaintEvent& event)
{

}

void BUNDLEBLDR::OnCheckListBox1Toggled(wxCommandEvent& event)
{
55800c8b   Steve Greedy   Update to SW1
1691
}
2e55c776   Steve Greedy   SW1_GUI Updates

47cbb42e   Steve Greedy   Update SW1