diff --git a/qa/tools/pns/pns_log_viewer_frame.cpp b/qa/tools/pns/pns_log_viewer_frame.cpp index 17c5f4b815..cdc6ddeb85 100644 --- a/qa/tools/pns/pns_log_viewer_frame.cpp +++ b/qa/tools/pns/pns_log_viewer_frame.cpp @@ -42,7 +42,7 @@ #include "router/pns_utils.h" #include "router/router_preview_item.h" - +#include class WX_SHAPE_TREE_ITEM_DATA : public wxClientData { @@ -204,6 +204,43 @@ PNS_DEBUG_STAGE* PNS_LOG_VIEWER_FRAME::getCurrentStage() } +void PNS_LOG_VIEWER_FRAME::drawSimpleShape( SHAPE* aShape, bool aIsSelected, const std::string& aName ) +{ + switch( aShape->Type() ) + { + case SH_CIRCLE: + { + auto cir = static_cast( aShape ); + m_overlay->Circle( cir->GetCenter(), cir->GetRadius() ); + + break; + } + case SH_SEGMENT: + { + auto seg = static_cast( aShape ); + m_overlay->Line( seg->GetSeg().A, seg->GetSeg().B ); + + break; + } + case SH_RECT: + { + auto rect = static_cast( aShape ); + m_overlay->Rectangle( rect->GetPosition(), rect->GetPosition() + rect->GetSize() ); + + break; + } + case SH_LINE_CHAIN: + { + auto lc = static_cast( aShape ); + m_overlay->AnnotatedPolyline( *lc, aName, + m_showVertices || aIsSelected ); + + break; + } + default: break; + } +} + void PNS_LOG_VIEWER_FRAME::drawLoggedItems( int iter ) { if( !m_logPlayer ) @@ -247,39 +284,18 @@ void PNS_LOG_VIEWER_FRAME::drawLoggedItems( int iter ) m_overlay->SetStrokeColor( color ); m_overlay->SetLineWidth( m_showThinLines ? 10000 : ent->m_width ); - switch( sh->Type() ) + if( sh->Type() == SH_COMPOUND ) { - case SH_CIRCLE: - { - auto cir = static_cast( sh ); - m_overlay->Circle( cir->GetCenter(), cir->GetRadius() ); + auto cmpnd = static_cast( sh ); - break; + for( auto subshape : cmpnd->Shapes() ) + { + drawSimpleShape( subshape, isSelected, ent->m_name.ToStdString() ); + } } - case SH_SEGMENT: + else { - auto seg = static_cast( sh ); - m_overlay->Line( seg->GetSeg().A, seg->GetSeg().B ); - - break; - } - case SH_RECT: - { - auto rect = static_cast( sh ); - m_overlay->Rectangle( rect->GetPosition(), rect->GetPosition() + rect->GetSize() ); - - break; - } - case SH_LINE_CHAIN: - { - auto lc = static_cast( sh ); - m_overlay->AnnotatedPolyline( *lc, ent->m_name.ToStdString(), m_showVertices || ( ent->m_hasLabels && isSelected ) ); - - break; - - } - default: - break; + drawSimpleShape( sh, isSelected, ent->m_name.ToStdString() ); } } diff --git a/qa/tools/pns/pns_log_viewer_frame.h b/qa/tools/pns/pns_log_viewer_frame.h index d5861e8143..78b8c631e6 100644 --- a/qa/tools/pns/pns_log_viewer_frame.h +++ b/qa/tools/pns/pns_log_viewer_frame.h @@ -78,6 +78,7 @@ private: virtual void onShowRPIsChecked( wxCommandEvent& event ) override; virtual void onShowVerticesChecked( wxCommandEvent& event ) override; virtual void onFilterText( wxCommandEvent& event ) override; + void drawSimpleShape( SHAPE* aShape, bool aIsSelected, const std::string& aName ); std::shared_ptr m_overlay; std::shared_ptr m_logFile; @@ -107,6 +108,7 @@ public: private: + std::unique_ptr m_labelMgr; };