Formatting (no functional changes).
This commit is contained in:
parent
37717a8281
commit
c049e1e90d
|
@ -2,7 +2,7 @@
|
|||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||
*
|
||||
* Copyright (C) 2013-2021 CERN
|
||||
* Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2016-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Author: Christian Gagneraud <chgans@gna.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
|
@ -37,7 +37,9 @@ class ITEM;
|
|||
class DEBUG_DECORATOR
|
||||
{
|
||||
public:
|
||||
DEBUG_DECORATOR() : m_debugEnabled( false ) {}
|
||||
DEBUG_DECORATOR() :
|
||||
m_debugEnabled( false )
|
||||
{}
|
||||
|
||||
struct SRC_LOCATION_INFO
|
||||
{
|
||||
|
|
|
@ -850,8 +850,9 @@ int PNS_PCBNEW_RULE_RESOLVER::matchDpSuffix( const wxString& aNetName, wxString&
|
|||
|
||||
if( rv != 0 && count >= 1 )
|
||||
{
|
||||
aComplementNet = aNetName.Left( aNetName.length() - count ) + aComplementNet
|
||||
+ aNetName.Right( count - 1 );
|
||||
aComplementNet = aNetName.Left( aNetName.length() - count )
|
||||
+ aComplementNet
|
||||
+ aNetName.Right( count - 1 );
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -973,7 +974,7 @@ public:
|
|||
}
|
||||
|
||||
void AddPoint( const VECTOR2I& aP, const KIGFX::COLOR4D& aColor, int aSize,
|
||||
const wxString& aName = wxT( "" ),
|
||||
const wxString& aName = wxT( "" ),
|
||||
const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override
|
||||
|
||||
{
|
||||
|
@ -991,7 +992,7 @@ public:
|
|||
}
|
||||
|
||||
void AddItem( const PNS::ITEM* aItem, const KIGFX::COLOR4D& aColor, int aOverrideWidth = 0,
|
||||
const wxString& aName = wxT( "" ),
|
||||
const wxString& aName = wxT( "" ),
|
||||
const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override
|
||||
{
|
||||
if( !m_view || !aItem )
|
||||
|
@ -1008,7 +1009,7 @@ public:
|
|||
}
|
||||
|
||||
void AddShape( const BOX2I& aBox, const KIGFX::COLOR4D& aColor, int aOverrideWidth = 0,
|
||||
const wxString& aName = wxT( "" ),
|
||||
const wxString& aName = wxT( "" ),
|
||||
const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override
|
||||
{
|
||||
SHAPE_LINE_CHAIN l;
|
||||
|
@ -1027,7 +1028,7 @@ public:
|
|||
}
|
||||
|
||||
void AddShape( const SHAPE* aShape, const KIGFX::COLOR4D& aColor, int aOverrideWidth = 0,
|
||||
const wxString& aName = wxT( "" ),
|
||||
const wxString& aName = wxT( "" ),
|
||||
const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override
|
||||
{
|
||||
if( !m_view || !aShape )
|
||||
|
@ -1110,7 +1111,7 @@ PNS_KICAD_IFACE::~PNS_KICAD_IFACE()
|
|||
delete m_ruleResolver;
|
||||
delete m_debugDecorator;
|
||||
|
||||
if( m_previewItems )
|
||||
if( m_previewItems )
|
||||
{
|
||||
m_previewItems->FreeItems();
|
||||
delete m_previewItems;
|
||||
|
|
|
@ -40,17 +40,14 @@ PNS_DEBUG_SHAPE::PNS_DEBUG_SHAPE( PNS_DEBUG_SHAPE* aParent )
|
|||
|
||||
PNS_DEBUG_SHAPE::~PNS_DEBUG_SHAPE()
|
||||
{
|
||||
for( auto s : m_shapes )
|
||||
{
|
||||
delete s;
|
||||
}
|
||||
for( SHAPE* shape : m_shapes )
|
||||
delete shape;
|
||||
|
||||
for( auto ch : m_children )
|
||||
{
|
||||
delete ch;
|
||||
}
|
||||
for( PNS_DEBUG_SHAPE* child : m_children )
|
||||
delete child;
|
||||
}
|
||||
|
||||
|
||||
PNS_DEBUG_SHAPE* PNS_DEBUG_SHAPE::NewChild()
|
||||
{
|
||||
PNS_DEBUG_SHAPE* ent = new PNS_DEBUG_SHAPE( this );
|
||||
|
@ -59,18 +56,20 @@ PNS_DEBUG_SHAPE* PNS_DEBUG_SHAPE::NewChild()
|
|||
return ent;
|
||||
}
|
||||
|
||||
|
||||
void PNS_DEBUG_SHAPE::AddChild( PNS_DEBUG_SHAPE* ent )
|
||||
{
|
||||
ent->m_parent = this;
|
||||
m_children.push_back( ent );
|
||||
}
|
||||
|
||||
|
||||
bool PNS_DEBUG_SHAPE::IsVisible() const
|
||||
{
|
||||
if( m_visible )
|
||||
return true;
|
||||
|
||||
auto parent = m_parent;
|
||||
PNS_DEBUG_SHAPE* parent = m_parent;
|
||||
|
||||
while( parent )
|
||||
{
|
||||
|
@ -83,19 +82,17 @@ bool PNS_DEBUG_SHAPE::IsVisible() const
|
|||
return false;
|
||||
}
|
||||
|
||||
void PNS_DEBUG_SHAPE::IterateTree(
|
||||
std::function<bool( PNS_DEBUG_SHAPE* )> visitor, int depth )
|
||||
void PNS_DEBUG_SHAPE::IterateTree( std::function<bool( PNS_DEBUG_SHAPE* )> visitor, int depth )
|
||||
{
|
||||
if( !visitor( this ) )
|
||||
return;
|
||||
|
||||
|
||||
for( auto child : m_children )
|
||||
{
|
||||
for( PNS_DEBUG_SHAPE* child : m_children )
|
||||
child->IterateTree( visitor, depth + 1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PNS_DEBUG_STAGE::PNS_DEBUG_STAGE()
|
||||
{
|
||||
m_name = "<unknown>";
|
||||
|
@ -109,20 +106,19 @@ PNS_DEBUG_STAGE::~PNS_DEBUG_STAGE()
|
|||
}
|
||||
|
||||
|
||||
PNS_TEST_DEBUG_DECORATOR::PNS_TEST_DEBUG_DECORATOR()
|
||||
{
|
||||
m_iter = 0;
|
||||
m_grouping = false;
|
||||
m_activeEntry = nullptr;
|
||||
SetDebugEnabled( true );
|
||||
}
|
||||
PNS_TEST_DEBUG_DECORATOR::PNS_TEST_DEBUG_DECORATOR()
|
||||
{
|
||||
m_iter = 0;
|
||||
m_grouping = false;
|
||||
m_activeEntry = nullptr;
|
||||
SetDebugEnabled( true );
|
||||
}
|
||||
|
||||
PNS_TEST_DEBUG_DECORATOR::~PNS_TEST_DEBUG_DECORATOR()
|
||||
{
|
||||
// fixme: I know it's a hacky tool but it should clean after itself at some point...
|
||||
|
||||
}
|
||||
|
||||
PNS_TEST_DEBUG_DECORATOR::~PNS_TEST_DEBUG_DECORATOR()
|
||||
{
|
||||
// fixme: I know it's a hacky tool but it should clean after itself at some point...
|
||||
}
|
||||
|
||||
|
||||
PNS_DEBUG_STAGE* PNS_TEST_DEBUG_DECORATOR::currentStage()
|
||||
|
@ -145,9 +141,7 @@ void PNS_TEST_DEBUG_DECORATOR::BeginGroup( const wxString& name, int aLevel,
|
|||
ent->m_level = aLevel;
|
||||
|
||||
if( m_activeEntry )
|
||||
{
|
||||
m_activeEntry->AddChild( ent );
|
||||
}
|
||||
|
||||
m_activeEntry = ent;
|
||||
m_grouping = true;
|
||||
|
@ -165,17 +159,19 @@ void PNS_TEST_DEBUG_DECORATOR::EndGroup( const SRC_LOCATION_INFO& aSrcLoc )
|
|||
m_grouping = false;
|
||||
}
|
||||
|
||||
|
||||
void PNS_TEST_DEBUG_DECORATOR::addEntry( PNS_DEBUG_SHAPE* ent )
|
||||
{
|
||||
auto st = currentStage();
|
||||
m_activeEntry->AddChild( ent );
|
||||
}
|
||||
|
||||
|
||||
void PNS_TEST_DEBUG_DECORATOR::AddPoint( const VECTOR2I& aP, const KIGFX::COLOR4D& aColor,
|
||||
int aSize, const wxString& aName,
|
||||
const SRC_LOCATION_INFO& aSrcLoc )
|
||||
{
|
||||
auto sh = new SHAPE_LINE_CHAIN;
|
||||
SHAPE_LINE_CHAIN* sh = new SHAPE_LINE_CHAIN;
|
||||
|
||||
sh->Append( aP.x - aSize, aP.y - aSize );
|
||||
sh->Append( aP.x + aSize, aP.y + aSize );
|
||||
|
@ -201,7 +197,7 @@ void PNS_TEST_DEBUG_DECORATOR::AddItem( const PNS::ITEM* aItem, const KIGFX::COL
|
|||
int aOverrideWidth, const wxString& aName,
|
||||
const SRC_LOCATION_INFO& aSrcLoc )
|
||||
{
|
||||
auto sh = aItem->Shape()->Clone();
|
||||
SHAPE* sh = aItem->Shape()->Clone();
|
||||
PNS_DEBUG_SHAPE* ent = new PNS_DEBUG_SHAPE();
|
||||
|
||||
ent->m_shapes.push_back( sh );
|
||||
|
@ -219,7 +215,7 @@ void PNS_TEST_DEBUG_DECORATOR::AddShape( const SHAPE* aShape, const KIGFX::COLOR
|
|||
int aOverrideWidth, const wxString& aName,
|
||||
const SRC_LOCATION_INFO& aSrcLoc )
|
||||
{
|
||||
auto sh = aShape->Clone();
|
||||
SHAPE* sh = aShape->Clone();
|
||||
PNS_DEBUG_SHAPE* ent = new PNS_DEBUG_SHAPE();
|
||||
|
||||
ent->m_shapes.push_back( sh );
|
||||
|
@ -261,25 +257,28 @@ void PNS_TEST_DEBUG_DECORATOR::SetCurrentStageStatus( bool stat )
|
|||
m_stages.back()->m_status = stat;
|
||||
}
|
||||
|
||||
|
||||
BOX2I PNS_TEST_DEBUG_DECORATOR::GetStageExtents( int stage ) const
|
||||
{
|
||||
PNS_DEBUG_STAGE* st = m_stages[stage];
|
||||
BOX2I bb;
|
||||
bool first = true;
|
||||
|
||||
auto visitor = [&]( PNS_DEBUG_SHAPE* ent ) -> bool {
|
||||
for( auto sh : ent->m_shapes )
|
||||
{
|
||||
if( first )
|
||||
bb = sh->BBox();
|
||||
else
|
||||
bb.Merge( sh->BBox() );
|
||||
auto visitor =
|
||||
[&]( PNS_DEBUG_SHAPE* ent ) -> bool
|
||||
{
|
||||
for( SHAPE* sh : ent->m_shapes )
|
||||
{
|
||||
if( first )
|
||||
bb = sh->BBox();
|
||||
else
|
||||
bb.Merge( sh->BBox() );
|
||||
|
||||
first = false;
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
return true;
|
||||
};
|
||||
|
||||
return bb;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue