From 10ca34e2a7f47d91d06d5311de4e5b6d63f62a85 Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Mon, 4 Mar 2024 15:08:28 +0300 Subject: [PATCH] EasyEDA Std: support Dot and Clock symbol pin styles. (cherry picked from commit cc181df9169a84631b3a9c383753c2c448ea0c43) --- .../sch_io/easyeda/sch_easyeda_parser.cpp | 53 ++++++++++++++++++- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/eeschema/sch_io/easyeda/sch_easyeda_parser.cpp b/eeschema/sch_io/easyeda/sch_easyeda_parser.cpp index b61394e41f..c5f5bf3b5f 100644 --- a/eeschema/sch_io/easyeda/sch_easyeda_parser.cpp +++ b/eeschema/sch_io/easyeda/sch_easyeda_parser.cpp @@ -445,11 +445,11 @@ void SCH_EASYEDA_PARSER::ParseSymbolShapes( LIB_SYMBOL* aSymbol wxString fillColor = arr[5].Lower(); //bool locked = arr[7] != wxS( "0" ); - std::vector lineChains = + std::vector lineChains = ParseLineChains( pointsData, schIUScale.MilsToIU( 10 ), false ); for( SHAPE_LINE_CHAIN outline : lineChains ) - { + { std::unique_ptr shape = std::make_unique( aSymbol, SHAPE_T::POLY ); @@ -806,6 +806,55 @@ void SCH_EASYEDA_PARSER::ParseSymbolShapes( LIB_SYMBOL* aSymbol int pinUnit = 0; int kPinLen = ScaleSize( std::abs( pinLen ) ); + if( segments.size() > 5 ) + { + wxArrayString dotParts = wxSplit( segments[5], '~', '\0' ); + wxArrayString clockParts = wxSplit( segments[6], '~', '\0' ); + + if( dotParts.size() == 3 && clockParts.size() == 2 ) + { + if( dotParts[0] == wxS( "1" ) ) + { + VECTOR2D dotPos( Convert( dotParts[1] ), Convert( dotParts[2] ) ); + + std::unique_ptr circle = + std::make_unique( aSymbol, SHAPE_T::CIRCLE ); + + circle->SetCenter( RelPosSym( dotPos ) ); + circle->SetEnd( RelPosSym( + pinPos + ( dotPos - pinPos ).Resize( std::abs( pinLen ) ) ) ); + + circle->SetUnit( 0 ); + + aSymbol->AddDrawItem( circle.release() ); + } + + if( clockParts[0] == wxS( "1" ) ) + { + std::vector lineChains = + ParseLineChains( clockParts[1], schIUScale.MilsToIU( 10 ), false ); + + for( SHAPE_LINE_CHAIN outline : lineChains ) + { + std::unique_ptr shape = + std::make_unique( aSymbol, SHAPE_T::POLY ); + + outline.Mirror( false, true ); + + if( outline.IsClosed() ) + outline.Append( outline.CPoint( 0 ), true ); + + for( const VECTOR2I& pt : outline.CPoints() ) + shape->AddPoint( pt ); + + shape->SetUnit( 0 ); + + aSymbol->AddDrawItem( shape.release() ); + } + } + } + } + std::unique_ptr pin = std::make_unique( aSymbol ); pin->SetName( pinName );