Commit 47cbb42e83023f45bf92cdcf5dbeaf03bc2aff57

Authored by Steve Greedy
1 parent 55679355

Update SW1

Modifications to BUNDLEBLDR.cpp. Fixed issues is some Linux versions affecting drawing of cable schematic.
GUI/SW1/SRC/BUNDLEBLDR.cpp
... ... @@ -325,6 +325,27 @@ BUNDLEBLDR::BUNDLEBLDR(wxWindow* parent,wxWindowID id,const wxPoint& pos,const w
325 325 //PopulateTheDirectoryTree(PathToMOD);
326 326 }
327 327  
  328 +
  329 +BUNDLEBLDR::~BUNDLEBLDR()
  330 +{
  331 + //(*Destroy(BUNDLEBLDR)
  332 + //*)
  333 +}
  334 +
  335 +void BUNDLEBLDR::SetPathForDir(wxString Path, wxString Name)
  336 +{
  337 + PathToMOD << Path;
  338 + MODname << Name;
  339 +
  340 + PopulateTheDirectoryTree(PathToMOD);
  341 +}
  342 +
  343 +
  344 +//=========================================================================================================
  345 +// Build bundle from components selected from MOD
  346 +
  347 +
  348 +//Select cable component for removal
328 349 void BUNDLEBLDR::OnListboxRDown(wxMouseEvent& event)
329 350 {
330 351 int item = ListBox1->HitTest(event.GetPosition());
... ... @@ -334,9 +355,10 @@ void BUNDLEBLDR::OnListboxRDown(wxMouseEvent&amp; event)
334 355 wxString strMessage;
335 356 wxString strItem = ListBox1->GetString(item);
336 357  
337   - strMessage = "Are you sure you w DrawBundleCsection();ish to delete: ";
  358 + strMessage = "Are you sure you wish to delete: ";
338 359 strMessage = strMessage << strItem;
339   - // Confirm cable component deletion?
  360 +
  361 + // Confirm cable component deletion
340 362 wxMessageDialog bb_ConfirmDelete (this, strMessage, _("Please confirm delete") ,wxYES_NO|wxCENTRE,wxDefaultPosition );
341 363  
342 364 bb_ConfirmDelete.ShowModal();
... ... @@ -351,11 +373,13 @@ void BUNDLEBLDR::OnListboxRDown(wxMouseEvent&amp; event)
351 373 event.Skip();
352 374 }
353 375  
  376 +
  377 +//Add cable component to component list
354 378 void BUNDLEBLDR::PopulateListControl(void)
355 379 {
356 380 ListBox1->Clear();
357 381  
358   - Button1->Enable(); DrawBundleCsection();
  382 + Button1->Enable();
359 383  
360 384 Bundle *Current = bundle_root;
361 385  
... ... @@ -364,10 +388,10 @@ void BUNDLEBLDR::PopulateListControl(void)
364 388 ListBox1->Append(Current->CableType);
365 389 Current = Current->next;
366 390 }
367   - DrawPanel();
368   - DrawBundleCsection();
369 391 }
370 392  
  393 +
  394 +//Delete cable component from component list
371 395 void BUNDLEBLDR::removeElement(int ItemIndex)
372 396 {
373 397  
... ... @@ -399,13 +423,7 @@ void BUNDLEBLDR::removeElement(int ItemIndex)
399 423 }
400 424  
401 425  
402   -
403   -BUNDLEBLDR::~BUNDLEBLDR()
404   -{
405   - //(*Destroy(BUNDLEBLDR)
406   - //*)
407   -}
408   -
  426 +// Display MOD
409 427 void BUNDLEBLDR::PopulateTheDirectoryTree (wxString Path)
410 428 {
411 429 int size_h, size_v;
... ... @@ -426,8 +444,10 @@ void BUNDLEBLDR::PopulateTheDirectoryTree (wxString Path)
426 444  
427 445 //SetButtonState_FolderSelected();
428 446 }
  447 +//=========================================================================================================
429 448  
430 449  
  450 +//Capture component selection from MOD, position and display
431 451 void BUNDLEBLDR::OnTreeSelectionChanged(wxTreeEvent& evt)
432 452 {
433 453 // A few file functions
... ... @@ -464,32 +484,10 @@ void BUNDLEBLDR::OnTreeSelectionChanged(wxTreeEvent&amp; evt)
464 484  
465 485 }
466 486  
467   -
468   -void BUNDLEBLDR::OnPanel2Paint(wxPaintEvent& event)
469   -{
470   -
471   -}
472   -
473   -
474   -void BUNDLEBLDR::SetPathForDir(wxString Path, wxString Name)
475   -{
476   - PathToMOD << Path;
477   - MODname << Name;
478   -
479   - PopulateTheDirectoryTree(PathToMOD);
480   -}
481   -
482   -void BUNDLEBLDR::OnCheckListBox1Toggled(wxCommandEvent& event)
483   -{
484   -}
485   -
  487 +// Initialise Draw Panel
486 488 void BUNDLEBLDR::OnPanel1Paint(wxPaintEvent& event)
487 489 {
488   -
489 490 DrawPanel();
490   - //DrawBundleCsection();
491   -
492   -
493 491 }
494 492  
495 493 void BUNDLEBLDR::DrawPanel()
... ... @@ -503,27 +501,7 @@ void BUNDLEBLDR::DrawPanel()
503 501 FormatPanel(maxDimension);
504 502 }
505 503  
506   -void BUNDLEBLDR::DrawBundleCsection()
507   -{
508   - bundle_list = bundle_root;
509   -
510   - wxString x, y, rot, cable;
511   -
512   - while ( bundle_list->next != NULL )
513   - {
514   - cable = bundle_list->CableType;
515   - x = bundle_list->x_offset;
516   - y = bundle_list->y_offset;
517   - rot = bundle_list->rot_theta;
518   -
519   - DrawBundleCable(cable, x, y, rot);
520   -
521   - bundle_list = bundle_list->next;
522   - }
523   -}
524   -
525   -
526   -// BUNDLE GRAPHICAL SCHEMATIC - SET UP PANEL
  504 +// Set Default Panel
527 505 void BUNDLEBLDR::FormatPanel(double maxDimension)
528 506  
529 507 {
... ... @@ -566,711 +544,733 @@ void BUNDLEBLDR::FormatPanel(double maxDimension)
566 544  
567 545 }
568 546  
569   -void BUNDLEBLDR::DrawBundleCable(wxString cable, wxString x, wxString y, wxString rot)
  547 +// Draw Bundle for Selected Components
  548 +void BUNDLEBLDR::DrawBundleCsection()
570 549 {
571   - wxString separator(wxFileName::GetPathSeparator());
572   -
573   - double xCoord, yCoord, rotation, maxDimension;
  550 + bundle_list = bundle_root;
574 551  
575   - x.ToDouble(&xCoord);
576   - y.ToDouble(&yCoord);
577   - rot.ToDouble(&rotation);
  552 + wxString x, y, rot, cable;
578 553  
579   - yCoord = -1.0 * yCoord;
  554 + double maxDimension;
580 555  
581   - int size_h, size_v;
582   - Panel1->GetSize(&size_h, &size_v );
  556 + wxString maxXY = TextCtrl8->GetValue();
583 557  
584   - wxClientDC dc(Panel1);
  558 + maxXY.ToDouble(&maxDimension);
585 559  
586   - std::stringstream stream;
587   - stream << PathToMOD << separator << "CABLE"<< separator << cable;
  560 + FormatPanel(maxDimension);
588 561  
589   - cable = (stream.str().c_str());
590 562  
591   - std::ifstream cableFile;
592   - cableFile.open (cable);
  563 + while ( bundle_list->next != NULL )
  564 + {
  565 + cable = bundle_list->CableType;
  566 + x = bundle_list->x_offset;
  567 + y = bundle_list->y_offset;
  568 + rot = bundle_list->rot_theta;
593 569  
594   - std::string str;
  570 + DrawBundleCable(cable, x, y, rot);
595 571  
596   - std::getline(cableFile, str);
597   - std::getline(cableFile, str);
598   - std::getline(cableFile, str);
  572 + bundle_list = bundle_list->next;
  573 + }
  574 +}
599 575  
600   - float scaleFactor = (size_h/2 * 1.0);
601 576  
602   - wxString maxXY = TextCtrl8->GetValue();
603 577  
604   - maxXY.ToDouble(&maxDimension);
  578 +// Save bundle
  579 +void BUNDLEBLDR::OnButton1Click(wxCommandEvent& event)
  580 +{
  581 + int IsError = 0;
605 582  
606   - if (str.compare("Cylindrical") == 0 ){
  583 + wxString fileName = TextCtrl1->GetValue();
607 584  
608   - std::getline(cableFile, str);
609   - std::getline(cableFile, str);
  585 + TextCtrl1->SetBackgroundColour(wxColor(255,255,255));
610 586  
611   - float conductor_radius, dielectric_radius;
  587 + if (fileName == "")
  588 + {
  589 + wxMessageBox("Please Specify a Cable Name" , _("Missing Cable Name"));
  590 + return;
  591 + }
612 592  
613   - cableFile >> conductor_radius;
614   - std::getline(cableFile, str); //Read to end of line
615   - cableFile >> dielectric_radius;
  593 + WriteBundleFile(fileName);
616 594  
617   - float dielectric_Scaledradius,conductor_Scaledradius, scaledxCoord, scaledyCoord;
  595 + Button1->Disable();
  596 +}
618 597  
619   - dielectric_Scaledradius = (dielectric_radius/maxDimension)*scaleFactor;
620   - conductor_Scaledradius = (conductor_radius/maxDimension)*scaleFactor;
621   - scaledxCoord = (xCoord/maxDimension)*scaleFactor;
622   - scaledyCoord = (yCoord/maxDimension)*scaleFactor;
  598 +void BUNDLEBLDR::WriteBundleFile(wxString fileName)
  599 +{
  600 + ofstream cableFile;
  601 + wxString separator(wxFileName::GetPathSeparator());
623 602  
624   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
625   - dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
626   - dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2+scaledyCoord), dielectric_Scaledradius );
627   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
628   - dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
629   - dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2+scaledyCoord), conductor_Scaledradius );
  603 + wxString fullFileName = PathToMOD + separator + "BUNDLE" + separator + fileName + ".bundle_spec";
630 604  
631   - }
  605 + cableFile.open (fullFileName);
632 606  
633   - if (str.compare("Coax") == 0 ){
  607 + if (cableFile.is_open())
  608 + {
  609 + cableFile << "#MOD_cable_lib_dir" << "\n";
634 610  
635   - std::getline(cableFile, str);
636   - std::getline(cableFile, str);
  611 + cableFile <<".." << separator << MODname << separator << "CABLE" << separator <<"\n";
637 612  
638   - float inner_conductor_radius, shield_radius, outer_insulation, shield_thickness;
  613 + cableFile << "#MOD_cable_lib_dir" << "\n";
639 614  
640   - cableFile >> inner_conductor_radius;
641   - std::getline(cableFile, str); //Read to end of line
642   - cableFile >> shield_radius;
643   - std::getline(cableFile, str); //Read to end of line
644   - cableFile >> outer_insulation;
645   - std::getline(cableFile, str); //Read to end of line
646   - std::getline(cableFile, str); //Read to end of line
647   - cableFile >> shield_thickness;
  615 + cableFile <<".." << separator << MODname << separator << "BUNDLE" << separator <<"\n";
648 616  
649   - float inner_conductor_Scaledradius, shield_Scaledradius, outer_Scaledinsulation, shield_Scaledthickness, scaledxCoord, scaledyCoord;
  617 + cableFile << ListBox1->GetCount() << " #Number of cables in bundle, cable list follows\n";
650 618  
651   - outer_Scaledinsulation = (outer_insulation/maxDimension)*scaleFactor;
652   - shield_Scaledthickness = (shield_thickness/maxDimension)*scaleFactor;
653   - shield_Scaledradius = (shield_radius/maxDimension)*scaleFactor;
654   - inner_conductor_Scaledradius = (inner_conductor_radius/maxDimension)*scaleFactor;
655   - scaledxCoord = (xCoord/maxDimension)*scaleFactor;
656   - scaledyCoord = (yCoord/maxDimension)*scaleFactor;
  619 + bundle_list = bundle_root;
657 620  
658   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
659   - dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
660   - dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2+scaledyCoord), outer_Scaledinsulation );
  621 + wxString x, y, rot, cable;
