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() );
281 bool includeType = aIncludeElectricalType;
286 includeNumber =
false;
292 if( !parentSymbol->GetShowPinNames() )
295 if( !parentSymbol->GetShowPinNumbers() )
296 includeNumber =
false;
311 bbox.
Merge( pinBox );
316 bbox.
Merge( *decoBox );
323 bbox.
Merge( *nameBox );
328 bbox.
Merge( *altIconBox );
336 bbox.
Merge( *numBox );
344 bbox.
Merge( *typeBox );
380 const float offsetRatio =
388 int pinNameOffset = 0;
391 if( parentSymbol->GetShowPinNames() )
392 pinNameOffset = parentSymbol->GetPinNameOffset();
405 if( pinNameOffset > 0 )
428 int pinNameOffset = 0;
431 if( parentSymbol->GetShowPinNames() )
432 pinNameOffset = parentSymbol->GetPinNameOffset();
448 box->Move( { 0, textPos } );
480 VECTOR2I c{ 0, ( nameBox->GetTop() + nameBox->GetBottom() ) / 2 };
484 c.
x = nameBox->GetRight() + iconSize * 0.75;
488 c.x = nameBox->GetLeft() - iconSize * 0.75;
501 const auto makeInvertBox = [&]()
503 return BOX2I::ByCenter( { -decoSize, 0 }, { decoSize * 2, decoSize * 2 } );
506 const auto makeLowBox = [&]()
511 const auto makeClockBox = [&]()
513 return BOX2I::ByCorners( { 0, -intDecoSize }, { intDecoSize, intDecoSize } );
520 case GRAPHIC_PINSHAPE::INVERTED:
522 box = makeInvertBox();
525 case GRAPHIC_PINSHAPE::CLOCK:
527 box = makeClockBox();
530 case GRAPHIC_PINSHAPE::INVERTED_CLOCK:
532 box = makeInvertBox();
533 box->Merge( makeClockBox() );
536 case GRAPHIC_PINSHAPE::INPUT_LOW:
541 case GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK:
542 case GRAPHIC_PINSHAPE::CLOCK_LOW:
545 box->Merge( makeClockBox() );
548 case GRAPHIC_PINSHAPE::NONLOGIC:
553 case GRAPHIC_PINSHAPE::LINE:
633 const int thickOffset =
636 info->m_TextPosition = pos +
VECTOR2I{ thickOffset, 0 };
645 info->m_TextPosition = pos;
663 std::optional<TEXT_INFO>
info;
666 info->m_Text = std::move( number );
674 const bool numAbove =
692std::optional<PIN_LAYOUT_CACHE::TEXT_INFO>
704 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