KiCad PCB EDA Suite
Loading...
Searching...
No Matches
SCH_IO_WIRE_DETOUR Class Reference

Keeps wires of one net from touching pins, junctions and wire ends of other nets on import. More...

#include <sch_io_wire_detour.h>

Classes

struct  CONTACT
 
struct  RESULT
 
struct  WIRE
 

Public Member Functions

int AnonymousNet ()
 
void AddWire (const SEG &aWire, int aNet)
 Register a wire as an obstacle for the wires of other nets.
 
void AddContact (const VECTOR2I &aPos, int aNet)
 Register a pin or junction.
 
RESULT Route (const SEG &aWire, int aNet)
 Detour a wire around foreign items lying on it and register the result as the wire's geometry.
 
bool TouchesOtherNet (const VECTOR2I &aPos, int aNet) const
 

Private Member Functions

std::vector< CONTACT > contacts () const
 
bool joinsOtherNet (const SEG &aPiece, const SEG &aWire, int aNet, const std::vector< CONTACT > &aContacts) const
 True if a detour piece would join another net.
 
std::vector< SEG > detour (const SEG &aWire, const VECTOR2I &aEnter, const VECTOR2I &aLeave, int aNet, const std::vector< CONTACT > &aContacts) const
 Detour the stretch of a wire between two points, or an empty vector if there is no safe place for it.
 

Private Attributes

std::vector< WIRE > m_wires
 
std::vector< CONTACT > m_contacts
 
int m_anonymousNets = 0
 

Detailed Description

Keeps wires of one net from touching pins, junctions and wire ends of other nets on import.

Other EDA tools join a pin or wire end to a wire only where the file says so, whereas a pin or wire end lying on a wire always joins it here. The importer describes one sheet with plain geometry and an opaque net identity per item, then asks for each wire to be replaced by a detour around the foreign items lying on it.

Definition at line 34 of file sch_io_wire_detour.h.

Member Function Documentation

◆ AddContact()

void SCH_IO_WIRE_DETOUR::AddContact ( const VECTOR2I & aPos,
int aNet )

Register a pin or junction.

Definition at line 41 of file sch_io_wire_detour.cpp.

References m_contacts.

Referenced by SCH_IO_EAGLE::collectSheetWiring().

◆ AddWire()

void SCH_IO_WIRE_DETOUR::AddWire ( const SEG & aWire,
int aNet )

Register a wire as an obstacle for the wires of other nets.

Definition at line 35 of file sch_io_wire_detour.cpp.

References m_wires.

Referenced by SCH_IO_EAGLE::collectSheetWiring(), and Route().

◆ AnonymousNet()

int SCH_IO_WIRE_DETOUR::AnonymousNet ( )
inline
Returns
a net identity that no other item shares, for an item that belongs to no net.

Definition at line 49 of file sch_io_wire_detour.h.

References m_anonymousNets.

Referenced by SCH_IO_EAGLE::collectSheetWiring().

◆ contacts()

std::vector< SCH_IO_WIRE_DETOUR::CONTACT > SCH_IO_WIRE_DETOUR::contacts ( ) const
private

Definition at line 47 of file sch_io_wire_detour.cpp.

References m_contacts, and m_wires.

Referenced by Route(), and TouchesOtherNet().

◆ detour()

std::vector< SEG > SCH_IO_WIRE_DETOUR::detour ( const SEG & aWire,
const VECTOR2I & aEnter,
const VECTOR2I & aLeave,
int aNet,
const std::vector< CONTACT > & aContacts ) const
private

Detour the stretch of a wire between two points, or an empty vector if there is no safe place for it.

Definition at line 104 of file sch_io_wire_detour.cpp.

References SEG::A, SEG::B, joinsOtherNet(), m_wires, normal, and schIUScale.

Referenced by Route().

◆ joinsOtherNet()

bool SCH_IO_WIRE_DETOUR::joinsOtherNet ( const SEG & aPiece,
const SEG & aWire,
int aNet,
const std::vector< CONTACT > & aContacts ) const
private

True if a detour piece would join another net.

Definition at line 73 of file sch_io_wire_detour.cpp.

References SEG::A, SEG::B, SEG::Contains(), and m_wires.

Referenced by detour().

◆ Route()

SCH_IO_WIRE_DETOUR::RESULT SCH_IO_WIRE_DETOUR::Route ( const SEG & aWire,
int aNet )

Detour a wire around foreign items lying on it and register the result as the wire's geometry.

Wire ends count as items. A detour never lands on another net's item or wire, and is not made where a branch of the same net joins the replaced stretch.

Definition at line 162 of file sch_io_wire_detour.cpp.

References SEG::A, AddWire(), SEG::B, contacts(), detour(), m_wires, SCH_IO_WIRE_DETOUR::WIRE::Net, path, VECTOR2< T >::Resize(), result, schIUScale, SCH_IO_WIRE_DETOUR::WIRE::Seg, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), and SCH_IO_EAGLE::loadSegments().

◆ TouchesOtherNet()

bool SCH_IO_WIRE_DETOUR::TouchesOtherNet ( const VECTOR2I & aPos,
int aNet ) const
Returns
true if a pin, junction or wire end of another net sits exactly at a point.

Definition at line 61 of file sch_io_wire_detour.cpp.

References contacts().

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::loadNets().

Member Data Documentation

◆ m_anonymousNets

int SCH_IO_WIRE_DETOUR::m_anonymousNets = 0
private

Definition at line 98 of file sch_io_wire_detour.h.

Referenced by AnonymousNet().

◆ m_contacts

std::vector<CONTACT> SCH_IO_WIRE_DETOUR::m_contacts
private

Definition at line 97 of file sch_io_wire_detour.h.

Referenced by AddContact(), and contacts().

◆ m_wires

std::vector<WIRE> SCH_IO_WIRE_DETOUR::m_wires
private

Definition at line 96 of file sch_io_wire_detour.h.

Referenced by AddWire(), contacts(), detour(), joinsOtherNet(), and Route().


The documentation for this class was generated from the following files: