KiCad PCB EDA Suite
|
A graph with nodes and connections for creepage calculation. More...
#include <drc_creepage_utils.h>
Public Member Functions | |
CreepageGraph (BOARD &aBoard) | |
~CreepageGraph () | |
void | TransformEdgeToCreepShapes () |
void | TransformCreepShapesToNodes (std::vector< CREEP_SHAPE * > &aShapes) |
void | RemoveDuplicatedShapes () |
std::shared_ptr< GraphNode > | AddNode (GraphNode::TYPE aType, CREEP_SHAPE *aParent=nullptr, VECTOR2I aPos=VECTOR2I()) |
std::shared_ptr< GraphNode > | AddNodeVirtual () |
std::shared_ptr< GraphConnection > | AddConnection (std::shared_ptr< GraphNode > &aN1, std::shared_ptr< GraphNode > &aN2, const PATH_CONNECTION &aPc) |
std::shared_ptr< GraphConnection > | AddConnection (std::shared_ptr< GraphNode > &aN1, std::shared_ptr< GraphNode > &aN2) |
std::shared_ptr< GraphNode > | FindNode (GraphNode::TYPE aType, CREEP_SHAPE *aParent, VECTOR2I aPos) |
void | RemoveConnection (std::shared_ptr< GraphConnection >, bool aDelete=false) |
void | Trim (double aWeightLimit) |
void | Addshape (const SHAPE &aShape, std::shared_ptr< GraphNode > &aConnectTo, BOARD_ITEM *aParent=nullptr) |
double | Solve (std::shared_ptr< GraphNode > &aFrom, std::shared_ptr< GraphNode > &aTo, std::vector< std::shared_ptr< GraphConnection > > &aResult) |
void | GeneratePaths (double aMaxWeight, PCB_LAYER_ID aLayer, bool aGenerateBoardEdges=true) |
std::shared_ptr< GraphNode > | 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< GraphNode > > | m_nodes |
std::vector< std::shared_ptr< GraphConnection > > | m_connections |
int | m_minGrooveWidth = 0 |
std::vector< CREEP_SHAPE * > | m_shapeCollection |
Private Attributes | |
double | m_creepageTarget |
double | m_creepageTargetSquared |
A graph with nodes and connections for creepage calculation.
Definition at line 657 of file drc_creepage_utils.h.
|
inline |
Definition at line 660 of file drc_creepage_utils.h.
References m_boardOutline, m_creepageTarget, and m_creepageTargetSquared.
|
inline |
Definition at line 666 of file drc_creepage_utils.h.
References m_shapeCollection.
std::shared_ptr< GraphConnection > CreepageGraph::AddConnection | ( | std::shared_ptr< GraphNode > & | aN1, |
std::shared_ptr< GraphNode > & | aN2 | ||
) |
Definition at line 2465 of file drc_creepage_utils.cpp.
References PATH_CONNECTION::a1, PATH_CONNECTION::a2, AddConnection(), and PATH_CONNECTION::weight.
std::shared_ptr< GraphConnection > CreepageGraph::AddConnection | ( | std::shared_ptr< GraphNode > & | aN1, |
std::shared_ptr< GraphNode > & | aN2, | ||
const PATH_CONNECTION & | aPc | ||
) |
Definition at line 2448 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< GraphNode > CreepageGraph::AddNetElements | ( | int | aNetCode, |
PCB_LAYER_ID | aLayer, | ||
int | aMaxCreepage | ||
) |
Definition at line 2493 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< GraphNode > CreepageGraph::AddNode | ( | GraphNode::TYPE | aType, |
CREEP_SHAPE * | aParent = nullptr , |
||
VECTOR2I | aPos = VECTOR2I() |
||
) |
Definition at line 2426 of file drc_creepage_utils.cpp.
References FindNode(), and m_nodes.
Referenced by Addshape(), GeneratePaths(), BE_SHAPE_CIRCLE::ShortenChildDueToGV(), and TransformCreepShapesToNodes().
std::shared_ptr< GraphNode > CreepageGraph::AddNodeVirtual | ( | ) |
Definition at line 2438 of file drc_creepage_utils.cpp.
References m_nodes.
Referenced by AddNetElements(), and DRC_TEST_PROVIDER_CLEARANCE_BASE::ReportAndShowPathCuToCu().
void CreepageGraph::Addshape | ( | const SHAPE & | aShape, |
std::shared_ptr< GraphNode > & | aConnectTo, | ||
BOARD_ITEM * | aParent = nullptr |
||
) |
Definition at line 2126 of file drc_creepage_utils.cpp.
References SEG::A, AddConnection(), AddNode(), Addshape(), GraphNode::ARC, SEG::B, EDA_SHAPE::CalcArcAngles(), GraphNode::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, GraphNode::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< GraphNode > CreepageGraph::FindNode | ( | GraphNode::TYPE | aType, |
CREEP_SHAPE * | aParent, | ||
VECTOR2I | aPos | ||
) |
Definition at line 2479 of file drc_creepage_utils.cpp.
References m_nodes, and CREEP_SHAPE::m_parent.
Referenced by AddNode().
void CreepageGraph::GeneratePaths | ( | double | aMaxWeight, |
PCB_LAYER_ID | aLayer, | ||
bool | aGenerateBoardEdges = true |
||
) |
Definition at line 2269 of file drc_creepage_utils.cpp.
References AddConnection(), AddNode(), GetPaths(), m_board, m_boardEdge, m_boardOutline, m_minGrooveWidth, m_nodes, and GraphNode::POINT.
Referenced by DRC_TEST_PROVIDER_CLEARANCE_BASE::ReportAndShowPathCuToCu(), and DRC_TEST_PROVIDER_CREEPAGE::testCreepage().
|
inline |
Definition at line 712 of file drc_creepage_utils.h.
References m_creepageTarget.
Referenced by BE_SHAPE_CIRCLE::ConnectChildren(), and BE_SHAPE_ARC::ConnectChildren().
void CreepageGraph::RemoveConnection | ( | std::shared_ptr< GraphConnection > | aGc, |
bool | aDelete = false |
||
) |
Definition at line 2390 of file drc_creepage_utils.cpp.
References m_connections, and m_nodes.
Referenced by Trim().
void CreepageGraph::RemoveDuplicatedShapes | ( | ) |
Definition at line 487 of file drc_creepage_utils.cpp.
References areEquivalent(), compareShapes(), and m_shapeCollection.
Referenced by DRC_TEST_PROVIDER_CREEPAGE::testCreepage().
void CreepageGraph::SetTarget | ( | double | aTarget | ) |
Definition at line 831 of file drc_creepage_utils.cpp.
References m_creepageTarget, and m_creepageTargetSquared.
Referenced by DRC_TEST_PROVIDER_CREEPAGE::testCreepage().
double CreepageGraph::Solve | ( | std::shared_ptr< GraphNode > & | aFrom, |
std::shared_ptr< GraphNode > & | aTo, | ||
std::vector< std::shared_ptr< GraphConnection > > & | aResult | ||
) |
Definition at line 2033 of file drc_creepage_utils.cpp.
References left, GraphNode::m_connections, m_nodes, and right.
Referenced by DRC_TEST_PROVIDER_CREEPAGE::testCreepage().
void CreepageGraph::TransformCreepShapesToNodes | ( | std::vector< CREEP_SHAPE * > & | aShapes | ) |
Definition at line 470 of file drc_creepage_utils.cpp.
References AddNode().
Referenced by DRC_TEST_PROVIDER_CREEPAGE::testCreepage().
void CreepageGraph::TransformEdgeToCreepShapes | ( | ) |
Definition at line 517 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 CreepageGraph::Trim | ( | double | aWeightLimit | ) |
Definition at line 2370 of file drc_creepage_utils.cpp.
References m_connections, and RemoveConnection().
BOARD& CreepageGraph::m_board |
Definition at line 676 of file drc_creepage_utils.h.
Referenced by AddNetElements(), and GeneratePaths().
std::vector<BOARD_ITEM*> CreepageGraph::m_boardEdge |
Definition at line 677 of file drc_creepage_utils.h.
Referenced by GeneratePaths(), DRC_TEST_PROVIDER_CREEPAGE::testCreepage(), and TransformEdgeToCreepShapes().
SHAPE_POLY_SET* CreepageGraph::m_boardOutline |
Definition at line 678 of file drc_creepage_utils.h.
Referenced by CreepageGraph(), GeneratePaths(), and DRC_TEST_PROVIDER_CREEPAGE::testCreepage().
std::vector<std::shared_ptr<GraphConnection> > CreepageGraph::m_connections |
Definition at line 681 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 718 of file drc_creepage_utils.h.
Referenced by CreepageGraph(), GetTarget(), and SetTarget().
|
private |
Definition at line 719 of file drc_creepage_utils.h.
Referenced by CreepageGraph(), and SetTarget().
int CreepageGraph::m_minGrooveWidth = 0 |
Definition at line 713 of file drc_creepage_utils.h.
Referenced by BE_SHAPE_CIRCLE::ConnectChildren(), BE_SHAPE_ARC::ConnectChildren(), GeneratePaths(), BE_SHAPE_CIRCLE::ShortenChildDueToGV(), and DRC_TEST_PROVIDER_CREEPAGE::testCreepage().
std::vector<std::shared_ptr<GraphNode> > CreepageGraph::m_nodes |
Definition at line 680 of file drc_creepage_utils.h.
Referenced by AddNode(), AddNodeVirtual(), FindNode(), GeneratePaths(), RemoveConnection(), Solve(), and DRC_TEST_PROVIDER_CREEPAGE::testCreepage().
std::vector<CREEP_SHAPE*> CreepageGraph::m_shapeCollection |
Definition at line 715 of file drc_creepage_utils.h.
Referenced by Addshape(), RemoveDuplicatedShapes(), DRC_TEST_PROVIDER_CREEPAGE::testCreepage(), TransformEdgeToCreepShapes(), and ~CreepageGraph().