KiCad PCB EDA Suite
|
A graph with nodes and connections for creepage calculation. More...
#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, const 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, const VECTOR2I &aPos) |
void | RemoveConnection (const 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) |
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 |
A graph with nodes and connections for creepage calculation.
Definition at line 697 of file drc_creepage_utils.h.
|
inline |
Definition at line 700 of file drc_creepage_utils.h.
References m_board, m_boardOutline, m_creepageTarget, m_creepageTargetSquared, and m_minGrooveWidth.
|
inline |
Definition at line 709 of file drc_creepage_utils.h.
References m_connections, m_nodes, and 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 2428 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 2410 of file drc_creepage_utils.cpp.
References m_connections.
Referenced by AddConnection(), Addshape(), BE_SHAPE_ARC::ConnectChildren(), BE_SHAPE_CIRCLE::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 2455 of file drc_creepage_utils.cpp.
References AddNodeVirtual(), Addshape(), BOARD_ITEM::GetEffectiveShape(), BOARD_CONNECTED_ITEM::GetNetCode(), BOARD_ITEM::IsOnLayer(), m_board, and pad.
Referenced by DRC_TEST_PROVIDER_CREEPAGE::testCreepage().
std::shared_ptr< GRAPH_NODE > CREEPAGE_GRAPH::AddNode | ( | GRAPH_NODE::TYPE | aType, |
CREEP_SHAPE * | aParent = nullptr, | ||
const VECTOR2I & | aPos = VECTOR2I() ) |
Definition at line 2385 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 2400 of file drc_creepage_utils.cpp.
References m_nodes, and m_nodeset.
Referenced by AddNetElements().
void CREEPAGE_GRAPH::Addshape | ( | const SHAPE & | aShape, |
std::shared_ptr< GRAPH_NODE > & | aConnectTo, | ||
BOARD_ITEM * | aParent = nullptr ) |
Definition at line 2032 of file drc_creepage_utils.cpp.
References SEG::A, AddConnection(), AddNode(), Addshape(), GRAPH_NODE::ARC, ARC, SEG::B, EDA_SHAPE::CalcArcAngles(), GRAPH_NODE::CIRCLE, circle(), SHAPE_POLY_SET::CIterateSegmentsWithHoles(), SHAPE_LINE_CHAIN::CLastPoint(), SHAPE_LINE_CHAIN::CPoints(), end, SHAPE_ARC::GetArcMid(), EDA_SHAPE::getCenter(), SHAPE_ARC::GetP0(), SHAPE_ARC::GetP1(), CREEP_SHAPE::GetPos(), SHAPE_RECT::GetPosition(), EDA_SHAPE::GetRadius(), SHAPE_SEGMENT::GetSeg(), SHAPE_RECT::GetSize(), SHAPE_ARC::GetWidth(), SHAPE_SEGMENT::GetWidth(), SHAPE_ARC::IsClockwise(), m_shapeCollection, NO_FILL, 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_BASE::Type(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by AddNetElements(), and Addshape().
std::shared_ptr< GRAPH_NODE > CREEPAGE_GRAPH::FindNode | ( | GRAPH_NODE::TYPE | aType, |
CREEP_SHAPE * | aParent, | ||
const VECTOR2I & | aPos ) |
Definition at line 2443 of file drc_creepage_utils.cpp.
References m_nodeset.
Referenced by AddNode().
void CREEPAGE_GRAPH::GeneratePaths | ( | double | aMaxWeight, |
PCB_LAYER_ID | aLayer ) |
Definition at line 2176 of file drc_creepage_utils.cpp.
References AddConnection(), AddNode(), empty(), GetKiCadThreadPool(), GetPaths(), m_board, m_boardEdge, m_boardOutline, m_minGrooveWidth, m_nodes, GRAPH_NODE::POINT, and tp.
Referenced by DRC_TEST_PROVIDER_CREEPAGE::testCreepage(), and DRC_TEST_PROVIDER_CREEPAGE::testCreepage().
|
inline |
Definition at line 772 of file drc_creepage_utils.h.
References m_creepageTarget.
Referenced by BE_SHAPE_ARC::ConnectChildren(), and BE_SHAPE_CIRCLE::ConnectChildren().
void CREEPAGE_GRAPH::RemoveConnection | ( | const std::shared_ptr< GRAPH_CONNECTION > & | aGc, |
bool | aDelete = false ) |
Definition at line 2349 of file drc_creepage_utils.cpp.
References m_connections, m_nodes, and m_nodeset.
Referenced by Trim().
void CREEPAGE_GRAPH::RemoveDuplicatedShapes | ( | ) |
Definition at line 482 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 793 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 1931 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 465 of file drc_creepage_utils.cpp.
References AddNode().
Referenced by DRC_TEST_PROVIDER_CREEPAGE::testCreepage().
void CREEPAGE_GRAPH::TransformEdgeToCreepShapes | ( | ) |
Definition at line 512 of file drc_creepage_utils.cpp.
References ARC, EDA_SHAPE::CalcArcAngles(), center, CIRCLE, 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, POLY, RECTANGLE, SEGMENT, 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 2332 of file drc_creepage_utils.cpp.
References m_connections, and RemoveConnection().
BOARD& CREEPAGE_GRAPH::m_board |
Definition at line 791 of file drc_creepage_utils.h.
Referenced by AddNetElements(), CREEPAGE_GRAPH(), and GeneratePaths().
std::vector<BOARD_ITEM*> CREEPAGE_GRAPH::m_boardEdge |
Definition at line 792 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 793 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 795 of file drc_creepage_utils.h.
Referenced by AddConnection(), RemoveConnection(), DRC_TEST_PROVIDER_CREEPAGE::testCreepage(), Trim(), and ~CREEPAGE_GRAPH().
|
private |
Definition at line 804 of file drc_creepage_utils.h.
Referenced by CREEPAGE_GRAPH(), GetTarget(), and SetTarget().
|
private |
Definition at line 805 of file drc_creepage_utils.h.
Referenced by CREEPAGE_GRAPH(), and SetTarget().
int CREEPAGE_GRAPH::m_minGrooveWidth |
Definition at line 801 of file drc_creepage_utils.h.
Referenced by BE_SHAPE_ARC::ConnectChildren(), BE_SHAPE_CIRCLE::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 794 of file drc_creepage_utils.h.
Referenced by AddNode(), AddNodeVirtual(), GeneratePaths(), RemoveConnection(), Solve(), DRC_TEST_PROVIDER_CREEPAGE::testCreepage(), DRC_TEST_PROVIDER_CREEPAGE::testCreepage(), and ~CREEPAGE_GRAPH().
std::unordered_set<std::shared_ptr<GRAPH_NODE>, GraphNodeHash, GraphNodeEqual> CREEPAGE_GRAPH::m_nodeset |
Definition at line 799 of file drc_creepage_utils.h.
Referenced by AddNode(), AddNodeVirtual(), FindNode(), and RemoveConnection().
std::vector<CREEP_SHAPE*> CREEPAGE_GRAPH::m_shapeCollection |
Definition at line 796 of file drc_creepage_utils.h.
Referenced by Addshape(), RemoveDuplicatedShapes(), DRC_TEST_PROVIDER_CREEPAGE::testCreepage(), TransformEdgeToCreepShapes(), and ~CREEPAGE_GRAPH().