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 )
150 if( !font->IsOutline() )
184 case PIN_ORIENTATION::PIN_UP:
196 case PIN_ORIENTATION::PIN_DOWN:
210 case PIN_ORIENTATION::PIN_LEFT:
216 case PIN_ORIENTATION::PIN_RIGHT:
230 case PIN_ORIENTATION::PIN_LEFT:
236 case PIN_ORIENTATION::PIN_UP:
242 case PIN_ORIENTATION::PIN_DOWN:
250 case PIN_ORIENTATION::PIN_RIGHT:
260 bool aIncludeNameAndNumber,
bool aIncludeElectricalType )
265 wxCHECK( libPin,
BOX2I() );
268 aIncludeElectricalType );
270 r = symbol->GetTransform().TransformCoordinate( r );
271 r.
Offset( symbol->GetPosition() );
279 bool includeType = aIncludeElectricalType;
284 includeNumber =
false;
290 if( !parentSymbol->GetShowPinNames() )
293 if( !parentSymbol->GetShowPinNumbers() )
294 includeNumber =
false;
309 bbox.
Merge( pinBox );
314 bbox.
Merge( *decoBox );
321 bbox.
Merge( *nameBox );
326 bbox.
Merge( *altIconBox );
334 bbox.
Merge( *numBox );
342 bbox.
Merge( *typeBox );
378 const float offsetRatio =
386 int pinNameOffset = 0;
389 if( parentSymbol->GetShowPinNames() )
390 pinNameOffset = parentSymbol->GetPinNameOffset();
403 if( pinNameOffset > 0 )
426 int pinNameOffset = 0;
429 if( parentSymbol->GetShowPinNames() )
430 pinNameOffset = parentSymbol->GetPinNameOffset();
446 box->Move( { 0, textPos } );
478 VECTOR2I c{ 0, ( nameBox->GetTop() + nameBox->GetBottom() ) / 2 };
482 c.
x = nameBox->GetRight() + iconSize * 0.75;
486 c.x = nameBox->GetLeft() - iconSize * 0.75;
499 const auto makeInvertBox = [&]()
501 return BOX2I::ByCenter( { -decoSize, 0 }, { decoSize * 2, decoSize * 2 } );
504 const auto makeLowBox = [&]()
509 const auto makeClockBox = [&]()
511 return BOX2I::ByCorners( { 0, -intDecoSize }, { intDecoSize, intDecoSize } );
518 case GRAPHIC_PINSHAPE::INVERTED:
520 box = makeInvertBox();
523 case GRAPHIC_PINSHAPE::CLOCK:
525 box = makeClockBox();
528 case GRAPHIC_PINSHAPE::INVERTED_CLOCK:
530 box = makeInvertBox();
531 box->Merge( makeClockBox() );
534 case GRAPHIC_PINSHAPE::INPUT_LOW:
539 case GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK:
540 case GRAPHIC_PINSHAPE::CLOCK_LOW:
543 box->Merge( makeClockBox() );
546 case GRAPHIC_PINSHAPE::NONLOGIC:
551 case GRAPHIC_PINSHAPE::LINE:
631 const int thickOffset =
634 info->m_TextPosition = pos +
VECTOR2I{ thickOffset, 0 };
643 info->m_TextPosition = pos;
661 std::optional<TEXT_INFO>
info;
664 info->m_Text = std::move( number );
672 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)
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).
virtual SETTINGS_MANAGER & GetSettingsManager() const
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
Pin type decoration if any.
int getPinTextOffset() const
Get the current pin text offset.
OPT_BOX2I getUntransformedDecorationBox() const
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
Searches 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
T * GetAppSettings()
Returns a handle to the a given settings by type If the settings have already been loaded,...
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)
PGM_BASE & Pgm()
The global Program "get" accessor.
static int externalPinDecoSize(const RENDER_SETTINGS *aSettings, const SCH_PIN &aPin)
Utility for getting the size of the 'external' pin decorators (as a radius)
static int internalPinDecoSize(const RENDER_SETTINGS *aSettings, const SCH_PIN &aPin)
Utility for getting the size of the 'internal' pin decorators (as a radius)
#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