qa: some new stuff for the P&S debugger:
- search/filter in messages - detection of non-45 degree lines - indication of routing stage status (OK/FAIL) - loading of project files (for custom DRC rules)
This commit is contained in:
parent
c8b93c39b6
commit
563b67f9a0
|
@ -728,6 +728,132 @@
|
|||
<event name="OnCheckBox">onShowThinLinesChecked</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="checked">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Show Vertices</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_showVertices</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnCheckBox">onShowVerticesChecked</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font">,90,92,-1,70,0</property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">MyLabel</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_algoStatus</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
|
|
|
@ -1,33 +1,82 @@
|
|||
#include <wx/cmdline.h>
|
||||
|
||||
#include <qa_utils/utility_registry.h>
|
||||
|
||||
#include "pns_log_file.h"
|
||||
#include "pns_log_viewer_frame.h"
|
||||
|
||||
|
||||
static const wxCmdLineEntryDesc g_cmdLineDesc[] = {
|
||||
{
|
||||
wxCMD_LINE_SWITCH,
|
||||
"h",
|
||||
"help",
|
||||
_( "displays help on the command line parameters" ).mb_str(),
|
||||
wxCMD_LINE_VAL_NONE,
|
||||
wxCMD_LINE_OPTION_HELP,
|
||||
},
|
||||
{
|
||||
wxCMD_LINE_OPTION,
|
||||
"i",
|
||||
"iteration-limit",
|
||||
_( "Max number of iterations" ).mb_str(),
|
||||
wxCMD_LINE_VAL_NUMBER,
|
||||
wxCMD_LINE_PARAM_OPTIONAL,
|
||||
},
|
||||
{
|
||||
wxCMD_LINE_OPTION,
|
||||
"s",
|
||||
"steps-limit",
|
||||
_( "execute log up to steps-limit events" ).mb_str(),
|
||||
wxCMD_LINE_VAL_NUMBER,
|
||||
wxCMD_LINE_PARAM_OPTIONAL,
|
||||
},
|
||||
{
|
||||
wxCMD_LINE_PARAM,
|
||||
"filename",
|
||||
"filename",
|
||||
_( "log file name (no extensions)" ).mb_str(),
|
||||
wxCMD_LINE_VAL_STRING,
|
||||
wxCMD_LINE_OPTION_MANDATORY,
|
||||
},
|
||||
{ wxCMD_LINE_NONE }
|
||||
};
|
||||
|
||||
int replay_main_func( int argc, char* argv[] )
|
||||
{
|
||||
wxCmdLineParser cl_parser( argc, argv );
|
||||
cl_parser.SetDesc( g_cmdLineDesc );
|
||||
cl_parser.AddUsageText( _( "PNS Log (Re)player. Allows to step through the log written by the ROUTER_TOOL "
|
||||
"in debug KiCad builds." ) );
|
||||
|
||||
int cmd_parsed_ok = cl_parser.Parse();
|
||||
|
||||
if( cl_parser.Found("help") )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( cmd_parsed_ok != 0 )
|
||||
{
|
||||
printf("P&S Log Replay/Debug tool. For command line options, call %s -h.\n\n", argv[0] );
|
||||
// Help and invalid input both stop here
|
||||
return ( cmd_parsed_ok == -1 ) ? KI_TEST::RET_CODES::OK : KI_TEST::RET_CODES::BAD_CMDLINE;
|
||||
}
|
||||
|
||||
wxString filename;
|
||||
|
||||
long iter_limit = 256;
|
||||
long steps_limit = -1;
|
||||
cl_parser.Found( "iteration-limit", &iter_limit );
|
||||
cl_parser.Found( "steps-limit", &steps_limit );
|
||||
filename = cl_parser.GetParam(0);
|
||||
|
||||
printf("iters %d steps %d file '%s'\n", iter_limit, steps_limit, (const char *) filename.c_str() );
|
||||
|
||||
auto frame = new PNS_LOG_VIEWER_FRAME( nullptr );
|
||||
|
||||
// drcCreateTestsProviderClearance();
|
||||
// drcCreateTestsProviderEdgeClearance();
|
||||
|
||||
if( argc >= 2 && std::string( argv[1] ) == "-h" )
|
||||
{
|
||||
printf( "PNS Log (Re)player. Allows to step through the log written by the ROUTER_TOOL "
|
||||
"in debug KiCad builds. " );
|
||||
printf( "Requires a board file with UUIDs and a matching log file. Both are written to "
|
||||
"/tmp when you press '0' during routing." );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( argc < 3 )
|
||||
{
|
||||
printf( "Expected parameters: log_file.log board_file.dump\n" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
PNS_LOG_FILE* logFile = new PNS_LOG_FILE;
|
||||
logFile->Load( argv[1], argv[2] );
|
||||
|
||||
logFile->Load( wxFileName( argv[1] ) );
|
||||
frame->SetLogFile( logFile );
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -64,9 +64,21 @@ PNS_LOG_FILE::PNS_LOG_FILE()
|
|||
}
|
||||
|
||||
|
||||
bool PNS_LOG_FILE::Load( const std::string& logName, const std::string boardName )
|
||||
bool PNS_LOG_FILE::Load( const wxFileName& logFileName )
|
||||
{
|
||||
FILE* f = fopen( logName.c_str(), "rb" );
|
||||
wxFileName fname_log( logFileName );
|
||||
fname_log.SetExt( wxT( "log" ) );
|
||||
|
||||
wxFileName fname_dump( logFileName );
|
||||
fname_dump.SetExt( wxT( "dump" ) );
|
||||
|
||||
wxFileName fname_project( logFileName );
|
||||
fname_project.SetExt( wxT( "kicad_pro" ) );
|
||||
fname_project.MakeAbsolute();
|
||||
|
||||
FILE* f = fopen( fname_log.GetFullPath().c_str(), "rb" );
|
||||
|
||||
printf("Loading dump from '%s'\n", (const char*) fname_log.GetFullPath().c_str() );
|
||||
|
||||
if( !f )
|
||||
return false;
|
||||
|
@ -101,10 +113,15 @@ bool PNS_LOG_FILE::Load( const std::string& logName, const std::string boardName
|
|||
|
||||
fclose( f );
|
||||
|
||||
|
||||
m_settingsMgr.reset( new SETTINGS_MANAGER ( true ) );
|
||||
m_settingsMgr->LoadProject( fname_project.GetFullPath() );
|
||||
|
||||
try
|
||||
{
|
||||
PCB_PLUGIN io;
|
||||
m_board.reset( io.Load( boardName.c_str(), nullptr, nullptr ) );
|
||||
m_board.reset( io.Load( fname_dump.GetFullPath(), nullptr, nullptr ) );
|
||||
m_board->SetProject( m_settingsMgr->GetProject( fname_project.GetFullPath() ) );
|
||||
|
||||
std::shared_ptr<DRC_ENGINE> drcEngine( new DRC_ENGINE );
|
||||
|
||||
|
@ -113,6 +130,8 @@ bool PNS_LOG_FILE::Load( const std::string& logName, const std::string boardName
|
|||
|
||||
bds.m_DRCEngine = drcEngine;
|
||||
|
||||
m_board->SynchronizeNetsAndNetClasses();
|
||||
|
||||
drcEngine->SetBoard( m_board.get() );
|
||||
drcEngine->SetDesignSettings( &bds );
|
||||
drcEngine->SetLogReporter( new CONSOLE_MSG_REPORTER( &consoleLog ) );
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <wx/filename.h>
|
||||
|
||||
#include <kiid.h>
|
||||
#include <math/vector2d.h>
|
||||
#include <router/pns_logger.h>
|
||||
|
@ -40,6 +42,8 @@
|
|||
#include <pcbnew/board.h>
|
||||
#include <pcbnew/board_connected_item.h>
|
||||
|
||||
#include <settings/settings_manager.h>
|
||||
|
||||
class PNS_LOG_FILE
|
||||
{
|
||||
public:
|
||||
|
@ -55,7 +59,7 @@ public:
|
|||
};
|
||||
|
||||
// Loads a P&S event log and the associated board file. These two always go together.
|
||||
bool Load( const std::string& logFileName, const std::string boardFileName );
|
||||
bool Load( const wxFileName& logFileName );
|
||||
|
||||
BOARD_CONNECTED_ITEM* ItemById( const EVENT_ENTRY& evt );
|
||||
|
||||
|
@ -67,6 +71,7 @@ public:
|
|||
PNS::ROUTING_SETTINGS* GetRoutingSettings() const { return m_routerSettings.get(); }
|
||||
|
||||
private:
|
||||
std::shared_ptr<SETTINGS_MANAGER> m_settingsMgr;
|
||||
std::unique_ptr<PNS::ROUTING_SETTINGS> m_routerSettings;
|
||||
std::vector<EVENT_ENTRY> m_events;
|
||||
std::shared_ptr<BOARD> m_board;
|
||||
|
|
|
@ -136,8 +136,8 @@ void PNS_LOG_PLAYER::ReplayLog( PNS_LOG_FILE* aLog, int aStartEventIndex, int aF
|
|||
m_debugDecorator->NewStage( "move", 0, PNSLOGINFO );
|
||||
m_viewTracker->SetStage( m_debugDecorator->GetStageCount() - 1 );
|
||||
m_debugDecorator->Message( wxString::Format( "move (%d, %d)", evt.p.x, evt.p.y ) );
|
||||
printf( " move -> (%d, %d)\n", evt.p.x, evt.p.y );
|
||||
m_router->Move( evt.p, ritem );
|
||||
bool ret = m_router->Move( evt.p, ritem );
|
||||
m_debugDecorator->SetCurrentStageStatus( ret );
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -78,8 +78,9 @@ void PNS_LOG_VIEWER_OVERLAY::AnnotatedPoint( const VECTOR2I p, int size, std::st
|
|||
Line( p + VECTOR2D( size, size ), p - VECTOR2D( size, size ) );
|
||||
Line( p + VECTOR2D( -size, size ), p - VECTOR2D( -size, size ) );
|
||||
|
||||
//if( aShowVertexNumbers)
|
||||
// m_labelMgr->Add( aL, GetStrokeColor() );
|
||||
if( name.length() > 0 )
|
||||
m_labelMgr->Add( p, name, GetStrokeColor() );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -627,7 +628,7 @@ void PNS_LOG_VIEWER_FRAME::updateDumpPanel( int iter )
|
|||
buildListTree( rootItem, st->m_entries );
|
||||
m_itemList->CheckItemRecursively( rootItem, wxCHK_UNCHECKED );
|
||||
|
||||
expandAllChildren( m_itemList );
|
||||
collapseAllChildren( m_itemList );
|
||||
|
||||
m_itemList->Refresh();
|
||||
}
|
||||
|
|
|
@ -47,9 +47,10 @@
|
|||
class WX_SHAPE_TREE_ITEM_DATA : public wxClientData
|
||||
{
|
||||
public:
|
||||
WX_SHAPE_TREE_ITEM_DATA( PNS_DEBUG_SHAPE* item ) : m_item( item ){};
|
||||
WX_SHAPE_TREE_ITEM_DATA( PNS_DEBUG_SHAPE* item, int level = 0 ) : m_item( item ), m_level( level ) {};
|
||||
|
||||
PNS_DEBUG_SHAPE* m_item;
|
||||
int m_level;
|
||||
};
|
||||
|
||||
|
||||
|
@ -64,8 +65,8 @@ void PNS_LOG_VIEWER_OVERLAY::AnnotatedPolyline( const SHAPE_LINE_CHAIN& aL, std:
|
|||
{
|
||||
Polyline( aL );
|
||||
|
||||
if( aShowVertexNumbers)
|
||||
m_labelMgr->Add( aL, GetStrokeColor() );
|
||||
if( name.length() > 0 )
|
||||
m_labelMgr->Add( aL.CPoint(-1), name, GetStrokeColor() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,8 +75,8 @@ void PNS_LOG_VIEWER_OVERLAY::AnnotatedPoint( const VECTOR2I p, int size, std::st
|
|||
Line( p + VECTOR2D( size, size ), p - VECTOR2D( size, size ) );
|
||||
Line( p + VECTOR2D( -size, size ), p - VECTOR2D( -size, size ) );
|
||||
|
||||
//if( aShowVertexNumbers)
|
||||
// m_labelMgr->Add( aL, GetStrokeColor() );
|
||||
if( name.length() > 0 )
|
||||
m_labelMgr->Add( p, name, GetStrokeColor() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -157,6 +158,8 @@ PNS_LOG_VIEWER_FRAME::PNS_LOG_VIEWER_FRAME( wxFrame* frame ) : PNS_LOG_VIEWER_FR
|
|||
m_itemList->AppendColumn( "File" );
|
||||
m_itemList->AppendColumn( "Method" );
|
||||
m_itemList->AppendColumn( "Line" );
|
||||
m_itemList->AppendColumn( "VCount" );
|
||||
m_itemList->AppendColumn( "Non-45" );
|
||||
|
||||
m_overlay.reset( new PNS_LOG_VIEWER_OVERLAY ( m_galPanel->GetGAL() ) );
|
||||
m_galPanel->GetView()->Add( m_overlay.get() );
|
||||
|
@ -212,7 +215,7 @@ void PNS_LOG_VIEWER_FRAME::drawLoggedItems( int iter )
|
|||
auto drawShapes = [&]( PNS_DEBUG_SHAPE* ent ) -> bool
|
||||
{
|
||||
bool isEnabled = ent->IsVisible();
|
||||
bool isSelected = false;
|
||||
bool isSelected = ent->m_selected;
|
||||
|
||||
if( !isEnabled )
|
||||
return true;
|
||||
|
@ -261,7 +264,7 @@ void PNS_LOG_VIEWER_FRAME::drawLoggedItems( int iter )
|
|||
case SH_LINE_CHAIN:
|
||||
{
|
||||
auto lc = static_cast<SHAPE_LINE_CHAIN*>( sh );
|
||||
m_overlay->AnnotatedPolyline( *lc, ent->m_name.ToStdString(), ent->m_hasLabels && isSelected );
|
||||
m_overlay->AnnotatedPolyline( *lc, ent->m_name.ToStdString(), m_showVertices || ( ent->m_hasLabels && isSelected ) );
|
||||
|
||||
break;
|
||||
|
||||
|
@ -364,6 +367,13 @@ void PNS_LOG_VIEWER_FRAME::onShowRPIsChecked( wxCommandEvent& event )
|
|||
updatePnsPreviewItems( m_rewindIter );
|
||||
}
|
||||
|
||||
void PNS_LOG_VIEWER_FRAME::onShowVerticesChecked( wxCommandEvent& event )
|
||||
{
|
||||
m_showVertices = event.GetInt();
|
||||
drawLoggedItems( m_rewindIter );
|
||||
updatePnsPreviewItems( m_rewindIter );
|
||||
}
|
||||
|
||||
|
||||
void PNS_LOG_VIEWER_FRAME::onRewindScroll( wxScrollEvent& event )
|
||||
{
|
||||
|
@ -410,6 +420,12 @@ void PNS_LOG_VIEWER_FRAME::onBtnRewindRight( wxCommandEvent& event )
|
|||
}
|
||||
}
|
||||
|
||||
void PNS_LOG_VIEWER_FRAME::onFilterText( wxCommandEvent& event )
|
||||
{
|
||||
m_searchString = m_filterString->GetValue();
|
||||
updateDumpPanel( m_rewindIter );
|
||||
}
|
||||
|
||||
|
||||
void PNS_LOG_VIEWER_FRAME::onRewindCountText( wxCommandEvent& event )
|
||||
{
|
||||
|
@ -518,6 +534,81 @@ void PNS_LOG_VIEWER_FRAME::onListSelect( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
|
||||
static bool isLine45Degree( const SHAPE_LINE_CHAIN* lc )
|
||||
{
|
||||
for( int i = 0; i < lc->SegmentCount(); i++ )
|
||||
{
|
||||
const SEG& s = lc->CSegment( i );
|
||||
|
||||
if( lc->IsArcSegment( i ) )
|
||||
continue;
|
||||
|
||||
if( s.Length() < 10 )
|
||||
continue;
|
||||
|
||||
double angle = 180.0 / M_PI *
|
||||
atan2( (double) s.B.y - (double) s.A.y,
|
||||
(double) s.B.x - (double) s.A.x );
|
||||
|
||||
if( angle < 0 )
|
||||
angle += 360.0;
|
||||
|
||||
double angle_a = fabs( fmod( angle, 45.0 ) );
|
||||
|
||||
if( angle_a > 1.0 && angle_a < 44.0 )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool PNS_LOG_VIEWER_FRAME::filterStringMatches( PNS_DEBUG_SHAPE* ent )
|
||||
{
|
||||
|
||||
std::set<PNS_DEBUG_SHAPE*> processed;
|
||||
std::deque<PNS_DEBUG_SHAPE*> q;
|
||||
|
||||
q.push_back(ent);
|
||||
int total = 0;
|
||||
while ( q.size() > 0 )
|
||||
{
|
||||
PNS_DEBUG_SHAPE* top = q.front();
|
||||
|
||||
q.pop_front();
|
||||
|
||||
for ( auto chld : top->m_children )
|
||||
{
|
||||
bool match = m_searchString.Length() == 0 ? true : false;
|
||||
//printf("CHK %s\n", (const char *) chld->m_name.c_str() );
|
||||
chld->m_filterMatch = false;
|
||||
if ( chld->m_name.Contains( m_searchString ) )
|
||||
match = true;
|
||||
if ( chld->m_msg.Contains( m_searchString ) )
|
||||
match = true;
|
||||
|
||||
if( match )
|
||||
{
|
||||
for ( PNS_DEBUG_SHAPE *cur = chld; cur; cur = cur->m_parent )
|
||||
cur->m_filterMatch = match;
|
||||
}
|
||||
|
||||
if( processed.find(chld) == processed.end() )
|
||||
{
|
||||
q.push_back( chld );
|
||||
processed.insert( chld );
|
||||
}
|
||||
}
|
||||
total++;
|
||||
}
|
||||
|
||||
printf("total: %d\n", total );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void PNS_LOG_VIEWER_FRAME::buildListTree( wxTreeListItem item,
|
||||
PNS_DEBUG_SHAPE* ent, int depth )
|
||||
{
|
||||
|
@ -533,7 +624,8 @@ void PNS_LOG_VIEWER_FRAME::buildListTree( wxTreeListItem item,
|
|||
|
||||
wxTreeListItem ritem;
|
||||
|
||||
printf("depth %d\n", depth );
|
||||
if( !ent->m_filterMatch )
|
||||
return;
|
||||
|
||||
if( ent->m_msg.length() )
|
||||
{
|
||||
|
@ -560,7 +652,35 @@ void PNS_LOG_VIEWER_FRAME::buildListTree( wxTreeListItem item,
|
|||
m_itemList->SetItemText( ritem, 3, ent->m_srcLoc.funcName );
|
||||
m_itemList->SetItemText( ritem, 4, wxString::Format("%d", ent->m_srcLoc.line ) );
|
||||
|
||||
m_itemList->SetItemData( ritem, new WX_SHAPE_TREE_ITEM_DATA( ent ) );
|
||||
int totalVC = 0, totalVCSimplified = 0;
|
||||
bool is45Degree = true;
|
||||
|
||||
for( SHAPE* sh : ent->m_shapes )
|
||||
{
|
||||
if( sh->Type() == SH_LINE_CHAIN )
|
||||
{
|
||||
auto lc = static_cast<SHAPE_LINE_CHAIN*>( sh );
|
||||
|
||||
totalVC += lc->PointCount();
|
||||
|
||||
SHAPE_LINE_CHAIN simp(*lc);
|
||||
|
||||
simp.Simplify();
|
||||
|
||||
totalVCSimplified += simp.PointCount();
|
||||
|
||||
if( !isLine45Degree( lc ) )
|
||||
is45Degree = false;
|
||||
}
|
||||
}
|
||||
|
||||
if( totalVC > 0 )
|
||||
m_itemList->SetItemText( ritem, 5, wxString::Format( "%d [%d]", totalVC, totalVCSimplified ) );
|
||||
|
||||
if( !is45Degree )
|
||||
m_itemList->SetItemText( ritem, 6, wxT("") );
|
||||
|
||||
m_itemList->SetItemData( ritem, new WX_SHAPE_TREE_ITEM_DATA( ent, depth ) );
|
||||
|
||||
if( !ent->m_children.size() )
|
||||
return;
|
||||
|
@ -572,7 +692,7 @@ void PNS_LOG_VIEWER_FRAME::buildListTree( wxTreeListItem item,
|
|||
}
|
||||
|
||||
|
||||
static void expandAllChildren( wxTreeListCtrl* tree, int maxLevel = 0 )
|
||||
static void expandAllChildren( wxTreeListCtrl* tree, int maxLevel = -1 )
|
||||
{
|
||||
wxTreeListItem child = tree->GetFirstItem ();
|
||||
|
||||
|
@ -581,7 +701,7 @@ static void expandAllChildren( wxTreeListCtrl* tree, int maxLevel = 0 )
|
|||
WX_SHAPE_TREE_ITEM_DATA* idata =
|
||||
static_cast<WX_SHAPE_TREE_ITEM_DATA*>( tree->GetItemData( child ) );
|
||||
|
||||
if( idata->m_item->m_level <= maxLevel )
|
||||
if( maxLevel < 0 || idata->m_level <= maxLevel )
|
||||
tree->Expand ( child );
|
||||
else
|
||||
tree->Collapse ( child );
|
||||
|
@ -621,13 +741,26 @@ void PNS_LOG_VIEWER_FRAME::updateDumpPanel( int iter )
|
|||
iter = count - 1;
|
||||
|
||||
auto st = dbgd->GetStage( iter );
|
||||
|
||||
if( st->m_status )
|
||||
{
|
||||
m_algoStatus->SetLabel("OK");
|
||||
m_algoStatus->SetForegroundColour( wxColor(*wxGREEN));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_algoStatus->SetLabel("FAIL");
|
||||
m_algoStatus->SetForegroundColour( wxColor(*wxRED));
|
||||
}
|
||||
|
||||
auto rootItem = m_itemList->GetRootItem();
|
||||
|
||||
m_itemList->DeleteAllItems();
|
||||
filterStringMatches( st->m_entries );
|
||||
buildListTree( rootItem, st->m_entries );
|
||||
m_itemList->CheckItemRecursively( rootItem, wxCHK_UNCHECKED );
|
||||
|
||||
expandAllChildren( m_itemList );
|
||||
expandAllChildren( m_itemList, 0 );
|
||||
|
||||
m_itemList->Refresh();
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ private:
|
|||
void syncModel();
|
||||
PNS_DEBUG_STAGE* getCurrentStage();
|
||||
void updatePnsPreviewItems( int iter );
|
||||
bool filterStringMatches( PNS_DEBUG_SHAPE* ent );
|
||||
|
||||
virtual void onReload( wxCommandEvent& event ) override;
|
||||
virtual void onExit( wxCommandEvent& event ) override;
|
||||
|
@ -75,6 +76,8 @@ private:
|
|||
virtual void onListChecked( wxCommandEvent& event );
|
||||
virtual void onShowThinLinesChecked( wxCommandEvent& event ) override;
|
||||
virtual void onShowRPIsChecked( wxCommandEvent& event ) override;
|
||||
virtual void onShowVerticesChecked( wxCommandEvent& event ) override;
|
||||
virtual void onFilterText( wxCommandEvent& event ) override;
|
||||
|
||||
std::shared_ptr<PNS_LOG_VIEWER_OVERLAY> m_overlay;
|
||||
std::shared_ptr<PNS_LOG_FILE> m_logFile;
|
||||
|
@ -85,6 +88,8 @@ private:
|
|||
|
||||
bool m_showThinLines = true;
|
||||
bool m_showRPIs = true;
|
||||
bool m_showVertices = false;
|
||||
wxString m_searchString;
|
||||
};
|
||||
|
||||
class LABEL_MANAGER;
|
||||
|
|
|
@ -71,6 +71,15 @@ PNS_LOG_VIEWER_FRAME_BASE::PNS_LOG_VIEWER_FRAME_BASE( wxWindow* parent, wxWindow
|
|||
m_chkThinLines = new wxCheckBox( this, wxID_ANY, wxT("Thin lines"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer3->Add( m_chkThinLines, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_showVertices = new wxCheckBox( this, wxID_ANY, wxT("Show Vertices"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer3->Add( m_showVertices, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_algoStatus = new wxStaticText( this, wxID_ANY, wxT("MyLabel"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_algoStatus->Wrap( -1 );
|
||||
m_algoStatus->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
|
||||
|
||||
fgSizer3->Add( m_algoStatus, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
m_mainSizer->Add( fgSizer3, 0, wxEXPAND, 5 );
|
||||
|
||||
|
@ -112,8 +121,10 @@ PNS_LOG_VIEWER_FRAME_BASE::PNS_LOG_VIEWER_FRAME_BASE( wxWindow* parent, wxWindow
|
|||
m_rewindRight->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onBtnRewindRight ), NULL, this );
|
||||
m_rewindPos->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindCountText2 ), NULL, this );
|
||||
m_rewindPos->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindCountText ), NULL, this );
|
||||
m_filterString->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onFilterText ), NULL, this );
|
||||
m_chkShowRPItems->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onShowRPIsChecked ), NULL, this );
|
||||
m_chkThinLines->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onShowThinLinesChecked ), NULL, this );
|
||||
m_showVertices->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onShowVerticesChecked ), NULL, this );
|
||||
}
|
||||
|
||||
PNS_LOG_VIEWER_FRAME_BASE::~PNS_LOG_VIEWER_FRAME_BASE()
|
||||
|
@ -132,7 +143,9 @@ PNS_LOG_VIEWER_FRAME_BASE::~PNS_LOG_VIEWER_FRAME_BASE()
|
|||
m_rewindRight->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onBtnRewindRight ), NULL, this );
|
||||
m_rewindPos->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindCountText2 ), NULL, this );
|
||||
m_rewindPos->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindCountText ), NULL, this );
|
||||
m_filterString->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onFilterText ), NULL, this );
|
||||
m_chkShowRPItems->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onShowRPIsChecked ), NULL, this );
|
||||
m_chkThinLines->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onShowThinLinesChecked ), NULL, this );
|
||||
m_showVertices->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onShowVerticesChecked ), NULL, this );
|
||||
|
||||
}
|
||||
|
|
|
@ -51,6 +51,8 @@ class PNS_LOG_VIEWER_FRAME_BASE : public wxFrame
|
|||
wxTextCtrl* m_filterString;
|
||||
wxCheckBox* m_chkShowRPItems;
|
||||
wxCheckBox* m_chkThinLines;
|
||||
wxCheckBox* m_showVertices;
|
||||
wxStaticText* m_algoStatus;
|
||||
wxBoxSizer* m_viewSizer;
|
||||
wxTreeListCtrl* m_itemList;
|
||||
wxStatusBar* m_statusBar;
|
||||
|
@ -63,8 +65,10 @@ class PNS_LOG_VIEWER_FRAME_BASE : public wxFrame
|
|||
virtual void onBtnRewindRight( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onRewindCountText2( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onRewindCountText( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onFilterText( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onShowRPIsChecked( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onShowThinLinesChecked( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onShowVerticesChecked( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
|
|
@ -101,6 +101,7 @@ PNS_DEBUG_STAGE::PNS_DEBUG_STAGE()
|
|||
m_name = "<unknown>";
|
||||
m_iter = 0;
|
||||
m_entries = new PNS_DEBUG_SHAPE();
|
||||
m_status = false;
|
||||
}
|
||||
|
||||
PNS_DEBUG_STAGE::~PNS_DEBUG_STAGE()
|
||||
|
@ -252,7 +253,13 @@ void PNS_TEST_DEBUG_DECORATOR::NewStage( const wxString& name, int iter,
|
|||
m_activeEntry = m_stages.back()->m_entries;
|
||||
}
|
||||
|
||||
void PNS_TEST_DEBUG_DECORATOR::SetCurrentStageStatus( bool stat )
|
||||
{
|
||||
if( m_stages.empty() )
|
||||
return;
|
||||
|
||||
m_stages.back()->m_status = stat;
|
||||
}
|
||||
|
||||
BOX2I PNS_TEST_DEBUG_DECORATOR::GetStageExtents( int stage ) const
|
||||
{
|
||||
|
|
|
@ -51,6 +51,7 @@ public:
|
|||
PNS::DEBUG_DECORATOR::SRC_LOCATION_INFO m_srcLoc;
|
||||
bool m_visible;
|
||||
bool m_selected;
|
||||
bool m_filterMatch;
|
||||
int m_level;
|
||||
};
|
||||
|
||||
|
@ -62,6 +63,7 @@ struct PNS_DEBUG_STAGE
|
|||
wxString m_name;
|
||||
int m_iter;
|
||||
PNS_DEBUG_SHAPE* m_entries;
|
||||
bool m_status;
|
||||
};
|
||||
|
||||
|
||||
|
@ -101,6 +103,8 @@ public:
|
|||
|
||||
BOX2I GetStageExtents( int stage ) const;
|
||||
|
||||
void SetCurrentStageStatus( bool stat );
|
||||
|
||||
private:
|
||||
void addEntry( PNS_DEBUG_SHAPE* ent );
|
||||
PNS_DEBUG_STAGE* currentStage();
|
||||
|
|
Loading…
Reference in New Issue