661 622  
662   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
663   - dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
664   - dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2+scaledyCoord), shield_Scaledthickness+shield_Scaledradius );
  623 + while ( bundle_list->next != NULL )
  624 + {
665 625  
666   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
667   - dc.SetBrush(wxBrush(*wxLIGHT_GREY, wxSOLID));
668   - dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2+scaledyCoord), shield_Scaledradius );
  626 + cable = bundle_list->CableType;
669 627  
670   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
671   - dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
672   - dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2+scaledyCoord), inner_conductor_Scaledradius );
  628 + //Remove file extension
  629 + size_t lastindex = cable.find_last_of(".");
  630 + wxString cable_name = cable.substr(0, lastindex); //at the moment here requires full path to file
673 631  
674   - }
  632 + x = bundle_list->x_offset;
  633 + y = bundle_list->y_offset;
  634 + rot = bundle_list->rot_theta;
675 635  
676   - if (str.compare("Twinax") == 0 ){
  636 + cableFile << cable_name <<"\n";
  637 + cableFile << x << "\t" << y << "\t" << rot << "\n";
677 638  
678   - std::getline(cableFile, str);
679   - std::getline(cableFile, str);
  639 + bundle_list = bundle_list->next;
  640 + }
680 641  
681   - float inner_conductor_radius, inner_dielectric_radius, conductor_separation, shield_radius, shield_thickness, outer_dielectric_radius;
  642 + if (CheckBox1->GetValue())
  643 + {
  644 + cableFile << "ground_plane\n";
  645 + }
  646 + else
  647 + {
  648 + cableFile <<"no_ground_plane\n";
  649 + }
682 650  
683   - cableFile >> inner_conductor_radius;
684   - std::getline(cableFile, str); //Read to end of line
685   - cableFile >> inner_dielectric_radius;
686   - std::getline(cableFile, str); //Read to end of line
687   - cableFile >> conductor_separation;
688   - std::getline(cableFile, str); //Read to end of line
689   - cableFile >> shield_radius;
690   - std::getline(cableFile, str); //Read to end of line
691   - cableFile >> shield_thickness;
692   - std::getline(cableFile, str); //Read to end of line
693   - cableFile >> outer_dielectric_radius;
694 651  
695   - float outer_dielectric_Scaledradius,
696   - shield_Scaledthickness,
697   - shield_Scaledradius,
698   - inner_dielectric_Scaledradius,
699   - inner_conductor_Scaledradius,
700   - conductor_Scaledseparation,
701   - scaledxCoord,
702   - scaledyCoord;
  652 + if (CheckBox4->GetValue())
  653 + {
  654 + cableFile << TextCtrl2->GetValue() <<"\t # order for filter fitting\n";
  655 + if (RadioButton1)
  656 + {
  657 + cableFile << "lin # frequency range type for filter fitting type (lin or dB)";
  658 + }
  659 + else
  660 + {
  661 + cableFile << "log # frequency range type for filter fitting type (lin or dB)";
  662 + }
  663 + cableFile << TextCtrl3->GetValue() <<" "<< TextCtrl6->GetValue() <<" "<< TextCtrl7->GetValue() <<"\t # fmin fmax number_of_frequencies for filter fitting";
703 664  
704   - outer_dielectric_Scaledradius = (outer_dielectric_radius/maxDimension)*scaleFactor;
705   - shield_Scaledthickness = (shield_thickness/maxDimension)*scaleFactor;
706   - shield_Scaledradius = (shield_radius/maxDimension)*scaleFactor;
707   - inner_dielectric_Scaledradius = (inner_dielectric_radius/maxDimension)*scaleFactor;
708   - inner_conductor_Scaledradius = (inner_conductor_radius/maxDimension)*scaleFactor;
709   - conductor_Scaledseparation = (conductor_separation/maxDimension)*scaleFactor;
710   - scaledxCoord = 2*(xCoord/maxDimension)*scaleFactor;
711   - scaledyCoord = 2*(yCoord/maxDimension)*scaleFactor;
  665 + }
712 666  
713   - size_h = size_h + scaledxCoord;
714   - size_v = size_v + scaledyCoord;
  667 + if (CheckBox2->GetValue())
  668 + {
  669 + cableFile << "use_laplace\n";
  670 + }
  671 + else
  672 + {
  673 + cableFile << "no_laplace\n";
  674 + }
715 675  
716   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
717   - dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
718   - dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_dielectric_Scaledradius );
  676 + if (CheckBox3->GetValue())
  677 + {
  678 + cableFile << "Laplace_boundary_constant\n";
  679 + cableFile << TextCtrl4->GetValue() <<"\n";
  680 + cableFile << "Laplace_surface_mesh_constant\n";
  681 + cableFile << TextCtrl5->GetValue() <<"\n";
  682 + cableFile << "max_mesh_edge_length\n";
  683 + cableFile << TextCtrl9->GetValue() <<"\n";
719 684  
720   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
721   - dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
722   - dc.DrawCircle( wxPoint(size_h/2,size_v/2), shield_Scaledthickness+shield_Scaledradius );
  685 + if (CheckBox1->GetValue())
  686 + {
  687 + cableFile << "gp_edge_length\n";
  688 + cableFile << TextCtrl10->GetValue() <<"\n";
  689 + }
  690 + //CheckBox3 ->SetValue(false);
  691 + }
  692 + }
  693 + cableFile.close();
723 694  
724   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
725   - dc.SetBrush(wxBrush(*wxLIGHT_GREY, wxSOLID));
726   - dc.DrawCircle( wxPoint(size_h/2,size_v/2), shield_Scaledradius );
  695 +}
727 696  
728   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
729   - dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
730   - dc.DrawCircle( wxPoint((size_h/2)+(conductor_Scaledseparation/2),size_v/2), inner_dielectric_Scaledradius );
  697 +// Build Bundle Model
  698 +void BUNDLEBLDR::OnButton2Click(wxCommandEvent& event)
  699 +{
  700 + //clean up directory
  701 + clean_temp_files();
731 702  
732   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
733   - dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
734   - dc.DrawCircle( wxPoint((size_h/2)-(conductor_Scaledseparation/2),size_v/2), inner_dielectric_Scaledradius );
  703 + wxString fileName = TextCtrl1->GetValue();
735 704  
736   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
737   - dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
738   - dc.DrawCircle( wxPoint((size_h/2)+(conductor_Scaledseparation/2),size_v/2), inner_conductor_Scaledradius );
  705 + wxString command_line;
739 706  
740   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
741   - dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
742   - dc.DrawCircle( wxPoint((size_h/2)-(conductor_Scaledseparation/2),size_v/2), inner_conductor_Scaledradius );
743   - }
  707 + wxString separator(wxFileName::GetPathSeparator());
744 708  
745   - if (str.compare("Twisted_pair") == 0 ){
  709 + WriteBundleFile (TextCtrl1->GetValue());
746 710  
747   - std::getline(cableFile, str);
748   - std::getline(cableFile, str);
  711 + std::stringstream stream;
  712 + stream <<"." + separator
  713 + << "cable_bundle_model_builder"
  714 + << " "
  715 + << ".." + separator + MODname + separator + "BUNDLE" + separator
  716 + << fileName ;
749 717  
750   - float conductor_radius, conductor_separation, dielectric_radius;
  718 + command_line << stream.str().c_str();
751 719  
752   - cableFile >> conductor_radius;
753   - std::getline(cableFile, str); //Read to end of line
754   - cableFile >> conductor_separation;
755   - std::getline(cableFile, str); //Read to end of line
756   - cableFile >> dielectric_radius;
  720 + wxExecute (command_line,wxEXEC_SYNC);
757 721  
758   - float conductor_Scaledradius, conductor_Scaledseparation, dielectric_Scaledradius, scaledxCoord, scaledyCoord;
  722 + // Display Run Status
  723 + RUN_STATUS *run_status_bundle = new RUN_STATUS(this);
  724 + run_status_bundle->ShowModal();
759 725  
760   - conductor_Scaledradius = (conductor_radius/maxDimension)*scaleFactor;
761   - conductor_Scaledseparation = (conductor_separation/maxDimension)*scaleFactor;
762   - dielectric_Scaledradius = (dielectric_radius/maxDimension)*scaleFactor;
763   - scaledxCoord = 2*(xCoord/maxDimension)*scaleFactor;
764   - scaledyCoord = 2*(yCoord/maxDimension)*scaleFactor;
  726 + DrawBundleCsection();
765 727  
766   - size_h = size_h + scaledxCoord;
767   - size_v = size_v + scaledyCoord;
  728 + Button1->Enable();
768 729  
769   - float wire_pos = (conductor_Scaledseparation/2)*0.707;
  730 + if (CheckBox2->GetValue())
  731 + {
  732 + wxString pattern(("*.msh.vtk"));
  733 + wxString file;
770 734  
771   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
772   - dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
773   - dc.DrawCircle( wxPoint(size_h/2-wire_pos,size_v/2-wire_pos), conductor_Scaledradius );
  735 + ComboBox1->Clear();
774 736  
  737 + file = wxFindFirstFile(pattern);
775 738  
776   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
777   - dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
778   - dc.DrawCircle( wxPoint(size_h/2-wire_pos,size_v/2-wire_pos), dielectric_Scaledradius );
  739 + while ( !file.empty())
  740 + {
  741 + wxString meshfile = file;
779 742  
780   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
781   - dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
782   - dc.DrawCircle( wxPoint(size_h/2+wire_pos,size_v/2+wire_pos), conductor_Scaledradius );
  743 + size_t extindex = meshfile.find_last_of (".");
783 744  
784   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
785   - dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
786   - dc.DrawCircle( wxPoint(size_h/2+wire_pos,size_v/2+wire_pos), dielectric_Scaledradius );
  745 + meshfile = meshfile.substr(0, extindex);
  746 +
  747 + extindex = meshfile.find_last_of (".");
  748 +
  749 + meshfile = meshfile.substr(0, extindex);
  750 +
  751 + meshfile = meshfile.substr(2,meshfile.length());
  752 +
  753 + ComboBox1->Append(meshfile);
  754 +
  755 + file = wxFindNextFile();
  756 + }
  757 + CheckBox3->Enable();
787 758 }
  759 +
788 760  
789   - if (str.compare("Shielded_twisted_pair") == 0 ){
790 761  
791   - std::getline(cableFile, str);
792   - std::getline(cableFile, str);
  762 +}
793 763  
794   - float inner_conductor_radius, inner_conductor_separation, inner_dielectric_radius, shield_radius, shield_thickness, outer_dielectric_radius;
  764 +void BUNDLEBLDR::OnButton3Click(wxCommandEvent& event)
  765 +{
  766 + //clean up directory
  767 + clean_temp_files();
  768 + Close();
  769 +}
795 770  
796   - cableFile >> inner_conductor_radius;
797   - std::getline(cableFile, str); //Read to end of line
798   - cableFile >> inner_dielectric_radius;
799   - std::getline(cableFile, str); //Read to end of line
800   - cableFile >> inner_conductor_separation;
801   - std::getline(cableFile, str); //Read to end of line
802   - cableFile >> shield_radius;
803   - std::getline(cableFile, str); //Read to end of line
804   - cableFile >> shield_thickness;
805   - std::getline(cableFile, str); //Read to end of line
806   - cableFile >> outer_dielectric_radius;
  771 +void BUNDLEBLDR::OnCheckBox1Click(wxCommandEvent& event)
  772 +{
  773 + int size_h, size_v;
  774 + Panel1->GetSize(&size_h, &size_v );
807 775  
808   - float inner_conductor_Scaledradius,
809   - inner_conductor_Scaledseparation,
810   - inner_dielectric_Scaledradius,
811   - shield_Scaledradius,
812   - shield_Scaledthickness,
813   - outer_dielectric_Scaledradius,
814   - scaledxCoord,
815   - scaledyCoord;
  776 + DrawBundleCsection();
816 777  
817   - inner_conductor_Scaledradius = (inner_conductor_radius/maxDimension)*scaleFactor;
818   - inner_conductor_Scaledseparation = (inner_conductor_separation/maxDimension)*scaleFactor;
819   - inner_dielectric_Scaledradius = (inner_dielectric_radius/maxDimension)*scaleFactor;
820   - shield_Scaledradius = (shield_radius/maxDimension)*scaleFactor;
821   - shield_Scaledthickness = (shield_thickness/maxDimension)*scaleFactor;
822   - outer_dielectric_Scaledradius = (outer_dielectric_radius/maxDimension)*scaleFactor;
823   - scaledxCoord = (xCoord/maxDimension)*scaleFactor;
824   - scaledyCoord = (yCoord/maxDimension)*scaleFactor;
825 778  
826   - size_h = size_h + scaledxCoord;
827   - size_v = size_v + scaledyCoord;
  779 + TextCtrl10->Enable();
  780 +}
828 781  
829   - float wire_pos = (inner_conductor_Scaledseparation/2)*0.707;
  782 +void BUNDLEBLDR::OnCheckBox3Click(wxCommandEvent& event)
  783 +{
  784 + if (CheckBox3->GetValue())
  785 + {
  786 + TextCtrl4->Enable();
  787 + TextCtrl5->Enable();
  788 + TextCtrl9->Enable();
  789 + }
830 790  
831   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
832   - dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
833   - dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_dielectric_Scaledradius );
  791 + //WriteBundleFile (TextCtrl1->GetValue());
  792 +}
