Code formatting

This commit is contained in:
Maciej Suminski 2016-08-15 17:16:53 +02:00
parent f0adbd757c
commit 0ef866ee74
25 changed files with 351 additions and 315 deletions

View File

@ -27,6 +27,7 @@ PNS_ROUTING_SETTINGS& PNS_ALGO_BASE::Settings() const
return m_router->Settings();
}
PNS_LOGGER* PNS_ALGO_BASE::Logger()
{
return NULL;

View File

@ -133,6 +133,7 @@ void PNS_DP_PRIMITIVE_PAIR::CursorOrientation( const VECTOR2I& aCursorPos, VECTO
aN = m_primN->Anchor( 1 );
midpoint = ( aP + aN ) / 2;
SEG s = static_cast <PNS_SEGMENT*>( m_primP )->Seg();
if ( s.B != s.A )
{
dir = s.B - s.A;
@ -144,7 +145,9 @@ void PNS_DP_PRIMITIVE_PAIR::CursorOrientation( const VECTOR2I& aCursorPos, VECTO
dir = dir.Resize( ( aP - aN ).EuclideanNorm() );
} else {
}
else
{
aP = m_primP->Anchor( 0 );
aN = m_primN->Anchor( 0 );
midpoint = ( aP + aN ) / 2;
@ -158,6 +161,7 @@ void PNS_DP_PRIMITIVE_PAIR::CursorOrientation( const VECTOR2I& aCursorPos, VECTO
aDirection = dir;
}
DIRECTION_45 PNS_DP_PRIMITIVE_PAIR::DirP() const
{
return anchorDirection( m_primP, m_anchorP );
@ -347,7 +351,6 @@ bool PNS_DP_GATEWAYS::FitGateways( PNS_DP_GATEWAYS& aEntry, PNS_DP_GATEWAYS& aTa
{
for( const PNS_DP_GATEWAY& g_target : aTarget.Gateways() )
{
n++;
for( int attempt = 0; attempt < 2; attempt++ )
@ -400,6 +403,7 @@ void PNS_DP_GATEWAYS::FilterByOrientation ( int aAngleMask, DIRECTION_45 aRefOri
} );
}
void PNS_DP_GATEWAYS::BuildFromPrimitivePair( PNS_DP_PRIMITIVE_PAIR aPair, bool aPreferDiagonal )
{
VECTOR2I majorDirection;

View File

@ -366,7 +366,9 @@ public:
{
m_p = aN;
m_n = aP;
} else {
}
else
{
m_p = aP;
m_n = aN;
}
@ -397,7 +399,8 @@ public:
m_gapConstraint = RANGED_NUM<int>( m_gap, 10000, 10000 );
}
int Gap() const {
int Gap() const
{
return m_gap;
}
@ -432,6 +435,7 @@ public:
{
if( !m_line_p.IsLinked() )
updateLine( m_line_p, m_p, m_net_p, m_via_p );
return m_line_p;
}
@ -439,6 +443,7 @@ public:
{
if( !m_line_n.IsLinked() )
updateLine( m_line_n, m_n, m_net_n, m_via_n );
return m_line_n;
}
@ -467,6 +472,7 @@ public:
{
return ( m_n.SegmentCount() == 0 ) || ( m_p.SegmentCount() == 0 );
}
const SHAPE_LINE_CHAIN& CP() const { return m_p; }
const SHAPE_LINE_CHAIN& CN() const { return m_n; }
@ -476,12 +482,12 @@ public:
int64_t CoupledLength( const SHAPE_LINE_CHAIN& aP, const SHAPE_LINE_CHAIN& aN ) const;
const RANGED_NUM<int> GapConstraint() const {
const RANGED_NUM<int> GapConstraint() const
{
return m_gapConstraint;
}
private:
void updateLine( PNS_LINE &aLine, const SHAPE_LINE_CHAIN& aShape, int aNet, PNS_VIA& aVia )
{
aLine.SetShape( aShape );
@ -507,5 +513,4 @@ private:
RANGED_NUM<int> m_gapConstraint;
};
#endif

View File

@ -474,7 +474,6 @@ bool PNS_DIFF_PAIR_PLACER::findDpPrimitivePair( const VECTOR2I& aP, PNS_ITEM* aI
{
int netP, netN;
printf( "world %p\n", m_world );
bool result = m_world->GetRuleResolver()->DpNetPair( aItem, netP, netN );
@ -487,8 +486,6 @@ bool PNS_DIFF_PAIR_PLACER::findDpPrimitivePair( const VECTOR2I& aP, PNS_ITEM* aI
printf( "result %d\n", !!result );
OPT_VECTOR2I refAnchor = getDanglingAnchor( m_currentNode, aItem );
PNS_ITEM* primRef = aItem;
@ -642,6 +639,7 @@ void PNS_DIFF_PAIR_PLACER::initPlacement( )
}
}
bool PNS_DIFF_PAIR_PLACER::routeHead( const VECTOR2I& aP )
{
m_fitOk = false;
@ -660,13 +658,14 @@ bool PNS_DIFF_PAIR_PLACER::routeHead( const VECTOR2I& aP )
{
gwsTarget.BuildFromPrimitivePair( target, m_startDiagonal );
m_snapOnTarget = true;
} else {
}
else
{
VECTOR2I fp;
if( !propagateDpHeadForces( aP, fp ) )
return false;
VECTOR2I midp, dirV;
m_prevPair->CursorOrientation( fp, midp, dirV );
@ -678,7 +677,9 @@ bool PNS_DIFF_PAIR_PLACER::routeHead( const VECTOR2I& aP )
if( lead_dist > m_sizes.DiffPairGap() + m_sizes.DiffPairWidth() )
{
gwsTarget.BuildForCursor( fp );
} else {
}
else
{
gwsTarget.BuildForCursor( fpProj );
gwsTarget.FilterByOrientation( DIRECTION_45::ANG_STRAIGHT | DIRECTION_45::ANG_HALF_FULL, DIRECTION_45( dirV ) );
}

View File

@ -117,7 +117,6 @@ bool PNS_DP_MEANDER_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
void PNS_DP_MEANDER_PLACER::release()
{
}

View File

@ -73,8 +73,8 @@ public:
virtual bool DpNetPair( PNS_ITEM* aItem, int& aNetP, int& aNetN );
private:
struct CLEARANCE_ENT {
struct CLEARANCE_ENT
{
int coupledNet;
int clearance;
};
@ -91,7 +91,6 @@ private:
int m_overrideNetA, m_overrideNetB;
int m_overrideClearance;
bool m_useDpGap;
};
@ -107,6 +106,7 @@ PNS_PCBNEW_RULE_RESOLVER::PNS_PCBNEW_RULE_RESOLVER( BOARD *aBoard, PNS_ROUTER* a
for( unsigned int i = 0; i < m_board->GetNetCount(); i++ )
{
NETINFO_ITEM* ni = m_board->FindNet( i );
if( ni == NULL )
continue;
@ -131,10 +131,12 @@ PNS_PCBNEW_RULE_RESOLVER::PNS_PCBNEW_RULE_RESOLVER( BOARD *aBoard, PNS_ROUTER* a
m_overrideClearance = 0;
}
PNS_PCBNEW_RULE_RESOLVER::~PNS_PCBNEW_RULE_RESOLVER()
{
}
int PNS_PCBNEW_RULE_RESOLVER::localPadClearance( const PNS_ITEM* aItem ) const
{
if( !aItem->Parent() || aItem->Parent()->Type() != PCB_PAD_T )
@ -178,6 +180,7 @@ void PNS_PCBNEW_RULE_RESOLVER::OverrideClearance( bool aEnable, int aNetA, int a
m_overrideClearance = aClearance;
}
int PNS_PCBNEW_RULE_RESOLVER::matchDpSuffix( wxString aNetName, wxString& aComplementNet, wxString& aBaseDpName )
{
int rv = 0;
@ -226,7 +229,6 @@ int PNS_PCBNEW_RULE_RESOLVER::DpCoupledNet( int aNet )
return -1;
return net->GetNet();
}
return -1;
@ -241,6 +243,7 @@ int PNS_PCBNEW_RULE_RESOLVER::DpNetPolarity( int aNet )
return matchDpSuffix( refName, dummy1, dummy2 );
}
bool PNS_PCBNEW_RULE_RESOLVER::DpNetPair( PNS_ITEM* aItem, int& aNetP, int& aNetN )
{
if( !aItem || !aItem->Parent() || !aItem->Parent()->GetNet() )
@ -279,6 +282,7 @@ bool PNS_PCBNEW_RULE_RESOLVER::DpNetPair( PNS_ITEM* aItem, int& aNetP, int& aNet
return true;
}
class PNS_PCBNEW_DEBUG_DECORATOR: public PNS_DEBUG_DECORATOR
{
public:
@ -299,8 +303,10 @@ public:
delete m_items;
m_items = NULL;
m_view = aView;
if( m_view == NULL )
return;
m_items = new KIGFX::VIEW_GROUP( m_view );
m_items->SetLayer( ITEM_GAL_LAYER( GP_OVERLAY ) );
m_view->Add( m_items );
@ -388,6 +394,7 @@ private:
KIGFX::VIEW_GROUP* m_items;
};
PNS_DEBUG_DECORATOR* PNS_KICAD_IFACE::GetDebugDecorator()
{
return m_debugDecorator;
@ -406,6 +413,7 @@ PNS_KICAD_IFACE::PNS_KICAD_IFACE ()
m_debugDecorator = nullptr;
}
PNS_KICAD_IFACE::~PNS_KICAD_IFACE()
{
if( m_ruleResolver )
@ -441,8 +449,10 @@ PNS_ITEM* PNS_KICAD_IFACE::syncPad( D_PAD* aPad )
if( lmsk[i] )
{
is_copper = true;
if( aPad->GetAttribute() != PAD_ATTRIB_HOLE_NOT_PLATED )
layers = PNS_LAYERSET( i );
break;
}
}
@ -532,8 +542,7 @@ PNS_ITEM* PNS_KICAD_IFACE::syncPad( D_PAD* aPad )
SHAPE_POLY_SET outline;
const int segmentToCircleCount = 64;
aPad->BuildPadShapePolygon( outline, wxSize( 0, 0 ),
segmentToCircleCount, 1.0 );
aPad->BuildPadShapePolygon( outline, wxSize( 0, 0 ), segmentToCircleCount, 1.0 );
// TransformRoundRectToPolygon creates only one convex polygon
SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
@ -642,8 +651,8 @@ PNS_ITEM* PNS_KICAD_IFACE::syncPad( D_PAD* aPad )
}
solid->SetShape( shape );
}
break;
}
default:
TRACEn( 0, "unsupported pad shape" );
@ -741,6 +750,7 @@ void PNS_KICAD_IFACE::SyncWorld( PNS_NODE *aWorld )
aWorld->SetMaxClearance( 4 * worstClearance );
}
void PNS_KICAD_IFACE::EraseView()
{
for( auto item : m_hiddenItems )
@ -758,6 +768,7 @@ void PNS_KICAD_IFACE::EraseView()
m_debugDecorator->Clear();
}
void PNS_KICAD_IFACE::DisplayItem( const PNS_ITEM* aItem, int aColor, int aClearance )
{
printf( "DisplayItem %p\n", aItem );
@ -776,6 +787,7 @@ void PNS_KICAD_IFACE::DisplayItem( const PNS_ITEM* aItem, int aColor, int aClear
m_previewItems->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY | KIGFX::VIEW_ITEM::APPEARANCE );
}
void PNS_KICAD_IFACE::HideItem( PNS_ITEM* aItem )
{
BOARD_CONNECTED_ITEM* parent = aItem->Parent();
@ -790,6 +802,7 @@ void PNS_KICAD_IFACE::HideItem( PNS_ITEM *aItem )
}
}
void PNS_KICAD_IFACE::RemoveItem( PNS_ITEM* aItem )
{
BOARD_CONNECTED_ITEM* parent = aItem->Parent();
@ -802,6 +815,7 @@ void PNS_KICAD_IFACE::RemoveItem ( PNS_ITEM *aItem )
}
}
void PNS_KICAD_IFACE::AddItem( PNS_ITEM* aItem )
{
BOARD_CONNECTED_ITEM* newBI = NULL;
@ -852,6 +866,7 @@ void PNS_KICAD_IFACE::AddItem ( PNS_ITEM *aItem )
}
}
void PNS_KICAD_IFACE::Commit()
{
m_board->GetRatsnest()->Recalculate();
@ -860,9 +875,11 @@ void PNS_KICAD_IFACE::Commit()
m_frame->OnModify();
}
void PNS_KICAD_IFACE::SetView( KIGFX::VIEW *aView )
{
printf( "SetView %p\n", aView );
if( m_previewItems )
{
m_previewItems->FreeItems();

View File

@ -28,11 +28,10 @@
class PNS_PCBNEW_RULE_RESOLVER;
class PNS_PCBNEW_DEBUG_DECORATOR;
class BOARD;
namespace KIGFX {
namespace KIGFX
{
class VIEW;
};
class PNS_KICAD_IFACE : public PNS_ROUTER_IFACE {
@ -59,7 +58,6 @@ public:
PNS_DEBUG_DECORATOR* GetDebugDecorator();
private:
PNS_PCBNEW_RULE_RESOLVER* m_ruleResolver;
PNS_PCBNEW_DEBUG_DECORATOR* m_debugDecorator;

View File

@ -801,8 +801,11 @@ void PNS_LINE::ClearSegmentLinks()
static void extendBox( BOX2I& aBox, bool& aDefined, const VECTOR2I& aP )
{
if( aDefined )
{
aBox.Merge( aP );
else {
}
else
{
aBox = BOX2I( aP, VECTOR2I( 0, 0 ) );
aDefined = true;
}
@ -887,6 +890,7 @@ OPT_BOX2I PNS_LINE::ChangedArea( const PNS_LINE* aOther ) const
return OPT_BOX2I();
}
bool PNS_LINE::HasLockedSegments() const
{
for( const PNS_SEGMENT* seg : *m_segmentRefs )

View File

@ -724,7 +724,8 @@ bool PNS_LINE_PLACER::SetLayer( int aLayer )
{
return false;
}
else if( !m_startItem || ( m_startItem->OfKind( PNS_ITEM::VIA ) && m_startItem->Layers().Overlaps( aLayer ) ) ) {
else if( !m_startItem || ( m_startItem->OfKind( PNS_ITEM::VIA ) && m_startItem->Layers().Overlaps( aLayer ) ) )
{
m_currentLayer = aLayer;
initPlacement();
Move( m_currentEnd, NULL );
@ -760,6 +761,7 @@ bool PNS_LINE_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
return true;
}
void PNS_LINE_PLACER::initPlacement()
{
m_idle = false;
@ -1029,6 +1031,7 @@ void PNS_LINE_PLACER::SetOrthoMode( bool aOrthoMode )
m_orthoMode = aOrthoMode;
}
bool PNS_LINE_PLACER::buildInitialLine( const VECTOR2I& aP, PNS_LINE& aHead )
{
SHAPE_LINE_CHAIN l;

View File

@ -35,11 +35,13 @@ const PNS_MEANDER_SETTINGS& PNS_MEANDER_SHAPE::Settings() const
return m_placer->MeanderSettings();
}
const PNS_MEANDER_SETTINGS& PNS_MEANDERED_LINE::Settings() const
{
return m_placer->MeanderSettings();
}
void PNS_MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex )
{
double base_len = aBase.Length();

View File

@ -157,12 +157,14 @@ PNS_OBSTACLE_VISITOR::PNS_OBSTACLE_VISITOR( const PNS_ITEM* aItem ) :
m_extraClearance += static_cast<const PNS_LINE*>( aItem )->Width() / 2;
}
void PNS_OBSTACLE_VISITOR::SetWorld( const PNS_NODE* aNode, const PNS_NODE* aOverride )
{
m_node = aNode;
m_override = aOverride;
}
bool PNS_OBSTACLE_VISITOR::visit( PNS_ITEM* aCandidate )
{
// check if there is a more recent branch with a newer
@ -173,6 +175,7 @@ bool PNS_OBSTACLE_VISITOR::visit( PNS_ITEM *aCandidate )
return false;
}
// function object that visits potential obstacles and performs
// the actual collision refining
struct PNS_NODE::DEFAULT_OBSTACLE_VISITOR : public PNS_OBSTACLE_VISITOR
@ -249,8 +252,8 @@ struct PNS_NODE::DEFAULT_OBSTACLE_VISITOR : public PNS_OBSTACLE_VISITOR
};
};
int PNS_NODE::QueryColliding( const PNS_ITEM *aItem,
PNS_OBSTACLE_VISITOR& aVisitor )
int PNS_NODE::QueryColliding( const PNS_ITEM* aItem, PNS_OBSTACLE_VISITOR& aVisitor )
{
aVisitor.SetWorld( this, NULL );
m_index->Query( aItem, m_maxClearance, aVisitor );
@ -292,8 +295,7 @@ int PNS_NODE::QueryColliding( const PNS_ITEM* aItem,
}
PNS_NODE::OPT_OBSTACLE PNS_NODE::NearestObstacle( const PNS_LINE* aItem,
int aKindMask,
PNS_NODE::OPT_OBSTACLE PNS_NODE::NearestObstacle( const PNS_LINE* aItem, int aKindMask,
const std::set<PNS_ITEM*>* aRestrictedSet )
{
OBSTACLES obs_list;

View File

@ -61,8 +61,6 @@ public:
virtual int DpCoupledNet( int aNet ) = 0;
virtual int DpNetPolarity( int aNet ) = 0;
virtual bool DpNetPair( PNS_ITEM* aItem, int& aNetP, int& aNetN ) = 0;
};
/**
@ -290,7 +288,6 @@ public:
*/
void Remove( PNS_LINE& aLine );
/**
* Function Replace()
*

View File

@ -90,7 +90,6 @@ enum PNS_ROUTER_MODE {
virtual PNS_RULE_RESOLVER* GetRuleResolver() = 0;
virtual PNS_DEBUG_DECORATOR* GetDebugDecorator() = 0;
};
class PNS_ROUTER

View File

@ -216,7 +216,9 @@ void PNS_TOOL_BASE::updateStartItem( TOOL_EVENT& aEvent )
{
snapEnabled = !aEvent.Modifier( MD_SHIFT );
p = aEvent.Position();
} else {
}
else
{
p = cp;
}
@ -307,6 +309,7 @@ void PNS_TOOL_BASE::updateEndItem( TOOL_EVENT& aEvent )
TRACE( 0, "%s, layer : %d", m_endItem->KindStr().c_str() % m_endItem->Layers().Start() );
}
void PNS_TOOL_BASE::deleteTraces( PNS_ITEM* aStartItem, bool aWholeTrack )
{
PNS_NODE *node = m_router->GetWorld()->Branch();
@ -330,11 +333,13 @@ void PNS_TOOL_BASE::deleteTraces( PNS_ITEM *aStartItem, bool aWholeTrack )
m_router->CommitRouting( node );
}
PNS_ROUTER *PNS_TOOL_BASE::Router() const
{
return m_router;
}
const VECTOR2I PNS_TOOL_BASE::snapToItem( PNS_ITEM* aItem, VECTOR2I aP, bool& aSplitsSegment )
{
VECTOR2I anchor;

View File

@ -277,8 +277,6 @@ const PNS_ITEMSET PNS_TOPOLOGY::ConnectedItems( PNS_ITEM* aStart, int aKindMask
}
bool commonParallelProjection( SEG n, SEG p, SEG &pClip, SEG& nClip );

View File

@ -712,7 +712,8 @@ int ROUTER_TOOL::mainLoop( PNS_ROUTER_MODE aMode )
else if( evt->IsAction( &ACT_PlaceThroughVia ) )
{
m_toolMgr->RunAction( COMMON_ACTIONS::layerToggle, true );
} else if (evt->IsAction ( &COMMON_ACTIONS::remove ) )
}
else if( evt->IsAction( &COMMON_ACTIONS::remove ) )
{
deleteTraces( m_startItem, true );
}