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 ) );
......
...@@ -247,8 +247,9 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, ...@@ -247,8 +247,9 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
} }
if( mode == LINE ) if( mode == LINE )
{
GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius, color ); GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius, color );
}
else if( mode == SKETCH ) else if( mode == SKETCH )
{ {
GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle,
...@@ -264,14 +265,17 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, ...@@ -264,14 +265,17 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
break; break;
case S_CURVE: case S_CURVE:
m_BezierPoints = Bezier2Poly(m_Start, m_BezierC1, m_BezierC2, m_End); m_BezierPoints = Bezier2Poly( m_Start, m_BezierC1, m_BezierC2, m_End );
for (unsigned int i=1; i < m_BezierPoints.size(); i++) { for( unsigned int i=1; i < m_BezierPoints.size(); i++ )
{
if( mode == LINE ) if( mode == LINE )
{
GRLine( panel->GetClipBox(), DC, GRLine( panel->GetClipBox(), DC,
m_BezierPoints[i].x, m_BezierPoints[i].y, m_BezierPoints[i].x, m_BezierPoints[i].y,
m_BezierPoints[i-1].x, m_BezierPoints[i-1].y, 0, m_BezierPoints[i-1].x, m_BezierPoints[i-1].y, 0,
color ); color );
}
else if( mode == SKETCH ) else if( mode == SKETCH )
{ {
GRCSegm( panel->GetClipBox(), DC, GRCSegm( panel->GetClipBox(), DC,
...@@ -317,7 +321,7 @@ void DRAWSEGMENT::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -317,7 +321,7 @@ void DRAWSEGMENT::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
wxASSERT( m_Parent ); wxASSERT( m_Parent );
msg = wxT( "DRAWING" ); msg = _( "Drawing" );
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) );
...@@ -332,7 +336,7 @@ void DRAWSEGMENT::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -332,7 +336,7 @@ void DRAWSEGMENT::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
case S_ARC: case S_ARC:
aList.push_back( MSG_PANEL_ITEM( shape, _( "Arc" ), RED ) ); aList.push_back( MSG_PANEL_ITEM( shape, _( "Arc" ), RED ) );
msg.Printf( wxT( "%.1f" ), m_Angle / 10.0 ); msg.Printf( wxT( "%.1f" ), m_Angle / 10.0 );
aList.push_back( MSG_PANEL_ITEM( _("Angle"), msg, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, RED ) );
break; break;
case S_CURVE: case S_CURVE:
...@@ -340,7 +344,18 @@ void DRAWSEGMENT::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -340,7 +344,18 @@ void DRAWSEGMENT::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
break; break;
default: default:
{
aList.push_back( MSG_PANEL_ITEM( shape, _( "Segment" ), RED ) ); aList.push_back( MSG_PANEL_ITEM( shape, _( "Segment" ), RED ) );
msg = ::CoordinateToString( GetLineLength( m_Start, m_End ) );
aList.push_back( MSG_PANEL_ITEM( _( "Length" ), msg, DARKGREEN ) );
// angle counter-clockwise from 3'o-clock
const double deg = RAD2DEG( atan2( m_Start.y - m_End.y,
m_End.x - m_Start.x ) );
msg.Printf( wxT( "%.1f" ), deg );
aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, DARKGREEN ) );
}
} }
wxString start; wxString start;
...@@ -373,93 +388,93 @@ const EDA_RECT DRAWSEGMENT::GetBoundingBox() const ...@@ -373,93 +388,93 @@ const EDA_RECT DRAWSEGMENT::GetBoundingBox() const
break; break;
case S_ARC: case S_ARC:
{ {
bbox.Merge( m_End ); bbox.Merge( m_End );
wxPoint end = m_End; wxPoint end = m_End;
RotatePoint( &end, m_Start, -m_Angle ); RotatePoint( &end, m_Start, -m_Angle );
bbox.Merge( end ); bbox.Merge( end );
// Determine the starting quarter // Determine the starting quarter
// 0 right-bottom // 0 right-bottom
// 1 left-bottom // 1 left-bottom
// 2 left-top // 2 left-top
// 3 right-top // 3 right-top
unsigned int quarter = 0; // assume right-bottom unsigned int quarter = 0; // assume right-bottom
if( m_End.y < m_Start.y ) // change to left-top if( m_End.y < m_Start.y ) // change to left-top
quarter |= 3; quarter |= 3;
if( m_End.x < m_Start.x ) // for left side, the LSB is 2nd bit negated if( m_End.x < m_Start.x ) // for left side, the LSB is 2nd bit negated
quarter ^= 1; quarter ^= 1;
int radius = GetRadius(); int radius = GetRadius();
int angle = (int) GetArcAngleStart() % 900 + m_Angle; int angle = (int) GetArcAngleStart() % 900 + m_Angle;
bool directionCW = ( m_Angle > 0 ); // Is the direction of arc clockwise? bool directionCW = ( m_Angle > 0 ); // Is the direction of arc clockwise?
if( !directionCW ) if( !directionCW )
{ {
angle = 900 - angle; angle = 900 - angle;
quarter = ( quarter + 3 ) % 4; // -1 modulo arithmetic quarter = ( quarter + 3 ) % 4; // -1 modulo arithmetic
} }
while( angle > 900 ) while( angle > 900 )
{
switch( quarter )
{ {
switch( quarter ) case 0:
{ bbox.Merge( wxPoint( m_Start.x, m_Start.y + radius ) ); // down
case 0: break;
bbox.Merge( wxPoint( m_Start.x, m_Start.y + radius ) ); // down
break; case 1:
bbox.Merge( wxPoint( m_Start.x - radius, m_Start.y ) ); // left
case 1: break;
bbox.Merge( wxPoint( m_Start.x - radius, m_Start.y ) ); // left
break; case 2:
bbox.Merge( wxPoint( m_Start.x, m_Start.y - radius ) ); // up
case 2: break;
bbox.Merge( wxPoint( m_Start.x, m_Start.y - radius ) ); // up
break; case 3:
bbox.Merge( wxPoint( m_Start.x + radius, m_Start.y ) ); // right
case 3: break;
bbox.Merge( wxPoint( m_Start.x + radius, m_Start.y ) ); // right
break;
}
if( directionCW )
++quarter;
else
quarter += 3; // -1 modulo arithmetic
quarter %= 4;
angle -= 900;
} }
if( directionCW )
++quarter;
else
quarter += 3; // -1 modulo arithmetic
quarter %= 4;
angle -= 900;
} }
}
break; break;
case S_POLYGON: case S_POLYGON:
{
wxPoint p_end;
MODULE* module = GetParentModule();
for( unsigned ii = 0; ii < m_PolyPoints.size(); ii++ )
{ {
wxPoint p_end; wxPoint pt = m_PolyPoints[ii];
MODULE* module = GetParentModule();
for( unsigned ii = 0; ii < m_PolyPoints.size(); ii++ ) if( module ) // Transform, if we belong to a module
{ {
wxPoint pt = m_PolyPoints[ii]; RotatePoint( &pt, module->GetOrientation() );
pt += module->GetPosition();
if( module ) // Transform, if we belong to a module
{
RotatePoint( &pt, module->GetOrientation() );
pt += module->GetPosition();
}
if( ii == 0 )
p_end = pt;
bbox.SetX( std::min( bbox.GetX(), pt.x ) );
bbox.SetY( std::min( bbox.GetY(), pt.y ) );
p_end.x = std::max( p_end.x, pt.x );
p_end.y = std::max( p_end.y, pt.y );
} }
bbox.SetEnd( p_end ); if( ii == 0 )
p_end = pt;
bbox.SetX( std::min( bbox.GetX(), pt.x ) );
bbox.SetY( std::min( bbox.GetY(), pt.y ) );
p_end.x = std::max( p_end.x, pt.x );
p_end.y = std::max( p_end.y, pt.y );
} }
bbox.SetEnd( p_end );
}
break; break;
default: default:
...@@ -479,46 +494,46 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aPosition ) const ...@@ -479,46 +494,46 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aPosition ) const
{ {
case S_CIRCLE: case S_CIRCLE:
case S_ARC: case S_ARC:
{
wxPoint relPos = aPosition - GetCenter();
int radius = GetRadius();
int dist = KiROUND( EuclideanNorm( relPos ) );
if( abs( radius - dist ) <= ( m_Width / 2 ) )
{ {
wxPoint relPos = aPosition - GetCenter(); if( m_Shape == S_CIRCLE )
int radius = GetRadius(); return true;
int dist = KiROUND( EuclideanNorm( relPos ) );
if( abs( radius - dist ) <= ( m_Width / 2 ) ) // For arcs, the test point angle must be >= arc angle start
// and <= arc angle end
// However angle values > 360 deg are not easy to handle
// so we calculate the relative angle between arc start point and teast point
// this relative arc should be < arc angle if arc angle > 0 (CW arc)
// and > arc angle if arc angle < 0 (CCW arc)
double arc_angle_start = GetArcAngleStart(); // Always 0.0 ... 360 deg, in 0.1 deg
double arc_hittest = ArcTangente( relPos.y, relPos.x );
// Calculate relative angle between the starting point of the arc, and the test point
arc_hittest -= arc_angle_start;
// Normalise arc_hittest between 0 ... 360 deg
NORMALIZE_ANGLE_POS( arc_hittest );
// Check angle: inside the arc angle when it is > 0
// and outside the not drawn arc when it is < 0
if( GetAngle() >= 0.0 )
{ {
if( m_Shape == S_CIRCLE ) if( arc_hittest <= GetAngle() )
return true;
}
else
{
if( arc_hittest >= (3600.0 + GetAngle()) )
return true; return true;
// For arcs, the test point angle must be >= arc angle start
// and <= arc angle end
// However angle values > 360 deg are not easy to handle
// so we calculate the relative angle between arc start point and teast point
// this relative arc should be < arc angle if arc angle > 0 (CW arc)
// and > arc angle if arc angle < 0 (CCW arc)
double arc_angle_start = GetArcAngleStart(); // Always 0.0 ... 360 deg, in 0.1 deg
double arc_hittest = ArcTangente( relPos.y, relPos.x );
// Calculate relative angle between the starting point of the arc, and the test point
arc_hittest -= arc_angle_start;
// Normalise arc_hittest between 0 ... 360 deg
NORMALIZE_ANGLE_POS( arc_hittest );
// Check angle: inside the arc angle when it is > 0
// and outside the not drawn arc when it is < 0
if( GetAngle() >= 0.0 )
{
if( arc_hittest <= GetAngle() )
return true;
}
else
{
if( arc_hittest >= (3600.0 + GetAngle()) )
return true;
}
} }
} }
}
break; break;
case S_CURVE: case S_CURVE:
...@@ -538,6 +553,7 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aPosition ) const ...@@ -538,6 +553,7 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aPosition ) const
wxASSERT( 0 ); wxASSERT( 0 );
break; break;
} }
return false; return false;
} }
......
...@@ -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 );
} }
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project> <wxFormBuilder_Project>
<FileVersion major="1" minor="11" /> <FileVersion major="1" minor="13" />
<object class="Project" expanded="1"> <object class="Project" expanded="1">
<property name="class_decoration"></property> <property name="class_decoration"></property>
<property name="code_generation">C++</property> <property name="code_generation">C++</property>
...@@ -41,11 +41,11 @@ ...@@ -41,11 +41,11 @@
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size">280,240</property>
<property name="name">DIALOG_TRACK_VIA_SIZE_BASE</property> <property name="name">DIALOG_TRACK_VIA_SIZE_BASE</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">388,162</property> <property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> <property name="style">wxDEFAULT_DIALOG_STYLE</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="title">Track width and via size</property> <property name="title">Track width and via size</property>
<property name="tooltip"></property> <property name="tooltip"></property>
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
<property name="settings"></property> <property name="settings"></property>
<property name="show">1</property> <property name="show">1</property>
<property name="size"></property> <property name="size"></property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
...@@ -350,189 +350,28 @@ ...@@ -350,189 +350,28 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1"> <object class="wxStdDialogButtonSizer" expanded="1">
<property name="Apply">0</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="No">0</property>
<property name="OK">1</property>
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">bButtons</property> <property name="name">m_stdButtons</property>
<property name="orient">wxHORIZONTAL</property> <property name="permission">protected</property>
<property name="permission">none</property> <event name="OnApplyButtonClick"></event>
<object class="sizeritem" expanded="1"> <event name="OnCancelButtonClick">onCancelClick</event>
<property name="border">5</property> <event name="OnContextHelpButtonClick"></event>
<property name="flag">wxALL</property> <event name="OnHelpButtonClick"></event>
<property name="proportion">1</property> <event name="OnNoButtonClick"></event>
<object class="wxButton" expanded="1"> <event name="OnOKButtonClick">onOkClick</event>
<property name="BottomDockable">1</property> <event name="OnSaveButtonClick"></event>
<property name="LeftDockable">1</property> <event name="OnYesButtonClick"></event>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_OK</property>
<property name="label">OK</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_ok</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">onOkClick</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">1</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">Cancel</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_cancel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">onCancelClick</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object> </object>
</object> </object>
</object> </object>
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// 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
{ {
......
...@@ -40,10 +40,10 @@ PNS_LINE_PLACER::PNS_LINE_PLACER( PNS_ROUTER* aRouter ) : ...@@ -40,10 +40,10 @@ PNS_LINE_PLACER::PNS_LINE_PLACER( PNS_ROUTER* aRouter ) :
PNS_ALGO_BASE ( aRouter ) PNS_ALGO_BASE ( aRouter )
{ {
m_initial_direction = DIRECTION_45::N; m_initial_direction = DIRECTION_45::N;
m_iteration = 0;
m_world = NULL; m_world = NULL;
m_shove = NULL; m_shove = NULL;
m_currentNode = NULL; m_currentNode = NULL;
m_idle = true;
} }
...@@ -59,53 +59,23 @@ void PNS_LINE_PLACER::setWorld ( PNS_NODE* aWorld ) ...@@ -59,53 +59,23 @@ void PNS_LINE_PLACER::setWorld ( PNS_NODE* aWorld )
m_world = aWorld; m_world = aWorld;
} }
const PNS_VIA PNS_LINE_PLACER::makeVia ( const VECTOR2I& aP )
void PNS_LINE_PLACER::AddVia( bool aEnabled, int aDiameter, int aDrill, VIATYPE_T aType )
{ {
m_viaDiameter = aDiameter; const PNS_LAYERSET layers( m_sizes.GetLayerTop(), m_sizes.GetLayerBottom() );
m_viaDrill = aDrill;
m_placingVia = aEnabled; return PNS_VIA ( aP, layers, m_sizes.ViaDiameter(), m_sizes.ViaDrill(), -1, m_sizes.ViaType() );
m_viaType = aType;
} }
void PNS_LINE_PLACER::startPlacement( const VECTOR2I& aStart, int aNet, int aWidth, int aLayer ) void PNS_LINE_PLACER::ToggleVia( bool aEnabled )
{ {
assert( m_world != NULL ); m_placingVia = aEnabled;
if(!m_idle)
m_direction = m_initial_direction; Move ( m_currentEnd, NULL );
TRACE( 1, "world %p, initial-direction %s layer %d\n",
m_world % m_direction.Format().c_str() % aLayer );
m_head.SetNet( aNet );
m_tail.SetNet( aNet );
m_head.SetWidth( aWidth );
m_tail.SetWidth( aWidth );
m_head.Line().Clear();
m_tail.Line().Clear();
m_head.SetLayer( aLayer );
m_tail.SetLayer( aLayer );
m_iteration = 0;
m_p_start = aStart;
m_lastNode = NULL;
m_currentNode = m_world;
m_currentMode = Settings().Mode();
if( m_shove )
delete m_shove;
m_shove = NULL;
if( m_currentMode == RM_Shove || m_currentMode == RM_Smart )
{
m_shove = new PNS_SHOVE( m_world->Branch(), Router() );
}
m_placingVia = false;
} }
void PNS_LINE_PLACER::setInitialDirection( const DIRECTION_45& aDirection ) void PNS_LINE_PLACER::setInitialDirection( const DIRECTION_45& aDirection )
{ {
m_initial_direction = aDirection; m_initial_direction = aDirection;
...@@ -380,8 +350,9 @@ bool PNS_LINE_PLACER::handleViaPlacement( PNS_LINE& aHead ) ...@@ -380,8 +350,9 @@ bool PNS_LINE_PLACER::handleViaPlacement( PNS_LINE& aHead )
if( !m_placingVia ) if( !m_placingVia )
return true; return true;
PNS_LAYERSET layers( Settings().GetLayerTop(), Settings().GetLayerBottom() ); PNS_VIA v ( makeVia ( aHead.CPoint( -1 ) ) );
PNS_VIA v( aHead.CPoint( -1 ), layers, m_viaDiameter, m_viaDrill, aHead.Net(), m_viaType ); v.SetNet ( aHead.Net() );
VECTOR2I force; VECTOR2I force;
VECTOR2I lead = aHead.CPoint( -1 ) - aHead.CPoint( 0 ); VECTOR2I lead = aHead.CPoint( -1 ) - aHead.CPoint( 0 );
...@@ -415,12 +386,12 @@ bool PNS_LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead ) ...@@ -415,12 +386,12 @@ bool PNS_LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead )
walkaround.SetSolidsOnly( false ); walkaround.SetSolidsOnly( false );
walkaround.SetIterationLimit( Settings().WalkaroundIterationLimit() ); walkaround.SetIterationLimit( Settings().WalkaroundIterationLimit() );
PNS_WALKAROUND::WALKAROUND_STATUS wf = walkaround.Route( initTrack, walkFull, false ); PNS_WALKAROUND::WALKAROUND_STATUS wf = walkaround.Route( initTrack, walkFull, false );
switch( Settings().OptimizerEffort() ) switch( Settings().OptimizerEffort() )
{ {
case OE_LOW: case OE_LOW:
effort = 0; effort = 0;
break; break;
...@@ -440,9 +411,7 @@ bool PNS_LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead ) ...@@ -440,9 +411,7 @@ bool PNS_LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead )
} }
else if( m_placingVia && viaOk ) else if( m_placingVia && viaOk )
{ {
PNS_LAYERSET layers( Settings().GetLayerTop(), Settings().GetLayerBottom() ); walkFull.AppendVia( makeVia ( walkFull.CPoint( -1 ) ) );
PNS_VIA v1( walkFull.CPoint( -1 ), layers, m_viaDiameter, m_viaDrill, -1, m_viaType );
walkFull.AppendVia( v1 );
} }
PNS_OPTIMIZER::Optimize( &walkFull, effort, m_currentNode ); PNS_OPTIMIZER::Optimize( &walkFull, effort, m_currentNode );
...@@ -454,7 +423,7 @@ bool PNS_LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead ) ...@@ -454,7 +423,7 @@ bool PNS_LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead )
m_head = walkFull; m_head = walkFull;
aNewHead = walkFull; aNewHead = walkFull;
return rv; return rv;
} }
...@@ -462,16 +431,14 @@ bool PNS_LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead ) ...@@ -462,16 +431,14 @@ bool PNS_LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead )
bool PNS_LINE_PLACER::rhMarkObstacles( const VECTOR2I& aP, PNS_LINE& aNewHead ) bool PNS_LINE_PLACER::rhMarkObstacles( const VECTOR2I& aP, PNS_LINE& aNewHead )
{ {
m_head.SetShape( m_direction.BuildInitialTrace( m_p_start, aP ) ); m_head.SetShape( m_direction.BuildInitialTrace( m_p_start, aP ) );
if( m_placingVia ) if( m_placingVia )
{ {
PNS_LAYERSET layers( Settings().GetLayerTop(), Settings().GetLayerBottom() ); m_head.AppendVia( makeVia ( m_head.CPoint( -1 ) ) );
PNS_VIA v1( m_head.CPoint( -1 ), layers, m_viaDiameter, m_viaDrill, -1, m_viaType );
m_head.AppendVia( v1 );
} }
aNewHead = m_head; aNewHead = m_head;
return m_currentNode->CheckColliding( &m_head ); return m_currentNode->CheckColliding( &m_head );
} }
...@@ -508,24 +475,23 @@ bool PNS_LINE_PLACER::rhShoveOnly ( const VECTOR2I& aP, PNS_LINE& aNewHead ) ...@@ -508,24 +475,23 @@ bool PNS_LINE_PLACER::rhShoveOnly ( const VECTOR2I& aP, PNS_LINE& aNewHead )
if( m_placingVia ) if( m_placingVia )
{ {
PNS_LAYERSET layers( Settings().GetLayerTop(), Settings().GetLayerBottom() ); PNS_VIA v1( makeVia ( l.CPoint( -1 ) ) );
PNS_VIA v1( l.CPoint( -1 ), layers, m_viaDiameter, m_viaDrill, -1, m_viaType ); PNS_VIA v2( makeVia ( l2.CPoint( -1 ) ) );
PNS_VIA v2( l2.CPoint( -1 ), layers, m_viaDiameter, m_viaDrill, -1, m_viaType );
l.AppendVia( v1 ); l.AppendVia( v1 );
l2.AppendVia( v2 ); l2.AppendVia( v2 );
} }
l.Line().Simplify(); l.Line().Simplify();
// in certain, uncommon cases there may be loops in the head+tail, In such case, we don't shove to avoid // in certain, uncommon cases there may be loops in the head+tail, In such case, we don't shove to avoid
// screwing up the database. // screwing up the database.
if( l.HasLoops() ) if( l.HasLoops() )
{ {
aNewHead = m_head; aNewHead = m_head;
return false; return false;
} }
PNS_SHOVE::SHOVE_STATUS status = m_shove->ShoveLines( l ); PNS_SHOVE::SHOVE_STATUS status = m_shove->ShoveLines( l );
m_currentNode = m_shove->CurrentNode(); m_currentNode = m_shove->CurrentNode();
...@@ -570,7 +536,7 @@ bool PNS_LINE_PLACER::routeHead( const VECTOR2I& aP, PNS_LINE& aNewHead ) ...@@ -570,7 +536,7 @@ bool PNS_LINE_PLACER::routeHead( const VECTOR2I& aP, PNS_LINE& aNewHead )
default: default:
break; break;
} }
return false; return false;
} }
...@@ -584,14 +550,14 @@ bool PNS_LINE_PLACER::optimizeTailHeadTransition() ...@@ -584,14 +550,14 @@ bool PNS_LINE_PLACER::optimizeTailHeadTransition()
if( tmp.SegmentCount() < 1 ) if( tmp.SegmentCount() < 1 )
return false; return false;
m_head = tmp; m_head = tmp;
m_p_start = tmp.CLine().CPoint( 0 ); m_p_start = tmp.CLine().CPoint( 0 );
m_direction = DIRECTION_45( tmp.CSegment( 0 ) ); m_direction = DIRECTION_45( tmp.CSegment( 0 ) );
m_tail.Line().Clear(); m_tail.Line().Clear();
return true; return true;
} }
SHAPE_LINE_CHAIN& head = m_head.Line(); SHAPE_LINE_CHAIN& head = m_head.Line();
SHAPE_LINE_CHAIN& tail = m_tail.Line(); SHAPE_LINE_CHAIN& tail = m_tail.Line();
...@@ -710,9 +676,9 @@ const PNS_LINE PNS_LINE_PLACER::Trace() const ...@@ -710,9 +676,9 @@ const PNS_LINE PNS_LINE_PLACER::Trace() const
} }
const PNS_ITEMSET PNS_LINE_PLACER::Traces() const PNS_ITEMSET PNS_LINE_PLACER::Traces()
{ {
m_currentTrace = Trace(); m_currentTrace = Trace();
return PNS_ITEMSET( &m_currentTrace ); return PNS_ITEMSET( &m_currentTrace );
} }
...@@ -737,13 +703,13 @@ void PNS_LINE_PLACER::splitAdjacentSegments( PNS_NODE* aNode, PNS_ITEM* aSeg, co ...@@ -737,13 +703,13 @@ void PNS_LINE_PLACER::splitAdjacentSegments( PNS_NODE* aNode, PNS_ITEM* aSeg, co
{ {
if( aSeg && aSeg->OfKind( PNS_ITEM::SEGMENT ) ) if( aSeg && aSeg->OfKind( PNS_ITEM::SEGMENT ) )
{ {
PNS_JOINT *jt = aNode->FindJoint( aP, aSeg ); PNS_JOINT* jt = aNode->FindJoint( aP, aSeg );
if( jt && jt->LinkCount() >= 1 ) if( jt && jt->LinkCount() >= 1 )
return; return;
PNS_SEGMENT* s_old = static_cast<PNS_SEGMENT*>( aSeg ); PNS_SEGMENT* s_old = static_cast<PNS_SEGMENT*>( aSeg );
PNS_SEGMENT* s_new[2]; PNS_SEGMENT* s_new[2];
s_new[0] = s_old->Clone(); s_new[0] = s_old->Clone();
...@@ -759,15 +725,25 @@ void PNS_LINE_PLACER::splitAdjacentSegments( PNS_NODE* aNode, PNS_ITEM* aSeg, co ...@@ -759,15 +725,25 @@ void PNS_LINE_PLACER::splitAdjacentSegments( PNS_NODE* aNode, PNS_ITEM* aSeg, co
} }
void PNS_LINE_PLACER::SetLayer( int aLayer ) bool PNS_LINE_PLACER::SetLayer( int aLayer )
{ {
m_currentLayer = aLayer; if( m_idle )
{
m_currentLayer = aLayer;
return true;
} else if( m_chainedPlacement ) {
return false;
} else if( !m_startItem || ( m_startItem->OfKind( PNS_ITEM::VIA ) && m_startItem->Layers().Overlaps( aLayer ) ) ) {
m_currentLayer = aLayer;
m_splitSeg = false;
initPlacement ( m_splitSeg );
Move ( m_currentEnd, NULL );
return true;
}
m_head.SetLayer( aLayer ); return false;
m_tail.SetLayer( aLayer );
} }
void PNS_LINE_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ) void PNS_LINE_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
{ {
VECTOR2I p( aP ); VECTOR2I p( aP );
...@@ -775,33 +751,71 @@ void PNS_LINE_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ) ...@@ -775,33 +751,71 @@ void PNS_LINE_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
static int unknowNetIdx = 0; // -10000; static int unknowNetIdx = 0; // -10000;
int net = -1; int net = -1;
m_lastNode = NULL;
m_placingVia = false;
m_startsOnVia = false;
bool splitSeg = false; bool splitSeg = false;
if( Router()->SnappingEnabled() ) if( Router()->SnappingEnabled() )
p = Router()->SnapToItem( aStartItem, aP, splitSeg ); p = Router()->SnapToItem( aStartItem, aP, splitSeg );
if( !aStartItem || aStartItem->Net() < 0 ) if( !aStartItem || aStartItem->Net() < 0 )
net = unknowNetIdx--; net = unknowNetIdx--;
else else
net = aStartItem->Net(); net = aStartItem->Net();
m_currentStart = p; m_currentStart = p;
m_originalStart = p;
m_currentEnd = p; m_currentEnd = p;
m_currentNet = net; m_currentNet = net;
m_startItem = aStartItem;
m_placingVia = false;
m_chainedPlacement = false;
m_splitSeg = splitSeg;
setInitialDirection( Settings().InitialDirection() );
PNS_NODE* rootNode = Router()->GetWorld()->Branch(); initPlacement( m_splitSeg );
}
void PNS_LINE_PLACER::initPlacement( bool aSplitSeg )
{
m_idle = false;
m_head.Line().Clear();
m_tail.Line().Clear();
m_head.SetNet( m_currentNet );
m_tail.SetNet( m_currentNet );
m_head.SetLayer( m_currentLayer );
m_tail.SetLayer( m_currentLayer );
m_head.SetWidth( m_sizes.TrackWidth() );
m_tail.SetWidth( m_sizes.TrackWidth() );
m_p_start = m_currentStart;
m_direction = m_initial_direction;
PNS_NODE* world = Router()->GetWorld();
world->KillChildren();
PNS_NODE* rootNode = world->Branch();
if( aSplitSeg )
splitAdjacentSegments( rootNode, m_startItem, m_currentStart );
if( splitSeg )
splitAdjacentSegments( rootNode, aStartItem, p );
setWorld( rootNode ); setWorld( rootNode );
setInitialDirection( Settings().InitialDirection() );
startPlacement( p, m_currentNet, m_currentWidth, m_currentLayer ); TRACE( 1, "world %p, intitial-direction %s layer %d\n",
m_world % m_direction.Format().c_str() % aLayer );
m_lastNode = NULL;
m_currentNode = m_world;
m_currentMode = Settings().Mode();
if( m_shove )
delete m_shove;
m_shove = NULL;
if( m_currentMode == RM_Shove || m_currentMode == RM_Smart )
{
m_shove = new PNS_SHOVE( m_world->Branch(), Router() );
}
} }
...@@ -810,20 +824,20 @@ void PNS_LINE_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem ) ...@@ -810,20 +824,20 @@ void PNS_LINE_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem )
PNS_LINE current; PNS_LINE current;
VECTOR2I p = aP; VECTOR2I p = aP;
int eiDepth = -1; int eiDepth = -1;
if( aEndItem && aEndItem->Owner() ) if( aEndItem && aEndItem->Owner() )
eiDepth = aEndItem->Owner()->Depth(); eiDepth = aEndItem->Owner()->Depth();
if( m_lastNode ) if( m_lastNode )
{ {
delete m_lastNode; delete m_lastNode;
m_lastNode = NULL; m_lastNode = NULL;
} }
route( p ); route( p );
current = Trace(); current = Trace();
if( !current.PointCount() ) if( !current.PointCount() )
m_currentEnd = m_p_start; m_currentEnd = m_p_start;
else else
...@@ -831,14 +845,14 @@ void PNS_LINE_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem ) ...@@ -831,14 +845,14 @@ void PNS_LINE_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem )
PNS_NODE* latestNode = m_currentNode; PNS_NODE* latestNode = m_currentNode;
m_lastNode = latestNode->Branch(); m_lastNode = latestNode->Branch();
if( eiDepth >= 0 && aEndItem && latestNode->Depth() > eiDepth && if( eiDepth >= 0 && aEndItem && latestNode->Depth() > eiDepth &&
current.SegmentCount() && current.CPoint( -1 ) == aP ) current.SegmentCount() && current.CPoint( -1 ) == aP )
{ {
splitAdjacentSegments( m_lastNode, aEndItem, current.CPoint( -1 ) ); splitAdjacentSegments( m_lastNode, aEndItem, current.CPoint( -1 ) );
if( Settings().RemoveLoops() ) if( Settings().RemoveLoops() )
removeLoops( m_lastNode, &current ); removeLoops( m_lastNode, &current );
} }
updateLeadingRatLine(); updateLeadingRatLine();
...@@ -849,7 +863,7 @@ bool PNS_LINE_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) ...@@ -849,7 +863,7 @@ bool PNS_LINE_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
{ {
bool realEnd = false; bool realEnd = false;
int lastV; int lastV;
PNS_LINE pl = Trace(); PNS_LINE pl = Trace();
if( m_currentMode == RM_MarkObstacles && if( m_currentMode == RM_MarkObstacles &&
...@@ -894,33 +908,22 @@ bool PNS_LINE_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) ...@@ -894,33 +908,22 @@ bool PNS_LINE_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
if( realEnd ) if( realEnd )
simplifyNewLine( m_lastNode, lastSeg ); simplifyNewLine( m_lastNode, lastSeg );
Router()->CommitRouting( m_lastNode ); Router()->CommitRouting( m_lastNode );
m_lastNode = NULL; m_lastNode = NULL;
if( !realEnd ) if( !realEnd )
{ {
setInitialDirection( d_last ); setInitialDirection( d_last );
VECTOR2I p_start = m_placingVia ? p_last : p_pre_last; m_currentStart = m_placingVia ? p_last : p_pre_last;
m_startItem = NULL;
if( m_placingVia )
{
int layerTop = Router()->Settings().GetLayerTop();
int layerBottom = Router()->Settings().GetLayerBottom();
// Change the current layer to the other side of the board
if( m_currentLayer == layerTop )
m_currentLayer = layerBottom;
else
m_currentLayer = layerTop;
}
setWorld( Router()->GetWorld()->Branch() );
startPlacement( p_start, m_head.Net(), m_head.Width(), m_currentLayer );
m_startsOnVia = m_placingVia;
m_placingVia = false; m_placingVia = false;
m_chainedPlacement = !pl.EndsWithVia();
m_splitSeg = false;
initPlacement( );
} else {
m_idle = true;
} }
return realEnd; return realEnd;
...@@ -933,10 +936,10 @@ void PNS_LINE_PLACER::removeLoops( PNS_NODE* aNode, PNS_LINE* aLatest ) ...@@ -933,10 +936,10 @@ void PNS_LINE_PLACER::removeLoops( PNS_NODE* aNode, PNS_LINE* aLatest )
return; return;
aNode->Add( aLatest, true ); aNode->Add( aLatest, true );
for( int s = 0; s < aLatest->SegmentCount(); s++ ) for( int s = 0; s < aLatest->SegmentCount(); s++ )
{ {
PNS_SEGMENT *seg = ( *aLatest->LinkedSegments() )[s]; PNS_SEGMENT* seg = ( *aLatest->LinkedSegments() )[s];
PNS_LINE* ourLine = aNode->AssembleLine( seg ); PNS_LINE* ourLine = aNode->AssembleLine( seg );
PNS_JOINT a, b; PNS_JOINT a, b;
std::vector<PNS_LINE*> lines; std::vector<PNS_LINE*> lines;
...@@ -947,7 +950,7 @@ void PNS_LINE_PLACER::removeLoops( PNS_NODE* aNode, PNS_LINE* aLatest ) ...@@ -947,7 +950,7 @@ void PNS_LINE_PLACER::removeLoops( PNS_NODE* aNode, PNS_LINE* aLatest )
{ {
aNode->FindLineEnds( aLatest, a, b); aNode->FindLineEnds( aLatest, a, b);
} }
aNode->FindLinesBetweenJoints( a, b, lines ); aNode->FindLinesBetweenJoints( a, b, lines );
int removedCount = 0; int removedCount = 0;
...@@ -973,7 +976,7 @@ void PNS_LINE_PLACER::removeLoops( PNS_NODE* aNode, PNS_LINE* aLatest ) ...@@ -973,7 +976,7 @@ void PNS_LINE_PLACER::removeLoops( PNS_NODE* aNode, PNS_LINE* aLatest )
delete ourLine; delete ourLine;
} }
aNode->Remove( aLatest ); aNode->Remove( aLatest );
} }
...@@ -988,44 +991,42 @@ void PNS_LINE_PLACER::simplifyNewLine( PNS_NODE* aNode, PNS_SEGMENT* aLatest ) ...@@ -988,44 +991,42 @@ void PNS_LINE_PLACER::simplifyNewLine( PNS_NODE* aNode, PNS_SEGMENT* aLatest )
if( simplified.PointCount() != l->PointCount() ) if( simplified.PointCount() != l->PointCount() )
{ {
std::auto_ptr<PNS_LINE> lnew ( l->Clone() ); std::auto_ptr<PNS_LINE> lnew ( l->Clone() );
aNode -> Remove(l); aNode -> Remove( l );
lnew->SetShape(simplified); lnew->SetShape( simplified );
aNode -> Add( lnew.get() ); aNode -> Add( lnew.get() );
} }
} }
void PNS_LINE_PLACER::UpdateSizes( const PNS_ROUTING_SETTINGS& aSettings ) void PNS_LINE_PLACER::UpdateSizes( const PNS_SIZES_SETTINGS& aSizes )
{ {
int trackWidth = aSettings.GetTrackWidth(); m_sizes = aSizes;
if( !m_idle )
m_head.SetWidth( trackWidth ); {
m_tail.SetWidth( trackWidth ); initPlacement ( m_splitSeg );
Move ( m_currentEnd, NULL );
m_currentWidth = trackWidth; }
m_viaDiameter = aSettings.GetViaDiameter();
m_viaDrill = aSettings.GetViaDrill();
} }
void PNS_LINE_PLACER::updateLeadingRatLine() void PNS_LINE_PLACER::updateLeadingRatLine()
{ {
PNS_LINE current = Trace(); PNS_LINE current = Trace();
if( !current.PointCount() ) if( !current.PointCount() )
return; return;
std::auto_ptr<PNS_NODE> tmpNode ( m_lastNode->Branch() ); std::auto_ptr<PNS_NODE> tmpNode ( m_lastNode->Branch() );
tmpNode->Add( &current ); tmpNode->Add( &current );
PNS_JOINT *jt = tmpNode->FindJoint( current.CPoint( -1 ), PNS_JOINT* jt = tmpNode->FindJoint( current.CPoint( -1 ),
current.Layers().Start(), current.Net() ); current.Layers().Start(), current.Net() );
if( !jt ) if( !jt )
return; return;
int anchor; int anchor;
PNS_ITEM *it = tmpNode->NearestUnconnectedItem( jt, &anchor ); PNS_ITEM* it = tmpNode->NearestUnconnectedItem( jt, &anchor );
if( it ) if( it )
{ {
......
...@@ -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
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#include <profile.h> #include <profile.h>
static void sanityCheck( PNS_LINE *aOld, PNS_LINE *aNew ) static void sanityCheck( PNS_LINE* aOld, PNS_LINE* aNew )
{ {
assert( aOld->CPoint( 0 ) == aNew->CPoint( 0 ) ); assert( aOld->CPoint( 0 ) == aNew->CPoint( 0 ) );
assert( aOld->CPoint( -1 ) == aNew->CPoint( -1 ) ); assert( aOld->CPoint( -1 ) == aNew->CPoint( -1 ) );
...@@ -58,26 +58,26 @@ PNS_SHOVE::PNS_SHOVE( PNS_NODE* aWorld, PNS_ROUTER* aRouter ) : ...@@ -58,26 +58,26 @@ PNS_SHOVE::PNS_SHOVE( PNS_NODE* aWorld, PNS_ROUTER* aRouter ) :
PNS_SHOVE::~PNS_SHOVE() PNS_SHOVE::~PNS_SHOVE()
{ {
// free all the stuff we've created during routing/dragging operation. // free all the stuff we've created during routing/dragging operation.
BOOST_FOREACH( PNS_ITEM *item, m_gcItems ) BOOST_FOREACH( PNS_ITEM* item, m_gcItems )
delete item; delete item;
} }
// garbage-collected line assembling // garbage-collected line assembling
PNS_LINE* PNS_SHOVE::assembleLine( const PNS_SEGMENT *aSeg, int *aIndex ) PNS_LINE* PNS_SHOVE::assembleLine( const PNS_SEGMENT* aSeg, int* aIndex )
{ {
PNS_LINE* l = m_currentNode->AssembleLine( const_cast<PNS_SEGMENT*>( aSeg ), aIndex ); PNS_LINE* l = m_currentNode->AssembleLine( const_cast<PNS_SEGMENT*>( aSeg ), aIndex );
m_gcItems.push_back(l); m_gcItems.push_back( l );
return l; return l;
} }
// garbage-collected line cloning // garbage-collected line cloning
PNS_LINE *PNS_SHOVE::cloneLine ( const PNS_LINE *aLine ) PNS_LINE* PNS_SHOVE::cloneLine ( const PNS_LINE* aLine )
{ {
PNS_LINE *l = aLine->Clone(); PNS_LINE* l = aLine->Clone();
m_gcItems.push_back( l ); m_gcItems.push_back( l );
return l; return l;
...@@ -88,7 +88,7 @@ PNS_LINE *PNS_SHOVE::cloneLine ( const PNS_LINE *aLine ) ...@@ -88,7 +88,7 @@ PNS_LINE *PNS_SHOVE::cloneLine ( const PNS_LINE *aLine )
// visually "outwards" of the line/via applying pressure on it. Unfortunately there's no // visually "outwards" of the line/via applying pressure on it. Unfortunately there's no
// mathematical concept of orientation of an open curve, so we use some primitive heuristics: // mathematical concept of orientation of an open curve, so we use some primitive heuristics:
// if the shoved line wraps around the start of the "pusher", it's likely shoved in wrong direction. // if the shoved line wraps around the start of the "pusher", it's likely shoved in wrong direction.
bool PNS_SHOVE::checkBumpDirection( PNS_LINE *aCurrent, PNS_LINE *aShoved ) const bool PNS_SHOVE::checkBumpDirection( PNS_LINE* aCurrent, PNS_LINE* aShoved ) const
{ {
const SEG ss = aCurrent->CSegment( 0 ); const SEG ss = aCurrent->CSegment( 0 );
...@@ -98,13 +98,13 @@ bool PNS_SHOVE::checkBumpDirection( PNS_LINE *aCurrent, PNS_LINE *aShoved ) cons ...@@ -98,13 +98,13 @@ bool PNS_SHOVE::checkBumpDirection( PNS_LINE *aCurrent, PNS_LINE *aShoved ) cons
dist += aShoved->Width() / 2; dist += aShoved->Width() / 2;
const VECTOR2I ps = ss.A - ( ss.B - ss.A ).Resize( dist ); const VECTOR2I ps = ss.A - ( ss.B - ss.A ).Resize( dist );
return !aShoved->CLine().PointOnEdge( ps ); return !aShoved->CLine().PointOnEdge( ps );
} }
PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::walkaroundLoneVia( PNS_LINE* aCurrent, PNS_LINE* aObstacle, PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::walkaroundLoneVia( PNS_LINE* aCurrent, PNS_LINE* aObstacle,
PNS_LINE* aShoved ) PNS_LINE* aShoved )
{ {
int clearance = m_currentNode->GetClearance( aCurrent, aObstacle ); int clearance = m_currentNode->GetClearance( aCurrent, aObstacle );
const SHAPE_LINE_CHAIN hull = aCurrent->Via().Hull( clearance, aObstacle->Width() ); const SHAPE_LINE_CHAIN hull = aCurrent->Via().Hull( clearance, aObstacle->Width() );
...@@ -157,7 +157,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::processHullSet( PNS_LINE* aCurrent, PNS_LINE* ...@@ -157,7 +157,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::processHullSet( PNS_LINE* aCurrent, PNS_LINE*
path.Simplify(); path.Simplify();
l.SetShape( path ); l.SetShape( path );
} }
for( int i = 0; i < std::min ( path.PointCount(), obs.PointCount() ); i++ ) for( int i = 0; i < std::min ( path.PointCount(), obs.PointCount() ); i++ )
{ {
if( path.CPoint( i ) != obs.CPoint( i ) ) if( path.CPoint( i ) != obs.CPoint( i ) )
...@@ -203,28 +203,28 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::processHullSet( PNS_LINE* aCurrent, PNS_LINE* ...@@ -203,28 +203,28 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::processHullSet( PNS_LINE* aCurrent, PNS_LINE*
TRACE( 100, "attempt %d fail self-intersect", attempt ); TRACE( 100, "attempt %d fail self-intersect", attempt );
continue; continue;
} }
bool colliding = m_currentNode->CheckColliding( &l, aCurrent ); bool colliding = m_currentNode->CheckColliding( &l, aCurrent );
if( ( aCurrent->Marker() & MK_HEAD ) && !colliding ) if( ( aCurrent->Marker() & MK_HEAD ) && !colliding )
{ {
PNS_JOINT* jtStart = m_currentNode->FindJoint( aCurrent->CPoint( 0 ), aCurrent ); PNS_JOINT* jtStart = m_currentNode->FindJoint( aCurrent->CPoint( 0 ), aCurrent );
BOOST_FOREACH( PNS_ITEM* item, jtStart->LinkList() ) BOOST_FOREACH( PNS_ITEM* item, jtStart->LinkList() )
{ {
if( m_currentNode->CheckColliding( item, &l ) ) if( m_currentNode->CheckColliding( item, &l ) )
colliding = true; colliding = true;
} }
} }
if( colliding ) if( colliding )
{ {
TRACE( 100, "attempt %d fail coll-check", attempt ); TRACE( 100, "attempt %d fail coll-check", attempt );
continue; continue;
} }
aShoved->SetShape( l.CLine() ); aShoved->SetShape( l.CLine() );
return SH_OK; return SH_OK;
} }
...@@ -254,7 +254,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::processSingleLine( PNS_LINE* aCurrent, PNS_LI ...@@ -254,7 +254,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::processSingleLine( PNS_LINE* aCurrent, PNS_LI
bool viaOnEnd = aCurrent->EndsWithVia(); bool viaOnEnd = aCurrent->EndsWithVia();
if( viaOnEnd && ( !aCurrent->LayersOverlap( aObstacle ) || aCurrent->SegmentCount() == 0 ) ) if( viaOnEnd && ( !aCurrent->LayersOverlap( aObstacle ) || aCurrent->SegmentCount() == 0 ) )
{ {
rv = walkaroundLoneVia( aCurrent, aObstacle, aShoved ); rv = walkaroundLoneVia( aCurrent, aObstacle, aShoved );
} }
...@@ -279,7 +279,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::processSingleLine( PNS_LINE* aCurrent, PNS_LI ...@@ -279,7 +279,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::processSingleLine( PNS_LINE* aCurrent, PNS_LI
rv = processHullSet ( aCurrent, aObstacle, aShoved, hulls ); rv = processHullSet ( aCurrent, aObstacle, aShoved, hulls );
} }
if( obstacleIsHead ) if( obstacleIsHead )
aShoved->Mark( aShoved->Marker() | MK_HEAD ); aShoved->Mark( aShoved->Marker() | MK_HEAD );
...@@ -292,16 +292,16 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSegment( PNS_LINE* aCurrent, PNS_S ...@@ -292,16 +292,16 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSegment( PNS_LINE* aCurrent, PNS_S
int segIndex; int segIndex;
PNS_LINE* obstacleLine = assembleLine( aObstacleSeg, &segIndex ); PNS_LINE* obstacleLine = assembleLine( aObstacleSeg, &segIndex );
PNS_LINE* shovedLine = cloneLine( obstacleLine ); PNS_LINE* shovedLine = cloneLine( obstacleLine );
SHOVE_STATUS rv = processSingleLine( aCurrent, obstacleLine, shovedLine ); SHOVE_STATUS rv = processSingleLine( aCurrent, obstacleLine, shovedLine );
assert ( obstacleLine->LayersOverlap( shovedLine ) ); assert ( obstacleLine->LayersOverlap( shovedLine ) );
if( rv == SH_OK ) if( rv == SH_OK )
{ {
if ( shovedLine->Marker() & MK_HEAD ) if( shovedLine->Marker() & MK_HEAD )
m_newHead = *shovedLine; m_newHead = *shovedLine;
sanityCheck( obstacleLine, shovedLine ); sanityCheck( obstacleLine, shovedLine );
m_currentNode->Replace( obstacleLine, shovedLine ); m_currentNode->Replace( obstacleLine, shovedLine );
sanityCheck( obstacleLine, shovedLine ); sanityCheck( obstacleLine, shovedLine );
...@@ -313,18 +313,18 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSegment( PNS_LINE* aCurrent, PNS_S ...@@ -313,18 +313,18 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSegment( PNS_LINE* aCurrent, PNS_S
} }
#ifdef DEBUG #ifdef DEBUG
m_logger.NewGroup ("on-colliding-segment", m_iter); m_logger.NewGroup( "on-colliding-segment", m_iter );
m_logger.Log ( aObstacleSeg, 0, "obstacle-segment"); m_logger.Log( aObstacleSeg, 0, "obstacle-segment" );
m_logger.Log ( aCurrent, 1, "current-line"); m_logger.Log( aCurrent, 1, "current-line" );
m_logger.Log ( obstacleLine, 2, "obstacle-line"); m_logger.Log( obstacleLine, 2, "obstacle-line" );
m_logger.Log ( shovedLine, 3, "shoved-line"); m_logger.Log( shovedLine, 3, "shoved-line" );
#endif #endif
return rv; return rv;
} }
PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingLine( PNS_LINE *aCurrent, PNS_LINE *aObstacle ) PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingLine( PNS_LINE* aCurrent, PNS_LINE* aObstacle )
{ {
PNS_LINE* shovedLine = cloneLine( aObstacle ); PNS_LINE* shovedLine = cloneLine( aObstacle );
...@@ -332,13 +332,13 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingLine( PNS_LINE *aCurrent, PNS_LINE ...@@ -332,13 +332,13 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingLine( PNS_LINE *aCurrent, PNS_LINE
if( rv == SH_OK ) if( rv == SH_OK )
{ {
if ( shovedLine->Marker() & MK_HEAD ) if( shovedLine->Marker() & MK_HEAD )
m_newHead = *shovedLine; m_newHead = *shovedLine;
sanityCheck( aObstacle, shovedLine ); sanityCheck( aObstacle, shovedLine );
m_currentNode->Replace( aObstacle, shovedLine ); m_currentNode->Replace( aObstacle, shovedLine );
sanityCheck( aObstacle, shovedLine ); sanityCheck( aObstacle, shovedLine );
int rank = aObstacle->Rank(); int rank = aObstacle->Rank();
shovedLine->SetRank ( rank ); shovedLine->SetRank ( rank );
...@@ -360,12 +360,12 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE* aCurrent, PNS_SOL ...@@ -360,12 +360,12 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE* aCurrent, PNS_SOL
{ {
PNS_WALKAROUND walkaround( m_currentNode, Router() ); PNS_WALKAROUND walkaround( m_currentNode, Router() );
PNS_LINE* walkaroundLine = cloneLine( aCurrent ); PNS_LINE* walkaroundLine = cloneLine( aCurrent );
if( aCurrent->EndsWithVia() ) if( aCurrent->EndsWithVia() )
{ {
PNS_VIA vh = aCurrent->Via(); PNS_VIA vh = aCurrent->Via();
PNS_VIA* via = NULL; PNS_VIA* via = NULL;
PNS_JOINT* jtStart = m_currentNode->FindJoint ( vh.Pos(), aCurrent ); PNS_JOINT* jtStart = m_currentNode->FindJoint( vh.Pos(), aCurrent );
if( !jtStart ) if( !jtStart )
return SH_INCOMPLETE; return SH_INCOMPLETE;
...@@ -378,14 +378,14 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE* aCurrent, PNS_SOL ...@@ -378,14 +378,14 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE* aCurrent, PNS_SOL
break; break;
} }
} }
if( via && m_currentNode->CheckColliding( via, aObstacleSolid ) ) if( via && m_currentNode->CheckColliding( via, aObstacleSolid ) )
return onCollidingVia( aObstacleSolid, via ); return onCollidingVia( aObstacleSolid, via );
} }
walkaround.SetSolidsOnly( true ); walkaround.SetSolidsOnly( true );
walkaround.SetIterationLimit ( 8 ); // fixme: make configurable walkaround.SetIterationLimit ( 8 ); // fixme: make configurable
int currentRank = aCurrent->Rank(); int currentRank = aCurrent->Rank();
int nextRank; int nextRank;
...@@ -399,7 +399,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE* aCurrent, PNS_SOL ...@@ -399,7 +399,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE* aCurrent, PNS_SOL
nextRank = currentRank - 1; nextRank = currentRank - 1;
walkaround.SetSingleDirection( true ); walkaround.SetSingleDirection( true );
} }
if( walkaround.Route( *aCurrent, *walkaroundLine, false ) != PNS_WALKAROUND::DONE ) if( walkaround.Route( *aCurrent, *walkaroundLine, false ) != PNS_WALKAROUND::DONE )
return SH_INCOMPLETE; return SH_INCOMPLETE;
...@@ -415,10 +415,10 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE* aCurrent, PNS_SOL ...@@ -415,10 +415,10 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE* aCurrent, PNS_SOL
walkaroundLine->Mark( MK_HEAD ); walkaroundLine->Mark( MK_HEAD );
m_newHead = *walkaroundLine; m_newHead = *walkaroundLine;
} }
m_currentNode->Replace( aCurrent, walkaroundLine ); m_currentNode->Replace( aCurrent, walkaroundLine );
walkaroundLine->SetRank ( nextRank ); walkaroundLine->SetRank( nextRank );
#ifdef DEBUG #ifdef DEBUG
m_logger.NewGroup( "on-colliding-solid", m_iter ); m_logger.NewGroup( "on-colliding-solid", m_iter );
m_logger.Log( aObstacleSolid, 0, "obstacle-solid" ); m_logger.Log( aObstacleSolid, 0, "obstacle-solid" );
...@@ -444,7 +444,7 @@ bool PNS_SHOVE::reduceSpringback( const PNS_ITEMSET& aHeadSet ) ...@@ -444,7 +444,7 @@ bool PNS_SHOVE::reduceSpringback( const PNS_ITEMSET& aHeadSet )
if( !spTag.m_node->CheckColliding( aHeadSet ) ) if( !spTag.m_node->CheckColliding( aHeadSet ) )
{ {
rv = true; rv = true;
delete spTag.m_node; delete spTag.m_node;
m_nodeStack.pop_back(); m_nodeStack.pop_back();
} }
...@@ -498,9 +498,9 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc ...@@ -498,9 +498,9 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc
PNS_SEGMENT* seg = (PNS_SEGMENT*) item; PNS_SEGMENT* seg = (PNS_SEGMENT*) item;
LINE_PAIR lp; LINE_PAIR lp;
int segIndex; int segIndex;
lp.first = assembleLine( seg, &segIndex ); lp.first = assembleLine( seg, &segIndex );
assert( segIndex == 0 || ( segIndex == ( lp.first->SegmentCount() - 1 ) ) ); assert( segIndex == 0 || ( segIndex == ( lp.first->SegmentCount() - 1 ) ) );
if( segIndex == 0 ) if( segIndex == 0 )
...@@ -523,10 +523,10 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc ...@@ -523,10 +523,10 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc
pushedVia->SetRank( aCurrentRank - 1 ); pushedVia->SetRank( aCurrentRank - 1 );
#ifdef DEBUG #ifdef DEBUG
m_logger.Log ( aVia, 0, "obstacle-via"); m_logger.Log( aVia, 0, "obstacle-via" );
m_logger.Log ( pushedVia, 1, "pushed-via"); m_logger.Log( pushedVia, 1, "pushed-via" );
#endif #endif
BOOST_FOREACH( LINE_PAIR lp, draggedLines ) BOOST_FOREACH( LINE_PAIR lp, draggedLines )
{ {
if( lp.first->Marker() & MK_HEAD ) if( lp.first->Marker() & MK_HEAD )
...@@ -535,13 +535,13 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc ...@@ -535,13 +535,13 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc
m_newHead = *lp.second; m_newHead = *lp.second;
} }
unwindStack(lp.first); unwindStack( lp.first );
if( lp.second->SegmentCount() ) if( lp.second->SegmentCount() )
{ {
m_currentNode->Replace( lp.first, lp.second ); m_currentNode->Replace( lp.first, lp.second );
lp.second->SetRank( aCurrentRank - 1 ); lp.second->SetRank( aCurrentRank - 1 );
pushLine( lp.second ); pushLine( lp.second );
} }
else else
m_currentNode->Remove( lp.first ); m_currentNode->Remove( lp.first );
...@@ -556,12 +556,12 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc ...@@ -556,12 +556,12 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc
} }
PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingVia (PNS_ITEM* aCurrent, PNS_VIA* aObstacleVia ) PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingVia( PNS_ITEM* aCurrent, PNS_VIA* aObstacleVia )
{ {
int clearance = m_currentNode->GetClearance( aCurrent, aObstacleVia ) ; int clearance = m_currentNode->GetClearance( aCurrent, aObstacleVia ) ;
LINE_PAIR_VEC draggedLines; LINE_PAIR_VEC draggedLines;
bool colLine = false, colVia = false; bool colLine = false, colVia = false;
PNS_LINE *currentLine = NULL; PNS_LINE* currentLine = NULL;
VECTOR2I mtvLine, mtvVia, mtv, mtvSolid; VECTOR2I mtvLine, mtvVia, mtv, mtvSolid;
int rank = -1; int rank = -1;
...@@ -573,12 +573,12 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingVia (PNS_ITEM* aCurrent, PNS_VIA* ...@@ -573,12 +573,12 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingVia (PNS_ITEM* aCurrent, PNS_VIA*
#endif #endif
currentLine = (PNS_LINE*) aCurrent; currentLine = (PNS_LINE*) aCurrent;
colLine = CollideShapes( aObstacleVia->Shape(), currentLine->Shape(), colLine = CollideShapes( aObstacleVia->Shape(), currentLine->Shape(),
clearance + currentLine->Width() / 2 + PNS_HULL_MARGIN, clearance + currentLine->Width() / 2 + PNS_HULL_MARGIN,
true, mtvLine ); true, mtvLine );
if( currentLine->EndsWithVia() ) if( currentLine->EndsWithVia() )
colVia = CollideShapes( currentLine->Via().Shape(), aObstacleVia->Shape(), colVia = CollideShapes( currentLine->Via().Shape(), aObstacleVia->Shape(),
clearance + PNS_HULL_MARGIN, true, mtvVia ); clearance + PNS_HULL_MARGIN, true, mtvVia );
if( !colLine && !colVia ) if( !colLine && !colVia )
...@@ -590,18 +590,18 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingVia (PNS_ITEM* aCurrent, PNS_VIA* ...@@ -590,18 +590,18 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingVia (PNS_ITEM* aCurrent, PNS_VIA*
mtv = mtvLine; mtv = mtvLine;
else else
mtv = mtvVia; mtv = mtvVia;
rank = currentLine->Rank(); rank = currentLine->Rank();
} }
else if (aCurrent->OfKind(PNS_ITEM::SOLID)) else if( aCurrent->OfKind( PNS_ITEM::SOLID ) )
{ {
CollideShapes( aObstacleVia->Shape(), aCurrent->Shape(), CollideShapes( aObstacleVia->Shape(), aCurrent->Shape(),
clearance + PNS_HULL_MARGIN, true, mtvSolid ); clearance + PNS_HULL_MARGIN, true, mtvSolid );
mtv = mtvSolid; mtv = -mtvSolid;
rank = aCurrent->Rank() + 10000; rank = aCurrent->Rank() + 10000;
} }
return pushVia( aObstacleVia, mtv, rank ); return pushVia( aObstacleVia, mtv, rank );
} }
...@@ -617,19 +617,19 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE* aCurrent, PN ...@@ -617,19 +617,19 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE* aCurrent, PN
shoved->ClearSegmentLinks(); shoved->ClearSegmentLinks();
cur->RemoveVia(); cur->RemoveVia();
unwindStack(aCurrent); unwindStack( aCurrent );
BOOST_FOREACH( PNS_ITEM* item, jt->LinkList() ) BOOST_FOREACH( PNS_ITEM* item, jt->LinkList() )
{ {
if( item->OfKind( PNS_ITEM::SEGMENT ) && item->LayersOverlap( aCurrent ) ) if( item->OfKind( PNS_ITEM::SEGMENT ) && item->LayersOverlap( aCurrent ) )
{ {
PNS_SEGMENT* seg = (PNS_SEGMENT*) item; PNS_SEGMENT* seg = (PNS_SEGMENT*) item;
PNS_LINE* head = assembleLine( seg ); PNS_LINE* head = assembleLine( seg );
head->AppendVia( *aObstacleVia ); head->AppendVia( *aObstacleVia );
SHOVE_STATUS st = processSingleLine ( head, cur, shoved ); SHOVE_STATUS st = processSingleLine( head, cur, shoved );
if( st != SH_OK ) if( st != SH_OK )
{ {
#ifdef DEBUG #ifdef DEBUG
...@@ -641,7 +641,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE* aCurrent, PN ...@@ -641,7 +641,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE* aCurrent, PN
return st; return st;
} }
cur->SetShape( shoved->CLine() ); cur->SetShape( shoved->CLine() );
n++; n++;
} }
...@@ -654,7 +654,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE* aCurrent, PN ...@@ -654,7 +654,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE* aCurrent, PN
m_logger.Log( aObstacleVia, 0, "the-via" ); m_logger.Log( aObstacleVia, 0, "the-via" );
m_logger.Log( aCurrent, 1, "current-line" ); m_logger.Log( aCurrent, 1, "current-line" );
#endif #endif
PNS_LINE head( *aCurrent ); PNS_LINE head( *aCurrent );
head.Line().Clear(); head.Line().Clear();
head.AppendVia( *aObstacleVia ); head.AppendVia( *aObstacleVia );
...@@ -665,7 +665,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE* aCurrent, PN ...@@ -665,7 +665,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE* aCurrent, PN
if( st != SH_OK ) if( st != SH_OK )
return st; return st;
cur->SetShape ( shoved->CLine() ); cur->SetShape( shoved->CLine() );
} }
if( aCurrent->EndsWithVia() ) if( aCurrent->EndsWithVia() )
...@@ -678,12 +678,12 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE* aCurrent, PN ...@@ -678,12 +678,12 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE* aCurrent, PN
m_logger.Log( shoved, 3, "shoved-line" ); m_logger.Log( shoved, 3, "shoved-line" );
#endif #endif
int currentRank = aCurrent->Rank(); int currentRank = aCurrent->Rank();
m_currentNode->Replace ( aCurrent, shoved ); m_currentNode->Replace( aCurrent, shoved );
pushLine( shoved ); pushLine( shoved );
shoved->SetRank( currentRank ); shoved->SetRank( currentRank );
return SH_OK; return SH_OK;
} }
...@@ -691,7 +691,7 @@ void PNS_SHOVE::unwindStack( PNS_SEGMENT *aSeg ) ...@@ -691,7 +691,7 @@ void PNS_SHOVE::unwindStack( PNS_SEGMENT *aSeg )
{ {
for( std::vector<PNS_LINE*>::iterator i = m_lineStack.begin(); i != m_lineStack.end(); ) for( std::vector<PNS_LINE*>::iterator i = m_lineStack.begin(); i != m_lineStack.end(); )
{ {
if( (*i)->ContainsSegment ( aSeg ) ) if( (*i)->ContainsSegment( aSeg ) )
i = m_lineStack.erase( i ); i = m_lineStack.erase( i );
else else
i++; i++;
...@@ -703,7 +703,7 @@ void PNS_SHOVE::unwindStack( PNS_SEGMENT *aSeg ) ...@@ -703,7 +703,7 @@ void PNS_SHOVE::unwindStack( PNS_SEGMENT *aSeg )
i = m_optimizerQueue.erase( i ); i = m_optimizerQueue.erase( i );
else else
i++; i++;
} }
} }
...@@ -715,20 +715,20 @@ void PNS_SHOVE::unwindStack( PNS_ITEM* aItem ) ...@@ -715,20 +715,20 @@ void PNS_SHOVE::unwindStack( PNS_ITEM* aItem )
{ {
PNS_LINE* l = static_cast<PNS_LINE*>( aItem ); PNS_LINE* l = static_cast<PNS_LINE*>( aItem );
if ( !l->LinkedSegments() ) if( !l->LinkedSegments() )
return; return;
BOOST_FOREACH( PNS_SEGMENT* seg, *l->LinkedSegments() ) BOOST_FOREACH( PNS_SEGMENT* seg, *l->LinkedSegments() )
unwindStack( seg ); unwindStack( seg );
} }
} }
void PNS_SHOVE::pushLine( PNS_LINE* aL ) void PNS_SHOVE::pushLine( PNS_LINE* aL )
{ {
if( aL->LinkCount() >= 0 && ( aL->LinkCount() != aL->SegmentCount() ) ) if( aL->LinkCount() >= 0 && ( aL->LinkCount() != aL->SegmentCount() ) )
assert( false ); assert( false );
m_lineStack.push_back( aL ); m_lineStack.push_back( aL );
m_optimizerQueue.push_back( aL ); m_optimizerQueue.push_back( aL );
} }
...@@ -756,18 +756,18 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter ) ...@@ -756,18 +756,18 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter )
{ {
PNS_LINE* currentLine = m_lineStack.back(); PNS_LINE* currentLine = m_lineStack.back();
PNS_NODE::OPT_OBSTACLE nearest; PNS_NODE::OPT_OBSTACLE nearest;
SHOVE_STATUS st; SHOVE_STATUS st = SH_NULL;
PNS_ITEM::PnsKind search_order[] = { PNS_ITEM::SOLID, PNS_ITEM::VIA, PNS_ITEM::SEGMENT }; PNS_ITEM::PnsKind search_order[] = { PNS_ITEM::SOLID, PNS_ITEM::VIA, PNS_ITEM::SEGMENT };
for( int i = 0; i < 3; i++ ) for( int i = 0; i < 3; i++ )
{ {
nearest = m_currentNode->NearestObstacle( currentLine, search_order[i] ); nearest = m_currentNode->NearestObstacle( currentLine, search_order[i] );
if( nearest ) if( nearest )
break; break;
} }
if( !nearest ) if( !nearest )
{ {
m_lineStack.pop_back(); m_lineStack.pop_back();
...@@ -786,7 +786,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter ) ...@@ -786,7 +786,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter )
{ {
PNS_VIA* revVia = (PNS_VIA*) ni; PNS_VIA* revVia = (PNS_VIA*) ni;
TRACE( 2, "iter %d: reverse-collide-via", aIter ); TRACE( 2, "iter %d: reverse-collide-via", aIter );
if( currentLine->EndsWithVia() && m_currentNode->CheckColliding( &currentLine->Via(), revVia ) ) if( currentLine->EndsWithVia() && m_currentNode->CheckColliding( &currentLine->Via(), revVia ) )
{ {
st = SH_INCOMPLETE; st = SH_INCOMPLETE;
...@@ -798,7 +798,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter ) ...@@ -798,7 +798,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter )
break; break;
} }
case PNS_ITEM::SEGMENT: case PNS_ITEM::SEGMENT:
{ {
PNS_SEGMENT* seg = (PNS_SEGMENT*) ni; PNS_SEGMENT* seg = (PNS_SEGMENT*) ni;
...@@ -819,23 +819,23 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter ) ...@@ -819,23 +819,23 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter )
{ // "forward" collisoins { // "forward" collisoins
switch( ni->Kind() ) switch( ni->Kind() )
{ {
case PNS_ITEM::SEGMENT: case PNS_ITEM::SEGMENT:
TRACE( 2, "iter %d: collide-segment ", aIter ); TRACE( 2, "iter %d: collide-segment ", aIter );
st = onCollidingSegment( currentLine, (PNS_SEGMENT*) ni ); st = onCollidingSegment( currentLine, (PNS_SEGMENT*) ni );
break; break;
case PNS_ITEM::VIA: case PNS_ITEM::VIA:
TRACE( 2, "iter %d: shove-via ", aIter ); TRACE( 2, "iter %d: shove-via ", aIter );
st = onCollidingVia( currentLine, (PNS_VIA*) ni ); st = onCollidingVia( currentLine, (PNS_VIA*) ni );
break; break;
case PNS_ITEM::SOLID: case PNS_ITEM::SOLID:
TRACE( 2, "iter %d: walk-solid ", aIter ); TRACE( 2, "iter %d: walk-solid ", aIter );
st = onCollidingSolid( currentLine, (PNS_SOLID*) ni ); st = onCollidingSolid( currentLine, (PNS_SOLID*) ni );
break; break;
default: default:
break; break;
} }
} }
...@@ -863,7 +863,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveMainLoop() ...@@ -863,7 +863,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveMainLoop()
m_iter++; m_iter++;
if( st == SH_INCOMPLETE || timeLimit.Expired() || m_iter >= iterLimit ) if( st == SH_INCOMPLETE || timeLimit.Expired() || m_iter >= iterLimit )
{ {
st = SH_INCOMPLETE; st = SH_INCOMPLETE;
break; break;
...@@ -884,7 +884,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead ) ...@@ -884,7 +884,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead )
PNS_LINE* head = cloneLine( &aCurrentHead ); PNS_LINE* head = cloneLine( &aCurrentHead );
head->ClearSegmentLinks(); head->ClearSegmentLinks();
m_lineStack.clear(); m_lineStack.clear();
m_optimizerQueue.clear(); m_optimizerQueue.clear();
m_newHead = OPT_LINE(); m_newHead = OPT_LINE();
...@@ -899,7 +899,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead ) ...@@ -899,7 +899,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead )
m_currentNode = parent->Branch(); m_currentNode = parent->Branch();
m_currentNode->ClearRanks(); m_currentNode->ClearRanks();
m_currentNode->Add( head ); m_currentNode->Add( head );
head->Mark( MK_HEAD ); head->Mark( MK_HEAD );
head->SetRank( 100000 ); head->SetRank( 100000 );
...@@ -921,11 +921,11 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead ) ...@@ -921,11 +921,11 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead )
st = shoveMainLoop(); st = shoveMainLoop();
runOptimizer( m_currentNode, head ); runOptimizer( m_currentNode, head );
if( m_newHead && st == SH_OK ) if( m_newHead && st == SH_OK )
{ {
st = SH_HEAD_MODIFIED; st = SH_HEAD_MODIFIED;
Router()->DisplayDebugLine( m_newHead->CLine(), 3, 20000 ); //Router()->DisplayDebugLine( m_newHead->CLine(), 3, 20000 );
} }
m_currentNode->RemoveByMarker( MK_HEAD ); m_currentNode->RemoveByMarker( MK_HEAD );
...@@ -939,9 +939,9 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead ) ...@@ -939,9 +939,9 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead )
else else
{ {
delete m_currentNode; delete m_currentNode;
m_currentNode = parent; m_currentNode = parent;
m_newHead = OPT_LINE(); m_newHead = OPT_LINE();
} }
return st; return st;
...@@ -952,7 +952,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveDraggingVia( PNS_VIA* aVia, const VECTOR ...@@ -952,7 +952,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveDraggingVia( PNS_VIA* aVia, const VECTOR
PNS_VIA** aNewVia ) PNS_VIA** aNewVia )
{ {
SHOVE_STATUS st = SH_OK; SHOVE_STATUS st = SH_OK;
m_lineStack.clear(); m_lineStack.clear();
m_optimizerQueue.clear(); m_optimizerQueue.clear();
m_newHead = OPT_LINE(); m_newHead = OPT_LINE();
...@@ -996,25 +996,25 @@ void PNS_SHOVE::runOptimizer( PNS_NODE* aNode, PNS_LINE* aHead ) ...@@ -996,25 +996,25 @@ void PNS_SHOVE::runOptimizer( PNS_NODE* aNode, PNS_LINE* aHead )
switch( effort ) switch( effort )
{ {
case OE_LOW: case OE_LOW:
optFlags = PNS_OPTIMIZER::MERGE_OBTUSE; optFlags = PNS_OPTIMIZER::MERGE_OBTUSE;
n_passes = 1; n_passes = 1;
extend = 0; extend = 0;
break; break;
case OE_MEDIUM: case OE_MEDIUM:
optFlags = PNS_OPTIMIZER::MERGE_OBTUSE; optFlags = PNS_OPTIMIZER::MERGE_OBTUSE;
n_passes = 2; n_passes = 2;
extend = 1; extend = 1;
break; break;
case OE_FULL: case OE_FULL:
optFlags = PNS_OPTIMIZER::MERGE_SEGMENTS; optFlags = PNS_OPTIMIZER::MERGE_SEGMENTS;
n_passes = 2; n_passes = 2;
break; break;
default: default:
break; break;
} }
if( Settings().SmartPads() ) if( Settings().SmartPads() )
...@@ -1028,10 +1028,10 @@ void PNS_SHOVE::runOptimizer( PNS_NODE* aNode, PNS_LINE* aHead ) ...@@ -1028,10 +1028,10 @@ void PNS_SHOVE::runOptimizer( PNS_NODE* aNode, PNS_LINE* aHead )
std::reverse( m_optimizerQueue.begin(), m_optimizerQueue.end() ); std::reverse( m_optimizerQueue.begin(), m_optimizerQueue.end() );
for( std::vector<PNS_LINE*>::iterator i = m_optimizerQueue.begin(); for( std::vector<PNS_LINE*>::iterator i = m_optimizerQueue.begin();
i != m_optimizerQueue.end(); ++i) i != m_optimizerQueue.end(); ++i )
{ {
PNS_LINE* line = *i; PNS_LINE* line = *i;
if( !( line -> Marker() & MK_HEAD ) ) if( !( line -> Marker() & MK_HEAD ) )
{ {
if( effort == OE_MEDIUM || effort == OE_LOW ) if( effort == OE_MEDIUM || effort == OE_LOW )
...@@ -1057,12 +1057,10 @@ void PNS_SHOVE::runOptimizer( PNS_NODE* aNode, PNS_LINE* aHead ) ...@@ -1057,12 +1057,10 @@ void PNS_SHOVE::runOptimizer( PNS_NODE* aNode, PNS_LINE* aHead )
} }
} }
} }
} }
const RANGE<int> PNS_SHOVE::findShovedVertexRange( PNS_LINE *aL ) const RANGE<int> PNS_SHOVE::findShovedVertexRange( PNS_LINE* aL )
{ {
RANGE<int> r; RANGE<int> r;
...@@ -1116,8 +1114,9 @@ const PNS_LINE PNS_SHOVE::NewHead() const ...@@ -1116,8 +1114,9 @@ const PNS_LINE PNS_SHOVE::NewHead() const
return *m_newHead; return *m_newHead;
} }
void PNS_SHOVE::SetInitialLine( PNS_LINE* aInitial ) void PNS_SHOVE::SetInitialLine( PNS_LINE* aInitial )
{ {
m_root = m_root->Branch(); m_root = m_root->Branch();
m_root->Remove ( aInitial ); m_root->Remove( aInitial );
} }
...@@ -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;
......
...@@ -38,7 +38,7 @@ ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM( const PNS_ITEM* aItem, VIEW_GROUP* aPa ...@@ -38,7 +38,7 @@ ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM( const PNS_ITEM* aItem, VIEW_GROUP* aPa
EDA_ITEM( NOT_USED ) EDA_ITEM( NOT_USED )
{ {
m_parent = aParent; m_parent = aParent;
m_shape = NULL; m_shape = NULL;
m_clearance = -1; m_clearance = -1;
m_originLayer = m_layer = ITEM_GAL_LAYER( GP_OVERLAY ); m_originLayer = m_layer = ITEM_GAL_LAYER( GP_OVERLAY );
...@@ -64,7 +64,7 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS_ITEM* aItem ) ...@@ -64,7 +64,7 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS_ITEM* aItem )
m_color.a = 0.8; m_color.a = 0.8;
m_depth = BaseOverlayDepth - aItem->Layers().Start(); m_depth = BaseOverlayDepth - aItem->Layers().Start();
m_shape = aItem->Shape()->Clone(); m_shape = aItem->Shape()->Clone();
switch( aItem->Kind() ) switch( aItem->Kind() )
{ {
case PNS_ITEM::LINE: case PNS_ITEM::LINE:
...@@ -81,6 +81,7 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS_ITEM* aItem ) ...@@ -81,6 +81,7 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS_ITEM* aItem )
} }
case PNS_ITEM::VIA: case PNS_ITEM::VIA:
m_originLayer = m_layer = ITEM_GAL_LAYER( VIAS_VISIBLE );
m_type = PR_SHAPE; m_type = PR_SHAPE;
m_width = 0; m_width = 0;
m_color = COLOR4D( 0.7, 0.7, 0.7, 0.8 ); m_color = COLOR4D( 0.7, 0.7, 0.7, 0.8 );
...@@ -98,7 +99,7 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS_ITEM* aItem ) ...@@ -98,7 +99,7 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS_ITEM* aItem )
if( aItem->Marker() & MK_VIOLATION ) if( aItem->Marker() & MK_VIOLATION )
m_color = COLOR4D( 0, 1, 0, 1 ); m_color = COLOR4D( 0, 1, 0, 1 );
if( aItem->Marker() & MK_HEAD ) if( aItem->Marker() & MK_HEAD )
m_color.Brighten( 0.7 ); m_color.Brighten( 0.7 );
...@@ -177,7 +178,7 @@ void ROUTER_PREVIEW_ITEM::ViewDraw( int aLayer, KIGFX::GAL* aGal ) const ...@@ -177,7 +178,7 @@ void ROUTER_PREVIEW_ITEM::ViewDraw( int aLayer, KIGFX::GAL* aGal ) const
aGal->SetLineWidth( m_width + 2 * m_clearance ); aGal->SetLineWidth( m_width + 2 * m_clearance );
aGal->DrawLine( s->GetSeg().A, s->GetSeg().B ); aGal->DrawLine( s->GetSeg().A, s->GetSeg().B );
} }
break; break;
} }
...@@ -193,7 +194,7 @@ void ROUTER_PREVIEW_ITEM::ViewDraw( int aLayer, KIGFX::GAL* aGal ) const ...@@ -193,7 +194,7 @@ void ROUTER_PREVIEW_ITEM::ViewDraw( int aLayer, KIGFX::GAL* aGal ) const
aGal->SetIsStroke( false ); aGal->SetIsStroke( false );
aGal->DrawCircle( c->GetCenter(), c->GetRadius() + m_clearance ); aGal->DrawCircle( c->GetCenter(), c->GetRadius() + m_clearance );
} }
break; break;
} }
...@@ -224,7 +225,7 @@ void ROUTER_PREVIEW_ITEM::ViewDraw( int aLayer, KIGFX::GAL* aGal ) const ...@@ -224,7 +225,7 @@ void ROUTER_PREVIEW_ITEM::ViewDraw( int aLayer, KIGFX::GAL* aGal ) const
void ROUTER_PREVIEW_ITEM::Line( const SHAPE_LINE_CHAIN& aLine, int aWidth, int aStyle ) void ROUTER_PREVIEW_ITEM::Line( const SHAPE_LINE_CHAIN& aLine, int aWidth, int aStyle )
{ {
m_originLayer = m_layer = 0; m_originLayer = m_layer = 0;
m_width = aWidth; m_width = aWidth;
m_color = assignColor( aStyle ); m_color = assignColor( aStyle );
m_type = PR_SHAPE; m_type = PR_SHAPE;
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <macros.h> #include <macros.h>
#include <pcbnew_id.h> #include <pcbnew_id.h>
#include <view/view_controls.h> #include <view/view_controls.h>
#include <pcbcommon.h>
#include <pcb_painter.h> #include <pcb_painter.h>
#include <dialogs/dialog_pns_settings.h> #include <dialogs/dialog_pns_settings.h>
#include <dialogs/dialog_track_via_size.h> #include <dialogs/dialog_track_via_size.h>
...@@ -303,7 +304,7 @@ PNS_ITEM* ROUTER_TOOL::pickSingleItem( const VECTOR2I& aWhere, int aNet, int aLa ...@@ -303,7 +304,7 @@ PNS_ITEM* ROUTER_TOOL::pickSingleItem( const VECTOR2I& aWhere, int aNet, int aLa
PNS_ITEM* prioritized[4]; PNS_ITEM* prioritized[4];
for(int i = 0; i < 4; i++) for( int i = 0; i < 4; i++ )
prioritized[i] = 0; prioritized[i] = 0;
PNS_ITEMSET candidates = m_router->QueryHoverItems( aWhere ); PNS_ITEMSET candidates = m_router->QueryHoverItems( aWhere );
...@@ -377,6 +378,9 @@ void ROUTER_TOOL::highlightNet( bool aEnabled, int aNetcode ) ...@@ -377,6 +378,9 @@ void ROUTER_TOOL::highlightNet( bool aEnabled, int aNetcode )
void ROUTER_TOOL::handleCommonEvents( TOOL_EVENT& aEvent ) void ROUTER_TOOL::handleCommonEvents( TOOL_EVENT& aEvent )
{ {
PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME> ();
BOARD* board = getModel<BOARD> ();
#ifdef DEBUG #ifdef DEBUG
if( aEvent.IsKeyPressed() ) if( aEvent.IsKeyPressed() )
{ {
...@@ -392,36 +396,32 @@ void ROUTER_TOOL::handleCommonEvents( TOOL_EVENT& aEvent ) ...@@ -392,36 +396,32 @@ void ROUTER_TOOL::handleCommonEvents( TOOL_EVENT& aEvent )
#endif #endif
if( aEvent.IsAction( &ACT_RouterOptions ) ) if( aEvent.IsAction( &ACT_RouterOptions ) )
{ {
DIALOG_PNS_SETTINGS settingsDlg( getEditFrame<PCB_EDIT_FRAME>(), m_router->Settings() ); DIALOG_PNS_SETTINGS settingsDlg( frame, m_router->Settings() );
if( settingsDlg.ShowModal() ) if( settingsDlg.ShowModal() )
m_router->ApplySettings(); {
// FIXME: do we need an explicit update?
}
} }
else if( aEvent.IsAction( &ACT_CustomTrackWidth ) ) else if( aEvent.IsAction( &ACT_CustomTrackWidth ) )
{ {
DIALOG_TRACK_VIA_SIZE sizeDlg( getEditFrame<PCB_EDIT_FRAME>(), m_router->Settings() ); BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
BOARD_DESIGN_SETTINGS& bds = getModel<BOARD>()->GetDesignSettings(); DIALOG_TRACK_VIA_SIZE sizeDlg( frame, bds );
sizeDlg.ShowModal();
// TODO it should be changed, router settings won't keep track & via sizes in the future if( sizeDlg.ShowModal() )
bds.SetCustomTrackWidth( m_router->Settings().GetTrackWidth() ); {
bds.SetCustomViaSize( m_router->Settings().GetViaDiameter() ); bds.UseCustomTrackViaSize( true );
bds.SetCustomViaDrill( m_router->Settings().GetViaDrill() ); m_toolMgr->RunAction( COMMON_ACTIONS::trackViaSizeChanged );
bds.UseCustomTrackViaSize( true ); }
m_toolMgr->RunAction( COMMON_ACTIONS::trackViaSizeChanged );
} }
else if( aEvent.IsAction( &COMMON_ACTIONS::trackViaSizeChanged ) ) else if( aEvent.IsAction( &COMMON_ACTIONS::trackViaSizeChanged ) )
{ {
BOARD_DESIGN_SETTINGS& bds = getModel<BOARD>()->GetDesignSettings();
m_router->Settings().SetTrackWidth( bds.GetCurrentTrackWidth() ); PNS_SIZES_SETTINGS sizes;
m_router->Settings().SetViaDiameter( bds.GetCurrentViaSize() ); sizes.ImportCurrent ( board->GetDesignSettings() );
m_router->Settings().SetViaDrill( bds.GetCurrentViaDrill() ); m_router->UpdateSizes ( sizes );
m_router->ApplySettings();
} }
} }
...@@ -437,7 +437,7 @@ void ROUTER_TOOL::updateStartItem( TOOL_EVENT& aEvent ) ...@@ -437,7 +437,7 @@ void ROUTER_TOOL::updateStartItem( TOOL_EVENT& aEvent )
{ {
VECTOR2I p = aEvent.Position(); VECTOR2I p = aEvent.Position();
startItem = pickSingleItem( p ); startItem = pickSingleItem( p );
bool snapEnabled = !aEvent.Modifier(MD_SHIFT); bool snapEnabled = !aEvent.Modifier( MD_SHIFT );
m_router->EnableSnapping ( snapEnabled ); m_router->EnableSnapping ( snapEnabled );
if( !snapEnabled && startItem && !startItem->Layers().Overlaps( tl ) ) if( !snapEnabled && startItem && !startItem->Layers().Overlaps( tl ) )
...@@ -459,10 +459,10 @@ void ROUTER_TOOL::updateStartItem( TOOL_EVENT& aEvent ) ...@@ -459,10 +459,10 @@ void ROUTER_TOOL::updateStartItem( TOOL_EVENT& aEvent )
ctls->ForceCursorPosition( false ); ctls->ForceCursorPosition( false );
} }
if( startItem->Layers().IsMultilayer() ) // if( startItem->Layers().IsMultilayer() )
m_startLayer = tl; // m_startLayer = tl;
else // else
m_startLayer = startItem->Layers().Start(); // m_startLayer = startItem->Layers().Start();
m_startItem = startItem; m_startItem = startItem;
} }
...@@ -470,7 +470,6 @@ void ROUTER_TOOL::updateStartItem( TOOL_EVENT& aEvent ) ...@@ -470,7 +470,6 @@ void ROUTER_TOOL::updateStartItem( TOOL_EVENT& aEvent )
{ {
m_startItem = NULL; m_startItem = NULL;
m_startSnapPoint = cp; m_startSnapPoint = cp;
m_startLayer = tl;
ctls->ForceCursorPosition( false ); ctls->ForceCursorPosition( false );
} }
} }
...@@ -521,25 +520,99 @@ void ROUTER_TOOL::updateEndItem( TOOL_EVENT& aEvent ) ...@@ -521,25 +520,99 @@ void ROUTER_TOOL::updateEndItem( TOOL_EVENT& aEvent )
TRACE( 0, "%s, layer : %d", m_endItem->KindStr().c_str() % m_endItem->Layers().Start() ); TRACE( 0, "%s, layer : %d", m_endItem->KindStr().c_str() % m_endItem->Layers().Start() );
} }
int ROUTER_TOOL::getStartLayer( const PNS_ITEM* aItem )
{
int tl = getView()->GetTopLayer();
void ROUTER_TOOL::performRouting() if( m_startItem )
{
const PNS_LAYERSET& ls = m_startItem->Layers();
if( ls.Overlaps( tl ) )
return tl;
else
return ls.Start();
}
return tl;
}
void ROUTER_TOOL::switchLayerOnViaPlacement()
{ {
PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>(); PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
bool saveUndoBuffer = true;
VIEW_CONTROLS* ctls = getViewControls();
if( getModel<BOARD>()->GetDesignSettings().m_UseConnectedTrackWidth ) int al = frame->GetActiveLayer();
int cl = m_router->GetCurrentLayer();
if( cl != al )
{ {
int width = getDefaultWidth( m_startItem ? m_startItem->Net() : -1 ); m_router->SwitchLayer( al );
}
if( m_startItem && m_startItem->OfKind( PNS_ITEM::SEGMENT ) ) optional<int> newLayer = m_router->Sizes().PairedLayer( cl );
width = static_cast<PNS_SEGMENT*>( m_startItem )->Width();
m_router->Settings().SetTrackWidth( width ); if( newLayer )
{
m_router->SwitchLayer ( *newLayer );
frame->SetActiveLayer ( ToLAYER_ID( *newLayer ) );
} }
}
bool ROUTER_TOOL::onViaCommand( VIATYPE_T aType )
{
BOARD* board = getModel<BOARD> ();
BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
const int layerCount = bds.GetCopperLayerCount();
int currentLayer = m_router->GetCurrentLayer();
m_router->SwitchLayer( m_startLayer ); PNS_SIZES_SETTINGS sizes = m_router->Sizes();
frame->SetActiveLayer( ToLAYER_ID( m_startLayer ) );
sizes.ClearLayerPairs();
sizes.AddLayerPair( frame->GetScreen()->m_Route_Layer_TOP,
frame->GetScreen()->m_Route_Layer_BOTTOM );
if( !m_router->IsPlacingVia() )
{
// Cannot place microvias or blind vias if not allowed (obvious)
if( ( aType == VIA_BLIND_BURIED ) && ( !bds.m_BlindBuriedViaAllowed ) )
return false;
if( ( aType == VIA_MICROVIA ) && ( !bds.m_MicroViasAllowed ) )
return false;
//Can only place through vias on 2-layer boards
if( ( aType != VIA_THROUGH ) && ( layerCount <= 2 ) )
return false;
//Can only place microvias if we're on an outer layer, or directly adjacent to one
if( ( aType == VIA_MICROVIA ) && ( currentLayer > In1_Cu ) && ( currentLayer < layerCount-2 ) )
return false;
//Cannot place blind vias with front/back as the layer pair, this doesn't make sense
if( ( aType == VIA_BLIND_BURIED ) && ( sizes.GetLayerTop() == F_Cu ) && ( sizes.GetLayerBottom() == B_Cu ) )
return false;
}
sizes.SetViaType ( aType );
m_router->ToggleViaPlacement( );
m_router->UpdateSizes( sizes );
m_router->Move( m_endSnapPoint, m_endItem ); // refresh
return false;
}
void ROUTER_TOOL::performRouting()
{
PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
bool saveUndoBuffer = true;
VIEW_CONTROLS* ctls = getViewControls();
BOARD* board = getModel<BOARD>();
int routingLayer = getStartLayer ( m_startItem );
frame->SetActiveLayer( ToLAYER_ID ( routingLayer ) );
// fixme: switch on invisible layer
if( m_startItem && m_startItem->Net() >= 0 ) if( m_startItem && m_startItem->Net() >= 0 )
{ {
...@@ -553,7 +626,13 @@ void ROUTER_TOOL::performRouting() ...@@ -553,7 +626,13 @@ void ROUTER_TOOL::performRouting()
ctls->ForceCursorPosition( false ); ctls->ForceCursorPosition( false );
ctls->SetAutoPan( true ); ctls->SetAutoPan( true );
m_router->StartRouting( m_startSnapPoint, m_startItem ); PNS_SIZES_SETTINGS sizes;
sizes.Init ( board, m_startItem );
sizes.AddLayerPair ( frame->GetScreen()->m_Route_Layer_TOP,
frame->GetScreen()->m_Route_Layer_BOTTOM );
m_router->UpdateSizes( sizes );
m_router->StartRouting( m_startSnapPoint, m_startItem, routingLayer );
m_endItem = NULL; m_endItem = NULL;
m_endSnapPoint = m_startSnapPoint; m_endSnapPoint = m_startSnapPoint;
...@@ -575,10 +654,16 @@ void ROUTER_TOOL::performRouting() ...@@ -575,10 +654,16 @@ void ROUTER_TOOL::performRouting()
else if( evt->IsClick( BUT_LEFT ) ) else if( evt->IsClick( BUT_LEFT ) )
{ {
updateEndItem( *evt ); updateEndItem( *evt );
bool needLayerSwitch = m_router->IsPlacingVia();
if( m_router->FixRoute( m_endSnapPoint, m_endItem ) ) if( m_router->FixRoute( m_endSnapPoint, m_endItem ) )
break; break;
if( needLayerSwitch )
{
switchLayerOnViaPlacement();
}
// Synchronize the indicated layer // Synchronize the indicated layer
frame->SetActiveLayer( ToLAYER_ID( m_router->GetCurrentLayer() ) ); frame->SetActiveLayer( ToLAYER_ID( m_router->GetCurrentLayer() ) );
...@@ -586,24 +671,15 @@ void ROUTER_TOOL::performRouting() ...@@ -586,24 +671,15 @@ void ROUTER_TOOL::performRouting()
} }
else if( evt->IsAction( &ACT_PlaceThroughVia ) ) else if( evt->IsAction( &ACT_PlaceThroughVia ) )
{ {
m_router->Settings().SetLayerPair( frame->GetScreen()->m_Route_Layer_TOP, onViaCommand ( VIA_THROUGH );
frame->GetScreen()->m_Route_Layer_BOTTOM );
m_router->ToggleViaPlacement( VIA_THROUGH );
m_router->Move( m_endSnapPoint, m_endItem ); // refresh
} }
else if( evt->IsAction( &ACT_PlaceBlindVia ) ) else if( evt->IsAction( &ACT_PlaceBlindVia ) )
{ {
m_router->Settings().SetLayerPair( frame->GetScreen()->m_Route_Layer_TOP, onViaCommand ( VIA_BLIND_BURIED );
frame->GetScreen()->m_Route_Layer_BOTTOM );
m_router->ToggleViaPlacement( VIA_BLIND_BURIED );
m_router->Move( m_endSnapPoint, m_endItem ); // refresh
} }
else if( evt->IsAction( &ACT_PlaceMicroVia ) ) else if( evt->IsAction( &ACT_PlaceMicroVia ) )
{ {
m_router->Settings().SetLayerPair( frame->GetScreen()->m_Route_Layer_TOP, onViaCommand ( VIA_MICROVIA );
frame->GetScreen()->m_Route_Layer_BOTTOM );
m_router->ToggleViaPlacement( VIA_MICROVIA );
m_router->Move( m_endSnapPoint, m_endItem ); // refresh
} }
else if( evt->IsAction( &ACT_SwitchPosture ) ) else if( evt->IsAction( &ACT_SwitchPosture ) )
{ {
...@@ -649,26 +725,19 @@ void ROUTER_TOOL::performRouting() ...@@ -649,26 +725,19 @@ void ROUTER_TOOL::performRouting()
int ROUTER_TOOL::Main( TOOL_EVENT& aEvent ) int ROUTER_TOOL::Main( TOOL_EVENT& aEvent )
{ {
VIEW_CONTROLS* ctls = getViewControls(); VIEW_CONTROLS* ctls = getViewControls();
PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
BOARD* board = getModel<BOARD>(); BOARD* board = getModel<BOARD>();
BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
// Deselect all items // Deselect all items
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
getEditFrame<PCB_EDIT_FRAME>()->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, frame->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Interactive Router" ) );
_( "Interactive Router" ) );
ctls->SetSnapping( true ); ctls->SetSnapping( true );
ctls->ShowCursor( true ); ctls->ShowCursor( true );
// Set current track widths & via size std::auto_ptr<ROUTER_TOOL_MENU> ctxMenu ( new ROUTER_TOOL_MENU( board ) );
m_router->Settings().SetTrackWidth( bds.GetCurrentTrackWidth() ); SetContextMenu ( ctxMenu.get() );
m_router->Settings().SetViaDiameter( bds.GetCurrentViaSize() );
m_router->Settings().SetViaDrill( bds.GetCurrentViaDrill() );
ROUTER_TOOL_MENU* ctxMenu = new ROUTER_TOOL_MENU( board );
SetContextMenu ( ctxMenu );
// Main loop: keep receiving events // Main loop: keep receiving events
while( OPT_TOOL_EVENT evt = Wait() ) while( OPT_TOOL_EVENT evt = Wait() )
...@@ -695,7 +764,7 @@ int ROUTER_TOOL::Main( TOOL_EVENT& aEvent ) ...@@ -695,7 +764,7 @@ int ROUTER_TOOL::Main( TOOL_EVENT& aEvent )
else else
performRouting(); performRouting();
} }
else if ( evt->IsAction( &ACT_Drag ) ) else if( evt->IsAction( &ACT_Drag ) )
performDragging(); performDragging();
handleCommonEvents( *evt ); handleCommonEvents( *evt );
...@@ -704,11 +773,10 @@ int ROUTER_TOOL::Main( TOOL_EVENT& aEvent ) ...@@ -704,11 +773,10 @@ int ROUTER_TOOL::Main( TOOL_EVENT& aEvent )
// Restore the default settings // Restore the default settings
ctls->SetAutoPan( false ); ctls->SetAutoPan( false );
ctls->ShowCursor( false ); ctls->ShowCursor( false );
getEditFrame<PCB_EDIT_FRAME>()->SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString ); frame->SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString );
// Store routing settings till the next invocation // Store routing settings till the next invocation
m_settings = m_router->Settings(); m_settings = m_router->Settings();
delete ctxMenu;
return 0; return 0;
} }
......
...@@ -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
[Desktop Entry] [Desktop Entry]
Categories=Development;Electronics Categories=Development;Electronics;
Comment=Design a printed circuit board Comment=Assign footprints to symbols (part of KiCad)
Exec=cvpcb Exec=cvpcb
GenericName=EDA Suite GenericName=EDA Suite
Icon=cvpcb Icon=cvpcb
MimeType=application/x-cvpcb-project; MimeType=application/x-cvpcb-project;
Name=cvpcb Name=CvPcb
Type=Application Type=Application
Name[en_US]=cvpcb Name[en_US]=CvPcb
[Desktop Entry] [Desktop Entry]
Categories=Development;Electronics Categories=Development;Electronics;
Comment=Design an electronic schematic Comment=Design an electronic schematic
Comment[fr]=Dessiner des schémas électroniques Comment[fr]=Dessiner des schémas électroniques
Exec=eeschema %f Exec=eeschema %f
......
[Desktop Entry] [Desktop Entry]
Categories=Development;Electronics Categories=Development;Electronics;
Comment=Design a printed circuit board Comment=View gerber files
Exec=gerbview Exec=gerbview
GenericName=EDA Suite GenericName=EDA Suite
Icon=gerbview Icon=gerbview
MimeType=application/x-gerbview-project; MimeType=application/x-gerbview-project;
Name=gerbview Name=GerbView
Type=Application Type=Application
Name[en_US]=gerbview Name[en_US]=GerbView
[Desktop Entry] [Desktop Entry]
Categories=Development;Electronics Categories=Development;Electronics;
Comment=Design a printed circuit board Comment=Design a printed circuit board
Comment[fr]=Concevoir un circuit imprimé Comment[fr]=Concevoir un circuit imprimé
Exec=kicad %f Exec=kicad %f
......
[Desktop Entry] [Desktop Entry]
Categories=Development;Electronics Categories=Development;Electronics;
Comment=Design a printed circuit board Comment=Calculator for various electronics related computations
Exec=pcb_calculator Exec=pcb_calculator
GenericName=EDA Suite GenericName=EDA Suite
Icon=pcbcalculator Icon=pcbcalculator
MimeType=application/x-pcbcalculator-project; MimeType=application/x-pcbcalculator-project;
Name=pcbcalculator Name=Pcb Calculator
Type=Application Type=Application
Name[en_US]=pcbcalculator Name[en_US]=Pcb Calculator
[Desktop Entry] [Desktop Entry]
Categories=Development;Electronics Categories=Development;Electronics;
Comment=Design a printed circuit board Comment=Layout a printed circuit board
Exec=pcbnew %f Exec=pcbnew %f
GenericName=EDA Suite GenericName=EDA Suite
Icon=pcbnew Icon=pcbnew
MimeType=application/x-pcbnew-pcb; MimeType=application/x-pcbnew-pcb;
Name=pcbnew Name=Pcbnew
Type=Application Type=Application
Name[en_US]=pcbnew Name[en_US]=Pcbnew
...@@ -848,7 +848,7 @@ bool VRML_LAYER::Tesselate( VRML_LAYER* holes, bool aHolesOnly ) ...@@ -848,7 +848,7 @@ bool VRML_LAYER::Tesselate( VRML_LAYER* holes, bool aHolesOnly )
std::ostringstream ostr; std::ostringstream ostr;
ostr << "Tesselate():FAILED: " << holes->GetError(); ostr << "Tesselate():FAILED: " << holes->GetError();
error = ostr.str(); error = ostr.str();
return NULL; return false;
} }
if( Fault ) if( Fault )
......
...@@ -62,7 +62,6 @@ ...@@ -62,7 +62,6 @@
#define M_PI4 ( M_PI / 4.0 ) #define M_PI4 ( M_PI / 4.0 )
#endif #endif
struct GLUtesselator;
struct VERTEX_3D struct VERTEX_3D
{ {
......
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