From 2ddcbe1a0122a36c4677a5ccba7ba0d8549a9289 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 12 Oct 2010 12:28:30 +0200 Subject: [PATCH] Eedchema: class_libentry.* : wxString GetLibraryName() is now virtual --- eeschema/class_libentry.cpp | 14 ++++++++++++++ eeschema/class_libentry.h | 6 +++++- gerbview/rs274d.cpp | 9 +++++---- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index 171e0a379d..372d805638 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -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 diff --git a/eeschema/class_libentry.h b/eeschema/class_libentry.h index 4d9b0266ec..17cd76fc5c 100644 --- a/eeschema/class_libentry.h +++ b/eeschema/class_libentry.h @@ -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; } diff --git a/gerbview/rs274d.cpp b/gerbview/rs274d.cpp index a3907f3513..fa42b879a5 100644 --- a/gerbview/rs274d.cpp +++ b/gerbview/rs274d.cpp @@ -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++ ) {