30#include <api/board/board_types.pb.h>
51 kiapi::board::types::Field field;
53 google::protobuf::Any anyText;
55 anyText.UnpackTo( field.mutable_text() );
58 field.mutable_id()->set_id(
GetId() );
60 aContainer.PackFrom( field );
66 kiapi::board::types::Field field;
68 if( !aContainer.UnpackTo( &field ) )
72 setId( field.id().id() );
76 SetName( wxString( field.name().c_str(), wxConvUTF8 ) );
78 if( field.has_text() )
80 google::protobuf::Any anyText;
81 anyText.PackFrom( field.text() );
85 if( field.text().layer() == kiapi::board::types::BoardLayer::BL_UNKNOWN )
98 else if(
m_name.IsEmpty() && aUseDefaultName )
105 wxFAIL_MSG(
"Unhandled field owner type." );
124 wxFAIL_MSG( wxString::Format(
"Unhandled field owner type (id %d, parent type %d).",
138 return _(
"User Field" );
150 return wxString::Format(
_(
"Reference field of %s" ), ref );
153 return wxString::Format(
_(
"Value field of %s (%s)" ), ref, content );
156 return wxString::Format(
_(
"Footprint field of %s (%s)" ), ref, content );
159 return wxString::Format(
_(
"Datasheet field of %s (%s)" ), ref, content );
163 return wxString::Format(
_(
"Field of %s (%s)" ), ref, content );
165 return wxString::Format(
_(
"%s field of %s (%s)" ),
GetName(), ref, content );
172 constexpr double HIDE = std::numeric_limits<double>::max();
218 return *
this == other;
265 auto isNotFootprintFootprint =
269 return !field->IsFootprint();
275 isNotFootprintFootprint );
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
FOOTPRINT * GetParentFootprint() const
A base class for most all the KiCad significant classes used in schematics and boards.
KICAD_T Type() const
Returns the type of object.
EDA_ITEM * m_parent
Linked list: Link (parent struct)
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
virtual const wxString & GetText() const
Return the string associated with the text object.
double Similarity(const EDA_TEXT &aOther) const
bool operator==(const EDA_TEXT &aRhs) const
Class that other classes need to inherit from, in order to be inspectable.
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.
bool m_ForceShowFieldsWhenFPSelected
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.
bool operator==(const PCB_FIELD &aOther) const
wxString GetTextTypeDescription() const override
PCB_FIELD(FOOTPRINT *aParent, int aFieldId, const wxString &aName=wxEmptyString)
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
wxString GetCanonicalName() const
Get a non-language-specific name for a field which can be used for storage, variable look-up,...
void SetName(const wxString &aName)
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
void swapData(BOARD_ITEM *aImage) override
double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
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.
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
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()
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.
Some functions to handle hotkeys in KiCad.
@ LAYER_FP_REFERENCES
show footprints references (when texts are visible)
@ LAYER_FP_VALUES
show footprints values (when texts are visible)
KICOMMON_API wxString EllipsizeMenuText(const wxString &aString)
Ellipsize text (at the end) to be no more than 36 characters.
static struct PCB_FIELD_DESC _PCB_FIELD_DESC
static const wxString GetDefaultFieldName(int aFieldNdx, bool aTranslateForHI=false)
Return a default symbol field name for field aFieldNdx for all components.
wxString GetCanonicalFieldName(int idx)
@ DATASHEET_FIELD
name of datasheet
@ FOOTPRINT_FIELD
Field Name Module PCB, i.e. "16DIP300".
@ VALUE_FIELD
Field Value of part, i.e. "3.3K".
@ MANDATORY_FIELDS
The first 5 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint