44#define PIN_TEXT_MARGIN 4
77 m_position( { 0, 0 } ),
86 m_layoutCache( std::make_unique<PIN_LAYOUT_CACHE>( *
this ) )
101 int aNameTextSize,
int aNumTextSize,
int aBodyStyle,
const VECTOR2I& aPos,
107 m_orientation( aOrientation ),
111 m_numTextSize( aNumTextSize ),
112 m_nameTextSize( aNameTextSize ),
113 m_isDangling( true ),
129 m_isDangling( true ),
132 wxASSERT( aParentSymbol );
143 const KIID& aUuid ) :
151 m_isDangling( true ),
154 wxASSERT( aParentSymbol );
163 m_libPin( aPin.m_libPin ),
164 m_alternates( aPin.m_alternates ),
165 m_position( aPin.m_position ),
166 m_length( aPin.m_length ),
167 m_orientation( aPin.m_orientation ),
168 m_shape( aPin.m_shape ),
169 m_type( aPin.m_type ),
170 m_hidden( aPin.m_hidden ),
171 m_numTextSize( aPin.m_numTextSize ),
172 m_nameTextSize( aPin.m_nameTextSize ),
174 m_isDangling( aPin.m_isDangling ),
215 return symbol->GetTransform().TransformCoordinate(
m_position ) + symbol->GetPosition();
225 return PIN_ORIENTATION::PIN_RIGHT;
236 if( !
m_alt.IsEmpty() )
239 return GRAPHIC_PINSHAPE::LINE;
243 else if(
m_shape == GRAPHIC_PINSHAPE::INHERIT )
246 return GRAPHIC_PINSHAPE::LINE;
271 if( !
m_alt.IsEmpty() )
274 return ELECTRICAL_PINTYPE::PT_UNSPECIFIED;
278 else if(
m_type == ELECTRICAL_PINTYPE::PT_INHERIT )
281 return ELECTRICAL_PINTYPE::PT_UNSPECIFIED;
301 if(
m_type != ELECTRICAL_PINTYPE::PT_INHERIT )
302 return ::GetCanonicalElectricalTypeName(
m_type );
305 return ::GetCanonicalElectricalTypeName( ELECTRICAL_PINTYPE::PT_UNSPECIFIED );
313 if(
m_type != ELECTRICAL_PINTYPE::PT_INHERIT )
325 return GetType() == ELECTRICAL_PINTYPE::PT_POWER_IN
332 return GetType() == ELECTRICAL_PINTYPE::PT_POWER_IN
359 if( !
m_alt.IsEmpty() )
383 m_name.Replace( wxT(
" " ), wxT(
"_" ) );
396 m_alt = wxEmptyString;
402 wxFAIL_MSG( wxString::Format( wxS(
"Pin '%s' has no corresponding lib_pin" ),
m_number ) );
403 m_alt = wxEmptyString;
409 wxFAIL_MSG( wxString::Format( wxS(
"Pin '%s' has no alterate '%s'" ),
m_number, aAlt ) );
410 m_alt = wxEmptyString;
419 if(
GetType() == ELECTRICAL_PINTYPE::PT_NC ||
GetType() == ELECTRICAL_PINTYPE::PT_NIC )
434 bool isConnectableType_a =
GetType() == ELECTRICAL_PINTYPE::PT_PASSIVE
435 ||
GetType() == ELECTRICAL_PINTYPE::PT_NIC;
436 bool isConnectableType_b = aPin->
GetType() == ELECTRICAL_PINTYPE::PT_PASSIVE
437 || aPin->
GetType() == ELECTRICAL_PINTYPE::PT_NIC;
442 && (
GetType() == aPin->
GetType() || isConnectableType_a || isConnectableType_b );
475 bool isReplaced =
false;
499 aAccuracy = std::max( aAccuracy,
Schematic()->Settings().m_PinSymbolSize / 4 );
526 if( !
m_alt.IsEmpty() )
548 m_number.Replace( wxT(
" " ), wxT(
"_" ) );
606 const TRANSFORM& t = symbol->GetTransform();
628 int MapX1, MapY1, x1, y1;
635 if( bg == COLOR4D::UNSPECIFIED || !aPlotter->
GetColorMode() )
648 x1 = aPosition.
x; y1 = aPosition.
y;
650 switch( aOrientation )
652 case PIN_ORIENTATION::PIN_UP: y1 = aPosition.
y - pinLength; MapY1 = 1;
break;
653 case PIN_ORIENTATION::PIN_DOWN: y1 = aPosition.
y + pinLength; MapY1 = -1;
break;
654 case PIN_ORIENTATION::PIN_LEFT: x1 = aPosition.
x - pinLength; MapX1 = 1;
break;
655 case PIN_ORIENTATION::PIN_RIGHT: x1 = aPosition.
x + pinLength; MapX1 = -1;
break;
656 case PIN_ORIENTATION::INHERIT: wxFAIL_MSG( wxS(
"aOrientation must be resolved!" ) );
break;
659 if(
m_shape == GRAPHIC_PINSHAPE::INVERTED ||
m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK )
663 FILL_T::NO_FILL, penWidth );
668 else if(
m_shape == GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK )
684 aPlotter->
MoveTo(
VECTOR2I( MapX1 * deco_size * 2 + x1, MapY1 * deco_size * 2 + y1 ) );
693 if(
m_shape == GRAPHIC_PINSHAPE::CLOCK
694 ||
m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK
695 ||
m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW )
712 if(
m_shape == GRAPHIC_PINSHAPE::INPUT_LOW
713 ||
m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW )
720 aPlotter->
LineTo(
VECTOR2I( x1 + MapX1 * deco_size * 2, y1 - deco_size * 2 ) );
726 aPlotter->
LineTo(
VECTOR2I( x1 - deco_size * 2, y1 + MapY1 * deco_size * 2 ) );
731 if(
m_shape == GRAPHIC_PINSHAPE::OUTPUT_LOW )
746 else if(
m_shape == GRAPHIC_PINSHAPE::NONLOGIC )
750 y1 - ( MapY1 - MapX1 ) * deco_size ) );
752 y1 + ( MapY1 - MapX1 ) * deco_size ) );
754 y1 - ( MapY1 + MapX1 ) * deco_size ) );
756 y1 + ( MapY1 + MapX1 ) * deco_size ) );
759 if(
m_type == ELECTRICAL_PINTYPE::PT_NC )
762 const int ex1 = aPosition.
x;
763 const int ey1 = aPosition.
y;
773 int aTextInside,
bool aDrawPinNum,
bool aDrawPinName,
782 aDrawPinName =
false;
787 if( !aDrawPinNum && !aDrawPinName )
800 if( bg == COLOR4D::UNSPECIFIED || !aPlotter->
GetColorMode() )
807 nameColor = nameColor.
Mix( bg, 0.5f );
808 numColor = numColor.
Mix( bg, 0.5f );
816 case PIN_ORIENTATION::PIN_UP: y1 -=
GetLength();
break;
817 case PIN_ORIENTATION::PIN_DOWN: y1 +=
GetLength();
break;
818 case PIN_ORIENTATION::PIN_LEFT: x1 -=
GetLength();
break;
819 case PIN_ORIENTATION::PIN_RIGHT: x1 +=
GetLength();
break;
820 case PIN_ORIENTATION::INHERIT: wxFAIL_MSG( wxS(
"aPinOrient must be resolved!" ) );
break;
858 if( ( aPinOrient == PIN_ORIENTATION::PIN_LEFT )
859 || ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) )
863 if( aPinOrient == PIN_ORIENTATION::PIN_RIGHT )
883 if( aPinOrient == PIN_ORIENTATION::PIN_DOWN )
915 if( ( aPinOrient == PIN_ORIENTATION::PIN_LEFT )
916 || ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) )
919 if( aDrawPinName && aDrawPinNum )
927 else if( aDrawPinName )
932 else if( aDrawPinNum )
941 if( aDrawPinName && aDrawPinNum )
949 else if( aDrawPinName )
954 else if( aDrawPinNum )
972 case PIN_ORIENTATION::PIN_RIGHT:
end.
x = 1;
break;
973 case PIN_ORIENTATION::PIN_UP:
end.
y = -1;
break;
974 case PIN_ORIENTATION::PIN_DOWN:
end.
y = 1;
break;
975 case PIN_ORIENTATION::PIN_LEFT:
end.
x = -1;
break;
980 orient = PIN_ORIENTATION::PIN_UP;
985 orient = PIN_ORIENTATION::PIN_DOWN;
989 orient = PIN_ORIENTATION::PIN_RIGHT;
992 orient = PIN_ORIENTATION::PIN_LEFT;
1010 int lengthChange =
GetLength() - aLength;
1017 case PIN_ORIENTATION::PIN_RIGHT:
1018 offsetX = lengthChange;
1020 case PIN_ORIENTATION::PIN_LEFT:
1021 offsetX = -1 * lengthChange;
1023 case PIN_ORIENTATION::PIN_UP:
1024 offsetY = -1 * lengthChange;
1026 case PIN_ORIENTATION::PIN_DOWN:
1027 offsetY = lengthChange;
1091 case PIN_ORIENTATION::PIN_RIGHT:
m_orientation = PIN_ORIENTATION::PIN_UP;
break;
1092 case PIN_ORIENTATION::PIN_UP:
m_orientation = PIN_ORIENTATION::PIN_LEFT;
break;
1093 case PIN_ORIENTATION::PIN_LEFT:
m_orientation = PIN_ORIENTATION::PIN_DOWN;
break;
1094 case PIN_ORIENTATION::PIN_DOWN:
m_orientation = PIN_ORIENTATION::PIN_RIGHT;
break;
1104 case PIN_ORIENTATION::PIN_RIGHT:
m_orientation = PIN_ORIENTATION::PIN_DOWN;
break;
1105 case PIN_ORIENTATION::PIN_UP:
m_orientation = PIN_ORIENTATION::PIN_RIGHT;
break;
1106 case PIN_ORIENTATION::PIN_LEFT:
m_orientation = PIN_ORIENTATION::PIN_UP;
break;
1107 case PIN_ORIENTATION::PIN_DOWN:
m_orientation = PIN_ORIENTATION::PIN_LEFT;
break;
1121 int aUnit,
int aBodyStyle,
const VECTOR2I& aOffset,
bool aDimmed )
1146 aList.emplace_back(
_(
"Type" ),
_(
"Pin" ) );
1155 aList.emplace_back(
_(
"Visible" ),
IsVisible() ?
_(
"Yes" ) :
_(
"No" ) );
1173 aList.emplace_back( symbol->
GetRef( currentSheet ),
1174 UnescapeString( schsymbol->GetField( FIELD_T::VALUE )->GetText() ) );
1228 if( it->second.second == aForceNoConnect )
1229 return it->second.first;
1232 wxString
name =
"Net-(";
1233 bool unconnected =
false;
1235 if( aForceNoConnect ||
GetType() == ELECTRICAL_PINTYPE::PT_NC )
1238 name = (
"unconnected-(" );
1241 bool annotated =
true;
1243 std::vector<SCH_PIN*> pins = symbol->
GetPins( &aPath );
1244 bool has_multiple =
false;
1250 && unconnected == (
pin->GetType() == ELECTRICAL_PINTYPE::PT_NC ) )
1252 has_multiple =
true;
1261 if( symbol->
GetRef( &aPath,
false ).Last() ==
'?' )
1266 name <<
"-Pad" << libPinNumber <<
")";
1269 else if( !libPinShownName.IsEmpty() && ( libPinShownName != libPinShownNumber ) )
1276 if( unconnected || has_multiple )
1311 if( aCache->
m_Font == aFont
1330 bool aIncludeElectricalType )
const
1333 return m_layoutCache->GetPinBoundingBox( aIncludeLabelsOnInvisiblePins, aIncludeNameAndNumber,
1334 aIncludeElectricalType );
1348 wxCHECK(
pin,
false );
1392 if( !
m_alt.IsEmpty() )
1395 alt = &localStorage;
1399 : wxString( wxS(
"Undefined library pin." ) );
1403 return wxString::Format(
"Symbol %s %s",
1420 if ( !
name.IsEmpty() )
1422 return wxString::Format(
_(
"Pin %s [%s, %s, %s]" ),
1430 return wxString::Format(
_(
"Pin %s [%s, %s]" ),
1438 if( !
name.IsEmpty() )
1440 return wxString::Format(
_(
"Hidden pin %s [%s, %s, %s]" ),
1448 return wxString::Format(
_(
"Hidden pin %s [%s, %s]" ),
1503 return static_cast<int>(
m_shape ) -
static_cast<int>( tmp->
m_shape );
1506 return static_cast<int>(
m_type ) -
static_cast<int>( tmp->
m_type );
1525 const ALT& lhsAlt = lhsItem->second;
1526 const ALT& rhsAlt = rhsItem->second;
1534 return static_cast<int>( lhsAlt.
m_Type ) -
static_cast<int>( rhsAlt.
m_Type );
1537 return static_cast<int>( lhsAlt.
m_Shape ) -
static_cast<int>( rhsAlt.
m_Shape );
1610 aStream <<
"SCH_PIN:" << std::endl
1611 <<
" Name: \"" <<
m_name <<
"\"" << std::endl
1612 <<
" Number: \"" <<
m_number <<
"\"" << std::endl
1614 <<
" Length: " <<
GetLength() << std::endl
1627void SCH_PIN::Show(
int nestLevel, std::ostream& os )
const
1629 NestedSpace( nestLevel, os ) <<
'<' <<
GetClass().Lower().mb_str()
1650 if( pinTypeEnum.Choices().GetCount() == 0 )
1652 pinTypeEnum.Map( ELECTRICAL_PINTYPE::PT_INPUT,
_HKI(
"Input" ) )
1653 .Map( ELECTRICAL_PINTYPE::PT_OUTPUT,
_HKI(
"Output" ) )
1654 .Map( ELECTRICAL_PINTYPE::PT_BIDI,
_HKI(
"Bidirectional" ) )
1655 .Map( ELECTRICAL_PINTYPE::PT_TRISTATE,
_HKI(
"Tri-state" ) )
1656 .Map( ELECTRICAL_PINTYPE::PT_PASSIVE,
_HKI(
"Passive" ) )
1657 .Map( ELECTRICAL_PINTYPE::PT_NIC,
_HKI(
"Free" ) )
1658 .Map( ELECTRICAL_PINTYPE::PT_UNSPECIFIED,
_HKI(
"Unspecified" ) )
1659 .Map( ELECTRICAL_PINTYPE::PT_POWER_IN,
_HKI(
"Power input" ) )
1660 .Map( ELECTRICAL_PINTYPE::PT_POWER_OUT,
_HKI(
"Power output" ) )
1661 .Map( ELECTRICAL_PINTYPE::PT_OPENCOLLECTOR,
_HKI(
"Open collector" ) )
1662 .Map( ELECTRICAL_PINTYPE::PT_OPENEMITTER,
_HKI(
"Open emitter" ) )
1663 .Map( ELECTRICAL_PINTYPE::PT_NC,
_HKI(
"Unconnected" ) );
1668 if( pinShapeEnum.Choices().GetCount() == 0 )
1670 pinShapeEnum.Map( GRAPHIC_PINSHAPE::LINE,
_HKI(
"Line" ) )
1671 .Map( GRAPHIC_PINSHAPE::INVERTED,
_HKI(
"Inverted" ) )
1672 .Map( GRAPHIC_PINSHAPE::CLOCK,
_HKI(
"Clock" ) )
1673 .Map( GRAPHIC_PINSHAPE::INVERTED_CLOCK,
_HKI(
"Inverted clock" ) )
1674 .Map( GRAPHIC_PINSHAPE::INPUT_LOW,
_HKI(
"Input low" ) )
1675 .Map( GRAPHIC_PINSHAPE::CLOCK_LOW,
_HKI(
"Clock low" ) )
1676 .Map( GRAPHIC_PINSHAPE::OUTPUT_LOW,
_HKI(
"Output low" ) )
1677 .Map( GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK,
_HKI(
"Falling edge clock" ) )
1678 .Map( GRAPHIC_PINSHAPE::NONLOGIC,
_HKI(
"NonLogic" ) );
1683 if( orientationEnum.Choices().GetCount() == 0 )
1685 orientationEnum.Map( PIN_ORIENTATION::PIN_RIGHT,
_(
"Right" ) )
1686 .Map( PIN_ORIENTATION::PIN_LEFT,
_(
"Left" ) )
1687 .Map( PIN_ORIENTATION::PIN_UP,
_(
"Up" ) )
1688 .Map( PIN_ORIENTATION::PIN_DOWN,
_(
"Down" ) );
1691 auto isSymbolEditor =
1695 return dynamic_cast<LIB_SYMBOL*
>(
pin->GetParentSymbol() ) !=
nullptr;
1714 _HKI(
"Electrical Type" ),
1719 _HKI(
"Graphic Style" ),
1737 PROPERTY_DISPLAY::PT_SIZE ) )
1742 PROPERTY_DISPLAY::PT_SIZE ) )
1747 PROPERTY_DISPLAY::PT_SIZE ) )
constexpr EDA_IU_SCALE schIUScale
BITMAPS
A list of all bitmap identifiers.
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr bool Contains(const Vec &aPoint) const
constexpr bool Intersects(const BOX2< Vec > &aRect) const
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
KICAD_T Type() const
Returns the type of object.
virtual bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
EDA_ITEM * GetParent() const
EDA_ITEM * m_parent
Owner.
static bool Replace(const EDA_SEARCH_DATA &aSearchData, wxString &aText)
Perform a text replace on aText using the find and replace criteria in aSearchData on items that supp...
virtual const wxString & GetText() const
Return the string associated with the text object.
static ENUM_MAP< T > & Instance()
Class that other classes need to inherit from, in order to be inspectable.
FONT is an abstract base class for both outline and stroke fonts.
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false, const std::vector< wxString > *aEmbeddedFiles=nullptr, bool aForDrawingSheet=false)
VECTOR2I StringBoundaryLimits(const wxString &aText, const VECTOR2I &aSize, int aThickness, bool aBold, bool aItalic, const METRICS &aFontMetrics) const
Compute the boundary limits of aText (the bounding box of all shapes).
A color representation with 4 components: red, green, blue, alpha.
COLOR4D & Desaturate()
Removes color (in HSL model)
COLOR4D Mix(const COLOR4D &aColor, double aFactor) const
Return a color that is mixed with the input by a factor.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
int GetDefaultPenWidth() const
const wxString & GetDefaultFont() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
virtual const COLOR4D & GetBackgroundColor() const =0
Return current background color settings.
wxString AsString() const
Define a library symbol object.
A pin layout helper is a class that manages the layout of the parts of a pin on a schematic symbol:
Base plotter engine class.
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width)=0
void MoveTo(const VECTOR2I &pos)
void FinishTo(const VECTOR2I &pos)
RENDER_SETTINGS * RenderSettings()
bool GetColorMode() const
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
void LineTo(const VECTOR2I &pos)
virtual void PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont=nullptr, const KIFONT::METRICS &aFontMetrics=KIFONT::METRICS::Default(), void *aData=nullptr)
virtual void SetColor(const COLOR4D &color)=0
PROPERTY_BASE & SetAvailableFunc(std::function< bool(INSPECTABLE *)> aFunc)
Set a callback function to determine whether an object provides this property.
PROPERTY_BASE & SetWriteableFunc(std::function< bool(INSPECTABLE *)> aFunc)
Provide class metadata.Helper macro to map type hashes to names.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
wxString GetNetName() const
void AppendInfoToMsgPanel(std::vector< MSG_PANEL_ITEM > &aList) const
Adds information about the connection object to aList.
Schematic editor (Eeschema) main window.
SCH_SHEET_PATH & GetCurrentSheet() const
Base class for any item which can be embedded within the SCHEMATIC container class,...
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
SCH_ITEM & operator=(const SCH_ITEM &aPin)
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
const SYMBOL * GetParentSymbol() const
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
virtual int compare(const SCH_ITEM &aOther, int aCompareFlags=0) const
Provide the draw object specific comparison called by the == and < operators.
bool IsConnectivityDirty() const
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
const KIFONT::METRICS & GetFontMetrics() const
int GetEffectivePenWidth(const SCH_RENDER_SETTINGS *aSettings) const
double SimilarityBase(const SCH_ITEM &aItem) const
Calculate the boilerplate similarity for all LIB_ITEMs without preventing the use above of a pure vir...
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW=true) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
std::ostream & operator<<(std::ostream &aStream)
void SetAlt(const wxString &aAlt)
Set the name of the alternate pin.
void PlotPinTexts(PLOTTER *aPlotter, const VECTOR2I &aPinPos, PIN_ORIENTATION aPinOrient, int aTextInside, bool aDrawPinNum, bool aDrawPinName, bool aDimmed) const
Plot the pin name and number.
int GetNumberTextSize() const
std::optional< bool > m_hidden
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
std::unique_ptr< PIN_LAYOUT_CACHE > m_layoutCache
The layout cache for this pin.
void MirrorVerticallyPin(int aCenter)
void validateExtentsCache(KIFONT::FONT *aFont, int aSize, const wxString &aText, EXTENTS_CACHE *aCache) const
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
std::vector< int > ViewGetLayers() const override
Return the layers the item is drawn on (which may be more than its "home" layer)
const std::map< wxString, ALT > & GetAlternates() const
void CalcEdit(const VECTOR2I &aPosition) override
Calculate the attributes of an item at aPosition when it is being edited.
void SetNumber(const wxString &aNumber)
std::optional< int > m_nameTextSize
PIN_ORIENTATION PinDrawOrient(const TRANSFORM &aTransform) const
Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT), according to its orientation...
void SetVisible(bool aVisible)
void ChangeLength(int aLength)
Change the length of a pin and adjust its position based on orientation.
ALT GetAlt(const wxString &aAlt)
bool HasConnectivityChanges(const SCH_ITEM *aItem, const SCH_SHEET_PATH *aInstance=nullptr) const override
Check if aItem has connectivity changes against this object.
SCH_PIN & operator=(const SCH_PIN &aPin)
wxString GetShownNumber() const
void Move(const VECTOR2I &aOffset) override
Move the item by aMoveVector to a new position.
std::map< const SCH_SHEET_PATH, std::pair< wxString, bool > > m_net_name_map
PIN_ORIENTATION m_orientation
void SetOrientation(PIN_ORIENTATION aOrientation)
void SetName(const wxString &aName)
bool IsGlobalPower() const
Return whether this pin forms a global power connection: i.e., is part of a power symbol and of type ...
wxString getItemDescription(ALT *aAlt) const
bool ConnectionPropagatesTo(const EDA_ITEM *aItem) const override
Return true if this item should propagate connection info to aItem.
std::optional< int > m_numTextSize
VECTOR2I GetPinRoot() const
bool IsLocalPower() const
Local power pin is the same except that it is sheet-local and it does not support the legacy hidden p...
ELECTRICAL_PINTYPE m_type
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
SCH_PIN * GetLibPin() const
void SetPosition(const VECTOR2I &aPos) override
double Similarity(const SCH_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
void SetIsDangling(bool aIsDangling)
wxString GetElectricalTypeName() const
std::map< wxString, ALT > m_alternates
const wxString & GetName() const
bool IsDangling() const override
void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Plot the item to aPlotter.
void MirrorHorizontally(int aCenter) override
These transforms have effect only if the pin has a LIB_SYMBOL as parent.
std::recursive_mutex m_netmap_mutex
The name that this pin connection will drive onto a net.
PIN_ORIENTATION GetOrientation() const
wxString GetClass() const override
Return the class name.
void SetNumberTextSize(int aSize)
void SetShape(GRAPHIC_PINSHAPE aShape)
void RotatePin(const VECTOR2I &aCenter, bool aRotateCCW=true)
VECTOR2I GetPosition() const override
wxString GetCanonicalElectricalTypeName() const
bool Replace(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) override
Perform a text replace using the find and replace criteria in aSearchData on items that support text ...
int GetNameTextSize() const
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
int compare(const SCH_ITEM &aOther, int aCompareFlags=0) const override
The pin specific sort order is as follows:
wxString GetShownName() const
void MirrorHorizontallyPin(int aCenter)
These transforms have always effects.
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
void SetType(ELECTRICAL_PINTYPE aType)
const wxString & GetBaseName() const
Get the name without any alternates.
void ClearDefaultNetName(const SCH_SHEET_PATH *aPath)
SCH_PIN(LIB_SYMBOL *aParentSymbol)
bool IsStacked(const SCH_PIN *aPin) const
const wxString & GetNumber() const
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
wxString GetDefaultNetName(const SCH_SHEET_PATH &aPath, bool aForceNoConnect=false)
std::optional< int > m_length
GRAPHIC_PINSHAPE GetShape() const
void PlotPinType(PLOTTER *aPlotter, const VECTOR2I &aPosition, PIN_ORIENTATION aOrientation, bool aDimmed) const
bool IsPower() const
Check if the pin is either a global or local power pin.
ELECTRICAL_PINTYPE GetType() const
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
void SetNameTextSize(int aSize)
VECTOR2I TransformCoordinate(const VECTOR2I &aPoint) const
const KIGFX::COLOR4D & GetBackgroundColor() const override
Return current background color settings.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
const wxString GetValue(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText) const override
std::vector< SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet) const
Retrieve a list of the SCH_PINs for the given sheet path.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
A base class for LIB_SYMBOL and SCH_SYMBOL.
virtual bool IsGlobalPower() const =0
virtual bool IsLocalPower() const =0
virtual const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const =0
int GetPinNameOffset() const
virtual bool GetShowPinNames() const
virtual bool GetShowPinNumbers() const
GR_TEXT_H_ALIGN_T m_Halign
GR_TEXT_V_ALIGN_T m_Valign
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
#define DEFAULT_PINNUM_SIZE
The default pin name size when creating pins(can be changed in preference menu)
#define DEFAULT_PINNAME_SIZE
The default selection highlight thickness (can be changed in preference menu)
#define DEFAULT_PIN_LENGTH
The default pin number size when creating pins(can be changed in preference menu)
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_VERTICAL
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
#define STRUCT_DELETED
flag indication structures to be erased
#define SKIP_STRUCT
flag indicating that the structure should be ignored
#define SHOW_ELEC_TYPE
Show pin electrical type.
int GetPenSizeForNormal(int aTextSize)
@ LAYER_SELECTION_SHADOWS
wxString PinShapeGetText(GRAPHIC_PINSHAPE shape)
ELECTRICAL_PINTYPE
The symbol library pin object electrical types used in ERC tests.
@ PT_UNSPECIFIED
unknown electrical properties: creates always a warning when connected
BITMAPS ElectricalPinTypeGetBitmap(ELECTRICAL_PINTYPE)
wxString ElectricalPinTypeGetText(ELECTRICAL_PINTYPE)
wxString PinOrientationName(PIN_ORIENTATION aOrientation)
PIN_ORIENTATION
The symbol library pin object orientations.
@ PIN_RIGHT
The pin extends rightwards from the connection point.
#define ENUM_TO_WXANY(type)
Macro to define read-only fields (no setter method available)
static int externalPinDecoSize(const RENDER_SETTINGS *aSettings, const SCH_PIN &aPin)
Utility for getting the size of the 'external' pin decorators (as a radius) i.e.
static int internalPinDecoSize(const RENDER_SETTINGS *aSettings, const SCH_PIN &aPin)
Utility for getting the size of the 'internal' pin decorators (as a radius) i.e.
static struct SCH_PIN_DESC _SCH_PIN_DESC
#define TARGET_PIN_RADIUS
wxString UnescapeString(const wxString &aSource)
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
constexpr int MilsToIU(int mils) const
ELECTRICAL_PINTYPE m_Type
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
GR_TEXT_V_ALIGN_T
This is API surface mapped to common.types.VertialAlignment.
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
VECTOR2< int32_t > VECTOR2I