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 
49 LABEL_MANAGER::LABEL_MANAGER( KIGFX::GAL* aGal ) : m_gal( aGal )
50 {
51 
52 };
53 
54 
56 {
57 }
58 
59 
60 void LABEL_MANAGER::Add( VECTOR2I target, std::string msg, COLOR4D color )
61 {
62  LABEL lbl;
63 
64  lbl.m_target = target;
65  lbl.m_msg = msg;
66  lbl.m_color = color;
68 
69  VECTOR2I textDims = m_gal->GetTextLineSize( msg );
70 
71  lbl.m_bbox.SetOrigin( lbl.m_target - textDims - VECTOR2I( m_textSize, m_textSize ) );
72  lbl.m_bbox.SetSize( textDims );
73  m_labels.push_back( lbl );
74 }
75 
76 
78 {
79  for( int i = 0; i < aL.PointCount(); i++ )
80  {
81  char msg[1024];
82  snprintf( msg, sizeof( msg ), "%d", i );
83  Add( aL.CPoint( i ), msg, color );
84  }
85 }
86 
88 {
89  recalculate();
90 
91  for( auto& lbl : m_labels )
92  {
93  aOvl->SetIsFill( false );
94  aOvl->SetIsStroke( true );
95  aOvl->SetLineWidth( 10000 );
96  aOvl->SetStrokeColor( lbl.m_color.Brighten( 0.7 ) );
97  aOvl->Rectangle( lbl.m_bbox.GetOrigin(), lbl.m_bbox.GetEnd() );
98  aOvl->BitmapText( lbl.m_msg, lbl.m_bbox.Centre(), 0.0 );
99  VECTOR2I nearest = nearestBoxCorner( lbl.m_bbox, lbl.m_target );
100  aOvl->Line( lbl.m_target, nearest );
101  }
102 }
103 
104 
106 {
107  VECTOR2I ptest[4] = { b.GetPosition(), b.GetPosition() + VECTOR2I( b.GetWidth(), 0 ),
108  b.GetPosition() + VECTOR2I( b.GetWidth(), b.GetHeight() ),
109  b.GetPosition() + VECTOR2I( 0, b.GetHeight() ) };
110 
111  int bestDist = INT_MAX;
112  VECTOR2I rv;
113 
114  for( int i = 0; i < 4; i++ )
115  {
116  int dist = ( ptest[i] - p ).EuclideanNorm();
117 
118  if( dist < bestDist )
119  {
120  bestDist = dist;
121  rv = ptest[i];
122  }
123  }
124 
125  return rv;
126 }
127 
128 
130 {
131  VECTOR2I rv( 0, 0 );
132 
133  b1.Normalize();
134  b2.Normalize();
135 
136  if( !b1.Intersects( b2 ) )
137  return rv;
138 
139  int bestDist = INT_MAX;
140 
141  VECTOR2I p[4] = { b2.GetPosition(), b2.GetPosition() + VECTOR2I( b2.GetWidth(), 0 ),
142  b2.GetPosition() + VECTOR2I( b2.GetWidth(), b2.GetHeight() ),
143  b2.GetPosition() + VECTOR2I( 0, b2.GetHeight() ) };
144 
145  for( int i = 0; i < 4; i++ )
146  {
147  if( b1.Contains( p[i] ) )
148  {
149  // printf("CONT %d\n", i );
150  VECTOR2I dp[4] = { VECTOR2I( b1.GetEnd().x - p[i].x + 1, 0 ),
151  VECTOR2I( b1.GetPosition().x - p[i].x - 1, 0 ),
152  VECTOR2I( 0, b1.GetEnd().y - p[i].y + 1 ),
153  VECTOR2I( 0, b1.GetPosition().y - p[i].y - 1 ) };
154 
155  for( int j = 0; j < 4; j++ )
156  {
157  BOX2I btest( b2 );
158  btest.Move( dp[j] );
159 
160  if( !b1.Intersects( btest ) )
161  {
162  int dist = dp[j].EuclideanNorm();
163 
164  if( dist < bestDist )
165  {
166  bestDist = dist;
167  rv = dp[j];
168  }
169  }
170  }
171  }
172  }
173 
174  return rv;
175 }
176 
177 
179 {
180  int iterLimit = 5;
181 
182  while( iterLimit > 0 )
183  {
184  printf( "Iter %d\n", iterLimit );
185  bool collisionsFound = false;
186 
187  for( int i = 0; i < m_labels.size(); i++ )
188  {
189  for( int j = 0; j < m_labels.size(); j++ )
190  {
191  if( i == j )
192  continue;
193 
194  auto bb_i = m_labels[i].m_bbox;
195  auto bb_j = m_labels[j].m_bbox;
196 
197  bb_i.Inflate( 100000 );
198  bb_j.Inflate( 100000 );
199  VECTOR2I mtv = boxMtv( bb_i, bb_j );
200 
201  if( mtv.x || mtv.y )
202  {
203  m_labels[i].m_bbox.Move( -mtv );
204  collisionsFound = true;
205  }
206  }
207  }
208 
209  if( !collisionsFound )
210  break;
211 
212  iterLimit--;
213  }
214 }
215 
216 
217 class WX_SHAPE_TREE_ITEM_DATA : public wxClientData
218 {
219 public:
221 
223 };
224 
225 
227 {
228  m_labelMgr.reset( new LABEL_MANAGER( aGal ) );
229 }
230 
231 
233  bool aShowVertexNumbers )
234 {
235  Polyline( aL );
236 
237  if( aShowVertexNumbers)
238  m_labelMgr->Add( aL, GetStrokeColor() );
239 }
240 
241 
242 void PNS_LOG_VIEWER_OVERLAY::AnnotatedPoint( const VECTOR2I p, int size, std::string name, bool aShowVertexNumbers )
243 {
244  Line( p + VECTOR2D( size, size ), p - VECTOR2D( size, size ) );
245  Line( p + VECTOR2D( -size, size ), p - VECTOR2D( -size, size ) );
246 
247  //if( aShowVertexNumbers)
248  // m_labelMgr->Add( aL, GetStrokeColor() );
249 }
250 
251 
253 {
254  double radius = arc.GetRadius();
255  double start_angle = DEG2RAD( arc.GetStartAngle() );
256  double angle = DEG2RAD( arc.GetCentralAngle() );
257 
259  KIGFX::VIEW_OVERLAY::Arc( arc.GetCenter(), radius, start_angle, start_angle + angle );
260 
262  COLOR4D lightStrokeCol = prevStrokeCol.WithAlpha(0.5);
263  KIGFX::VIEW_OVERLAY::SetStrokeColor( lightStrokeCol );
264 
266  KIGFX::VIEW_OVERLAY::Arc( arc.GetCenter(), radius, start_angle, start_angle + angle );
267 
268  KIGFX::VIEW_OVERLAY::SetStrokeColor( prevStrokeCol );
269 }
270 
272 {
273  m_labelMgr->Redraw( this );
274 }
275 
276 
278 {
279  LoadSettings();
281 
282  m_viewSizer->Add( m_galPanel.get(), 1, wxEXPAND, 5 );
283 
284  Layout();
285 
286  Show( true );
287  Maximize();
288  Raise();
289 
290  auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>(
291  m_galPanel->GetView()->GetPainter()->GetSettings() );
292 
293  settings->SetZoneDisplayMode( ZONE_DISPLAY_MODE::SHOW_ZONE_OUTLINE );
294 
295  m_listPopupMenu = new wxMenu( wxT( "" ) );
296  m_listPopupMenu->Append( ID_LIST_COPY, wxT( "Copy selected geometry" ), wxT( "" ),
297  wxITEM_NORMAL );
298  m_listPopupMenu->Append( ID_LIST_SHOW_ALL, wxT( "Show all" ), wxT( "" ), wxITEM_NORMAL );
299  m_listPopupMenu->Append( ID_LIST_SHOW_NONE, wxT( "Show none" ), wxT( "" ), wxITEM_NORMAL );
300 
301  m_itemList->Connect( m_itemList->GetId(), wxEVT_TREELIST_ITEM_CONTEXT_MENU,
302  wxMouseEventHandler( PNS_LOG_VIEWER_FRAME::onListRightClick ), nullptr,
303  this );
304  //m_itemList->Connect(m_itemList->GetId(),wxEVT_LISTBOX,wxCommandEventHandler(PNS_LOG_VIEWER_FRAME::onListSelect),nullptr,this);
305  m_itemList->Connect( m_itemList->GetId(), wxEVT_TREELIST_SELECTION_CHANGED,
306  wxCommandEventHandler( PNS_LOG_VIEWER_FRAME::onListSelect ),
307  nullptr, this );
308  m_itemList->Connect( m_itemList->GetId(), wxEVT_TREELIST_ITEM_CHECKED,
309  wxCommandEventHandler( PNS_LOG_VIEWER_FRAME::onListChecked ),
310  nullptr, this );
311 
312  m_itemList->AppendColumn( "Type" );
313  m_itemList->AppendColumn( "Value" );
314  m_itemList->AppendColumn( "File" );
315  m_itemList->AppendColumn( "Method" );
316  m_itemList->AppendColumn( "Line" );
317 
318  m_overlay.reset( new PNS_LOG_VIEWER_OVERLAY ( m_galPanel->GetGAL() ) );
319  m_galPanel->GetView()->Add( m_overlay.get() );
320 }
321 
322 
324 {
325  m_overlay = nullptr;
326 }
327 
328 
330 {
331 
332 }
333 
334 
336 {
337  PNS_TEST_DEBUG_DECORATOR* dbgd = m_env->GetDebugDecorator();
338  int count = dbgd->GetStageCount();
339 
340  int iter = m_rewindIter;
341 
342  if( count <= 0 )
343  return nullptr;
344 
345  if( iter < 0 )
346  iter = 0;
347 
348  if( iter >= count )
349  iter = count - 1;
350 
351  return dbgd->GetStage( iter );
352 }
353 
354 
356 {
357  if( !m_env )
358  return;
359 
361 
362  if( !st )
363  return;
364 
365  m_overlay.reset( new PNS_LOG_VIEWER_OVERLAY ( m_galPanel->GetGAL() ) );
366  m_galPanel->GetView()->Add( m_overlay.get() );
367 
368  auto drawShapes = [&]( PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT* ent ) -> bool
369  {
370  bool isEnabled = ent->IsVisible();
371  bool isSelected = false;
372 
373  if( !isEnabled )
374  return true;
375 
376  for( auto& sh : ent->m_shapes )
377  {
378  COLOR4D color = ent->m_color;
379  int lineWidth = ent->m_width;
380 
381  m_overlay->SetIsStroke( true );
382  m_overlay->SetIsFill( false );
383 
384  if( isSelected )
385  {
386  color.Brighten( 0.5 );
387  }
388 
389  m_overlay->SetStrokeColor( color );
390  m_overlay->SetLineWidth( ent->m_width );
391 
392  switch( sh->Type() )
393  {
394  case SH_CIRCLE:
395  {
396  auto cir = static_cast<SHAPE_CIRCLE*>( sh );
397  m_overlay->Circle( cir->GetCenter(), cir->GetRadius() );
398 
399  break;
400  }
401  case SH_RECT:
402  {
403  auto rect = static_cast<SHAPE_RECT*>( sh );
404  m_overlay->Rectangle( rect->GetPosition(), rect->GetPosition() + rect->GetSize() );
405 
406  break;
407  }
408  case SH_LINE_CHAIN:
409  {
410  auto lc = static_cast<SHAPE_LINE_CHAIN*>( sh );
411  m_overlay->AnnotatedPolyline( *lc, ent->m_name, ent->m_hasLabels && isSelected );
412 
413  break;
414 
415  }
416  default:
417  break;
418  }
419  }
420 
421  return true;
422  };
423 
424  st->m_entries->IterateTree( drawShapes );
425 
426  m_overlay->DrawAnnotations();
427 
428  m_galPanel->GetView()->MarkDirty();
429  m_galPanel->GetParent()->Refresh();
430 }
431 
432 
433 static BOARD* loadBoard( const std::string& filename )
434 {
435  PLUGIN::RELEASER pi( new PCB_IO );
436  BOARD* brd = nullptr;
437 
438  try
439  {
440  brd = pi->Load( wxString( filename.c_str() ), nullptr, nullptr );
441  }
442  catch( const IO_ERROR& ioe )
443  {
444  return nullptr;
445  }
446 
447  return brd;
448 }
449 
450 
452 {
453  m_logFile.reset( aLog );
454 
455  SetBoard( m_logFile->GetBoard() );
456 
457  m_env.reset( new PNS_TEST_ENVIRONMENT );
458 
459  m_env->SetMode( PNS::PNS_MODE_ROUTE_SINGLE );
460  m_env->ReplayLog( m_logFile.get() );
461 
462  auto dbgd = m_env->GetDebugDecorator();
463  int n_stages = dbgd->GetStageCount();
464  m_rewindSlider->SetMax( n_stages - 1 );
465  m_rewindSlider->SetValue( n_stages - 1 );
466  m_rewindIter = n_stages - 1;
467 
468  auto extents = m_board->GetBoundingBox();
469 
470 
471  BOX2D bbd;
472  bbd.SetOrigin( extents.GetOrigin() );
473  bbd.SetWidth( extents.GetWidth() );
474  bbd.SetHeight( extents.GetHeight() );
475  bbd.Inflate( std::min( bbd.GetWidth(), bbd.GetHeight() ) / 5 );
476 
477  m_galPanel->GetView()->SetViewport( bbd );
478 
481 }
482 
483 
484 void PNS_LOG_VIEWER_FRAME::onReload( wxCommandEvent& event )
485 {
486  event.Skip();
487 }
488 
489 void PNS_LOG_VIEWER_FRAME::onExit( wxCommandEvent& event )
490 {
491  event.Skip();
492 }
493 
494 
495 void PNS_LOG_VIEWER_FRAME::onListChecked( wxCommandEvent& event )
496 {
497  syncModel();
499 }
500 
501 
502 void PNS_LOG_VIEWER_FRAME::onRewindScroll( wxScrollEvent& event )
503 {
504  m_rewindIter = event.GetPosition();
507  char str[128];
508  sprintf( str, "%d", m_rewindIter );
509  m_rewindPos->SetValue( str );
510  event.Skip();
511 }
512 
513 
514 void PNS_LOG_VIEWER_FRAME::onBtnRewindLeft( wxCommandEvent& event )
515 {
516  if( m_rewindIter > 0 )
517  {
518  m_rewindIter--;
521  char str[128];
522  sprintf( str, "%d", m_rewindIter );
523  m_rewindPos->SetValue( str );
524  }
525 }
526 
527 
528 void PNS_LOG_VIEWER_FRAME::onBtnRewindRight( wxCommandEvent& event )
529 {
530  auto dbgd = m_env->GetDebugDecorator();
531  int count = dbgd->GetStageCount();
532 
533  if( m_rewindIter < count )
534  {
535  m_rewindIter++;
538  char str[128];
539  sprintf( str, "%d", m_rewindIter );
540  m_rewindPos->SetValue( str );
541  }
542 }
543 
544 
545 void PNS_LOG_VIEWER_FRAME::onRewindCountText( wxCommandEvent& event )
546 {
547  if( !m_env )
548  return;
549 
550  int val = wxAtoi( m_rewindPos->GetValue() );
551 
552  auto dbgd = m_env->GetDebugDecorator();
553  int count = dbgd->GetStageCount();
554 
555  if( val < 0 )
556  val = 0;
557 
558  if( val >= count )
559  val = count - 1;
560 
561  m_rewindIter = val;
562  m_rewindSlider->SetValue( m_rewindIter );
565 
566  event.Skip();
567 }
568 
569 
571 {
572  for( wxTreeListItem item = m_itemList->GetFirstItem(); item.IsOk();
573  item = m_itemList->GetNextItem( item ) )
574  {
575  WX_SHAPE_TREE_ITEM_DATA* idata =
576  static_cast<WX_SHAPE_TREE_ITEM_DATA*>( m_itemList->GetItemData( item ) );
577 
578  if( idata )
579  {
580  bool checked = m_itemList->GetCheckedState( item ) == wxCHK_CHECKED;
581  bool selected = m_itemList->IsSelected( item );
582  idata->m_item->m_visible = checked || selected;
583  idata->m_item->m_selected = selected;
584  }
585  }
586 }
587 
588 
589 void PNS_LOG_VIEWER_FRAME::onListRightClick( wxMouseEvent& event )
590 {
591  auto sel = m_itemList->GetPopupMenuSelectionFromUser( *m_listPopupMenu );
592 
593  switch( sel )
594  {
595  case ID_LIST_SHOW_NONE:
596  m_itemList->CheckItemRecursively( m_itemList->GetRootItem(), wxCHK_UNCHECKED );
597  syncModel();
599  break;
600  case ID_LIST_SHOW_ALL:
601  m_itemList->CheckItemRecursively( m_itemList->GetRootItem(), wxCHK_CHECKED );
602  syncModel();
604  break;
605  case ID_LIST_COPY:
606  {
607  wxString s;
608 
610 
611  if( !st )
612  return;
613 
614  auto formatShapes = [&]( PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT* ent ) -> bool
615  {
616  if( ent->m_selected )
617  {
618  for( auto sh : ent->m_shapes )
619  {
620  s += "// " + ent->m_name + "\n " + sh->Format() + "; \n";
621  }
622  }
623 
624  return true;
625  };
626 
627  st->m_entries->IterateTree( formatShapes );
628 
629  if( wxTheClipboard->Open() )
630  {
631  // This data objects are held by the clipboard,
632  // so do not delete them in the app.
633  wxTheClipboard->SetData( new wxTextDataObject( s ) );
634  wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
635  wxTheClipboard->Close();
636  }
637 
638  return;
639  }
640  }
641 }
642 
643 
644 void PNS_LOG_VIEWER_FRAME::onListSelect( wxCommandEvent& event )
645 {
646  syncModel();
648 }
649 
650 
651 void PNS_LOG_VIEWER_FRAME::buildListTree( wxTreeListItem item,
652  PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT* ent, int depth )
653 {
654 #ifdef EXTRA_VERBOSE
655  for( int i = 0; i < depth * 2; i++ )
656  printf( " " );
657 
658  if( ent->m_msg.length() )
659  printf( "MSG: %s\n", ent->m_msg.c_str() );
660  else
661  printf( "SHAPES: %s [%d]\n", ent->m_name.c_str(), ent->m_children.size() );
662 #endif
663 
664  wxTreeListItem ritem;
665 
666  printf("depth %d\n", depth );
667 
668  if( ent->m_msg.length() )
669  {
670  ritem = m_itemList->AppendItem( item, "Child" );
671  m_itemList->SetItemText( ritem, 0, "Message" );
672  m_itemList->SetItemText( ritem, 1, ent->m_msg );
673  }
674  else
675  {
676  ritem = m_itemList->AppendItem( item, "Child" );
677  m_itemList->SetItemText( ritem, 0, "Shapes" );
678  m_itemList->SetItemText( ritem, 1, ent->m_name );
679  }
680 
681  m_itemList->SetItemText( ritem, 2, wxFileNameFromPath( ent->m_srcLoc.fileName ) );
682  m_itemList->SetItemText( ritem, 3, ent->m_srcLoc.funcName );
683  m_itemList->SetItemText( ritem, 4, wxString::Format("%d", ent->m_srcLoc.line ) );
684 
685  m_itemList->SetItemData( ritem, new WX_SHAPE_TREE_ITEM_DATA( ent ) );
686 
687  if( !ent->m_children.size() )
688  return;
689 
690  for( auto child : ent->m_children )
691  {
692  buildListTree( ritem, child, depth + 1 );
693  }
694 }
695 
696 
697 static void expandAllChildren( wxTreeListCtrl* tree )
698 {
699  wxTreeListItem child = tree->GetFirstItem ();
700 
701  while( child.IsOk() )
702  {
703  tree->Expand ( child );
704  child = tree->GetNextItem( child );
705  }
706 }
707 
708 
710 {
711  if( !m_env )
712  return;
713 
714  auto dbgd = m_env->GetDebugDecorator();
715  int count = dbgd->GetStageCount();
716 
717  wxArrayString dumpStrings;
718 
719  if( count <= 0 )
720  return;
721 
722  if( iter < 0 )
723  iter = 0;
724 
725  if( iter >= count )
726  iter = count - 1;
727 
728  auto st = dbgd->GetStage( iter );
729  auto rootItem = m_itemList->GetRootItem();
730 
731  m_itemList->DeleteAllItems();
732  buildListTree( rootItem, st->m_entries );
733  m_itemList->CheckItemRecursively( rootItem, wxCHK_UNCHECKED );
734 
736 
737  m_itemList->Refresh();
738 }
739 
740 
741 int replay_main_func( int argc, char* argv[] )
742 {
743  auto frame = new PNS_LOG_VIEWER_FRAME( nullptr );
744 
745  // drcCreateTestsProviderClearance();
746  // drcCreateTestsProviderEdgeClearance();
747 
748  if( argc >= 2 && std::string( argv[1] ) == "-h" )
749  {
750  printf( "PNS Log (Re)player. Allows to step through the log written by the ROUTER_TOOL "
751  "in debug KiCad builds. " );
752  printf( "Requires a board file with UUIDs and a matching log file. Both are written to "
753  "/tmp when you press '0' during routing." );
754  return 0;
755  }
756 
757  if( argc < 3 )
758  {
759  printf( "Expected parameters: log_file.log board_file.dump\n" );
760  return 0;
761  }
762 
763  PNS_LOG_FILE* logFile = new PNS_LOG_FILE;
764  logFile->Load( argv[1], argv[2] );
765 
766  frame->SetLogFile( logFile );
767  //SetTopFrame( frame ); // wxApp gets a face.
768 
769  return 0;
770 }
771 
772 
774  "replay",
775  "PNS Log Player",
777 } );
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:52
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
double GetRadius() const
Definition: shape_arc.cpp:492
#define ID_LIST_COPY
const COLOR4D & GetStrokeColor() const
Definition: view_overlay.h:103
int color
Definition: DXF_plotter.cpp:57
COLOR4D WithAlpha(double aAlpha) const
Return a color with the same color, but the given alpha.
Definition: color4d.h:314
PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT * m_item
void SetSize(const Vec &size)
Definition: box2.h:195
double GetStartAngle() const
Definition: shape_arc.cpp:444
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
void Arc(const VECTOR2D &aCenterPoint, double aRadius, double aStartAngle, double aEndAngle)
#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 Arc(const SHAPE_ARC &arc)
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:439
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
int GetWidth() const
Definition: shape_arc.h:156
std::shared_ptr< PNS_LOG_VIEWER_OVERLAY > m_overlay
see class PGM_BASE
const char * name
Definition: DXF_plotter.cpp:56
void SetLineWidth(double aLineWidth)
double DEG2RAD(double deg)
Definition: trigo.h:229
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
void AnnotatedPoint(const VECTOR2I p, int size, std::string name="", bool aShowVertexNumbers=false)
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
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
virtual void SetBoard(std::shared_ptr< BOARD > b)
void SetOrigin(const Vec &pos)
Definition: box2.h:193
double GetCentralAngle() const
Definition: shape_arc.cpp:479
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
VECTOR2I GetCenter() const
Definition: shape_arc.cpp:464
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