73 m_pin( aPin ), m_schSettings( nullptr ), m_dirtyFlags(
DIRTY_FLAGS::
ALL )
92 bool aShowElectricalType,
bool aShowAltIcons )
118 const wxString& aText,
123 if( !aDefinitelyDirty && aCache.
m_Font == aFont && aCache.
m_FontSize == aSize )
181 case PIN_ORIENTATION::PIN_UP:
193 case PIN_ORIENTATION::PIN_DOWN:
207 case PIN_ORIENTATION::PIN_LEFT:
213 case PIN_ORIENTATION::PIN_RIGHT:
227 case PIN_ORIENTATION::PIN_LEFT:
233 case PIN_ORIENTATION::PIN_UP:
239 case PIN_ORIENTATION::PIN_DOWN:
247 case PIN_ORIENTATION::PIN_RIGHT:
257 bool aIncludeNameAndNumber,
bool aIncludeElectricalType )
262 wxCHECK( libPin,
BOX2I() );
265 aIncludeElectricalType );
267 r = symbol->GetTransform().TransformCoordinate( r );
268 r.
Offset( symbol->GetPosition() );
276 bool includeType = aIncludeElectricalType;
281 includeNumber =
false;
287 if( !parentSymbol->GetShowPinNames() )
290 if( !parentSymbol->GetShowPinNumbers() )
291 includeNumber =
false;
306 bbox.
Merge( pinBox );
311 bbox.
Merge( *decoBox );
318 bbox.
Merge( *nameBox );
323 bbox.
Merge( *altIconBox );
331 bbox.
Merge( *numBox );
339 bbox.
Merge( *typeBox );
375 const float offsetRatio =
383 int pinNameOffset = 0;
386 if( parentSymbol->GetShowPinNames() )
387 pinNameOffset = parentSymbol->GetPinNameOffset();
400 if( pinNameOffset > 0 )
423 int pinNameOffset = 0;
427 if( parentSymbol->GetShowPinNames() )
428 pinNameOffset = parentSymbol->GetPinNameOffset();
444 box->Move( { 0, textPos } );
476 VECTOR2I c{ 0, ( nameBox->GetTop() + nameBox->GetBottom() ) / 2 };
480 c.
x = nameBox->GetRight() + iconSize * 0.75;
484 c.x = nameBox->GetLeft() - iconSize * 0.75;
497 const auto makeInvertBox = [&]()
499 return BOX2I::ByCenter( { -decoSize, 0 }, { decoSize * 2, decoSize * 2 } );
502 const auto makeLowBox = [&]()
507 const auto makeClockBox = [&]()
509 return BOX2I::ByCorners( { 0, -intDecoSize }, { intDecoSize, intDecoSize } );
516 case GRAPHIC_PINSHAPE::INVERTED:
518 box = makeInvertBox();
521 case GRAPHIC_PINSHAPE::CLOCK:
523 box = makeClockBox();
526 case GRAPHIC_PINSHAPE::INVERTED_CLOCK:
528 box = makeInvertBox();
529 box->Merge( makeClockBox() );
532 case GRAPHIC_PINSHAPE::INPUT_LOW:
537 case GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK:
538 case GRAPHIC_PINSHAPE::CLOCK_LOW:
541 box->Merge( makeClockBox() );
544 case GRAPHIC_PINSHAPE::NONLOGIC:
549 case GRAPHIC_PINSHAPE::LINE:
629 const int thickOffset =
632 info->m_TextPosition = pos +
VECTOR2I{ thickOffset, 0 };
641 info->m_TextPosition = pos;
659 std::optional<TEXT_INFO>
info;
662 info->m_Text = std::move( number );
670 const bool numAbove =
690std::optional<PIN_LAYOUT_CACHE::TEXT_INFO>
702 info->m_Thickness =
info->m_TextSize / 8;
constexpr EDA_IU_SCALE schIUScale
std::optional< BOX2I > OPT_BOX2I
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
static constexpr BOX2< VECTOR2I > ByCorners(const VECTOR2I &aCorner1, const VECTOR2I &aCorner2)
constexpr BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
static constexpr BOX2< VECTOR2I > ByCenter(const VECTOR2I &aCenter, const SizeVec &aSize)
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
constexpr const Vec GetCenter() const
constexpr coord_type GetLeft() const
constexpr void Move(const Vec &aMoveVector)
Move the rectangle by the aMoveVector.
constexpr coord_type GetRight() const
constexpr coord_type GetTop() const
constexpr void Offset(coord_type dx, coord_type dy)
constexpr coord_type GetBottom() const
Represent basic circle geometry with utility geometry functions.
VECTOR2I Center
Public to make access simpler.
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)
virtual bool IsOutline() const
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).
OPT_BOX2I getUntransformedPinNameBox() const
Get the untransformd text box in the default orientation.
TEXT_EXTENTS_CACHE m_nameExtentsCache
void transformTextForPin(TEXT_INFO &aTextInfo) const
Transform text info to suit a pin's.
OPT_BOX2I GetAltIconBBox()
Get the box of the alt mode icon, if there is one.
void transformBoxForPin(BOX2I &aBox) const
Transform a box (in-place) to the pin's orientation.
void recomputeCaches()
Recompute all the caches that have become dirty.
const SCHEMATIC_SETTINGS * m_schSettings
OPT_BOX2I GetPinNumberBBox()
Get the bounding box of the pin number, if there is one.
PIN_LAYOUT_CACHE(const SCH_PIN &aPin)
bool m_showElectricalType
TEXT_EXTENTS_CACHE m_typeExtentsCache
BOX2I GetPinBoundingBox(bool aIncludeLabelsOnInvisiblePins, bool aIncludeNameAndNumber, bool aIncludeElectricalType)
Get the bounding box of the pin itself.
TEXT_EXTENTS_CACHE m_numExtentsCache
OPT_BOX2I getUntransformedPinTypeBox() const
std::optional< TEXT_INFO > GetPinNameInfo(int aShadowWidth)
Get the text info for the pin name.
static void recomputeExtentsCache(bool aDefinitelyDirty, KIFONT::FONT *aFont, int aSize, const wxString &aText, const KIFONT::METRICS &aFontMetrics, TEXT_EXTENTS_CACHE &aCache)
std::optional< TEXT_INFO > GetPinElectricalTypeInfo(int aShadowWidth)
bool isDirty(int aMask) const
CIRCLE GetDanglingIndicator() const
Gets the dangling indicator geometry for this pin, if the pin were to be dangling.
std::optional< TEXT_INFO > GetPinNumberInfo(int aShadowWidth)
OPT_BOX2I GetPinNameBBox()
Get the bounding box of the pin name, if there is one.
void MarkDirty(int aFlags)
Recompute all the layout information.
void SetRenderParameters(int aNameThickness, int aNumberThickness, bool aShowElectricalType, bool aShowAltIcons)
OPT_BOX2I getUntransformedAltIconBox() const
int getPinTextOffset() const
Get the current pin text offset.
OPT_BOX2I getUntransformedDecorationBox() const
Pin type decoration if any.
const SCH_PIN & m_pin
The pin in question.
OPT_BOX2I getUntransformedPinNumberBox() const
float m_shadowOffsetAdjust
These are loaded from Eeschema settings but then overwritten by the project settings.
Holds all the data relating to one schematic.
SCHEMATIC_SETTINGS & Settings() const
const SYMBOL * GetParentSymbol() const
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
const KIFONT::METRICS & GetFontMetrics() const
int GetNumberTextSize() const
const std::map< wxString, ALT > & GetAlternates() const
PIN_ORIENTATION PinDrawOrient(const TRANSFORM &aTransform) const
Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT), according to its orientation...
wxString GetShownNumber() const
SCH_PIN * GetLibPin() const
wxString GetElectricalTypeName() const
int GetPenWidth() const override
bool IsDangling() const override
VECTOR2I GetPosition() const override
int GetNameTextSize() const
wxString GetShownName() const
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
GRAPHIC_PINSHAPE GetShape() const
A base class for LIB_SYMBOL and SCH_SYMBOL.
int GetPinNameOffset() const
virtual bool GetShowPinNames() const
virtual bool GetShowPinNumbers() const
#define DEFAULT_TEXT_OFFSET_RATIO
Ratio of the font height to space around global labels.
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_VERTICAL
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
TRANSFORM DefaultTransform
int GetPenSizeForNormal(int aTextSize)
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.
#define TARGET_PIN_RADIUS
Utility functions for working with shapes.
constexpr int MilsToIU(int mils) const
constexpr int mmToIU(double mm) const
Cached extent of a text item.
GR_TEXT_H_ALIGN_T m_HAlign
constexpr GR_TEXT_H_ALIGN_T GetFlippedAlignment(GR_TEXT_H_ALIGN_T aAlign)
Get the reverse alignment: left-right are swapped, others are unchanged.
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