Fix some breakage due to symbol Y axis inversion in EasyEDA parsers.

This commit is contained in:
Alex Shvartzkop 2024-05-03 01:44:48 +03:00
parent 1a1be2d542
commit b5b65d0846
5 changed files with 54 additions and 68 deletions

View File

@ -2974,28 +2974,28 @@ VECTOR2I HelperGeneratePowerPortGraphics( LIB_SYMBOL* aKsymbol, ASCH_POWER_PORT_
if( aStyle == ASCH_POWER_PORT_STYLE::CIRCLE || aStyle == ASCH_POWER_PORT_STYLE::ARROW )
{
SCH_SHAPE* line1 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line1, false );
line1->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line1->AddPoint( { 0, 0 } );
line1->AddPoint( { 0, schIUScale.MilsToIU( -50 ) } );
aKsymbol->AddDrawItem( line1, false );
if( aStyle == ASCH_POWER_PORT_STYLE::CIRCLE )
{
SCH_SHAPE* circle = new SCH_SHAPE( SHAPE_T::CIRCLE, LAYER_DEVICE );
aKsymbol->AddDrawItem( circle, false );
circle->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 5 ), LINE_STYLE::SOLID ) );
circle->SetPosition( { schIUScale.MilsToIU( 0 ), schIUScale.MilsToIU( -75 ) } );
circle->SetEnd( circle->GetPosition() + VECTOR2I( schIUScale.MilsToIU( 25 ), 0 ) );
aKsymbol->AddDrawItem( circle, false );
}
else
{
SCH_SHAPE* line2 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line2, false );
line2->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line2->AddPoint( { schIUScale.MilsToIU( -25 ), schIUScale.MilsToIU( -50 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 25 ), schIUScale.MilsToIU( -50 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 0 ), schIUScale.MilsToIU( -100 ) } );
line2->AddPoint( { schIUScale.MilsToIU( -25 ), schIUScale.MilsToIU( -50 ) } );
aKsymbol->AddDrawItem( line2, false );
}
return { 0, schIUScale.MilsToIU( 150 ) };
@ -3003,18 +3003,18 @@ VECTOR2I HelperGeneratePowerPortGraphics( LIB_SYMBOL* aKsymbol, ASCH_POWER_PORT_
else if( aStyle == ASCH_POWER_PORT_STYLE::WAVE )
{
SCH_SHAPE* line = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line, false );
line->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line->AddPoint( { 0, 0 } );
line->AddPoint( { 0, schIUScale.MilsToIU( -72 ) } );
aKsymbol->AddDrawItem( line, false );
SCH_SHAPE* bezier = new SCH_SHAPE( SHAPE_T::BEZIER, LAYER_DEVICE );
aKsymbol->AddDrawItem( bezier, false );
bezier->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 5 ), LINE_STYLE::SOLID ) );
bezier->SetStart( { schIUScale.MilsToIU( 30 ), schIUScale.MilsToIU( -50 ) } );
bezier->SetBezierC1( { schIUScale.MilsToIU( 30 ), schIUScale.MilsToIU( -87 ) } );
bezier->SetBezierC2( { schIUScale.MilsToIU( -30 ), schIUScale.MilsToIU( -63 ) } );
bezier->SetEnd( { schIUScale.MilsToIU( -30 ), schIUScale.MilsToIU( -100 ) } );
aKsymbol->AddDrawItem( bezier, false );
return { 0, schIUScale.MilsToIU( 150 ) };
}
@ -3024,71 +3024,71 @@ VECTOR2I HelperGeneratePowerPortGraphics( LIB_SYMBOL* aKsymbol, ASCH_POWER_PORT_
|| aStyle == ASCH_POWER_PORT_STYLE::GOST_ARROW )
{
SCH_SHAPE* line1 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line1, false );
line1->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line1->AddPoint( { 0, 0 } );
line1->AddPoint( { 0, schIUScale.MilsToIU( -100 ) } );
aKsymbol->AddDrawItem( line1, false );
if( aStyle == ASCH_POWER_PORT_STYLE::POWER_GROUND )
{
SCH_SHAPE* line2 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line2, false );
line2->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line2->AddPoint( { schIUScale.MilsToIU( -100 ), schIUScale.MilsToIU( -100 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 100 ), schIUScale.MilsToIU( -100 ) } );
aKsymbol->AddDrawItem( line2, false );
SCH_SHAPE* line3 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line3, false );
line3->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line3->AddPoint( { schIUScale.MilsToIU( -70 ), schIUScale.MilsToIU( -130 ) } );
line3->AddPoint( { schIUScale.MilsToIU( 70 ), schIUScale.MilsToIU( -130 ) } );
aKsymbol->AddDrawItem( line3, false );
SCH_SHAPE* line4 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line4, false );
line4->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line4->AddPoint( { schIUScale.MilsToIU( -40 ), schIUScale.MilsToIU( -160 ) } );
line4->AddPoint( { schIUScale.MilsToIU( 40 ), schIUScale.MilsToIU( -160 ) } );
aKsymbol->AddDrawItem( line4, false );
SCH_SHAPE* line5 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line5, false );
line5->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line5->AddPoint( { schIUScale.MilsToIU( -10 ), schIUScale.MilsToIU( -190 ) } );
line5->AddPoint( { schIUScale.MilsToIU( 10 ), schIUScale.MilsToIU( -190 ) } );
aKsymbol->AddDrawItem( line5, false );
}
else if( aStyle == ASCH_POWER_PORT_STYLE::SIGNAL_GROUND )
{
SCH_SHAPE* line2 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line2, false );
line2->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line2->AddPoint( { schIUScale.MilsToIU( -100 ), schIUScale.MilsToIU( -100 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 100 ), schIUScale.MilsToIU( -100 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 0 ), schIUScale.MilsToIU( -200 ) } );
line2->AddPoint( { schIUScale.MilsToIU( -100 ), schIUScale.MilsToIU( -100 ) } );
aKsymbol->AddDrawItem( line2, false );
}
else if( aStyle == ASCH_POWER_PORT_STYLE::EARTH )
{
SCH_SHAPE* line2 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line2, false );
line2->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line2->AddPoint( { schIUScale.MilsToIU( -150 ), schIUScale.MilsToIU( -200 ) } );
line2->AddPoint( { schIUScale.MilsToIU( -100 ), schIUScale.MilsToIU( -100 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 100 ), schIUScale.MilsToIU( -100 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 50 ), schIUScale.MilsToIU( -200 ) } );
aKsymbol->AddDrawItem( line2, false );
SCH_SHAPE* line3 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line3, false );
line3->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line3->AddPoint( { schIUScale.MilsToIU( 0 ), schIUScale.MilsToIU( -100 ) } );
line3->AddPoint( { schIUScale.MilsToIU( -50 ), schIUScale.MilsToIU( -200 ) } );
aKsymbol->AddDrawItem( line3, false );
}
else // ASCH_POWER_PORT_STYLE::GOST_ARROW
{
SCH_SHAPE* line2 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line2, false );
line2->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line2->AddPoint( { schIUScale.MilsToIU( -25 ), schIUScale.MilsToIU( -50 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 0 ), schIUScale.MilsToIU( -100 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 25 ), schIUScale.MilsToIU( -50 ) } );
aKsymbol->AddDrawItem( line2, false );
return { 0, schIUScale.MilsToIU( 150 ) }; // special case
}
@ -3099,53 +3099,53 @@ VECTOR2I HelperGeneratePowerPortGraphics( LIB_SYMBOL* aKsymbol, ASCH_POWER_PORT_
|| aStyle == ASCH_POWER_PORT_STYLE::GOST_EARTH )
{
SCH_SHAPE* line1 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line1, false );
line1->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line1->AddPoint( { 0, 0 } );
line1->AddPoint( { 0, schIUScale.MilsToIU( -160 ) } );
aKsymbol->AddDrawItem( line1, false );
SCH_SHAPE* line2 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line2, false );
line2->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line2->AddPoint( { schIUScale.MilsToIU( -100 ), schIUScale.MilsToIU( -160 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 100 ), schIUScale.MilsToIU( -160 ) } );
aKsymbol->AddDrawItem( line2, false );
SCH_SHAPE* line3 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line3, false );
line3->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line3->AddPoint( { schIUScale.MilsToIU( -60 ), schIUScale.MilsToIU( -200 ) } );
line3->AddPoint( { schIUScale.MilsToIU( 60 ), schIUScale.MilsToIU( -200 ) } );
aKsymbol->AddDrawItem( line3, false );
SCH_SHAPE* line4 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line4, false );
line4->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line4->AddPoint( { schIUScale.MilsToIU( -20 ), schIUScale.MilsToIU( -240 ) } );
line4->AddPoint( { schIUScale.MilsToIU( 20 ), schIUScale.MilsToIU( -240 ) } );
aKsymbol->AddDrawItem( line4, false );
if( aStyle == ASCH_POWER_PORT_STYLE::GOST_POWER_GROUND )
return { 0, schIUScale.MilsToIU( 300 ) };
SCH_SHAPE* circle = new SCH_SHAPE( SHAPE_T::CIRCLE, LAYER_DEVICE );
aKsymbol->AddDrawItem( circle, false );
circle->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
circle->SetPosition( { schIUScale.MilsToIU( 0 ), schIUScale.MilsToIU( -160 ) } );
circle->SetEnd( circle->GetPosition() + VECTOR2I( schIUScale.MilsToIU( 120 ), 0 ) );
aKsymbol->AddDrawItem( circle, false );
return { 0, schIUScale.MilsToIU( 350 ) };
}
else if( aStyle == ASCH_POWER_PORT_STYLE::GOST_BAR )
{
SCH_SHAPE* line1 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line1, false );
line1->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line1->AddPoint( { 0, 0 } );
line1->AddPoint( { 0, schIUScale.MilsToIU( -200 ) } );
aKsymbol->AddDrawItem( line1, false );
SCH_SHAPE* line2 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line2, false );
line2->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line2->AddPoint( { schIUScale.MilsToIU( -100 ), schIUScale.MilsToIU( -200 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 100 ), schIUScale.MilsToIU( -200 ) } );
aKsymbol->AddDrawItem( line2, false );
return { 0, schIUScale.MilsToIU( 250 ) };
}
@ -3158,16 +3158,16 @@ VECTOR2I HelperGeneratePowerPortGraphics( LIB_SYMBOL* aKsymbol, ASCH_POWER_PORT_
}
SCH_SHAPE* line1 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line1, false );
line1->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line1->AddPoint( { 0, 0 } );
line1->AddPoint( { 0, schIUScale.MilsToIU( -100 ) } );
aKsymbol->AddDrawItem( line1, false );
SCH_SHAPE* line2 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line2, false );
line2->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line2->AddPoint( { schIUScale.MilsToIU( -50 ), schIUScale.MilsToIU( -100 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 50 ), schIUScale.MilsToIU( -100 ) } );
aKsymbol->AddDrawItem( line2, false );
return { 0, schIUScale.MilsToIU( 150 ) };
}

View File

@ -191,28 +191,28 @@ VECTOR2I HelperGeneratePowerPortGraphics( LIB_SYMBOL* aKsymbol, EASYEDA::POWER_F
if( aStyle == EASYEDA::POWER_FLAG_STYLE::CIRCLE || aStyle == EASYEDA::POWER_FLAG_STYLE::ARROW )
{
SCH_SHAPE* line1 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line1 );
line1->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line1->AddPoint( { 0, 0 } );
line1->AddPoint( { 0, schIUScale.MilsToIU( -50 ) } );
aKsymbol->AddDrawItem( line1, false );
if( aStyle == EASYEDA::POWER_FLAG_STYLE::CIRCLE )
{
SCH_SHAPE* circle = new SCH_SHAPE( SHAPE_T::CIRCLE, LAYER_DEVICE );
aKsymbol->AddDrawItem( circle );
circle->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 5 ), LINE_STYLE::SOLID ) );
circle->SetPosition( { schIUScale.MilsToIU( 0 ), schIUScale.MilsToIU( -75 ) } );
circle->SetEnd( circle->GetPosition() + VECTOR2I( schIUScale.MilsToIU( 25 ), 0 ) );
aKsymbol->AddDrawItem( circle, false );
}
else
{
SCH_SHAPE* line2 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line2 );
line2->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line2->AddPoint( { schIUScale.MilsToIU( -25 ), schIUScale.MilsToIU( -50 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 25 ), schIUScale.MilsToIU( -50 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 0 ), schIUScale.MilsToIU( -100 ) } );
line2->AddPoint( { schIUScale.MilsToIU( -25 ), schIUScale.MilsToIU( -50 ) } );
aKsymbol->AddDrawItem( line2, false );
}
return { 0, schIUScale.MilsToIU( 150 ) };
@ -220,18 +220,18 @@ VECTOR2I HelperGeneratePowerPortGraphics( LIB_SYMBOL* aKsymbol, EASYEDA::POWER_F
else if( aStyle == EASYEDA::POWER_FLAG_STYLE::WAVE )
{
SCH_SHAPE* line = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line );
line->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line->AddPoint( { 0, 0 } );
line->AddPoint( { 0, schIUScale.MilsToIU( -72 ) } );
aKsymbol->AddDrawItem( line, false );
SCH_SHAPE* bezier = new SCH_SHAPE( SHAPE_T::BEZIER, LAYER_DEVICE );
aKsymbol->AddDrawItem( bezier );
bezier->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 5 ), LINE_STYLE::SOLID ) );
bezier->AddPoint( { schIUScale.MilsToIU( 30 ), schIUScale.MilsToIU( -50 ) } );
bezier->AddPoint( { schIUScale.MilsToIU( 30 ), schIUScale.MilsToIU( -87 ) } );
bezier->AddPoint( { schIUScale.MilsToIU( -30 ), schIUScale.MilsToIU( -63 ) } );
bezier->AddPoint( { schIUScale.MilsToIU( -30 ), schIUScale.MilsToIU( -100 ) } );
aKsymbol->AddDrawItem( bezier, false );
return { 0, schIUScale.MilsToIU( 150 ) };
}
@ -241,71 +241,71 @@ VECTOR2I HelperGeneratePowerPortGraphics( LIB_SYMBOL* aKsymbol, EASYEDA::POWER_F
|| aStyle == EASYEDA::POWER_FLAG_STYLE::GOST_ARROW )
{
SCH_SHAPE* line1 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line1 );
line1->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line1->AddPoint( { 0, 0 } );
line1->AddPoint( { 0, schIUScale.MilsToIU( -100 ) } );
aKsymbol->AddDrawItem( line1, false );
if( aStyle == EASYEDA::POWER_FLAG_STYLE::POWER_GROUND )
{
SCH_SHAPE* line2 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line2 );
line2->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line2->AddPoint( { schIUScale.MilsToIU( -100 ), schIUScale.MilsToIU( -100 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 100 ), schIUScale.MilsToIU( -100 ) } );
aKsymbol->AddDrawItem( line2, false );
SCH_SHAPE* line3 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line3 );
line3->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line3->AddPoint( { schIUScale.MilsToIU( -70 ), schIUScale.MilsToIU( -120 ) } );
line3->AddPoint( { schIUScale.MilsToIU( 70 ), schIUScale.MilsToIU( -120 ) } );
aKsymbol->AddDrawItem( line3, false );
SCH_SHAPE* line4 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line4 );
line4->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line4->AddPoint( { schIUScale.MilsToIU( -40 ), schIUScale.MilsToIU( -140 ) } );
line4->AddPoint( { schIUScale.MilsToIU( 40 ), schIUScale.MilsToIU( -140 ) } );
aKsymbol->AddDrawItem( line4, false );
SCH_SHAPE* line5 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line5 );
line5->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line5->AddPoint( { schIUScale.MilsToIU( -10 ), schIUScale.MilsToIU( -160 ) } );
line5->AddPoint( { schIUScale.MilsToIU( 10 ), schIUScale.MilsToIU( -160 ) } );
aKsymbol->AddDrawItem( line5, false );
}
else if( aStyle == EASYEDA::POWER_FLAG_STYLE::SIGNAL_GROUND )
{
SCH_SHAPE* line2 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line2 );
line2->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line2->AddPoint( { schIUScale.MilsToIU( -100 ), schIUScale.MilsToIU( -100 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 100 ), schIUScale.MilsToIU( -100 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 0 ), schIUScale.MilsToIU( -160 ) } );
line2->AddPoint( { schIUScale.MilsToIU( -100 ), schIUScale.MilsToIU( -100 ) } );
aKsymbol->AddDrawItem( line2, false );
}
else if( aStyle == EASYEDA::POWER_FLAG_STYLE::EARTH )
{
SCH_SHAPE* line2 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line2 );
line2->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line2->AddPoint( { schIUScale.MilsToIU( -150 ), schIUScale.MilsToIU( -200 ) } );
line2->AddPoint( { schIUScale.MilsToIU( -100 ), schIUScale.MilsToIU( -100 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 100 ), schIUScale.MilsToIU( -100 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 50 ), schIUScale.MilsToIU( -200 ) } );
aKsymbol->AddDrawItem( line2, false );
SCH_SHAPE* line3 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line3 );
line3->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line3->AddPoint( { schIUScale.MilsToIU( 0 ), schIUScale.MilsToIU( -100 ) } );
line3->AddPoint( { schIUScale.MilsToIU( -50 ), schIUScale.MilsToIU( -200 ) } );
aKsymbol->AddDrawItem( line3, false );
}
else // EASYEDA::POWER_FLAG_STYLE::GOST_ARROW
{
SCH_SHAPE* line2 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line2 );
line2->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line2->AddPoint( { schIUScale.MilsToIU( -25 ), schIUScale.MilsToIU( -50 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 0 ), schIUScale.MilsToIU( -100 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 25 ), schIUScale.MilsToIU( -50 ) } );
aKsymbol->AddDrawItem( line2, false );
return { 0, schIUScale.MilsToIU( 150 ) }; // special case
}
@ -316,53 +316,53 @@ VECTOR2I HelperGeneratePowerPortGraphics( LIB_SYMBOL* aKsymbol, EASYEDA::POWER_F
|| aStyle == EASYEDA::POWER_FLAG_STYLE::GOST_EARTH )
{
SCH_SHAPE* line1 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line1 );
line1->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line1->AddPoint( { 0, 0 } );
line1->AddPoint( { 0, schIUScale.MilsToIU( -160 ) } );
aKsymbol->AddDrawItem( line1, false );
SCH_SHAPE* line2 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line2 );
line2->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line2->AddPoint( { schIUScale.MilsToIU( -100 ), schIUScale.MilsToIU( -160 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 100 ), schIUScale.MilsToIU( -160 ) } );
aKsymbol->AddDrawItem( line2, false );
SCH_SHAPE* line3 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line3 );
line3->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line3->AddPoint( { schIUScale.MilsToIU( -60 ), schIUScale.MilsToIU( -200 ) } );
line3->AddPoint( { schIUScale.MilsToIU( 60 ), schIUScale.MilsToIU( -200 ) } );
aKsymbol->AddDrawItem( line3, false );
SCH_SHAPE* line4 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line4 );
line4->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line4->AddPoint( { schIUScale.MilsToIU( -20 ), schIUScale.MilsToIU( -240 ) } );
line4->AddPoint( { schIUScale.MilsToIU( 20 ), schIUScale.MilsToIU( -240 ) } );
aKsymbol->AddDrawItem( line4, false );
if( aStyle == EASYEDA::POWER_FLAG_STYLE::GOST_POWER_GROUND )
return { 0, schIUScale.MilsToIU( 300 ) };
SCH_SHAPE* circle = new SCH_SHAPE( SHAPE_T::CIRCLE, LAYER_DEVICE );
aKsymbol->AddDrawItem( circle );
circle->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
circle->SetPosition( { schIUScale.MilsToIU( 0 ), schIUScale.MilsToIU( -160 ) } );
circle->SetEnd( circle->GetPosition() + VECTOR2I( schIUScale.MilsToIU( 120 ), 0 ) );
aKsymbol->AddDrawItem( circle, false );
return { 0, schIUScale.MilsToIU( 350 ) };
}
else if( aStyle == EASYEDA::POWER_FLAG_STYLE::GOST_BAR )
{
SCH_SHAPE* line1 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line1 );
line1->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line1->AddPoint( { 0, 0 } );
line1->AddPoint( { 0, schIUScale.MilsToIU( -200 ) } );
aKsymbol->AddDrawItem( line1, false );
SCH_SHAPE* line2 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line2 );
line2->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line2->AddPoint( { schIUScale.MilsToIU( -100 ), schIUScale.MilsToIU( -200 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 100 ), schIUScale.MilsToIU( -200 ) } );
aKsymbol->AddDrawItem( line2, false );
return { 0, schIUScale.MilsToIU( 250 ) };
}
@ -375,16 +375,16 @@ VECTOR2I HelperGeneratePowerPortGraphics( LIB_SYMBOL* aKsymbol, EASYEDA::POWER_F
}
SCH_SHAPE* line1 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line1 );
line1->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line1->AddPoint( { 0, 0 } );
line1->AddPoint( { 0, schIUScale.MilsToIU( -100 ) } );
aKsymbol->AddDrawItem( line1, false );
SCH_SHAPE* line2 = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
aKsymbol->AddDrawItem( line2 );
line2->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
line2->AddPoint( { schIUScale.MilsToIU( -50 ), schIUScale.MilsToIU( -100 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 50 ), schIUScale.MilsToIU( -100 ) } );
aKsymbol->AddDrawItem( line2, false );
return { 0, schIUScale.MilsToIU( 150 ) };
}
@ -462,8 +462,6 @@ void SCH_EASYEDA_PARSER::ParseSymbolShapes( LIB_SYMBOL* aSymbol
{
auto shape = std::make_unique<SCH_SHAPE>( SHAPE_T::POLY, LAYER_DEVICE );
outline.Mirror( false, true );
if( outline.IsClosed() )
outline.Append( outline.CPoint( 0 ), true );
@ -519,7 +517,7 @@ void SCH_EASYEDA_PARSER::ParseSymbolShapes( LIB_SYMBOL* aSymbol
svgImportPlugin.GetImageHeight() );
VECTOR2D pixelScale( schIUScale.IUTomm( ScaleSize( size.x ) ) / imSize.x,
schIUScale.IUTomm( -ScaleSize( size.y ) ) / imSize.y );
schIUScale.IUTomm( ScaleSize( size.y ) ) / imSize.y );
libsymImporter.SetScale( pixelScale );
@ -552,7 +550,7 @@ void SCH_EASYEDA_PARSER::ParseSymbolShapes( LIB_SYMBOL* aSymbol
}
VECTOR2D pixelScale( ScaleSize( size.x ) / img.GetWidth(),
-ScaleSize( size.y ) / img.GetHeight() );
ScaleSize( size.y ) / img.GetHeight() );
ConvertImageToLibShapes( aSymbol, 0, img, pixelScale,
RelPosSym( start ) );
@ -575,7 +573,7 @@ void SCH_EASYEDA_PARSER::ParseSymbolShapes( LIB_SYMBOL* aSymbol
auto transform = []( VECTOR2I aVec )
{
return VECTOR2I( aVec.x, -aVec.y );
return VECTOR2I( aVec.x, aVec.y );
};
for( const SHAPE_LINE_CHAIN& chain : chains )
@ -808,8 +806,6 @@ void SCH_EASYEDA_PARSER::ParseSymbolShapes( LIB_SYMBOL* aSymbol
{
auto shape = std::make_unique<SCH_SHAPE>( SHAPE_T::POLY, LAYER_DEVICE );
outline.Mirror( false, true );
if( outline.IsClosed() )
outline.Append( outline.CPoint( 0 ), true );

View File

@ -47,7 +47,7 @@ public:
template <typename T>
VECTOR2<T> RelPosSym( const VECTOR2<T>& aVec )
{
return VECTOR2<T>( RelPosX( aVec.x ), -RelPosY( aVec.y ) );
return VECTOR2<T>( RelPosX( aVec.x ), RelPosY( aVec.y ) );
}
std::pair<LIB_SYMBOL*, bool> MakePowerSymbol( const wxString& aFlagTypename,

View File

@ -480,19 +480,9 @@ SCH_EASYEDAPRO_PARSER::ParseSymbol( const std::vector<nlohmann::json>& aLines,
VECTOR2D kmid = ScalePosSym( mid );
VECTOR2D kend = ScalePosSym( end );
VECTOR2D kcenter = CalcArcCenter( kstart, kmid, kend );
auto shape = std::make_unique<SCH_SHAPE>( SHAPE_T::ARC, LAYER_DEVICE );
shape->SetStart( kstart );
shape->SetEnd( kend );
shape->SetCenter( kcenter );
if( SEG( start, end ).Side( mid ) != SEG( kstart, kend ).Side( shape->GetArcMid() ) )
{
shape->SetStart( kend );
shape->SetEnd( kstart );
}
shape->SetArcGeometry( kstart, kmid, kend );
shape->SetUnit( currentUnit );
ApplyLineStyle( lineStyles, shape, styleStr );
@ -591,7 +581,7 @@ SCH_EASYEDAPRO_PARSER::ParseSymbol( const std::vector<nlohmann::json>& aLines,
svgImportPlugin.GetImageHeight() );
VECTOR2D pixelScale( schIUScale.IUTomm( ScaleSize( size.x ) ) / imSize.x,
schIUScale.IUTomm( -ScaleSize( size.y ) ) / imSize.y );
schIUScale.IUTomm( ScaleSize( size.y ) ) / imSize.y );
if( upsideDown )
pixelScale.y *= -1;
@ -627,7 +617,7 @@ SCH_EASYEDAPRO_PARSER::ParseSymbol( const std::vector<nlohmann::json>& aLines,
}
VECTOR2D pixelScale( ScaleSize( size.x ) / img.GetWidth(),
-ScaleSize( size.y ) / img.GetHeight() );
ScaleSize( size.y ) / img.GetHeight() );
// TODO: rotation
ConvertImageToLibShapes( ksymbol, 0, img, pixelScale, ScalePosSym( start ) );

View File

@ -89,7 +89,7 @@ public:
template <typename T>
static VECTOR2<T> ScalePosSym( VECTOR2<T> aValue )
{
return VECTOR2<T>( ScaleSize( aValue.x ), ScaleSize( aValue.y ) );
return VECTOR2<T>( ScaleSize( aValue.x ), -ScaleSize( aValue.y ) );
}
double SizeToKi( wxString units );