26#include <google/protobuf/any.pb.h> 
   46#include <api/board/board_types.pb.h> 
   86    *
this = *
static_cast<const PCB_TEXT*
>( aOther );
 
 
   93    kiapi::board::types::BoardText boardText;
 
   95    boardText.mutable_id()->set_value( 
m_Uuid.AsStdString() );
 
   98    boardText.set_locked( 
IsLocked() ? types::LockedState::LS_LOCKED
 
   99                                     : types::LockedState::LS_UNLOCKED );
 
  101    google::protobuf::Any 
any;
 
  103    any.UnpackTo( boardText.mutable_text() );
 
  106    types::Text* 
text = boardText.mutable_text();
 
  110    aContainer.PackFrom( boardText );
 
 
  117    kiapi::board::types::BoardText boardText;
 
  119    if( !aContainer.UnpackTo( &boardText ) )
 
  125    SetLocked( boardText.locked() == types::LockedState::LS_LOCKED );
 
  127    google::protobuf::Any 
any;
 
  128    any.PackFrom( boardText.text() );
 
  131    const types::Text& 
text = boardText.text();
 
 
  144    std::function<bool( wxString* )> 
resolver =
 
  145            [&]( wxString* token ) -> 
bool 
  147                if( token->IsSameAs( wxT( 
"LAYER" ) ) )
 
  153                if( parentFootprint && parentFootprint->
ResolveTextVar( token, aDepth + 1 ) )
 
  157                if( 
board && 
board->ResolveTextVar( token, aDepth + 1 ) )
 
  171    if( 
text.Contains( wxT( 
"@{" ) ) )
 
 
  245        if( 
GetText() == wxT( 
"${VALUE}" ) )
 
  251        if( 
GetText() == wxT( 
"${REFERENCE}" ) )
 
 
  276        aList.emplace_back( 
_( 
"Footprint" ), parentFP->
GetReference() );
 
  288        aList.emplace_back( 
_( 
"Status" ), 
_( 
"Locked" ) );
 
  292    aList.emplace_back( 
_( 
"Mirror" ), 
IsMirrored() ? 
_( 
"Yes" ) : 
_( 
"No" ) );
 
  294    aList.emplace_back( 
_( 
"Angle" ), wxString::Format( wxT( 
"%g" ), 
GetTextAngle().AsDegrees() ) );
 
  296    aList.emplace_back( 
_( 
"Font" ), 
GetFont() ? 
GetFont()->GetName() : 
_( 
"Default" ) );
 
  301        aList.emplace_back( 
_( 
"Text Thickness" ), 
_( 
"Auto" ) );
 
 
  341    bool needsFlipped = newAngle >= 
ANGLE_180;
 
 
  469        wxString ref = parentFP->GetReference();
 
  470        return wxString::Format( 
_( 
"Footprint text of %s (%s)" ), ref, content );
 
  473    return wxString::Format( 
_( 
"PCB text '%s' on %s" ), content, 
GetLayerName() );
 
 
  505        return std::make_shared<SHAPE_POLY_SET>( std::move( poly ) );
 
 
  513                                           int aMaxError )
 const 
 
  545                                  int aClearance )
 const 
  556    corners[1].
y = corners[0].
y;
 
  558    corners[2].
x = corners[1].
x;
 
  560    corners[3].
y = corners[2].
y;
 
  561    corners[3].
x = corners[0].
x;
 
  568        aBuffer->
Append( corner.x, corner.y );
 
 
  600                for( 
const VECTOR2I& point : { aPt1, aPt2, aPt3 } )
 
  601                    textShape.
Append( point.x, point.y );
 
  619        aBuffer.
Append( finalPoly );
 
  626                aClearance += aMaxError;
 
  631        aBuffer.
Append( textShape );
 
 
  637                                        int aClearance, 
int aMaxError, 
ERROR_LOC aErrorLoc,
 
  638                                        bool aIgnoreLineWidth )
 const 
 
  655    return *
this == other;
 
 
  691                _HKI( 
"Text Properties" ) );
 
  695                _HKI( 
"Text Properties" ) );
 
  697        auto isFootprintText =
 
  701                        return text->GetParentFootprint();
 
  707                                      _HKI( 
"Keep Upright" ), isFootprintText );
 
 
 
types::KiCadObjectType ToProtoEnum(KICAD_T aValue)
 
KICAD_T FromProtoEnum(types::KiCadObjectType aValue)
 
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
 
constexpr EDA_IU_SCALE pcbIUScale
 
BITMAPS
A list of all bitmap identifiers.
 
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
 
Container for design settings for a BOARD object.
 
bool GetTextUpright(PCB_LAYER_ID aLayer) const
 
int GetTextThickness(PCB_LAYER_ID aLayer) const
Return the default text thickness from the layer class for the given layer.
 
bool GetTextItalic(PCB_LAYER_ID aLayer) const
 
VECTOR2I GetTextSize(PCB_LAYER_ID aLayer) const
Return the default text size from the layer class for the given layer.
 
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
 
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
 
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
 
