diff --git a/3d-viewer/3d_canvas/create_layer_items.cpp b/3d-viewer/3d_canvas/create_layer_items.cpp index ac965c6808..f624e46378 100644 --- a/3d-viewer/3d_canvas/create_layer_items.cpp +++ b/3d-viewer/3d_canvas/create_layer_items.cpp @@ -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() ); diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index b6e4c10a9c..0d14f00ca8 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -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 ) ); diff --git a/include/class_board_item.h b/include/class_board_item.h index f12506874b..53ee8e6345 100644 --- a/include/class_board_item.h +++ b/include/class_board_item.h @@ -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 */ diff --git a/pcbnew/board_items_to_polygon_shape_transform.cpp b/pcbnew/board_items_to_polygon_shape_transform.cpp index ee4c1a5f59..0dbd82a497 100644 --- a/pcbnew/board_items_to_polygon_shape_transform.cpp +++ b/pcbnew/board_items_to_polygon_shape_transform.cpp @@ -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 ); } diff --git a/pcbnew/class_board_item.cpp b/pcbnew/class_board_item.cpp index 0d764f9cc5..e1ad270924 100644 --- a/pcbnew/class_board_item.cpp +++ b/pcbnew/class_board_item.cpp @@ -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." ); }; diff --git a/pcbnew/class_drawsegment.h b/pcbnew/class_drawsegment.h index c79beccb82..c57d7ff18e 100644 --- a/pcbnew/class_drawsegment.h +++ b/pcbnew/class_drawsegment.h @@ -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; diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h index 5b1e3260d1..f3dce2ef0b 100644 --- a/pcbnew/class_pad.h +++ b/pcbnew/class_pad.h @@ -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 diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h index 75df81ed62..5255913845 100644 --- a/pcbnew/class_track.h +++ b/pcbnew/class_track.h @@ -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 diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h index 3658afe048..030ca68fac 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/class_zone.h @@ -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 diff --git a/pcbnew/zone_filler.cpp b/pcbnew/zone_filler.cpp index 10fd751cfa..0f498cb189 100644 --- a/pcbnew/zone_filler.cpp +++ b/pcbnew/zone_filler.cpp @@ -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: