From 58ce8653521c48a64e5c4d4824d8ba9e9594873e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20W=C5=82ostowski?= Date: Wed, 29 Nov 2017 19:51:01 +0100 Subject: [PATCH] pcbnew: made TransformShapeWithClearanceToPolygon virtual --- include/class_board_item.h | 7 ++++++- pcbnew/board_items_to_polygon_shape_transform.cpp | 9 +++++++++ pcbnew/class_board_item.cpp | 9 +++++++++ pcbnew/class_drawsegment.h | 2 +- pcbnew/class_pad.h | 2 +- pcbnew/class_track.h | 2 +- pcbnew/class_zone.h | 6 ++++++ 7 files changed, 33 insertions(+), 4 deletions(-) diff --git a/include/class_board_item.h b/include/class_board_item.h index 19cc26b962..66054cd3ad 100644 --- a/include/class_board_item.h +++ b/include/class_board_item.h @@ -39,7 +39,7 @@ class BOARD; class BOARD_ITEM_CONTAINER; class EDA_DRAW_PANEL; - +class SHAPE_POLY_SET; /** * Enum STROKE_T @@ -334,6 +334,11 @@ public: static std::string FormatInternalUnits( const wxSize& aSize ); virtual void ViewGetLayers( int aLayers[], int& aCount ) const override; + + virtual void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, + int aClearanceValue, + int aCircleToSegmentsCount, + double aCorrectionFactor ) 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 81818bc226..7c8aef7626 100644 --- a/pcbnew/board_items_to_polygon_shape_transform.cpp +++ b/pcbnew/board_items_to_polygon_shape_transform.cpp @@ -1251,3 +1251,12 @@ void CreateThermalReliefPadPolygon( SHAPE_POLY_SET& aCornerBuffer, ; } } + +void ZONE_CONTAINER::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, + int aClearanceValue, + int aCircleToSegmentsCount, + double aCorrectionFactor ) const +{ + 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 1c60f85adc..bcaeb371d1 100644 --- a/pcbnew/class_board_item.cpp +++ b/pcbnew/class_board_item.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -264,3 +265,11 @@ 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.")); +}; diff --git a/pcbnew/class_drawsegment.h b/pcbnew/class_drawsegment.h index 51655c419d..d892172f6d 100644 --- a/pcbnew/class_drawsegment.h +++ b/pcbnew/class_drawsegment.h @@ -230,7 +230,7 @@ public: void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aClearanceValue, int aCircleToSegmentsCount, - double aCorrectionFactor ) const; + double aCorrectionFactor ) const override; virtual wxString GetSelectMenuText() const override; diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h index b767d0bc10..bc1c9f118f 100644 --- a/pcbnew/class_pad.h +++ b/pcbnew/class_pad.h @@ -428,7 +428,7 @@ public: void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aClearanceValue, int aCircleToSegmentsCount, - double aCorrectionFactor ) const; + double aCorrectionFactor ) const override; /** * Function GetClearance diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h index c152ab006f..0509c74e80 100644 --- a/pcbnew/class_track.h +++ b/pcbnew/class_track.h @@ -194,7 +194,7 @@ public: void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aClearanceValue, int aCircleToSegmentsCount, - double aCorrectionFactor ) const; + double aCorrectionFactor ) 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 d9f63ea338..aabb4b631a 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/class_zone.h @@ -360,6 +360,12 @@ public: void TransformOutlinesShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aMinClearanceValue, bool aUseNetClearance ); + + void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, + int aClearanceValue, + int aCircleToSegmentsCount, + double aCorrectionFactor ) const override; + /** * Function HitTestForCorner * tests if the given wxPoint is near a corner.