diff --git a/eeschema/lib_symbol.cpp b/eeschema/lib_symbol.cpp index 8b875be342..57cf8b0b3e 100644 --- a/eeschema/lib_symbol.cpp +++ b/eeschema/lib_symbol.cpp @@ -961,6 +961,49 @@ void LIB_SYMBOL::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, bool } +void LIB_SYMBOL::FixupDrawItems() +{ + std::vector potential_top_items; + std::vector bottom_items; + + for( LIB_ITEM& item : m_drawings ) + { + if( item.Type() == LIB_SHAPE_T ) + { + LIB_SHAPE& shape = static_cast( item ); + + if( shape.GetFillMode() == FILL_T::FILLED_WITH_COLOR ) + potential_top_items.push_back( &shape ); + else + bottom_items.push_back( &item ); + } + else + { + bottom_items.push_back( &item ); + } + } + + std::sort( potential_top_items.begin(), potential_top_items.end(), + []( LIB_ITEM* a, LIB_ITEM* b ) + { + return a->GetBoundingBox().GetArea() > b->GetBoundingBox().GetArea(); + } ); + + + for( LIB_SHAPE* item : potential_top_items ) + { + for( LIB_ITEM* bottom_item : bottom_items ) + { + if( item->GetBoundingBox().Contains( bottom_item->GetBoundingBox() ) ) + { + item->SetFillMode( FILL_T::FILLED_WITH_BG_BODYCOLOR ); + break; + } + } + } +} + + void LIB_SYMBOL::RemoveDrawItem( LIB_ITEM* aItem ) { wxASSERT( aItem != nullptr ); diff --git a/eeschema/lib_symbol.h b/eeschema/lib_symbol.h index c77ade2158..8d4cde44c8 100644 --- a/eeschema/lib_symbol.h +++ b/eeschema/lib_symbol.h @@ -546,6 +546,12 @@ public: LIB_ITEMS_CONTAINER& GetDrawItems() { return m_drawings; } const LIB_ITEMS_CONTAINER& GetDrawItems() const { return m_drawings; } + /** + * This function finds the filled draw items that are covering up smaller draw items + * and replaces their body fill color with the background fill color. + */ + void FixupDrawItems(); + INSPECT_RESULT Visit( INSPECTOR inspector, void* testData, const std::vector& aScanTypes ) override; diff --git a/eeschema/sch_plugins/altium/altium_parser_sch.cpp b/eeschema/sch_plugins/altium/altium_parser_sch.cpp index f7dc3daf78..0cd4539c8f 100644 --- a/eeschema/sch_plugins/altium/altium_parser_sch.cpp +++ b/eeschema/sch_plugins/altium/altium_parser_sch.cpp @@ -259,7 +259,7 @@ ASCH_BORDER_INTERFACE::ASCH_BORDER_INTERFACE( const std::map // Altium line width 0 means hairline. Since KiCad doesn't have a hairline, we // represent it as a 1 mil line. if( LineWidth == 0 ) - LineWidth = 1; + LineWidth = schIUScale.MilsToIU( 1 ); Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 ); } @@ -872,6 +872,7 @@ ASCH_IMPLEMENTATION::ASCH_IMPLEMENTATION( const std::map& aP name = ALTIUM_PARSER::ReadString( aProps, "MODELNAME", "" ); type = ALTIUM_PARSER::ReadString( aProps, "MODELTYPE", "" ); libname = ALTIUM_PARSER::ReadString( aProps, "MODELDATAFILE0", "" ); + description = ALTIUM_PARSER::ReadString( aProps, "DESCRIPTION", "" ); isCurrent = ALTIUM_PARSER::ReadBool( aProps, "ISCURRENT", false ); } diff --git a/eeschema/sch_plugins/altium/altium_parser_sch.h b/eeschema/sch_plugins/altium/altium_parser_sch.h index 5376c53dfa..8d0df4463b 100644 --- a/eeschema/sch_plugins/altium/altium_parser_sch.h +++ b/eeschema/sch_plugins/altium/altium_parser_sch.h @@ -861,7 +861,7 @@ struct ASCH_IMPLEMENTATION : ASCH_OWNER_INTERFACE wxString name; wxString type; wxString libname; - + wxString description; bool isCurrent; explicit ASCH_IMPLEMENTATION( const std::map& aProps ); diff --git a/eeschema/sch_plugins/altium/sch_altium_plugin.cpp b/eeschema/sch_plugins/altium/sch_altium_plugin.cpp index 11e7201218..5e9f603143 100644 --- a/eeschema/sch_plugins/altium/sch_altium_plugin.cpp +++ b/eeschema/sch_plugins/altium/sch_altium_plugin.cpp @@ -52,6 +52,7 @@ #include #include +#include #include #include #include @@ -134,7 +135,8 @@ static void SetLibShapeLine( const ASCH_BORDER_INTERFACE& elem, LIB_SHAPE* shape { COLOR4D color = GetColorFromInt( elem.Color ); COLOR4D default_color; - COLOR4D alt_default_color; + COLOR4D alt_default_color = COLOR4D( PUREBLUE ); // PUREBLUE is used for many objects, so if it is used, + // we will assume that it should blend with the others STROKE_PARAMS stroke; switch( aType ) @@ -156,9 +158,6 @@ static void SetLibShapeLine( const ASCH_BORDER_INTERFACE& elem, LIB_SHAPE* shape break; case ALTIUM_SCH_RECORD::POLYLINE: default_color = COLOR4D( BLACK ); - alt_default_color = COLOR4D( PUREBLUE ); // POLYLINEs get two default colors because they are - // often used for drawing wires in polygons, so we will - // want them the same color break; case ALTIUM_SCH_RECORD::RECTANGLE: default_color = COLOR4D( 0.5, 0, 0, 1.0 ); @@ -198,7 +197,11 @@ static void SetLibShapeFillAndColor( const ASCH_FILL_INTERFACE& elem, LIB_SHAPE* if( !elem.IsSolid ) shape->SetFillMode( FILL_T::NO_FILL ); else if( elem.AreaColor == aStrokeColor ) + { + bgcolor = shape->GetStroke().GetColor(); + shape->SetFillMode( FILL_T::FILLED_SHAPE ); + } else if( bgcolor == default_bgcolor ) shape->SetFillMode( FILL_T::FILLED_WITH_BG_BODYCOLOR ); else @@ -206,7 +209,7 @@ static void SetLibShapeFillAndColor( const ASCH_FILL_INTERFACE& elem, LIB_SHAPE* shape->SetFillColor( bgcolor ); - if( elem.AreaColor == aStrokeColor && shape->GetStroke().GetWidth() == 1 ) + if( elem.AreaColor == aStrokeColor && shape->GetStroke().GetWidth() == schIUScale.MilsToIU( 1 ) ) { STROKE_PARAMS stroke = shape->GetStroke(); stroke.SetWidth( -1 ); @@ -981,6 +984,9 @@ void SCH_ALTIUM_PLUGIN::ParsePin( const std::map& aPropertie pin->SetNumber( elem.designator ); pin->SetLength( elem.pinlength ); + if( elem.hidden ) + pin->SetVisible( false ); + if( !elem.showDesignator ) pin->SetNumberTextSize( 0 ); @@ -1827,18 +1833,11 @@ void SCH_ALTIUM_PLUGIN::ParseRoundRectangle( const std::map& void SCH_ALTIUM_PLUGIN::ParseArc( const std::map& aProperties, std::vector& aSymbol ) { - // The Arc can be ALTIUM_SCH_RECORD::ELLIPTICAL_ARC or ALTIUM_SCH_RECORD::ARC - // Elliptical arcs are not handled in KiCad. So use an arc instead - // TODO: handle elliptical arc better. - ASCH_ARC elem( aProperties ); int arc_radius = elem.m_Radius; - // Try to approximate this ellipse by an arc. use the biggest of radius and secondary radius - // One can of course use another recipe - if( elem.m_IsElliptical ) - arc_radius = std::max( elem.m_Radius, elem.m_SecondaryRadius ); + // Try to approximate this ellipse by a series of beziers if( aSymbol.empty() && elem.ownerpartid == ALTIUM_COMPONENT_NONE ) { @@ -1920,33 +1919,24 @@ void SCH_ALTIUM_PLUGIN::ParseArc( const std::map& aPropertie symbol->AddDrawItem( arc, false ); arc->SetUnit( std::max( 0, elem.ownerpartid ) ); - if( !schsym ) - arc->SetCenter( GetLibEditPosition( elem.m_Center ) ); - else + EDA_ANGLE includedAngle( elem.m_EndAngle - elem.m_StartAngle, DEGREES_T ); + EDA_ANGLE startAngle( elem.m_EndAngle, DEGREES_T ); + VECTOR2I startOffset( KiROUND( arc_radius * startAngle.Cos() ), + -KiROUND( arc_radius * startAngle.Sin() ) ); + + if( schsym ) + { arc->SetCenter( GetRelativePosition( elem.m_Center + m_sheetOffset, schsym ) ); + arc->SetStart( GetRelativePosition( elem.m_Center + startOffset + m_sheetOffset, + schsym ) ); + } + else + { + arc->SetCenter( GetLibEditPosition( elem.m_Center ) ); + arc->SetStart( elem.m_Center + startOffset + m_sheetOffset ); + } - VECTOR2I arcStart = AltiumGetEllipticalPos( - elem.m_Radius, elem.m_SecondaryRadius, - -EDA_ANGLE( elem.m_StartAngle, DEGREES_T ).AsRadians() ); - arcStart += arc->GetCenter(); - - VECTOR2I arcEnd = AltiumGetEllipticalPos( - elem.m_Radius, elem.m_SecondaryRadius, - -EDA_ANGLE( elem.m_EndAngle, DEGREES_T ).AsRadians() ); - arcEnd += arc->GetCenter(); - - double end_angle = elem.m_EndAngle; - - if( elem.m_EndAngle < elem.m_StartAngle ) - end_angle += 360; - - double mid_angle = std::fmod( ( elem.m_StartAngle + end_angle ) / 2, 360 ); - VECTOR2I arcMid = AltiumGetEllipticalPos( - elem.m_Radius, elem.m_SecondaryRadius, - -EDA_ANGLE( mid_angle, DEGREES_T ).AsRadians() ); - arcMid += arc->GetCenter(); - - arc->SetArcGeometry( arcStart, arcMid, arcEnd ); + arc->SetArcAngleAndEnd( includedAngle.Normalize(), true ); SetLibShapeLine( elem, arc, ALTIUM_SCH_RECORD::ARC ); } @@ -1954,16 +1944,104 @@ void SCH_ALTIUM_PLUGIN::ParseArc( const std::map& aPropertie } +void SCH_ALTIUM_PLUGIN::ParseEllipticalArc( const std::map& aProperties, std::vector& aSymbol ) +{ + ASCH_ARC elem( aProperties ); + + if( aSymbol.empty() && elem.ownerpartid == ALTIUM_COMPONENT_NONE ) + { + SCH_SCREEN* currentScreen = getCurrentScreen(); + wxCHECK( currentScreen, /* void */ ); + + ELLIPSE ellipse( elem.m_Center + m_sheetOffset, elem.m_Radius, + KiROUND( elem.m_SecondaryRadius ), EDA_ANGLE::m_Angle0, + EDA_ANGLE( elem.m_StartAngle, DEGREES_T ), + EDA_ANGLE( elem.m_EndAngle, DEGREES_T ) ); + std::vector> beziers; + + TransformEllipseToBeziers( ellipse, beziers ); + + for( const BEZIER& bezier : beziers ) + { + SCH_SHAPE* schbezier = new SCH_SHAPE( SHAPE_T::BEZIER ); + schbezier->SetStart( bezier.Start ); + schbezier->SetBezierC1( bezier.C1 ); + schbezier->SetBezierC2( bezier.C2 ); + schbezier->SetEnd( bezier.End ); + schbezier->SetStroke( STROKE_PARAMS( elem.LineWidth, PLOT_DASH_TYPE::SOLID ) ); + schbezier->RebuildBezierToSegmentsPointsList( elem.LineWidth ); + + currentScreen->Append( schbezier ); + } + } + else + { + LIB_SYMBOL* symbol = static_cast( aSymbol.size() ) <= elem.ownerpartdisplaymode + ? nullptr + : aSymbol[elem.ownerpartdisplaymode]; + SCH_SYMBOL* schsym = nullptr; + + if( !symbol ) + { + const auto& libSymbolIt = m_libSymbols.find( elem.ownerindex ); + + if( libSymbolIt == m_libSymbols.end() ) + { + // TODO: e.g. can depend on Template (RECORD=39 + m_reporter->Report( wxString::Format( wxT( "Elliptical Arc's owner (%d) not found." ), + elem.ownerindex ), + RPT_SEVERITY_DEBUG ); + return; + } + + symbol = libSymbolIt->second; + schsym = m_symbols.at( libSymbolIt->first ); + } + + if( !symbol && !IsComponentPartVisible( elem.ownerindex, elem.ownerpartdisplaymode ) ) + return; + + ELLIPSE ellipse( elem.m_Center, elem.m_Radius, + KiROUND( elem.m_SecondaryRadius ), EDA_ANGLE::m_Angle0, + EDA_ANGLE( elem.m_StartAngle, DEGREES_T ), + EDA_ANGLE( elem.m_EndAngle, DEGREES_T ) ); + std::vector> beziers; + + TransformEllipseToBeziers( ellipse, beziers ); + + for( const BEZIER& bezier : beziers ) + { + LIB_SHAPE* schbezier = new LIB_SHAPE( symbol, SHAPE_T::BEZIER ); + symbol->AddDrawItem( schbezier, false ); + + schbezier->SetUnit( std::max( 0, elem.ownerpartid ) ); + + if( schsym ) + { + schbezier->SetStart( GetRelativePosition( bezier.Start + m_sheetOffset, schsym ) ); + schbezier->SetBezierC1( GetRelativePosition( bezier.C1 + m_sheetOffset, schsym ) ); + schbezier->SetBezierC2( GetRelativePosition( bezier.C2 + m_sheetOffset, schsym ) ); + schbezier->SetEnd( GetRelativePosition( bezier.End + m_sheetOffset, schsym ) ); + } + else + { + schbezier->SetStart( GetLibEditPosition( bezier.Start ) ); + schbezier->SetBezierC1( GetLibEditPosition( bezier.C1 ) ); + schbezier->SetBezierC2( GetLibEditPosition( bezier.C2 ) ); + schbezier->SetEnd( GetLibEditPosition( bezier.End ) ); + } + + SetLibShapeLine( elem, schbezier, ALTIUM_SCH_RECORD::ELLIPTICAL_ARC ); + schbezier->RebuildBezierToSegmentsPointsList( elem.LineWidth ); + } + } +} + + void SCH_ALTIUM_PLUGIN::ParseEllipse( const std::map& aProperties, std::vector& aSymbol ) { ASCH_ELLIPSE elem( aProperties ); - VECTOR2I start( elem.Center.x + elem.Radius, elem.Center.y ); - VECTOR2I end( elem.Center.x - elem.Radius, elem.Center.y ); - VECTOR2I mid( elem.Center.x, elem.Center.y + elem.SecondaryRadius ); - VECTOR2I mid2( elem.Center.x, elem.Center.y - elem.SecondaryRadius ); - - if( elem.Radius == elem.SecondaryRadius ) { ParseCircle( aProperties, aSymbol ); @@ -1975,31 +2053,29 @@ void SCH_ALTIUM_PLUGIN::ParseEllipse( const std::map& aPrope SCH_SCREEN* screen = getCurrentScreen(); wxCHECK( screen, /* void */ ); - SCH_SHAPE* arc1 = new SCH_SHAPE( SHAPE_T::ARC ); - SCH_SHAPE* arc2 = new SCH_SHAPE( SHAPE_T::ARC ); + ELLIPSE ellipse( elem.Center + m_sheetOffset, elem.Radius, KiROUND(elem.SecondaryRadius ), EDA_ANGLE::m_Angle0 ); + std::vector> beziers; - arc1->SetArcGeometry( start + m_sheetOffset, mid + m_sheetOffset, end + m_sheetOffset ); - arc2->SetArcGeometry( start + m_sheetOffset, mid2 + m_sheetOffset, end + m_sheetOffset ); + TransformEllipseToBeziers( ellipse, beziers ); - arc1->SetStroke( STROKE_PARAMS( 1, PLOT_DASH_TYPE::SOLID ) ); - arc2->SetStroke( STROKE_PARAMS( 1, PLOT_DASH_TYPE::SOLID ) ); - - arc1->SetFillColor( GetColorFromInt( elem.AreaColor ) ); - arc2->SetFillColor( GetColorFromInt( elem.AreaColor ) ); - - if( elem.IsSolid ) + for( const BEZIER& bezier : beziers ) { - arc1->SetFillMode( FILL_T::FILLED_WITH_COLOR ); - arc2->SetFillMode( FILL_T::FILLED_WITH_COLOR ); - } - else - { - arc1->SetFilled( false ); - arc2->SetFilled( false ); - } + SCH_SHAPE* schbezier = new SCH_SHAPE( SHAPE_T::BEZIER ); + schbezier->SetStart( bezier.Start ); + schbezier->SetBezierC1( bezier.C1 ); + schbezier->SetBezierC2( bezier.C2 ); + schbezier->SetEnd( bezier.End ); + schbezier->SetStroke( STROKE_PARAMS( elem.LineWidth, PLOT_DASH_TYPE::SOLID ) ); + schbezier->SetFillColor( GetColorFromInt( elem.AreaColor ) ); - screen->Append( arc1 ); - screen->Append( arc2 ); + if( elem.IsSolid ) + schbezier->SetFillMode( FILL_T::FILLED_WITH_COLOR ); + else + schbezier->SetFilled( false ); + + schbezier->RebuildBezierToSegmentsPointsList( schbezier->GetWidth() / 2 ); + screen->Append( schbezier ); + } } else { @@ -2025,41 +2101,66 @@ void SCH_ALTIUM_PLUGIN::ParseEllipse( const std::map& aPrope schsym = m_symbols.at( libSymbolIt->first ); } - LIB_SHAPE* arc1 = new LIB_SHAPE( symbol, SHAPE_T::ARC ); - LIB_SHAPE* arc2 = new LIB_SHAPE( symbol, SHAPE_T::ARC ); + ELLIPSE ellipse( elem.Center, elem.Radius, KiROUND(elem.SecondaryRadius ), EDA_ANGLE::m_Angle0 ); + std::vector> beziers; - symbol->AddDrawItem( arc1, false ); - symbol->AddDrawItem( arc2, false ); + TransformEllipseToBeziers( ellipse, beziers ); - arc1->SetUnit( elem.ownerpartid ); - arc2->SetUnit( elem.ownerpartid ); - - if( !schsym ) + for( const BEZIER& bezier : beziers ) { - arc1->SetArcGeometry( GetLibEditPosition( start ), - GetLibEditPosition( mid ), - GetLibEditPosition( end ) ); - arc2->SetArcGeometry( GetLibEditPosition( start ), - GetLibEditPosition( mid2 ), - GetLibEditPosition( end ) ); - } - else - { - arc1->SetArcGeometry( GetRelativePosition( start + m_sheetOffset, schsym ), - GetRelativePosition( mid + m_sheetOffset, schsym ), - GetRelativePosition( end + m_sheetOffset, schsym ) ); - arc2->SetArcGeometry( GetRelativePosition( start + m_sheetOffset, schsym ), - GetRelativePosition( mid2 + m_sheetOffset, schsym ), - GetRelativePosition( end + m_sheetOffset, schsym ) ); + LIB_SHAPE* libbezier = new LIB_SHAPE( symbol, SHAPE_T::BEZIER ); + symbol->AddDrawItem( libbezier, false ); + libbezier->SetUnit( elem.ownerpartid ); + + if( !schsym ) + { + libbezier->SetStart( GetLibEditPosition( bezier.Start ) ); + libbezier->SetBezierC1( GetLibEditPosition( bezier.C1 ) ); + libbezier->SetBezierC2( GetLibEditPosition( bezier.C2 ) ); + libbezier->SetEnd( GetLibEditPosition( bezier.End ) ); + } + else + { + libbezier->SetStart( GetRelativePosition( bezier.Start + m_sheetOffset, schsym ) ); + libbezier->SetBezierC1( GetRelativePosition( bezier.C1 + m_sheetOffset, schsym ) ); + libbezier->SetBezierC2( GetRelativePosition( bezier.C2 + m_sheetOffset, schsym ) ); + libbezier->SetEnd( GetRelativePosition( bezier.End + m_sheetOffset, schsym ) ); + } + + SetLibShapeLine( elem, libbezier, ALTIUM_SCH_RECORD::ELLIPSE ); + SetLibShapeFillAndColor( elem, libbezier, ALTIUM_SCH_RECORD::ELLIPSE, elem.Color ); + libbezier->RebuildBezierToSegmentsPointsList( libbezier->GetWidth() / 2 ); } - arc1->SetEnd( arc1->GetPosition() + VECTOR2I( elem.Radius, 0 ) ); + // A series of beziers won't fill the center, so if this is meant to be fully filled, + // Add a polygon to fill the center + if( elem.IsSolid) + { - SetLibShapeLine( elem, arc1, ALTIUM_SCH_RECORD::ELLIPSE ); - SetLibShapeFillAndColor( elem, arc1, ALTIUM_SCH_RECORD::ELLIPSE, elem.Color ); + LIB_SHAPE* libline = new LIB_SHAPE( symbol, SHAPE_T::POLY ); + symbol->AddDrawItem( libline, false ); + libline->SetUnit( elem.ownerpartid ); - SetLibShapeLine( elem, arc2, ALTIUM_SCH_RECORD::ELLIPSE ); - SetLibShapeFillAndColor( elem, arc2, ALTIUM_SCH_RECORD::ELLIPSE, elem.Color ); + if( !schsym ) + { + libline->AddPoint( GetLibEditPosition( elem.Center + VECTOR2I( elem.Radius, 0 ) ) ); + libline->AddPoint( GetLibEditPosition( elem.Center + VECTOR2I( 0, elem.SecondaryRadius ) ) ); + libline->AddPoint( GetLibEditPosition( elem.Center + VECTOR2I( -elem.Radius, 0 ) ) ); + libline->AddPoint( GetLibEditPosition( elem.Center + VECTOR2I( 0, -elem.SecondaryRadius ) ) ); + libline->AddPoint( GetLibEditPosition( elem.Center + VECTOR2I( elem.Radius, 0 ) ) ); + } + else + { + libline->AddPoint( GetRelativePosition( elem.Center + VECTOR2I( elem.Radius, 0 ) + m_sheetOffset, schsym ) ); + libline->AddPoint( GetRelativePosition( elem.Center + VECTOR2I( 0, elem.SecondaryRadius ) + m_sheetOffset, schsym ) ); + libline->AddPoint( GetRelativePosition( elem.Center + VECTOR2I( -elem.Radius, 0 ) + m_sheetOffset, schsym ) ); + libline->AddPoint( GetRelativePosition( elem.Center + VECTOR2I( 0, -elem.SecondaryRadius ) + m_sheetOffset, schsym ) ); + libline->AddPoint( GetRelativePosition( elem.Center + VECTOR2I( elem.Radius, 0 ) + m_sheetOffset, schsym ) ); + } + + SetLibShapeLine( elem, libline, ALTIUM_SCH_RECORD::ELLIPSE ); + SetLibShapeFillAndColor( elem, libline, ALTIUM_SCH_RECORD::ELLIPSE, elem.Color ); + } } } @@ -3530,13 +3631,31 @@ void SCH_ALTIUM_PLUGIN::ParseImplementationList( int aIndex, } -void SCH_ALTIUM_PLUGIN::ParseImplementation( const std::map& aProperties ) +void SCH_ALTIUM_PLUGIN::ParseImplementation( const std::map& aProperties, + std::vector& aSymbol ) { ASCH_IMPLEMENTATION elem( aProperties ); // Only get footprint, currently assigned only if( ( elem.type == "PCBLIB" ) && ( elem.isCurrent ) ) { + // Parse the footprint fields for the library symbol + if( !aSymbol.empty() ) + { + for( LIB_SYMBOL* symbol : aSymbol ) + { + LIB_ID fpLibId = AltiumToKiCadLibID( elem.libname, elem.name ); + wxArrayString fpFilters; + fpFilters.Add( fpLibId.Format() ); + + symbol->SetFPFilters( wxArrayString( 1, wxString::Format( "*%s*", elem.name ) )); + LIB_FIELD& footprintField = symbol->GetFootprintField(); + footprintField.SetText( fpLibId.Format() ); + } + + return; + } + const auto& implementationOwnerIt = m_altiumImplementationList.find( elem.ownerindex ); if( implementationOwnerIt == m_altiumImplementationList.end() ) @@ -3715,7 +3834,8 @@ std::map SCH_ALTIUM_PLUGIN::ParseLibFile( const ALTIUM_COM case ALTIUM_SCH_RECORD::ROUND_RECTANGLE: ParseRoundRectangle( properties, symbols ); break; - case ALTIUM_SCH_RECORD::ELLIPTICAL_ARC: + case ALTIUM_SCH_RECORD::ELLIPTICAL_ARC: ParseEllipticalArc( properties, symbols ); break; + case ALTIUM_SCH_RECORD::ARC: ParseArc( properties, symbols ); break; case ALTIUM_SCH_RECORD::LINE: ParseLine( properties, symbols ); break; @@ -3730,7 +3850,9 @@ std::map SCH_ALTIUM_PLUGIN::ParseLibFile( const ALTIUM_COM // Nothing for now. TODO: Figure out how implementation lists are generted in libs case ALTIUM_SCH_RECORD::IMPLEMENTATION_LIST: break; - case ALTIUM_SCH_RECORD::IMPLEMENTATION: break; + + case ALTIUM_SCH_RECORD::IMPLEMENTATION: ParseImplementation( properties, symbols ); break; + case ALTIUM_SCH_RECORD::IMPL_PARAMS: break; case ALTIUM_SCH_RECORD::MAP_DEFINER_LIST: break; @@ -3760,6 +3882,7 @@ std::map SCH_ALTIUM_PLUGIN::ParseLibFile( const ALTIUM_COM for( size_t ii = 0; ii < symbols.size(); ii++ ) { LIB_SYMBOL* symbol = symbols[ii]; + symbol->FixupDrawItems(); if( symbols.size() == 1 ) ret[name] = symbol; diff --git a/eeschema/sch_plugins/altium/sch_altium_plugin.h b/eeschema/sch_plugins/altium/sch_altium_plugin.h index 70c531ab1e..d2cc88087e 100644 --- a/eeschema/sch_plugins/altium/sch_altium_plugin.h +++ b/eeschema/sch_plugins/altium/sch_altium_plugin.h @@ -82,15 +82,16 @@ public: // const PROPERTIES* aProperties = NULL ) override; - void EnumerateSymbolLib( wxArrayString& aSymbolNameList, - const wxString& aLibraryPath, + void EnumerateSymbolLib( wxArrayString& aSymbolNameList, + const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties = nullptr ) override; void EnumerateSymbolLib( std::vector& aSymbolList, const wxString& aLibraryPath, - const STRING_UTF8_MAP* aProperties = nullptr ) override; + const STRING_UTF8_MAP* aProperties = nullptr ) override; - LIB_SYMBOL* LoadSymbol( const wxString& aLibraryPath, const wxString& aAliasName, + LIB_SYMBOL* LoadSymbol( const wxString& aLibraryPath, + const wxString& aAliasName, const STRING_UTF8_MAP* aProperties = nullptr ) override; //void SaveSymbol( const wxString& aLibraryPath, const LIB_SYMBOL* aSymbol, @@ -142,6 +143,7 @@ private: void ParsePolygon( const std::map& aProperties, std::vector& aSymbol = nullsym); void ParseRoundRectangle( const std::map& aProperties, std::vector& aSymbol = nullsym); void ParseArc( const std::map& aProperties, std::vector& aSymbol = nullsym); + void ParseEllipticalArc( const std::map& aProperties, std::vector& aSymbol = nullsym); void ParseEllipse( const std::map& aProperties, std::vector& aSymbol = nullsym); void ParseCircle( const std::map& aProperties, std::vector& aSymbol = nullsym); void ParseLine( const std::map& aProperties, std::vector& aSymbol = nullsym); @@ -169,7 +171,7 @@ private: void ParseBusEntry( const std::map& aProperties ); void ParseParameter( const std::map& aProperties, std::vector& aSymbol = nullsym); void ParseImplementationList( int aIndex, const std::map& aProperties ); - void ParseImplementation( const std::map& aProperties ); + void ParseImplementation( const std::map& aProperties, std::vector& aSymbol = nullsym ); void ParseLibHeader( const ALTIUM_COMPOUND_FILE& aAltiumSchFile, wxArrayString& aLibNames ); std::map ParseLibFile( const ALTIUM_COMPOUND_FILE& aAltiumSchFile );