834 793  
835   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
836   - dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
837   - dc.DrawCircle( wxPoint(size_h/2,size_v/2), shield_Scaledthickness+shield_Scaledradius );
  794 +void BUNDLEBLDR::OnComboBox1Selected(wxCommandEvent& event)
  795 +{
  796 + wxString meshToView;
  797 + meshToView<<ComboBox1->GetValue();
  798 + draw_mesh(Panel1,meshToView, scale);
838 799  
839   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
840   - dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
841   - dc.DrawCircle( wxPoint(size_h/2,size_v/2), shield_Scaledradius );
  800 + MeshSelected = 1;
842 801  
843   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
844   - dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
845   - dc.DrawCircle( wxPoint(size_h/2-wire_pos,size_v/2-wire_pos), inner_dielectric_Scaledradius );
  802 + TextCtrl8->Disable();
  803 +}
846 804  
847   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
848   - dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
849   - dc.DrawCircle( wxPoint(size_h/2-wire_pos,size_v/2-wire_pos), inner_conductor_Scaledradius );
  805 +void BUNDLEBLDR::OnTextCtrl4Text(wxCommandEvent& event)
  806 +{
  807 + TextCtrl4->SetForegroundColour(*wxBLACK);
  808 + int IsError = 0;
  809 + check_is_numeric(TextCtrl4, &IsError);
  810 +}
850 811  
851   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
852   - dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
853   - dc.DrawCircle( wxPoint(size_h/2+wire_pos,size_v/2+wire_pos), inner_dielectric_Scaledradius );
  812 +void BUNDLEBLDR::OnInit(wxInitDialogEvent& event)
  813 +{
  814 + TextCtrl4->SetForegroundColour(*wxLIGHT_GREY);
  815 + TextCtrl5->SetForegroundColour(*wxLIGHT_GREY);
  816 +}
854 817  
855   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
856   - dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
857   - dc.DrawCircle( wxPoint(size_h/2+wire_pos,size_v/2+wire_pos), inner_conductor_Scaledradius );
  818 +void BUNDLEBLDR::OnTextCtrl5Text(wxCommandEvent& event)
  819 +{
  820 + TextCtrl5->SetForegroundColour(*wxBLACK);
  821 + int IsError = 0;
  822 + check_is_numeric(TextCtrl5, &IsError);
  823 +}
  824 +
  825 +void BUNDLEBLDR::OnSpinButton1Change(wxSpinEvent& event)
  826 +{
  827 +
  828 +}
  829 +
  830 +void BUNDLEBLDR::OnTextCtrl8TextEnter(wxCommandEvent& event)
  831 +{
  832 + double maxDimension;
  833 +
  834 + wxString maxXY = TextCtrl8->GetValue();
  835 +
  836 + maxXY.ToDouble(&maxDimension);
  837 +
  838 +
  839 + if (MeshSelected == 1)
  840 + {
  841 + scale = scale + 0.1;
  842 +
  843 + wxString meshToView;
  844 + meshToView<<ComboBox1->GetValue();
  845 + draw_mesh(Panel1,meshToView, scale);
858 846 }
859 847  
860   - if (str.compare("Spacewire") == 0 ){
  848 + else
  849 + {
  850 + DrawBundleCsection();
  851 + }
861 852  
862   - std::getline(cableFile, str);
863   - std::getline(cableFile, str);
  853 +}
864 854  
865   - float inner_conductor_radius, inner_conductor_separation, inner_dielectric_radius, inner_shield_radius, inner_shield_thickness,
866   - inner_shield_jacket_radius, shielded_twisted_pair_radius, outer_shield_radius, outer_shield_thickness, outer_dielectric_radius;
  855 +void BUNDLEBLDR::OnSpinButton1ChangeUp(wxSpinEvent& event)
  856 +{
  857 + double maxDimension;
867 858  
868   - cableFile >> inner_conductor_radius;
869   - std::getline(cableFile, str); //Read to end of line
870   - cableFile >> inner_dielectric_radius;
871   - std::getline(cableFile, str); //Read to end of line
872   - cableFile >> inner_conductor_separation;
873   - std::getline(cableFile, str); //Read to end of line
874   - cableFile >> inner_shield_radius;
875   - std::getline(cableFile, str); //Read to end of line
876   - cableFile >> inner_shield_thickness;
877   - std::getline(cableFile, str); //Read to end of line
878   - cableFile >> inner_shield_jacket_radius;
879   - std::getline(cableFile, str); //Read to end of line
880   - cableFile >> shielded_twisted_pair_radius;
881   - std::getline(cableFile, str); //Read to end of line
882   - cableFile >> outer_shield_radius;
883   - std::getline(cableFile, str); //Read to end of line
884   - cableFile >> outer_shield_thickness;
885   - std::getline(cableFile, str); //Read to end of line
886   - cableFile >> outer_dielectric_radius;
  859 + wxString maxXY = TextCtrl8->GetValue();
887 860  
888   - float inner_conductor_Scaledradius,
889   - inner_dielectric_Scaledradius,
890   - inner_conductor_Scaledseparation,
891   - inner_shield_Scaledradius,
892   - inner_shield_Scaledthickness,
893   - inner_shield_jacket_Scaledradius,
894   - shielded_twisted_pair_Scaledradius,
895   - outer_shield_Scaledradius,
896   - outer_shield_Scaledthickness,
897   - outer_dielectric_Scaledradius,
898   - scaledxCoord,
899   - scaledyCoord;
  861 + maxXY.ToDouble(&maxDimension);
900 862  
901   - inner_conductor_Scaledradius = (inner_conductor_radius/maxDimension)*scaleFactor;
902   - inner_dielectric_Scaledradius = (inner_dielectric_radius/maxDimension)*scaleFactor;
903   - inner_conductor_Scaledseparation = (inner_conductor_separation/maxDimension)*scaleFactor;
904   - inner_shield_Scaledradius = (inner_shield_radius/maxDimension)*scaleFactor;
905   - inner_shield_Scaledthickness = (inner_shield_thickness/maxDimension)*scaleFactor;
906   - inner_shield_jacket_Scaledradius = (inner_shield_jacket_radius/maxDimension)*scaleFactor;
907   - shielded_twisted_pair_Scaledradius = (shielded_twisted_pair_radius/maxDimension)*scaleFactor;
908   - outer_shield_Scaledradius = (outer_shield_radius/maxDimension)*scaleFactor;
909   - outer_shield_Scaledthickness = (outer_shield_thickness/maxDimension)*scaleFactor;
910   - outer_dielectric_Scaledradius = (outer_dielectric_radius/maxDimension)*scaleFactor;
911   - scaledxCoord = (xCoord/maxDimension)*scaleFactor;
912   - scaledyCoord = (yCoord/maxDimension)*scaleFactor;
  863 + maxDimension = maxDimension + 0.001;
913 864  
914   - size_h = size_h + scaledxCoord;
915   - size_v = size_v + scaledyCoord;
  865 + maxXY = "";
916 866  
917   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
918   - dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
919   - dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_dielectric_Scaledradius );
  867 + maxXY << maxDimension;
920 868  
921   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
922   - dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
923   - dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_shield_Scaledthickness+outer_shield_Scaledradius );
  869 + TextCtrl8 ->SetValue(maxXY);
924 870  
925   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
926   - dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
927   - dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_shield_Scaledradius );
928 871  
929   - //TP Top
930   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
931   - dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
932   - dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_Scaledradius)), inner_shield_jacket_Scaledradius );
  872 + if (MeshSelected == 1)
  873 + {
  874 + scale = scale + 0.05;
933 875  
934   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
935   - dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
936   - dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_Scaledradius)), inner_shield_Scaledthickness + inner_shield_Scaledradius );
  876 + wxString meshToView;
  877 + meshToView<<ComboBox1->GetValue();
  878 + draw_mesh(Panel1,meshToView, scale);
  879 + }
937 880  
938   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
939   - dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
940   - dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_Scaledradius)), inner_shield_Scaledradius );
  881 + else
  882 + {
  883 + DrawBundleCsection();
  884 + }
941 885  
942   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
943   - dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
944   - dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2)), inner_dielectric_Scaledradius );
  886 +}
945 887  
946   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
947   - dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
948   - dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2)), inner_dielectric_Scaledradius );
  888 +void BUNDLEBLDR::OnSpinButton1ChangeDown(wxSpinEvent& event)
  889 +{
  890 + double maxDimension;
949 891  
950   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
951   - dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
952   - dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2)), inner_conductor_Scaledradius );
  892 + wxString maxXY = TextCtrl8->GetValue();
953 893  
954   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
955   - dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
956   - dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2)), inner_conductor_Scaledradius );
  894 + maxXY.ToDouble(&maxDimension);
957 895  
  896 + maxDimension = maxDimension - 0.001;
958 897  
959   - //TP Left
960   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
961   - dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
962   - dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius),size_v/2), inner_shield_jacket_Scaledradius );
  898 + if (maxDimension <=0) maxDimension = 0;
  899 +
  900 + maxXY = "";
  901 +
  902 + maxXY << maxDimension;
  903 +
  904 + TextCtrl8 ->SetValue(maxXY);
  905 +
  906 +
  907 + if (MeshSelected == 1)
  908 + {
  909 + scale = scale - 0.05;
  910 +
  911 + if (scale <= 0.05) scale = 0.05;
  912 +
  913 + wxString meshToView;
  914 + meshToView<<ComboBox1->GetValue();
  915 + draw_mesh(Panel1,meshToView, scale);
  916 + }
  917 +
  918 + else
  919 + {
  920 + DrawBundleCsection();
  921 + }
  922 +}
963 923  
964   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
965   - dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
966   - dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius),size_v/2), inner_shield_Scaledthickness + inner_shield_Scaledradius );
967 924  
968   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
969   - dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
970   - dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius),size_v/2), inner_shield_Scaledradius );
971 925  
972   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
973   - dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
974   - dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2),size_v/2), inner_dielectric_Scaledradius );
975 926  
976   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
977   - dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
978   - dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2),size_v/2), inner_dielectric_Scaledradius );
979 927  
980   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
981   - dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
982   - dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2),size_v/2), inner_conductor_Scaledradius );
983 928  
984   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
985   - dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
986   - dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2),size_v/2), inner_conductor_Scaledradius );
  929 +//=====================================================================================
  930 +// Draw routines
987 931  
988   - //TP Bottom
989   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
990   - dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
991   - dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_Scaledradius)), inner_shield_jacket_Scaledradius );
  932 +void BUNDLEBLDR::DrawBundleCable(wxString cable, wxString x, wxString y, wxString rot)
  933 +{
  934 + wxString separator(wxFileName::GetPathSeparator());
992 935  
993   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
994   - dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
995   - dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_Scaledradius)), inner_shield_Scaledthickness + inner_shield_Scaledradius );
  936 + double xCoord, yCoord, rotation, maxDimension;
996 937  
997   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
998   - dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
999   - dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_Scaledradius)), inner_shield_Scaledradius );
  938 + x.ToDouble(&xCoord);
  939 + y.ToDouble(&yCoord);
  940 + rot.ToDouble(&rotation);
1000 941  
1001   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
1002   - dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
1003   - dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2)), inner_dielectric_Scaledradius );
  942 + yCoord = -1.0 * yCoord;
1004 943  
1005   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
1006   - dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
1007   - dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2)), inner_dielectric_Scaledradius );
  944 + int size_h, size_v;
  945 + Panel1->GetSize(&size_h, &size_v );
1008 946  
1009   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
1010   - dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
1011   - dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2)), inner_conductor_Scaledradius );
  947 + wxClientDC dc(Panel1);
1012 948  
1013   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
1014   - dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
1015   - dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2)), inner_conductor_Scaledradius );
  949 + std::stringstream stream;
  950 + stream << PathToMOD << separator << "CABLE"<< separator << cable;
1016 951  
1017   - //TP Right
1018   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
1019   - dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
1020   - dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius),size_v/2), inner_shield_jacket_Scaledradius );
  952 + cable = (stream.str().c_str());
1021 953  
1022   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
1023   - dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
1024   - dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius),size_v/2), inner_shield_Scaledthickness + inner_shield_Scaledradius );
  954 + std::ifstream cableFile;
  955 + cableFile.open (cable);
1025 956  
1026   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
1027   - dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
1028   - dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius),size_v/2), inner_shield_Scaledradius );
  957 + std::string str;
1029 958  
1030   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
1031   - dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
1032   - dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2),size_v/2), inner_dielectric_Scaledradius );
  959 + std::getline(cableFile, str);
  960 + std::getline(cableFile, str);
  961 + std::getline(cableFile, str);
1033 962  
1034   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
1035   - dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
1036   - dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2),size_v/2), inner_dielectric_Scaledradius );
  963 + float scaleFactor = (size_h/2 * 1.0);
1037 964  
1038   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
1039   - dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
1040   - dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2),size_v/2), inner_conductor_Scaledradius );
  965 + wxString maxXY = TextCtrl8->GetValue();
1041 966  
1042   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
1043   - dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
1044   - dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2),size_v/2), inner_conductor_Scaledradius );
1045   - }
  967 + maxXY.ToDouble(&maxDimension);
1046 968  
1047   - if (str.compare("Overshield") == 0 ){
  969 + if (str.compare("Cylindrical") == 0 ){
1048 970  
1049 971 std::getline(cableFile, str);
1050 972 std::getline(cableFile, str);
1051 973  
1052   - float overshield_radius, overshield_thickness;
  974 + float conductor_radius, dielectric_radius;
1053 975  
1054   - cableFile >> overshield_radius;
  976 + cableFile >> conductor_radius;
1055 977 std::getline(cableFile, str); //Read to end of line
1056   - cableFile >> overshield_thickness;
1057   -
  978 + cableFile >> dielectric_radius;
1058 979  
1059   - float overshield_Scaledradius, overshield_Scaledthickness, scaledxCoord, scaledyCoord;
  980 + float dielectric_Scaledradius,conductor_Scaledradius, scaledxCoord, scaledyCoord;
1060 981  
1061   - overshield_Scaledradius = (overshield_radius/maxDimension)*scaleFactor;
1062   - overshield_Scaledthickness = (overshield_thickness/maxDimension)*scaleFactor;
  982 + dielectric_Scaledradius = (dielectric_radius/maxDimension)*scaleFactor;
  983 + conductor_Scaledradius = (conductor_radius/maxDimension)*scaleFactor;
1063 984 scaledxCoord = (xCoord/maxDimension)*scaleFactor;
1064 985 scaledyCoord = (yCoord/maxDimension)*scaleFactor;
1065 986  
1066   - size_h = size_h + scaledxCoord;
1067   - size_v = size_v + scaledyCoord;
1068   -
  987 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  988 + dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
  989 + dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2+scaledyCoord), dielectric_Scaledradius );
1069 990 dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
1070 991 dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
1071   - dc.DrawCircle( wxPoint(size_h/2,size_v/2), overshield_Scaledthickness+overshield_Scaledradius );
  992 + dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2+scaledyCoord), conductor_Scaledradius );
1072 993  
1073   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
1074   - dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
1075   - dc.DrawCircle( wxPoint(size_h/2,size_v/2), overshield_Scaledradius );
1076 994 }
1077 995  
1078   - if (str.compare("flex_cable") == 0 ){
  996 + if (str.compare("Coax") == 0 ){
1079 997  
1080   - float dielectric_width, dielectric_height, conductor_rows;
  998 + std::getline(cableFile, str);
  999 + std::getline(cableFile, str);
1081 1000  
  1001 + float inner_conductor_radius, shield_radius, outer_insulation, shield_thickness;
  1002 +
  1003 + cableFile >> inner_conductor_radius;
1082 1004 std::getline(cableFile, str); //Read to end of line
  1005 + cableFile >> shield_radius;
1083 1006 std::getline(cableFile, str); //Read to end of line
1084   - cableFile >> dielectric_width;
1085   - std::getline(cableFile, str); //Read to end of line
1086   - cableFile >> dielectric_height;
  1007 + cableFile >> outer_insulation;
1087 1008 std::getline(cableFile, str); //Read to end of line
1088   - cableFile >> conductor_rows;
1089 1009 std::getline(cableFile, str); //Read to end of line
  1010 + cableFile >> shield_thickness;
1090 1011  
1091   - float scaled_dielectric_width, scaled_dielectric_height, scaledxCoord, scaledyCoord;
  1012 + float inner_conductor_Scaledradius, shield_Scaledradius, outer_Scaledinsulation, shield_Scaledthickness, scaledxCoord, scaledyCoord;
1092 1013  
1093   - float dx1,dy1,dx2,dy2,dx3,dy3,dx4,dy4, tempx, tempy, rotation_rad;
  1014 + outer_Scaledinsulation = (outer_insulation/maxDimension)*scaleFactor;
  1015 + shield_Scaledthickness = (shield_thickness/maxDimension)*scaleFactor;
  1016 + shield_Scaledradius = (shield_radius/maxDimension)*scaleFactor;
  1017 + inner_conductor_Scaledradius = (inner_conductor_radius/maxDimension)*scaleFactor;
  1018 + scaledxCoord = (xCoord/maxDimension)*scaleFactor;
  1019 + scaledyCoord = (yCoord/maxDimension)*scaleFactor;
1094 1020  
1095   - scaled_dielectric_width = (dielectric_width/maxDimension) * scaleFactor;
1096   - scaled_dielectric_height = (dielectric_height/maxDimension) * scaleFactor;
  1021 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1022 + dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
  1023 + dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2+scaledyCoord), outer_Scaledinsulation );
1097 1024  
1098   - scaledxCoord = xCoord/maxDimension * scaleFactor;
1099   - scaledyCoord = yCoord/maxDimension * scaleFactor;
  1025 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1026 + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
  1027 + dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2+scaledyCoord), shield_Scaledthickness+shield_Scaledradius );
1100 1028  
1101   - rotation_rad = rotation * (PI/180.0);
  1029 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1030 + dc.SetBrush(wxBrush(*wxLIGHT_GREY, wxSOLID));
  1031 + dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2+scaledyCoord), shield_Scaledradius );
1102 1032  
1103   - float s = sin(rotation_rad);
1104   - float c = cos(rotation_rad);
  1033 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1034 + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
  1035 + dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2+scaledyCoord), inner_conductor_Scaledradius );
1105 1036  
1106   - dx1 = -scaled_dielectric_width/2;
1107   - dy1 = scaled_dielectric_height/2;
  1037 + }
1108 1038  
1109   - tempx = dx1*c - dy1*s;
1110   - tempy = dx1*s + dy1*c;
  1039 + if (str.compare("Twinax") == 0 ){
1111 1040  
1112   - dx1 = size_h/2 + tempx + scaledxCoord;
1113   - dy1 = size_v/2 + tempy + scaledyCoord ;
  1041 + std::getline(cableFile, str);
  1042 + std::getline(cableFile, str);
1114 1043  
1115   - //point 3
1116   - dx2 = -scaled_dielectric_width/2;
1117   - dy2 = -scaled_dielectric_height/2;
  1044 + float inner_conductor_radius, inner_dielectric_radius, conductor_separation, shield_radius, shield_thickness, outer_dielectric_radius;
1118 1045  
1119   - tempx = dx2*c - dy2*s;
1120   - tempy = dx2*s + dy2*c;
  1046 + cableFile >> inner_conductor_radius;
  1047 + std::getline(cableFile, str); //Read to end of line
  1048 + cableFile >> inner_dielectric_radius;
  1049 + std::getline(cableFile, str); //Read to end of line
  1050 + cableFile >> conductor_separation;
  1051 + std::getline(cableFile, str); //Read to end of line
  1052 + cableFile >> shield_radius;
  1053 + std::getline(cableFile, str); //Read to end of line
  1054 + cableFile >> shield_thickness;
  1055 + std::getline(cableFile, str); //Read to end of line
  1056 + cableFile >> outer_dielectric_radius;
1121 1057  
1122   - dx2 = size_h/2 + tempx + scaledxCoord;
1123   - dy2 = size_v/2 + tempy + scaledyCoord;
  1058 + float outer_dielectric_Scaledradius,
  1059 + shield_Scaledthickness,
  1060 + shield_Scaledradius,
  1061 + inner_dielectric_Scaledradius,
  1062 + inner_conductor_Scaledradius,
  1063 + conductor_Scaledseparation,
  1064 + scaledxCoord,
  1065 + scaledyCoord;
1124 1066  
1125   - //point 3
1126   - dx3 = scaled_dielectric_width/2;
1127   - dy3 = -scaled_dielectric_height/2;
  1067 + outer_dielectric_Scaledradius = (outer_dielectric_radius/maxDimension)*scaleFactor;
  1068 + shield_Scaledthickness = (shield_thickness/maxDimension)*scaleFactor;
  1069 + shield_Scaledradius = (shield_radius/maxDimension)*scaleFactor;
  1070 + inner_dielectric_Scaledradius = (inner_dielectric_radius/maxDimension)*scaleFactor;
  1071 + inner_conductor_Scaledradius = (inner_conductor_radius/maxDimension)*scaleFactor;
  1072 + conductor_Scaledseparation = (conductor_separation/maxDimension)*scaleFactor;
  1073 + scaledxCoord = 2*(xCoord/maxDimension)*scaleFactor;
  1074 + scaledyCoord = 2*(yCoord/maxDimension)*scaleFactor;
1128 1075  
1129   - tempx = dx3*c - dy3*s;
1130   - tempy = dx3*s + dy3*c;
  1076 + size_h = size_h + scaledxCoord;
  1077 + size_v = size_v + scaledyCoord;
1131 1078  
1132   - dx3 = size_h/2 + tempx + scaledxCoord;
1133   - dy3 = size_v/2 + tempy + scaledyCoord;
  1079 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1080 + dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
  1081 + dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_dielectric_Scaledradius );
1134 1082  
1135   - //point 4
1136   - dx4 = scaled_dielectric_width/2;
1137   - dy4 = scaled_dielectric_height/2;
  1083 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1084 + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
  1085 + dc.DrawCircle( wxPoint(size_h/2,size_v/2), shield_Scaledthickness+shield_Scaledradius );
1138 1086  
1139   - tempx = dx4*c - dy4*s;
1140   - tempy = dx4*s + dy4*c;
  1087 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1088 + dc.SetBrush(wxBrush(*wxLIGHT_GREY, wxSOLID));
  1089 + dc.DrawCircle( wxPoint(size_h/2,size_v/2), shield_Scaledradius );
1141 1090  
1142   - dx4 = size_h/2 + tempx + scaledxCoord;
1143   - dy4 = size_v/2 + tempy + scaledyCoord;
  1091 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1092 + dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
  1093 + dc.DrawCircle( wxPoint((size_h/2)+(conductor_Scaledseparation/2),size_v/2), inner_dielectric_Scaledradius );
1144 1094  
  1095 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1096 + dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
  1097 + dc.DrawCircle( wxPoint((size_h/2)-(conductor_Scaledseparation/2),size_v/2), inner_dielectric_Scaledradius );
1145 1098  
1146 1099 dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
1147   - dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
  1100 + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
  1101 + dc.DrawCircle( wxPoint((size_h/2)+(conductor_Scaledseparation/2),size_v/2), inner_conductor_Scaledradius );
1148 1102  
1149   - dc.DrawLine(dx1, dy1, dx2, dy2);
1150   - dc.DrawLine(dx2, dy2, dx3, dy3);
1151   - dc.DrawLine(dx3, dy3, dx4, dy4);
1152   - dc.DrawLine(dx4, dy4, dx1, dy1);
  1103 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1104 + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
  1105 + dc.DrawCircle( wxPoint((size_h/2)-(conductor_Scaledseparation/2),size_v/2), inner_conductor_Scaledradius );
  1106 + }
1153 1107  
1154   - float offset_x, offset_y, width, height,separation, conductors;
  1108 + if (str.compare("Twisted_pair") == 0 ){
1155 1109  
1156   - for (int i = 0; i < conductor_rows;i++){
1157   - cableFile >> offset_x;
1158   - std::getline(cableFile, str); //Read to end of line
  1110 + std::getline(cableFile, str);
  1111 + std::getline(cableFile, str);
1159 1112  
1160   - cableFile >> offset_y;
1161   - std::getline(cableFile, str); //Read to end of line
  1113 + float conductor_radius, conductor_separation, dielectric_radius;
  1114 +
  1115 + cableFile >> conductor_radius;
  1116 + std::getline(cableFile, str); //Read to end of line
  1117 + cableFile >> conductor_separation;
  1118 + std::getline(cableFile, str); //Read to end of line
  1119 + cableFile >> dielectric_radius;
1162 1120  
1163   - cableFile >> width;
1164   - std::getline(cableFile, str); //Read to end of line
  1121 + float conductor_Scaledradius, conductor_Scaledseparation, dielectric_Scaledradius, scaledxCoord, scaledyCoord;
1165 1122  
1166   - cableFile >> height;
1167   - std::getline(cableFile, str); //Read to end of line
  1123 + conductor_Scaledradius = (conductor_radius/maxDimension)*scaleFactor;
  1124 + conductor_Scaledseparation = (conductor_separation/maxDimension)*scaleFactor;
  1125 + dielectric_Scaledradius = (dielectric_radius/maxDimension)*scaleFactor;
  1126 + scaledxCoord = 2*(xCoord/maxDimension)*scaleFactor;
  1127 + scaledyCoord = 2*(yCoord/maxDimension)*scaleFactor;
1168 1128  
1169   - cableFile >> separation;
1170   - std::getline(cableFile, str); //Read to end of line
  1129 + size_h = size_h + scaledxCoord;
  1130 + size_v = size_v + scaledyCoord;
1171 1131  
1172   - cableFile >> conductors;
1173   - std::getline(cableFile, str); //Read to end of line
  1132 + float wire_pos = (conductor_Scaledseparation/2)*0.707;
1174 1133  
  1134 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1135 + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
  1136 + dc.DrawCircle( wxPoint(size_h/2-wire_pos,size_v/2-wire_pos), conductor_Scaledradius );
1175 1137  
1176   - float scaled_conductor_width = width/maxDimension * scaleFactor;
1177   - float scaled_conductor_height = height/maxDimension * scaleFactor;
1178   - float scaled_conductor_separation = separation/maxDimension * scaleFactor;
1179   - float scaled_offset_x = offset_x/maxDimension * scaleFactor;
1180   - float scaled_offset_y = offset_y/maxDimension * scaleFactor;
1181 1138  
1182   - //calculate conductor origin, top left corner: start at no.1
1183   - float x_origin = 0 - (scaled_conductor_width * conductors/2) - scaled_conductor_separation*(conductors - 1)/2 + scaled_offset_x;
1184   - float y_origin = scaled_conductor_height/2 + scaled_offset_y;
  1139 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1140 + dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
  1141 + dc.DrawCircle( wxPoint(size_h/2-wire_pos,size_v/2-wire_pos), dielectric_Scaledradius );
1185 1142  
1186   - float cx1,cy1,cx2,cy2,cx3,cy3,cx4,cy4;
  1143 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1144 + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
  1145 + dc.DrawCircle( wxPoint(size_h/2+wire_pos,size_v/2+wire_pos), conductor_Scaledradius );
1187 1146  
1188   - dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
1189   - dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
  1147 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1148 + dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
  1149 + dc.DrawCircle( wxPoint(size_h/2+wire_pos,size_v/2+wire_pos), dielectric_Scaledradius );
  1150 + }
1190 1151  
1191   - for (int j = 0; j<conductors; j++){
  1152 + if (str.compare("Shielded_twisted_pair") == 0 ){
1192 1153  
1193   - //point 1
1194   - cx1 = x_origin + j * (scaled_conductor_width + scaled_conductor_separation);
1195   - cy1 = y_origin;
  1154 + std::getline(cableFile, str);
  1155 + std::getline(cableFile, str);
1196 1156  
1197   - tempx = cx1*c - cy1*s;
1198   - tempy = cx1*s + cy1*c;
  1157 + float inner_conductor_radius, inner_conductor_separation, inner_dielectric_radius, shield_radius, shield_thickness, outer_dielectric_radius;
1199 1158  
1200   - cx1 = tempx + scaledxCoord + size_h/2;
1201   - cy1 = tempy + scaledyCoord + size_v/2;
  1159 + cableFile >> inner_conductor_radius;
  1160 + std::getline(cableFile, str); //Read to end of line
  1161 + cableFile >> inner_dielectric_radius;
  1162 + std::getline(cableFile, str); //Read to end of line
  1163 + cableFile >> inner_conductor_separation;
  1164 + std::getline(cableFile, str); //Read to end of line
  1165 + cableFile >> shield_radius;
  1166 + std::getline(cableFile, str); //Read to end of line
  1167 + cableFile >> shield_thickness;
  1168 + std::getline(cableFile, str); //Read to end of line
  1169 + cableFile >> outer_dielectric_radius;
1202 1170  
1203   - //point 3
1204   - cx2 = x_origin + j * (scaled_conductor_width + scaled_conductor_separation);
1205   - cy2 = y_origin - scaled_conductor_height;
  1171 + float inner_conductor_Scaledradius,
  1172 + inner_conductor_Scaledseparation,
  1173 + inner_dielectric_Scaledradius,
  1174 + shield_Scaledradius,
  1175 + shield_Scaledthickness,
  1176 + outer_dielectric_Scaledradius,
  1177 + scaledxCoord,
  1178 + scaledyCoord;
1206 1179  
1207   - tempx = cx2*c - cy2*s;
1208   - tempy = cx2*s + cy2*c;
  1180 + inner_conductor_Scaledradius = (inner_conductor_radius/maxDimension)*scaleFactor;
  1181 + inner_conductor_Scaledseparation = (inner_conductor_separation/maxDimension)*scaleFactor;
  1182 + inner_dielectric_Scaledradius = (inner_dielectric_radius/maxDimension)*scaleFactor;
  1183 + shield_Scaledradius = (shield_radius/maxDimension)*scaleFactor;
  1184 + shield_Scaledthickness = (shield_thickness/maxDimension)*scaleFactor;
  1185 + outer_dielectric_Scaledradius = (outer_dielectric_radius/maxDimension)*scaleFactor;
  1186 + scaledxCoord = (xCoord/maxDimension)*scaleFactor;
  1187 + scaledyCoord = (yCoord/maxDimension)*scaleFactor;
1209 1188  
1210   - cx2 = tempx + scaledxCoord + size_h/2;
1211   - cy2 = tempy + scaledyCoord + size_v/2;
  1189 + size_h = size_h + scaledxCoord;
  1190 + size_v = size_v + scaledyCoord;
1212 1191  
1213   - //point 3
1214   - cx3 = x_origin + scaled_conductor_width + j * (scaled_conductor_width + scaled_conductor_separation);
1215   - cy3 = y_origin - scaled_conductor_height;
  1192 + float wire_pos = (inner_conductor_Scaledseparation/2)*0.707;
1216 1193  
1217   - tempx = cx3*c - cy3*s;
1218   - tempy = cx3*s + cy3*c;
  1194 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1195 + dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
  1196 + dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_dielectric_Scaledradius );
1219 1197  
1220   - cx3 = tempx + scaledxCoord + size_h/2;
1221   - cy3 = tempy + scaledyCoord + size_v/2;
  1198 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1199 + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
  1200 + dc.DrawCircle( wxPoint(size_h/2,size_v/2), shield_Scaledthickness+shield_Scaledradius );
1222 1201  
1223   - //point 4
1224   - cx4 = x_origin + scaled_conductor_width + j * (scaled_conductor_width + scaled_conductor_separation);
1225   - cy4 = y_origin;
  1202 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1203 + dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
  1204 + dc.DrawCircle( wxPoint(size_h/2,size_v/2), shield_Scaledradius );
1226 1205  
1227   - tempx = cx4*c - cy4*s;
1228   - tempy = cx4*s + cy4*c;
  1206 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1207 + dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
  1208 + dc.DrawCircle( wxPoint(size_h/2-wire_pos,size_v/2-wire_pos), inner_dielectric_Scaledradius );
1229 1209  
1230   - cx4 = tempx + scaledxCoord + size_h/2;
1231   - cy4 = tempy + scaledyCoord + size_v/2;
  1210 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1211 + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
  1212 + dc.DrawCircle( wxPoint(size_h/2-wire_pos,size_v/2-wire_pos), inner_conductor_Scaledradius );
1232 1213  
1233   - dc.DrawLine(cx1, cy1, cx2, cy2);
1234   - dc.DrawLine(cx2, cy2, cx3, cy3);
1235   - dc.DrawLine(cx3, cy3, cx4, cy4);
1236   - dc.DrawLine(cx4, cy4, cx1, cy1);
1237   - }
1238   - }
  1214 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1215 + dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
  1216 + dc.DrawCircle( wxPoint(size_h/2+wire_pos,size_v/2+wire_pos), inner_dielectric_Scaledradius );
1239 1217  
  1218 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1219 + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
  1220 + dc.DrawCircle( wxPoint(size_h/2+wire_pos,size_v/2+wire_pos), inner_conductor_Scaledradius );
1240 1221 }
1241 1222  
1242   - if (str.compare("Dconnector") == 0 ){
  1223 + if (str.compare("Spacewire") == 0 ){
1243 1224  
1244   - float conductors, conductor_radius, conductor_pitch, conductor_separation, shell_offset;
  1225 + std::getline(cableFile, str);
  1226 + std::getline(cableFile, str);
1245 1227  
1246   - cableFile >> conductors;
  1228 + float inner_conductor_radius, inner_conductor_separation, inner_dielectric_radius, inner_shield_radius, inner_shield_thickness,
  1229 + inner_shield_jacket_radius, shielded_twisted_pair_radius, outer_shield_radius, outer_shield_thickness, outer_dielectric_radius;
  1230 +
  1231 + cableFile >> inner_conductor_radius;
  1232 + std::getline(cableFile, str); //Read to end of line
  1233 + cableFile >> inner_dielectric_radius;
1247 1234 std::getline(cableFile, str); //Read to end of line
  1235 + cableFile >> inner_conductor_separation;
1248 1236 std::getline(cableFile, str); //Read to end of line
1249   - cableFile >> conductor_radius;
  1237 + cableFile >> inner_shield_radius;
1250 1238 std::getline(cableFile, str); //Read to end of line
1251   - cableFile >> conductor_pitch;
  1239 + cableFile >> inner_shield_thickness;
1252 1240 std::getline(cableFile, str); //Read to end of line
1253   - cableFile >> conductor_separation;
  1241 + cableFile >> inner_shield_jacket_radius;
1254 1242 std::getline(cableFile, str); //Read to end of line
1255   - cableFile >> shell_offset;
1256   -
1257   -// float totalWidth = (conductors/2 * conductor_separation) + (2 * shell_offset) + (2 * conductor_radius);
  1243 + cableFile >> shielded_twisted_pair_radius;
  1244 + std::getline(cableFile, str); //Read to end of line
  1245 + cableFile >> outer_shield_radius;
  1246 + std::getline(cableFile, str); //Read to end of line
  1247 + cableFile >> outer_shield_thickness;
  1248 + std::getline(cableFile, str); //Read to end of line
  1249 + cableFile >> outer_dielectric_radius;
1258 1250  
1259   - float conductor_Scaledradius,
1260   - conductor_Scaledpitch,
1261   - conductor_Scaledseparation,
  1251 + float inner_conductor_Scaledradius,
  1252 + inner_dielectric_Scaledradius,
  1253 + inner_conductor_Scaledseparation,
  1254 + inner_shield_Scaledradius,
  1255 + inner_shield_Scaledthickness,
  1256 + inner_shield_jacket_Scaledradius,
  1257 + shielded_twisted_pair_Scaledradius,
  1258 + outer_shield_Scaledradius,
  1259 + outer_shield_Scaledthickness,
  1260 + outer_dielectric_Scaledradius,
1262 1261 scaledxCoord,
1263 1262 scaledyCoord;
1264 1263  
1265   -
1266   - float x_origin, y_origin;
1267   -
1268   - scaleFactor = (size_h * 0.25);
1269   -
1270   - conductor_Scaledradius = (conductor_radius/maxDimension)*scaleFactor;
1271   - conductor_Scaledpitch = (conductor_pitch/maxDimension)*scaleFactor;
1272   - conductor_Scaledseparation = (conductor_separation/maxDimension)*scaleFactor;
1273   -
  1264 + inner_conductor_Scaledradius = (inner_conductor_radius/maxDimension)*scaleFactor;
  1265 + inner_dielectric_Scaledradius = (inner_dielectric_radius/maxDimension)*scaleFactor;
  1266 + inner_conductor_Scaledseparation = (inner_conductor_separation/maxDimension)*scaleFactor;
  1267 + inner_shield_Scaledradius = (inner_shield_radius/maxDimension)*scaleFactor;
  1268 + inner_shield_Scaledthickness = (inner_shield_thickness/maxDimension)*scaleFactor;
  1269 + inner_shield_jacket_Scaledradius = (inner_shield_jacket_radius/maxDimension)*scaleFactor;
  1270 + shielded_twisted_pair_Scaledradius = (shielded_twisted_pair_radius/maxDimension)*scaleFactor;
  1271 + outer_shield_Scaledradius = (outer_shield_radius/maxDimension)*scaleFactor;
  1272 + outer_shield_Scaledthickness = (outer_shield_thickness/maxDimension)*scaleFactor;
  1273 + outer_dielectric_Scaledradius = (outer_dielectric_radius/maxDimension)*scaleFactor;
1274 1274 scaledxCoord = (xCoord/maxDimension)*scaleFactor;
1275 1275 scaledyCoord = (yCoord/maxDimension)*scaleFactor;
1276 1276  
... ... @@ -1278,404 +1278,416 @@ void BUNDLEBLDR::DrawBundleCable(wxString cable, wxString x, wxString y, wxStrin
1278 1278 size_v = size_v + scaledyCoord;
1279 1279  
1280 1280 dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
1281   - dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
1282   -
1283   - // Upper conductors & Shell
1284   - int upper_conductors = conductors / 2;
1285   - x_origin = (size_h/2) - (upper_conductors/2 * conductor_Scaledseparation);
1286   - y_origin = (size_v/2) - (conductor_Scaledpitch);
  1281 + dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
  1282 + dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_dielectric_Scaledradius );
1287 1283  
1288 1284 dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
1289   - dc.SetBrush(wxBrush(*wxBLACK));
1290   -
1291   - for(int i=0;i<upper_conductors;i++){
1292   -
1293   - dc.DrawCircle( wxPoint(x_origin,y_origin), conductor_Scaledradius );
1294   - x_origin = x_origin + (conductor_Scaledpitch);
1295   - }
1296   - // Lower conductors
1297   - int lower_conductors = (conductors / 2) - 1;
1298   - x_origin = (size_h/2) - (lower_conductors/2 * conductor_Scaledseparation) + conductor_Scaledseparation/2;
1299   - y_origin = (size_v/2) + (conductor_Scaledpitch); // This isn't correct!!
1300   -
1301   - for(int i=0;i<lower_conductors;i++){
1302   -
1303   - dc.DrawCircle( wxPoint(x_origin,y_origin), conductor_Scaledradius );
1304   - x_origin = x_origin + (conductor_Scaledpitch);
1305   - }
1306   - }
1307   -
1308   - if(CheckBox1->GetValue())
1309   - {
1310   - // Ground Plane
1311   - int size_hl, size_vl;
1312   - Panel1->GetSize(&size_hl, &size_vl );
1313   - dc.SetPen( wxPen( (*wxBLACK) ,5 , wxSOLID) );
1314   - dc.DrawLine( 0, size_vl/2, size_hl,size_vl/2 );
1315   - }
  1285 + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
  1286 + dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_shield_Scaledthickness+outer_shield_Scaledradius );
1316 1287  
1317   -}
  1288 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1289 + dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
  1290 + dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_shield_Scaledradius );
1318 1291  
1319   -void BUNDLEBLDR::OnButton1Click(wxCommandEvent& event)
1320   -{
1321   - int IsError = 0;
  1292 + //TP Top
  1293 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1294 + dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
  1295 + dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_Scaledradius)), inner_shield_jacket_Scaledradius );
1322 1296  
1323   - wxString fileName = TextCtrl1->GetValue();
  1297 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1298 + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
  1299 + dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_Scaledradius)), inner_shield_Scaledthickness + inner_shield_Scaledradius );
1324 1300  
1325   - TextCtrl1->SetBackgroundColour(wxColor(255,255,255));
  1301 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1302 + dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
  1303 + dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_Scaledradius)), inner_shield_Scaledradius );
1326 1304  
1327   - if (fileName == "")
1328   - {
1329   - wxMessageBox("Please Specify a Cable Name" , _("Missing Cable Name"));
1330   - return;
1331   - }
  1305 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1306 + dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
  1307 + dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2)), inner_dielectric_Scaledradius );
1332 1308  
1333   - WriteBundleFile(fileName);
  1309 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1310 + dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
  1311 + dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2)), inner_dielectric_Scaledradius );
1334 1312  
1335   - Button1->Disable();
1336   -}
  1313 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1314 + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
  1315 + dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2)), inner_conductor_Scaledradius );
1337 1316  
1338   -void BUNDLEBLDR::WriteBundleFile(wxString fileName)
1339   -{
1340   - ofstream cableFile;
1341   - wxString separator(wxFileName::GetPathSeparator());
  1317 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1318 + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
  1319 + dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2)), inner_conductor_Scaledradius );
1342 1320  
1343   - wxString fullFileName = PathToMOD + separator + "BUNDLE" + separator + fileName + ".bundle_spec";
1344 1321  
1345   - cableFile.open (fullFileName);
  1322 + //TP Left
  1323 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1324 + dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
  1325 + dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius),size_v/2), inner_shield_jacket_Scaledradius );
1346 1326  
1347   - if (cableFile.is_open())
1348   - {
1349   - cableFile << "#MOD_cable_lib_dir" << "\n";
  1327 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1328 + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
  1329 + dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius),size_v/2), inner_shield_Scaledthickness + inner_shield_Scaledradius );
1350 1330  
1351   - cableFile <<".." << separator << MODname << separator << "CABLE" << separator <<"\n";
  1331 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1332 + dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
  1333 + dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius),size_v/2), inner_shield_Scaledradius );
1352 1334  
1353   - cableFile << "#MOD_cable_lib_dir" << "\n";
  1335 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1336 + dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
  1337 + dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2),size_v/2), inner_dielectric_Scaledradius );
1354 1338  
1355   - cableFile <<".." << separator << MODname << separator << "BUNDLE" << separator <<"\n";
  1339 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1340 + dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
  1341 + dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2),size_v/2), inner_dielectric_Scaledradius );
1356 1342  
1357   - cableFile << ListBox1->GetCount() << " #Number of cables in bundle, cable list follows\n";
  1343 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1344 + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
  1345 + dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2),size_v/2), inner_conductor_Scaledradius );
1358 1346  
1359   - bundle_list = bundle_root;
  1347 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1348 + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
  1349 + dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2),size_v/2), inner_conductor_Scaledradius );
1360 1350  
1361   - wxString x, y, rot, cable;
  1351 + //TP Bottom
  1352 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1353 + dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
  1354 + dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_Scaledradius)), inner_shield_jacket_Scaledradius );
1362 1355  
1363   - while ( bundle_list->next != NULL )
1364   - {
  1356 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1357 + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
  1358 + dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_Scaledradius)), inner_shield_Scaledthickness + inner_shield_Scaledradius );
1365 1359  
1366   - cable = bundle_list->CableType;
  1360 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1361 + dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
  1362 + dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_Scaledradius)), inner_shield_Scaledradius );
1367 1363  
1368   - //Remove file extension
1369   - size_t lastindex = cable.find_last_of(".");
1370   - wxString cable_name = cable.substr(0, lastindex); //at the moment here requires full path to file
  1364 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1365 + dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
  1366 + dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2)), inner_dielectric_Scaledradius );
1371 1367  
1372   - x = bundle_list->x_offset;
1373   - y = bundle_list->y_offset;
1374   - rot = bundle_list->rot_theta;
  1368 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1369 + dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
  1370 + dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2)), inner_dielectric_Scaledradius );
1375 1371  
1376   - cableFile << cable_name <<"\n";
1377   - cableFile << x << "\t" << y << "\t" << rot << "\n";
  1372 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1373 + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
  1374 + dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2)), inner_conductor_Scaledradius );
1378 1375  
1379   - bundle_list = bundle_list->next;
1380   - }
  1376 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1377 + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
  1378 + dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2)), inner_conductor_Scaledradius );
1381 1379  
1382   - if (CheckBox1->GetValue())
1383   - {
1384   - cableFile << "ground_plane\n";
1385   - }
1386   - else
1387   - {
1388   - cableFile <<"no_ground_plane\n";
1389   - }
  1380 + //TP Right
  1381 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1382 + dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
  1383 + dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius),size_v/2), inner_shield_jacket_Scaledradius );
1390 1384  
  1385 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1386 + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
  1387 + dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius),size_v/2), inner_shield_Scaledthickness + inner_shield_Scaledradius );
1391 1388  
1392   - if (CheckBox4->GetValue())
1393   - {
1394   - cableFile << TextCtrl2->GetValue() <<"\t # order for filter fitting\n";
1395   - if (RadioButton1)
1396   - {
1397   - cableFile << "lin # frequency range type for filter fitting type (lin or dB)";
1398   - }
1399   - else
1400   - {
1401   - cableFile << "log # frequency range type for filter fitting type (lin or dB)";
1402   - }
1403   - cableFile << TextCtrl3->GetValue() <<" "<< TextCtrl6->GetValue() <<" "<< TextCtrl7->GetValue() <<"\t # fmin fmax number_of_frequencies for filter fitting";
  1389 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1390 + dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
  1391 + dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius),size_v/2), inner_shield_Scaledradius );
1404 1392  
1405   - }
  1393 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1394 + dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
  1395 + dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2),size_v/2), inner_dielectric_Scaledradius );
1406 1396  
1407   - if (CheckBox2->GetValue())
1408   - {
1409   - cableFile << "use_laplace\n";
1410   - }
1411   - else
1412   - {
1413   - cableFile << "no_laplace\n";
1414   - }
  1397 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1398 + dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
  1399 + dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2),size_v/2), inner_dielectric_Scaledradius );
1415 1400  
1416   - if (CheckBox3->GetValue())
1417   - {
1418   - cableFile << "Laplace_boundary_constant\n";
1419   - cableFile << TextCtrl4->GetValue() <<"\n";
1420   - cableFile << "Laplace_surface_mesh_constant\n";
1421   - cableFile << TextCtrl5->GetValue() <<"\n";
1422   - cableFile << "max_mesh_edge_length\n";
1423   - cableFile << TextCtrl9->GetValue() <<"\n";
  1401 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1402 + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
  1403 + dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2),size_v/2), inner_conductor_Scaledradius );
1424 1404  
1425   - if (CheckBox1->GetValue())
1426   - {
1427   - cableFile << "gp_edge_length\n";
1428   - cableFile << TextCtrl10->GetValue() <<"\n";
1429   - }
1430   - //CheckBox3 ->SetValue(false);
1431   - }
  1405 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1406 + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
  1407 + dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2),size_v/2), inner_conductor_Scaledradius );
1432 1408 }
1433   - cableFile.close();
1434 1409  
1435   -}
  1410 + if (str.compare("Overshield") == 0 ){
1436 1411  
  1412 + std::getline(cableFile, str);
  1413 + std::getline(cableFile, str);
1437 1414  
1438   -void BUNDLEBLDR::OnButton2Click(wxCommandEvent& event)
1439   -{
1440   - //clean up directory
1441   - clean_temp_files();
  1415 + float overshield_radius, overshield_thickness;
1442 1416  
1443   - wxString fileName = TextCtrl1->GetValue();
  1417 + cableFile >> overshield_radius;
  1418 + std::getline(cableFile, str); //Read to end of line
  1419 + cableFile >> overshield_thickness;
1444 1420  
1445   - wxString command_line;
1446 1421  
1447   - wxString separator(wxFileName::GetPathSeparator());
  1422 + float overshield_Scaledradius, overshield_Scaledthickness, scaledxCoord, scaledyCoord;
1448 1423  
1449   - WriteBundleFile (TextCtrl1->GetValue());
  1424 + overshield_Scaledradius = (overshield_radius/maxDimension)*scaleFactor;
  1425 + overshield_Scaledthickness = (overshield_thickness/maxDimension)*scaleFactor;
  1426 + scaledxCoord = (xCoord/maxDimension)*scaleFactor;
  1427 + scaledyCoord = (yCoord/maxDimension)*scaleFactor;
1450 1428  
1451   - std::stringstream stream;
1452   - stream <<"." + separator
1453   - << "cable_bundle_model_builder"
1454   - << " "
1455   - << ".." + separator + MODname + separator + "BUNDLE" + separator
1456   - << fileName ;
  1429 + size_h = size_h + scaledxCoord;
  1430 + size_v = size_v + scaledyCoord;
1457 1431  
1458   - command_line << stream.str().c_str();
  1432 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1433 + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
  1434 + dc.DrawCircle( wxPoint(size_h/2,size_v/2), overshield_Scaledthickness+overshield_Scaledradius );
1459 1435  
1460   - wxExecute (command_line,wxEXEC_SYNC);
  1436 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1437 + dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
  1438 + dc.DrawCircle( wxPoint(size_h/2,size_v/2), overshield_Scaledradius );
  1439 + }
1461 1440  
1462   - // Display Run Status
1463   - RUN_STATUS *run_status_bundle = new RUN_STATUS(this);
1464   - run_status_bundle->ShowModal();
  1441 + if (str.compare("flex_cable") == 0 ){
1465 1442  
1466   - Button1->Enable();
  1443 + float dielectric_width, dielectric_height, conductor_rows;
1467 1444  
1468   - if (CheckBox2->GetValue())
1469   - {
1470   - wxString pattern(("*.msh.vtk"));
1471   - wxString file;
  1445 + std::getline(cableFile, str); //Read to end of line
  1446 + std::getline(cableFile, str); //Read to end of line
  1447 + cableFile >> dielectric_width;
  1448 + std::getline(cableFile, str); //Read to end of line
  1449 + cableFile >> dielectric_height;
  1450 + std::getline(cableFile, str); //Read to end of line
  1451 + cableFile >> conductor_rows;
  1452 + std::getline(cableFile, str); //Read to end of line
1472 1453  
1473   - ComboBox1->Clear();
  1454 + float scaled_dielectric_width, scaled_dielectric_height, scaledxCoord, scaledyCoord;
1474 1455  
1475   - file = wxFindFirstFile(pattern);
  1456 + float dx1,dy1,dx2,dy2,dx3,dy3,dx4,dy4, tempx, tempy, rotation_rad;
1476 1457  
1477   - while ( !file.empty())
1478   - {
1479   - wxString meshfile = file;
  1458 + scaled_dielectric_width = (dielectric_width/maxDimension) * scaleFactor;
  1459 + scaled_dielectric_height = (dielectric_height/maxDimension) * scaleFactor;
1480 1460  
1481   - size_t extindex = meshfile.find_last_of (".");
  1461 + scaledxCoord = xCoord/maxDimension * scaleFactor;
  1462 + scaledyCoord = yCoord/maxDimension * scaleFactor;
1482 1463  
1483   - meshfile = meshfile.substr(0, extindex);
  1464 + rotation_rad = rotation * (PI/180.0);
1484 1465  
1485   - extindex = meshfile.find_last_of (".");
1486   - int size_h, size_v;
1487   - Panel1->GetSize(&size_h, &size_v );
1488   - meshfile = meshfile.substr(0, extindex);
  1466 + float s = sin(rotation_rad);
  1467 + float c = cos(rotation_rad);
1489 1468  
1490   - meshfile = meshfile.substr(2,meshfile.length());
  1469 + dx1 = -scaled_dielectric_width/2;
  1470 + dy1 = scaled_dielectric_height/2;
1491 1471  
1492   - ComboBox1->Append(meshfile);
  1472 + tempx = dx1*c - dy1*s;
  1473 + tempy = dx1*s + dy1*c;
1493 1474  
1494   - file = wxFindNextFile();
1495   - }
1496   - CheckBox3->Enable();
1497   - }
1498   -}
  1475 + dx1 = size_h/2 + tempx + scaledxCoord;
  1476 + dy1 = size_v/2 + tempy + scaledyCoord ;
1499 1477  
1500   -void BUNDLEBLDR::OnButton3Click(wxCommandEvent& event)
1501   -{
1502   - //PopulateTheDirectoryTree(PathToMOD);
1503   - //clean up directory
1504   - clean_temp_files();
1505   - Close();
1506   -}
  1478 + //point 3
  1479 + dx2 = -scaled_dielectric_width/2;
  1480 + dy2 = -scaled_dielectric_height/2;
1507 1481  
1508   -void BUNDLEBLDR::OnCheckBox1Click(wxCommandEvent& event)
1509   -{
1510   - int size_h, size_v;
1511   - Panel1->GetSize(&size_h, &size_v );
  1482 + tempx = dx2*c - dy2*s;
  1483 + tempy = dx2*s + dy2*c;
1512 1484  
1513   - wxClientDC dc(Panel1);
  1485 + dx2 = size_h/2 + tempx + scaledxCoord;
  1486 + dy2 = size_v/2 + tempy + scaledyCoord;
1514 1487  
1515   - // Ground Plane
1516   - dc.SetPen( wxPen( (*wxBLACK) ,5 , wxSOLID) );
1517   - dc.DrawLine( 0, size_v/2, size_h,size_v/2 );
  1488 + //point 3
  1489 + dx3 = scaled_dielectric_width/2;
  1490 + dy3 = -scaled_dielectric_height/2;
1518 1491  
1519   - TextCtrl10->Enable();
  1492 + tempx = dx3*c - dy3*s;
  1493 + tempy = dx3*s + dy3*c;
1520 1494  
1521   -}
  1495 + dx3 = size_h/2 + tempx + scaledxCoord;
  1496 + dy3 = size_v/2 + tempy + scaledyCoord;
1522 1497  
1523   -void BUNDLEBLDR::OnCheckBox3Click(wxCommandEvent& event)
1524   -{
1525   - if (CheckBox3->GetValue())
1526   - {
1527   - TextCtrl4->Enable();
1528   - TextCtrl5->Enable();
1529   - TextCtrl9->Enable();
1530   - }
  1498 + //point 4
  1499 + dx4 = scaled_dielectric_width/2;
  1500 + dy4 = scaled_dielectric_height/2;
1531 1501  
1532   - //WriteBundleFile (TextCtrl1->GetValue());
1533   -}
  1502 + tempx = dx4*c - dy4*s;
  1503 + tempy = dx4*s + dy4*c;
1534 1504  
1535   -void BUNDLEBLDR::OnComboBox1Selected(wxCommandEvent& event)
1536   -{
1537   - wxString meshToView;
1538   - meshToView<<ComboBox1->GetValue();
1539   - draw_mesh(Panel1,meshToView, scale);
  1505 + dx4 = size_h/2 + tempx + scaledxCoord;
  1506 + dy4 = size_v/2 + tempy + scaledyCoord;
1540 1507  
1541   - MeshSelected = 1;
1542 1508  
1543   - TextCtrl8->Disable();
1544   -}
  1509 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1510 + dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
1545 1511  
1546   -void BUNDLEBLDR::OnTextCtrl4Text(wxCommandEvent& event)
1547   -{
1548   - TextCtrl4->SetForegroundColour(*wxBLACK);
1549   - int IsError = 0;
1550   - check_is_numeric(TextCtrl4, &IsError);
1551   -}
  1512 + dc.DrawLine(dx1, dy1, dx2, dy2);
  1513 + dc.DrawLine(dx2, dy2, dx3, dy3);
  1514 + dc.DrawLine(dx3, dy3, dx4, dy4);
  1515 + dc.DrawLine(dx4, dy4, dx1, dy1);
1552 1516  
1553   -void BUNDLEBLDR::OnInit(wxInitDialogEvent& event)
1554   -{
1555   - TextCtrl4->SetForegroundColour(*wxLIGHT_GREY);
1556   - TextCtrl5->SetForegroundColour(*wxLIGHT_GREY);
1557   -}
  1517 + float offset_x, offset_y, width, height,separation, conductors;
1558 1518  
1559   -void BUNDLEBLDR::OnTextCtrl5Text(wxCommandEvent& event)
1560   -{
1561   - TextCtrl5->SetForegroundColour(*wxBLACK);
1562   - int IsError = 0;
1563   - check_is_numeric(TextCtrl5, &IsError);
1564   -}
  1519 + for (int i = 0; i < conductor_rows;i++){
  1520 + cableFile >> offset_x;
  1521 + std::getline(cableFile, str); //Read to end of line
1565 1522  
1566   -void BUNDLEBLDR::OnSpinButton1Change(wxSpinEvent& event)
1567   -{
  1523 + cableFile >> offset_y;
  1524 + std::getline(cableFile, str); //Read to end of line
1568 1525  
1569   - double maxDimension;
  1526 + cableFile >> width;
  1527 + std::getline(cableFile, str); //Read to end of line
1570 1528  
1571   - wxString maxXY = TextCtrl8->GetValue();
  1529 + cableFile >> height;
  1530 + std::getline(cableFile, str); //Read to end of line
1572 1531  
1573   - maxXY.ToDouble(&maxDimension);
  1532 + cableFile >> separation;
  1533 + std::getline(cableFile, str); //Read to end of line
1574 1534  
1575   - if (MeshSelected == 0)
1576   - {
1577   - FormatPanel(maxDimension);
1578   - DrawBundleCsection();
1579   - }
  1535 + cableFile >> conductors;
  1536 + std::getline(cableFile, str); //Read to end of line
1580 1537  
1581   -}
1582 1538  
1583   -void BUNDLEBLDR::OnTextCtrl8TextEnter(wxCommandEvent& event)
1584   -{
1585   - double maxDimension;
  1539 + float scaled_conductor_width = width/maxDimension * scaleFactor;
  1540 + float scaled_conductor_height = height/maxDimension * scaleFactor;
  1541 + float scaled_conductor_separation = separation/maxDimension * scaleFactor;
  1542 + float scaled_offset_x = offset_x/maxDimension * scaleFactor;
  1543 + float scaled_offset_y = offset_y/maxDimension * scaleFactor;
1586 1544  
1587   - wxString maxXY = TextCtrl8->GetValue();
  1545 + //calculate conductor origin, top left corner: start at no.1
  1546 + float x_origin = 0 - (scaled_conductor_width * conductors/2) - scaled_conductor_separation*(conductors - 1)/2 + scaled_offset_x;
  1547 + float y_origin = scaled_conductor_height/2 + scaled_offset_y;
1588 1548  
1589   - maxXY.ToDouble(&maxDimension);
  1549 + float cx1,cy1,cx2,cy2,cx3,cy3,cx4,cy4;
1590 1550  
1591   - FormatPanel(maxDimension);
  1551 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1552 + dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
1592 1553  
  1554 + for (int j = 0; j<conductors; j++){
1593 1555  
1594   - if (MeshSelected == 1)
1595   - {
1596   - scale = scale + 0.1;
  1556 + //point 1
  1557 + cx1 = x_origin + j * (scaled_conductor_width + scaled_conductor_separation);
  1558 + cy1 = y_origin;
1597 1559  
1598   - wxString meshToView;
1599   - meshToView<<ComboBox1->GetValue();
1600   - draw_mesh(Panel1,meshToView, scale);
1601   - }
  1560 + tempx = cx1*c - cy1*s;
  1561 + tempy = cx1*s + cy1*c;
1602 1562  
1603   - else
1604   - {
1605   - DrawBundleCsection();
1606   - }
  1563 + cx1 = tempx + scaledxCoord + size_h/2;
  1564 + cy1 = tempy + scaledyCoord + size_v/2;
1607 1565  
1608   -}
  1566 + //point 3
  1567 + cx2 = x_origin + j * (scaled_conductor_width + scaled_conductor_separation);
  1568 + cy2 = y_origin - scaled_conductor_height;
1609 1569  
1610   -void BUNDLEBLDR::OnSpinButton1ChangeUp(wxSpinEvent& event)
1611   -{
1612   - double maxDimension;
  1570 + tempx = cx2*c - cy2*s;
  1571 + tempy = cx2*s + cy2*c;
1613 1572  
1614   - wxString maxXY = TextCtrl8->GetValue();
  1573 + cx2 = tempx + scaledxCoord + size_h/2;
  1574 + cy2 = tempy + scaledyCoord + size_v/2;
1615 1575  
1616   - maxXY.ToDouble(&maxDimension);
  1576 + //point 3
  1577 + cx3 = x_origin + scaled_conductor_width + j * (scaled_conductor_width + scaled_conductor_separation);
  1578 + cy3 = y_origin - scaled_conductor_height;
1617 1579  
1618   - maxDimension = maxDimension + 0.001;
  1580 + tempx = cx3*c - cy3*s;
  1581 + tempy = cx3*s + cy3*c;
1619 1582  
1620   - maxXY = "";
  1583 + cx3 = tempx + scaledxCoord + size_h/2;
  1584 + cy3 = tempy + scaledyCoord + size_v/2;
1621 1585  
1622   - maxXY << maxDimension;
  1586 + //point 4
  1587 + cx4 = x_origin + scaled_conductor_width + j * (scaled_conductor_width + scaled_conductor_separation);
  1588 + cy4 = y_origin;
1623 1589  
1624   - TextCtrl8 ->SetValue(maxXY);
  1590 + tempx = cx4*c - cy4*s;
  1591 + tempy = cx4*s + cy4*c;
1625 1592  
1626   - FormatPanel(maxDimension);
  1593 + cx4 = tempx + scaledxCoord + size_h/2;
  1594 + cy4 = tempy + scaledyCoord + size_v/2;
1627 1595  
1628   - if (MeshSelected == 1)
1629   - {
1630   - scale = scale + 0.05;
  1596 + dc.DrawLine(cx1, cy1, cx2, cy2);
  1597 + dc.DrawLine(cx2, cy2, cx3, cy3);
  1598 + dc.DrawLine(cx3, cy3, cx4, cy4);
  1599 + dc.DrawLine(cx4, cy4, cx1, cy1);
  1600 + }
  1601 + }
1631 1602  
1632   - wxString meshToView;
1633   - meshToView<<ComboBox1->GetValue();
1634   - draw_mesh(Panel1,meshToView, scale);
1635 1603 }
1636 1604  
1637   - else
1638   - {
1639   - DrawBundleCsection();
1640   - }
  1605 + if (str.compare("Dconnector") == 0 ){
1641 1606  
1642   -}
  1607 + float conductors, conductor_radius, conductor_pitch, conductor_separation, shell_offset;
1643 1608  
1644   -void BUNDLEBLDR::OnSpinButton1ChangeDown(wxSpinEvent& event)
1645   -{
1646   - double maxDimension;
  1609 + cableFile >> conductors;
  1610 + std::getline(cableFile, str); //Read to end of line
  1611 + std::getline(cableFile, str); //Read to end of line
  1612 + cableFile >> conductor_radius;
  1613 + std::getline(cableFile, str); //Read to end of line
  1614 + cableFile >> conductor_pitch;
  1615 + std::getline(cableFile, str); //Read to end of line
  1616 + cableFile >> conductor_separation;
  1617 + std::getline(cableFile, str); //Read to end of line
  1618 + cableFile >> shell_offset;
1647 1619  
1648   - wxString maxXY = TextCtrl8->GetValue();
  1620 +// float totalWidth = (conductors/2 * conductor_separation) + (2 * shell_offset) + (2 * conductor_radius);
1649 1621  
1650   - maxXY.ToDouble(&maxDimension);
  1622 + float conductor_Scaledradius,
  1623 + conductor_Scaledpitch,
  1624 + conductor_Scaledseparation,
  1625 + scaledxCoord,
  1626 + scaledyCoord;
1651 1627  
1652   - maxDimension = maxDimension - 0.001;
1653 1628  
1654   - if (maxDimension <=0) maxDimension = 0;
  1629 + float x_origin, y_origin;
1655 1630  
1656   - maxXY = "";
  1631 + scaleFactor = (size_h * 0.25);
1657 1632  
1658   - maxXY << maxDimension;
  1633 + conductor_Scaledradius = (conductor_radius/maxDimension)*scaleFactor;
  1634 + conductor_Scaledpitch = (conductor_pitch/maxDimension)*scaleFactor;
  1635 + conductor_Scaledseparation = (conductor_separation/maxDimension)*scaleFactor;
1659 1636  
1660   - TextCtrl8 ->SetValue(maxXY);
  1637 + scaledxCoord = (xCoord/maxDimension)*scaleFactor;
  1638 + scaledyCoord = (yCoord/maxDimension)*scaleFactor;
1661 1639  
1662   - FormatPanel(maxDimension);
  1640 + size_h = size_h + scaledxCoord;
  1641 + size_v = size_v + scaledyCoord;
  1642 +
  1643 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1644 + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
1663 1645  
  1646 + // Upper conductors & Shell
  1647 + int upper_conductors = conductors / 2;
  1648 + x_origin = (size_h/2) - (upper_conductors/2 * conductor_Scaledseparation);
  1649 + y_origin = (size_v/2) - (conductor_Scaledpitch);
1664 1650  
1665   - if (MeshSelected == 1)
1666   - {
1667   - scale = scale - 0.05;
  1651 + dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
  1652 + dc.SetBrush(wxBrush(*wxBLACK));
1668 1653  
1669   - if (scale <= 0.05) scale = 0.05;
  1654 + for(int i=0;i<upper_conductors;i++){
1670 1655  
1671   - wxString meshToView;
1672   - meshToView<<ComboBox1->GetValue();
1673   - draw_mesh(Panel1,meshToView, scale);
  1656 + dc.DrawCircle( wxPoint(x_origin,y_origin), conductor_Scaledradius );
  1657 + x_origin = x_origin + (conductor_Scaledpitch);
  1658 + }
  1659 + // Lower conductors
  1660 + int lower_conductors = (conductors / 2) - 1;
  1661 + x_origin = (size_h/2) - (lower_conductors/2 * conductor_Scaledseparation) + conductor_Scaledseparation/2;
  1662 + y_origin = (size_v/2) + (conductor_Scaledpitch); // This isn't correct!!
  1663 +
  1664 + for(int i=0;i<lower_conductors;i++){
  1665 +
  1666 + dc.DrawCircle( wxPoint(x_origin,y_origin), conductor_Scaledradius );
  1667 + x_origin = x_origin + (conductor_Scaledpitch);
  1668 + }
1674 1669 }
1675 1670  
1676   - else
  1671 +
  1672 + // Draw Ground Plane if Selected
  1673 + if(CheckBox1->GetValue())
1677 1674 {
1678   - DrawBundleCsection();
  1675 + int size_hl, size_vl;
  1676 + Panel1->GetSize(&size_hl, &size_vl );
  1677 + dc.SetPen( wxPen( (*wxBLACK) ,5 , wxSOLID) );
  1678 + dc.DrawLine( 0, size_vl/2, size_hl,size_vl/2 );
1679 1679 }
  1680 +
  1681 +}
  1682 +
  1683 +
  1684 +void BUNDLEBLDR::OnPanel2Paint(wxPaintEvent& event)
  1685 +{
  1686 +
  1687 +}
  1688 +
  1689 +void BUNDLEBLDR::OnCheckListBox1Toggled(wxCommandEvent& event)
  1690 +{
1680 1691 }
1681 1692  
  1693 +
... ...
GUI/SW1/SRC/SW1_GUIApp.h
... ... @@ -68,7 +68,7 @@ class SW1_GUIApp : public wxApp
68 68 wxBitmap splashimage;
69 69  
70 70 std::string SACAMOS_V_NUMBER = "SPICE_CABLE_MODEL_BUILDER_version=\"v4.0.0\"";
71   - std::string SACAMOS_V_DATE = "SPICE_CABLE_MODEL_BUILDER_date=\"5th October 2018\"";
  71 + std::string SACAMOS_V_DATE = "SPICE_CABLE_MODEL_BUILDER_date=\"6th October 2018\"";
72 72  
73 73  
74 74  
... ...
GUI/SW1/SRC/resources/Build
1 1 GUI:
2 2 Version: v4.0.0
3   -Date: 5th October 2018
  3 +Date: 6th October 2018
4 4  
5 5 SPICE_CABLE_MODEL_BUILDER
6 6 Version: v4.0.0
... ...
version_information.inc
1 1 SPICE_CABLE_MODEL_BUILDER_version="v4.0.0"
2   -SPICE_CABLE_MODEL_BUILDER_date="5th October 2018"
  2 +SPICE_CABLE_MODEL_BUILDER_date="6th October 2018"
... ...