void SetLocked(bool aLocked) override
 
virtual bool IsKnockout() const
 
bool IsLocked() const override
 
virtual void SetIsKnockout(bool aKnockout)
 
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
 
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
 
FOOTPRINT * GetParentFootprint() const
 
const KIFONT::METRICS & GetFontMetrics() const
 
bool IsSideSpecific() const
 
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
 
Information pertinent to a Pcbnew printed circuit board.
 
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 const Vec & GetOrigin() const
 
const BOX2< Vec > GetBoundingBoxRotated(const VECTOR2I &aRotCenter, const EDA_ANGLE &aAngle) const
Useful to calculate bounding box of rotated items, when rotation is not cardinal.
 
constexpr coord_type GetRight() const
 
constexpr bool Intersects(const BOX2< Vec > &aRect) const
 
constexpr coord_type GetBottom() const
 
The base class for create windows for drawing purpose.
 
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(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
 
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
 
int GetTextHeight() const
 
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
 
const VECTOR2I & GetTextPos() const
 
const EDA_ANGLE & GetTextAngle() const
 
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
 
virtual const wxString & GetText() const
Return the string associated with the text object.
 
bool IsKeepUpright() const
 
void SetTextPos(const VECTOR2I &aPoint)
 
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
 
KIFONT::FONT * GetFont() const
 
void SetMirrored(bool isMirrored)
 
std::vector< std::unique_ptr< KIFONT::GLYPH > > * GetRenderCache(const KIFONT::FONT *aFont, const wxString &forResolvedText, const VECTOR2I &aOffset={ 0, 0 }) const
 
virtual VECTOR2I GetDrawPos() const
 
BOX2I GetTextBox(const RENDER_SETTINGS *aSettings, int aLine=-1) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
 
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
 
GR_TEXT_H_ALIGN_T GetHorizJustify() const
 
virtual KIFONT::FONT * GetDrawFont(const RENDER_SETTINGS *aSettings) const
 
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
 
EDA_TEXT(const EDA_IU_SCALE &aIuScale, const wxString &aText=wxEmptyString)
 
double Similarity(const EDA_TEXT &aOther) const
 
wxString EvaluateText(const wxString &aText) const
 
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
 
virtual bool TextHitTest(const VECTOR2I &aPoint, int aAccuracy=0) const
Test if aPoint is within the bounds of this object.
 
const TEXT_ATTRIBUTES & GetAttributes() const
 
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
 
std::shared_ptr< SHAPE_COMPOUND > GetEffectiveTextShape(bool aTriangulate=true, const BOX2I &aBBox=BOX2I(), const EDA_ANGLE &aAngle=ANGLE_0) const
build a list of segments (SHAPE_SEGMENT) to describe a text shape.
 
void SetKeepUpright(bool aKeepUpright)
 
GR_TEXT_V_ALIGN_T GetVertJustify() const
 
virtual wxString GetShownText(bool aAllowExtraText, int aDepth=0) const
Return the string actually shown after processing of the base text.
 
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
 
int GetTextThickness() const
 
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
 
bool operator==(const EDA_TEXT &aRhs) const
 
void SetMultilineAllowed(bool aAllow)
 
VECTOR2I GetTextSize() const
 
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
 
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.
 
void Draw(KIGFX::GAL *aGal, const wxString &aText, const VECTOR2I &aPosition, const VECTOR2I &aCursor, const TEXT_ATTRIBUTES &aAttributes, const METRICS &aFontMetrics) const
Draw a string.
 
virtual void DrawGlyphs(const std::vector< std::unique_ptr< KIFONT::GLYPH > > &aGlyphs)
Draw polygons representing font glyphs.
 
Contains methods for drawing PCB-specific items.
 
virtual PCB_RENDER_SETTINGS * GetSettings() override
Return a pointer to current settings that are going to be used when drawing items.
 
PCB specific render settings.
 
PCB_LAYER_ID GetPrimaryHighContrastLayer() const
Return the board layer which is in high-contrast mode.
 
bool GetHighContrast() const
 
static constexpr double LOD_HIDE
Return this constant from ViewGetLOD() to hide the item unconditionally.
 
static constexpr double LOD_SHOW
Return this constant from ViewGetLOD() to show the item unconditionally.
 
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
 
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
 
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
 
SHAPE_POLY_SET GetKnockoutCache(const KIFONT::FONT *aFont, const wxString &forResolvedText, int aMaxError) const
 
void CopyFrom(const BOARD_ITEM *aOther) override
 
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.
 
void StyleFromSettings(const BOARD_DESIGN_SETTINGS &settings, bool aCheckSide) override
 
double Similarity(const BOARD_ITEM &aBoardItem) const override
Return a measure of how likely the other object is to represent the same object.
 
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc, bool aIgnoreLineWidth=false) const override
Convert the item shape to a closed polygon.
 
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
 
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
 
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
 
virtual void swapData(BOARD_ITEM *aImage) override
 
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
 
void KeepUpright()
Called when rotating the parent footprint.
 
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
 
EDA_ANGLE m_knockout_cache_angle
 
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
 
wxString GetShownText(bool aAllowExtraText, int aDepth=0) const override
Return the string actually shown after processing of the base text.
 
void Mirror(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Mirror this object relative to a given horizontal axis the layer is not changed.
 
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
 
virtual VECTOR2I GetPosition() const override
 
PCB_TEXT(BOARD_ITEM *parent, KICAD_T idtype=PCB_TEXT_T)
 
wxString m_knockout_cache_text
 
TEXT_ATTRIBUTES m_knockout_cache_text_attrs
 
bool operator==(const PCB_TEXT &aOther) const
 
int getKnockoutMargin() const
 
void TransformTextToPolySet(SHAPE_POLY_SET &aBuffer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc) const
Function TransformTextToPolySet Convert the text to a polygonSet describing the actual character stro...
 
SHAPE_POLY_SET m_knockout_cache
 
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
 
virtual wxString GetTextTypeDescription() const
 
std::vector< int > ViewGetLayers() const override
 
void buildBoundingHull(SHAPE_POLY_SET *aBuffer, const SHAPE_POLY_SET &aRenderedText, int aClearance) const
Build a nominally rectangular bounding box for the rendered text.
 
bool TextHitTest(const VECTOR2I &aPoint, int aAccuracy=0) const override
Test if aPoint is within the bounds of this object.
 
virtual void SetPosition(const VECTOR2I &aPos) override
 
VECTOR2I m_knockout_cache_pos
 
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
 
EDA_ANGLE GetDrawRotation() const override
 
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
 
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
 
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
 
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.
 
void Mask(TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName)
Sets a base class property as masked in a derived class.
 
static PROPERTY_MANAGER & Instance()
 
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
 
void OverrideAvailability(TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName, std::function< bool(INSPECTABLE *)> aFunc)
Sets an override availability functor for a base class property of a given derived class.
 
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
 
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
 
Represent a set of closed polygons.
 
void Rotate(const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Rotate all vertices by a given angle.
 
void Inflate(int aAmount, CORNER_STRATEGY aCornerStrategy, int aMaxError, bool aSimplify=false)
Perform outline inflation/deflation.
 
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)
 
void Simplify()
Simplify the polyset (merges overlapping polys, eliminates degeneracy/self-intersections)
 
int NewOutline()
Creates a new empty polygon in the set and returns its index.
 
void BooleanSubtract(const SHAPE_POLY_SET &b)
Perform boolean polyset difference.
 
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
 
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
 
A type-safe container of any type.
 
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject, int aFlags)
 
void TransformOvalToPolygon(SHAPE_POLY_SET &aBuffer, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0)
Convert a oblong shape to a polygon, using multiple segments.
 
@ ROUND_ALL_CORNERS
All angles are rounded.
 
static constexpr EDA_ANGLE ANGLE_90
 
static constexpr EDA_ANGLE ANGLE_VERTICAL
 
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
 
static constexpr EDA_ANGLE ANGLE_180
 
#define PCB_EDIT_FRAME_NAME
 
static FILENAME_RESOLVER * resolver
 
a few functions useful in geometry calculations.
 
int GetKnockoutTextMargin(const VECTOR2I &aSize, int aThickness)
Return the margin for knocking out text.
 
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
 
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
 
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
 
@ LAYER_LOCKED_ITEM_SHADOW
Shadow layer for locked items.
 
@ LAYER_FOOTPRINTS_FR
Show footprints on front.
 
@ LAYER_FP_REFERENCES
Show footprints references (when texts are visible).
 
@ LAYER_FOOTPRINTS_BK
Show footprints on back.
 
@ LAYER_FP_VALUES
Show footprints values (when texts are visible).
 
PCB_LAYER_ID
A quick note on layer IDs:
 
constexpr T MIRRORVAL(T aPoint, T aMirrorRef)
Returns the mirror of aPoint relative to the aMirrorRef.
 
@ LEFT_RIGHT
Flip left to right (around the Y axis)
 
bool BoxHitTest(const VECTOR2I &aHitPoint, const BOX2I &aHittee, int aAccuracy)
Perform a point-to-box hit test.
 
KICOMMON_API wxString EllipsizeMenuText(const wxString &aString)
Ellipsize text (at the end) to be no more than 36 characters.
 
KICOMMON_API wxString EllipsizeStatusText(wxWindow *aWindow, const wxString &aString)
Ellipsize text (at the end) to be no more than 1/3 of the window width.
 
KICOMMON_API VECTOR2I UnpackVector2(const types::Vector2 &aInput)
 
KICOMMON_API void PackVector2(types::Vector2 &aOutput, const VECTOR2I &aInput)
 
static struct PCB_TEXT_DESC _PCB_TEXT_DESC
 
wxString UnescapeString(const wxString &aSource)
 
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.
 
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
 
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
 
VECTOR2< int32_t > VECTOR2I