Eedchema: class_libentry.* : wxString GetLibraryName() is now virtual

This commit is contained in:
jean-pierre charras 2010-10-12 12:28:30 +02:00
parent 73fd4fb2ba
commit 2ddcbe1a01
3 changed files with 24 additions and 5 deletions

View File

@ -80,6 +80,20 @@ wxString CMP_LIB_ENTRY::GetLibraryName()
return wxString( _( "none" ) );
}
wxString LIB_COMPONENT::GetLibraryName()
{
if( library != NULL )
return library->GetName();
return wxString( _( "none" ) );
}
wxString LIB_ALIAS::GetLibraryName()
{
if( GetComponent() )
return GetComponent()->GetLibraryName();
return wxString( _( "none" ) );
}
/**
* Function SaveDoc

View File

@ -79,7 +79,7 @@ public:
return wxT( "CMP_LIB_ENTRY" );
}
wxString GetLibraryName();
virtual wxString GetLibraryName();
CMP_LIBRARY* GetLibrary() { return library; }
@ -185,6 +185,8 @@ public:
GetValueField().m_Text = aName;
}
virtual wxString GetLibraryName();
wxArrayString GetAliasNames( bool aIncludeRoot = true ) const;
size_t GetAliasCount() const { return m_aliases.size(); }
@ -614,6 +616,8 @@ public:
return root;
}
virtual wxString GetLibraryName();
bool IsRoot() const { return name.CmpNoCase( root->GetName() ) == 0; }
bool operator==( const LIB_ALIAS* aAlias ) const { return this == aAlias; }

View File

@ -411,20 +411,21 @@ static void fillArcPOLY( BOARD* aPcb, GERBER_DRAW_ITEM* aGbrItem,
int end_angle = wxRound(atan2( (double) end.y, (double) end.x ) * 1800 / M_PI);
// dummyTrack has right geometric parameters, but
// fillArcGBRITEM calculate arc parameters for a draw function that expects
// fillArcGBRITEM calculates arc parameters for a draw function that expects
// start_angle < end_angle. So ensure this is the case here:
// Due to the fact atan2 returns angles between -180 to + 180 degrees,
// this not always the case ( a modulo 360.0 degrees can be lost )
// this is not always the case ( a modulo 360.0 degrees can be lost )
if( start_angle > end_angle )
end_angle += 3600;
int arc_angle = start_angle - end_angle;
// Approximate arc by 36 segments per 360 degree
int increment_angle = 3600 / 36;
const int increment_angle = 3600 / 36;
int count = ABS( arc_angle / increment_angle );
// calculate polygon corners
// when not clockwise, dummyGbrItem arc goes from end to start
// when arc is counter-clockwise, dummyGbrItem arc goes from end to start
// and we must always create a polygon from start to end.
wxPoint start_arc = start;
for( int ii = 0; ii <= count; ii++ )
{