Register properties for ARC elements so we can get their netclass.
Also improves GAL arc drawing and polygonization. Fixes https://gitlab.com/kicad/code/kicad/issues/6039
This commit is contained in:
parent
47786fa976
commit
58c006bc45
|
@ -841,7 +841,12 @@ void OPENGL_GAL::DrawArcSegment( const VECTOR2D& aCenterPoint, double aRadius, d
|
|||
// Swap the angles, if start angle is greater than end angle
|
||||
SWAP( aStartAngle, >, aEndAngle );
|
||||
|
||||
const double alphaIncrement = calcAngleStep( aRadius );
|
||||
// Bigger arcs need smaller alpha increment to make them look smooth
|
||||
const double alphaIncrement = std::min( 1e6 / aRadius, 2.0 * M_PI / CIRCLE_POINTS );
|
||||
|
||||
// Draw entirely within the real arc boundary (ie: put all polygonization error inside)
|
||||
double correctionFactor = cos( M_PI / (double) CIRCLE_POINTS );
|
||||
aRadius *= correctionFactor;
|
||||
|
||||
Save();
|
||||
currentManager->Translate( aCenterPoint.x, aCenterPoint.y, 0.0 );
|
||||
|
|
|
@ -375,13 +375,14 @@ const SHAPE_LINE_CHAIN SHAPE_ARC::ConvertToPolyline( double aAccuracy ) const
|
|||
|
||||
int n;
|
||||
|
||||
if( r == 0.0 )
|
||||
if( r < aAccuracy )
|
||||
{
|
||||
n = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
n = GetArcToSegmentCount( r, aAccuracy, ca );
|
||||
r -= aAccuracy / 2; // Split the error on either side of arc
|
||||
}
|
||||
|
||||
for( int i = 0; i <= n ; i++ )
|
||||
|
|
|
@ -1074,6 +1074,23 @@ static struct TRACK_VIA_DESC
|
|||
propMgr.AddProperty( new PROPERTY<TRACK, int>( _HKI( "End Y" ),
|
||||
&TRACK::SetEndY, &TRACK::GetEndY, PROPERTY_DISPLAY::DISTANCE ) );
|
||||
|
||||
// Arc
|
||||
REGISTER_TYPE( ARC );
|
||||
propMgr.InheritsAfter( TYPE_HASH( ARC ), TYPE_HASH( BOARD_CONNECTED_ITEM ) );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<TRACK, int>( _HKI( "Width" ),
|
||||
&ARC::SetWidth, &ARC::GetWidth, PROPERTY_DISPLAY::DISTANCE ) );
|
||||
propMgr.ReplaceProperty( TYPE_HASH( BOARD_ITEM ), _HKI( "Position X" ),
|
||||
new PROPERTY<ARC, int, BOARD_ITEM>( _HKI( "Origin X" ),
|
||||
&TRACK::SetX, &ARC::GetX, PROPERTY_DISPLAY::DISTANCE ) );
|
||||
propMgr.ReplaceProperty( TYPE_HASH( BOARD_ITEM ), _HKI( "Position Y" ),
|
||||
new PROPERTY<ARC, int, BOARD_ITEM>( _HKI( "Origin Y" ),
|
||||
&TRACK::SetY, &ARC::GetY, PROPERTY_DISPLAY::DISTANCE ) );
|
||||
propMgr.AddProperty( new PROPERTY<TRACK, int>( _HKI( "End X" ),
|
||||
&TRACK::SetEndX, &ARC::GetEndX, PROPERTY_DISPLAY::DISTANCE ) );
|
||||
propMgr.AddProperty( new PROPERTY<TRACK, int>( _HKI( "End Y" ),
|
||||
&TRACK::SetEndY, &ARC::GetEndY, PROPERTY_DISPLAY::DISTANCE ) );
|
||||
|
||||
// Via
|
||||
REGISTER_TYPE( VIA );
|
||||
propMgr.InheritsAfter( TYPE_HASH( VIA ), TYPE_HASH( BOARD_CONNECTED_ITEM ) );
|
||||
|
|
|
@ -587,13 +587,15 @@ void PCB_PAINTER::draw( const ARC* aArc, int aLayer )
|
|||
|
||||
if( ( m_pcbSettings.m_clearance & clearanceFlags ) == clearanceFlags )
|
||||
{
|
||||
int clearance = aArc->GetOwnClearance( m_pcbSettings.GetActiveLayer() );
|
||||
|
||||
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
|
||||
m_gal->SetIsFill( false );
|
||||
m_gal->SetIsStroke( true );
|
||||
m_gal->SetStrokeColor( color );
|
||||
|
||||
m_gal->DrawArcSegment( center, radius, start_angle, start_angle + angle,
|
||||
width + aArc->GetOwnClearance( ToLAYER_ID( aLayer ) ) * 2 );
|
||||
width + clearance * 2 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue