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 )
151 if( !font->IsOutline() )
185 case PIN_ORIENTATION::PIN_UP:
197 case PIN_ORIENTATION::PIN_DOWN:
211 case PIN_ORIENTATION::PIN_LEFT:
217 case PIN_ORIENTATION::PIN_RIGHT:
231 case PIN_ORIENTATION::PIN_LEFT:
237 case PIN_ORIENTATION::PIN_UP:
243 case PIN_ORIENTATION::PIN_DOWN:
251 case PIN_ORIENTATION::PIN_RIGHT:
261 bool aIncludeNameAndNumber,
bool aIncludeElectricalType )
266 wxCHECK( libPin,
BOX2I() );
269 aIncludeElectricalType );
271 r = symbol->GetTransform().TransformCoordinate( r );
272 r.
Offset( symbol->GetPosition() );
280 bool includeType = aIncludeElectricalType;
285 includeNumber =
false;
291 if( !parentSymbol->GetShowPinNames() )
294 if( !parentSymbol->GetShowPinNumbers() )
295 includeNumber =
false;
310 bbox.
Merge( pinBox );
315 bbox.
Merge( *decoBox );
322 bbox.
Merge( *nameBox );
327 bbox.
Merge( *altIconBox );
335 bbox.
Merge( *numBox );
343 bbox.
Merge( *typeBox );
379 const float offsetRatio =
387 int pinNameOffset = 0;
390 if( parentSymbol->GetShowPinNames() )
391 pinNameOffset = parentSymbol->GetPinNameOffset();
404 if( pinNameOffset > 0 )
427 int pinNameOffset = 0;
430 if( parentSymbol->GetShowPinNames() )
431 pinNameOffset = parentSymbol->GetPinNameOffset();
447 box->Move( { 0, textPos } );
479 VECTOR2I c{ 0, ( nameBox->GetTop() + nameBox->GetBottom() ) / 2 };
483 c.
x = nameBox->GetRight() + iconSize * 0.75;
487 c.x = nameBox->GetLeft() - iconSize * 0.75;
500 const auto makeInvertBox = [&]()
502 return BOX2I::ByCenter( { -decoSize, 0 }, { decoSize * 2, decoSize * 2 } );
505 const auto makeLowBox = [&]()
510 const auto makeClockBox = [&]()
512 return BOX2I::ByCorners( { 0, -intDecoSize }, { intDecoSize, intDecoSize } );
519 case GRAPHIC_PINSHAPE::INVERTED:
521 box = makeInvertBox();
524 case GRAPHIC_PINSHAPE::CLOCK:
526 box = makeClockBox();
529 case GRAPHIC_PINSHAPE::INVERTED_CLOCK:
531 box = makeInvertBox();
532 box->Merge( makeClockBox() );
535 case GRAPHIC_PINSHAPE::INPUT_LOW:
540 case GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK:
541 case GRAPHIC_PINSHAPE::CLOCK_LOW:
544 box->Merge( makeClockBox() );
547 case GRAPHIC_PINSHAPE::NONLOGIC:
552 case GRAPHIC_PINSHAPE::LINE:
632 const int thickOffset =
635 info->m_TextPosition = pos +
VECTOR2I{ thickOffset, 0 };
644 info->m_TextPosition = pos;
662 std::optional<TEXT_INFO>
info;
665 info->m_Text = std::move( number );
673 const bool numAbove =
691std::optional<PIN_LAYOUT_CACHE::TEXT_INFO>
703 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(const wxString &aFilename)
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