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
|
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013-2021 CERN
|
* 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>
|
* Author: Christian Gagneraud <chgans@gna.org>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
@ -37,7 +37,9 @@ class ITEM;
|
||||||
class DEBUG_DECORATOR
|
class DEBUG_DECORATOR
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DEBUG_DECORATOR() : m_debugEnabled( false ) {}
|
DEBUG_DECORATOR() :
|
||||||
|
m_debugEnabled( false )
|
||||||
|
{}
|
||||||
|
|
||||||
struct SRC_LOCATION_INFO
|
struct SRC_LOCATION_INFO
|
||||||
{
|
{
|
||||||
|
|
|
@ -850,7 +850,8 @@ int PNS_PCBNEW_RULE_RESOLVER::matchDpSuffix( const wxString& aNetName, wxString&
|
||||||
|
|
||||||
if( rv != 0 && count >= 1 )
|
if( rv != 0 && count >= 1 )
|
||||||
{
|
{
|
||||||
aComplementNet = aNetName.Left( aNetName.length() - count ) + aComplementNet
|
aComplementNet = aNetName.Left( aNetName.length() - count )
|
||||||
|
+ aComplementNet
|
||||||
+ aNetName.Right( count - 1 );
|
+ aNetName.Right( count - 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,17 +40,14 @@ PNS_DEBUG_SHAPE::PNS_DEBUG_SHAPE( PNS_DEBUG_SHAPE* aParent )
|
||||||
|
|
||||||
PNS_DEBUG_SHAPE::~PNS_DEBUG_SHAPE()
|
PNS_DEBUG_SHAPE::~PNS_DEBUG_SHAPE()
|
||||||
{
|
{
|
||||||
for( auto s : m_shapes )
|
for( SHAPE* shape : m_shapes )
|
||||||
{
|
delete shape;
|
||||||
delete s;
|
|
||||||
}
|
|
||||||
|
|
||||||
for( auto ch : m_children )
|
for( PNS_DEBUG_SHAPE* child : m_children )
|
||||||
{
|
delete child;
|
||||||
delete ch;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PNS_DEBUG_SHAPE* PNS_DEBUG_SHAPE::NewChild()
|
PNS_DEBUG_SHAPE* PNS_DEBUG_SHAPE::NewChild()
|
||||||
{
|
{
|
||||||
PNS_DEBUG_SHAPE* ent = new PNS_DEBUG_SHAPE( this );
|
PNS_DEBUG_SHAPE* ent = new PNS_DEBUG_SHAPE( this );
|
||||||
|
@ -59,18 +56,20 @@ PNS_DEBUG_SHAPE* PNS_DEBUG_SHAPE::NewChild()
|
||||||
return ent;
|
return ent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PNS_DEBUG_SHAPE::AddChild( PNS_DEBUG_SHAPE* ent )
|
void PNS_DEBUG_SHAPE::AddChild( PNS_DEBUG_SHAPE* ent )
|
||||||
{
|
{
|
||||||
ent->m_parent = this;
|
ent->m_parent = this;
|
||||||
m_children.push_back( ent );
|
m_children.push_back( ent );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PNS_DEBUG_SHAPE::IsVisible() const
|
bool PNS_DEBUG_SHAPE::IsVisible() const
|
||||||
{
|
{
|
||||||
if( m_visible )
|
if( m_visible )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto parent = m_parent;
|
PNS_DEBUG_SHAPE* parent = m_parent;
|
||||||
|
|
||||||
while( parent )
|
while( parent )
|
||||||
{
|
{
|
||||||
|
@ -83,19 +82,17 @@ bool PNS_DEBUG_SHAPE::IsVisible() const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PNS_DEBUG_SHAPE::IterateTree(
|
void PNS_DEBUG_SHAPE::IterateTree( std::function<bool( PNS_DEBUG_SHAPE* )> visitor, int depth )
|
||||||
std::function<bool( PNS_DEBUG_SHAPE* )> visitor, int depth )
|
|
||||||
{
|
{
|
||||||
if( !visitor( this ) )
|
if( !visitor( this ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
for( auto child : m_children )
|
for( PNS_DEBUG_SHAPE* child : m_children )
|
||||||
{
|
|
||||||
child->IterateTree( visitor, depth + 1 );
|
child->IterateTree( visitor, depth + 1 );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PNS_DEBUG_STAGE::PNS_DEBUG_STAGE()
|
PNS_DEBUG_STAGE::PNS_DEBUG_STAGE()
|
||||||
{
|
{
|
||||||
m_name = "<unknown>";
|
m_name = "<unknown>";
|
||||||
|
@ -109,20 +106,19 @@ PNS_DEBUG_STAGE::~PNS_DEBUG_STAGE()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PNS_TEST_DEBUG_DECORATOR::PNS_TEST_DEBUG_DECORATOR()
|
PNS_TEST_DEBUG_DECORATOR::PNS_TEST_DEBUG_DECORATOR()
|
||||||
{
|
{
|
||||||
m_iter = 0;
|
m_iter = 0;
|
||||||
m_grouping = false;
|
m_grouping = false;
|
||||||
m_activeEntry = nullptr;
|
m_activeEntry = nullptr;
|
||||||
SetDebugEnabled( true );
|
SetDebugEnabled( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
PNS_TEST_DEBUG_DECORATOR::~PNS_TEST_DEBUG_DECORATOR()
|
|
||||||
{
|
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...
|
// 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()
|
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;
|
ent->m_level = aLevel;
|
||||||
|
|
||||||
if( m_activeEntry )
|
if( m_activeEntry )
|
||||||
{
|
|
||||||
m_activeEntry->AddChild( ent );
|
m_activeEntry->AddChild( ent );
|
||||||
}
|
|
||||||
|
|
||||||
m_activeEntry = ent;
|
m_activeEntry = ent;
|
||||||
m_grouping = true;
|
m_grouping = true;
|
||||||
|
@ -165,17 +159,19 @@ void PNS_TEST_DEBUG_DECORATOR::EndGroup( const SRC_LOCATION_INFO& aSrcLoc )
|
||||||
m_grouping = false;
|
m_grouping = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PNS_TEST_DEBUG_DECORATOR::addEntry( PNS_DEBUG_SHAPE* ent )
|
void PNS_TEST_DEBUG_DECORATOR::addEntry( PNS_DEBUG_SHAPE* ent )
|
||||||
{
|
{
|
||||||
auto st = currentStage();
|
auto st = currentStage();
|
||||||
m_activeEntry->AddChild( ent );
|
m_activeEntry->AddChild( ent );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PNS_TEST_DEBUG_DECORATOR::AddPoint( const VECTOR2I& aP, const KIGFX::COLOR4D& aColor,
|
void PNS_TEST_DEBUG_DECORATOR::AddPoint( const VECTOR2I& aP, const KIGFX::COLOR4D& aColor,
|
||||||
int aSize, const wxString& aName,
|
int aSize, const wxString& aName,
|
||||||
const SRC_LOCATION_INFO& aSrcLoc )
|
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 );
|
||||||
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,
|
int aOverrideWidth, const wxString& aName,
|
||||||
const SRC_LOCATION_INFO& aSrcLoc )
|
const SRC_LOCATION_INFO& aSrcLoc )
|
||||||
{
|
{
|
||||||
auto sh = aItem->Shape()->Clone();
|
SHAPE* sh = aItem->Shape()->Clone();
|
||||||
PNS_DEBUG_SHAPE* ent = new PNS_DEBUG_SHAPE();
|
PNS_DEBUG_SHAPE* ent = new PNS_DEBUG_SHAPE();
|
||||||
|
|
||||||
ent->m_shapes.push_back( sh );
|
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,
|
int aOverrideWidth, const wxString& aName,
|
||||||
const SRC_LOCATION_INFO& aSrcLoc )
|
const SRC_LOCATION_INFO& aSrcLoc )
|
||||||
{
|
{
|
||||||
auto sh = aShape->Clone();
|
SHAPE* sh = aShape->Clone();
|
||||||
PNS_DEBUG_SHAPE* ent = new PNS_DEBUG_SHAPE();
|
PNS_DEBUG_SHAPE* ent = new PNS_DEBUG_SHAPE();
|
||||||
|
|
||||||
ent->m_shapes.push_back( sh );
|
ent->m_shapes.push_back( sh );
|
||||||
|
@ -261,14 +257,17 @@ void PNS_TEST_DEBUG_DECORATOR::SetCurrentStageStatus( bool stat )
|
||||||
m_stages.back()->m_status = stat;
|
m_stages.back()->m_status = stat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOX2I PNS_TEST_DEBUG_DECORATOR::GetStageExtents( int stage ) const
|
BOX2I PNS_TEST_DEBUG_DECORATOR::GetStageExtents( int stage ) const
|
||||||
{
|
{
|
||||||
PNS_DEBUG_STAGE* st = m_stages[stage];
|
PNS_DEBUG_STAGE* st = m_stages[stage];
|
||||||
BOX2I bb;
|
BOX2I bb;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
auto visitor = [&]( PNS_DEBUG_SHAPE* ent ) -> bool {
|
auto visitor =
|
||||||
for( auto sh : ent->m_shapes )
|
[&]( PNS_DEBUG_SHAPE* ent ) -> bool
|
||||||
|
{
|
||||||
|
for( SHAPE* sh : ent->m_shapes )
|
||||||
{
|
{
|
||||||
if( first )
|
if( first )
|
||||||
bb = sh->BBox();
|
bb = sh->BBox();
|
||||||
|
|
Loading…
Reference in New Issue