/////////////////////////////////////////////////////////////////////////////////
//
// This file is part of SACAMOS, cable models for EMI simulations in SPICE.
// It was developed by the University of Nottingham and the Netherlands Aerospace
// Centre (NLR) for ESA under contract number 4000112765/14/NL/HK.
//
// Copyright (C) 2015 - 2018 University of Nottingham
//
// SACAMOS is free software: you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software
// Foundation, either version 3 of the License, or (at your option) any later
// version.
//
// SACAMOS is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// A copy of the GNU General Public License version 3 can be found in the
// file GNU_GPL_v3 in the root or at .
//
// wxWidgets is currently licenced under the "wxWindows Library Licence".
// A copy of the wxWindows Library Licence, Version 3.1 can be found in the file
// wxWindows_Library_Licence_v3-1 in the root or at:
//
//
// The University of Nottingham can be contacted at: ggiemr@nottingham.ac.uk
//
// File Contents:
//
// NAME
// OVERSHIELD.cpp
//
// DESCRIPTION
// GUI for the construction of cable_spec file for cable type: Overshield
//
// AUTHOR(S)
// Steve Greedy
//
/////////////////////////////////////////////////////////////////////////////////
#include "OVERSHIELD.h"
//(*InternalHeaders(OVERSHIELD)
#include
#include
#include
//*)
//(*IdInit(OVERSHIELD)
const long OVERSHIELD::ID_STATICTEXT1 = wxNewId();
const long OVERSHIELD::ID_TEXTCTRL1 = wxNewId();
const long OVERSHIELD::ID_STATICTEXT2 = wxNewId();
const long OVERSHIELD::ID_TEXTCTRL2 = wxNewId();
const long OVERSHIELD::ID_STATICTEXT3 = wxNewId();
const long OVERSHIELD::ID_TEXTCTRL3 = wxNewId();
const long OVERSHIELD::ID_STATICTEXT4 = wxNewId();
const long OVERSHIELD::ID_TEXTCTRL4 = wxNewId();
const long OVERSHIELD::ID_STATICTEXT5 = wxNewId();
const long OVERSHIELD::ID_TEXTCTRL5 = wxNewId();
const long OVERSHIELD::ID_STATICTEXT6 = wxNewId();
const long OVERSHIELD::ID_TEXTCTRL6 = wxNewId();
const long OVERSHIELD::ID_STATICTEXT7 = wxNewId();
const long OVERSHIELD::ID_TEXTCTRL7 = wxNewId();
const long OVERSHIELD::ID_STATICTEXT8 = wxNewId();
const long OVERSHIELD::ID_TEXTCTRL8 = wxNewId();
const long OVERSHIELD::ID_STATICTEXT9 = wxNewId();
const long OVERSHIELD::ID_TEXTCTRL9 = wxNewId();
const long OVERSHIELD::ID_BUTTON1 = wxNewId();
const long OVERSHIELD::ID_BUTTON2 = wxNewId();
const long OVERSHIELD::ID_BUTTON3 = wxNewId();
const long OVERSHIELD::ID_PANEL1 = wxNewId();
//*)
BEGIN_EVENT_TABLE(OVERSHIELD,wxDialog)
//(*EventTable(OVERSHIELD)
//*)
END_EVENT_TABLE()
OVERSHIELD::OVERSHIELD(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{
//(*Initialize(OVERSHIELD)
wxStaticBoxSizer* StaticBoxSizer2;
wxFlexGridSizer* FlexGridSizer4;
wxStaticBoxSizer* StaticBoxSizer4;
wxFlexGridSizer* FlexGridSizer3;
wxFlexGridSizer* FlexGridSizer2;
wxBoxSizer* BoxSizer2;
wxStaticBoxSizer* StaticBoxSizer3;
wxBoxSizer* BoxSizer1;
wxStaticBoxSizer* StaticBoxSizer1;
wxFlexGridSizer* FlexGridSizer1;
Create(parent, wxID_ANY, _("SACAMOS: OVERSHIELD MODEL"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY"));
FlexGridSizer1 = new wxFlexGridSizer(2, 2, 0, 0);
StaticBoxSizer1 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Overshield Parameters"));
FlexGridSizer2 = new wxFlexGridSizer(0, 1, 0, 0);
BoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Overshield Name"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1"));
BoxSizer1->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"));
BoxSizer1->Add(TextCtrl1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
FlexGridSizer2->Add(BoxSizer1, 1, wxALL|wxEXPAND, 5);
StaticBoxSizer3 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("General Properties"));
FlexGridSizer3 = new wxFlexGridSizer(0, 2, 0, 0);
StaticText2 = new wxStaticText(this, ID_STATICTEXT2, _("Overshield Radius (m)"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT2"));
FlexGridSizer3->Add(StaticText2, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
TextCtrl2 = new wxTextCtrl(this, ID_TEXTCTRL2, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL2"));
FlexGridSizer3->Add(TextCtrl2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
StaticText3 = new wxStaticText(this, ID_STATICTEXT3, _("Overshield Thickness (m)"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT3"));
FlexGridSizer3->Add(StaticText3, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
TextCtrl3 = new wxTextCtrl(this, ID_TEXTCTRL3, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL3"));
FlexGridSizer3->Add(TextCtrl3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
StaticText4 = new wxStaticText(this, ID_STATICTEXT4, _("Overshield Conductivity (S/m)"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT4"));
StaticText4->SetHelpText(_("Overshield conductivity (S/m)"));
FlexGridSizer3->Add(StaticText4, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
TextCtrl4 = new wxTextCtrl(this, ID_TEXTCTRL4, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL4"));
FlexGridSizer3->Add(TextCtrl4, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
StaticBoxSizer3->Add(FlexGridSizer3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
FlexGridSizer2->Add(StaticBoxSizer3, 1, wxALL|wxEXPAND, 5);
StaticBoxSizer4 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Transfer Impedance Model"));
FlexGridSizer4 = new wxFlexGridSizer(0, 2, 0, 0);
StaticText5 = new wxStaticText(this, ID_STATICTEXT5, _("Angular f Normalisation"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT5"));
FlexGridSizer4->Add(StaticText5, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
TextCtrl5 = new wxTextCtrl(this, ID_TEXTCTRL5, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL5"));
FlexGridSizer4->Add(TextCtrl5, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
StaticText6 = new wxStaticText(this, ID_STATICTEXT6, _("Numerator Order"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT6"));
FlexGridSizer4->Add(StaticText6, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
TextCtrl6 = new wxTextCtrl(this, ID_TEXTCTRL6, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL6"));
FlexGridSizer4->Add(TextCtrl6, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
StaticText7 = new wxStaticText(this, ID_STATICTEXT7, _("Numerator Coefficients"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT7"));
FlexGridSizer4->Add(StaticText7, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
TextCtrl7 = new wxTextCtrl(this, ID_TEXTCTRL7, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL7"));
FlexGridSizer4->Add(TextCtrl7, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
StaticText8 = new wxStaticText(this, ID_STATICTEXT8, _("Denominator Order"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT8"));
FlexGridSizer4->Add(StaticText8, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
TextCtrl8 = new wxTextCtrl(this, ID_TEXTCTRL8, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL8"));
FlexGridSizer4->Add(TextCtrl8, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
StaticText9 = new wxStaticText(this, ID_STATICTEXT9, _("Denominator Coefficients"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT9"));
FlexGridSizer4->Add(StaticText9, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
TextCtrl9 = new wxTextCtrl(this, ID_TEXTCTRL9, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL9"));
FlexGridSizer4->Add(TextCtrl9, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
StaticBoxSizer4->Add(FlexGridSizer4, 1, wxALL, 5);
FlexGridSizer2->Add(StaticBoxSizer4, 1, wxALL|wxEXPAND, 5);
BoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
Button1 = new wxButton(this, ID_BUTTON1, _("SAVE"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));
BoxSizer2->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"));
BoxSizer2->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"));
BoxSizer2->Add(Button3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
FlexGridSizer2->Add(BoxSizer2, 0, wxALL|wxEXPAND, 5);
StaticBoxSizer1->Add(FlexGridSizer2, 1, wxALL|wxEXPAND, 5);
FlexGridSizer1->Add(StaticBoxSizer1, 1, wxALL|wxEXPAND, 5);
StaticBoxSizer2 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Cross Section"));
Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxSize(500,500), wxTAB_TRAVERSAL, _T("ID_PANEL1"));
Panel1->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
Panel1->SetToolTip(_("Double Click to Reset Schematic"));
StaticBoxSizer2->Add(Panel1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
FlexGridSizer1->Add(StaticBoxSizer2, 1, wxALL|wxALIGN_TOP|wxALIGN_CENTER_HORIZONTAL, 5);
SetSizer(FlexGridSizer1);
FlexGridSizer1->Fit(this);
FlexGridSizer1->SetSizeHints(this);
Connect(ID_TEXTCTRL2,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&OVERSHIELD::OnTextCtrl2Text);
Connect(ID_TEXTCTRL3,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&OVERSHIELD::OnTextCtrl3Text);
Connect(ID_TEXTCTRL4,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&OVERSHIELD::OnTextCtrl4Text);
Connect(ID_TEXTCTRL5,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&OVERSHIELD::OnTextCtrl5Text);
Connect(ID_TEXTCTRL6,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&OVERSHIELD::OnTextCtrl6Text);
Connect(ID_TEXTCTRL7,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&OVERSHIELD::OnTextCtrl7Text);
Connect(ID_TEXTCTRL8,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&OVERSHIELD::OnTextCtrl8Text);
Connect(ID_TEXTCTRL9,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&OVERSHIELD::OnTextCtrl9Text);
Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&OVERSHIELD::OnButton1Click);
Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&OVERSHIELD::OnButton2Click);
Connect(ID_BUTTON3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&OVERSHIELD::OnButton3Click);
Panel1->Connect(wxEVT_PAINT,(wxObjectEventFunction)&OVERSHIELD::OnPanel1Paint,0,this);
Panel1->Connect(wxEVT_LEFT_DCLICK,(wxObjectEventFunction)&OVERSHIELD::OnPanel1LeftDClick,0,this);
Connect(wxID_ANY,wxEVT_INIT_DIALOG,(wxObjectEventFunction)&OVERSHIELD::OnInit);
Connect(wxEVT_PAINT,(wxObjectEventFunction)&OVERSHIELD::OnPaint);
//*)
}
OVERSHIELD::~OVERSHIELD()
{
//(*Destroy(OVERSHIELD)
//*)
}
void OVERSHIELD::OnInit(wxInitDialogEvent& event)
{
TextCtrl2->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&OVERSHIELD::OnHighlightSchematic, this);
TextCtrl3->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&OVERSHIELD::OnHighlightSchematic, this);
TextCtrl4->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&OVERSHIELD::OnHighlightSchematic, this);
TextCtrl5->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&OVERSHIELD::OnHighlightSchematic, this);
}
void OVERSHIELD::OnPaint(wxPaintEvent& event)
{
if (EDIT_EXISTING==true) EditExistingCable();
}
void OVERSHIELD::SetPathToMOD(wxString Path, wxString Name)
{
pathToMOD << Path;
MODname << Name;
}
void OVERSHIELD::OnButton1Click(wxCommandEvent& event)
{
int IsError = 0;
wxString fileName = TextCtrl1->GetValue();
TextCtrl1->SetBackgroundColour(wxColor(255,255,255));
if (fileName == "")
{
wxMessageBox("Please Specify a Cable Name" , _("Missing Cable Name"));
return;
}
check_is_empty(TextCtrl2, &IsError);
check_is_empty(TextCtrl3, &IsError);
check_is_empty(TextCtrl4, &IsError);
check_is_empty(TextCtrl5, &IsError);
check_is_empty(TextCtrl6, &IsError);
check_is_empty(TextCtrl7, &IsError);
check_is_empty(TextCtrl8, &IsError);
check_is_empty(TextCtrl9, &IsError);
if (IsError ==1)
{
return;
}
if ( IsError == 1)
{
wxMessageBox("Please fix highlighted errors" , _("Non numeric entry"));
return;
}
WriteCableFile (fileName);
Button1->Disable();
}
void OVERSHIELD::OnButton2Click(wxCommandEvent& event)
{
//CABLE BUIDER
wxString fileName = TextCtrl1->GetValue();
wxString command_line;
wxString separator(wxFileName::GetPathSeparator());
std::stringstream stream;
stream <<"." + separator
<< "cable_model_builder"
<< " "
<< ".." + separator + MODname + separator + "CABLE" + separator
<< fileName ;
command_line << stream.str().c_str();
wxExecute (command_line, wxEXEC_SYNC);
// Display Run Status
RUN_STATUS *run_status = new RUN_STATUS(this);
run_status->ShowModal();
Button1->Disable();
}
void OVERSHIELD::OnButton3Click(wxCommandEvent& event)
{
//clean up directory
clean_temp_files();
Close();
}
void OVERSHIELD::OnTextCtrl2Text(wxCommandEvent& event)
{
int IsError = 0;
check_is_numeric(TextCtrl2, &IsError);
check_is_positive(TextCtrl2, &IsError);
}
void OVERSHIELD::OnTextCtrl3Text(wxCommandEvent& event)
{
int IsError = 0;
check_is_numeric(TextCtrl3, &IsError);
check_is_positive(TextCtrl2, &IsError);
}
void OVERSHIELD::OnTextCtrl4Text(wxCommandEvent& event)
{
int IsError = 0;
check_is_numeric(TextCtrl4, &IsError);
check_is_positive(TextCtrl2, &IsError);
}
void OVERSHIELD::OnTextCtrl5Text(wxCommandEvent& event)
{
int IsError = 0;
check_is_numeric(TextCtrl5, &IsError);
}
void OVERSHIELD::OnTextCtrl6Text(wxCommandEvent& event)
{
int IsError = 0;
check_is_numeric(TextCtrl6, &IsError);
}
void OVERSHIELD::OnTextCtrl7Text(wxCommandEvent& event)
{
int IsError = 0;
check_is_numeric_list(TextCtrl7, &IsError);
}
void OVERSHIELD::OnTextCtrl8Text(wxCommandEvent& event)
{
int IsError = 0;
check_is_numeric(TextCtrl8, &IsError);
}
void OVERSHIELD::OnTextCtrl9Text(wxCommandEvent& event)
{
int IsError = 0;
check_is_numeric_list(TextCtrl9, &IsError);
}
void OVERSHIELD::WriteCableFile (wxString fileName)
{
ofstream cableFile;
wxString separator(wxFileName::GetPathSeparator());
wxString fullFileName = pathToMOD + separator + "CABLE" + separator + fileName + ".cable_spec";
cableFile.open (fullFileName);
if (cableFile.is_open())
{
// minimum requirements for type Cylindrical
cableFile <<"# MOD_cable_lib_dir \n";
cableFile <<".." << separator << MODname << separator << "CABLE" << separator <<"\n";
cableFile <<"Overshield\n";
cableFile <<"1 /t#number of conductors \n";
cableFile <<"3 /t#number of parameters \n";
cableFile << TextCtrl2->GetValue() <<" \t# parameter 1: overshield radius (m)\n";
cableFile << TextCtrl3->GetValue() <<" \t# parameter 2: overshield thickness (m)\n";
cableFile << TextCtrl4->GetValue() <<" \t# parameter 3: overshield conductivity\n";
cableFile <<"0 \t# number of frequency dependent parameters\n";
cableFile <<"1 \t# number of frequency dependent transfer impedance models\n";
cableFile << "# Transfer impedance model \n";
cableFile << TextCtrl5->GetValue() <<" \t# angular frequency normalisation\n";
cableFile << TextCtrl6->GetValue() <<" \t# order of numerator model\n";
cableFile << TextCtrl7->GetValue() <<" \t# list of numerator coefficients a0 a1 a2... \n";
cableFile << TextCtrl8->GetValue() <<" \t# order of denominator model\n";
cableFile << TextCtrl9->GetValue() <<" \t# list of denominator coefficients b0 b1 b2... \n";
}
cableFile.close();
}
void OVERSHIELD::OnPanel1Paint(wxPaintEvent& event)
{
overshieldSchematic();
}
void OVERSHIELD::overshieldSchematic()
{
int size_h, size_v;
Panel1->GetSize(&size_h, &size_v );
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(*wxBLUE);
dc.DrawText("General Overshield", 10, 15);
float conductor_radius, conductor_thickness;
conductor_radius = size_h *0.4;
conductor_thickness = size_h * 0.02;
dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
dc.SetBrush(wxBrush(wxColor(224,224,224), wxSOLID));
dc.DrawCircle( wxPoint(size_h/2,size_v/2), conductor_radius + conductor_thickness );
dc.SetBrush(wxBrush(wxColor(255,255,255), wxSOLID));
dc.DrawCircle( wxPoint(size_h/2,size_v/2), conductor_radius );
}
void OVERSHIELD::OnHighlightSchematic(wxCommandEvent& event)
{
overshieldSchematic();
int ID = event.GetId();
event.Skip(true);
int size_h, size_v;
Panel1->GetSize(&size_h, &size_v );
float conductor_radius, conductor_thickness;
conductor_radius = size_h *0.4;
conductor_thickness = size_h * 0.02;
wxClientDC dc(Panel1);
wxPoint arrowHead[3];
if (ID == ID_TEXTCTRL2)
{
dc.SetPen(wxPen(wxColor(51,51,255), 3));
dc.SetBrush(wxBrush(wxColor(51,51,255), wxSOLID));
dc.DrawCircle( wxPoint(size_h/2,size_v/2),4 );
dc.DrawLine( size_h/2,size_v/2, size_h/2+conductor_radius, size_v/2 );
arrowHead[0] = wxPoint(size_h/2+conductor_radius, size_v/2);
arrowHead[1] = wxPoint(size_h/2+conductor_radius - 5, size_v/2 - 3);
arrowHead[2] = wxPoint(size_h/2+conductor_radius - 5, size_v/2 + 3);
dc.DrawPolygon(WXSIZEOF(arrowHead), arrowHead);
}
if (ID == ID_TEXTCTRL3 || ID == ID_TEXTCTRL4)
{
dc.SetPen(wxPen(wxColor(51,51,255), 3));
dc.SetBrush(wxBrush(wxColor(51,51,255), wxSOLID));
dc.DrawCircle( wxPoint(size_h/2,size_v/2), conductor_radius + conductor_thickness );
dc.SetBrush(wxBrush(wxColor(255,255,255), wxSOLID));
dc.DrawCircle( wxPoint(size_h/2,size_v/2), conductor_radius );
}
}
void OVERSHIELD::OnPanel1LeftDClick(wxMouseEvent& event)
{
overshieldSchematic();
}
void OVERSHIELD::EditExistingCable()
{
Close();
}