KiCad PCB EDA Suite
|
#include <drc_creepage_utils.h>
Classes | |
struct | GraphNodeEqual |
struct | GraphNodeHash |
Public Member Functions | |
CREEPAGE_GRAPH (BOARD &aBoard) | |
~CREEPAGE_GRAPH () | |
void | TransformEdgeToCreepShapes () |
void | TransformCreepShapesToNodes (std::vector< CREEP_SHAPE * > &aShapes) |
void | RemoveDuplicatedShapes () |
std::shared_ptr< GRAPH_NODE > | AddNode (GRAPH_NODE::TYPE aType, CREEP_SHAPE *aParent=nullptr, VECTOR2I aPos=VECTOR2I()) |
std::shared_ptr< GRAPH_NODE > | AddNodeVirtual () |
std::shared_ptr< GRAPH_CONNECTION > | AddConnection (std::shared_ptr< GRAPH_NODE > &aN1, std::shared_ptr< GRAPH_NODE > &aN2, const PATH_CONNECTION &aPc) |
std::shared_ptr< GRAPH_CONNECTION > | AddConnection (std::shared_ptr< GRAPH_NODE > &aN1, std::shared_ptr< GRAPH_NODE > &aN2) |
std::shared_ptr< GRAPH_NODE > | FindNode (GRAPH_NODE::TYPE aType, CREEP_SHAPE *aParent, VECTOR2I aPos) |
void | RemoveConnection (std::shared_ptr< GRAPH_CONNECTION >, bool aDelete=false) |
void | Trim (double aWeightLimit) |
void | Addshape (const SHAPE &aShape, std::shared_ptr< GRAPH_NODE > &aConnectTo, BOARD_ITEM *aParent=nullptr) |
double | Solve (std::shared_ptr< GRAPH_NODE > &aFrom, std::shared_ptr< GRAPH_NODE > &aTo, std::vector< std::shared_ptr< GRAPH_CONNECTION > > &aResult) |
void | GeneratePaths (double aMaxWeight, PCB_LAYER_ID aLayer, bool aClearance) |
std::shared_ptr< GRAPH_NODE > | AddNetElements (int aNetCode, PCB_LAYER_ID aLayer, int aMaxCreepage) |
void | SetTarget (double aTarget) |
double | GetTarget () |
Public Attributes | |
BOARD & | m_board |
std::vector< BOARD_ITEM * > | m_boardEdge |
SHAPE_POLY_SET * | m_boardOutline |
std::vector< std::shared_ptr< GRAPH_NODE > > | m_nodes |
std::vector< std::shared_ptr< GRAPH_CONNECTION > > | m_connections |
std::vector< CREEP_SHAPE * > | m_shapeCollection |
std::unordered_set< std::shared_ptr< GRAPH_NODE >, GraphNodeHash, GraphNodeEqual > | m_nodeset |
int | m_minGrooveWidth |
Private Attributes | |
double | m_creepageTarget |
double | m_creepageTargetSquared |
Definition at line 686 of file drc_creepage_utils.h.
|
inline |
Definition at line 689 of file drc_creepage_utils.h.
References m_boardOutline, m_creepageTarget, m_creepageTargetSquared, and m_minGrooveWidth.
|
inline |
Definition at line 697 of file drc_creepage_utils.h.
References m_shapeCollection.
std::shared_ptr< GRAPH_CONNECTION > CREEPAGE_GRAPH::AddConnection | ( | std::shared_ptr< GRAPH_NODE > & | aN1, |
std::shared_ptr< GRAPH_NODE > & | aN2 | ||
) |
Definition at line 2477 of file drc_creepage_utils.cpp.
References PATH_CONNECTION::a1, PATH_CONNECTION::a2, AddConnection(), and PATH_CONNECTION::weight.
std::shared_ptr< GRAPH_CONNECTION > CREEPAGE_GRAPH::AddConnection | ( | std::shared_ptr< GRAPH_NODE > & | aN1, |
std::shared_ptr< GRAPH_NODE > & | aN2, | ||
const PATH_CONNECTION & | aPc | ||
) |
Definition at line 2460 of file drc_creepage_utils.cpp.
References m_connections.
Referenced by AddConnection(), Addshape(), BE_SHAPE_CIRCLE::ConnectChildren(), BE_SHAPE_ARC::ConnectChildren(), GeneratePaths(), and BE_SHAPE_CIRCLE::ShortenChildDueToGV().
std::shared_ptr< GRAPH_NODE > CREEPAGE_GRAPH::AddNetElements | ( | int | aNetCode, |
PCB_LAYER_ID | aLayer, | ||
int | aMaxCreepage | ||
) |
Definition at line 2503 of file drc_creepage_utils.cpp.
References AddNodeVirtual(), Addshape(), BOARD::Drawings(), BOARD::Footprints(), BOARD_ITEM::GetEffectiveShape(), BOARD_CONNECTED_ITEM::GetNetCode(), BOARD_ITEM::IsOnLayer(), m_board, pad, BOARD::Tracks(), and BOARD::Zones().
Referenced by DRC_TEST_PROVIDER_CREEPAGE::testCreepage().
std::shared_ptr< GRAPH_NODE > CREEPAGE_GRAPH::AddNode | ( | GRAPH_NODE::TYPE | aType, |
CREEP_SHAPE * | aParent = nullptr , |
||
VECTOR2I | aPos = VECTOR2I() |
||
) |
Definition at line 2436 of file drc_creepage_utils.cpp.
References FindNode(), m_nodes, and m_nodeset.
Referenced by Addshape(), GeneratePaths(), BE_SHAPE_CIRCLE::ShortenChildDueToGV(), and TransformCreepShapesToNodes().
std::shared_ptr< GRAPH_NODE > CREEPAGE_GRAPH::AddNodeVirtual | ( | ) |
Definition at line 2449 of file drc_creepage_utils.cpp.
References m_nodes, and m_nodeset.
Referenced by AddNetElements(), and DRC_TEST_PROVIDER_CLEARANCE_BASE::ReportAndShowPathCuToCu().
void CREEPAGE_GRAPH::Addshape | ( | const SHAPE & | aShape, |
std::shared_ptr< GRAPH_NODE > & | aConnectTo, | ||
BOARD_ITEM * | aParent = nullptr |
||
) |
Definition at line 2128 of file drc_creepage_utils.cpp.
References SEG::A, AddConnection(), AddNode(), Addshape(), GRAPH_NODE::ARC, SEG::B, EDA_SHAPE::CalcArcAngles(), GRAPH_NODE::CIRCLE, SHAPE_POLY_SET::CIterateSegmentsWithHoles(), SHAPE_LINE_CHAIN::CLastPoint(), SHAPE_LINE_CHAIN::CPoints(), SHAPE_ARC::GetArcMid(), EDA_SHAPE::getCenter(), SHAPE_CIRCLE::GetCenter(), SHAPE_ARC::GetP0(), SHAPE_ARC::GetP1(), CREEP_SHAPE::GetPos(), SHAPE_RECT::GetPosition(), EDA_SHAPE::GetRadius(), SHAPE_CIRCLE::GetRadius(), SHAPE_SEGMENT::GetSeg(), SHAPE_RECT::GetSize(), SHAPE_ARC::GetWidth(), SHAPE_SEGMENT::GetWidth(), SHAPE_ARC::IsClockwise(), m_shapeCollection, GRAPH_NODE::SEGMENT, EDA_SHAPE::SetArcGeometry(), CREEP_SHAPE::SetParent(), CU_SHAPE_ARC::SetWidth(), SH_ARC, SH_CIRCLE, SH_COMPOUND, SH_LINE_CHAIN, SH_POLY_SET, SH_RECT, SH_SEGMENT, SHAPE_COMPOUND::Shapes(), SHAPE_BASE::Type(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by AddNetElements(), Addshape(), and DRC_TEST_PROVIDER_CLEARANCE_BASE::ReportAndShowPathCuToCu().
std::shared_ptr< GRAPH_NODE > CREEPAGE_GRAPH::FindNode | ( | GRAPH_NODE::TYPE | aType, |
CREEP_SHAPE * | aParent, | ||
VECTOR2I | aPos | ||
) |
Definition at line 2491 of file drc_creepage_utils.cpp.
References m_nodeset.
Referenced by AddNode().
void CREEPAGE_GRAPH::GeneratePaths | ( | double | aMaxWeight, |
PCB_LAYER_ID | aLayer, | ||
bool | aClearance | ||
) |
Definition at line 2271 of file drc_creepage_utils.cpp.
References AddConnection(), AddNode(), GetKiCadThreadPool(), GetPaths(), m_board, m_boardEdge, m_boardOutline, m_minGrooveWidth, m_nodes, GRAPH_NODE::POINT, and tp.
Referenced by DRC_TEST_PROVIDER_CLEARANCE_BASE::ReportAndShowPathCuToCu(), and DRC_TEST_PROVIDER_CREEPAGE::testCreepage().
|
inline |
Definition at line 744 of file drc_creepage_utils.h.
References m_creepageTarget.
Referenced by BE_SHAPE_CIRCLE::ConnectChildren(), and BE_SHAPE_ARC::ConnectChildren().
void CREEPAGE_GRAPH::RemoveConnection | ( | std::shared_ptr< GRAPH_CONNECTION > | aGc, |
bool | aDelete = false |
||
) |
Definition at line 2400 of file drc_creepage_utils.cpp.
References m_connections, m_nodes, and m_nodeset.
Referenced by Trim().
void CREEPAGE_GRAPH::RemoveDuplicatedShapes | ( | ) |
Definition at line 488 of file drc_creepage_utils.cpp.
References areEquivalent(), compareShapes(), and m_shapeCollection.
Referenced by DRC_TEST_PROVIDER_CREEPAGE::testCreepage().
void CREEPAGE_GRAPH::SetTarget | ( | double | aTarget | ) |
Definition at line 832 of file drc_creepage_utils.cpp.
References m_creepageTarget, and m_creepageTargetSquared.
Referenced by DRC_TEST_PROVIDER_CREEPAGE::testCreepage().
double CREEPAGE_GRAPH::Solve | ( | std::shared_ptr< GRAPH_NODE > & | aFrom, |
std::shared_ptr< GRAPH_NODE > & | aTo, | ||
std::vector< std::shared_ptr< GRAPH_CONNECTION > > & | aResult | ||
) |
Definition at line 2034 of file drc_creepage_utils.cpp.
References left, GRAPH_NODE::m_node_conns, m_nodes, and right.
Referenced by DRC_TEST_PROVIDER_CREEPAGE::testCreepage().
void CREEPAGE_GRAPH::TransformCreepShapesToNodes | ( | std::vector< CREEP_SHAPE * > & | aShapes | ) |
Definition at line 471 of file drc_creepage_utils.cpp.
References AddNode().
Referenced by DRC_TEST_PROVIDER_CREEPAGE::testCreepage().
void CREEPAGE_GRAPH::TransformEdgeToCreepShapes | ( | ) |
Definition at line 518 of file drc_creepage_utils.cpp.
References EDA_SHAPE::CalcArcAngles(), EDA_SHAPE::DupPolyPointsList(), EDA_SHAPE::GetArcMid(), PCB_SHAPE::GetCenter(), EDA_SHAPE::GetEnd(), EDA_SHAPE::GetRadius(), EDA_SHAPE::GetShape(), EDA_SHAPE::GetStart(), m_boardEdge, m_shapeCollection, CREEP_SHAPE::SetParent(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by DRC_TEST_PROVIDER_CREEPAGE::testCreepage().
void CREEPAGE_GRAPH::Trim | ( | double | aWeightLimit | ) |
Definition at line 2380 of file drc_creepage_utils.cpp.
References m_connections, and RemoveConnection().
BOARD& CREEPAGE_GRAPH::m_board |
Definition at line 763 of file drc_creepage_utils.h.
Referenced by AddNetElements(), and GeneratePaths().
std::vector<BOARD_ITEM*> CREEPAGE_GRAPH::m_boardEdge |
Definition at line 764 of file drc_creepage_utils.h.
Referenced by GeneratePaths(), DRC_TEST_PROVIDER_CREEPAGE::testCreepage(), and TransformEdgeToCreepShapes().
SHAPE_POLY_SET* CREEPAGE_GRAPH::m_boardOutline |
Definition at line 765 of file drc_creepage_utils.h.
Referenced by CREEPAGE_GRAPH(), GeneratePaths(), and DRC_TEST_PROVIDER_CREEPAGE::testCreepage().
std::vector<std::shared_ptr<GRAPH_CONNECTION> > CREEPAGE_GRAPH::m_connections |
Definition at line 767 of file drc_creepage_utils.h.
Referenced by AddConnection(), RemoveConnection(), DRC_TEST_PROVIDER_CLEARANCE_BASE::ReportAndShowPathCuToCu(), DRC_TEST_PROVIDER_CREEPAGE::testCreepage(), and Trim().
|
private |
Definition at line 776 of file drc_creepage_utils.h.
Referenced by CREEPAGE_GRAPH(), GetTarget(), and SetTarget().
|
private |
Definition at line 777 of file drc_creepage_utils.h.
Referenced by CREEPAGE_GRAPH(), and SetTarget().
int CREEPAGE_GRAPH::m_minGrooveWidth |
Definition at line 773 of file drc_creepage_utils.h.
Referenced by BE_SHAPE_CIRCLE::ConnectChildren(), BE_SHAPE_ARC::ConnectChildren(), CREEPAGE_GRAPH(), GeneratePaths(), BE_SHAPE_CIRCLE::ShortenChildDueToGV(), and DRC_TEST_PROVIDER_CREEPAGE::testCreepage().
std::vector<std::shared_ptr<GRAPH_NODE> > CREEPAGE_GRAPH::m_nodes |
Definition at line 766 of file drc_creepage_utils.h.
Referenced by AddNode(), AddNodeVirtual(), GeneratePaths(), RemoveConnection(), Solve(), and DRC_TEST_PROVIDER_CREEPAGE::testCreepage().
std::unordered_set<std::shared_ptr<GRAPH_NODE>, GraphNodeHash, GraphNodeEqual> CREEPAGE_GRAPH::m_nodeset |
Definition at line 771 of file drc_creepage_utils.h.
Referenced by AddNode(), AddNodeVirtual(), FindNode(), and RemoveConnection().
std::vector<CREEP_SHAPE*> CREEPAGE_GRAPH::m_shapeCollection |
Definition at line 768 of file drc_creepage_utils.h.
Referenced by Addshape(), RemoveDuplicatedShapes(), DRC_TEST_PROVIDER_CREEPAGE::testCreepage(), TransformEdgeToCreepShapes(), and ~CREEPAGE_GRAPH().