Code formatting.

This commit is contained in:
Maciej Suminski 2015-10-05 18:28:41 +02:00
parent 480cf85102
commit 2607497b37
15 changed files with 492 additions and 492 deletions

View File

@ -411,32 +411,32 @@ void PNS_DP_GATEWAYS::BuildFromPrimitivePair( PNS_DP_PRIMITIVE_PAIR aPair, bool
switch( shP->Type() )
{
case SH_RECT:
{
int w = static_cast<const SHAPE_RECT*>( shP )->GetWidth();
int h = static_cast<const SHAPE_RECT*>( shP )->GetHeight();
case SH_RECT:
{
int w = static_cast<const SHAPE_RECT*>( shP )->GetWidth();
int h = static_cast<const SHAPE_RECT*>( shP )->GetHeight();
if( w < h )
std::swap( w, h );
if( w < h )
std::swap( w, h );
orthoFanDistance = w * 3/4;
diagFanDistance = ( w - h ) / 2;
break;
}
orthoFanDistance = w * 3/4;
diagFanDistance = ( w - h ) / 2;
break;
}
case SH_SEGMENT:
{
int w = static_cast<const SHAPE_SEGMENT*>( shP )->GetWidth();
SEG s = static_cast<const SHAPE_SEGMENT*>( shP )->GetSeg();
case SH_SEGMENT:
{
int w = static_cast<const SHAPE_SEGMENT*>( shP )->GetWidth();
SEG s = static_cast<const SHAPE_SEGMENT*>( shP )->GetSeg();
orthoFanDistance = w + ( s.B - s.A ).EuclideanNorm() / 2;
diagFanDistance = ( s.B - s.A ).EuclideanNorm() / 2;
break;
}
orthoFanDistance = w + ( s.B - s.A ).EuclideanNorm() / 2;
diagFanDistance = ( s.B - s.A ).EuclideanNorm() / 2;
break;
}
default:
BuildGeneric ( p0_p, p0_n, true );
return;
default:
BuildGeneric ( p0_p, p0_n, true );
return;
}
if( checkDiagonalAlignment( p0_p, p0_n ) )

View File

@ -302,14 +302,14 @@ bool PNS_DIFF_PAIR_PLACER::route( const VECTOR2I& aP )
{
switch( m_currentMode )
{
case RM_MarkObstacles:
return rhMarkObstacles( aP );
case RM_Walkaround:
return rhWalkOnly( aP );
case RM_Shove:
return rhShoveOnly( aP );
default:
break;
case RM_MarkObstacles:
return rhMarkObstacles( aP );
case RM_Walkaround:
return rhWalkOnly( aP );
case RM_Shove:
return rhShoveOnly( aP );
default:
break;
}
return false;
@ -447,28 +447,28 @@ OPT_VECTOR2I PNS_DIFF_PAIR_PLACER::getDanglingAnchor( PNS_NODE* aNode, PNS_ITEM*
{
switch( aItem->Kind() )
{
case PNS_ITEM::VIA:
case PNS_ITEM::SOLID:
return aItem->Anchor( 0 );
case PNS_ITEM::VIA:
case PNS_ITEM::SOLID:
return aItem->Anchor( 0 );
case PNS_ITEM::SEGMENT:
{
PNS_SEGMENT* s =static_cast<PNS_SEGMENT*>( aItem );
case PNS_ITEM::SEGMENT:
{
PNS_SEGMENT* s =static_cast<PNS_SEGMENT*>( aItem );
PNS_JOINT* jA = aNode->FindJoint( s->Seg().A, s );
PNS_JOINT* jB = aNode->FindJoint( s->Seg().B, s );
PNS_JOINT* jA = aNode->FindJoint( s->Seg().A, s );
PNS_JOINT* jB = aNode->FindJoint( s->Seg().B, s );
if( jA->LinkCount() == 1 )
return s->Seg().A;
else if( jB->LinkCount() == 1 )
return s->Seg().B;
else
return OPT_VECTOR2I();
}
default:
if( jA->LinkCount() == 1 )
return s->Seg().A;
else if( jB->LinkCount() == 1 )
return s->Seg().B;
else
return OPT_VECTOR2I();
break;
}
default:
return OPT_VECTOR2I();
break;
}
}

View File

@ -368,17 +368,17 @@ const wxString PNS_DP_MEANDER_PLACER::TuningInfo() const
switch( m_lastStatus )
{
case TOO_LONG:
status = _( "Too long: " );
break;
case TOO_SHORT:
status = _("Too short: " );
break;
case TUNED:
status = _( "Tuned: " );
break;
default:
return _( "?" );
case TOO_LONG:
status = _( "Too long: " );
break;
case TOO_SHORT:
status = _("Too short: " );
break;
case TUNED:
status = _( "Tuned: " );
break;
default:
return _( "?" );
}
status += LengthDoubleToString( (double) m_lastLength, false );

View File

@ -116,14 +116,14 @@ bool PNS_DRAGGER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
switch( aStartItem->Kind() )
{
case PNS_ITEM::SEGMENT:
return startDragSegment( aP, static_cast<PNS_SEGMENT*>( aStartItem ) );
case PNS_ITEM::SEGMENT:
return startDragSegment( aP, static_cast<PNS_SEGMENT*>( aStartItem ) );
case PNS_ITEM::VIA:
return startDragVia( aP, static_cast<PNS_VIA*>( aStartItem ) );
case PNS_ITEM::VIA:
return startDragVia( aP, static_cast<PNS_VIA*>( aStartItem ) );
default:
return false;
default:
return false;
}
}
@ -138,37 +138,37 @@ bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP )
switch( m_mode )
{
case SEGMENT:
case CORNER:
{
int thresh = Settings().SmoothDraggedSegments() ? m_draggedLine.Width() / 4 : 0;
PNS_LINE dragged( m_draggedLine );
case SEGMENT:
case CORNER:
{
int thresh = Settings().SmoothDraggedSegments() ? m_draggedLine.Width() / 4 : 0;
PNS_LINE dragged( m_draggedLine );
if( m_mode == SEGMENT )
dragged.DragSegment( aP, m_draggedSegmentIndex, thresh );
else
dragged.DragCorner( aP, m_draggedSegmentIndex, thresh );
if( m_mode == SEGMENT )
dragged.DragSegment( aP, m_draggedSegmentIndex, thresh );
else
dragged.DragCorner( aP, m_draggedSegmentIndex, thresh );
m_lastNode = m_shove->CurrentNode()->Branch();
m_lastNode = m_shove->CurrentNode()->Branch();
m_lastValidDraggedLine = dragged;
m_lastValidDraggedLine.ClearSegmentLinks();
m_lastValidDraggedLine.Unmark();
m_lastValidDraggedLine = dragged;
m_lastValidDraggedLine.ClearSegmentLinks();
m_lastValidDraggedLine.Unmark();
m_lastNode->Add( &m_lastValidDraggedLine );
m_draggedItems.Clear();
m_draggedItems.Add( m_lastValidDraggedLine );
m_lastNode->Add( &m_lastValidDraggedLine );
m_draggedItems.Clear();
m_draggedItems.Add( m_lastValidDraggedLine );
break;
}
break;
}
case VIA: // fixme...
{
m_lastNode = m_shove->CurrentNode()->Branch();
dumbDragVia( m_initialVia, m_lastNode, aP );
case VIA: // fixme...
{
m_lastNode = m_shove->CurrentNode()->Branch();
dumbDragVia( m_initialVia, m_lastNode, aP );
break;
}
break;
}
}
if( Settings().CanViolateDRC() )
@ -224,59 +224,59 @@ bool PNS_DRAGGER::dragShove( const VECTOR2I& aP )
switch( m_mode )
{
case SEGMENT:
case CORNER:
case SEGMENT:
case CORNER:
{
int thresh = Settings().SmoothDraggedSegments() ? m_draggedLine.Width() / 4 : 0;
PNS_LINE dragged( m_draggedLine );
if( m_mode == SEGMENT )
dragged.DragSegment( aP, m_draggedSegmentIndex, thresh );
else
dragged.DragCorner( aP, m_draggedSegmentIndex, thresh );
PNS_SHOVE::SHOVE_STATUS st = m_shove->ShoveLines( dragged );
if( st == PNS_SHOVE::SH_OK )
ok = true;
else if( st == PNS_SHOVE::SH_HEAD_MODIFIED )
{
int thresh = Settings().SmoothDraggedSegments() ? m_draggedLine.Width() / 4 : 0;
PNS_LINE dragged( m_draggedLine );
dragged = m_shove->NewHead();
ok = true;
}
if( m_mode == SEGMENT )
dragged.DragSegment( aP, m_draggedSegmentIndex, thresh );
else
dragged.DragCorner( aP, m_draggedSegmentIndex, thresh );
m_lastNode = m_shove->CurrentNode()->Branch();
PNS_SHOVE::SHOVE_STATUS st = m_shove->ShoveLines( dragged );
if( ok )
m_lastValidDraggedLine = dragged;
if( st == PNS_SHOVE::SH_OK )
ok = true;
else if( st == PNS_SHOVE::SH_HEAD_MODIFIED )
{
dragged = m_shove->NewHead();
ok = true;
}
m_lastValidDraggedLine.ClearSegmentLinks();
m_lastValidDraggedLine.Unmark();
m_lastNode->Add( &m_lastValidDraggedLine );
m_draggedItems.Clear();
m_draggedItems.Add( m_lastValidDraggedLine );
m_lastNode = m_shove->CurrentNode()->Branch();
break;
}
if( ok )
m_lastValidDraggedLine = dragged;
case VIA:
{
PNS_VIA* newVia;
PNS_SHOVE::SHOVE_STATUS st = m_shove->ShoveDraggingVia( m_draggedVia, aP, &newVia );
m_lastValidDraggedLine.ClearSegmentLinks();
m_lastValidDraggedLine.Unmark();
m_lastNode->Add( &m_lastValidDraggedLine );
if( st == PNS_SHOVE::SH_OK || st == PNS_SHOVE::SH_HEAD_MODIFIED )
ok = true;
m_lastNode = m_shove->CurrentNode()->Branch();
if( ok )
{
m_draggedVia = newVia;
m_draggedItems.Clear();
m_draggedItems.Add( m_lastValidDraggedLine );
break;
}
case VIA:
{
PNS_VIA* newVia;
PNS_SHOVE::SHOVE_STATUS st = m_shove->ShoveDraggingVia( m_draggedVia, aP, &newVia );
if( st == PNS_SHOVE::SH_OK || st == PNS_SHOVE::SH_HEAD_MODIFIED )
ok = true;
m_lastNode = m_shove->CurrentNode()->Branch();
if( ok )
{
m_draggedVia = newVia;
m_draggedItems.Clear();
}
break;
}
break;
}
}
m_dragStatus = ok;
@ -301,16 +301,16 @@ bool PNS_DRAGGER::Drag( const VECTOR2I& aP )
{
switch( m_currentMode )
{
case RM_MarkObstacles:
return dragMarkObstacles( aP );
case RM_MarkObstacles:
return dragMarkObstacles( aP );
case RM_Shove:
case RM_Walkaround:
case RM_Smart:
return dragShove( aP );
case RM_Shove:
case RM_Walkaround:
case RM_Smart:
return dragShove( aP );
default:
return false;
default:
return false;
}
}

View File

@ -379,14 +379,14 @@ bool PNS_LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead )
switch( Settings().OptimizerEffort() )
{
case OE_LOW:
effort = 0;
break;
case OE_LOW:
effort = 0;
break;
case OE_MEDIUM:
case OE_FULL:
effort = PNS_OPTIMIZER::MERGE_SEGMENTS;
break;
case OE_MEDIUM:
case OE_FULL:
effort = PNS_OPTIMIZER::MERGE_SEGMENTS;
break;
}
if( Settings().SmartPads() )
@ -513,14 +513,14 @@ bool PNS_LINE_PLACER::routeHead( const VECTOR2I& aP, PNS_LINE& aNewHead )
{
switch( m_currentMode )
{
case RM_MarkObstacles:
return rhMarkObstacles( aP, aNewHead );
case RM_Walkaround:
return rhWalkOnly( aP, aNewHead );
case RM_Shove:
return rhShoveOnly( aP, aNewHead );
default:
break;
case RM_MarkObstacles:
return rhMarkObstacles( aP, aNewHead );
case RM_Walkaround:
return rhWalkOnly( aP, aNewHead );
case RM_Shove:
return rhShoveOnly( aP, aNewHead );
default:
break;
}
return false;
@ -1104,4 +1104,4 @@ PNS_LOGGER* PNS_LINE_PLACER::Logger()
return m_shove->Logger();
return NULL;
}
}

View File

@ -77,44 +77,44 @@ void PNS_LOGGER::Log ( const PNS_ITEM* aItem, int aKind, const std::string aName
switch( aItem->Kind() )
{
case PNS_ITEM::LINE:
{
PNS_LINE* l = (PNS_LINE*) aItem;
m_theLog << " line ";
m_theLog << l->Width() << " " << ( l->EndsWithVia() ? 1 : 0 ) << " ";
dumpShape ( l->Shape() );
m_theLog << std::endl;
break;
}
case PNS_ITEM::LINE:
{
PNS_LINE* l = (PNS_LINE*) aItem;
m_theLog << " line ";
m_theLog << l->Width() << " " << ( l->EndsWithVia() ? 1 : 0 ) << " ";
dumpShape ( l->Shape() );
m_theLog << std::endl;
break;
}
case PNS_ITEM::VIA:
{
m_theLog << " via 0 0 ";
dumpShape ( aItem->Shape() );
m_theLog << std::endl;
break;
}
case PNS_ITEM::VIA:
{
m_theLog << " via 0 0 ";
dumpShape ( aItem->Shape() );
m_theLog << std::endl;
break;
}
case PNS_ITEM::SEGMENT:
{
PNS_SEGMENT* s =(PNS_SEGMENT*) aItem;
m_theLog << " line ";
m_theLog << s->Width() << " 0 linechain 2 0 " << s->Seg().A.x << " " <<
s->Seg().A.y << " " << s->Seg().B.x << " " <<s->Seg().B.y << std::endl;
break;
}
case PNS_ITEM::SEGMENT:
{
PNS_SEGMENT* s =(PNS_SEGMENT*) aItem;
m_theLog << " line ";
m_theLog << s->Width() << " 0 linechain 2 0 " << s->Seg().A.x << " " <<
s->Seg().A.y << " " << s->Seg().B.x << " " <<s->Seg().B.y << std::endl;
break;
}
case PNS_ITEM::SOLID:
{
PNS_SOLID* s = (PNS_SOLID*) aItem;
m_theLog << " solid 0 0 ";
dumpShape( s->Shape() );
m_theLog << std::endl;
break;
}
case PNS_ITEM::SOLID:
{
PNS_SOLID* s = (PNS_SOLID*) aItem;
m_theLog << " solid 0 0 ";
dumpShape( s->Shape() );
m_theLog << std::endl;
break;
}
default:
break;
default:
break;
}
}
@ -140,53 +140,53 @@ void PNS_LOGGER::dumpShape( const SHAPE* aSh )
{
switch( aSh->Type() )
{
case SH_LINE_CHAIN:
{
const SHAPE_LINE_CHAIN* lc = (const SHAPE_LINE_CHAIN*) aSh;
m_theLog << "linechain " << lc->PointCount() << " " << ( lc->IsClosed() ? 1 : 0 ) << " ";
case SH_LINE_CHAIN:
{
const SHAPE_LINE_CHAIN* lc = (const SHAPE_LINE_CHAIN*) aSh;
m_theLog << "linechain " << lc->PointCount() << " " << ( lc->IsClosed() ? 1 : 0 ) << " ";
for( int i = 0; i < lc->PointCount(); i++ )
m_theLog << lc->CPoint( i ).x << " " << lc->CPoint( i ).y << " ";
for( int i = 0; i < lc->PointCount(); i++ )
m_theLog << lc->CPoint( i ).x << " " << lc->CPoint( i ).y << " ";
break;
}
break;
}
case SH_CIRCLE:
{
const SHAPE_CIRCLE *c = (const SHAPE_CIRCLE*) aSh;
m_theLog << "circle " << c->GetCenter().x << " " << c->GetCenter().y << " " << c->GetRadius();
break;
}
case SH_CIRCLE:
{
const SHAPE_CIRCLE *c = (const SHAPE_CIRCLE*) aSh;
m_theLog << "circle " << c->GetCenter().x << " " << c->GetCenter().y << " " << c->GetRadius();
break;
}
case SH_RECT:
{
const SHAPE_RECT* r = (const SHAPE_RECT*) aSh;
m_theLog << "rect " << r->GetPosition().x << " " << r->GetPosition().y << " " <<
r->GetSize().x << " " <<r->GetSize().y;
break;
}
case SH_RECT:
{
const SHAPE_RECT* r = (const SHAPE_RECT*) aSh;
m_theLog << "rect " << r->GetPosition().x << " " << r->GetPosition().y << " " <<
r->GetSize().x << " " <<r->GetSize().y;
break;
}
case SH_SEGMENT:
{
const SHAPE_SEGMENT* s = (const SHAPE_SEGMENT*) aSh;
m_theLog << "linechain 2 0 " << s->GetSeg().A.x << " " << s->GetSeg().A.y << " " <<
s->GetSeg().B.x << " " << s->GetSeg().B.y;
break;
}
case SH_SEGMENT:
{
const SHAPE_SEGMENT* s = (const SHAPE_SEGMENT*) aSh;
m_theLog << "linechain 2 0 " << s->GetSeg().A.x << " " << s->GetSeg().A.y << " " <<
s->GetSeg().B.x << " " << s->GetSeg().B.y;
break;
}
case SH_CONVEX:
{
const SHAPE_CONVEX* c = (const SHAPE_CONVEX*) aSh;
m_theLog << "convex " << c->PointCount() << " ";
case SH_CONVEX:
{
const SHAPE_CONVEX* c = (const SHAPE_CONVEX*) aSh;
m_theLog << "convex " << c->PointCount() << " ";
for( int i = 0; i < c->PointCount(); i++ )
m_theLog << c->CPoint( i ).x << " " << c->CPoint( i ).y << " ";
for( int i = 0; i < c->PointCount(); i++ )
m_theLog << c->CPoint( i ).x << " " << c->CPoint( i ).y << " ";
break;
}
break;
}
default:
break;
default:
break;
}
}

View File

@ -331,53 +331,53 @@ SHAPE_LINE_CHAIN PNS_MEANDER_SHAPE::genMeanderShape( VECTOR2D aP, VECTOR2D aDir,
switch( aType )
{
case MT_EMPTY:
{
lc.Append( aP + dir_v_b + aDir );
break;
}
case MT_START:
{
arc( cr - offset, false );
uShape( aAmpl - 2 * cr + std::abs( offset ), cr + offset, spc - 2 * cr );
forward( std::min( cr - offset, cr + offset ) );
forward( std::abs( offset ) );
case MT_EMPTY:
{
lc.Append( aP + dir_v_b + aDir );
break;
}
case MT_START:
{
arc( cr - offset, false );
uShape( aAmpl - 2 * cr + std::abs( offset ), cr + offset, spc - 2 * cr );
forward( std::min( cr - offset, cr + offset ) );
forward( std::abs( offset ) );
break;
}
break;
}
case MT_FINISH:
{
start( &lc, aP - dir_u_b, aDir );
turn ( 90 );
forward( std::min( cr - offset, cr + offset ) );
forward( std::abs( offset ) );
uShape( aAmpl - 2 * cr + std::abs( offset ), cr + offset, spc - 2 * cr );
arc( cr - offset, false );
break;
}
case MT_FINISH:
{
start( &lc, aP - dir_u_b, aDir );
turn ( 90 );
forward( std::min( cr - offset, cr + offset ) );
forward( std::abs( offset ) );
uShape( aAmpl - 2 * cr + std::abs( offset ), cr + offset, spc - 2 * cr );
arc( cr - offset, false );
break;
}
case MT_TURN:
{
start( &lc, aP - dir_u_b, aDir );
turn( 90 );
forward( std::abs( offset ) );
uShape ( aAmpl - cr, cr + offset, spc - 2 * cr );
forward( std::abs( offset ) );
break;
}
case MT_TURN:
{
start( &lc, aP - dir_u_b, aDir );
turn( 90 );
forward( std::abs( offset ) );
uShape ( aAmpl - cr, cr + offset, spc - 2 * cr );
forward( std::abs( offset ) );
break;
}
case MT_SINGLE:
{
arc( cr - offset, false );
uShape( aAmpl - 2 * cr + std::abs( offset ), cr + offset, spc - 2 * cr );
arc( cr - offset, false );
lc.Append( aP + dir_v_b + aDir.Resize ( 2 * st.m_spacing ) );
break;
}
case MT_SINGLE:
{
arc( cr - offset, false );
uShape( aAmpl - 2 * cr + std::abs( offset ), cr + offset, spc - 2 * cr );
arc( cr - offset, false );
lc.Append( aP + dir_v_b + aDir.Resize ( 2 * st.m_spacing ) );
break;
}
default:
break;
default:
break;
}
if( aSide )

View File

@ -241,17 +241,17 @@ const wxString PNS_MEANDER_PLACER::TuningInfo() const
switch ( m_lastStatus )
{
case TOO_LONG:
status = _( "Too long: " );
break;
case TOO_SHORT:
status = _( "Too short: " );
break;
case TUNED:
status = _( "Tuned: " );
break;
default:
return _( "?" );
case TOO_LONG:
status = _( "Too long: " );
break;
case TOO_SHORT:
status = _( "Too short: " );
break;
case TUNED:
status = _( "Tuned: " );
break;
default:
return _( "?" );
}
status += LengthDoubleToString( (double) m_lastLength, false );

View File

@ -152,17 +152,17 @@ const wxString PNS_MEANDER_SKEW_PLACER::TuningInfo() const
switch( m_lastStatus )
{
case TOO_LONG:
status = _( "Too long: skew " );
break;
case TOO_SHORT:
status = _( "Too short: skew " );
break;
case TUNED:
status = _( "Tuned: skew " );
break;
default:
return _( "?" );
case TOO_LONG:
status = _( "Too long: skew " );
break;
case TOO_SHORT:
status = _( "Too short: skew " );
break;
case TUNED:
status = _( "Tuned: skew " );
break;
default:
return _( "?" );
}
status += LengthDoubleToString( (double) m_lastLength - m_coupledLength, false );

View File

@ -613,25 +613,25 @@ bool PNS_ROUTER::StartRouting( const VECTOR2I& aP, PNS_ITEM* aStartItem, int aLa
switch( m_mode )
{
case PNS_MODE_ROUTE_SINGLE:
m_placer = new PNS_LINE_PLACER( this );
break;
case PNS_MODE_ROUTE_DIFF_PAIR:
m_placer = new PNS_DIFF_PAIR_PLACER( this );
m_clearanceFunc->UseDpGap( true );
break;
case PNS_MODE_TUNE_SINGLE:
m_placer = new PNS_MEANDER_PLACER( this );
break;
case PNS_MODE_TUNE_DIFF_PAIR:
m_placer = new PNS_DP_MEANDER_PLACER( this );
break;
case PNS_MODE_TUNE_DIFF_PAIR_SKEW:
m_placer = new PNS_MEANDER_SKEW_PLACER( this );
break;
case PNS_MODE_ROUTE_SINGLE:
m_placer = new PNS_LINE_PLACER( this );
break;
case PNS_MODE_ROUTE_DIFF_PAIR:
m_placer = new PNS_DIFF_PAIR_PLACER( this );
m_clearanceFunc->UseDpGap( true );
break;
case PNS_MODE_TUNE_SINGLE:
m_placer = new PNS_MEANDER_PLACER( this );
break;
case PNS_MODE_TUNE_DIFF_PAIR:
m_placer = new PNS_DP_MEANDER_PLACER( this );
break;
case PNS_MODE_TUNE_DIFF_PAIR_SKEW:
m_placer = new PNS_MEANDER_SKEW_PLACER( this );
break;
default:
return false;
default:
return false;
}
m_placer->UpdateSizes ( m_sizes );
@ -725,16 +725,16 @@ void PNS_ROUTER::Move( const VECTOR2I& aP, PNS_ITEM* endItem )
switch( m_state )
{
case ROUTE_TRACK:
movePlacing( aP, endItem );
break;
case ROUTE_TRACK:
movePlacing( aP, endItem );
break;
case DRAG_SEGMENT:
moveDragging( aP, endItem );
break;
case DRAG_SEGMENT:
moveDragging( aP, endItem );
break;
default:
break;
default:
break;
}
}
@ -934,16 +934,16 @@ bool PNS_ROUTER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
switch( m_state )
{
case ROUTE_TRACK:
rv = m_placer->FixRoute( aP, aEndItem );
break;
case ROUTE_TRACK:
rv = m_placer->FixRoute( aP, aEndItem );
break;
case DRAG_SEGMENT:
rv = m_dragger->FixRoute();
break;
case DRAG_SEGMENT:
rv = m_dragger->FixRoute();
break;
default:
break;
default:
break;
}
if( rv )
@ -1003,11 +1003,11 @@ void PNS_ROUTER::SwitchLayer( int aLayer )
{
switch( m_state )
{
case ROUTE_TRACK:
m_placer->SetLayer( aLayer );
break;
default:
break;
case ROUTE_TRACK:
m_placer->SetLayer( aLayer );
break;
default:
break;
}
}
@ -1045,16 +1045,16 @@ void PNS_ROUTER::DumpLog()
switch( m_state )
{
case DRAG_SEGMENT:
logger = m_dragger->Logger();
break;
case DRAG_SEGMENT:
logger = m_dragger->Logger();
break;
case ROUTE_TRACK:
logger = m_placer->Logger();
break;
case ROUTE_TRACK:
logger = m_placer->Logger();
break;
default:
break;
default:
break;
}
if( logger )

View File

@ -927,39 +927,39 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter )
{
switch( ni->Kind() )
{
case PNS_ITEM::VIA:
case PNS_ITEM::VIA:
{
PNS_VIA* revVia = (PNS_VIA*) ni;
TRACE( 2, "iter %d: reverse-collide-via", aIter );
if( currentLine.EndsWithVia() && m_currentNode->CheckColliding( &currentLine.Via(), revVia ) )
{
PNS_VIA* revVia = (PNS_VIA*) ni;
TRACE( 2, "iter %d: reverse-collide-via", aIter );
if( currentLine.EndsWithVia() && m_currentNode->CheckColliding( &currentLine.Via(), revVia ) )
{
st = SH_INCOMPLETE;
}
else
{
st = onReverseCollidingVia ( currentLine, revVia );
}
break;
st = SH_INCOMPLETE;
}
else
{
st = onReverseCollidingVia ( currentLine, revVia );
}
case PNS_ITEM::SEGMENT:
{
PNS_SEGMENT* seg = (PNS_SEGMENT*) ni;
TRACE( 2, "iter %d: reverse-collide-segment ", aIter );
PNS_LINE revLine = assembleLine( seg );
break;
}
popLine();
st = onCollidingLine( revLine, currentLine );
if ( !pushLine( revLine ) )
return SH_INCOMPLETE;
case PNS_ITEM::SEGMENT:
{
PNS_SEGMENT* seg = (PNS_SEGMENT*) ni;
TRACE( 2, "iter %d: reverse-collide-segment ", aIter );
PNS_LINE revLine = assembleLine( seg );
break;
}
popLine();
st = onCollidingLine( revLine, currentLine );
if ( !pushLine( revLine ) )
return SH_INCOMPLETE;
default:
assert( false );
break;
}
default:
assert( false );
}
}
else

View File

@ -34,19 +34,19 @@ int PNS_SIZES_SETTINGS::inheritTrackWidth( PNS_ITEM* aItem )
switch( aItem->Kind() )
{
case PNS_ITEM::VIA:
p = static_cast<PNS_VIA*>( aItem )->Pos();
break;
case PNS_ITEM::VIA:
p = static_cast<PNS_VIA*>( aItem )->Pos();
break;
case PNS_ITEM::SOLID:
p = static_cast<PNS_SOLID*>( aItem )->Pos();
break;
case PNS_ITEM::SOLID:
p = static_cast<PNS_SOLID*>( aItem )->Pos();
break;
case PNS_ITEM::SEGMENT:
return static_cast<PNS_SEGMENT*>( aItem )->Width();
case PNS_ITEM::SEGMENT:
return static_cast<PNS_SEGMENT*>( aItem )->Width();
default:
return 0;
default:
return 0;
}
PNS_JOINT* jt = static_cast<PNS_NODE*>( aItem->Owner() )->FindJoint( p, aItem );

View File

@ -49,15 +49,15 @@ void PNS_TUNE_STATUS_POPUP::UpdateStatus( PNS_ROUTER* aRouter )
switch( placer->TuningStatus() )
{
case PNS_MEANDER_PLACER::TUNED:
color = wxColour( 0, 255, 0 );
break;
case PNS_MEANDER_PLACER::TOO_SHORT:
color = wxColour( 255, 128, 128 );
break;
case PNS_MEANDER_PLACER::TOO_LONG:
color = wxColour( 128, 128, 255 );
break;
case PNS_MEANDER_PLACER::TUNED:
color = wxColour( 0, 255, 0 );
break;
case PNS_MEANDER_PLACER::TOO_SHORT:
color = wxColour( 255, 128, 128 );
break;
case PNS_MEANDER_PLACER::TOO_LONG:
color = wxColour( 128, 128, 255 );
break;
}
m_statusLine->SetForegroundColour( color );

View File

@ -177,92 +177,92 @@ void ROUTER_PREVIEW_ITEM::ViewDraw( int aLayer, KIGFX::GAL* aGal ) const
switch( m_shape->Type() )
{
case SH_LINE_CHAIN:
{
const SHAPE_LINE_CHAIN* l = (const SHAPE_LINE_CHAIN*) m_shape;
drawLineChain( *l, aGal );
break;
}
case SH_LINE_CHAIN:
{
const SHAPE_LINE_CHAIN* l = (const SHAPE_LINE_CHAIN*) m_shape;
drawLineChain( *l, aGal );
break;
}
case SH_SEGMENT:
{
const SHAPE_SEGMENT* s = (const SHAPE_SEGMENT*) m_shape;
aGal->DrawSegment( s->GetSeg().A, s->GetSeg().B, s->GetWidth() );
if( m_clearance > 0 )
{
aGal->SetLayerDepth( ClearanceOverlayDepth );
aGal->SetStrokeColor( COLOR4D( DARKDARKGRAY ) );
aGal->SetFillColor( COLOR4D( DARKDARKGRAY ) );
aGal->DrawSegment( s->GetSeg().A, s->GetSeg().B, s->GetWidth() + 2 * m_clearance );
}
break;
}
case SH_CIRCLE:
{
const SHAPE_CIRCLE* c = (const SHAPE_CIRCLE*) m_shape;
aGal->DrawCircle( c->GetCenter(), c->GetRadius() );
if( m_clearance > 0 )
{
aGal->SetLayerDepth( ClearanceOverlayDepth );
aGal->SetFillColor( COLOR4D( DARKDARKGRAY ) );
aGal->SetIsStroke( false );
aGal->DrawCircle( c->GetCenter(), c->GetRadius() + m_clearance );
}
break;
}
case SH_RECT:
{
const SHAPE_RECT* r = (const SHAPE_RECT*) m_shape;
aGal->DrawRectangle( r->GetPosition(), r->GetPosition() + r->GetSize() );
if( m_clearance > 0 )
{
aGal->SetLayerDepth( ClearanceOverlayDepth );
VECTOR2I p0( r->GetPosition() ), s( r->GetSize() );
aGal->SetStrokeColor( COLOR4D( DARKDARKGRAY ) );
aGal->SetIsStroke( true );
aGal->SetLineWidth( 2 * m_clearance );
aGal->DrawLine( p0, VECTOR2I( p0.x + s.x, p0.y ) );
aGal->DrawLine( p0, VECTOR2I( p0.x, p0.y + s.y ) );
aGal->DrawLine( p0 + s , VECTOR2I( p0.x + s.x, p0.y ) );
aGal->DrawLine( p0 + s, VECTOR2I( p0.x, p0.y + s.y ) );
}
break;
}
case SH_CONVEX:
{
const SHAPE_CONVEX* c = (const SHAPE_CONVEX*) m_shape;
std::deque<VECTOR2D> polygon = std::deque<VECTOR2D>();
for( int i = 0; i < c->PointCount(); i++ )
{
polygon.push_back( c->CDPoint( i ) );
}
aGal->DrawPolygon( polygon );
case SH_SEGMENT:
{
const SHAPE_SEGMENT* s = (const SHAPE_SEGMENT*) m_shape;
aGal->DrawSegment( s->GetSeg().A, s->GetSeg().B, s->GetWidth() );
if( m_clearance > 0 )
{
aGal->SetLayerDepth( ClearanceOverlayDepth );
aGal->SetStrokeColor( COLOR4D( DARKDARKGRAY ) );
aGal->SetIsStroke( true );
aGal->SetLineWidth( 2 * m_clearance );
// need the implicit last segment to be explicit for DrawPolyline
polygon.push_back( c->CDPoint( 0 ) );
aGal->DrawPolyline( polygon );
aGal->SetFillColor( COLOR4D( DARKDARKGRAY ) );
aGal->DrawSegment( s->GetSeg().A, s->GetSeg().B, s->GetWidth() + 2 * m_clearance );
}
break;
}
case SH_POLY_SET:
case SH_COMPOUND:
break; // Not yet in use
case SH_CIRCLE:
{
const SHAPE_CIRCLE* c = (const SHAPE_CIRCLE*) m_shape;
aGal->DrawCircle( c->GetCenter(), c->GetRadius() );
if( m_clearance > 0 )
{
aGal->SetLayerDepth( ClearanceOverlayDepth );
aGal->SetFillColor( COLOR4D( DARKDARKGRAY ) );
aGal->SetIsStroke( false );
aGal->DrawCircle( c->GetCenter(), c->GetRadius() + m_clearance );
}
break;
}
case SH_RECT:
{
const SHAPE_RECT* r = (const SHAPE_RECT*) m_shape;
aGal->DrawRectangle( r->GetPosition(), r->GetPosition() + r->GetSize() );
if( m_clearance > 0 )
{
aGal->SetLayerDepth( ClearanceOverlayDepth );
VECTOR2I p0( r->GetPosition() ), s( r->GetSize() );
aGal->SetStrokeColor( COLOR4D( DARKDARKGRAY ) );
aGal->SetIsStroke( true );
aGal->SetLineWidth( 2 * m_clearance );
aGal->DrawLine( p0, VECTOR2I( p0.x + s.x, p0.y ) );
aGal->DrawLine( p0, VECTOR2I( p0.x, p0.y + s.y ) );
aGal->DrawLine( p0 + s , VECTOR2I( p0.x + s.x, p0.y ) );
aGal->DrawLine( p0 + s, VECTOR2I( p0.x, p0.y + s.y ) );
}
break;
}
case SH_CONVEX:
{
const SHAPE_CONVEX* c = (const SHAPE_CONVEX*) m_shape;
std::deque<VECTOR2D> polygon = std::deque<VECTOR2D>();
for( int i = 0; i < c->PointCount(); i++ )
{
polygon.push_back( c->CDPoint( i ) );
}
aGal->DrawPolygon( polygon );
if( m_clearance > 0 )
{
aGal->SetLayerDepth( ClearanceOverlayDepth );
aGal->SetStrokeColor( COLOR4D( DARKDARKGRAY ) );
aGal->SetIsStroke( true );
aGal->SetLineWidth( 2 * m_clearance );
// need the implicit last segment to be explicit for DrawPolyline
polygon.push_back( c->CDPoint( 0 ) );
aGal->DrawPolyline( polygon );
}
break;
}
case SH_POLY_SET:
case SH_COMPOUND:
break; // Not yet in use
}
}
}

View File

@ -293,10 +293,10 @@ void ROUTER_TOOL::handleCommonEvents( const TOOL_EVENT& aEvent )
{
switch( aEvent.KeyCode() )
{
case '0':
TRACEn( 2, "saving drag/route log...\n" );
m_router->DumpLog();
break;
case '0':
TRACEn( 2, "saving drag/route log...\n" );
m_router->DumpLog();
break;
}
}
else
@ -435,37 +435,37 @@ bool ROUTER_TOOL::onViaCommand( VIATYPE_T aType )
switch( aType )
{
case VIA_THROUGH:
sizes.SetViaDiameter( bds.GetCurrentViaSize() );
sizes.SetViaDrill( bds.GetCurrentViaDrill() );
sizes.AddLayerPair( pairTop, pairBottom );
break;
case VIA_THROUGH:
sizes.SetViaDiameter( bds.GetCurrentViaSize() );
sizes.SetViaDrill( bds.GetCurrentViaDrill() );
sizes.AddLayerPair( pairTop, pairBottom );
break;
case VIA_MICROVIA:
sizes.SetViaDiameter( bds.GetCurrentMicroViaSize() );
sizes.SetViaDrill( bds.GetCurrentMicroViaDrill() );
case VIA_MICROVIA:
sizes.SetViaDiameter( bds.GetCurrentMicroViaSize() );
sizes.SetViaDrill( bds.GetCurrentMicroViaDrill() );
if( currentLayer == F_Cu || currentLayer == In1_Cu )
sizes.AddLayerPair( F_Cu, In1_Cu );
else if( currentLayer == B_Cu || currentLayer == layerCount - 2 )
sizes.AddLayerPair( B_Cu, layerCount - 2 );
else
wxASSERT( false );
break;
case VIA_BLIND_BURIED:
sizes.SetViaDiameter( bds.GetCurrentViaSize() );
sizes.SetViaDrill( bds.GetCurrentViaDrill() );
if( currentLayer == pairTop || currentLayer == pairBottom )
sizes.AddLayerPair( pairTop, pairBottom );
else
sizes.AddLayerPair( pairTop, currentLayer );
break;
default:
if( currentLayer == F_Cu || currentLayer == In1_Cu )
sizes.AddLayerPair( F_Cu, In1_Cu );
else if( currentLayer == B_Cu || currentLayer == layerCount - 2 )
sizes.AddLayerPair( B_Cu, layerCount - 2 );
else
wxASSERT( false );
break;
break;
case VIA_BLIND_BURIED:
sizes.SetViaDiameter( bds.GetCurrentViaSize() );
sizes.SetViaDrill( bds.GetCurrentViaDrill() );
if( currentLayer == pairTop || currentLayer == pairBottom )
sizes.AddLayerPair( pairTop, pairBottom );
else
sizes.AddLayerPair( pairTop, currentLayer );
break;
default:
wxASSERT( false );
break;
}
sizes.SetViaType( aType );