64 const wxString& layerName = b->AsString();
68 std::shared_lock<std::shared_mutex> readLock( board->
m_CachesMutex );
73 return i->second.Contains(
m_layer );
78 for(
unsigned ii = 0; ii < layerMap.GetCount(); ++ii )
80 wxPGChoiceEntry& entry = layerMap[ii];
82 if( entry.GetText().Matches( layerName ) )
87 std::unique_lock<std::shared_mutex> writeLock( board->
m_CachesMutex );
108 const wxString& thisStr =
AsString();
109 const wxString& otherStr = b->AsString();
111 if( thisStr.IsSameAs( otherStr,
false ) )
115 if( thisStr == wxT(
"tri_state" ) )
116 return otherStr.IsSameAs( wxT(
"Tri-state" ),
false );
118 if( thisStr == wxT(
"power_in" ) )
119 return otherStr.IsSameAs( wxT(
"Power input" ),
false );
121 if( thisStr == wxT(
"power_out" ) )
122 return otherStr.IsSameAs( wxT(
"Power output" ),
false );
124 if( thisStr == wxT(
"no_connect" ) )
125 return otherStr.IsSameAs( wxT(
"Unconnected" ),
false );
151 == *( bValue->m_item->GetEffectiveNetClass() );
194 if( !
m_item || !bValue->m_item )
202 return aClass == bClass;
215 if( !
m_item || !bValue->m_item )
223 return aClass != bClass;
305 str = item->
Get<wxString>( it->second );
307 if( it->second->Name() == wxT(
"Pin Type" ) )
314 const wxAny& any = item->
Get( it->second );
317 if( it->second->Name() == wxT(
"Layer" )
318 || it->second->Name() == wxT(
"Layer Top" )
319 || it->second->Name() == wxT(
"Layer Bottom" ) )
323 else if( any.GetAs<wxString>( &str ) )
328 if( any.GetAs<wxString>( &str ) )
387 return registry.
Get( aName.Lower() );
392 const wxString& aField )
395 std::unique_ptr<PCBEXPR_VAR_REF> vref;
399 if( aField.CmpNoCase( wxT(
"NetClass" ) ) == 0 )
401 if( aVar == wxT(
"A" ) )
402 return std::make_unique<PCBEXPR_NETCLASS_REF>( 0 );
403 else if( aVar == wxT(
"B" ) )
404 return std::make_unique<PCBEXPR_NETCLASS_REF>( 1 );
408 else if( aField.CmpNoCase( wxT(
"ComponentClass" ) ) == 0 )
410 if( aVar == wxT(
"A" ) )
411 return std::make_unique<PCBEXPR_COMPONENT_CLASS_REF>( 0 );
412 else if( aVar == wxT(
"B" ) )
413 return std::make_unique<PCBEXPR_COMPONENT_CLASS_REF>( 1 );
417 else if( aField.CmpNoCase( wxT(
"NetName" ) ) == 0 )
419 if( aVar == wxT(
"A" ) )
420 return std::make_unique<PCBEXPR_NETNAME_REF>( 0 );
421 else if( aVar == wxT(
"B" ) )
422 return std::make_unique<PCBEXPR_NETNAME_REF>( 1 );
426 else if( aField.CmpNoCase( wxT(
"Type" ) ) == 0 )
428 if( aVar == wxT(
"A" ) )
429 return std::make_unique<PCBEXPR_TYPE_REF>( 0 );
430 else if( aVar == wxT(
"B" ) )
431 return std::make_unique<PCBEXPR_TYPE_REF>( 1 );
436 if( aVar == wxT(
"A" ) || aVar == wxT(
"AB" ) )
437 vref = std::make_unique<PCBEXPR_VAR_REF>( 0 );
438 else if( aVar == wxT(
"B" ) )
439 vref = std::make_unique<PCBEXPR_VAR_REF>( 1 );
440 else if( aVar == wxT(
"L" ) )
441 vref = std::make_unique<PCBEXPR_VAR_REF>( 2 );
445 if( aField.length() == 0 )
450 wxString field( aField );
451 field.Replace( wxT(
"_" ), wxT(
" " ) );
461 vref->AddAllowedClass( cls.type, prop );
478 vref->SetIsEnum (
true );
482 wxFAIL_MSG( wxT(
"PCBEXPR_UCODE::createVarRef: Unknown property type." ) );
510 static const std::vector<wxString> pcbUnits = { wxT(
"mil" ), wxT(
"mm" ), wxT(
"in" ) };
518 return _(
"must be mm, in, or mil" );
524 double v = wxAtof( aString );
538 static const std::vector<wxString> emptyUnits;
546 return wxAtof( aString );
562 m_compiler( aUnitResolver ),
constexpr EDA_IU_SCALE pcbIUScale
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
BASE_SET & set(size_t pos)
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
virtual NETCLASS * GetEffectiveNetClass() const
Return the NETCLASS for this item.
wxString GetNetname() const
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Information pertinent to a Pcbnew printed circuit board.
PCB_LAYER_ID GetLayerID(const wxString &aLayerName) const
Return the ID of a layer.
std::unordered_map< wxString, LSET > m_LayerExpressionCache
std::shared_mutex m_CachesMutex
KICAD_T Type() const
Returns the type of object.
static ENUM_MAP< T > & Instance()
wxAny Get(PROPERTY_BASE *aProperty) const
std::unique_ptr< UNIT_RESOLVER > m_unitResolver
bool Compile(const wxString &aString, UCODE *aCode, CONTEXT *aPreflightContext)
VALUE * Run(CONTEXT *ctx)
virtual const wxString & AsString() const
virtual bool NotEqualTo(CONTEXT *aCtx, const VALUE *b) const
virtual double AsDouble() const
VAR_TYPE_T GetType() const
virtual bool EqualTo(CONTEXT *aCtx, const VALUE *b) const
LSET is a set of PCB_LAYER_IDs.
bool Contains(PCB_LAYER_ID aLayer) const
See if the layer set contains a PCB layer.
const wxString GetVariableSubstitutionName() const
Gets the name of this (maybe aggregate) netclass in a format for label variable substitutions.
LIBEVAL::FUNC_CALL_REF Get(const wxString &name)
static PCBEXPR_BUILTIN_FUNCTIONS & Instance()
PCBEXPR_COMPILER(LIBEVAL::UNIT_RESOLVER *aUnitResolver)
LIBEVAL::VALUE * GetValue(LIBEVAL::CONTEXT *aCtx) override
bool NotEqualTo(LIBEVAL::CONTEXT *aCtx, const LIBEVAL::VALUE *b) const override
const wxString & AsString() const override
PCBEXPR_COMPONENT_CLASS_VALUE(BOARD_ITEM *aItem)
bool EqualTo(LIBEVAL::CONTEXT *aCtx, const VALUE *b) const override
PCB_LAYER_ID GetLayer() const
BOARD_ITEM * GetItem(int index) const
PCBEXPR_EVALUATOR(LIBEVAL::UNIT_RESOLVER *aUnitResolver)
PCBEXPR_COMPILER m_compiler
bool Evaluate(const wxString &aExpr)
PCBEXPR_LAYER_VALUE(PCB_LAYER_ID aLayer)
virtual bool EqualTo(LIBEVAL::CONTEXT *aCtx, const VALUE *b) const override
LIBEVAL::VALUE * GetValue(LIBEVAL::CONTEXT *aCtx) override
bool EqualTo(LIBEVAL::CONTEXT *aCtx, const VALUE *b) const override
BOARD_CONNECTED_ITEM * m_item
PCBEXPR_NETCLASS_VALUE(BOARD_CONNECTED_ITEM *aItem)
const wxString & AsString() const override
bool NotEqualTo(LIBEVAL::CONTEXT *aCtx, const LIBEVAL::VALUE *b) const override
LIBEVAL::VALUE * GetValue(LIBEVAL::CONTEXT *aCtx) override
bool EqualTo(LIBEVAL::CONTEXT *aCtx, const VALUE *b) const override
BOARD_CONNECTED_ITEM * m_item
PCBEXPR_NET_VALUE(BOARD_CONNECTED_ITEM *aItem)
bool NotEqualTo(LIBEVAL::CONTEXT *aCtx, const LIBEVAL::VALUE *b) const override
const wxString & AsString() const override
bool EqualTo(LIBEVAL::CONTEXT *aCtx, const VALUE *b) const override
PCBEXPR_PINTYPE_VALUE(const wxString &aPinTypeName)
LIBEVAL::VALUE * GetValue(LIBEVAL::CONTEXT *aCtx) override
virtual std::unique_ptr< LIBEVAL::VAR_REF > CreateVarRef(const wxString &aVar, const wxString &aField) override
virtual LIBEVAL::FUNC_CALL_REF CreateFuncCall(const wxString &aName) override
const std::vector< wxString > & GetSupportedUnits() const override
double Convert(const wxString &aString, int unitId) const override
double Convert(const wxString &aString, int unitId) const override
wxString GetSupportedUnitsMessage() const override
const std::vector< wxString > & GetSupportedUnits() const override
std::unordered_map< TYPE_ID, PROPERTY_BASE * > m_matchingTypes
LIBEVAL::VALUE * GetValue(LIBEVAL::CONTEXT *aCtx) override
LIBEVAL::VAR_TYPE_T m_type
BOARD_ITEM * GetObject(const LIBEVAL::CONTEXT *aCtx) const
virtual size_t TypeHash() const =0
Return type-id of the property type.
virtual bool HasChoices() const
Return true if this PROPERTY has a limited set of possible values.
Provide class metadata.Helper macro to map type hashes to names.
CLASSES_INFO GetAllClasses()
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
bool IsOfType(TYPE_ID aDerived, TYPE_ID aBase) const
Return true if aDerived is inherited from aBase.
wxString LayerName(int aLayer)
Returns the default display name for a given layer.
PCB_LAYER_ID
A quick note on layer IDs:
PCB_LAYER_ID ToLAYER_ID(int aLayer)
KICOMMON_API double DoubleValueFromString(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Function DoubleValueFromString converts aTextValue to a double.
std::function< void(CONTEXT *, void *)> FUNC_CALL_REF
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint