Commit 79a10860 authored by Garth Corral's avatar Garth Corral

Merge trunk @ 5288

parents c3a3ac9d 1dc51780
...@@ -192,7 +192,7 @@ int VRML1_MODEL_PARSER::readMaterial() ...@@ -192,7 +192,7 @@ int VRML1_MODEL_PARSER::readMaterial()
continue; continue;
} }
if( ( *text == '}' ) ) if( *text == '}' )
{ {
return 0; return 0;
} }
...@@ -240,7 +240,7 @@ int VRML1_MODEL_PARSER::readCoordinate3() ...@@ -240,7 +240,7 @@ int VRML1_MODEL_PARSER::readCoordinate3()
continue; continue;
} }
if( ( *text == '}' ) ) if( *text == '}' )
{ {
return 0; return 0;
} }
...@@ -268,7 +268,7 @@ int VRML1_MODEL_PARSER::readIndexedFaceSet() ...@@ -268,7 +268,7 @@ int VRML1_MODEL_PARSER::readIndexedFaceSet()
continue; continue;
} }
if( ( *text == '}' ) ) if( *text == '}' )
{ {
return 0; return 0;
} }
......
...@@ -145,7 +145,7 @@ int VRML2_MODEL_PARSER::read_Transform() ...@@ -145,7 +145,7 @@ int VRML2_MODEL_PARSER::read_Transform()
continue; continue;
} }
if( ( *text == '}' ) ) if( *text == '}' )
{ {
// DBG( printf( " } Exit Transform\n" ) ); // DBG( printf( " } Exit Transform\n" ) );
break; break;
...@@ -265,7 +265,7 @@ int VRML2_MODEL_PARSER::read_DEF() ...@@ -265,7 +265,7 @@ int VRML2_MODEL_PARSER::read_DEF()
continue; continue;
} }
if( ( *text == '}' ) ) if( *text == '}' )
{ {
// DBG( printf( " } Exit DEF\n") ); // DBG( printf( " } Exit DEF\n") );
return 0; return 0;
...@@ -321,7 +321,7 @@ int VRML2_MODEL_PARSER::read_Shape() ...@@ -321,7 +321,7 @@ int VRML2_MODEL_PARSER::read_Shape()
continue; continue;
} }
if( ( *text == '}' ) ) if( *text == '}' )
{ {
// DBG( printf( " } Exit Shape\n") ); // DBG( printf( " } Exit Shape\n") );
return 0; return 0;
...@@ -368,7 +368,7 @@ int VRML2_MODEL_PARSER::read_Appearance() ...@@ -368,7 +368,7 @@ int VRML2_MODEL_PARSER::read_Appearance()
continue; continue;
} }
if( ( *text == '}' ) ) if( *text == '}' )
{ {
return 0; return 0;
} }
...@@ -473,7 +473,7 @@ int VRML2_MODEL_PARSER::read_Material() ...@@ -473,7 +473,7 @@ int VRML2_MODEL_PARSER::read_Material()
continue; continue;
} }
if( ( *text == '}' ) ) if( *text == '}' )
{ {
return 0; return 0;
} }
...@@ -566,7 +566,7 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet() ...@@ -566,7 +566,7 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet()
continue; continue;
} }
if( ( *text == '}' ) ) if( *text == '}' )
{ {
// DBG( printf( " } Exit IndexedFaceSet\n") ); // DBG( printf( " } Exit IndexedFaceSet\n") );
return 0; return 0;
...@@ -749,7 +749,7 @@ int VRML2_MODEL_PARSER::read_Color() ...@@ -749,7 +749,7 @@ int VRML2_MODEL_PARSER::read_Color()
continue; continue;
} }
if( ( *text == '}' ) ) if( *text == '}' )
{ {
// DBG( printf( " m_DiffuseColor.size: %ld\n", m_model->m_Materials->m_DiffuseColor.size() ) ); // DBG( printf( " m_DiffuseColor.size: %ld\n", m_model->m_Materials->m_DiffuseColor.size() ) );
return 0; return 0;
...@@ -779,7 +779,7 @@ int VRML2_MODEL_PARSER::read_Normal() ...@@ -779,7 +779,7 @@ int VRML2_MODEL_PARSER::read_Normal()
continue; continue;
} }
if( ( *text == '}' ) ) if( *text == '}' )
{ {
// DBG( printf( " m_PerFaceNormalsNormalized.size: %lu\n", m_model->m_PerFaceNormalsNormalized.size() ) ); // DBG( printf( " m_PerFaceNormalsNormalized.size: %lu\n", m_model->m_PerFaceNormalsNormalized.size() ) );
return 0; return 0;
...@@ -817,7 +817,7 @@ int VRML2_MODEL_PARSER::read_Coordinate() ...@@ -817,7 +817,7 @@ int VRML2_MODEL_PARSER::read_Coordinate()
continue; continue;
} }
if( ( *text == '}' ) ) if( *text == '}' )
{ {
// DBG( printf( " m_Point.size: %lu\n", m_model->m_Point.size() ) ); // DBG( printf( " m_Point.size: %lu\n", m_model->m_Point.size() ) );
return 0; return 0;
......
...@@ -384,7 +384,9 @@ bool X3D_MODEL_PARSER::parseDoubleTriplet( const wxString& aData, ...@@ -384,7 +384,9 @@ bool X3D_MODEL_PARSER::parseDoubleTriplet( const wxString& aData,
{ {
wxStringTokenizer tokens( aData ); wxStringTokenizer tokens( aData );
double x, y, z; double x = 0;
double y = 0;
double z = 0;
bool ret = tokens.GetNextToken().ToDouble( &x ) bool ret = tokens.GetNextToken().ToDouble( &x )
&& tokens.GetNextToken().ToDouble( &y ) && tokens.GetNextToken().ToDouble( &y )
......
...@@ -98,7 +98,8 @@ bool STROKE_FONT::LoadNewStrokeFont( const char* const aNewStrokeFont[], int aNe ...@@ -98,7 +98,8 @@ bool STROKE_FONT::LoadNewStrokeFont( const char* const aNewStrokeFont[], int aNe
// Every coordinate description of the Hershey format has an offset, // Every coordinate description of the Hershey format has an offset,
// it has to be subtracted // it has to be subtracted
point.x = (double) ( coordinate[0] - 'R' ) * HERSHEY_SCALE - glyphStartX; point.x = (double) ( coordinate[0] - 'R' ) * HERSHEY_SCALE - glyphStartX;
point.y = (double) ( coordinate[1] - 'R' ) * HERSHEY_SCALE; // -10 is here to keep GAL rendering consistent with the legacy gfx stuff
point.y = (double) ( coordinate[1] - 'R' - 10) * HERSHEY_SCALE;
pointList.push_back( point ); pointList.push_back( point );
} }
...@@ -160,28 +161,44 @@ void STROKE_FONT::Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRo ...@@ -160,28 +161,44 @@ void STROKE_FONT::Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRo
m_gal->Rotate( -aRotationAngle ); m_gal->Rotate( -aRotationAngle );
// Single line height // Single line height
int lineHeight = getInterline(); int lineHeight = getInterline( );
int lineCount = linesCount( aText );
// The overall height of all lines of text
double textBlockHeight = lineHeight * ( linesCount( aText ) - 1 ); // align the 1st line of text
switch( m_verticalJustify ) switch( m_verticalJustify )
{ {
case GR_TEXT_VJUSTIFY_CENTER: case GR_TEXT_VJUSTIFY_TOP:
m_gal->Translate( VECTOR2D( 0, -textBlockHeight / 2.0 ) ); m_gal->Translate( VECTOR2D( 0, m_glyphSize.y ) );
break; break;
case GR_TEXT_VJUSTIFY_BOTTOM: case GR_TEXT_VJUSTIFY_CENTER:
m_gal->Translate( VECTOR2D( 0, -textBlockHeight ) ); m_gal->Translate( VECTOR2D( 0, m_glyphSize.y / 2.0 ) );
break; break;
case GR_TEXT_VJUSTIFY_TOP: case GR_TEXT_VJUSTIFY_BOTTOM:
break; break;
default: default:
break; break;
} }
if( lineCount > 1 )
{
switch( m_verticalJustify )
{
case GR_TEXT_VJUSTIFY_TOP:
break;
case GR_TEXT_VJUSTIFY_CENTER:
m_gal->Translate( VECTOR2D(0, -( lineCount - 1 ) * lineHeight / 2) );
break;
case GR_TEXT_VJUSTIFY_BOTTOM:
m_gal->Translate( VECTOR2D(0, -( lineCount - 1 ) * lineHeight ) );
break;
}
}
m_gal->SetIsStroke( true ); m_gal->SetIsStroke( true );
m_gal->SetIsFill( false ); m_gal->SetIsFill( false );
......
...@@ -175,7 +175,7 @@ static inline bool Collide( const SHAPE_CIRCLE& aA, const SHAPE_SEGMENT& aSeg, i ...@@ -175,7 +175,7 @@ static inline bool Collide( const SHAPE_CIRCLE& aA, const SHAPE_SEGMENT& aSeg, i
if( col && aNeedMTV ) if( col && aNeedMTV )
{ {
aMTV = pushoutForce( aA, aSeg.GetSeg(), aClearance + aSeg.GetWidth() / 2); aMTV = -pushoutForce( aA, aSeg.GetSeg(), aClearance + aSeg.GetWidth() / 2);
} }
return col; return col;
} }
...@@ -231,16 +231,28 @@ static inline bool Collide( const SHAPE_LINE_CHAIN& aA, const SHAPE_SEGMENT& aB, ...@@ -231,16 +231,28 @@ static inline bool Collide( const SHAPE_LINE_CHAIN& aA, const SHAPE_SEGMENT& aB,
} }
template<class ShapeAType, class ShapeBType> bool template<class ShapeAType, class ShapeBType>
CollCase( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV ) inline bool CollCase( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV )
{ {
return Collide (*static_cast<const ShapeAType*>( aA ), return Collide (*static_cast<const ShapeAType*>( aA ),
*static_cast<const ShapeBType*>( aB ), *static_cast<const ShapeBType*>( aB ),
aClearance, aNeedMTV, aMTV); aClearance, aNeedMTV, aMTV);
} }
bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV ) template<class ShapeAType, class ShapeBType>
inline bool CollCaseReversed ( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV )
{ {
bool rv = Collide (*static_cast<const ShapeBType*>( aB ),
*static_cast<const ShapeAType*>( aA ),
aClearance, aNeedMTV, aMTV);
if(rv && aNeedMTV)
aMTV = -aMTV;
return rv;
}
bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV )
{
switch( aA->Type() ) switch( aA->Type() )
{ {
case SH_RECT: case SH_RECT:
...@@ -263,8 +275,8 @@ bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeed ...@@ -263,8 +275,8 @@ bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeed
switch( aB->Type() ) switch( aB->Type() )
{ {
case SH_RECT: case SH_RECT:
return CollCase<SHAPE_RECT, SHAPE_CIRCLE>( aB, aA, aClearance, aNeedMTV, aMTV ); return CollCaseReversed<SHAPE_CIRCLE, SHAPE_RECT>( aA, aB, aClearance, aNeedMTV, aMTV );
case SH_CIRCLE: case SH_CIRCLE:
return CollCase<SHAPE_CIRCLE, SHAPE_CIRCLE>( aA, aB, aClearance, aNeedMTV, aMTV ); return CollCase<SHAPE_CIRCLE, SHAPE_CIRCLE>( aA, aB, aClearance, aNeedMTV, aMTV );
...@@ -272,8 +284,9 @@ bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeed ...@@ -272,8 +284,9 @@ bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeed
return CollCase<SHAPE_CIRCLE, SHAPE_LINE_CHAIN>( aA, aB, aClearance, aNeedMTV, aMTV ); return CollCase<SHAPE_CIRCLE, SHAPE_LINE_CHAIN>( aA, aB, aClearance, aNeedMTV, aMTV );
case SH_SEGMENT: case SH_SEGMENT:
return CollCase<SHAPE_CIRCLE, SHAPE_SEGMENT>( aA, aB, aClearance, aNeedMTV, aMTV ); return CollCase<SHAPE_CIRCLE, SHAPE_SEGMENT>( aA, aB, aClearance, aNeedMTV, aMTV );
default:
default:
break; break;
} }
...@@ -303,7 +316,7 @@ bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeed ...@@ -303,7 +316,7 @@ bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeed
return CollCase<SHAPE_RECT, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV ); return CollCase<SHAPE_RECT, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV );
case SH_CIRCLE: case SH_CIRCLE:
return CollCase<SHAPE_CIRCLE, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV ); return CollCaseReversed<SHAPE_SEGMENT, SHAPE_CIRCLE>( aA, aB, aClearance, aNeedMTV, aMTV );
case SH_LINE_CHAIN: case SH_LINE_CHAIN:
return CollCase<SHAPE_LINE_CHAIN, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV ); return CollCase<SHAPE_LINE_CHAIN, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV );
......
...@@ -29,16 +29,15 @@ using boost::optional; ...@@ -29,16 +29,15 @@ using boost::optional;
bool SHAPE_LINE_CHAIN::Collide( const VECTOR2I& aP, int aClearance ) const bool SHAPE_LINE_CHAIN::Collide( const VECTOR2I& aP, int aClearance ) const
{ {
assert( false ); // fixme: ugly!
SEG s( aP, aP );
return false; return this->Collide( s, aClearance );
} }
bool SHAPE_LINE_CHAIN::Collide( const BOX2I& aBox, int aClearance ) const bool SHAPE_LINE_CHAIN::Collide( const BOX2I& aBox, int aClearance ) const
{ {
assert( false ); assert( false );
return false; return false;
} }
...@@ -150,10 +149,7 @@ int SHAPE_LINE_CHAIN::Split( const VECTOR2I& aP ) ...@@ -150,10 +149,7 @@ int SHAPE_LINE_CHAIN::Split( const VECTOR2I& aP )
int ii = -1; int ii = -1;
int min_dist = 2; int min_dist = 2;
ii = Find( aP ); int found_index = Find( aP );
if( ii >= 0 )
return ii;
for( int s = 0; s < SegmentCount(); s++ ) for( int s = 0; s < SegmentCount(); s++ )
{ {
...@@ -165,10 +161,16 @@ int SHAPE_LINE_CHAIN::Split( const VECTOR2I& aP ) ...@@ -165,10 +161,16 @@ int SHAPE_LINE_CHAIN::Split( const VECTOR2I& aP )
if( dist < min_dist && seg.A != aP && seg.B != aP ) if( dist < min_dist && seg.A != aP && seg.B != aP )
{ {
min_dist = dist; min_dist = dist;
ii = s; if( found_index < 0 )
ii = s;
else if( s < found_index )
ii = s;
} }
} }
if( ii < 0 )
ii = found_index;
if( ii >= 0 ) if( ii >= 0 )
{ {
m_points.insert( m_points.begin() + ii + 1, aP ); m_points.insert( m_points.begin() + ii + 1, aP );
...@@ -519,25 +521,27 @@ const std::string SHAPE_LINE_CHAIN::Format() const ...@@ -519,25 +521,27 @@ const std::string SHAPE_LINE_CHAIN::Format() const
bool SHAPE_LINE_CHAIN::CompareGeometry ( const SHAPE_LINE_CHAIN & aOther ) const bool SHAPE_LINE_CHAIN::CompareGeometry ( const SHAPE_LINE_CHAIN & aOther ) const
{ {
SHAPE_LINE_CHAIN a(*this), b(aOther); SHAPE_LINE_CHAIN a(*this), b( aOther );
a.Simplify(); a.Simplify();
b.Simplify(); b.Simplify();
if(a.m_points.size() != b.m_points.size()) if( a.m_points.size() != b.m_points.size() )
return false; return false;
for(int i = 0; i < a.PointCount(); i++) for( int i = 0; i < a.PointCount(); i++)
if(a.CPoint(i) != b.CPoint(i)) if( a.CPoint( i ) != b.CPoint( i ) )
return false; return false;
return true; return true;
} }
bool SHAPE_LINE_CHAIN::Intersects( const SHAPE_LINE_CHAIN& aChain ) const bool SHAPE_LINE_CHAIN::Intersects( const SHAPE_LINE_CHAIN& aChain ) const
{ {
INTERSECTIONS dummy; INTERSECTIONS dummy;
return Intersect(aChain, dummy) != 0; return Intersect( aChain, dummy ) != 0;
} }
SHAPE* SHAPE_LINE_CHAIN::Clone() const SHAPE* SHAPE_LINE_CHAIN::Clone() const
{ {
return new SHAPE_LINE_CHAIN( *this ); return new SHAPE_LINE_CHAIN( *this );
......
...@@ -557,12 +557,12 @@ void LIB_ARC::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -557,12 +557,12 @@ void LIB_ARC::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
msg = StringFromValue( g_UserUnit, m_Width, true ); msg = StringFromValue( g_UserUnit, m_Width, true );
aList.push_back( MSG_PANEL_ITEM( _( "Line width" ), msg, BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x, msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x,
bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y ); bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y );
aList.push_back( MSG_PANEL_ITEM( _( "Bounding box" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Bounding Box" ), msg, BROWN ) );
} }
......
...@@ -413,10 +413,10 @@ void LIB_BEZIER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -413,10 +413,10 @@ void LIB_BEZIER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
msg = StringFromValue( g_UserUnit, m_Width, true ); msg = StringFromValue( g_UserUnit, m_Width, true );
aList.push_back( MSG_PANEL_ITEM( _( "Line width" ), msg, BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x, msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x,
bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y ); bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y );
aList.push_back( MSG_PANEL_ITEM( _( "Bounding box" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Bounding Box" ), msg, BROWN ) );
} }
...@@ -272,7 +272,7 @@ void LIB_CIRCLE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) ...@@ -272,7 +272,7 @@ void LIB_CIRCLE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
msg = StringFromValue( g_UserUnit, m_Width, true ); msg = StringFromValue( g_UserUnit, m_Width, true );
aList.push_back( MSG_PANEL_ITEM( _( "Line width" ), msg, BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
msg = StringFromValue( g_UserUnit, m_Radius, true ); msg = StringFromValue( g_UserUnit, m_Radius, true );
aList.push_back( MSG_PANEL_ITEM( _( "Radius" ), msg, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "Radius" ), msg, RED ) );
...@@ -280,7 +280,7 @@ void LIB_CIRCLE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) ...@@ -280,7 +280,7 @@ void LIB_CIRCLE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x, msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x,
bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y ); bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y );
aList.push_back( MSG_PANEL_ITEM( _( "Bounding box" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Bounding Box" ), msg, BROWN ) );
} }
......
...@@ -753,10 +753,10 @@ void LIB_FIELD::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) ...@@ -753,10 +753,10 @@ void LIB_FIELD::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), msg, MAGENTA ) ); aList.push_back( MSG_PANEL_ITEM( _( "Style" ), msg, MAGENTA ) );
msg = StringFromValue( g_UserUnit, m_Size.x, true ); msg = StringFromValue( g_UserUnit, m_Size.x, true );
aList.push_back( MSG_PANEL_ITEM( _( "Size X" ), msg, BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, BLUE ) );
msg = StringFromValue( g_UserUnit, m_Size.y, true ); msg = StringFromValue( g_UserUnit, m_Size.y, true );
aList.push_back( MSG_PANEL_ITEM( _( "Size Y" ), msg, BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, BLUE ) );
// Display field name (ref, value ...) // Display field name (ref, value ...)
msg = GetName(); msg = GetName();
......
...@@ -402,12 +402,12 @@ void LIB_POLYLINE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) ...@@ -402,12 +402,12 @@ void LIB_POLYLINE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
msg = StringFromValue( g_UserUnit, m_Width, true ); msg = StringFromValue( g_UserUnit, m_Width, true );
aList.push_back( MSG_PANEL_ITEM( _( "Line width" ), msg, BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x, msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x,
bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y ); bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y );
aList.push_back( MSG_PANEL_ITEM( _( "Bounding box" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Bounding Box" ), msg, BROWN ) );
} }
......
...@@ -252,7 +252,7 @@ void LIB_RECTANGLE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) ...@@ -252,7 +252,7 @@ void LIB_RECTANGLE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
msg = StringFromValue( g_UserUnit, m_Width, true ); msg = StringFromValue( g_UserUnit, m_Width, true );
aList.push_back( MSG_PANEL_ITEM( _( "Line width" ), msg, BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
} }
......
...@@ -420,7 +420,7 @@ void LIB_TEXT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) ...@@ -420,7 +420,7 @@ void LIB_TEXT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
msg = StringFromValue( g_UserUnit, m_Thickness, true ); msg = StringFromValue( g_UserUnit, m_Thickness, true );
aList.push_back( MSG_PANEL_ITEM( _( "Line width" ), msg, BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
} }
......
...@@ -1516,7 +1516,7 @@ void SCH_COMPONENT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) ...@@ -1516,7 +1516,7 @@ void SCH_COMPONENT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
// Display description of the component, and keywords found in lib // Display description of the component, and keywords found in lib
aList.push_back( MSG_PANEL_ITEM( _( "Description" ), alias->GetDescription(), DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Description" ), alias->GetDescription(), DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Key words" ), alias->GetKeyWords(), DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Key Words" ), alias->GetKeyWords(), DARKCYAN ) );
} }
} }
......
...@@ -161,7 +161,7 @@ void SCH_MARKER::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) ...@@ -161,7 +161,7 @@ void SCH_MARKER::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
{ {
wxString msg; wxString msg;
aList.push_back( MSG_PANEL_ITEM( _( "Electronics rule check error" ), aList.push_back( MSG_PANEL_ITEM( _( "Electronics Rule Check Error" ),
GetReporter().GetErrorText(), DARKRED ) ); GetReporter().GetErrorText(), DARKRED ) );
} }
......
...@@ -825,8 +825,8 @@ wxString SCH_SHEET::GetFileName( void ) const ...@@ -825,8 +825,8 @@ wxString SCH_SHEET::GetFileName( void ) const
void SCH_SHEET::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) void SCH_SHEET::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
{ {
aList.push_back( MSG_PANEL_ITEM( _( "Sheet name" ), m_name, CYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Sheet Name" ), m_name, CYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "File name" ), m_fileName, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "File Name" ), m_fileName, BROWN ) );
#if 0 // Set to 1 to display the sheet time stamp (mainly for test) #if 0 // Set to 1 to display the sheet time stamp (mainly for test)
wxString msg; wxString msg;
......
...@@ -708,7 +708,7 @@ void SCH_TEXT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) ...@@ -708,7 +708,7 @@ void SCH_TEXT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
switch( Type() ) switch( Type() )
{ {
case SCH_TEXT_T: case SCH_TEXT_T:
msg = _( "Graphic text" ); msg = _( "Graphic Text" );
break; break;
case SCH_LABEL_T: case SCH_LABEL_T:
...@@ -716,11 +716,11 @@ void SCH_TEXT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) ...@@ -716,11 +716,11 @@ void SCH_TEXT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
break; break;
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
msg = _( "Global label" ); msg = _( "Global Label" );
break; break;
case SCH_HIERARCHICAL_LABEL_T: case SCH_HIERARCHICAL_LABEL_T:
msg = _( "Hierarchical label" ); msg = _( "Hierarchical Label" );
break; break;
case SCH_SHEET_PIN_T: case SCH_SHEET_PIN_T:
...@@ -767,7 +767,7 @@ void SCH_TEXT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) ...@@ -767,7 +767,7 @@ void SCH_TEXT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
if( m_Bold ) if( m_Bold )
style += 2; style += 2;
aList.push_back( MSG_PANEL_ITEM( _("Style"), textStyle[style], BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Style" ), textStyle[style], BROWN ) );
// Display electricat type if it is relevant // Display electricat type if it is relevant
......
...@@ -553,7 +553,7 @@ void GERBER_DRAW_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -553,7 +553,7 @@ void GERBER_DRAW_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
// Display graphic layer number // Display graphic layer number
msg.Printf( wxT( "%d" ), GetLayer() + 1 ); msg.Printf( wxT( "%d" ), GetLayer() + 1 );
aList.push_back( MSG_PANEL_ITEM( _( "Graphic layer" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Graphic Layer" ), msg, BROWN ) );
// Display item rotation // Display item rotation
// The full rotation is Image rotation + m_lyrRotation // The full rotation is Image rotation + m_lyrRotation
......
...@@ -52,7 +52,7 @@ public: ...@@ -52,7 +52,7 @@ public:
/** Default constructor /** Default constructor
* Creates an empty (0, 0) segment, locally-referenced * Creates an empty (0, 0) segment, locally-referenced
*/ */
SEG() SEG()
{ {
m_index = -1; m_index = -1;
} }
...@@ -61,8 +61,8 @@ public: ...@@ -61,8 +61,8 @@ public:
* Constructor * Constructor
* Creates a segment between (aX1, aY1) and (aX2, aY2), locally referenced * Creates a segment between (aX1, aY1) and (aX2, aY2), locally referenced
*/ */
SEG( int aX1, int aY1, int aX2, int aY2 ) : SEG( int aX1, int aY1, int aX2, int aY2 ) :
A ( VECTOR2I( aX1, aY1 ) ), A ( VECTOR2I( aX1, aY1 ) ),
B ( VECTOR2I( aX2, aY2 ) ) B ( VECTOR2I( aX2, aY2 ) )
{ {
m_index = -1; m_index = -1;
...@@ -84,7 +84,7 @@ public: ...@@ -84,7 +84,7 @@ public:
* @param aB reference to the end point in the parent shape * @param aB reference to the end point in the parent shape
* @param aIndex index of the segment within the parent shape * @param aIndex index of the segment within the parent shape
*/ */
SEG ( const VECTOR2I& aA, const VECTOR2I& aB, int aIndex ) : A( aA ), B( aB ) SEG( const VECTOR2I& aA, const VECTOR2I& aB, int aIndex ) : A( aA ), B( aB )
{ {
m_index = aIndex; m_index = aIndex;
} }
...@@ -92,7 +92,7 @@ public: ...@@ -92,7 +92,7 @@ public:
/** /**
* Copy constructor * Copy constructor
*/ */
SEG ( const SEG& aSeg ) : A( aSeg.A ), B( aSeg.B ), m_index ( aSeg.m_index ) SEG( const SEG& aSeg ) : A( aSeg.A ), B( aSeg.B ), m_index( aSeg.m_index )
{ {
} }
...@@ -101,7 +101,7 @@ public: ...@@ -101,7 +101,7 @@ public:
A = aSeg.A; A = aSeg.A;
B = aSeg.B; B = aSeg.B;
m_index = aSeg.m_index; m_index = aSeg.m_index;
return *this; return *this;
} }
...@@ -215,14 +215,35 @@ public: ...@@ -215,14 +215,35 @@ public:
*/ */
bool Collinear( const SEG& aSeg ) const bool Collinear( const SEG& aSeg ) const
{ {
ecoord qa1 = A.y - B.y; ecoord qa = A.y - B.y;
ecoord qb1 = B.x - A.x; ecoord qb = B.x - A.x;
ecoord qc1 = -qa1 * A.x - qb1 * A.y; ecoord qc = -qa * A.x - qb * A.y;
ecoord qa2 = aSeg.A.y - aSeg.B.y;
ecoord qb2 = aSeg.B.x - aSeg.A.x; ecoord d1 = std::abs( aSeg.A.x * qa + aSeg.A.y * qb + qc );
ecoord qc2 = -qa2 * aSeg.A.x - qb2 * aSeg.A.y; ecoord d2 = std::abs( aSeg.B.x * qa + aSeg.B.y * qb + qc );
return ( qa1 == qa2 ) && ( qb1 == qb2 ) && ( qc1 == qc2 ); return ( d1 <= 1 && d2 <= 1 );
}
bool Overlaps( const SEG& aSeg ) const
{
if( aSeg.A == aSeg.B ) // single point corner case
{
if( A == aSeg.A || B == aSeg.A )
return false;
return Contains( aSeg.A );
}
if( !Collinear( aSeg ) )
return false;
if( Contains( aSeg.A ) || Contains( aSeg.B ) )
return true;
if( aSeg.Contains( A ) || aSeg.Contains( B ) )
return true;
return false;
} }
/** /**
......
...@@ -40,7 +40,10 @@ enum SHAPE_TYPE ...@@ -40,7 +40,10 @@ enum SHAPE_TYPE
SH_RECT = 0, ///> axis-aligned rectangle SH_RECT = 0, ///> axis-aligned rectangle
SH_SEGMENT, ///> line segment SH_SEGMENT, ///> line segment
SH_LINE_CHAIN, ///> line chain (polyline) SH_LINE_CHAIN, ///> line chain (polyline)
SH_CIRCLE ///> circle SH_CIRCLE, ///> circle
SH_CONVEX, ///> convex polygon
SH_POLYGON, ///> any polygon (with holes, etc.)
SH_COMPOUND ///> compound shape, consisting of multiple simple shapes
}; };
/** /**
...@@ -60,7 +63,7 @@ public: ...@@ -60,7 +63,7 @@ public:
* Creates an empty shape of type aType * Creates an empty shape of type aType
*/ */
SHAPE ( SHAPE_TYPE aType ) : m_type( aType ) SHAPE( SHAPE_TYPE aType ) : m_type( aType )
{} {}
// Destructor // Destructor
...@@ -146,7 +149,11 @@ public: ...@@ -146,7 +149,11 @@ public:
return BBox( 0 ).Centre(); // if nothing better is available.... return BBox( 0 ).Centre(); // if nothing better is available....
} }
private: virtual void Move ( const VECTOR2I& aVector ) = 0;
virtual bool IsSolid() const = 0;
protected:
///> type of our shape ///> type of our shape
SHAPE_TYPE m_type; SHAPE_TYPE m_type;
}; };
......
...@@ -38,7 +38,7 @@ public: ...@@ -38,7 +38,7 @@ public:
SHAPE( SH_CIRCLE ), m_radius( aRadius ), m_center( aCenter ) SHAPE( SH_CIRCLE ), m_radius( aRadius ), m_center( aCenter )
{} {}
SHAPE_CIRCLE ( const SHAPE_CIRCLE& aOther ) : SHAPE_CIRCLE( const SHAPE_CIRCLE& aOther ) :
SHAPE( SH_CIRCLE ), SHAPE( SH_CIRCLE ),
m_radius( aOther.m_radius ), m_radius( aOther.m_radius ),
m_center( aOther.m_center ) m_center( aOther.m_center )
...@@ -86,6 +86,15 @@ public: ...@@ -86,6 +86,15 @@ public:
return m_center; return m_center;
} }
void Move( const VECTOR2I& aVector )
{
m_center += aVector;
}
bool IsSolid() const
{
return true;
}
private: private:
int m_radius; int m_radius;
VECTOR2I m_center; VECTOR2I m_center;
......
...@@ -103,7 +103,18 @@ public: ...@@ -103,7 +103,18 @@ public:
m_points[2] = aC; m_points[2] = aC;
} }
SHAPE_LINE_CHAIN(const VECTOR2I* aV, int aCount ) : SHAPE_LINE_CHAIN( const VECTOR2I& aA, const VECTOR2I& aB, const VECTOR2I& aC, const VECTOR2I& aD ) :
SHAPE( SH_LINE_CHAIN ), m_closed( false )
{
m_points.resize( 4 );
m_points[0] = aA;
m_points[1] = aB;
m_points[2] = aC;
m_points[3] = aD;
}
SHAPE_LINE_CHAIN( const VECTOR2I* aV, int aCount ) :
SHAPE( SH_LINE_CHAIN ), SHAPE( SH_LINE_CHAIN ),
m_closed( false ) m_closed( false )
{ {
...@@ -553,6 +564,16 @@ public: ...@@ -553,6 +564,16 @@ public:
bool CompareGeometry( const SHAPE_LINE_CHAIN & aOther ) const; bool CompareGeometry( const SHAPE_LINE_CHAIN & aOther ) const;
void Move( const VECTOR2I& aVector )
{
for( std::vector<VECTOR2I>::iterator i = m_points.begin(); i != m_points.end(); ++i )
(*i) += aVector;
}
bool IsSolid() const
{
return false;
}
private: private:
/// array of vertices /// array of vertices
std::vector<VECTOR2I> m_points; std::vector<VECTOR2I> m_points;
......
...@@ -57,7 +57,7 @@ public: ...@@ -57,7 +57,7 @@ public:
SHAPE( SH_RECT ), m_p0( aP0 ), m_w( aW ), m_h( aH ) SHAPE( SH_RECT ), m_p0( aP0 ), m_w( aW ), m_h( aH )
{} {}
SHAPE_RECT ( const SHAPE_RECT& aOther ) : SHAPE_RECT( const SHAPE_RECT& aOther ) :
SHAPE( SH_RECT ), SHAPE( SH_RECT ),
m_p0( aOther.m_p0 ), m_p0( aOther.m_p0 ),
m_w( aOther.m_w ), m_w( aOther.m_w ),
...@@ -159,6 +159,16 @@ public: ...@@ -159,6 +159,16 @@ public:
return m_h; return m_h;
} }
void Move( const VECTOR2I& aVector )
{
m_p0 += aVector;
}
bool IsSolid() const
{
return true;
}
private: private:
///> Top-left corner ///> Top-left corner
VECTOR2I m_p0; VECTOR2I m_p0;
......
...@@ -31,60 +31,71 @@ ...@@ -31,60 +31,71 @@
class SHAPE_SEGMENT : public SHAPE { class SHAPE_SEGMENT : public SHAPE {
public: public:
SHAPE_SEGMENT(): SHAPE_SEGMENT():
SHAPE( SH_SEGMENT ), m_width( 0 ) {}; SHAPE( SH_SEGMENT ), m_width( 0 ) {};
SHAPE_SEGMENT( const VECTOR2I& aA, const VECTOR2I& aB, int aWidth = 0 ):
SHAPE( SH_SEGMENT ), m_seg( aA, aB ), m_width( aWidth ) {};
SHAPE_SEGMENT( const SEG& aSeg, int aWidth = 0 ): SHAPE_SEGMENT( const VECTOR2I& aA, const VECTOR2I& aB, int aWidth = 0 ):
SHAPE( SH_SEGMENT ), m_seg( aSeg ), m_width( aWidth ) {}; SHAPE( SH_SEGMENT ), m_seg( aA, aB ), m_width( aWidth ) {};
~SHAPE_SEGMENT() {}; SHAPE_SEGMENT( const SEG& aSeg, int aWidth = 0 ):
SHAPE( SH_SEGMENT ), m_seg( aSeg ), m_width( aWidth ) {};
~SHAPE_SEGMENT() {};
SHAPE* Clone() const SHAPE* Clone() const
{ {
return new SHAPE_SEGMENT( m_seg, m_width ); return new SHAPE_SEGMENT( m_seg, m_width );
} }
const BOX2I BBox( int aClearance = 0 ) const const BOX2I BBox( int aClearance = 0 ) const
{ {
return BOX2I( m_seg.A, m_seg.B - m_seg.A ).Inflate( aClearance + m_width / 2 ); return BOX2I( m_seg.A, m_seg.B - m_seg.A ).Inflate( aClearance + m_width / 2 );
} }
bool Collide( const SEG& aSeg, int aClearance = 0 ) const bool Collide( const SEG& aSeg, int aClearance = 0 ) const
{ {
return m_seg.Distance( aSeg ) <= m_width / 2 + aClearance; return m_seg.Distance( aSeg ) <= m_width / 2 + aClearance;
} }
bool Collide( const VECTOR2I& aP, int aClearance = 0 ) const bool Collide( const VECTOR2I& aP, int aClearance = 0 ) const
{ {
return m_seg.Distance( aP ) <= m_width / 2 + aClearance; return m_seg.Distance( aP ) <= m_width / 2 + aClearance;
} }
void SetSeg ( const SEG& aSeg ) void SetSeg( const SEG& aSeg )
{ {
m_seg = aSeg; m_seg = aSeg;
} }
const SEG& GetSeg () const const SEG& GetSeg() const
{ {
return m_seg; return m_seg;
} }
void SetWidth ( int aWidth ) void SetWidth( int aWidth )
{ {
m_width = aWidth; m_width = aWidth;
} }
int GetWidth() const int GetWidth() const
{ {
return m_width; return m_width;
} }
bool IsSolid() const
{
return true;
}
void Move( const VECTOR2I& aVector )
{
m_seg.A += aVector;
m_seg.B += aVector;
}
private: private:
SEG m_seg; SEG m_seg;
int m_width; int m_width;
}; };
#endif #endif
...@@ -250,7 +250,7 @@ struct KIFACE ...@@ -250,7 +250,7 @@ struct KIFACE
*/ */
class KIWAY : public wxEvtHandler class KIWAY : public wxEvtHandler
{ {
friend class PGM_SINGLE_TOP; // can use set_kiface() friend struct PGM_SINGLE_TOP; // can use set_kiface()
public: public:
/// Known KIFACE implementations /// Known KIFACE implementations
......
...@@ -75,7 +75,7 @@ namespace PCB { struct IFACE; } // KIFACE_I is in pcbnew.cpp ...@@ -75,7 +75,7 @@ namespace PCB { struct IFACE; } // KIFACE_I is in pcbnew.cpp
*/ */
class PCB_EDIT_FRAME : public PCB_BASE_EDIT_FRAME class PCB_EDIT_FRAME : public PCB_BASE_EDIT_FRAME
{ {
friend class PCB::IFACE; friend struct PCB::IFACE;
friend class PCB_LAYER_WIDGET; friend class PCB_LAYER_WIDGET;
void updateTraceWidthSelectBox(); void updateTraceWidthSelectBox();
......
...@@ -920,7 +920,7 @@ void BOARD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -920,7 +920,7 @@ void BOARD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Vias" ), txt, DARKGREEN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Vias" ), txt, DARKGREEN ) );
txt.Printf( wxT( "%d" ), trackSegmentsCount ); txt.Printf( wxT( "%d" ), trackSegmentsCount );
aList.push_back( MSG_PANEL_ITEM( _( "trackSegm" ), txt, DARKGREEN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Track Segments" ), txt, DARKGREEN ) );
txt.Printf( wxT( "%d" ), GetNodesCount() ); txt.Printf( wxT( "%d" ), GetNodesCount() );
aList.push_back( MSG_PANEL_ITEM( _( "Nodes" ), txt, DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Nodes" ), txt, DARKCYAN ) );
...@@ -937,7 +937,7 @@ void BOARD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -937,7 +937,7 @@ void BOARD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Links" ), txt, DARKGREEN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Links" ), txt, DARKGREEN ) );
txt.Printf( wxT( "%d" ), GetRatsnestsCount() - GetUnconnectedNetCount() ); txt.Printf( wxT( "%d" ), GetRatsnestsCount() - GetUnconnectedNetCount() );
aList.push_back( MSG_PANEL_ITEM( _( "Connect" ), txt, DARKGREEN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Connections" ), txt, DARKGREEN ) );
txt.Printf( wxT( "%d" ), GetUnconnectedNetCount() ); txt.Printf( wxT( "%d" ), GetUnconnectedNetCount() );
aList.push_back( MSG_PANEL_ITEM( _( "Unconnected" ), txt, BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Unconnected" ), txt, BLUE ) );
......
This diff is collapsed.
...@@ -280,17 +280,15 @@ void EDGE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -280,17 +280,15 @@ void EDGE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
if( !board ) if( !board )
return; return;
aList.push_back( MSG_PANEL_ITEM( _( "Graphic Item" ), wxEmptyString, DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), module->GetReference(), DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Module" ), module->GetReference(), DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Value" ), module->GetValue(), BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Value" ), module->GetValue(), BLUE ) );
msg.Printf( wxT( "%8.8lX" ), module->GetTimeStamp() ); msg.Printf( wxT( "%8.8lX" ), module->GetTimeStamp() );
aList.push_back( MSG_PANEL_ITEM( _( "TimeStamp" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "TimeStamp" ), msg, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Mod Layer" ), aList.push_back( MSG_PANEL_ITEM( _( "Footprint Layer" ),
module->GetLayerName(), RED ) ); module->GetLayerName(), RED ) );
aList.push_back( MSG_PANEL_ITEM( _( "Seg Layer" ),
GetLayerName(), RED ) ); // append the features shared with the base class
msg = ::CoordinateToString( m_Width ); DRAWSEGMENT::GetMsgPanelInfo( aList );
aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, BLUE ) );
} }
...@@ -313,8 +311,7 @@ EDA_ITEM* EDGE_MODULE::Clone() const ...@@ -313,8 +311,7 @@ EDA_ITEM* EDGE_MODULE::Clone() const
} }
void EDGE_MODULE::Flip( const wxPoint& aCentre )
void EDGE_MODULE::Flip(const wxPoint& aCentre )
{ {
wxPoint pt; wxPoint pt;
......
...@@ -242,21 +242,21 @@ void MODULE::Copy( MODULE* aModule ) ...@@ -242,21 +242,21 @@ void MODULE::Copy( MODULE* aModule )
switch( item->Type() ) switch( item->Type() )
{ {
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
{ {
TEXTE_MODULE* textm = new TEXTE_MODULE( this ); TEXTE_MODULE* textm = new TEXTE_MODULE( this );
textm->Copy( static_cast<TEXTE_MODULE*>( item ) ); textm->Copy( static_cast<TEXTE_MODULE*>( item ) );
m_Drawings.PushBack( textm ); m_Drawings.PushBack( textm );
break; break;
} }
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
{ {
EDGE_MODULE * edge; EDGE_MODULE * edge;
edge = new EDGE_MODULE( this ); edge = new EDGE_MODULE( this );
edge->Copy( (EDGE_MODULE*) item ); edge->Copy( (EDGE_MODULE*) item );
m_Drawings.PushBack( edge ); m_Drawings.PushBack( edge );
break; break;
} }
default: default:
wxLogMessage( wxT( "MODULE::Copy() Internal Err: unknown type" ) ); wxLogMessage( wxT( "MODULE::Copy() Internal Err: unknown type" ) );
...@@ -322,14 +322,14 @@ void MODULE::Add( BOARD_ITEM* aBoardItem, bool doAppend ) ...@@ -322,14 +322,14 @@ void MODULE::Add( BOARD_ITEM* aBoardItem, bool doAppend )
break; break;
default: default:
{ {
wxString msg; wxString msg;
msg.Printf( wxT( "MODULE::Add() needs work: BOARD_ITEM type (%d) not handled" ), msg.Printf( wxT( "MODULE::Add() needs work: BOARD_ITEM type (%d) not handled" ),
aBoardItem->Type() ); aBoardItem->Type() );
wxFAIL_MSG( msg ); wxFAIL_MSG( msg );
return; return;
} }
} }
aBoardItem->SetParent( this ); aBoardItem->SetParent( this );
...@@ -353,12 +353,12 @@ BOARD_ITEM* MODULE::Remove( BOARD_ITEM* aBoardItem ) ...@@ -353,12 +353,12 @@ BOARD_ITEM* MODULE::Remove( BOARD_ITEM* aBoardItem )
return m_Pads.Remove( static_cast<D_PAD*>( aBoardItem ) ); return m_Pads.Remove( static_cast<D_PAD*>( aBoardItem ) );
default: default:
{ {
wxString msg; wxString msg;
msg.Printf( wxT( "MODULE::Remove() needs work: BOARD_ITEM type (%d) not handled" ), msg.Printf( wxT( "MODULE::Remove() needs work: BOARD_ITEM type (%d) not handled" ),
aBoardItem->Type() ); aBoardItem->Type() );
wxFAIL_MSG( msg ); wxFAIL_MSG( msg );
} }
} }
return NULL; return NULL;
...@@ -552,7 +552,7 @@ void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -552,7 +552,7 @@ void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Last Change" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Last Change" ), msg, BROWN ) );
// display schematic path // display schematic path
aList.push_back( MSG_PANEL_ITEM( _( "Netlist path" ), m_Path, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Netlist Path" ), m_Path, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), RED ) );
...@@ -576,32 +576,32 @@ void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -576,32 +576,32 @@ void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
if( m_ModuleStatus & MODULE_is_PLACED ) if( m_ModuleStatus & MODULE_is_PLACED )
msg[1] = 'P'; msg[1] = 'P';
aList.push_back( MSG_PANEL_ITEM( _( "Stat" ), msg, MAGENTA ) ); aList.push_back( MSG_PANEL_ITEM( _( "Status" ), msg, MAGENTA ) );
msg.Printf( wxT( "%.1f" ), m_Orient / 10.0 ); msg.Printf( wxT( "%.1f" ), m_Orient / 10.0 );
aList.push_back( MSG_PANEL_ITEM( _( "Orient" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, BROWN ) );
// Controls on right side of the dialog // Controls on right side of the dialog
switch( m_Attributs & 255 ) switch( m_Attributs & 255 )
{ {
case 0: case 0:
msg = _("Normal"); msg = _( "Normal" );
break; break;
case MOD_CMS: case MOD_CMS:
msg = _("Insert"); msg = _( "Insert" );
break; break;
case MOD_VIRTUAL: case MOD_VIRTUAL:
msg = _("Virtual"); msg = _( "Virtual" );
break; break;
default: default:
msg = wxT("???"); msg = wxT( "???" );
break; break;
} }
aList.push_back( MSG_PANEL_ITEM( _( "Attrib" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Attributes" ), msg, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), FROM_UTF8( m_fpid.Format().c_str() ), BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), FROM_UTF8( m_fpid.Format().c_str() ), BLUE ) );
msg = _( "No 3D shape" ); msg = _( "No 3D shape" );
...@@ -619,7 +619,7 @@ void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -619,7 +619,7 @@ void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
wxString doc, keyword; wxString doc, keyword;
doc.Printf( _( "Doc: %s" ), GetChars( m_Doc ) ); doc.Printf( _( "Doc: %s" ), GetChars( m_Doc ) );
keyword.Printf( _( "KeyW: %s" ), GetChars( m_KeyWord ) ); keyword.Printf( _( "Key Words: %s" ), GetChars( m_KeyWord ) );
aList.push_back( MSG_PANEL_ITEM( doc, keyword, BLACK ) ); aList.push_back( MSG_PANEL_ITEM( doc, keyword, BLACK ) );
} }
...@@ -1047,21 +1047,21 @@ void MODULE::MoveAnchorPosition( const wxPoint& aMoveVector ) ...@@ -1047,21 +1047,21 @@ void MODULE::MoveAnchorPosition( const wxPoint& aMoveVector )
switch( item->Type() ) switch( item->Type() )
{ {
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
{ {
EDGE_MODULE* edge = static_cast<EDGE_MODULE*>( item ); EDGE_MODULE* edge = static_cast<EDGE_MODULE*>( item );
edge->m_Start0 += moveVector; edge->m_Start0 += moveVector;
edge->m_End0 += moveVector; edge->m_End0 += moveVector;
edge->SetDrawCoord(); edge->SetDrawCoord();
break; break;
} }
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
{ {
TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item ); TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item );
text->SetPos0( text->GetPos0() + moveVector ); text->SetPos0( text->GetPos0() + moveVector );
text->SetDrawCoord(); text->SetDrawCoord();
break; break;
} }
default: default:
break; break;
...@@ -1103,7 +1103,6 @@ void MODULE::SetOrientation( double newangle ) ...@@ -1103,7 +1103,6 @@ void MODULE::SetOrientation( double newangle )
{ {
static_cast<EDGE_MODULE*>( item )->SetDrawCoord(); static_cast<EDGE_MODULE*>( item )->SetDrawCoord();
} }
else if( item->Type() == PCB_MODULE_TEXT_T ) else if( item->Type() == PCB_MODULE_TEXT_T )
{ {
static_cast<TEXTE_MODULE*>( item )->SetDrawCoord(); static_cast<TEXTE_MODULE*>( item )->SetDrawCoord();
......
...@@ -132,7 +132,7 @@ void NETINFO_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -132,7 +132,7 @@ void NETINFO_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
// Displays the full net length (tracks on pcb + internal ICs connections ): // Displays the full net length (tracks on pcb + internal ICs connections ):
txt = ::LengthDoubleToString( lengthnet + lengthPadToDie ); txt = ::LengthDoubleToString( lengthnet + lengthPadToDie );
aList.push_back( MSG_PANEL_ITEM( _( "Net Length:" ), txt, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "Net Length" ), txt, RED ) );
// Displays the net length of tracks only: // Displays the net length of tracks only:
txt = ::LengthDoubleToString( lengthnet ); txt = ::LengthDoubleToString( lengthnet );
......
...@@ -607,7 +607,7 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList ) ...@@ -607,7 +607,7 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList )
if( module ) if( module )
{ {
wxString msg = module->GetReference(); wxString msg = module->GetReference();
aList.push_back( MSG_PANEL_ITEM( _( "Module" ), msg, DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), msg, DARKCYAN ) );
StringPadName( Line ); StringPadName( Line );
aList.push_back( MSG_PANEL_ITEM( _( "Pad" ), Line, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Pad" ), Line, BROWN ) );
} }
...@@ -629,10 +629,10 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList ) ...@@ -629,10 +629,10 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList )
aList.push_back( MSG_PANEL_ITEM( ShowPadShape(), ShowPadAttr(), DARKGREEN ) ); aList.push_back( MSG_PANEL_ITEM( ShowPadShape(), ShowPadAttr(), DARKGREEN ) );
Line = ::CoordinateToString( m_Size.x ); Line = ::CoordinateToString( m_Size.x );
aList.push_back( MSG_PANEL_ITEM( _( "H Size" ), Line, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "Width" ), Line, RED ) );
Line = ::CoordinateToString( m_Size.y ); Line = ::CoordinateToString( m_Size.y );
aList.push_back( MSG_PANEL_ITEM( _( "V Size" ), Line, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "Height" ), Line, RED ) );
Line = ::CoordinateToString( (unsigned) m_Drill.x ); Line = ::CoordinateToString( (unsigned) m_Drill.x );
...@@ -658,13 +658,10 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList ) ...@@ -658,13 +658,10 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList )
else else
Line.Printf( wxT( "%3.1f" ), m_Orient / 10.0 ); Line.Printf( wxT( "%3.1f" ), m_Orient / 10.0 );
aList.push_back( MSG_PANEL_ITEM( _( "Orient" ), Line, LIGHTBLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), Line, LIGHTBLUE ) );
Line = ::CoordinateToString( m_Pos.x ); Line = ::CoordinateToString( m_Pos.x ) + wxT( ", " ) + ::CoordinateToString( m_Pos.y );
aList.push_back( MSG_PANEL_ITEM( _( "X Pos" ), Line, LIGHTBLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Position" ), Line, LIGHTBLUE ) );
Line = ::CoordinateToString( m_Pos.y );
aList.push_back( MSG_PANEL_ITEM( _( "Y pos" ), Line, LIGHTBLUE ) );
if( GetPadToDieLength() ) if( GetPadToDieLength() )
{ {
......
...@@ -143,16 +143,16 @@ void TEXTE_PCB::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -143,16 +143,16 @@ void TEXTE_PCB::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), _( "Yes" ), DARKGREEN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), _( "Yes" ), DARKGREEN ) );
msg.Printf( wxT( "%.1f" ), m_Orient / 10.0 ); msg.Printf( wxT( "%.1f" ), m_Orient / 10.0 );
aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), msg, DARKGREEN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, DARKGREEN ) );
msg = ::CoordinateToString( m_Thickness ); msg = ::CoordinateToString( m_Thickness );
aList.push_back( MSG_PANEL_ITEM( _( "Thickness" ), msg, MAGENTA ) ); aList.push_back( MSG_PANEL_ITEM( _( "Thickness" ), msg, MAGENTA ) );
msg = ::CoordinateToString( m_Size.x ); msg = ::CoordinateToString( m_Size.x );
aList.push_back( MSG_PANEL_ITEM( _( "Size X" ), msg, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, RED ) );
msg = ::CoordinateToString( m_Size.y ); msg = ::CoordinateToString( m_Size.y );
aList.push_back( MSG_PANEL_ITEM( _( "Size Y" ), msg, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, RED ) );
} }
const EDA_RECT TEXTE_PCB::GetBoundingBox() const const EDA_RECT TEXTE_PCB::GetBoundingBox() const
......
...@@ -408,16 +408,16 @@ void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -408,16 +408,16 @@ void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), msg, DARKGREEN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), msg, DARKGREEN ) );
msg.Printf( wxT( "%.1f" ), m_Orient / 10.0 ); msg.Printf( wxT( "%.1f" ), m_Orient / 10.0 );
aList.push_back( MSG_PANEL_ITEM( _( "Orient" ), msg, DARKGREEN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, DARKGREEN ) );
msg = ::CoordinateToString( m_Thickness ); msg = ::CoordinateToString( m_Thickness );
aList.push_back( MSG_PANEL_ITEM( _( "Thickness" ), msg, DARKGREEN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Thickness" ), msg, DARKGREEN ) );
msg = ::CoordinateToString( m_Size.x ); msg = ::CoordinateToString( m_Size.x );
aList.push_back( MSG_PANEL_ITEM( _( "H Size" ), msg, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, RED ) );
msg = ::CoordinateToString( m_Size.y ); msg = ::CoordinateToString( m_Size.y );
aList.push_back( MSG_PANEL_ITEM( _( "V Size" ), msg, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, RED ) );
} }
......
...@@ -1023,15 +1023,15 @@ void TRACK::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -1023,15 +1023,15 @@ void TRACK::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
double lenPadToDie = 0; double lenPadToDie = 0;
board->MarkTrace( this, NULL, &trackLen, &lenPadToDie, false ); board->MarkTrace( this, NULL, &trackLen, &lenPadToDie, false );
msg = ::LengthDoubleToString( trackLen ); msg = ::LengthDoubleToString( trackLen );
aList.push_back( MSG_PANEL_ITEM( _( "Track Len" ), msg, DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Length" ), msg, DARKCYAN ) );
if( lenPadToDie != 0 ) if( lenPadToDie != 0 )
{ {
msg = ::LengthDoubleToString( trackLen + lenPadToDie ); msg = ::LengthDoubleToString( trackLen + lenPadToDie );
aList.push_back( MSG_PANEL_ITEM( _( "Full Len" ), msg, DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Full Length" ), msg, DARKCYAN ) );
msg = ::LengthDoubleToString( lenPadToDie ); msg = ::LengthDoubleToString( lenPadToDie );
aList.push_back( MSG_PANEL_ITEM( _( "In Package" ), msg, DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Pad To Die Length" ), msg, DARKCYAN ) );
} }
} }
...@@ -1155,7 +1155,7 @@ void SEGZONE::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -1155,7 +1155,7 @@ void SEGZONE::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
if( board ) if( board )
msg = board->GetLayerName( m_Layer ); msg = board->GetLayerName( m_Layer );
else else
msg.Printf(wxT("%d"), m_Layer ); msg.Printf( wxT( "%d" ), m_Layer );
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), msg, BROWN ) );
...@@ -1209,7 +1209,7 @@ void VIA::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -1209,7 +1209,7 @@ void VIA::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
msg = board->GetLayerName( top_layer ) + wxT( "/" ) msg = board->GetLayerName( top_layer ) + wxT( "/" )
+ board->GetLayerName( bottom_layer ); + board->GetLayerName( bottom_layer );
else else
msg.Printf(wxT("%d/%d"), top_layer, bottom_layer ); msg.Printf( wxT( "%d/%d" ), top_layer, bottom_layer );
aList.push_back( MSG_PANEL_ITEM( _( "Layers" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Layers" ), msg, BROWN ) );
...@@ -1217,7 +1217,7 @@ void VIA::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -1217,7 +1217,7 @@ void VIA::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
msg = ::CoordinateToString( (unsigned) m_Width ); msg = ::CoordinateToString( (unsigned) m_Width );
// Display diameter value: // Display diameter value:
aList.push_back( MSG_PANEL_ITEM( _( "Diam" ), msg, DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Diameter" ), msg, DARKCYAN ) );
// Display drill value // Display drill value
int drill_value = GetDrillValue(); int drill_value = GetDrillValue();
......
...@@ -608,7 +608,7 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -608,7 +608,7 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
msg.Empty(); msg.Empty();
if( GetDoNotAllowVias() ) if( GetDoNotAllowVias() )
AccumulateDescription( msg, _("No via") ); AccumulateDescription( msg, _( "No via" ) );
if( GetDoNotAllowTracks() ) if( GetDoNotAllowTracks() )
AccumulateDescription( msg, _("No track") ); AccumulateDescription( msg, _("No track") );
...@@ -663,16 +663,16 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -663,16 +663,16 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
else else
msg = _( "Polygons" ); msg = _( "Polygons" );
aList.push_back( MSG_PANEL_ITEM( _( "Fill mode" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Fill Mode" ), msg, BROWN ) );
// Useful for statistics : // Useful for statistics :
msg.Printf( wxT( "%d" ), (int) m_Poly->m_HatchLines.size() ); msg.Printf( wxT( "%d" ), (int) m_Poly->m_HatchLines.size() );
aList.push_back( MSG_PANEL_ITEM( _( "Hatch lines" ), msg, BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Hatch Lines" ), msg, BLUE ) );
if( m_FilledPolysList.GetCornersCount() ) if( m_FilledPolysList.GetCornersCount() )
{ {
msg.Printf( wxT( "%d" ), (int) m_FilledPolysList.GetCornersCount() ); msg.Printf( wxT( "%d" ), (int) m_FilledPolysList.GetCornersCount() );
aList.push_back( MSG_PANEL_ITEM( _( "Corners in DrawList" ), msg, BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Corner Count" ), msg, BLUE ) );
} }
} }
......
...@@ -23,22 +23,22 @@ ...@@ -23,22 +23,22 @@
*/ */
#include "dialog_track_via_size.h" #include "dialog_track_via_size.h"
#include <router/pns_routing_settings.h>
#include <base_units.h> #include <base_units.h>
#include <confirm.h> #include <confirm.h>
#include <boost/optional.hpp> #include <boost/optional.hpp>
DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, PNS_ROUTING_SETTINGS& aSettings ) : #include "class_board_design_settings.h"
DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, BOARD_DESIGN_SETTINGS& aSettings ) :
DIALOG_TRACK_VIA_SIZE_BASE( aParent ), DIALOG_TRACK_VIA_SIZE_BASE( aParent ),
m_settings( aSettings ) m_settings( aSettings )
{ {
// Load router settings to dialog fields // Load router settings to dialog fields
m_trackWidth->SetValue( To_User_Unit( m_trackWidth->GetUnits(), m_settings.GetTrackWidth() ) ); m_trackWidth->SetValue( To_User_Unit( m_trackWidth->GetUnits(), m_settings.GetCustomTrackWidth() ) );
m_viaDiameter->SetValue( To_User_Unit( m_viaDiameter->GetUnits(), m_settings.GetViaDiameter() ) ); m_viaDiameter->SetValue( To_User_Unit( m_viaDiameter->GetUnits(), m_settings.GetCustomViaSize() ) );
m_viaDrill->SetValue( To_User_Unit( m_viaDrill->GetUnits(), m_settings.GetViaDrill() ) ); m_viaDrill->SetValue( To_User_Unit( m_viaDrill->GetUnits(), m_settings.GetCustomViaDrill() ) );
m_trackWidth->SetFocus(); m_trackWidth->SetFocus();
GetSizer()->SetSizeHints( this );
// Pressing ENTER when any of the text input fields is active applies changes // Pressing ENTER when any of the text input fields is active applies changes
#if wxCHECK_VERSION( 3, 0, 0 ) #if wxCHECK_VERSION( 3, 0, 0 )
...@@ -46,6 +46,8 @@ DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, PNS_ROUTING_SET ...@@ -46,6 +46,8 @@ DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, PNS_ROUTING_SET
#else #else
Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE::onOkClick ), NULL, this ); Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE::onOkClick ), NULL, this );
#endif #endif
Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_TRACK_VIA_SIZE::onClose ) );
} }
...@@ -56,7 +58,7 @@ bool DIALOG_TRACK_VIA_SIZE::check() ...@@ -56,7 +58,7 @@ bool DIALOG_TRACK_VIA_SIZE::check()
return false; return false;
// Via drill should be smaller than via diameter // Via drill should be smaller than via diameter
if( *m_viaDrill->GetValue() >= m_viaDiameter->GetValue() ) if( m_viaDrill->GetValue() >= m_viaDiameter->GetValue() )
return false; return false;
return true; return true;
...@@ -74,9 +76,9 @@ void DIALOG_TRACK_VIA_SIZE::onOkClick( wxCommandEvent& aEvent ) ...@@ -74,9 +76,9 @@ void DIALOG_TRACK_VIA_SIZE::onOkClick( wxCommandEvent& aEvent )
if( check() ) if( check() )
{ {
// Store dialog values to the router settings // Store dialog values to the router settings
m_settings.SetTrackWidth( From_User_Unit( m_trackWidth->GetUnits(), *m_trackWidth->GetValue() ) ); m_settings.SetCustomTrackWidth( From_User_Unit( m_trackWidth->GetUnits(), *m_trackWidth->GetValue() ) );
m_settings.SetViaDiameter( From_User_Unit( m_viaDiameter->GetUnits(), *m_viaDiameter->GetValue() ) ); m_settings.SetCustomViaSize( From_User_Unit( m_viaDiameter->GetUnits(), *m_viaDiameter->GetValue() ) );
m_settings.SetViaDrill( From_User_Unit( m_viaDrill->GetUnits(), *m_viaDrill->GetValue() ) ); m_settings.SetCustomViaDrill( From_User_Unit( m_viaDrill->GetUnits(), *m_viaDrill->GetValue() ) );
EndModal( 1 ); EndModal( 1 );
} }
else else
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
*/ */
/** /**
* Push and Shove router track width and via size dialog. * Custom track width and via size dialog.
*/ */
#ifndef __dialog_track_via_size__ #ifndef __dialog_track_via_size__
...@@ -27,18 +27,18 @@ ...@@ -27,18 +27,18 @@
#include "dialog_track_via_size_base.h" #include "dialog_track_via_size_base.h"
class PNS_ROUTING_SETTINGS; class BOARD_DESIGN_SETTINGS;
/** Implementing DIALOG_TRACK_VIA_SIZE_BASE */ /** Implementing DIALOG_TRACK_VIA_SIZE_BASE */
class DIALOG_TRACK_VIA_SIZE : public DIALOG_TRACK_VIA_SIZE_BASE class DIALOG_TRACK_VIA_SIZE : public DIALOG_TRACK_VIA_SIZE_BASE
{ {
public: public:
/** Constructor */ /** Constructor */
DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, PNS_ROUTING_SETTINGS& aSettings ); DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, BOARD_DESIGN_SETTINGS& aSettings );
protected: protected:
// Routings settings that are modified by the dialog. // Routings settings that are modified by the dialog.
PNS_ROUTING_SETTINGS& m_settings; BOARD_DESIGN_SETTINGS& m_settings;
///> Checks if values given in the dialog are sensible. ///> Checks if values given in the dialog are sensible.
bool check(); bool check();
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 6 2013) // C++ code generated with wxFormBuilder (version Jun 6 2014)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#include "dialog_shim.h"
#include "dialog_track_via_size_base.h" #include "dialog_track_via_size_base.h"
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
DIALOG_TRACK_VIA_SIZE_BASE::DIALOG_TRACK_VIA_SIZE_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) DIALOG_TRACK_VIA_SIZE_BASE::DIALOG_TRACK_VIA_SIZE_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{ {
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxSize( 280,240 ), wxDefaultSize );
wxBoxSizer* bSizes; wxBoxSizer* bSizes;
bSizes = new wxBoxSizer( wxVERTICAL ); bSizes = new wxBoxSizer( wxVERTICAL );
m_trackWidth = new WX_UNIT_TEXT( this, _("Track width:") ); m_trackWidth = new WX_UNIT_TEXT( this, _("Track width:") );
bSizes->Add( m_trackWidth, 0, wxALL, 5 ); bSizes->Add( m_trackWidth, 0, wxALL|wxEXPAND, 5 );
m_viaDiameter = new WX_UNIT_TEXT( this, _("Via diameter:") ); m_viaDiameter = new WX_UNIT_TEXT( this, _("Via diameter:") );
bSizes->Add( m_viaDiameter, 0, wxALL, 5 ); bSizes->Add( m_viaDiameter, 0, wxALL|wxEXPAND, 5 );
m_viaDrill = new WX_UNIT_TEXT( this, _("Via drill:") ); m_viaDrill = new WX_UNIT_TEXT( this, _("Via drill:") );
bSizes->Add( m_viaDrill, 0, wxALL, 5 ); bSizes->Add( m_viaDrill, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* bButtons;
bButtons = new wxBoxSizer( wxHORIZONTAL );
m_ok = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
bButtons->Add( m_ok, 1, wxALL, 5 );
m_cancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
bButtons->Add( m_cancel, 1, wxALL, 5 );
m_stdButtons = new wxStdDialogButtonSizer();
m_stdButtonsOK = new wxButton( this, wxID_OK );
m_stdButtons->AddButton( m_stdButtonsOK );
m_stdButtonsCancel = new wxButton( this, wxID_CANCEL );
m_stdButtons->AddButton( m_stdButtonsCancel );
m_stdButtons->Realize();
bSizes->Add( bButtons, 0, wxEXPAND, 5 ); bSizes->Add( m_stdButtons, 0, wxEXPAND|wxALL, 5 );
this->SetSizer( bSizes ); this->SetSizer( bSizes );
this->Layout(); this->Layout();
bSizes->Fit( this );
this->Centre( wxBOTH ); this->Centre( wxBOTH );
// Connect Events // Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onClose ) ); this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onClose ) );
m_ok->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onOkClick ), NULL, this ); m_stdButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onCancelClick ), NULL, this );
m_cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onCancelClick ), NULL, this ); m_stdButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onOkClick ), NULL, this );
} }
DIALOG_TRACK_VIA_SIZE_BASE::~DIALOG_TRACK_VIA_SIZE_BASE() DIALOG_TRACK_VIA_SIZE_BASE::~DIALOG_TRACK_VIA_SIZE_BASE()
{ {
// Disconnect Events // Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onClose ) ); this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onClose ) );
m_ok->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onOkClick ), NULL, this ); m_stdButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onCancelClick ), NULL, this );
m_cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onCancelClick ), NULL, this ); m_stdButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onOkClick ), NULL, this );
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 6 2013) // C++ code generated with wxFormBuilder (version Jun 6 2014)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -11,16 +11,14 @@ ...@@ -11,16 +11,14 @@
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
class DIALOG_SHIM;
#include <wxunittext.h> #include <wxunittext.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/font.h> #include <wx/font.h>
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/button.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/button.h>
#include <wx/dialog.h> #include <wx/dialog.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
...@@ -37,18 +35,19 @@ class DIALOG_TRACK_VIA_SIZE_BASE : public wxDialog ...@@ -37,18 +35,19 @@ class DIALOG_TRACK_VIA_SIZE_BASE : public wxDialog
WX_UNIT_TEXT* m_trackWidth; WX_UNIT_TEXT* m_trackWidth;
WX_UNIT_TEXT* m_viaDiameter; WX_UNIT_TEXT* m_viaDiameter;
WX_UNIT_TEXT* m_viaDrill; WX_UNIT_TEXT* m_viaDrill;
wxButton* m_ok; wxStdDialogButtonSizer* m_stdButtons;
wxButton* m_cancel; wxButton* m_stdButtonsOK;
wxButton* m_stdButtonsCancel;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void onClose( wxCloseEvent& event ) { event.Skip(); } virtual void onClose( wxCloseEvent& event ) { event.Skip(); }
virtual void onOkClick( wxCommandEvent& event ) { event.Skip(); }
virtual void onCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void onCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void onOkClick( wxCommandEvent& event ) { event.Skip(); }
public: public:
DIALOG_TRACK_VIA_SIZE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Track width and via size"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 388,162 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_TRACK_VIA_SIZE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Track width and via size"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
~DIALOG_TRACK_VIA_SIZE_BASE(); ~DIALOG_TRACK_VIA_SIZE_BASE();
}; };
......
...@@ -387,7 +387,6 @@ void PCB_PAINTER::draw( const VIA* aVia, int aLayer ) ...@@ -387,7 +387,6 @@ void PCB_PAINTER::draw( const VIA* aVia, int aLayer )
else else
{ {
double width = ( aVia->GetWidth() - aVia->GetDrillValue() ) / 2.0; double width = ( aVia->GetWidth() - aVia->GetDrillValue() ) / 2.0;
radius -= width / 2.0;
m_gal->SetLineWidth( width ); m_gal->SetLineWidth( width );
m_gal->SetIsFill( true ); m_gal->SetIsFill( true );
......
...@@ -24,6 +24,7 @@ set( PCBNEW_PNS_SRCS ...@@ -24,6 +24,7 @@ set( PCBNEW_PNS_SRCS
pns_router.cpp pns_router.cpp
pns_routing_settings.cpp pns_routing_settings.cpp
pns_shove.cpp pns_shove.cpp
pns_sizes_settings.cpp
pns_solid.cpp pns_solid.cpp
pns_utils.cpp pns_utils.cpp
pns_via.cpp pns_via.cpp
......
...@@ -65,7 +65,7 @@ public: ...@@ -65,7 +65,7 @@ public:
ANG_UNDEFINED = 0x20 ANG_UNDEFINED = 0x20
}; };
DIRECTION_45( Directions aDir = UNDEFINED ) : m_dir( aDir ) {}; DIRECTION_45( Directions aDir = UNDEFINED ) : m_dir( aDir ) {}
/** /**
* Constructor * Constructor
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "pns_router.h" #include "pns_router.h"
PNS_DRAGGER::PNS_DRAGGER( PNS_ROUTER* aRouter ) : PNS_DRAGGER::PNS_DRAGGER( PNS_ROUTER* aRouter ) :
PNS_ALGO_BASE ( aRouter ) PNS_ALGO_BASE( aRouter )
{ {
m_world = NULL; m_world = NULL;
m_shove = NULL; m_shove = NULL;
...@@ -39,7 +39,7 @@ PNS_DRAGGER::~PNS_DRAGGER() ...@@ -39,7 +39,7 @@ PNS_DRAGGER::~PNS_DRAGGER()
} }
void PNS_DRAGGER::SetWorld ( PNS_NODE* aWorld ) void PNS_DRAGGER::SetWorld( PNS_NODE* aWorld )
{ {
m_world = aWorld; m_world = aWorld;
} }
...@@ -49,7 +49,7 @@ bool PNS_DRAGGER::startDragSegment( const VECTOR2D& aP, PNS_SEGMENT* aSeg ) ...@@ -49,7 +49,7 @@ bool PNS_DRAGGER::startDragSegment( const VECTOR2D& aP, PNS_SEGMENT* aSeg )
{ {
int w2 = aSeg->Width() / 2; int w2 = aSeg->Width() / 2;
m_draggedLine = m_world->AssembleLine ( aSeg, &m_draggedSegmentIndex ); m_draggedLine = m_world->AssembleLine( aSeg, &m_draggedSegmentIndex );
m_shove->SetInitialLine( m_draggedLine ); m_shove->SetInitialLine( m_draggedLine );
m_lastValidDraggedLine = *m_draggedLine; m_lastValidDraggedLine = *m_draggedLine;
m_lastValidDraggedLine.ClearSegmentLinks(); m_lastValidDraggedLine.ClearSegmentLinks();
...@@ -58,9 +58,9 @@ bool PNS_DRAGGER::startDragSegment( const VECTOR2D& aP, PNS_SEGMENT* aSeg ) ...@@ -58,9 +58,9 @@ bool PNS_DRAGGER::startDragSegment( const VECTOR2D& aP, PNS_SEGMENT* aSeg )
m_mode = CORNER; m_mode = CORNER;
else if( ( aP - aSeg->Seg().B ).EuclideanNorm() <= w2 ) else if( ( aP - aSeg->Seg().B ).EuclideanNorm() <= w2 )
{ {
m_draggedSegmentIndex ++; m_draggedSegmentIndex++;
m_mode = CORNER; m_mode = CORNER;
} else } else
m_mode = SEGMENT; m_mode = SEGMENT;
return true; return true;
...@@ -74,14 +74,14 @@ bool PNS_DRAGGER::startDragVia( const VECTOR2D& aP, PNS_VIA* aVia ) ...@@ -74,14 +74,14 @@ bool PNS_DRAGGER::startDragVia( const VECTOR2D& aP, PNS_VIA* aVia )
m_mode = VIA; m_mode = VIA;
VECTOR2I p0( aVia->Pos() ); VECTOR2I p0( aVia->Pos() );
PNS_JOINT *jt = m_world->FindJoint( p0, aVia->Layers().Start(), aVia->Net() ); PNS_JOINT* jt = m_world->FindJoint( p0, aVia->Layers().Start(), aVia->Net() );
BOOST_FOREACH(PNS_ITEM *item, jt->LinkList() ) BOOST_FOREACH( PNS_ITEM* item, jt->LinkList() )
{ {
if( item->OfKind( PNS_ITEM::SEGMENT ) ) if( item->OfKind( PNS_ITEM::SEGMENT ) )
{ {
int segIndex; int segIndex;
PNS_SEGMENT* seg = (PNS_SEGMENT*) item; PNS_SEGMENT* seg = ( PNS_SEGMENT*) item;
std::auto_ptr<PNS_LINE> l( m_world->AssembleLine( seg, &segIndex ) ); std::auto_ptr<PNS_LINE> l( m_world->AssembleLine( seg, &segIndex ) );
if( segIndex != 0 ) if( segIndex != 0 )
...@@ -97,29 +97,29 @@ bool PNS_DRAGGER::startDragVia( const VECTOR2D& aP, PNS_VIA* aVia ) ...@@ -97,29 +97,29 @@ bool PNS_DRAGGER::startDragVia( const VECTOR2D& aP, PNS_VIA* aVia )
bool PNS_DRAGGER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ) bool PNS_DRAGGER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
{ {
m_shove = new PNS_SHOVE( m_world, Router() ); m_shove = new PNS_SHOVE( m_world, Router() );
m_lastNode = NULL; m_lastNode = NULL;
m_draggedItems.Clear(); m_draggedItems.Clear();
m_currentMode = Settings().Mode(); m_currentMode = Settings().Mode();
TRACE( 2, "StartDragging: item %p [kind %d]", aStartItem % aStartItem->Kind() ); TRACE( 2, "StartDragging: item %p [kind %d]", aStartItem % aStartItem->Kind() );
switch( aStartItem->Kind() ) switch( aStartItem->Kind() )
{ {
case PNS_ITEM::SEGMENT: case PNS_ITEM::SEGMENT:
return startDragSegment ( aP, static_cast<PNS_SEGMENT *>( aStartItem ) ); return startDragSegment( aP, static_cast<PNS_SEGMENT*>( aStartItem ) );
case PNS_ITEM::VIA: case PNS_ITEM::VIA:
return startDragVia ( aP, static_cast<PNS_VIA *> (aStartItem) ); return startDragVia( aP, static_cast<PNS_VIA*>( aStartItem ) );
default: default:
return false; return false;
} }
} }
bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP ) bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP )
{ {
if( m_lastNode ) if( m_lastNode )
{ {
delete m_lastNode; delete m_lastNode;
...@@ -133,20 +133,20 @@ bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP ) ...@@ -133,20 +133,20 @@ bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP )
{ {
int thresh = Settings().SmoothDraggedSegments() ? m_draggedLine->Width() / 4 : 0; int thresh = Settings().SmoothDraggedSegments() ? m_draggedLine->Width() / 4 : 0;
PNS_LINE tmp( *m_draggedLine ); PNS_LINE tmp( *m_draggedLine );
if( m_mode == SEGMENT ) if( m_mode == SEGMENT )
tmp.DragSegment ( aP, m_draggedSegmentIndex, thresh ); tmp.DragSegment( aP, m_draggedSegmentIndex, thresh );
else else
tmp.DragCorner ( aP, m_draggedSegmentIndex, thresh ); tmp.DragCorner( aP, m_draggedSegmentIndex, thresh );
m_lastNode = m_shove->CurrentNode()->Branch(); m_lastNode = m_shove->CurrentNode()->Branch();
m_lastValidDraggedLine = tmp; m_lastValidDraggedLine = tmp;
m_lastValidDraggedLine.ClearSegmentLinks(); m_lastValidDraggedLine.ClearSegmentLinks();
m_lastValidDraggedLine.Unmark(); m_lastValidDraggedLine.Unmark();
m_lastNode->Add ( &m_lastValidDraggedLine ); m_lastNode->Add( &m_lastValidDraggedLine );
m_draggedItems = PNS_ITEMSET ( &m_lastValidDraggedLine ); m_draggedItems = PNS_ITEMSET( &m_lastValidDraggedLine );
break; break;
} }
...@@ -154,7 +154,7 @@ bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP ) ...@@ -154,7 +154,7 @@ bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP )
case VIA: // fixme... case VIA: // fixme...
{ {
m_lastNode = m_shove->CurrentNode()->Branch(); m_lastNode = m_shove->CurrentNode()->Branch();
dumbDragVia ( m_initialVia, m_lastNode, aP ); dumbDragVia( m_initialVia, m_lastNode, aP );
break; break;
} }
...@@ -164,7 +164,7 @@ bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP ) ...@@ -164,7 +164,7 @@ bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP )
m_dragStatus = true; m_dragStatus = true;
else else
m_dragStatus = !m_world->CheckColliding( m_draggedItems ); m_dragStatus = !m_world->CheckColliding( m_draggedItems );
return true; return true;
} }
...@@ -176,20 +176,20 @@ void PNS_DRAGGER::dumbDragVia( PNS_VIA* aVia, PNS_NODE* aNode, const VECTOR2I& a ...@@ -176,20 +176,20 @@ void PNS_DRAGGER::dumbDragVia( PNS_VIA* aVia, PNS_NODE* aNode, const VECTOR2I& a
m_draggedVia->SetPos( aP ); m_draggedVia->SetPos( aP );
m_draggedItems.Clear(); m_draggedItems.Clear();
m_draggedItems.Add( m_draggedVia ); m_draggedItems.Add( m_draggedVia );
m_lastNode->Remove( aVia ); m_lastNode->Remove( aVia );
m_lastNode->Add( m_draggedVia ); m_lastNode->Add( m_draggedVia );
BOOST_FOREACH( PNS_LINE &l, m_origViaConnections ) BOOST_FOREACH( PNS_LINE &l, m_origViaConnections )
{ {
PNS_LINE origLine (l); PNS_LINE origLine( l );
PNS_LINE* draggedLine = l.Clone(); PNS_LINE* draggedLine = l.Clone();
draggedLine->DragCorner( aP, 0 ); draggedLine->DragCorner( aP, 0 );
draggedLine->ClearSegmentLinks(); draggedLine->ClearSegmentLinks();
m_draggedItems.AddOwned( draggedLine ); m_draggedItems.Add( draggedLine ); // FIXME: mem leak
m_lastNode->Remove( &origLine ); m_lastNode->Remove( &origLine );
m_lastNode->Add( draggedLine ); m_lastNode->Add( draggedLine );
} }
...@@ -208,43 +208,43 @@ bool PNS_DRAGGER::dragShove( const VECTOR2I& aP ) ...@@ -208,43 +208,43 @@ bool PNS_DRAGGER::dragShove( const VECTOR2I& aP )
switch( m_mode ) switch( m_mode )
{ {
case SEGMENT: case SEGMENT:
case CORNER: case CORNER:
{ {
int thresh = Settings().SmoothDraggedSegments() ? m_draggedLine->Width() / 4 : 0; int thresh = Settings().SmoothDraggedSegments() ? m_draggedLine->Width() / 4 : 0;
PNS_LINE tmp( *m_draggedLine ); PNS_LINE tmp( *m_draggedLine );
if( m_mode == SEGMENT ) if( m_mode == SEGMENT )
tmp.DragSegment( aP, m_draggedSegmentIndex, thresh ); tmp.DragSegment( aP, m_draggedSegmentIndex, thresh );
else else
tmp.DragCorner( aP, m_draggedSegmentIndex, thresh ); tmp.DragCorner( aP, m_draggedSegmentIndex, thresh );
PNS_SHOVE::SHOVE_STATUS st = m_shove->ShoveLines( tmp ); PNS_SHOVE::SHOVE_STATUS st = m_shove->ShoveLines( tmp );
if( st == PNS_SHOVE::SH_OK ) if( st == PNS_SHOVE::SH_OK )
ok = true; ok = true;
else if( st == PNS_SHOVE::SH_HEAD_MODIFIED ) else if( st == PNS_SHOVE::SH_HEAD_MODIFIED )
{ {
tmp = m_shove->NewHead(); tmp = m_shove->NewHead();
ok = true; ok = true;
} }
m_lastNode = m_shove->CurrentNode()->Branch(); m_lastNode = m_shove->CurrentNode()->Branch();
if( ok ) if( ok )
m_lastValidDraggedLine = tmp; m_lastValidDraggedLine = tmp;
m_lastValidDraggedLine.ClearSegmentLinks(); m_lastValidDraggedLine.ClearSegmentLinks();
m_lastValidDraggedLine.Unmark(); m_lastValidDraggedLine.Unmark();
m_lastNode->Add( &m_lastValidDraggedLine ); m_lastNode->Add( &m_lastValidDraggedLine );
m_draggedItems = PNS_ITEMSET( &m_lastValidDraggedLine ); m_draggedItems = PNS_ITEMSET( &m_lastValidDraggedLine );
break; break;
} }
case VIA: case VIA:
{ {
PNS_VIA *newVia; PNS_VIA* newVia;
PNS_SHOVE::SHOVE_STATUS st = m_shove->ShoveDraggingVia( m_draggedVia, aP, &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 ) if( st == PNS_SHOVE::SH_OK || st == PNS_SHOVE::SH_HEAD_MODIFIED )
...@@ -261,7 +261,7 @@ bool PNS_DRAGGER::dragShove( const VECTOR2I& aP ) ...@@ -261,7 +261,7 @@ bool PNS_DRAGGER::dragShove( const VECTOR2I& aP )
break; break;
} }
} }
m_dragStatus = ok; m_dragStatus = ok;
return ok; return ok;
...@@ -274,7 +274,7 @@ bool PNS_DRAGGER::FixRoute() ...@@ -274,7 +274,7 @@ bool PNS_DRAGGER::FixRoute()
{ {
Router()->CommitRouting( CurrentNode() ); Router()->CommitRouting( CurrentNode() );
return true; return true;
} }
return false; return false;
} }
...@@ -282,23 +282,23 @@ bool PNS_DRAGGER::FixRoute() ...@@ -282,23 +282,23 @@ bool PNS_DRAGGER::FixRoute()
bool PNS_DRAGGER::Drag( const VECTOR2I& aP ) bool PNS_DRAGGER::Drag( const VECTOR2I& aP )
{ {
switch( m_currentMode ) switch( m_currentMode )
{ {
case RM_MarkObstacles: case RM_MarkObstacles:
return dragMarkObstacles( aP ); return dragMarkObstacles( aP );
case RM_Shove: case RM_Shove:
case RM_Walkaround: case RM_Walkaround:
case RM_Smart: case RM_Smart:
return dragShove( aP ); return dragShove( aP );
default: default:
return false; return false;
} }
} }
PNS_NODE *PNS_DRAGGER::CurrentNode() const PNS_NODE* PNS_DRAGGER::CurrentNode() const
{ {
return m_lastNode; return m_lastNode;
} }
......
...@@ -24,32 +24,13 @@ ...@@ -24,32 +24,13 @@
PNS_ITEMSET::PNS_ITEMSET( PNS_ITEM* aInitialItem ) PNS_ITEMSET::PNS_ITEMSET( PNS_ITEM* aInitialItem )
{ {
if(aInitialItem) if( aInitialItem )
m_items.push_back(aInitialItem); m_items.push_back( aInitialItem );
} }
PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd, bool aInvert )
PNS_ITEMSET::~PNS_ITEMSET()
{
Clear();
}
void PNS_ITEMSET::Clear()
{
BOOST_FOREACH(PNS_ITEM* item, m_ownedItems)
{
delete item;
}
m_items.clear();
m_ownedItems.clear();
}
PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd )
{ {
ITEM_VECTOR newItems; ITEMS newItems;
PNS_LAYERSET l; PNS_LAYERSET l;
if( aEnd < 0 ) if( aEnd < 0 )
...@@ -59,7 +40,7 @@ PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd ) ...@@ -59,7 +40,7 @@ PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd )
BOOST_FOREACH( PNS_ITEM* item, m_items ) BOOST_FOREACH( PNS_ITEM* item, m_items )
if( item->Layers().Overlaps( l ) ) if( item->Layers().Overlaps( l ) ^ aInvert )
newItems.push_back( item ); newItems.push_back( item );
m_items = newItems; m_items = newItems;
...@@ -68,13 +49,13 @@ PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd ) ...@@ -68,13 +49,13 @@ PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd )
} }
PNS_ITEMSET& PNS_ITEMSET::FilterKinds( int aKindMask ) PNS_ITEMSET& PNS_ITEMSET::FilterKinds( int aKindMask, bool aInvert )
{ {
ITEM_VECTOR newItems; ITEMS newItems;
BOOST_FOREACH( PNS_ITEM* item, m_items ) BOOST_FOREACH( PNS_ITEM* item, m_items )
{ {
if( item->OfKind ( aKindMask ) ) if( item->OfKind( aKindMask ) ^ aInvert )
newItems.push_back( item ); newItems.push_back( item );
} }
...@@ -84,13 +65,28 @@ PNS_ITEMSET& PNS_ITEMSET::FilterKinds( int aKindMask ) ...@@ -84,13 +65,28 @@ PNS_ITEMSET& PNS_ITEMSET::FilterKinds( int aKindMask )
} }
PNS_ITEMSET& PNS_ITEMSET::FilterNet( int aNet ) PNS_ITEMSET& PNS_ITEMSET::FilterNet( int aNet, bool aInvert )
{
ITEMS newItems;
BOOST_FOREACH( PNS_ITEM* item, m_items )
{
if( ( item->Net() == aNet ) ^ aInvert )
newItems.push_back( item );
}
m_items = newItems;
return *this;
}
PNS_ITEMSET& PNS_ITEMSET::ExcludeItem( const PNS_ITEM* aItem )
{ {
ITEM_VECTOR newItems; ITEMS newItems;
BOOST_FOREACH( PNS_ITEM* item, m_items ) BOOST_FOREACH( PNS_ITEM* item, m_items )
{ {
if( item->Net() == aNet ) if( item != aItem )
newItems.push_back( item ); newItems.push_back( item );
} }
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#define __PNS_ITEMSET_H #define __PNS_ITEMSET_H
#include <vector> #include <vector>
#include <boost/foreach.hpp>
#include "pns_item.h" #include "pns_item.h"
...@@ -35,53 +36,96 @@ ...@@ -35,53 +36,96 @@
class PNS_ITEMSET class PNS_ITEMSET
{ {
public: public:
typedef std::vector<PNS_ITEM*> ITEM_VECTOR; typedef std::vector<PNS_ITEM*> ITEMS;
PNS_ITEMSET( PNS_ITEM* aInitialItem = NULL ); PNS_ITEMSET( PNS_ITEM* aInitialItem = NULL );
PNS_ITEMSET( const PNS_ITEMSET& aOther ) PNS_ITEMSET( const PNS_ITEMSET& aOther )
{ {
m_items = aOther.m_items; m_items = aOther.m_items;
m_ownedItems = ITEM_VECTOR();
} }
const PNS_ITEMSET& operator=( const PNS_ITEMSET& aOther ) const PNS_ITEMSET& operator=( const PNS_ITEMSET& aOther )
{ {
m_items = aOther.m_items; m_items = aOther.m_items;
m_ownedItems = ITEM_VECTOR();
return *this; return *this;
} }
~PNS_ITEMSET(); int Count( int aKindMask = -1 ) const
{
int n = 0;
BOOST_FOREACH( PNS_ITEM* item, m_items )
{
if( item->Kind() & aKindMask )
n++;
}
return n;
}
ITEM_VECTOR& Items() { return m_items; } ITEMS& Items() { return m_items; }
const ITEM_VECTOR& CItems() const { return m_items; } const ITEMS& CItems() const { return m_items; }
PNS_ITEMSET& FilterLayers( int aStart, int aEnd = -1 ); PNS_ITEMSET& FilterLayers( int aStart, int aEnd = -1, bool aInvert = false );
PNS_ITEMSET& FilterKinds( int aKindMask ); PNS_ITEMSET& FilterKinds( int aKindMask, bool aInvert = false );
PNS_ITEMSET& FilterNet( int aNet ); PNS_ITEMSET& FilterNet( int aNet, bool aInvert = false );
int Size() { return m_items.size(); } PNS_ITEMSET& ExcludeLayers( int aStart, int aEnd = -1 )
{
return FilterLayers( aStart, aEnd, true );
}
PNS_ITEMSET& ExcludeKinds( int aKindMask )
{
return FilterKinds( aKindMask, true );
}
PNS_ITEMSET& ExcludeNet( int aNet )
{
return FilterNet( aNet, true );
}
PNS_ITEMSET& ExcludeItem( const PNS_ITEM* aItem );
int Size() const
{
return m_items.size();
}
void Add( PNS_ITEM* aItem ) void Add( PNS_ITEM* aItem )
{ {
m_items.push_back( aItem ); m_items.push_back( aItem );
} }
PNS_ITEM* Get( int index ) const { return m_items[index]; } PNS_ITEM* Get( int index ) const
{
return m_items[index];
}
void Clear(); PNS_ITEM* operator[] ( int index ) const
{
return m_items[index];
}
void AddOwned( PNS_ITEM *aItem ) void Clear()
{ {
m_items.push_back( aItem ); m_items.clear();
m_ownedItems.push_back( aItem ); }
bool Contains( const PNS_ITEM* aItem ) const
{
return std::find( m_items.begin(), m_items.end(), aItem ) != m_items.end();
} }
void Erase( const PNS_ITEM* aItem )
{
ITEMS::iterator f = std::find( m_items.begin(), m_items.end(), aItem );
if( f != m_items.end() )
m_items.erase( f );
}
private: private:
ITEM_VECTOR m_items; ITEMS m_items;
ITEM_VECTOR m_ownedItems;
}; };
#endif #endif
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "pns_item.h" #include "pns_item.h"
#include "pns_segment.h" #include "pns_segment.h"
#include "pns_itemset.h"
/** /**
* Class PNS_JOINT * Class PNS_JOINT
...@@ -71,7 +72,7 @@ public: ...@@ -71,7 +72,7 @@ public:
m_layers = aB.m_layers; m_layers = aB.m_layers;
} }
PNS_ITEM* Clone ( ) const PNS_ITEM* Clone( ) const
{ {
assert( false ); assert( false );
return NULL; return NULL;
...@@ -81,7 +82,7 @@ public: ...@@ -81,7 +82,7 @@ public:
/// segments of the same net, on the same layer. /// segments of the same net, on the same layer.
bool IsLineCorner() const bool IsLineCorner() const
{ {
if( m_linkedItems.size() != 2 ) if( m_linkedItems.Size() != 2 )
return false; return false;
if( m_linkedItems[0]->Kind() != SEGMENT || m_linkedItems[1]->Kind() != SEGMENT ) if( m_linkedItems[0]->Kind() != SEGMENT || m_linkedItems[1]->Kind() != SEGMENT )
...@@ -97,24 +98,18 @@ public: ...@@ -97,24 +98,18 @@ public:
///> Links the joint to a given board item (when it's added to the PNS_NODE) ///> Links the joint to a given board item (when it's added to the PNS_NODE)
void Link( PNS_ITEM* aItem ) void Link( PNS_ITEM* aItem )
{ {
LINKED_ITEMS::iterator f = std::find( m_linkedItems.begin(), m_linkedItems.end(), aItem ); if( m_linkedItems.Contains( aItem ) )
if( f != m_linkedItems.end() )
return; return;
m_linkedItems.push_back( aItem ); m_linkedItems.Add( aItem );
} }
///> Unlinks a given board item from the joint (upon its removal from a PNS_NODE) ///> Unlinks a given board item from the joint (upon its removal from a PNS_NODE)
///> Returns true if the joint became dangling after unlinking. ///> Returns true if the joint became dangling after unlinking.
bool Unlink( PNS_ITEM* aItem ) bool Unlink( PNS_ITEM* aItem )
{ {
LINKED_ITEMS::iterator f = std::find( m_linkedItems.begin(), m_linkedItems.end(), aItem ); m_linkedItems.Erase( aItem );
return m_linkedItems.Size() == 0;
if( f != m_linkedItems.end() )
f = m_linkedItems.erase( f );
return m_linkedItems.size() == 0;
} }
///> For trivial joints, returns the segment adjacent to (aCurrent). For non-trival ones, returns ///> For trivial joints, returns the segment adjacent to (aCurrent). For non-trival ones, returns
...@@ -127,51 +122,41 @@ public: ...@@ -127,51 +122,41 @@ public:
return static_cast<PNS_SEGMENT*>( m_linkedItems[m_linkedItems[0] == aCurrent ? 1 : 0] ); return static_cast<PNS_SEGMENT*>( m_linkedItems[m_linkedItems[0] == aCurrent ? 1 : 0] );
} }
PNS_VIA* Via()
/// trivial accessors
const HASH_TAG& Tag() const
{ {
for( LINKED_ITEMS::iterator i = m_linkedItems.begin(); i != m_linkedItems.end(); ++i ) return m_tag;
{ }
if( (*i)->Kind() == PNS_ITEM::VIA )
return (PNS_VIA*)( *i );
}
return NULL; const VECTOR2I& Pos() const
{
return m_tag.pos;
} }
/// trivial accessors int Net() const
const HASH_TAG& Tag() const {
{ return m_tag.net;
return m_tag;
} }
const VECTOR2I& Pos() const const LINKED_ITEMS& LinkList() const
{ {
return m_tag.pos; return m_linkedItems.CItems();
} }
int Net() const const PNS_ITEMSET& CLinks() const
{ {
return m_tag.net; return m_linkedItems;
} }
LINKED_ITEMS& LinkList() PNS_ITEMSET Links() const
{ {
return m_linkedItems; return m_linkedItems;
} }
///> Returns the number of linked items of types listed in aMask.
int LinkCount( int aMask = -1 ) const int LinkCount( int aMask = -1 ) const
{ {
int n = 0; return m_linkedItems.Count( aMask );
for( LINKED_ITEMS::const_iterator i = m_linkedItems.begin();
i != m_linkedItems.end(); ++i )
{
if( (*i)->Kind() & aMask )
n++;
}
return n;
} }
void Dump() const; void Dump() const;
...@@ -188,11 +173,9 @@ public: ...@@ -188,11 +173,9 @@ public:
m_layers.Merge( aJoint.m_layers ); m_layers.Merge( aJoint.m_layers );
// fixme: duplicate links (?) BOOST_FOREACH( PNS_ITEM* item, aJoint.LinkList() )
for( LINKED_ITEMS::const_iterator i = aJoint.m_linkedItems.begin();
i != aJoint.m_linkedItems.end(); ++i )
{ {
m_linkedItems.push_back( *i ); m_linkedItems.Add( item );
} }
} }
...@@ -207,7 +190,7 @@ private: ...@@ -207,7 +190,7 @@ private:
HASH_TAG m_tag; HASH_TAG m_tag;
///> list of items linked to this joint ///> list of items linked to this joint
LINKED_ITEMS m_linkedItems; PNS_ITEMSET m_linkedItems;
}; };
......
...@@ -108,7 +108,7 @@ public: ...@@ -108,7 +108,7 @@ public:
///> Shortcut for comparisons/overlap tests ///> Shortcut for comparisons/overlap tests
static PNS_LAYERSET All() static PNS_LAYERSET All()
{ {
return PNS_LAYERSET( 0, 64 ); return PNS_LAYERSET( 0, 256 ); // fixme: use layer IDs header
} }
private: private:
......
...@@ -123,7 +123,7 @@ int PNS_LINE::Marker()const ...@@ -123,7 +123,7 @@ int PNS_LINE::Marker()const
} }
void PNS_LINE::copyLinks( const PNS_LINE *aParent ) void PNS_LINE::copyLinks( const PNS_LINE* aParent )
{ {
if( aParent->m_segmentRefs == NULL ) if( aParent->m_segmentRefs == NULL )
{ {
...@@ -190,6 +190,9 @@ bool PNS_LINE::Walkaround( SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN& aPre, ...@@ -190,6 +190,9 @@ bool PNS_LINE::Walkaround( SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN& aPre,
line.Intersect( aObstacle, ips ); line.Intersect( aObstacle, ips );
aWalk.Clear();
aPost.Clear();
int nearest_dist = INT_MAX; int nearest_dist = INT_MAX;
int farthest_dist = 0; int farthest_dist = 0;
...@@ -410,7 +413,7 @@ void PNS_LINE::DragCorner ( const VECTOR2I& aP, int aIndex, int aSnappingThresho ...@@ -410,7 +413,7 @@ void PNS_LINE::DragCorner ( const VECTOR2I& aP, int aIndex, int aSnappingThresho
if( aIndex == 0 ) if( aIndex == 0 )
path = dragCornerInternal( m_line.Reverse(), snapped ).Reverse(); path = dragCornerInternal( m_line.Reverse(), snapped ).Reverse();
else if ( aIndex == m_line.SegmentCount() ) else if( aIndex == m_line.SegmentCount() )
path = dragCornerInternal( m_line, snapped ); path = dragCornerInternal( m_line, snapped );
else else
{ {
......
This diff is collapsed.
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <geometry/shape.h> #include <geometry/shape.h>
#include <geometry/shape_line_chain.h> #include <geometry/shape_line_chain.h>
#include "pns_sizes_settings.h"
#include "pns_node.h" #include "pns_node.h"
#include "pns_via.h" #include "pns_via.h"
#include "pns_line.h" #include "pns_line.h"
...@@ -35,11 +36,14 @@ class PNS_ROUTER; ...@@ -35,11 +36,14 @@ class PNS_ROUTER;
class PNS_SHOVE; class PNS_SHOVE;
class PNS_OPTIMIZER; class PNS_OPTIMIZER;
class PNS_ROUTER_BASE; class PNS_ROUTER_BASE;
class PNS_VIA;
class PNS_SIZES_SETTINGS;
/** /**
* Class PNS_LINE_PLACER * Class PNS_LINE_PLACER
* *
* Single track placement algorithm. Interactively routes a track. * Single track placement algorithm. Interactively routes a track.
* Applies shove and walkaround algorithms when needed. * Applies shove and walkaround algorithms when needed.
*/ */
...@@ -51,7 +55,7 @@ public: ...@@ -51,7 +55,7 @@ public:
/** /**
* Function Start() * Function Start()
* *
* Starts routing a single track at point aP, taking item aStartItem as anchor * Starts routing a single track at point aP, taking item aStartItem as anchor
* (unless NULL). * (unless NULL).
*/ */
...@@ -59,8 +63,8 @@ public: ...@@ -59,8 +63,8 @@ public:
/** /**
* Function Move() * Function Move()
* *
* Moves the end of the currently routed trace to the point aP, taking * Moves the end of the currently routed trace to the point aP, taking
* aEndItem as anchor (if not NULL). * aEndItem as anchor (if not NULL).
* (unless NULL). * (unless NULL).
*/ */
...@@ -68,7 +72,7 @@ public: ...@@ -68,7 +72,7 @@ public:
/** /**
* Function FixRoute() * Function FixRoute()
* *
* Commits the currently routed track to the parent node, taking * Commits the currently routed track to the parent node, taking
* aP as the final end point and aEndItem as the final anchor (if provided). * aP as the final end point and aEndItem as the final anchor (if provided).
* @return true, if route has been commited. May return false if the routing * @return true, if route has been commited. May return false if the routing
...@@ -76,31 +80,21 @@ public: ...@@ -76,31 +80,21 @@ public:
* if Settings.CanViolateDRC() is on. * if Settings.CanViolateDRC() is on.
*/ */
bool FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ); bool FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem );
/** /**
* Function AddVia() * Function ToggleVia()
* *
* Enables/disables a via at the end of currently routed trace. * Enables/disables a via at the end of currently routed trace.
* @param aEnabled if true, a via is attached during placement
* @param aDiameter diameter of the via
* @param aDrill drill of the via
* @param aType Type of the via
*/ */
void AddVia( bool aEnabled, int aDiameter, int aDrill, VIATYPE_T aType ); void ToggleVia( bool aEnabled );
/** /**
* Function SetLayer() * Function SetLayer()
* *
* Sets the current routing layer. * Sets the current routing layer.
*/ */
void SetLayer( int aLayer ); bool SetLayer( int aLayer );
/**
* Function SetWidth()
*
* Sets the current track width.
*/
void SetWidth( int aWidth );
/** /**
* Function Head() * Function Head()
...@@ -109,7 +103,7 @@ public: ...@@ -109,7 +103,7 @@ public:
* that has not "settled" yet. * that has not "settled" yet.
*/ */
const PNS_LINE& Head() const { return m_head; } const PNS_LINE& Head() const { return m_head; }
/** /**
* Function Tail() * Function Tail()
* *
...@@ -137,7 +131,7 @@ public: ...@@ -137,7 +131,7 @@ public:
* *
* Returns the current end of the line being placed. It may not be equal * Returns the current end of the line being placed. It may not be equal
* to the cursor position due to collisions. * to the cursor position due to collisions.
*/ */
const VECTOR2I& CurrentEnd() const const VECTOR2I& CurrentEnd() const
{ {
return m_currentEnd; return m_currentEnd;
...@@ -147,8 +141,8 @@ public: ...@@ -147,8 +141,8 @@ public:
* Function CurrentNet() * Function CurrentNet()
* *
* Returns the net code of currently routed track. * Returns the net code of currently routed track.
*/ */
int CurrentNet() const int CurrentNet() const
{ {
return m_currentNet; return m_currentNet;
} }
...@@ -157,8 +151,8 @@ public: ...@@ -157,8 +151,8 @@ public:
* Function CurrentLayer() * Function CurrentLayer()
* *
* Returns the layer of currently routed track. * Returns the layer of currently routed track.
*/ */
int CurrentLayer() const int CurrentLayer() const
{ {
return m_currentLayer; return m_currentLayer;
} }
...@@ -169,14 +163,14 @@ public: ...@@ -169,14 +163,14 @@ public:
* Returns the most recent world state. * Returns the most recent world state.
*/ */
PNS_NODE* CurrentNode( bool aLoopsRemoved = false ) const; PNS_NODE* CurrentNode( bool aLoopsRemoved = false ) const;
/** /**
* Function FlipPosture() * Function FlipPosture()
* *
* Toggles the current posture (straight/diagonal) of the trace head. * Toggles the current posture (straight/diagonal) of the trace head.
*/ */
void FlipPosture(); void FlipPosture();
/** /**
* Function UpdateSizes() * Function UpdateSizes()
* *
...@@ -184,8 +178,9 @@ public: ...@@ -184,8 +178,9 @@ public:
* a settings class. Used to dynamically change these parameters as * a settings class. Used to dynamically change these parameters as
* the track is routed. * the track is routed.
*/ */
void UpdateSizes( const PNS_ROUTING_SETTINGS& aSettings ); void UpdateSizes( const PNS_SIZES_SETTINGS& aSizes );
bool IsPlacingVia() const { return m_placingVia; }
private: private:
/** /**
* Function route() * Function route()
...@@ -203,24 +198,24 @@ private: ...@@ -203,24 +198,24 @@ private:
* Function updateLeadingRatLine() * Function updateLeadingRatLine()
* *
* Draws the "leading" ratsnest line, which connects the end of currently * Draws the "leading" ratsnest line, which connects the end of currently
* routed track and the nearest yet unrouted item. If the routing for * routed track and the nearest yet unrouted item. If the routing for
* current net is complete, draws nothing. * current net is complete, draws nothing.
*/ */
void updateLeadingRatLine(); void updateLeadingRatLine();
/** /**
* Function setWorld() * Function setWorld()
* *
* Sets the board to route. * Sets the board to route.
*/ */
void setWorld( PNS_NODE* aWorld ); void setWorld( PNS_NODE* aWorld );
/** /**
* Function startPlacement() * Function startPlacement()
* *
* Initializes placement of a new line with given parameters. * Initializes placement of a new line with given parameters.
*/ */
void startPlacement( const VECTOR2I& aStart, int aNet, int aWidth, int aLayer ); void initPlacement( bool aSplitSeg = false );
/** /**
* Function setInitialDirection() * Function setInitialDirection()
...@@ -250,10 +245,10 @@ private: ...@@ -250,10 +245,10 @@ private:
* Function simplifyNewLine() * Function simplifyNewLine()
* *
* Assembles a line starting from segment aLatest, removes collinear segments * Assembles a line starting from segment aLatest, removes collinear segments
* and redundant vertexes. If a simplification bhas been found, replaces the * and redundant vertexes. If a simplification bhas been found, replaces the
* old line with the simplified one in aNode. * old line with the simplified one in aNode.
*/ */
void simplifyNewLine( PNS_NODE *aNode, PNS_SEGMENT *aLatest ); void simplifyNewLine( PNS_NODE* aNode, PNS_SEGMENT* aLatest );
/** /**
* Function handleViaPlacement() * Function handleViaPlacement()
...@@ -346,7 +341,9 @@ private: ...@@ -346,7 +341,9 @@ private:
///> route step, mark obstacles mode ///> route step, mark obstacles mode
bool rhMarkObstacles( const VECTOR2I& aP, PNS_LINE& aNewHead ); bool rhMarkObstacles( const VECTOR2I& aP, PNS_LINE& aNewHead );
const PNS_VIA makeVia ( const VECTOR2I& aP );
///> current routing direction ///> current routing direction
DIRECTION_45 m_direction; DIRECTION_45 m_direction;
...@@ -378,6 +375,8 @@ private: ...@@ -378,6 +375,8 @@ private:
///> Postprocessed world state (including marked collisions & removed loops) ///> Postprocessed world state (including marked collisions & removed loops)
PNS_NODE* m_lastNode; PNS_NODE* m_lastNode;
PNS_SIZES_SETTINGS m_sizes;
///> Are we placing a via? ///> Are we placing a via?
bool m_placingVia; bool m_placingVia;
...@@ -386,9 +385,6 @@ private: ...@@ -386,9 +385,6 @@ private:
///> current via drill ///> current via drill
int m_viaDrill; int m_viaDrill;
///> current via type
VIATYPE_T m_viaType;
///> current track width ///> current track width
int m_currentWidth; int m_currentWidth;
...@@ -397,11 +393,16 @@ private: ...@@ -397,11 +393,16 @@ private:
int m_currentLayer; int m_currentLayer;
bool m_startsOnVia; bool m_startsOnVia;
VECTOR2I m_originalStart, m_currentEnd, m_currentStart; VECTOR2I m_currentEnd, m_currentStart;
PNS_LINE m_currentTrace; PNS_LINE m_currentTrace;
PNS_MODE m_currentMode; PNS_MODE m_currentMode;
PNS_ITEM* m_startItem;
bool m_idle;
bool m_chainedPlacement;
bool m_splitSeg;
}; };
#endif // __PNS_LINE_PLACER_H #endif // __PNS_LINE_PLACER_H
...@@ -121,7 +121,6 @@ PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad ) ...@@ -121,7 +121,6 @@ PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad )
switch( aPad->GetAttribute() ) switch( aPad->GetAttribute() )
{ {
case PAD_STANDARD: case PAD_STANDARD:
layers = PNS_LAYERSET( 0, MAX_CU_LAYERS - 1 ); // TODO necessary? it is already initialized
break; break;
case PAD_SMD: case PAD_SMD:
...@@ -249,31 +248,6 @@ void PNS_ROUTER::SetBoard( BOARD* aBoard ) ...@@ -249,31 +248,6 @@ void PNS_ROUTER::SetBoard( BOARD* aBoard )
TRACE( 1, "m_board = %p\n", m_board ); TRACE( 1, "m_board = %p\n", m_board );
} }
int PNS_ROUTER::NextCopperLayer( bool aUp )
{
LSET mask = m_board->GetEnabledLayers() & m_board->GetVisibleLayers();
LAYER_NUM l = m_currentLayer;
do
{
l += ( aUp ? 1 : -1 );
if( l >= MAX_CU_LAYERS )
l = 0;
if( l < 0 )
l = MAX_CU_LAYERS - 1;
if( mask[l] )
return l;
}
while( l != m_currentLayer );
return l;
}
void PNS_ROUTER::SyncWorld() void PNS_ROUTER::SyncWorld()
{ {
if( !m_board ) if( !m_board )
...@@ -324,10 +298,6 @@ PNS_ROUTER::PNS_ROUTER() ...@@ -324,10 +298,6 @@ PNS_ROUTER::PNS_ROUTER()
m_clearanceFunc = NULL; m_clearanceFunc = NULL;
m_currentLayer = 1;
m_placingVia = false;
m_startsOnVia = false;
m_currentNet = -1;
m_state = IDLE; m_state = IDLE;
m_world = NULL; m_world = NULL;
m_placer = NULL; m_placer = NULL;
...@@ -483,51 +453,21 @@ bool PNS_ROUTER::StartDragging( const VECTOR2I& aP, PNS_ITEM* aStartItem ) ...@@ -483,51 +453,21 @@ bool PNS_ROUTER::StartDragging( const VECTOR2I& aP, PNS_ITEM* aStartItem )
return true; return true;
} }
bool PNS_ROUTER::StartRouting( const VECTOR2I& aP, PNS_ITEM* aStartItem, int aLayer )
bool PNS_ROUTER::StartRouting( const VECTOR2I& aP, PNS_ITEM* aStartItem )
{ {
m_state = ROUTE_TRACK;
m_placer = new PNS_LINE_PLACER( this ); m_placer = new PNS_LINE_PLACER( this );
m_placer->SetLayer( m_currentLayer );
const BOARD_DESIGN_SETTINGS& dsnSettings = m_board->GetDesignSettings();
if( dsnSettings.UseNetClassTrack() && aStartItem != NULL ) // netclass value
{
m_settings.SetTrackWidth( aStartItem->Parent()->GetNetClass()->GetTrackWidth() );
}
else
{
m_settings.SetTrackWidth( dsnSettings.GetCurrentTrackWidth() );
}
if( dsnSettings.UseNetClassVia() && aStartItem != NULL ) // netclass value
{
m_settings.SetViaDiameter( aStartItem->Parent()->GetNetClass()->GetViaDiameter() );
m_settings.SetViaDrill( aStartItem->Parent()->GetNetClass()->GetViaDrill() );
}
else
{
m_settings.SetViaDiameter( dsnSettings.GetCurrentViaSize() );
m_settings.SetViaDrill( dsnSettings.GetCurrentViaDrill() );
}
m_placer->UpdateSizes( m_settings ); m_placer->UpdateSizes ( m_sizes );
m_placer->SetLayer( aLayer );
m_placer->Start( aP, aStartItem ); m_placer->Start( aP, aStartItem );
m_currentEnd = aP; m_currentEnd = aP;
m_currentEndItem = NULL; m_currentEndItem = NULL;
m_state = ROUTE_TRACK;
return true; return true;
} }
const VECTOR2I PNS_ROUTER::CurrentEnd() const
{
return m_currentEnd;
}
void PNS_ROUTER::eraseView() void PNS_ROUTER::eraseView()
{ {
BOOST_FOREACH( BOARD_ITEM* item, m_hiddenItems ) BOOST_FOREACH( BOARD_ITEM* item, m_hiddenItems )
...@@ -564,7 +504,7 @@ void PNS_ROUTER::DisplayItem( const PNS_ITEM* aItem, int aColor, int aClearance ...@@ -564,7 +504,7 @@ void PNS_ROUTER::DisplayItem( const PNS_ITEM* aItem, int aColor, int aClearance
void PNS_ROUTER::DisplayItems( const PNS_ITEMSET& aItems ) void PNS_ROUTER::DisplayItems( const PNS_ITEMSET& aItems )
{ {
BOOST_FOREACH( const PNS_ITEM *item, aItems.CItems() ) BOOST_FOREACH( const PNS_ITEM* item, aItems.CItems() )
DisplayItem( item ); DisplayItem( item );
} }
...@@ -664,7 +604,7 @@ void PNS_ROUTER::updateView( PNS_NODE* aNode, PNS_ITEMSET& aCurrent ) ...@@ -664,7 +604,7 @@ void PNS_ROUTER::updateView( PNS_NODE* aNode, PNS_ITEMSET& aCurrent )
return; return;
if( Settings().Mode() == RM_MarkObstacles ) if( Settings().Mode() == RM_MarkObstacles )
markViolations(aNode, aCurrent, removed); markViolations( aNode, aCurrent, removed );
aNode->GetUpdatedItems( removed, added ); aNode->GetUpdatedItems( removed, added );
...@@ -689,13 +629,14 @@ void PNS_ROUTER::updateView( PNS_NODE* aNode, PNS_ITEMSET& aCurrent ) ...@@ -689,13 +629,14 @@ void PNS_ROUTER::updateView( PNS_NODE* aNode, PNS_ITEMSET& aCurrent )
} }
void PNS_ROUTER::ApplySettings() void PNS_ROUTER::UpdateSizes ( const PNS_SIZES_SETTINGS& aSizes )
{ {
m_sizes = aSizes;
// Change track/via size settings // Change track/via size settings
if( m_state == ROUTE_TRACK) if( m_state == ROUTE_TRACK)
{ {
m_placer->UpdateSizes( m_settings ); m_placer->UpdateSizes( m_sizes );
m_placer->Move( m_currentEnd, m_currentEndItem );
movePlacing( m_currentEnd, m_currentEndItem ); movePlacing( m_currentEnd, m_currentEndItem );
} }
} }
...@@ -791,26 +732,6 @@ void PNS_ROUTER::CommitRouting( PNS_NODE* aNode ) ...@@ -791,26 +732,6 @@ void PNS_ROUTER::CommitRouting( PNS_NODE* aNode )
} }
PNS_VIA* PNS_ROUTER::checkLoneVia( PNS_JOINT* aJoint ) const
{
PNS_VIA* theVia = NULL;
PNS_LAYERSET l;
BOOST_FOREACH( PNS_ITEM* item, aJoint->LinkList() )
{
if( item->Kind() == PNS_ITEM::VIA )
theVia = static_cast<PNS_VIA*>( item );
l.Merge( item->Layers() );
}
if( l.Start() == l.End() )
return theVia;
return NULL;
}
bool PNS_ROUTER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) bool PNS_ROUTER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
{ {
bool rv = false; bool rv = false;
...@@ -819,8 +740,6 @@ bool PNS_ROUTER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) ...@@ -819,8 +740,6 @@ bool PNS_ROUTER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
{ {
case ROUTE_TRACK: case ROUTE_TRACK:
rv = m_placer->FixRoute( aP, aEndItem ); rv = m_placer->FixRoute( aP, aEndItem );
m_startsOnVia = m_placingVia;
m_placingVia = false;
break; break;
case DRAG_SEGMENT: case DRAG_SEGMENT:
...@@ -841,7 +760,17 @@ bool PNS_ROUTER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) ...@@ -841,7 +760,17 @@ bool PNS_ROUTER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
void PNS_ROUTER::StopRouting() void PNS_ROUTER::StopRouting()
{ {
// Update the ratsnest with new changes // Update the ratsnest with new changes
m_board->GetRatsnest()->Recalculate( m_currentNet ); if( m_placer )
{
int n = m_placer->CurrentNet();
if( n >= 0)
{
// Update the ratsnest with new changes
m_board->GetRatsnest()->Recalculate( n );
}
}
if( !RoutingInProgress() ) if( !RoutingInProgress() )
return; return;
...@@ -868,7 +797,7 @@ void PNS_ROUTER::FlipPosture() ...@@ -868,7 +797,7 @@ void PNS_ROUTER::FlipPosture()
if( m_state == ROUTE_TRACK ) if( m_state == ROUTE_TRACK )
{ {
m_placer->FlipPosture(); m_placer->FlipPosture();
m_placer->Move( m_currentEnd, m_currentEndItem ); movePlacing ( m_currentEnd, m_currentEndItem );
} }
} }
...@@ -877,77 +806,38 @@ void PNS_ROUTER::SwitchLayer( int aLayer ) ...@@ -877,77 +806,38 @@ void PNS_ROUTER::SwitchLayer( int aLayer )
{ {
switch( m_state ) switch( m_state )
{ {
case IDLE: case ROUTE_TRACK:
m_currentLayer = aLayer;
break;
case ROUTE_TRACK:
if( m_startsOnVia )
{
m_currentLayer = aLayer;
m_placer->SetLayer( aLayer ); m_placer->SetLayer( aLayer );
} break;
break; default:
break;
default:
break;
} }
} }
void PNS_ROUTER::ToggleViaPlacement(VIATYPE_T type) void PNS_ROUTER::ToggleViaPlacement()
{ {
const int layercount = m_board->GetDesignSettings().GetCopperLayerCount(); if( m_state == ROUTE_TRACK )
// Cannot place microvias or blind vias if not allowed (obvious)
if( ( type == VIA_BLIND_BURIED ) && ( !m_board->GetDesignSettings().m_BlindBuriedViaAllowed ) )
return;
if( ( type == VIA_MICROVIA ) && ( !m_board->GetDesignSettings().m_MicroViasAllowed ) )
return;
//Can only place through vias on 2-layer boards
if( ( type != VIA_THROUGH ) && ( layercount <= 2 ) )
return;
//Can only place microvias if we're on an outer layer, or directly adjacent to one
if( ( type == VIA_MICROVIA ) && ( m_currentLayer > In1_Cu ) && ( m_currentLayer < layercount-2 ) )
return;
//Cannot place blind vias with front/back as the layer pair, this doesn't make sense
if( ( type == VIA_BLIND_BURIED ) && ( Settings().GetLayerTop() == F_Cu ) && ( Settings().GetLayerBottom() == B_Cu ) )
return;
if( m_state == ROUTE_TRACK )
{ {
m_placingVia = !m_placingVia; bool toggle = !m_placer->IsPlacingVia();
m_placer->AddVia( m_placingVia, m_settings.GetViaDiameter(), m_settings.GetViaDrill(), type ); m_placer->ToggleVia( toggle );
} }
} }
int PNS_ROUTER::GetCurrentNet() const int PNS_ROUTER::GetCurrentNet() const
{ {
switch( m_state ) if( m_placer )
{ return m_placer->CurrentNet();
case ROUTE_TRACK: return -1;
return m_placer->CurrentNet();
default:
return m_currentNet;
}
} }
int PNS_ROUTER::GetCurrentLayer() const int PNS_ROUTER::GetCurrentLayer() const
{ {
switch( m_state ) if( m_placer )
{ return m_placer->CurrentLayer();
case ROUTE_TRACK: return -1;
return m_placer->CurrentLayer();
default:
return m_currentLayer;
}
} }
...@@ -968,3 +858,11 @@ void PNS_ROUTER::DumpLog() ...@@ -968,3 +858,11 @@ void PNS_ROUTER::DumpLog()
if( logger ) if( logger )
logger->Save( "/tmp/shove.log" ); logger->Save( "/tmp/shove.log" );
} }
bool PNS_ROUTER::IsPlacingVia() const
{
if(!m_placer)
return NULL;
return m_placer->IsPlacingVia();
}
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <class_undoredo_container.h> #include <class_undoredo_container.h>
#include "pns_routing_settings.h" #include "pns_routing_settings.h"
#include "pns_sizes_settings.h"
#include "pns_item.h" #include "pns_item.h"
#include "pns_itemset.h" #include "pns_itemset.h"
#include "pns_node.h" #include "pns_node.h"
...@@ -86,13 +87,12 @@ public: ...@@ -86,13 +87,12 @@ public:
void SetView( KIGFX::VIEW* aView ); void SetView( KIGFX::VIEW* aView );
bool RoutingInProgress() const; bool RoutingInProgress() const;
bool StartRouting( const VECTOR2I& aP, PNS_ITEM* aItem ); bool StartRouting( const VECTOR2I& aP, PNS_ITEM* aItem, int aLayer );
void Move( const VECTOR2I& aP, PNS_ITEM* aItem ); void Move( const VECTOR2I& aP, PNS_ITEM* aItem );
bool FixRoute( const VECTOR2I& aP, PNS_ITEM* aItem ); bool FixRoute( const VECTOR2I& aP, PNS_ITEM* aItem );
void StopRouting(); void StopRouting();
const VECTOR2I CurrentEnd() const;
int GetClearance( const PNS_ITEM* aA, const PNS_ITEM* aB ) const; int GetClearance( const PNS_ITEM* aA, const PNS_ITEM* aB ) const;
...@@ -112,7 +112,7 @@ public: ...@@ -112,7 +112,7 @@ public:
void SwitchLayer( int layer ); void SwitchLayer( int layer );
void ToggleViaPlacement( VIATYPE_T type = VIA_NOT_DEFINED ); void ToggleViaPlacement();
int GetCurrentLayer() const; int GetCurrentLayer() const;
int GetCurrentNet() const; int GetCurrentNet() const;
...@@ -123,15 +123,7 @@ public: ...@@ -123,15 +123,7 @@ public:
{ {
return m_clearanceFunc; return m_clearanceFunc;
} }
bool IsPlacingVia() const;
bool IsPlacingVia() const
{
return m_placingVia;
}
int NextCopperLayer( bool aUp );
// typedef boost::optional<hoverItem> optHoverItem;
const PNS_ITEMSET QueryHoverItems( const VECTOR2I& aP ); const PNS_ITEMSET QueryHoverItems( const VECTOR2I& aP );
const VECTOR2I SnapToItem( PNS_ITEM* aItem, VECTOR2I aP, bool& aSplitsSegment ); const VECTOR2I SnapToItem( PNS_ITEM* aItem, VECTOR2I aP, bool& aSplitsSegment );
...@@ -175,7 +167,7 @@ public: ...@@ -175,7 +167,7 @@ public:
* Applies stored settings. * Applies stored settings.
* @see Settings() * @see Settings()
*/ */
void ApplySettings(); void UpdateSizes( const PNS_SIZES_SETTINGS& aSizes );
/** /**
* Changes routing settings to ones passed in the parameter. * Changes routing settings to ones passed in the parameter.
...@@ -184,8 +176,6 @@ public: ...@@ -184,8 +176,6 @@ public:
void LoadSettings( const PNS_ROUTING_SETTINGS& aSettings ) void LoadSettings( const PNS_ROUTING_SETTINGS& aSettings )
{ {
m_settings = aSettings; m_settings = aSettings;
ApplySettings();
} }
void EnableSnapping( bool aEnable ) void EnableSnapping( bool aEnable )
...@@ -198,6 +188,11 @@ public: ...@@ -198,6 +188,11 @@ public:
return m_snappingEnabled; return m_snappingEnabled;
} }
PNS_SIZES_SETTINGS& Sizes()
{
return m_sizes;
}
private: private:
void movePlacing( const VECTOR2I& aP, PNS_ITEM* aItem ); void movePlacing( const VECTOR2I& aP, PNS_ITEM* aItem );
void moveDragging( const VECTOR2I& aP, PNS_ITEM* aItem ); void moveDragging( const VECTOR2I& aP, PNS_ITEM* aItem );
...@@ -211,7 +206,6 @@ private: ...@@ -211,7 +206,6 @@ private:
PNS_ITEM* pickSingleItem( PNS_ITEMSET& aItems ) const; PNS_ITEM* pickSingleItem( PNS_ITEMSET& aItems ) const;
void splitAdjacentSegments( PNS_NODE* aNode, PNS_ITEM* aSeg, const VECTOR2I& aP ); void splitAdjacentSegments( PNS_NODE* aNode, PNS_ITEM* aSeg, const VECTOR2I& aP );
PNS_VIA* checkLoneVia( PNS_JOINT* aJoint ) const;
PNS_ITEM* syncPad( D_PAD* aPad ); PNS_ITEM* syncPad( D_PAD* aPad );
PNS_ITEM* syncTrack( TRACK* aTrack ); PNS_ITEM* syncTrack( TRACK* aTrack );
...@@ -223,11 +217,9 @@ private: ...@@ -223,11 +217,9 @@ private:
void highlightCurrent( bool enabled ); void highlightCurrent( bool enabled );
void markViolations( PNS_NODE* aNode, PNS_ITEMSET& aCurrent, PNS_NODE::ITEM_VECTOR& aRemoved ); void markViolations( PNS_NODE* aNode, PNS_ITEMSET& aCurrent, PNS_NODE::ITEM_VECTOR& aRemoved );
int m_currentLayer;
int m_currentNet;
VECTOR2I m_currentEnd;
RouterState m_state; RouterState m_state;
BOARD* m_board; BOARD* m_board;
...@@ -235,9 +227,7 @@ private: ...@@ -235,9 +227,7 @@ private:
PNS_NODE* m_lastNode; PNS_NODE* m_lastNode;
PNS_LINE_PLACER* m_placer; PNS_LINE_PLACER* m_placer;
PNS_DRAGGER* m_dragger; PNS_DRAGGER* m_dragger;
PNS_LINE* m_draggedLine;
PNS_SHOVE* m_shove; PNS_SHOVE* m_shove;
int m_draggedSegmentIndex;
int m_iterLimit; int m_iterLimit;
bool m_showInterSteps; bool m_showInterSteps;
int m_snapshotIter; int m_snapshotIter;
...@@ -247,11 +237,6 @@ private: ...@@ -247,11 +237,6 @@ private:
PNS_ITEM* m_currentEndItem; PNS_ITEM* m_currentEndItem;
VECTOR2I m_currentEnd;
VECTOR2I m_currentStart;
VECTOR2I m_originalStart;
bool m_placingVia;
bool m_startsOnVia;
bool m_snappingEnabled; bool m_snappingEnabled;
bool m_violation; bool m_violation;
...@@ -264,6 +249,7 @@ private: ...@@ -264,6 +249,7 @@ private:
///> Stores list of modified items in the current operation ///> Stores list of modified items in the current operation
PICKED_ITEMS_LIST m_undoBuffer; PICKED_ITEMS_LIST m_undoBuffer;
PNS_SIZES_SETTINGS m_sizes;
}; };
#endif #endif
...@@ -21,10 +21,12 @@ ...@@ -21,10 +21,12 @@
#ifndef __PNS_ROUTING_SETTINGS #ifndef __PNS_ROUTING_SETTINGS
#define __PNS_ROUTING_SETTINGS #define __PNS_ROUTING_SETTINGS
#include <cstdio>
#include "time_limit.h" #include "time_limit.h"
class DIRECTION_45; class DIRECTION_45;
///> Routing modes ///> Routing modes
enum PNS_MODE enum PNS_MODE
{ {
...@@ -35,9 +37,9 @@ enum PNS_MODE ...@@ -35,9 +37,9 @@ enum PNS_MODE
}; };
///> Optimization effort ///> Optimization effort
enum PNS_OPTIMIZATION_EFFORT enum PNS_OPTIMIZATION_EFFORT
{ {
OE_LOW = 0, OE_LOW = 0,
OE_MEDIUM = 1, OE_MEDIUM = 1,
OE_FULL = 2 OE_FULL = 2
}; };
...@@ -58,44 +60,44 @@ public: ...@@ -58,44 +60,44 @@ public:
///> Sets the routing mode. ///> Sets the routing mode.
void SetMode( PNS_MODE aMode ) { m_routingMode = aMode; } void SetMode( PNS_MODE aMode ) { m_routingMode = aMode; }
///> Returns the optimizer effort. Bigger means cleaner traces, but slower routing. ///> Returns the optimizer effort. Bigger means cleaner traces, but slower routing.
PNS_OPTIMIZATION_EFFORT OptimizerEffort() const { return m_optimizerEffort; } PNS_OPTIMIZATION_EFFORT OptimizerEffort() const { return m_optimizerEffort; }
///> Sets the optimizer effort. Bigger means cleaner traces, but slower routing. ///> Sets the optimizer effort. Bigger means cleaner traces, but slower routing.
void SetOptimizerEffort( PNS_OPTIMIZATION_EFFORT aEffort ) { m_optimizerEffort = aEffort; } void SetOptimizerEffort( PNS_OPTIMIZATION_EFFORT aEffort ) { m_optimizerEffort = aEffort; }
///> Returns true if shoving vias is enbled. ///> Returns true if shoving vias is enbled.
bool ShoveVias() const { return m_shoveVias; } bool ShoveVias() const { return m_shoveVias; }
///> Enables/disables shoving vias. ///> Enables/disables shoving vias.
void SetShoveVias( bool aShoveVias ) { m_shoveVias = aShoveVias; } void SetShoveVias( bool aShoveVias ) { m_shoveVias = aShoveVias; }
///> Returns true if loop (redundant track) removal is on. ///> Returns true if loop (redundant track) removal is on.
bool RemoveLoops() const { return m_removeLoops; } bool RemoveLoops() const { return m_removeLoops; }
///> Enables/disables loop (redundant track) removal. ///> Enables/disables loop (redundant track) removal.
void SetRemoveLoops( bool aRemoveLoops ) { m_removeLoops = aRemoveLoops; } void SetRemoveLoops( bool aRemoveLoops ) { m_removeLoops = aRemoveLoops; }
///> Returns true if suggesting the finish of currently placed track is on. ///> Returns true if suggesting the finish of currently placed track is on.
bool SuggestFinish() { return m_suggestFinish; } bool SuggestFinish() { return m_suggestFinish; }
///> Enables displaying suggestions for finishing the currently placed track. ///> Enables displaying suggestions for finishing the currently placed track.
void SetSuggestFinish( bool aSuggestFinish ) { m_suggestFinish = aSuggestFinish; } void SetSuggestFinish( bool aSuggestFinish ) { m_suggestFinish = aSuggestFinish; }
///> Returns true if Smart Pads (automatic neckdown) is enabled. ///> Returns true if Smart Pads (automatic neckdown) is enabled.
bool SmartPads () const { return m_smartPads; } bool SmartPads () const { return m_smartPads; }
///> Enables/disables Smart Pads (automatic neckdown). ///> Enables/disables Smart Pads (automatic neckdown).
void SetSmartPads( bool aSmartPads ) { m_smartPads = aSmartPads; } void SetSmartPads( bool aSmartPads ) { m_smartPads = aSmartPads; }
///> Returns true if follow mouse mode is active (permanently on for the moment). ///> Returns true if follow mouse mode is active (permanently on for the moment).
bool FollowMouse() const bool FollowMouse() const
{ {
return m_followMouse && !( Mode() == RM_MarkObstacles ); return m_followMouse && !( Mode() == RM_MarkObstacles );
} }
///> Returns true if smoothing segments durign dragging is enabled. ///> Returns true if smoothing segments durign dragging is enabled.
bool SmoothDraggedSegments() const { return m_smoothDraggedSegments; } bool SmoothDraggedSegments() const { return m_smoothDraggedSegments; }
///> Enables/disabled smoothing segments during dragging. ///> Enables/disabled smoothing segments during dragging.
...@@ -104,21 +106,14 @@ public: ...@@ -104,21 +106,14 @@ public:
///> Returns true if jumping over unmovable obstacles is on. ///> Returns true if jumping over unmovable obstacles is on.
bool JumpOverObstacles() const { return m_jumpOverObstacles; } bool JumpOverObstacles() const { return m_jumpOverObstacles; }
///> Enables/disables jumping over unmovable obstacles. ///> Enables/disables jumping over unmovable obstacles.
void SetJumpOverObstacles( bool aJumpOverObstacles ) { m_jumpOverObstacles = aJumpOverObstacles; } void SetJumpOverObstacles( bool aJumpOverObstacles ) { m_jumpOverObstacles = aJumpOverObstacles; }
void SetStartDiagonal(bool aStartDiagonal) { m_startDiagonal = aStartDiagonal; } void SetStartDiagonal( bool aStartDiagonal ) { m_startDiagonal = aStartDiagonal; }
bool CanViolateDRC() const { return m_canViolateDRC; } bool CanViolateDRC() const { return m_canViolateDRC; }
void SetCanViolateDRC( bool aViolate ) { m_canViolateDRC = aViolate; } void SetCanViolateDRC( bool aViolate ) { m_canViolateDRC = aViolate; }
void SetTrackWidth( int aWidth ) { m_trackWidth = aWidth; }
int GetTrackWidth() const { return m_trackWidth; }
void SetViaDiameter( int aDiameter ) { m_viaDiameter = aDiameter; }
int GetViaDiameter() const { return m_viaDiameter; }
void SetViaDrill( int aDrill ) { m_viaDrill = aDrill; }
int GetViaDrill() const { return m_viaDrill; }
const DIRECTION_45 InitialDirection() const; const DIRECTION_45 InitialDirection() const;
int ShoveIterationLimit() const; int ShoveIterationLimit() const;
...@@ -127,22 +122,6 @@ public: ...@@ -127,22 +122,6 @@ public:
int WalkaroundIterationLimit() const { return m_walkaroundIterationLimit; }; int WalkaroundIterationLimit() const { return m_walkaroundIterationLimit; };
TIME_LIMIT WalkaroundTimeLimit() const; TIME_LIMIT WalkaroundTimeLimit() const;
void SetLayerPair( int aLayer1, int aLayer2 )
{
if( aLayer1 < aLayer2 )
{
m_layerTop = aLayer1;
m_layerBottom = aLayer2;
}
else
{
m_layerBottom = aLayer1;
m_layerTop = aLayer2;
}
}
int GetLayerTop() const { return m_layerTop; }
int GetLayerBottom() const { return m_layerBottom; }
private: private:
bool m_shoveVias; bool m_shoveVias;
...@@ -157,20 +136,12 @@ private: ...@@ -157,20 +136,12 @@ private:
PNS_MODE m_routingMode; PNS_MODE m_routingMode;
PNS_OPTIMIZATION_EFFORT m_optimizerEffort; PNS_OPTIMIZATION_EFFORT m_optimizerEffort;
int m_trackWidth;
int m_viaDiameter;
int m_viaDrill;
int m_preferredLayer;
int m_walkaroundIterationLimit; int m_walkaroundIterationLimit;
int m_shoveIterationLimit; int m_shoveIterationLimit;
TIME_LIMIT m_shoveTimeLimit; TIME_LIMIT m_shoveTimeLimit;
TIME_LIMIT m_walkaroundTimeLimit; TIME_LIMIT m_walkaroundTimeLimit;
// Routing layers pair
int m_layerTop;
int m_layerBottom;
}; };
#endif #endif
This diff is collapsed.
...@@ -37,7 +37,7 @@ class PNS_ROUTER; ...@@ -37,7 +37,7 @@ class PNS_ROUTER;
/** /**
* Class PNS_SHOVE * Class PNS_SHOVE
* *
* The actual Push and Shove algorithm. * The actual Push and Shove algorithm.
*/ */
class PNS_SHOVE : public PNS_ALGO_BASE class PNS_SHOVE : public PNS_ALGO_BASE
...@@ -88,11 +88,11 @@ private: ...@@ -88,11 +88,11 @@ private:
SHOVE_STATUS processSingleLine( PNS_LINE* aCurrent, PNS_LINE* aObstacle, PNS_LINE* aShoved ); SHOVE_STATUS processSingleLine( PNS_LINE* aCurrent, PNS_LINE* aObstacle, PNS_LINE* aShoved );
SHOVE_STATUS processHullSet( PNS_LINE* aCurrent, PNS_LINE* aObstacle, SHOVE_STATUS processHullSet( PNS_LINE* aCurrent, PNS_LINE* aObstacle,
PNS_LINE* aShoved, const HULL_SET& hulls ); PNS_LINE* aShoved, const HULL_SET& hulls );
bool reduceSpringback( const PNS_ITEMSET& aHeadItems ); bool reduceSpringback( const PNS_ITEMSET& aHeadItems );
bool pushSpringback( PNS_NODE* aNode, const PNS_ITEMSET &aHeadItems, bool pushSpringback( PNS_NODE* aNode, const PNS_ITEMSET &aHeadItems,
const PNS_COST_ESTIMATOR& aCost ); const PNS_COST_ESTIMATOR& aCost );
SHOVE_STATUS walkaroundLoneVia( PNS_LINE* aCurrent, PNS_LINE* aObstacle, PNS_LINE* aShoved ); SHOVE_STATUS walkaroundLoneVia( PNS_LINE* aCurrent, PNS_LINE* aObstacle, PNS_LINE* aShoved );
bool checkBumpDirection( PNS_LINE* aCurrent, PNS_LINE* aShoved ) const; bool checkBumpDirection( PNS_LINE* aCurrent, PNS_LINE* aShoved ) const;
...@@ -104,20 +104,20 @@ private: ...@@ -104,20 +104,20 @@ private:
SHOVE_STATUS pushVia( PNS_VIA* aVia, const VECTOR2I& aForce, int aCurrentRank ); SHOVE_STATUS pushVia( PNS_VIA* aVia, const VECTOR2I& aForce, int aCurrentRank );
void unwindStack( PNS_SEGMENT* aSeg ); void unwindStack( PNS_SEGMENT* aSeg );
void unwindStack( PNS_ITEM *aItem ); void unwindStack( PNS_ITEM* aItem );
void runOptimizer( PNS_NODE* aNode, PNS_LINE* aHead ); void runOptimizer( PNS_NODE* aNode, PNS_LINE* aHead );
void pushLine( PNS_LINE *aL ); void pushLine( PNS_LINE* aL );
void popLine(); void popLine();
const RANGE<int> findShovedVertexRange( PNS_LINE *aL ); const RANGE<int> findShovedVertexRange( PNS_LINE* aL );
PNS_LINE* assembleLine( const PNS_SEGMENT* aSeg, int* aIndex = NULL ); PNS_LINE* assembleLine( const PNS_SEGMENT* aSeg, int* aIndex = NULL );
PNS_LINE* cloneLine( const PNS_LINE* aLine ); PNS_LINE* cloneLine( const PNS_LINE* aLine );
SHOVE_STATUS shoveIteration( int aIter ); SHOVE_STATUS shoveIteration( int aIter );
SHOVE_STATUS shoveMainLoop(); SHOVE_STATUS shoveMainLoop();
std::vector<SPRINGBACK_TAG> m_nodeStack; std::vector<SPRINGBACK_TAG> m_nodeStack;
std::vector<PNS_LINE*> m_lineStack; std::vector<PNS_LINE*> m_lineStack;
...@@ -126,7 +126,7 @@ private: ...@@ -126,7 +126,7 @@ private:
PNS_NODE* m_root; PNS_NODE* m_root;
PNS_NODE* m_currentNode; PNS_NODE* m_currentNode;
OPT_LINE m_newHead; OPT_LINE m_newHead;
PNS_LOGGER m_logger; PNS_LOGGER m_logger;
......
/*
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2014 CERN
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <class_board.h>
#include "pns_item.h"
#include "pns_via.h"
#include "pns_solid.h"
#include "pns_node.h"
#include "pns_sizes_settings.h"
int PNS_SIZES_SETTINGS::inheritTrackWidth( PNS_ITEM* aItem )
{
VECTOR2I p;
assert( aItem->Owner() != NULL );
switch( aItem->Kind() )
{
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::SEGMENT:
return static_cast<PNS_SEGMENT*>( aItem )->Width();
default:
return 0;
}
PNS_JOINT* jt = aItem->Owner()->FindJoint( p, aItem );
assert( jt != NULL );
int mval = INT_MAX;
PNS_ITEMSET linkedSegs = jt->Links().ExcludeItem( aItem ).FilterKinds( PNS_ITEM::SEGMENT );
BOOST_FOREACH( PNS_ITEM* item, linkedSegs.Items() )
{
int w = static_cast<PNS_SEGMENT*>( item )->Width();
mval = std::min( w, mval );
}
return ( mval == INT_MAX ? 0 : mval );
}
void PNS_SIZES_SETTINGS::Init( BOARD* aBoard, PNS_ITEM* aStartItem, int aNet )
{
BOARD_DESIGN_SETTINGS &bds = aBoard->GetDesignSettings();
NETCLASSPTR netClass;
int net = aNet;
if( aStartItem )
net = aStartItem->Net();
if( net >= 0 )
{
NETINFO_ITEM* ni = aBoard->FindNet( net );
if( ni )
{
wxString netClassName = ni->GetClassName();
netClass = bds.m_NetClasses.Find( netClassName );
}
}
if( !netClass )
netClass = bds.GetDefault();
m_trackWidth = 0;
if( bds.m_UseConnectedTrackWidth && aStartItem != NULL )
{
m_trackWidth = inheritTrackWidth( aStartItem );
}
if( !m_trackWidth && ( bds.UseNetClassTrack() && netClass != NULL ) ) // netclass value
{
m_trackWidth = netClass->GetTrackWidth();
}
if( !m_trackWidth )
{
m_trackWidth = bds.GetCurrentTrackWidth();
}
if( bds.UseNetClassVia() && netClass != NULL ) // netclass value
{
m_viaDiameter = netClass->GetViaDiameter();
m_viaDrill = netClass->GetViaDrill();
}
else
{
m_viaDiameter = bds.GetCurrentViaSize();
m_viaDrill = bds.GetCurrentViaDrill();
}
m_layerPairs.clear();
}
void PNS_SIZES_SETTINGS::ClearLayerPairs()
{
m_layerPairs.clear();
}
void PNS_SIZES_SETTINGS::AddLayerPair( int aL1, int aL2 )
{
int top = std::min( aL1, aL2 );
int bottom = std::max( aL1, aL2 );
m_layerPairs[bottom] = top;
m_layerPairs[top] = bottom;
}
void PNS_SIZES_SETTINGS::ImportCurrent( BOARD_DESIGN_SETTINGS& aSettings )
{
m_trackWidth = aSettings.GetCurrentTrackWidth();
m_viaDiameter = aSettings.GetCurrentViaSize();
m_viaDrill = aSettings.GetCurrentViaDrill();
}
int PNS_SIZES_SETTINGS::GetLayerTop() const
{
if( m_layerPairs.empty() )
return F_Cu;
else
return m_layerPairs.begin()->first;
}
int PNS_SIZES_SETTINGS::GetLayerBottom() const
{
if( m_layerPairs.empty() )
return B_Cu;
else
return m_layerPairs.begin()->second;
}
/*
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2014 CERN
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __PNS_SIZES_SETTINGS_H
#define __PNS_SIZES_SETTINGS_H
#include <map>
#include <boost/optional.hpp>
#include "../class_track.h" // for VIATYPE_T
class BOARD;
class BOARD_DESIGN_SETTINGS;
class PNS_ITEM;
class PNS_SIZES_SETTINGS {
public:
PNS_SIZES_SETTINGS() :
m_trackWidth( 100000 ),
m_diffPairWidth( 100000 ),
m_diffPairGap( 125000 ),
m_viaDiameter( 500000 ),
m_viaDrill( 200000 ),
m_viaType( VIA_THROUGH )
{};
~PNS_SIZES_SETTINGS() {};
void Init( BOARD* aBoard, PNS_ITEM* aStartItem = NULL, int aNet = -1 );
void ImportCurrent ( BOARD_DESIGN_SETTINGS& aSettings );
void ClearLayerPairs();
void AddLayerPair( int aL1, int aL2 );
int TrackWidth() const { return m_trackWidth; }
void SetTrackWidth( int aWidth ) { m_trackWidth = aWidth; }
int DiffPairWidth() const { return m_diffPairWidth; }
int DiffPairGap() const { return m_diffPairGap; }
int ViaDiameter() const { return m_viaDiameter; }
void SetViaDiameter( int aDiameter) { m_viaDiameter = aDiameter; }
int ViaDrill() const { return m_viaDrill; }
void SetViaDrill( int aDrill ) { m_viaDrill = aDrill; }
boost::optional<int> PairedLayer ( int aLayerId )
{
if( m_layerPairs.find(aLayerId) == m_layerPairs.end() )
return boost::optional<int>();
return m_layerPairs [ aLayerId ];
}
int GetLayerTop() const;
int GetLayerBottom() const;
void SetViaType( VIATYPE_T aViaType ) { m_viaType = aViaType; }
VIATYPE_T ViaType() const { return m_viaType; }
private:
int inheritTrackWidth( PNS_ITEM* aItem );
int m_trackWidth;
int m_diffPairWidth;
int m_diffPairGap;
int m_viaDiameter;
int m_viaDrill;
VIATYPE_T m_viaType;
std::map<int, int> m_layerPairs;
};
#endif // __PNS_SIZES_SETTINGS_H
...@@ -48,12 +48,12 @@ public: ...@@ -48,12 +48,12 @@ public:
m_drill = aDrill; m_drill = aDrill;
m_shape = SHAPE_CIRCLE( aPos, aDiameter / 2 ); m_shape = SHAPE_CIRCLE( aPos, aDiameter / 2 );
m_viaType = aViaType; m_viaType = aViaType;
//If we're a through-board via, use all layers regardless of the set passed //If we're a through-board via, use all layers regardless of the set passed
if( aViaType == VIA_THROUGH ) if( aViaType == VIA_THROUGH )
{ {
PNS_LAYERSET allLayers( 0, MAX_CU_LAYERS - 1 ); PNS_LAYERSET allLayers( 0, MAX_CU_LAYERS - 1 );
SetLayers( allLayers); SetLayers( allLayers );
} }
} }
......
...@@ -57,7 +57,7 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::singleStep( PNS_LINE& aPath, ...@@ -57,7 +57,7 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::singleStep( PNS_LINE& aPath,
VECTOR2I last = aPath.CPoint( -1 ); VECTOR2I last = aPath.CPoint( -1 );
if( ( current_obs->m_hull ).PointInside( last ) ) if( ( current_obs->m_hull ).PointInside( last ) || ( current_obs->m_hull ).PointOnEdge( last ) )
{ {
m_recursiveBlockageCount++; m_recursiveBlockageCount++;
...@@ -83,10 +83,10 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::singleStep( PNS_LINE& aPath, ...@@ -83,10 +83,10 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::singleStep( PNS_LINE& aPath,
m_logger.Log( &current_obs->m_hull, 2, "hull" ); m_logger.Log( &current_obs->m_hull, 2, "hull" );
m_logger.Log( current_obs->m_item, 3, "item" ); m_logger.Log( current_obs->m_item, 3, "item" );
#endif #endif
int len_pre = path_walk[0].Length(); int len_pre = path_walk[0].Length();
int len_alt = path_walk[1].Length(); int len_alt = path_walk[1].Length();
PNS_LINE walk_path( aPath, path_walk[1] ); PNS_LINE walk_path( aPath, path_walk[1] );
bool alt_collides = m_world->CheckColliding( &walk_path, m_itemMask ); bool alt_collides = m_world->CheckColliding( &walk_path, m_itemMask );
...@@ -99,7 +99,10 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::singleStep( PNS_LINE& aPath, ...@@ -99,7 +99,10 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::singleStep( PNS_LINE& aPath,
pnew.Append( path_walk[1] ); pnew.Append( path_walk[1] );
pnew.Append( path_post[1] ); pnew.Append( path_post[1] );
current_obs = nearestObstacle( PNS_LINE( aPath, path_post[1] ) ); if(!path_post[1].PointCount() || !path_walk[1].PointCount())
current_obs = nearestObstacle( PNS_LINE( aPath, path_pre[1] ) );
else
current_obs = nearestObstacle( PNS_LINE( aPath, path_post[1] ) );
prev_recursive = false; prev_recursive = false;
} }
else else
...@@ -108,7 +111,10 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::singleStep( PNS_LINE& aPath, ...@@ -108,7 +111,10 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::singleStep( PNS_LINE& aPath,
pnew.Append( path_walk[0] ); pnew.Append( path_walk[0] );
pnew.Append( path_post[0] ); pnew.Append( path_post[0] );
current_obs = nearestObstacle( PNS_LINE( aPath, path_walk[0] ) ); if(!path_post[0].PointCount() || !path_walk[0].PointCount())
current_obs = nearestObstacle( PNS_LINE( aPath, path_pre[0] ) );
else
current_obs = nearestObstacle( PNS_LINE( aPath, path_walk[0] ) );
if( !current_obs ) if( !current_obs )
{ {
...@@ -152,7 +158,7 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::Route( const PNS_LINE& aInitia ...@@ -152,7 +158,7 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::Route( const PNS_LINE& aInitia
{ {
int len_cw = path_cw.CLine().Length(); int len_cw = path_cw.CLine().Length();
int len_ccw = path_ccw.CLine().Length(); int len_ccw = path_ccw.CLine().Length();
if( m_forceLongerPath ) if( m_forceLongerPath )
aWalkPath = (len_cw > len_ccw ? path_cw : path_ccw); aWalkPath = (len_cw > len_ccw ? path_cw : path_ccw);
else else
...@@ -173,7 +179,7 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::Route( const PNS_LINE& aInitia ...@@ -173,7 +179,7 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::Route( const PNS_LINE& aInitia
m_iteration++; m_iteration++;
} }
if( m_iteration == m_iterationLimit ) if( m_iteration == m_iterationLimit )
{ {
int len_cw = path_cw.CLine().Length(); int len_cw = path_cw.CLine().Length();
...@@ -229,7 +235,7 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::Route( const PNS_LINE& aInitia ...@@ -229,7 +235,7 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::Route( const PNS_LINE& aInitia
if( aWalkPath.CPoint( 0 ) != aInitialPath.CPoint( 0 ) ) if( aWalkPath.CPoint( 0 ) != aInitialPath.CPoint( 0 ) )
return STUCK; return STUCK;
WALKAROUND_STATUS st = s_ccw == DONE || s_cw == DONE ? DONE : STUCK; WALKAROUND_STATUS st = s_ccw == DONE || s_cw == DONE ? DONE : STUCK;
if( aOptimize && st == DONE ) if( aOptimize && st == DONE )
......
...@@ -34,7 +34,7 @@ class PNS_WALKAROUND : public PNS_ALGO_BASE ...@@ -34,7 +34,7 @@ class PNS_WALKAROUND : public PNS_ALGO_BASE
public: public:
PNS_WALKAROUND( PNS_NODE* aWorld, PNS_ROUTER* aRouter ) : PNS_WALKAROUND( PNS_NODE* aWorld, PNS_ROUTER* aRouter ) :
PNS_ALGO_BASE ( aRouter ), PNS_ALGO_BASE ( aRouter ),
m_world( aWorld ), m_world( aWorld ),
m_iterationLimit( DefaultIterationLimit ) m_iterationLimit( DefaultIterationLimit )
{ {
m_forceSingleDirection = false; m_forceSingleDirection = false;
......
This diff is collapsed.
This diff is collapsed.
...@@ -47,19 +47,22 @@ private: ...@@ -47,19 +47,22 @@ private:
PNS_ITEM* pickSingleItem( const VECTOR2I& aWhere, int aNet = -1, int aLayer = -1 ); PNS_ITEM* pickSingleItem( const VECTOR2I& aWhere, int aNet = -1, int aLayer = -1 );
int getDefaultWidth( int aNetCode ); int getDefaultWidth( int aNetCode );
void performRouting(); void performRouting();
void performDragging(); void performDragging();
void highlightNet( bool aEnabled, int aNetcode = -1 ); void highlightNet( bool aEnabled, int aNetcode = -1 );
void updateStartItem( TOOL_EVENT& aEvent ); void updateStartItem( TOOL_EVENT& aEvent );
void updateEndItem( TOOL_EVENT& aEvent ); void updateEndItem( TOOL_EVENT& aEvent );
void getNetclassDimensions( int aNetCode, int& aWidth, int& aViaDiameter, int& aViaDrill ); void getNetclassDimensions( int aNetCode, int& aWidth, int& aViaDiameter, int& aViaDrill );
void handleCommonEvents( TOOL_EVENT& evt ); void handleCommonEvents( TOOL_EVENT& evt );
int getStartLayer( const PNS_ITEM* aItem );
void switchLayerOnViaPlacement();
bool onViaCommand( VIATYPE_T aType );
MSG_PANEL_ITEMS m_panelItems; MSG_PANEL_ITEMS m_panelItems;
PNS_ROUTER* m_router; PNS_ROUTER* m_router;
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <boost/function.hpp> #include <boost/function.hpp>
#include <core/typeinfo.h> #include <core/typeinfo.h>
class SELECTION; struct SELECTION;
///> Functor type that checks a specific condition for selected items. ///> Functor type that checks a specific condition for selected items.
typedef boost::function<bool (const SELECTION&)> SELECTION_CONDITION; typedef boost::function<bool (const SELECTION&)> SELECTION_CONDITION;
......
[Desktop Entry] [Desktop Entry]
Categories=Development;Electronics Categories=Development;Electronics;
Comment=Design a printed circuit board Comment=Create a component from a bitmap for use with KiCad
Exec=bitmap2component Exec=bitmap2component
GenericName=EDA Suite GenericName=EDA Suite
Icon=bitmap2component Icon=bitmap2component
MimeType=application/x-bitmap2component-project; MimeType=application/x-bitmap2component-project;
Name=bitmap2component Name=Bitmap to Component Converter
Type=Application Type=Application
Name[en_US]=bitmap2component Name[en_US]=Bitmap to Component Converter
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment