KiCad PCB EDA Suite
pns_log_viewer.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2020-2021 KiCad Developers.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
24 
25 // WARNING - this Tom's crappy PNS hack tool code. Please don't complain about its quality
26 // (unless you want to improve it).
27 
28 #include <wx/clipbrd.h>
29 
31 #include <pgm_base.h>
32 
33 #include <profile.h>
34 
35 #include <view/view_overlay.h>
36 
37 #include "pns_log.h"
38 #include "router/pns_diff_pair.h"
39 #include "router/pns_utils.h"
40 
41 #include "pns_log_viewer_frame.h"
42 
43 #include "qa/drc_proto/drc_proto.h"
44 
45 #include "label_manager.h"
46 #define TOM_EXTRA_DEBUG
47 
48 LABEL_MANAGER::LABEL_MANAGER( KIGFX::GAL* aGal ) : m_gal( aGal )
49 {
50 
51 };
52 
53 
55 {
56 }
57 
58 
59 void LABEL_MANAGER::Add( VECTOR2I target, std::string msg, COLOR4D color )
60 {
61  LABEL lbl;
62 
63  lbl.m_target = target;
64  lbl.m_msg = msg;
65  lbl.m_color = color;
67 
68  VECTOR2I textDims = m_gal->GetTextLineSize( msg );
69 
70  lbl.m_bbox.SetOrigin( lbl.m_target - textDims - VECTOR2I( m_textSize, m_textSize ) );
71  lbl.m_bbox.SetSize( textDims );
72  m_labels.push_back( lbl );
73 }
74 
75 
77 {
78  for( int i = 0; i < aL.PointCount(); i++ )
79  {
80  char msg[1024];
81  snprintf( msg, sizeof( msg ), "%d", i );
82  Add( aL.CPoint( i ), msg, color );
83  }
84 }
85 
87 {
88  recalculate();
89 
90  for( auto& lbl : m_labels )
91  {
92  aOvl->SetIsFill( false );
93  aOvl->SetIsStroke( true );
94  aOvl->SetLineWidth( 10000 );
95  aOvl->SetStrokeColor( lbl.m_color.Brighten( 0.7 ) );
96  aOvl->Rectangle( lbl.m_bbox.GetOrigin(), lbl.m_bbox.GetEnd() );
97  aOvl->BitmapText( lbl.m_msg, lbl.m_bbox.Centre(), 0.0 );
98  VECTOR2I nearest = nearestBoxCorner( lbl.m_bbox, lbl.m_target );
99  aOvl->Line( lbl.m_target, nearest );
100  }
101 }
102 
103 
105 {
106  VECTOR2I ptest[4] = { b.GetPosition(), b.GetPosition() + VECTOR2I( b.GetWidth(), 0 ),
107  b.GetPosition() + VECTOR2I( b.GetWidth(), b.GetHeight() ),
108  b.GetPosition() + VECTOR2I( 0, b.GetHeight() ) };
109 
110  int bestDist = INT_MAX;
111  VECTOR2I rv;
112 
113  for( int i = 0; i < 4; i++ )
114  {
115  int dist = ( ptest[i] - p ).EuclideanNorm();
116 
117  if( dist < bestDist )
118  {
119  bestDist = dist;
120  rv = ptest[i];
121  }
122  }
123 
124  return rv;
125 }
126 
127 
129 {
130  VECTOR2I rv( 0, 0 );
131 
132  b1.Normalize();
133  b2.Normalize();
134 
135  if( !b1.Intersects( b2 ) )
136  return rv;
137 
138  int bestDist = INT_MAX;
139 
140  VECTOR2I p[4] = { b2.GetPosition(), b2.GetPosition() + VECTOR2I( b2.GetWidth(), 0 ),
141  b2.GetPosition() + VECTOR2I( b2.GetWidth(), b2.GetHeight() ),
142  b2.GetPosition() + VECTOR2I( 0, b2.GetHeight() ) };
143 
144  for( int i = 0; i < 4; i++ )
145  {
146  if( b1.Contains( p[i] ) )
147  {
148  // printf("CONT %d\n", i );
149  VECTOR2I dp[4] = { VECTOR2I( b1.GetEnd().x - p[i].x + 1, 0 ),
150  VECTOR2I( b1.GetPosition().x - p[i].x - 1, 0 ),
151  VECTOR2I( 0, b1.GetEnd().y - p[i].y + 1 ),
152  VECTOR2I( 0, b1.GetPosition().y - p[i].y - 1 ) };
153 
154  for( int j = 0; j < 4; j++ )
155  {
156  BOX2I btest( b2 );
157  btest.Move( dp[j] );
158 
159  if( !b1.Intersects( btest ) )
160  {
161  int dist = dp[j].EuclideanNorm();
162 
163  if( dist < bestDist )
164  {
165  bestDist = dist;
166  rv = dp[j];
167  }
168  }
169  }
170  }
171  }
172 
173  return rv;
174 }
175 
176 
178 {
179  int iterLimit = 5;
180 
181  while( iterLimit > 0 )
182  {
183  printf( "Iter %d\n", iterLimit );
184  bool collisionsFound = false;
185 
186  for( int i = 0; i < m_labels.size(); i++ )
187  {
188  for( int j = 0; j < m_labels.size(); j++ )
189  {
190  if( i == j )
191  continue;
192 
193  auto bb_i = m_labels[i].m_bbox;
194  auto bb_j = m_labels[j].m_bbox;
195 
196  bb_i.Inflate( 100000 );
197  bb_j.Inflate( 100000 );
198  VECTOR2I mtv = boxMtv( bb_i, bb_j );
199 
200  if( mtv.x || mtv.y )
201  {
202  m_labels[i].m_bbox.Move( -mtv );
203  collisionsFound = true;
204  }
205  }
206  }
207 
208  if( !collisionsFound )
209  break;
210 
211  iterLimit--;
212  }
213 }
214 
215 
216 class WX_SHAPE_TREE_ITEM_DATA : public wxClientData
217 {
218 public:
220 
222 };
223 
224 
226 {
227  m_labelMgr.reset( new LABEL_MANAGER( aGal ) );
228 }
229 
230 
232  bool aShowVertexNumbers )
233 {
234  Polyline( aL );
235 
236  if( aShowVertexNumbers)
237  m_labelMgr->Add( aL, GetStrokeColor() );
238 }
239 
240 
242 {
243  m_labelMgr->Redraw( this );
244 }
245 
246 
248 {
249  LoadSettings();
251 
252  m_viewSizer->Add( m_galPanel.get(), 1, wxEXPAND, 5 );
253 
254  Layout();
255 
256  Show( true );
257  Maximize();
258  Raise();
259 
260  auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>(
261  m_galPanel->GetView()->GetPainter()->GetSettings() );
262 
263  settings->SetZoneDisplayMode( ZONE_DISPLAY_MODE::SHOW_ZONE_OUTLINE );
264 
265  m_listPopupMenu = new wxMenu( wxT( "" ) );
266  m_listPopupMenu->Append( ID_LIST_COPY, wxT( "Copy selected geometry" ), wxT( "" ),
267  wxITEM_NORMAL );
268  m_listPopupMenu->Append( ID_LIST_SHOW_ALL, wxT( "Show all" ), wxT( "" ), wxITEM_NORMAL );
269  m_listPopupMenu->Append( ID_LIST_SHOW_NONE, wxT( "Show none" ), wxT( "" ), wxITEM_NORMAL );
270 
271  m_itemList->Connect( m_itemList->GetId(), wxEVT_TREELIST_ITEM_CONTEXT_MENU,
272  wxMouseEventHandler( PNS_LOG_VIEWER_FRAME::onListRightClick ), nullptr,
273  this );
274  //m_itemList->Connect(m_itemList->GetId(),wxEVT_LISTBOX,wxCommandEventHandler(PNS_LOG_VIEWER_FRAME::onListSelect),nullptr,this);
275  m_itemList->Connect( m_itemList->GetId(), wxEVT_TREELIST_SELECTION_CHANGED,
276  wxCommandEventHandler( PNS_LOG_VIEWER_FRAME::onListSelect ),
277  nullptr, this );
278  m_itemList->Connect( m_itemList->GetId(), wxEVT_TREELIST_ITEM_CHECKED,
279  wxCommandEventHandler( PNS_LOG_VIEWER_FRAME::onListChecked ),
280  nullptr, this );
281 
282  m_itemList->AppendColumn( "Type" );
283  m_itemList->AppendColumn( "Value" );
284  m_itemList->AppendColumn( "File" );
285  m_itemList->AppendColumn( "Method" );
286  m_itemList->AppendColumn( "Line" );
287 
288  m_overlay.reset( new PNS_LOG_VIEWER_OVERLAY ( m_galPanel->GetGAL() ) );
289  m_galPanel->GetView()->Add( m_overlay.get() );
290 }
291 
292 
294 {
295  m_overlay = nullptr;
296 }
297 
298 
300 {
301 
302 }
303 
304 
306 {
307  PNS_TEST_DEBUG_DECORATOR* dbgd = m_env->GetDebugDecorator();
308  int count = dbgd->GetStageCount();
309 
310  int iter = m_rewindIter;
311 
312  if( count <= 0 )
313  return nullptr;
314 
315  if( iter < 0 )
316  iter = 0;
317 
318  if( iter >= count )
319  iter = count - 1;
320 
321  return dbgd->GetStage( iter );
322 }
323 
324 
326 {
327  if( !m_env )
328  return;
329 
331 
332  if( !st )
333  return;
334 
335  m_overlay.reset( new PNS_LOG_VIEWER_OVERLAY ( m_galPanel->GetGAL() ) );
336  m_galPanel->GetView()->Add( m_overlay.get() );
337 
338  auto drawShapes = [&]( PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT* ent ) -> bool
339  {
340  bool isEnabled = ent->IsVisible();
341  bool isSelected = false;
342 
343  if( !isEnabled )
344  return true;
345 
346  for( auto& sh : ent->m_shapes )
347  {
348  COLOR4D color = ent->m_color;
349  int lineWidth = ent->m_width;
350 
351  m_overlay->SetIsStroke( true );
352  m_overlay->SetIsFill( false );
353 
354  if( isSelected )
355  {
356  color.Brighten( 0.5 );
357  }
358 
359  m_overlay->SetStrokeColor( color );
360  m_overlay->SetLineWidth( ent->m_width );
361 
362  switch( sh->Type() )
363  {
364  case SH_CIRCLE:
365  {
366  auto cir = static_cast<SHAPE_CIRCLE*>( sh );
367  m_overlay->Circle( cir->GetCenter(), cir->GetRadius() );
368 
369  break;
370  }
371  case SH_RECT:
372  {
373  auto rect = static_cast<SHAPE_RECT*>( sh );
374  m_overlay->Rectangle( rect->GetPosition(), rect->GetPosition() + rect->GetSize() );
375 
376  break;
377  }
378  case SH_LINE_CHAIN:
379  {
380  auto lc = static_cast<SHAPE_LINE_CHAIN*>( sh );
381  m_overlay->AnnotatedPolyline( *lc, ent->m_name, ent->m_hasLabels && isSelected );
382 
383  break;
384 
385  }
386  default:
387  break;
388  }
389  }
390 
391  return true;
392  };
393 
394  st->m_entries->IterateTree( drawShapes );
395 
396  m_overlay->DrawAnnotations();
397 
398  m_galPanel->GetView()->MarkDirty();
399  m_galPanel->GetParent()->Refresh();
400 }
401 
402 
403 static BOARD* loadBoard( const std::string& filename )
404 {
405  PLUGIN::RELEASER pi( new PCB_IO );
406  BOARD* brd = nullptr;
407 
408  try
409  {
410  brd = pi->Load( wxString( filename.c_str() ), nullptr, nullptr );
411  }
412  catch( const IO_ERROR& ioe )
413  {
414  return nullptr;
415  }
416 
417  return brd;
418 }
419 
420 
422 {
423  m_logFile.reset( aLog );
424 
425  SetBoard( m_logFile->GetBoard() );
426 
427  m_env.reset( new PNS_TEST_ENVIRONMENT );
428 
429  m_env->SetMode( PNS::PNS_MODE_ROUTE_SINGLE );
430  m_env->ReplayLog( m_logFile.get() );
431 
432  auto dbgd = m_env->GetDebugDecorator();
433  int n_stages = dbgd->GetStageCount();
434  m_rewindSlider->SetMax( n_stages - 1 );
435  m_rewindSlider->SetValue( n_stages - 1 );
436  m_rewindIter = n_stages - 1;
437 
438  auto extents = m_board->GetBoundingBox();
439 
440 
441  BOX2D bbd;
442  bbd.SetOrigin( extents.GetOrigin() );
443  bbd.SetWidth( extents.GetWidth() );
444  bbd.SetHeight( extents.GetHeight() );
445  bbd.Inflate( std::min( bbd.GetWidth(), bbd.GetHeight() ) / 5 );
446 
447  m_galPanel->GetView()->SetViewport( bbd );
448 
451 }
452 
453 
454 void PNS_LOG_VIEWER_FRAME::onReload( wxCommandEvent& event )
455 {
456  event.Skip();
457 }
458 
459 void PNS_LOG_VIEWER_FRAME::onExit( wxCommandEvent& event )
460 {
461  event.Skip();
462 }
463 
464 
465 void PNS_LOG_VIEWER_FRAME::onListChecked( wxCommandEvent& event )
466 {
467  syncModel();
469 }
470 
471 
472 void PNS_LOG_VIEWER_FRAME::onRewindScroll( wxScrollEvent& event )
473 {
474  m_rewindIter = event.GetPosition();
477  char str[128];
478  sprintf( str, "%d", m_rewindIter );
479  m_rewindPos->SetValue( str );
480  event.Skip();
481 }
482 
483 
484 void PNS_LOG_VIEWER_FRAME::onBtnRewindLeft( wxCommandEvent& event )
485 {
486  if( m_rewindIter > 0 )
487  {
488  m_rewindIter--;
491  char str[128];
492  sprintf( str, "%d", m_rewindIter );
493  m_rewindPos->SetValue( str );
494  }
495 }
496 
497 
498 void PNS_LOG_VIEWER_FRAME::onBtnRewindRight( wxCommandEvent& event )
499 {
500  auto dbgd = m_env->GetDebugDecorator();
501  int count = dbgd->GetStageCount();
502 
503  if( m_rewindIter < count )
504  {
505  m_rewindIter++;
508  char str[128];
509  sprintf( str, "%d", m_rewindIter );
510  m_rewindPos->SetValue( str );
511  }
512 }
513 
514 
515 void PNS_LOG_VIEWER_FRAME::onRewindCountText( wxCommandEvent& event )
516 {
517  if( !m_env )
518  return;
519 
520  int val = wxAtoi( m_rewindPos->GetValue() );
521 
522  auto dbgd = m_env->GetDebugDecorator();
523  int count = dbgd->GetStageCount();
524 
525  if( val < 0 )
526  val = 0;
527 
528  if( val >= count )
529  val = count - 1;
530 
531  m_rewindIter = val;
532  m_rewindSlider->SetValue( m_rewindIter );
535 
536  event.Skip();
537 }
538 
539 
541 {
542  for( wxTreeListItem item = m_itemList->GetFirstItem(); item.IsOk();
543  item = m_itemList->GetNextItem( item ) )
544  {
545  WX_SHAPE_TREE_ITEM_DATA* idata =
546  static_cast<WX_SHAPE_TREE_ITEM_DATA*>( m_itemList->GetItemData( item ) );
547 
548  if( idata )
549  {
550  bool checked = m_itemList->GetCheckedState( item ) == wxCHK_CHECKED;
551  bool selected = m_itemList->IsSelected( item );
552  idata->m_item->m_visible = checked || selected;
553  idata->m_item->m_selected = selected;
554  }
555  }
556 }
557 
558 
559 void PNS_LOG_VIEWER_FRAME::onListRightClick( wxMouseEvent& event )
560 {
561  auto sel = m_itemList->GetPopupMenuSelectionFromUser( *m_listPopupMenu );
562 
563  switch( sel )
564  {
565  case ID_LIST_SHOW_NONE:
566  m_itemList->CheckItemRecursively( m_itemList->GetRootItem(), wxCHK_UNCHECKED );
567  syncModel();
569  break;
570  case ID_LIST_SHOW_ALL:
571  m_itemList->CheckItemRecursively( m_itemList->GetRootItem(), wxCHK_CHECKED );
572  syncModel();
574  break;
575  case ID_LIST_COPY:
576  {
577  wxString s;
578 
580 
581  if( !st )
582  return;
583 
584  auto formatShapes = [&]( PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT* ent ) -> bool
585  {
586  if( ent->m_selected )
587  {
588  for( auto sh : ent->m_shapes )
589  {
590  s += "// " + ent->m_name + "\n " + sh->Format() + "; \n";
591  }
592  }
593 
594  return true;
595  };
596 
597  st->m_entries->IterateTree( formatShapes );
598 
599  if( wxTheClipboard->Open() )
600  {
601  // This data objects are held by the clipboard,
602  // so do not delete them in the app.
603  wxTheClipboard->SetData( new wxTextDataObject( s ) );
604  wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
605  wxTheClipboard->Close();
606  }
607 
608  return;
609  }
610  }
611 }
612 
613 
614 void PNS_LOG_VIEWER_FRAME::onListSelect( wxCommandEvent& event )
615 {
616  syncModel();
618 }
619 
620 
621 void PNS_LOG_VIEWER_FRAME::buildListTree( wxTreeListItem item,
622  PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT* ent, int depth )
623 {
624 #ifdef EXTRA_VERBOSE
625  for( int i = 0; i < depth * 2; i++ )
626  printf( " " );
627 
628  if( ent->m_msg.length() )
629  printf( "MSG: %s\n", ent->m_msg.c_str() );
630  else
631  printf( "SHAPES: %s [%d]\n", ent->m_name.c_str(), ent->m_children.size() );
632 #endif
633 
634  wxTreeListItem ritem;
635 
636  printf("depth %d\n", depth );
637 
638  if( ent->m_msg.length() )
639  {
640  ritem = m_itemList->AppendItem( item, "Child" );
641  m_itemList->SetItemText( ritem, 0, "Message" );
642  m_itemList->SetItemText( ritem, 1, ent->m_msg );
643  }
644  else
645  {
646  ritem = m_itemList->AppendItem( item, "Child" );
647  m_itemList->SetItemText( ritem, 0, "Shapes" );
648  m_itemList->SetItemText( ritem, 1, ent->m_name );
649  }
650 
651  m_itemList->SetItemText( ritem, 2, wxFileNameFromPath( ent->m_srcLoc.fileName ) );
652  m_itemList->SetItemText( ritem, 3, ent->m_srcLoc.funcName );
653  m_itemList->SetItemText( ritem, 4, wxString::Format("%d", ent->m_srcLoc.line ) );
654 
655  m_itemList->SetItemData( ritem, new WX_SHAPE_TREE_ITEM_DATA( ent ) );
656 
657  if( !ent->m_children.size() )
658  return;
659 
660  for( auto child : ent->m_children )
661  {
662  buildListTree( ritem, child, depth + 1 );
663  }
664 }
665 
666 
667 static void expandAllChildren( wxTreeListCtrl* tree )
668 {
669  wxTreeListItem child = tree->GetFirstItem ();
670 
671  while( child.IsOk() )
672  {
673  tree->Expand ( child );
674  child = tree->GetNextItem( child );
675  }
676 }
677 
678 
680 {
681  if( !m_env )
682  return;
683 
684  auto dbgd = m_env->GetDebugDecorator();
685  int count = dbgd->GetStageCount();
686 
687  wxArrayString dumpStrings;
688 
689  if( count <= 0 )
690  return;
691 
692  if( iter < 0 )
693  iter = 0;
694 
695  if( iter >= count )
696  iter = count - 1;
697 
698  auto st = dbgd->GetStage( iter );
699  auto rootItem = m_itemList->GetRootItem();
700 
701  m_itemList->DeleteAllItems();
702  buildListTree( rootItem, st->m_entries );
703  m_itemList->CheckItemRecursively( rootItem, wxCHK_UNCHECKED );
704 
706 
707  m_itemList->Refresh();
708 }
709 
710 
711 int replay_main_func( int argc, char* argv[] )
712 {
713  auto frame = new PNS_LOG_VIEWER_FRAME( nullptr );
714 
715  // drcCreateTestsProviderClearance();
716  // drcCreateTestsProviderEdgeClearance();
717 
718  if( argc >= 2 && std::string( argv[1] ) == "-h" )
719  {
720  printf( "PNS Log (Re)player. Allows to step through the log written by the ROUTER_TOOL "
721  "in debug KiCad builds. " );
722  printf( "Requires a board file with UUIDs and a matching log file. Both are written to "
723  "/tmp when you press '0' during routing." );
724  return 0;
725  }
726 
727  if( argc < 3 )
728  {
729  printf( "Expected parameters: log_file.log board_file.dump\n" );
730  return 0;
731  }
732 
733  PNS_LOG_FILE* logFile = new PNS_LOG_FILE;
734  logFile->Load( argv[1], argv[2] );
735 
736  frame->SetLogFile( logFile );
737  //SetTopFrame( frame ); // wxApp gets a face.
738 
739  return 0;
740 }
741 
742 
744  "replay",
745  "PNS Log Player",
747 } );
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:146
bool Load(const std::string &logName, const std::string boardName)
Definition: pns_log.cpp:48
void Move(const Vec &aMoveVector)
Move the rectangle by the aMoveVector.
Definition: box2.h:104
std::shared_ptr< PNS_LOG_FILE > m_logFile
void BitmapText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
STAGE * GetStage(int index)
Definition: pns_log.h:243
A PLUGIN derivation for saving and loading Pcbnew s-expression formatted files.
Class PNS_LOG_VIEWER_FRAME_BASE.
const Vec GetEnd() const
Definition: box2.h:178
void buildListTree(wxTreeListItem item, PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT *ent, int depth=0)
virtual void onBtnRewindRight(wxCommandEvent &event) override
#define ID_LIST_COPY
const COLOR4D & GetStrokeColor() const
Definition: view_overlay.h:103
int color
Definition: DXF_plotter.cpp:60
PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT * m_item
void SetSize(const Vec &size)
Definition: box2.h:195
void Add(VECTOR2I target, std::string msg, COLOR4D color)
void createView(wxWindow *aParent, PCB_DRAW_PANEL_GAL::GAL_TYPE aGalType=PCB_DRAW_PANEL_GAL::GAL_TYPE_OPENGL)
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
int PointCount() const
Return the number of points (vertices) in this line chain.
VECTOR2D GetTextLineSize(const UTF8 &aText) const
Compute the X and Y size of a given text.
void SetIsStroke(bool aIsStrokeEnabled)
void Redraw(KIGFX::VIEW_OVERLAY *aOvl)
int GetStageCount() const
Definition: pns_log.h:241
Releases a PLUGIN in the context of a potential thrown exception through its destructor.
Definition: io_mgr.h:555
void Polyline(const SHAPE_LINE_CHAIN &aPolyLine)
bool Intersects(const BOX2< Vec > &aRect) const
Definition: box2.h:217
VECTOR2I nearestBoxCorner(BOX2I b, VECTOR2I p)
void Line(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
virtual void onExit(wxCommandEvent &event) override
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
PNS_TEST_DEBUG_DECORATOR::STAGE * getCurrentStage()
#define ID_LIST_SHOW_ALL
#define ID_LIST_SHOW_NONE
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
LABEL_MANAGER(KIGFX::GAL *aGal)
virtual void onRewindCountText(wxCommandEvent &event) override
static bool Register(const KI_TEST::UTILITY_PROGRAM &aProgInfo)
Register a utility program factory function against an ID string.
void updateDumpPanel(int iter)
coord_type GetWidth() const
Definition: box2.h:180
BOX2< Vec > & Normalize()
Ensure that the height ant width are positive.
Definition: box2.h:112
bool Contains(const Vec &aPoint) const
Definition: box2.h:134
virtual void onBtnRewindLeft(wxCommandEvent &event) override
virtual void createUserTools() override
static bool registered2
PNS_LOG_VIEWER_OVERLAY(KIGFX::GAL *aGal)
void SetStrokeColor(const COLOR4D &aColor)
PNS_LOG_VIEWER_FRAME(wxFrame *frame)
VECTOR2I boxMtv(BOX2I b1, BOX2I b2)
static void expandAllChildren(wxTreeListCtrl *tree)
virtual void onReload(wxCommandEvent &event) override
circle
Definition: shape.h:46
void SetGlyphSize(const VECTOR2D &aSize)
Set the font glyph size.
void SetIsFill(bool aIsFillEnabled)
std::unique_ptr< LABEL_MANAGER > m_labelMgr
std::vector< DEBUG_ENT * > m_children
Definition: pns_log.h:174
const Vec & GetPosition() const
Definition: box2.h:177
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
void IterateTree(std::function< bool(DEBUG_ENT *)> visitor, int depth=0)
Definition: pns_log.cpp:413
std::shared_ptr< PCB_DRAW_PANEL_GAL > m_galPanel
std::shared_ptr< BOARD > m_board
PNS::DEBUG_DECORATOR::SRC_LOCATION_INFO m_srcLoc
Definition: pns_log.h:181
void SetHeight(coord_type val)
Definition: box2.h:206
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:281
std::shared_ptr< PNS_LOG_VIEWER_OVERLAY > m_overlay
see class PGM_BASE
const char * name
Definition: DXF_plotter.cpp:59
void SetLineWidth(double aLineWidth)
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
Represent a polyline (an zero-thickness chain of connected line segments).
KIGFX::GAL * m_gal
Definition: label_manager.h:33
virtual void onListRightClick(wxMouseEvent &event)
std::shared_ptr< PNS_TEST_ENVIRONMENT > m_env
virtual void SetBoard(std::shared_ptr< BOARD > b)
void SetOrigin(const Vec &pos)
Definition: box2.h:193
line chain (polyline)
Definition: shape.h:45
coord_type GetHeight() const
Definition: box2.h:181
virtual void onListSelect(wxCommandEvent &event)
void drawLoggedItems(int iter)
virtual void onRewindScroll(wxScrollEvent &event) override
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
Definition: vector2d.h:293
axis-aligned rectangle
Definition: shape.h:43
int replay_main_func(int argc, char *argv[])
void AnnotatedPolyline(const SHAPE_LINE_CHAIN &aL, std::string name, bool aShowVertexNumbers=false)
static BOARD * loadBoard(const std::string &filename)
virtual void onListChecked(wxCommandEvent &event)
std::vector< LABEL > m_labels
Definition: label_manager.h:35
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75
WX_SHAPE_TREE_ITEM_DATA(PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT *item)
void SetLogFile(PNS_LOG_FILE *aLog)
void SetWidth(coord_type val)
Definition: box2.h:205
void Rectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Abstract interface for drawing on a 2D-surface.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103