Consider edge cuts items to have zero width when filling zones.

Fixes: lp:1797787
* https://bugs.launchpad.net/kicad/+bug/1797787
This commit is contained in:
Jeff Young 2018-11-14 23:34:32 +00:00
parent d65bb73d4e
commit bcc8c64256
10 changed files with 84 additions and 20 deletions

View File

@ -748,7 +748,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
switch( item->Type() )
{
case PCB_LINE_T: // should not exist on copper layers
case PCB_LINE_T:
{
const int nrSegments =
GetNrSegmentsCircle( item->GetBoundingBox().GetSizeMax() );

View File

@ -406,7 +406,7 @@ void SCH_PAINTER::draw( LIB_FIELD *aField, int aLayer )
m_gal->StrokeText( aField->GetText(), pos, orient );
// Draw the umbilical line
if( aField->IsMoving() && m_schSettings->m_ShowUmbilicals )
if( aField->IsMoving() && m_schSettings.m_ShowUmbilicals )
{
m_gal->SetLineWidth( m_schSettings.m_outlineWidth );
m_gal->SetStrokeColor( COLOR4D( 0.0, 0.0, 1.0, 1.0 ) );

View File

@ -338,10 +338,25 @@ public:
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
/**
* Function TransformShapeWithClearanceToPolygon
* Convert the item shape to a closed polygon
* Used in filling zones calculations
* Circles and arcs are approximated by segments
* @param aCornerBuffer = a buffer to store the polygon
* @param aClearanceValue = the clearance around the pad
* @param aCircleToSegmentsCount = the number of segments to approximate a circle
* @param aCorrectionFactor = the correction to apply to circles radius to keep
* clearance when the circle is approximated by segment bigger or equal
* to the real clearance value (usually near from 1.0)
* @param ignoreLineWidth = used for edge cut items where the line width is only
* for visualization
*/
virtual void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
int aClearanceValue,
int aCircleToSegmentsCount,
double aCorrectionFactor ) const;
double aCorrectionFactor,
bool ignoreLineWidth = false ) const;
};
#endif /* BOARD_ITEM_STRUCT_H */

View File

@ -510,14 +510,19 @@ void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(
* @param aCorrectionFactor = the correction to apply to circles radius to keep
* clearance when the circle is approxiamted by segment bigger or equal
* to the real clearance value (usually near from 1.0)
* @param ignoreLineWidth = used for edge cut items where the line width is only
* for visualization
*/
void DRAWSEGMENT::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
int aClearanceValue,
int aCircleToSegmentsCount,
double aCorrectionFactor ) const
double aCorrectionFactor,
bool ignoreLineWidth ) const
{
// The full width of the lines to create:
int linewidth = m_Width + (2 * aClearanceValue);
int linewidth = ignoreLineWidth ? 0 : m_Width;
linewidth += 2 * aClearanceValue;
// Creating a reliable clearance shape for circles and arcs is not so easy, due to
// the error created by segment approximation.
@ -635,12 +640,17 @@ void DRAWSEGMENT::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerB
* @param aCorrectionFactor = the correction to apply to circles radius to keep
* clearance when the circle is approximated by segment bigger or equal
* to the real clearance value (usually near from 1.0)
* @param ignoreLineWidth = used for edge cut items where the line width is only
* for visualization
*/
void TRACK::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
int aClearanceValue,
int aCircleToSegmentsCount,
double aCorrectionFactor ) const
double aCorrectionFactor,
bool ignoreLineWidth ) const
{
wxASSERT_MSG( !ignoreLineWidth, "IgnoreLineWidth has no meaning for tracks." );
switch( Type() )
{
case PCB_VIA_T:
@ -671,12 +681,17 @@ void TRACK::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
* aCorrectionFactor = the correction to apply to circles radius to keep
* clearance when the circle is approximated by segment bigger or equal
* to the real clearance value (usually near from 1.0)
* @param ignoreLineWidth = used for edge cut items where the line width is only
* for visualization
*/
void D_PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
int aClearanceValue,
int aCircleToSegmentsCount,
double aCorrectionFactor ) const
double aCorrectionFactor,
bool ignoreLineWidth ) const
{
wxASSERT_MSG( !ignoreLineWidth, "IgnoreLineWidth has no meaning for pads." );
double angle = m_Orient;
int dx = (m_Size.x / 2) + aClearanceValue;
int dy = (m_Size.y / 2) + aClearanceValue;
@ -1321,8 +1336,11 @@ void CreateThermalReliefPadPolygon( SHAPE_POLY_SET& aCornerBuffer,
void ZONE_CONTAINER::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
int aClearanceValue,
int aCircleToSegmentsCount,
double aCorrectionFactor ) const
double aCorrectionFactor,
bool ignoreLineWidth ) const
{
wxASSERT_MSG( !ignoreLineWidth, "IgnoreLineWidth has no meaning for zones." );
aCornerBuffer = m_FilledPolysList;
aCornerBuffer.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
}

View File

@ -275,7 +275,8 @@ void BOARD_ITEM::SwapData( BOARD_ITEM* aImage )
void BOARD_ITEM::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
int aClearanceValue,
int aCircleToSegmentsCount,
double aCorrectionFactor ) const
{
wxASSERT_MSG(false, wxT("Called TransformShapeWithClearanceToPolygon() on unsupported BOARD_ITEM."));
double aCorrectionFactor,
bool ignoreLineWidth ) const
{
wxASSERT_MSG( false, "Called TransformShapeWithClearanceToPolygon() on unsupported BOARD_ITEM." );
};

View File

@ -242,7 +242,7 @@ public:
/**
* Function TransformShapeWithClearanceToPolygon
* Convert the track shape to a closed polygon
* Convert the draw segment to a closed polygon
* Used in filling zones calculations
* Circles and arcs are approximated by segments
* @param aCornerBuffer = a buffer to store the polygon
@ -251,11 +251,14 @@ public:
* @param aCorrectionFactor = the correction to apply to circles radius to keep
* clearance when the circle is approximated by segment bigger or equal
* to the real clearance value (usually near from 1.0)
* @param ignoreLineWidth = used for edge cut items where the line width is only
* for visualization
*/
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
int aClearanceValue,
int aCircleToSegmentsCount,
double aCorrectionFactor ) const override;
double aCorrectionFactor,
bool ignoreLineWidth = false ) const override;
virtual wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;

View File

@ -435,13 +435,16 @@ public:
* @param aCorrectionFactor = the correction to apply to circles radius to keep
* clearance when the circle is approximated by segment bigger or equal
* to the real clearance value (usually near from 1.0)
*/
* @param ignoreLineWidth = used for edge cut items where the line width is only
* for visualization
*/
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
int aClearanceValue,
int aCircleToSegmentsCount,
double aCorrectionFactor ) const override;
double aCorrectionFactor,
bool ignoreLineWidth = false ) const override;
/**
/**
* Function GetClearance
* returns the clearance in internal units. If \a aItem is not NULL then the
* returned clearance is the greater of this object's clearance and

View File

@ -192,11 +192,14 @@ public:
* @param aCorrectionFactor = the correction to apply to circles radius to keep
* clearance when the circle is approximated by segment bigger or equal
* to the real clearance value (usually near from 1.0)
* @param ignoreLineWidth = used for edge cut items where the line width is only
* for visualization
*/
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
int aClearanceValue,
int aCircleToSegmentsCount,
double aCorrectionFactor ) const override;
double aCorrectionFactor,
bool ignoreLineWidth = false ) const override;
/**
* Function IsPointOnEnds
* returns STARTPOINT if point if near (dist = min_dist) start point, ENDPOINT if

View File

@ -305,10 +305,25 @@ public:
int aMinClearanceValue,
bool aUseNetClearance ) const;
/**
* Function TransformShapeWithClearanceToPolygon
* Convert the zone shape to a closed polygon
* Used in filling zones calculations
* Circles and arcs are approximated by segments
* @param aCornerBuffer = a buffer to store the polygon
* @param aClearanceValue = the clearance around the pad
* @param aCircleToSegmentsCount = the number of segments to approximate a circle
* @param aCorrectionFactor = the correction to apply to circles radius to keep
* clearance when the circle is approximated by segment bigger or equal
* to the real clearance value (usually near from 1.0)
* @param ignoreLineWidth = used for edge cut items where the line width is only
* for visualization
*/
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
int aClearanceValue,
int aCircleToSegmentsCount,
double aCorrectionFactor ) const override;
double aCorrectionFactor,
bool ignoreLineWidth = false ) const override;
/**
* Function HitTestForCorner

View File

@ -520,18 +520,24 @@ void ZONE_FILLER::buildZoneFeatureHoleList( const ZONE_CONTAINER* aZone,
if( !aItem->GetBoundingBox().Intersects( zone_boundingbox ) )
return;
bool ignoreLineWidth = false;
int zclearance = zone_clearance;
if( aItem->IsOnLayer( Edge_Cuts ) )
{
// use only the m_ZoneClearance, not the clearance using
// the netclass value, because we do not have a copper item
zclearance = zone_to_edgecut_clearance;
// edge cuts by definition don't have a width
ignoreLineWidth = true;
}
switch( aItem->Type() )
{
case PCB_LINE_T:
( (DRAWSEGMENT*) aItem )->TransformShapeWithClearanceToPolygon(
aFeatures, zclearance, segsPerCircle, correctionFactor );
aFeatures, zclearance, segsPerCircle, correctionFactor, ignoreLineWidth );
break;
case PCB_TEXT_T:
@ -541,7 +547,7 @@ void ZONE_FILLER::buildZoneFeatureHoleList( const ZONE_CONTAINER* aZone,
case PCB_MODULE_EDGE_T:
( (EDGE_MODULE*) aItem )->TransformShapeWithClearanceToPolygon(
aFeatures, zclearance, segsPerCircle, correctionFactor );
aFeatures, zclearance, segsPerCircle, correctionFactor, ignoreLineWidth );
break;
case PCB_MODULE_TEXT_T: