KiCad PCB EDA Suite
|
TEARDROP_MANAGER manage and build teardrop areas A teardrop area is a polygonal area (a copper ZONE) having: 2 points on the track connected to a pad or via 2 points on the outline of this pad or via 1 point near the pad/via position (calculated in order to have this pad/via position inside the area The 2 sides joining a point on the track to the corresponding point on the pad/via outline can be a straight line or a curved shape (defined from a Bezier curve) This curved shape is built by segments (3 to 10) from this Bezier curve Because one cannot build a suitable shape for a custom pad, custom pads are ignored. More...
#include <teardrop.h>
Public Types | |
enum | TEARDROP_VARIANT { TD_TYPE_PADVIA , TD_TYPE_TRACKEND } |
Public Member Functions | |
TEARDROP_MANAGER (BOARD *aBoard, TOOL_MANAGER *aToolManager) | |
void | RemoveTeardrops (BOARD_COMMIT &aCommit, const std::vector< BOARD_ITEM * > *dirtyPadsAndVias, const std::set< PCB_TRACK * > *dirtyTracks) |
Remove teardrops connected to any dirty pads, vias or tracks. | |
void | UpdateTeardrops (BOARD_COMMIT &aCommit, const std::vector< BOARD_ITEM * > *dirtyPadsAndVias, const std::set< PCB_TRACK * > *dirtyTracks, bool aForceFullUpdate=false) |
Update teardrops on a list of items. | |
void | AddTeardropsOnTracks (BOARD_COMMIT &aCommit, const std::set< PCB_TRACK * > *aTracks, bool aForceFullUpdate=false) |
Add teardrop on tracks of different sizes connected by their end. | |
void | DeleteTrackToTrackTeardrops (BOARD_COMMIT &aCommit) |
Static Public Member Functions | |
static int | GetWidth (BOARD_ITEM *aItem, PCB_LAYER_ID aLayer) |
static bool | IsRound (BOARD_ITEM *aItem, PCB_LAYER_ID aLayer) |
Private Member Functions | |
bool | areItemsInSameZone (BOARD_ITEM *aPadOrVia, PCB_TRACK *aTrack) const |
void | computeCurvedForRoundShape (const TEARDROP_PARAMETERS &aParams, std::vector< VECTOR2I > &aPoly, PCB_LAYER_ID aLayer, int aTrackHalfWidth, const VECTOR2D &aTrackDir, BOARD_ITEM *aOther, const VECTOR2I &aOtherPos, std::vector< VECTOR2I > &aPts) const |
Compute the curve part points for teardrops connected to a round shape The Bezier curve control points are optimized for a round pad/via shape, and do not give a good curve shape for other pad shapes use m_m_heightRatio. | |
void | computeCurvedForRectShape (const TEARDROP_PARAMETERS &aParams, std::vector< VECTOR2I > &aPoly, int aTdWidth, int aTrackHalfWidth, std::vector< VECTOR2I > &aPts, const VECTOR2I &aIntersection) const |
Compute the curve part points for teardrops connected to a rectangular/polygonal shape The Bezier curve control points are not optimized for a special shape, so use computeCurvedForRoundShape() for round shapes for better result. | |
bool | computeTeardropPolygon (const TEARDROP_PARAMETERS &aParams, std::vector< VECTOR2I > &aCorners, PCB_TRACK *aTrack, BOARD_ITEM *aOther, const VECTOR2I &aOtherPos) const |
Compute all teardrop points of the polygon shape. | |
bool | computeAnchorPoints (const TEARDROP_PARAMETERS &aParams, PCB_LAYER_ID aLayer, BOARD_ITEM *aItem, const VECTOR2I &aPos, std::vector< VECTOR2I > &aPts) const |
Compute the 2 points on pad/via of the teardrop shape. | |
PCB_TRACK * | findTouchingTrack (EDA_ITEM_FLAGS &aMatchType, PCB_TRACK *aTrackRef, const VECTOR2I &aEndPoint) const |
Find a track connected to the end of another track. | |
ZONE * | createTeardrop (TEARDROP_VARIANT aTeardropVariant, std::vector< VECTOR2I > &aPoints, PCB_TRACK *aTrack) const |
Creates a teardrop (a ZONE item) from its polygonal shape, track netcode and layer. | |
void | setTeardropPriorities () |
Set priority of created teardrops. | |
bool | findAnchorPointsOnTrack (const TEARDROP_PARAMETERS &aParams, VECTOR2I &aStartPoint, VECTOR2I &aEndPoint, VECTOR2I &aIntersection, PCB_TRACK *&aTrack, BOARD_ITEM *aOther, const VECTOR2I &aOtherPos, int *aEffectiveTeardropLen) const |
void | buildTrackCaches () |
Private Attributes | |
int | m_tolerance |
BOARD * | m_board |
TOOL_MANAGER * | m_toolManager |
TEARDROP_PARAMETERS_LIST * | m_prmsList |
DRC_RTREE | m_tracksRTree |
TRACK_BUFFER | m_trackLookupList |
std::vector< ZONE * > | m_createdTdList |
Friends | |
class | TEARDROP_PARAMETERS |
TEARDROP_MANAGER manage and build teardrop areas A teardrop area is a polygonal area (a copper ZONE) having: 2 points on the track connected to a pad or via 2 points on the outline of this pad or via 1 point near the pad/via position (calculated in order to have this pad/via position inside the area The 2 sides joining a point on the track to the corresponding point on the pad/via outline can be a straight line or a curved shape (defined from a Bezier curve) This curved shape is built by segments (3 to 10) from this Bezier curve Because one cannot build a suitable shape for a custom pad, custom pads are ignored.
Size of area (height and length) are defined from the pad/via size or for pads having a size X and a size Y, the smallest of X,Y size.
Definition at line 96 of file teardrop.h.
Enumerator | |
---|---|
TD_TYPE_PADVIA | |
TD_TYPE_TRACKEND |
Definition at line 101 of file teardrop.h.
TEARDROP_MANAGER::TEARDROP_MANAGER | ( | BOARD * | aBoard, |
TOOL_MANAGER * | aToolManager | ||
) |
Definition at line 48 of file teardrop.cpp.
References BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetTeadropParamsList(), m_board, m_prmsList, and m_tolerance.
void TEARDROP_MANAGER::AddTeardropsOnTracks | ( | BOARD_COMMIT & | aCommit, |
const std::set< PCB_TRACK * > * | aTracks, | ||
bool | aForceFullUpdate = false |
||
) |
Add teardrop on tracks of different sizes connected by their end.
Definition at line 344 of file teardrop.cpp.
References BOARD::Add(), COMMIT::Added(), computeTeardropPolygon(), alg::contains(), createTeardrop(), TRACK_BUFFER::GetBuffer(), BOARD::GetConnectivity(), PCB_TRACK::GetEnd(), PCB_TRACK::GetLength(), TRACK_BUFFER::GetNetcodeAndLayerFromIndex(), TEARDROP_PARAMETERS_LIST::GetParameters(), PCB_TRACK::GetStart(), PCB_TRACK::GetWidth(), GetWidth(), PCB_TRACK::IsPointOnEnds(), KiROUND(), m_board, m_createdTdList, m_prmsList, m_tolerance, m_trackLookupList, TEARDROP_PARAMETERS::m_WidthtoSizeFilterRatio, pad, TARGET_TRACK, TD_TYPE_TRACKEND, and via.
Referenced by DIALOG_GLOBAL_EDIT_TEARDROPS::TransferDataFromWindow(), and UpdateTeardrops().
|
private |
Definition at line 116 of file teardrop_utils.cpp.
References BOARD_ITEM::GetLayer(), BOARD_CONNECTED_ITEM::GetNetCode(), EDA_ITEM::GetPosition(), m_board, pad, PCB_PAD_T, EDA_ITEM::Type(), and BOARD::Zones().
Referenced by UpdateTeardrops().
|
private |
Definition at line 103 of file teardrop_utils.cpp.
References TRACK_BUFFER::AddTrack(), DRC_RTREE::Insert(), m_board, m_trackLookupList, m_tracksRTree, PCB_ARC_T, PCB_TRACE_T, and BOARD::Tracks().
Referenced by UpdateTeardrops().
|
private |
Compute the 2 points on pad/via of the teardrop shape.
aLayer | is the layer for the teardrop |
aItem | is the via/pad/track used to build the teardrop |
aPos | is the via/pad position, or track start or end teardrop height = aViaPad size * aHeightRatio |
aPts | is the buffer that contains initial and final teardrop polygonal shape in aPts: A and B ( aPts[0] and aPts[1] ) are points on the track C and E ( aPts[2] and aPts[4] ) are points on the aViaPad D ( aPts[3] ) is midpoint behind the aViaPad centre m_heightRatio is the factor to calculate the aViaPad teardrop size |
Definition at line 318 of file teardrop_utils.cpp.
References SHAPE_POLY_SET::Append(), ARC_LOW_DEF, SHAPE_LINE_CHAIN::Area(), SHAPE_POLY_SET::BooleanIntersection(), BuildConvexHull(), SHAPE_LINE_CHAIN::CPoints(), ERROR_INSIDE, VECTOR2< T >::EuclideanNorm(), GetWidth(), IsRound(), KiROUND(), TEARDROP_PARAMETERS::m_BestWidthRatio, TEARDROP_PARAMETERS::m_TdMaxWidth, SHAPE_POLY_SET::Move(), SHAPE_POLY_SET::NewOutline(), next(), SHAPE_POLY_SET::Outline(), pad, PCB_PAD_T, SHAPE_POLY_SET::PM_FAST, SHAPE_POLY_SET::Rotate(), TransformCircleToPolygon(), and EDA_ITEM::Type().
Referenced by computeTeardropPolygon().
|
private |
Compute the curve part points for teardrops connected to a rectangular/polygonal shape The Bezier curve control points are not optimized for a special shape, so use computeCurvedForRoundShape() for round shapes for better result.
Definition at line 274 of file teardrop_utils.cpp.
References ARC_HIGH_DEF, VECTOR2< T >::EuclideanNorm(), BEZIER_POLY::GetPoly(), and VECTOR2< T >::Resize().
Referenced by computeTeardropPolygon().
|
private |
Compute the curve part points for teardrops connected to a round shape The Bezier curve control points are optimized for a round pad/via shape, and do not give a good curve shape for other pad shapes use m_m_heightRatio.
Definition at line 213 of file teardrop_utils.cpp.
References ARC_HIGH_DEF, BEZIER_POLY::GetPoly(), GetWidth(), KiROUND(), SEG::Length(), TEARDROP_PARAMETERS::m_BestWidthRatio, TEARDROP_PARAMETERS::m_TdMaxWidth, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by computeTeardropPolygon().
|
private |
Compute all teardrop points of the polygon shape.
Definition at line 681 of file teardrop_utils.cpp.
References computeAnchorPoints(), computeCurvedForRectShape(), computeCurvedForRoundShape(), findAnchorPointsOnTrack(), BOARD_ITEM::GetLayer(), PCB_TRACK::GetWidth(), GetWidth(), TEARDROP_PARAMETERS::IsCurved(), IsRound(), KiROUND(), TEARDROP_PARAMETERS::m_BestWidthRatio, TEARDROP_PARAMETERS::m_TdMaxWidth, EDA_IU_SCALE::mmToIU(), NormalizeVector(), pad, pcbIUScale, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by AddTeardropsOnTracks(), and UpdateTeardrops().
|
private |
Creates a teardrop (a ZONE item) from its polygonal shape, track netcode and layer.
aTeardropVariant | = variant of the teardrop( attached to a pad, or a track end ) |
aPoints | is the polygonal shape |
aTrack | is the track connected to the starting points of the teardrop (mainly for net info) |
Definition at line 57 of file teardrop.cpp.
References SHAPE_POLY_SET::Append(), ZONE::CalculateFilledArea(), ZONE_SETTINGS::ExportSetting(), ZONE_SETTINGS::GetDefaultSettings(), BOARD_ITEM::GetLayer(), BOARD_CONNECTED_ITEM::GetNetCode(), m_board, MAGIC_TEARDROP_PADVIA_NAME, MAGIC_TEARDROP_TRACK_NAME, EDA_IU_SCALE::mmToIU(), SHAPE_POLY_SET::NewOutline(), ZONE::Outline(), pcbIUScale, ZONE::SetBorderDisplayStyle(), ZONE::SetFilledPolysList(), ZONE::SetIsFilled(), ZONE::SetIslandRemovalMode(), ZONE::SetLayer(), ZONE::SetLocalClearance(), ZONE::SetMinThickness(), BOARD_CONNECTED_ITEM::SetNetCode(), ZONE::SetPadConnection(), ZONE::SetTeardropAreaType(), ZONE::SetZoneName(), and TD_TYPE_PADVIA.
Referenced by AddTeardropsOnTracks(), and UpdateTeardrops().
void TEARDROP_MANAGER::DeleteTrackToTrackTeardrops | ( | BOARD_COMMIT & | aCommit | ) |
Definition at line 286 of file teardrop.cpp.
References m_board, BOARD::Remove(), COMMIT::Removed(), and BOARD::Zones().
Referenced by DIALOG_GLOBAL_EDIT_TEARDROPS::TransferDataFromWindow().
|
private |
aStartPoint | is the start point of the track found (always inside the teardrop) |
aEndPoint | is the start point of the track found (always outside the teardrop) |
aIntersection | is the point where the track's centerline meets the pad/via edge |
aTrack | is the track connected to the pad/via used to search a anchor point this reference can be modified if a connected track to the initial track is selected |
aOther | is the via/pad/track used to build the teardrop |
aOtherPos | is the via/pad position, or track start or end |
aEffectiveTeardropLen | is the actual teardrop length, that can be smaller than expected if the connected track length is too small |
aFollowTracks | = true to use a connected track to aTrack if aTrack is too small |
aTrackLookupList | is the list of tracks to explore if aFollowTracks = true m_lengthRatio is the length of teardrop (ratio pad/via size/teardrop len) |
Definition at line 499 of file teardrop_utils.cpp.
References ARC_LOW_DEF, SHAPE_ARC::ConvertToPolyline(), SHAPE_LINE_CHAIN::CPoint(), ERROR_INSIDE, findTouchingTrack(), PCB_TRACK::GetEnd(), BOARD_ITEM::GetLayer(), PCB_TRACK::GetLength(), PCB_ARC::GetMid(), PCB_TRACK::GetStart(), PCB_TRACK::GetWidth(), GetWidth(), EDA_ITEM::HitTest(), SHAPE_LINE_CHAIN::Intersect(), IsRound(), KiROUND(), TEARDROP_PARAMETERS::m_AllowUseTwoTracks, TEARDROP_PARAMETERS::m_BestLengthRatio, TEARDROP_PARAMETERS::m_TdMaxLen, SHAPE_POLY_SET::Outline(), PCB_ARC_T, PCB_PAD_T, SHAPE_LINE_CHAIN::PointCount(), SHAPE_ARC::Reverse(), SHAPE_LINE_CHAIN::SetClosed(), STARTPOINT, TransformCircleToPolygon(), and EDA_ITEM::Type().
Referenced by computeTeardropPolygon().
|
private |
Find a track connected to the end of another track.
aMatchType | returns the end point id 0, STARTPOINT, ENDPOINT |
aTrackRef | is the reference track |
aEndpoint | is the coordinate to test |
tracksRTree | is an RTree containing the available tracks |
Definition at line 153 of file teardrop_utils.cpp.
References BOARD_ITEM::GetLayer(), m_tracksRTree, and DRC_RTREE::QueryColliding().
Referenced by findAnchorPointsOnTrack().
|
static |
Definition at line 65 of file teardrop_utils.cpp.
References PCB_TRACK::GetWidth(), pad, PCB_ARC_T, PCB_PAD_T, PCB_TRACE_T, PCB_VIA_T, EDA_ITEM::Type(), and via.
Referenced by AddTeardropsOnTracks(), computeAnchorPoints(), computeCurvedForRoundShape(), computeTeardropPolygon(), and findAnchorPointsOnTrack().
|
static |
Definition at line 87 of file teardrop_utils.cpp.
References pad, PCB_PAD_T, and EDA_ITEM::Type().
Referenced by computeAnchorPoints(), computeTeardropPolygon(), findAnchorPointsOnTrack(), DIALOG_GLOBAL_EDIT_TEARDROPS::processItem(), and DIALOG_GLOBAL_EDIT_TEARDROPS::visitItem().
void TEARDROP_MANAGER::RemoveTeardrops | ( | BOARD_COMMIT & | aCommit, |
const std::vector< BOARD_ITEM * > * | dirtyPadsAndVias, | ||
const std::set< PCB_TRACK * > * | dirtyTracks | ||
) |
Remove teardrops connected to any dirty pads, vias or tracks.
They need to be removed before being rebuilt.
NB: this must be called BEFORE the connectivity is updated for the change in question.
Definition at line 99 of file teardrop.cpp.
References alg::contains(), BOARD::GetConnectivity(), m_board, pad, BOARD::Remove(), COMMIT::Removed(), via, and BOARD::Zones().
Referenced by BOARD_COMMIT::Push().
|
private |
Set priority of created teardrops.
smaller have bigger priority
Definition at line 304 of file teardrop.cpp.
References ZONE::GetFirstLayer(), ZONE::GetOutlineArea(), m_createdTdList, and MAGIC_TEARDROP_ZONE_ID.
Referenced by UpdateTeardrops().
void TEARDROP_MANAGER::UpdateTeardrops | ( | BOARD_COMMIT & | aCommit, |
const std::vector< BOARD_ITEM * > * | dirtyPadsAndVias, | ||
const std::set< PCB_TRACK * > * | dirtyTracks, | ||
bool | aForceFullUpdate = false |
||
) |
Update teardrops on a list of items.
Definition at line 151 of file teardrop.cpp.
References BOARD::Add(), COMMIT::Added(), AddTeardropsOnTracks(), areItemsInSameZone(), buildTrackCaches(), computeTeardropPolygon(), alg::contains(), createTeardrop(), BOARD::GetConnectivity(), TEARDROP_PARAMETERS_LIST::GetParameters(), BOARD::LegacyTeardrops(), TEARDROP_PARAMETERS::m_BestWidthRatio, m_board, m_createdTdList, TEARDROP_PARAMETERS::m_Enabled, m_prmsList, TEARDROP_PARAMETERS::m_TdMaxWidth, TEARDROP_PARAMETERS::m_TdOnPadsInZones, m_tolerance, TEARDROP_PARAMETERS::m_WidthtoSizeFilterRatio, EDA_IU_SCALE::mmToIU(), pad, PCB_ARC_T, PCB_TRACE_T, pcbIUScale, BOARD::Remove(), COMMIT::Removed(), setTeardropPriorities(), TARGET_TRACK, TD_TYPE_PADVIA, BOARD::Tracks(), via, VECTOR2< T >::x, VECTOR2< T >::y, and BOARD::Zones().
Referenced by ZONE_FILLER_TOOL::FillAllZones(), BOARD_COMMIT::Push(), and DIALOG_GLOBAL_EDIT_TEARDROPS::TransferDataFromWindow().
|
friend |
Definition at line 98 of file teardrop.h.
|
private |
Definition at line 240 of file teardrop.h.
Referenced by AddTeardropsOnTracks(), areItemsInSameZone(), buildTrackCaches(), createTeardrop(), DeleteTrackToTrackTeardrops(), RemoveTeardrops(), TEARDROP_MANAGER(), and UpdateTeardrops().
|
private |
Definition at line 246 of file teardrop.h.
Referenced by AddTeardropsOnTracks(), setTeardropPriorities(), and UpdateTeardrops().
|
private |
Definition at line 242 of file teardrop.h.
Referenced by AddTeardropsOnTracks(), TEARDROP_MANAGER(), and UpdateTeardrops().
|
private |
Definition at line 238 of file teardrop.h.
Referenced by AddTeardropsOnTracks(), TEARDROP_MANAGER(), and UpdateTeardrops().
|
private |
Definition at line 241 of file teardrop.h.
|
private |
Definition at line 245 of file teardrop.h.
Referenced by AddTeardropsOnTracks(), and buildTrackCaches().
|
private |
Definition at line 244 of file teardrop.h.
Referenced by buildTrackCaches(), and findTouchingTrack().