Fix whitespace errors

This commit is contained in:
Tomasz Wlostowski 2021-02-25 17:18:13 +01:00
parent 04d058d60a
commit 87ea540953
13 changed files with 87 additions and 94 deletions

View File

@ -98,7 +98,7 @@ public:
void SetFillColor( const COLOR4D& aColor );
void SetStrokeColor( const COLOR4D& aColor );
void SetGlyphSize( const VECTOR2D aSize );
void SetLineWidth( double aLineWidth );
private:

View File

@ -558,7 +558,7 @@ static bool collideSingleShapes( const SHAPE* aA, const SHAPE* aB, int aClearanc
{
switch( aA->Type() )
{
case SH_NULL:
case SH_NULL:
return false;
case SH_RECT:
@ -612,7 +612,7 @@ static bool collideSingleShapes( const SHAPE* aA, const SHAPE* aB, int aClearanc
case SH_ARC:
return CollCaseReversed<SHAPE_CIRCLE, SHAPE_ARC>( aA, aB, aClearance, aActual, aLocation, aMTV );
case SH_NULL:
return false;
@ -861,7 +861,7 @@ static bool collideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, int
{
return collideSingleShapes( aA, aB, aClearance, aActual, aLocation, aMTV );
}
if( colliding )
{
if( aLocation )

View File

@ -1019,7 +1019,7 @@ SHAPE_LINE_CHAIN& SHAPE_LINE_CHAIN::Simplify( bool aRemoveColinear )
|| SEG( p0, p1 ).Collinear( SEG( p1, pts_unique[n + 2] ) ) ) )
n++;
}
m_points.push_back( p0 );
m_shapes.push_back( shapes_unique[i] );

View File

@ -364,18 +364,18 @@ bool DRAGGER::dragViaWalkaround( const VIA_HANDLE& aHandle, NODE* aNode, const V
if( !ok )
return false;
m_lastNode->Remove( origLine );
m_lastNode->Remove( origLine );
optimizeAndUpdateDraggedLine( walkLine, origLine, aP );
}
}
else
{
{
m_draggedItems.Add( draggedLine );
m_lastNode->Remove( origLine );
m_lastNode->Add( draggedLine );
}
}
}
}
return true;
}

View File

@ -138,7 +138,7 @@ private:
int m_draggedSegmentIndex;
bool m_dragStatus;
PNS_MODE m_currentMode;
ITEM_SET m_origViaConnections;
ITEM_SET m_origViaConnections;
VECTOR2D m_lastValidPoint;
///< Contains the list of items that are currently modified by the dragger
@ -146,7 +146,7 @@ private:
///< If true, moves the connection lines without maintaining 45 degrees corners
bool m_freeAngleMode;
MOUSE_TRAIL_TRACER m_mouseTrailTracer;
MOUSE_TRAIL_TRACER m_mouseTrailTracer;
};
}

View File

@ -1623,7 +1623,7 @@ void PNS_KICAD_IFACE::SetView( KIGFX::VIEW* aView )
delete m_debugDecorator;
auto dec = new PNS_PCBNEW_DEBUG_DECORATOR( );
auto dec = new PNS_PCBNEW_DEBUG_DECORATOR();
m_debugDecorator = dec;
if( ADVANCED_CFG::GetCfg().m_ShowRouterDebugGraphics )

View File

@ -173,7 +173,7 @@ bool LINE::Walkaround( const SHAPE_LINE_CHAIN& aObstacle, SHAPE_LINE_CHAIN& aPat
// Double check if it's not on the hull itself as this triggers many unroutable corner cases.
if( inFirst || inLast )
{
return false;
return false;
}
enum VERTEX_TYPE { INSIDE = 0, OUTSIDE, ON_EDGE };
@ -206,8 +206,6 @@ bool LINE::Walkaround( const SHAPE_LINE_CHAIN& aObstacle, SHAPE_LINE_CHAIN& aPat
std::vector<VERTEX> vts;
auto findVertex = [&]( VECTOR2I pos) -> VERTEX*
{
for( VERTEX& v : vts )

View File

@ -298,7 +298,7 @@ private:
* colliding solid or non-movable items. Movable segments are ignored, as they'll be
* handled later by the shove algorithm.
*/
bool routeHead( const VECTOR2I& aP, LINE& aNewHead);
bool routeHead( const VECTOR2I& aP, LINE& aNewHead );
/**
* Perform a single routing algorithm step, for the end point \a aP.
@ -309,10 +309,10 @@ private:
void routeStep( const VECTOR2I& aP );
///< Route step walk around mode.
bool rhWalkOnly( const VECTOR2I& aP, LINE& aNewHead);
bool rhWalkOnly( const VECTOR2I& aP, LINE& aNewHead );
///< Route step shove mode.
bool rhShoveOnly( const VECTOR2I& aP, LINE& aNewHead);
bool rhShoveOnly( const VECTOR2I& aP, LINE& aNewHead );
///< Route step mark obstacles mode.
bool rhMarkObstacles( const VECTOR2I& aP, LINE& aNewHead );

View File

@ -102,7 +102,7 @@ void COST_ESTIMATOR::Replace( const LINE& aOldLine, const LINE& aNewLine )
bool COST_ESTIMATOR::IsBetter( const COST_ESTIMATOR& aOther, double aLengthTolerance,
double aCornerTolerance ) const
double aCornerTolerance ) const
{
if( aOther.m_cornerCost < m_cornerCost && aOther.m_lengthCost < m_lengthCost )
return true;
@ -195,7 +195,7 @@ void OPTIMIZER::CacheRemove( ITEM* aItem )
}
void OPTIMIZER::ClearCache( bool aStaticOnly )
void OPTIMIZER::ClearCache( bool aStaticOnly )
{
if( !aStaticOnly )
{
@ -299,7 +299,7 @@ static bool pointInside2( const SHAPE_LINE_CHAIN& aL, const VECTOR2I& aP )
{
if( (ipNext.x ==aP.x) || ( ip.y == aP.y && ( (ipNext.x >aP.x) == (ip.x <aP.x) ) ) )
return true; // pt on polyground boundary
}
}
if( (ip.y <aP.y) != (ipNext.y <aP.y) )
{
@ -309,9 +309,9 @@ static bool pointInside2( const SHAPE_LINE_CHAIN& aL, const VECTOR2I& aP )
result = 1 - result;
else
{
double d = static_cast<double>( ip.x - aP.x ) *
double d = static_cast<double>( ip.x - aP.x ) *
static_cast<double>( ipNext.y - aP.y ) -
static_cast<double>( ipNext.x - aP.x ) *
static_cast<double>( ipNext.x - aP.x ) *
static_cast<double>( ip.y - aP.y );
if( !d )
@ -347,7 +347,7 @@ static bool pointInside2( const SHAPE_LINE_CHAIN& aL, const VECTOR2I& aP )
bool KEEP_TOPOLOGY_CONSTRAINT::Check( int aVertex1, int aVertex2, const LINE* aOriginLine,
const SHAPE_LINE_CHAIN& aCurrentPath,
const SHAPE_LINE_CHAIN& aReplacement )
{
{
SHAPE_LINE_CHAIN encPoly = aOriginLine->CLine().Slice( aVertex1, aVertex2 );
// fixme: this is a remarkably shitty implementation...
@ -363,20 +363,20 @@ bool KEEP_TOPOLOGY_CONSTRAINT::Check( int aVertex1, int aVertex2, const LINE* aO
return true;
for( JOINT* j : joints )
{
if ( j->Net() == aOriginLine->Net() )
{
if( j->Net() == aOriginLine->Net() )
continue;
if ( pointInside2( encPoly, j->Pos() ) )
{
if( pointInside2( encPoly, j->Pos() ) )
{
bool falsePositive = false;
for( int k = 0; k < encPoly.PointCount(); k++)
for( int k = 0; k < encPoly.PointCount(); k++ )
{
if(encPoly.CPoint(k) == j->Pos() )
if( encPoly.CPoint(k) == j->Pos() )
{
falsePositive = true;
break;
}
}
}
if( !falsePositive )
@ -409,8 +409,8 @@ void OPTIMIZER::ClearConstraints()
void OPTIMIZER::AddConstraint ( OPT_CONSTRAINT *aConstraint )
{
m_constraints.push_back(aConstraint);
{
m_constraints.push_back( aConstraint );
}
@ -420,7 +420,7 @@ bool OPTIMIZER::checkConstraints( int aVertex1, int aVertex2, LINE* aOriginLine,
{
for( OPT_CONSTRAINT* c : m_constraints )
{
if ( !c->Check( aVertex1, aVertex2, aOriginLine, aCurrentPath, aReplacement ) )
if( !c->Check( aVertex1, aVertex2, aOriginLine, aCurrentPath, aReplacement ) )
return false;
}
@ -590,27 +590,27 @@ bool OPTIMIZER::Optimize( LINE* aLine, LINE* aResult )
bool hasArcs = aLine->ArcCount();
bool rv = false;
if ( m_effortLevel & PRESERVE_VERTEX )
if( m_effortLevel & PRESERVE_VERTEX )
{
auto c = new PRESERVE_VERTEX_CONSTRAINT( m_world, m_preservedVertex );
AddConstraint( c );
}
if ( m_effortLevel & RESTRICT_VERTEX_RANGE )
if( m_effortLevel & RESTRICT_VERTEX_RANGE )
{
auto c = new RESTRICT_VERTEX_RANGE_CONSTRAINT( m_world, m_restrictedVertexRange.first,
m_restrictedVertexRange.second );
AddConstraint( c );
}
if ( m_effortLevel & RESTRICT_AREA )
if( m_effortLevel & RESTRICT_AREA )
{
auto c = new AREA_CONSTRAINT( m_world, m_restrictArea, m_restrictAreaIsStrict );
AddConstraint( c );
}
if ( m_effortLevel & KEEP_TOPOLOGY )
if( m_effortLevel & KEEP_TOPOLOGY )
{
auto c = new KEEP_TOPOLOGY_CONSTRAINT( m_world );
AddConstraint( c );
@ -625,7 +625,7 @@ bool OPTIMIZER::Optimize( LINE* aLine, LINE* aResult )
rv |= mergeObtuse( aResult );
if( m_effortLevel & MERGE_COLINEAR )
rv |= mergeColinear( aResult );
rv |= mergeColinear( aResult );
// TODO: Fix for arcs
if( !hasArcs && m_effortLevel & SMART_PADS )
@ -672,7 +672,7 @@ bool OPTIMIZER::mergeStep( LINE* aLine, SHAPE_LINE_CHAIN& aCurrentPath, int step
bool ok = false;
if ( !checkColliding( aLine, bypass ) )
if( !checkColliding( aLine, bypass ) )
{
//printf("Chk-constraints: %d %d\n", n, n+step+1 );
ok = checkConstraints ( n, n + step + 1, aLine, aCurrentPath, bypass );
@ -712,9 +712,9 @@ OPTIMIZER::BREAKOUT_LIST OPTIMIZER::circleBreakouts( int aWidth, const SHAPE* aS
for( int angle = 0; angle < 360; angle += 45 )
{
const SHAPE_CIRCLE* cir = static_cast<const SHAPE_CIRCLE*>( aShape );
SHAPE_LINE_CHAIN l;
VECTOR2I p0 = cir->GetCenter();
VECTOR2I v0( cir->GetRadius() * M_SQRT2, 0 );
SHAPE_LINE_CHAIN l;
VECTOR2I p0 = cir->GetCenter();
VECTOR2I v0( cir->GetRadius() * M_SQRT2, 0 );
l.Append( p0 );
l.Append( p0 + v0.Rotate( angle * M_PI / 180.0 ) );
@ -932,7 +932,7 @@ int OPTIMIZER::smartPadsSingle( LINE* aLine, ITEM* aPad, bool aEnd, int aEndVert
DIRECTION_45 dir_bkout( breakout.CSegment( -1 ) );
if(!connect.SegmentCount())
if( !connect.SegmentCount() )
continue;
int ang1 = dir_bkout.Angle( DIRECTION_45( connect.CSegment( 0 ) ) );
@ -1108,7 +1108,7 @@ int findCoupledVertices( const VECTOR2I& aVertex, const SEG& aOrigSeg,
SEG s = aCoupled.CSegment( i );
VECTOR2I projOverCoupled = s.LineProject ( aVertex );
if( s.ApproxParallel ( aOrigSeg ) )
if( s.ApproxParallel( aOrigSeg ) )
{
int64_t dist = int64_t{(( projOverCoupled - aVertex ).EuclideanNorm())} - aPair->Width();
@ -1147,15 +1147,15 @@ bool coupledBypass( NODE* aNode, DIFF_PAIR* aPair, bool aRefIsP, const SHAPE_LIN
const SHAPE_LINE_CHAIN& aRefBypass, const SHAPE_LINE_CHAIN& aCoupled,
SHAPE_LINE_CHAIN& aNewCoupled )
{
int vStartIdx[1024]; // fixme: possible overflow
int vStartIdx[1024]; // fixme: possible overflow
int nStarts = findCoupledVertices( aRefBypass.CPoint( 0 ), aRefBypass.CSegment( 0 ),
aCoupled, aPair, vStartIdx );
DIRECTION_45 dir( aRefBypass.CSegment( 0 ) );
DIRECTION_45 dir( aRefBypass.CSegment( 0 ) );
int64_t bestLength = -1;
bool found = false;
int64_t bestLength = -1;
bool found = false;
SHAPE_LINE_CHAIN bestBypass;
int si, ei;
int si, ei;
for( int i=0; i< nStarts; i++ )
{
@ -1240,7 +1240,7 @@ bool OPTIMIZER::mergeDpStep( DIFF_PAIR* aPair, bool aTryP, int step )
deltaUni = aPair->CoupledLength ( newRef, coupledPath ) - clenPre + budget;
if ( coupledBypass( m_world, aPair, aTryP, newRef, bypass, coupledPath, newCoup ) )
if( coupledBypass( m_world, aPair, aTryP, newRef, bypass, coupledPath, newCoup ) )
{
deltaCoupled = aPair->CoupledLength( newRef, newCoup ) - clenPre + budget;
@ -1253,7 +1253,7 @@ bool OPTIMIZER::mergeDpStep( DIFF_PAIR* aPair, bool aTryP, int step )
return true;
}
}
else if( deltaUni >= 0 && verifyDpBypass ( m_world, aPair, aTryP, newRef, coupledPath ) )
else if( deltaUni >= 0 && verifyDpBypass( m_world, aPair, aTryP, newRef, coupledPath ) )
{
newRef.Simplify();
coupledPath.Simplify();
@ -1389,7 +1389,7 @@ bool tightenSegment( bool dir, NODE *aNode, const LINE& cur, const SHAPE_LINE_CH
int da = a.Length();
int db = b.Length();
if ( da < db )
if( da < db )
guide = a;
else
guide = b;
@ -1401,9 +1401,9 @@ bool tightenSegment( bool dir, NODE *aNode, const LINE& cur, const SHAPE_LINE_CH
int current = step;
SHAPE_LINE_CHAIN snew;
while (step > 1)
while( step > 1 )
{
LINE l ( cur );
LINE l( cur );
snew.Clear();
snew.Append( a.A );
@ -1444,27 +1444,27 @@ void Tighten( NODE *aNode, const SHAPE_LINE_CHAIN& aOldLine, const LINE& aNewLin
{
LINE tmp;
if ( aNewLine.SegmentCount() < 3 )
if( aNewLine.SegmentCount() < 3 )
return;
SHAPE_LINE_CHAIN current ( aNewLine.CLine() );
for (int step = 0; step < 3; step++)
for( int step = 0; step < 3; step++)
{
current.Simplify();
for ( int i = 0; i <= current.SegmentCount() - 3; i++)
for( int i = 0; i <= current.SegmentCount() - 3; i++)
{
SHAPE_LINE_CHAIN l_in, l_out;
l_in = current.Slice(i, i+3);
for (int dir = 0; dir < 1; dir++)
for( int dir = 0; dir < 1; dir++)
{
if( tightenSegment( dir ? true : false, aNode, aNewLine, l_in, l_out ) )
if( tightenSegment( dir ? true : false, aNode, aNewLine, l_in, l_out ) )
{
SHAPE_LINE_CHAIN opt = current;
opt.Replace(i, i+3, l_out);
opt.Replace(i, i + 3, l_out);
auto optArea = std::abs(shovedArea( aOldLine, opt ));
auto prevArea = std::abs(shovedArea( aOldLine, current ));

View File

@ -100,11 +100,11 @@ public:
SMART_PADS = 0x02, ///< Reroute pad exits
MERGE_OBTUSE = 0x04, ///< Reduce corner cost by merging obtuse segments
FANOUT_CLEANUP = 0x08, ///< Simplify pad-pad and pad-via connections if possible
KEEP_TOPOLOGY = 0x10,
PRESERVE_VERTEX = 0x20,
KEEP_TOPOLOGY = 0x10,
PRESERVE_VERTEX = 0x20,
RESTRICT_VERTEX_RANGE = 0x40,
MERGE_COLINEAR = 0x80, ///< Merge co-linear segments
RESTRICT_AREA = 0x100
RESTRICT_AREA = 0x100
};
OPTIMIZER( NODE* aWorld );
@ -196,20 +196,18 @@ private:
ITEM* findPadOrVia( int aLayer, int aNet, const VECTOR2I& aP ) const;
private:
SHAPE_INDEX_LIST<ITEM*> m_cache;
SHAPE_INDEX_LIST<ITEM*> m_cache;
std::vector<OPT_CONSTRAINT*> m_constraints;
std::unordered_map<ITEM*, CACHED_ITEM> m_cacheTags;
NODE* m_world;
int m_collisionKindMask;
int m_effortLevel;
bool m_keepPostures;
NODE* m_world;
int m_collisionKindMask;
int m_effortLevel;
VECTOR2I m_preservedVertex;
VECTOR2I m_preservedVertex;
std::pair<int, int> m_restrictedVertexRange;
BOX2I m_restrictArea;
bool m_restrictAreaIsStrict;
BOX2I m_restrictArea;
bool m_restrictAreaIsStrict;
};
@ -218,9 +216,9 @@ class OPT_CONSTRAINT
public:
OPT_CONSTRAINT( NODE* aWorld ) :
m_world( aWorld )
{
m_priority = 0;
};
{
m_priority = 0;
};
virtual ~OPT_CONSTRAINT()
{
@ -235,7 +233,7 @@ public:
protected:
NODE* m_world;
int m_priority;
int m_priority;
};
class ANGLE_CONSTRAINT_45: public OPT_CONSTRAINT
@ -275,7 +273,6 @@ public:
private:
BOX2I m_allowedArea;
bool m_allowedAreaStrict;
};
@ -306,7 +303,6 @@ public:
const SHAPE_LINE_CHAIN& aCurrentPath,
const SHAPE_LINE_CHAIN& aReplacement ) override;
private:
VECTOR2I m_v;
};
@ -325,7 +321,6 @@ public:
const SHAPE_LINE_CHAIN& aCurrentPath,
const SHAPE_LINE_CHAIN& aReplacement ) override;
private:
int m_start;
int m_end;
};

View File

@ -154,7 +154,7 @@ bool ROUTER::StartDragging( const VECTOR2I& aP, ITEM_SET aStartItems, int aDragM
m_dragger->SetMode( aDragMode );
m_dragger->SetWorld( m_world.get() );
m_dragger->SetLogger( m_logger );
m_dragger->SetDebugDecorator ( m_iface->GetDebugDecorator () );
m_dragger->SetDebugDecorator( m_iface->GetDebugDecorator() );
m_logger->Clear();
@ -163,7 +163,7 @@ bool ROUTER::StartDragging( const VECTOR2I& aP, ITEM_SET aStartItems, int aDragM
m_logger->Log( LOGGER::EVT_START_DRAG, aP, aStartItems[0] );
}
if( m_dragger->Start ( aP, aStartItems ) )
if( m_dragger->Start( aP, aStartItems ) )
{
m_state = DRAG_SEGMENT;
}
@ -367,7 +367,7 @@ bool ROUTER::StartRouting( const VECTOR2I& aP, ITEM* aStartItem, int aLayer )
m_placer->UpdateSizes( m_sizes );
m_placer->SetLayer( aLayer );
m_placer->SetDebugDecorator( m_iface->GetDebugDecorator () );
m_placer->SetDebugDecorator( m_iface->GetDebugDecorator() );
m_placer->SetLogger( m_logger );
m_logger->Clear();
@ -796,7 +796,7 @@ void ROUTER::BreakSegment( ITEM *aItem, const VECTOR2I& aP )
LINE_PLACER placer( this );
if ( placer.SplitAdjacentSegments( node, aItem, aP ) )
if( placer.SplitAdjacentSegments( node, aItem, aP ) )
{
CommitRouting( node );
}

View File

@ -1582,7 +1582,7 @@ SHOVE::SHOVE_STATUS SHOVE::ShoveDraggingVia( const VIA_HANDLE aOldVia, const VEC
void SHOVE::runOptimizer( NODE* aNode )
{
OPTIMIZER optimizer( aNode );
int optFlags = 0;
int optFlags = 0;
int n_passes = 0;
PNS_OPTIMIZATION_EFFORT effort = Settings().OptimizerEffort();
@ -1623,16 +1623,16 @@ void SHOVE::runOptimizer( NODE* aNode )
}
if( area )
{
if( Dbg() )
{
if( Dbg() )
{
Dbg()->AddBox( *area, 1, "opt-area" );
}
optFlags |= OPTIMIZER::RESTRICT_AREA;
optimizer.SetRestrictArea( *area, false );
Dbg()->AddBox( *area, 1, "opt-area" );
}
optFlags |= OPTIMIZER::RESTRICT_AREA;
optimizer.SetRestrictArea( *area, false );
}
if( Settings().SmartPads() )
optFlags |= OPTIMIZER::SMART_PADS;

View File

@ -112,6 +112,6 @@ private:
std::map<int, int> m_layerPairs;
};
};
}
#endif // __PNS_SIZES_SETTINGS_H