61 const wxString& layerName = b->AsString();
63 std::unique_lock<std::mutex> cacheLock( board->
m_CachesMutex );
69 for(
unsigned ii = 0; ii < layerMap.GetCount(); ++ii )
71 wxPGChoiceEntry& entry = layerMap[ii];
73 if( entry.GetText().Matches( layerName ) )
124 str = item->
Get<wxString>( it->second );
129 const wxAny& any = item->
Get( it->second );
132 if( it->second->Name() == wxT(
"Layer" ) )
136 else if( any.GetAs<wxString>( &str ) )
141 if( any.GetAs<wxString>( &str ) )
189 return registry.
Get( aName.Lower() );
194 const wxString& aField )
197 std::unique_ptr<PCB_EXPR_VAR_REF> vref;
201 if( aField.CmpNoCase( wxT(
"NetClass" ) ) == 0 )
203 if( aVar == wxT(
"A" ) )
204 return std::make_unique<PCB_EXPR_NETCLASS_REF>( 0 );
205 else if( aVar == wxT(
"B" ) )
206 return std::make_unique<PCB_EXPR_NETCLASS_REF>( 1 );
210 else if( aField.CmpNoCase( wxT(
"NetName" ) ) == 0 )
212 if( aVar == wxT(
"A" ) )
213 return std::make_unique<PCB_EXPR_NETNAME_REF>( 0 );
214 else if( aVar == wxT(
"B" ) )
215 return std::make_unique<PCB_EXPR_NETNAME_REF>( 1 );
219 else if( aField.CmpNoCase( wxT(
"Type" ) ) == 0 )
221 if( aVar == wxT(
"A" ) )
222 return std::make_unique<PCB_EXPR_TYPE_REF>( 0 );
223 else if( aVar == wxT(
"B" ) )
224 return std::make_unique<PCB_EXPR_TYPE_REF>( 1 );
229 if( aVar == wxT(
"A" ) || aVar == wxT(
"AB" ) )
230 vref = std::make_unique<PCB_EXPR_VAR_REF>( 0 );
231 else if( aVar == wxT(
"B" ) )
232 vref = std::make_unique<PCB_EXPR_VAR_REF>( 1 );
233 else if( aVar == wxT(
"L" ) )
234 vref = std::make_unique<PCB_EXPR_VAR_REF>( 2 );
238 if( aField.length() == 0 )
240 return std::move( vref );
243 wxString field( aField );
244 field.Replace( wxT(
"_" ), wxT(
" " ) );
254 vref->AddAllowedClass( cls.type, prop );
271 vref->SetIsEnum (
true );
275 wxFAIL_MSG( wxT(
"PCB_EXPR_UCODE::createVarRef: Unknown property type." ) );
284 return std::move( vref );
303 static const std::vector<wxString> pcbUnits = { wxT(
"mil" ), wxT(
"mm" ), wxT(
"in" ) };
311 return _(
"must be mm, in, or mil" );
317 double v = wxAtof( aString );
331 static const std::vector<wxString> emptyUnits;
339 return wxAtof( aString );
355 m_compiler( aUnitResolver ),
constexpr EDA_IU_SCALE pcbIUScale
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
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 double AsDouble() const
VAR_TYPE_T GetType() const
LSET is a set of PCB_LAYER_IDs.
bool Contains(PCB_LAYER_ID aLayer)
See if the layer set contains a PCB layer.
const wxString GetName() const
LIBEVAL::FUNC_CALL_REF Get(const wxString &name)
static PCB_EXPR_BUILTIN_FUNCTIONS & Instance()
PCB_EXPR_COMPILER(LIBEVAL::UNIT_RESOLVER *aUnitResolver)
BOARD_ITEM * GetItem(int index) const
PCB_LAYER_ID GetLayer() const
bool Evaluate(const wxString &aExpr)
PCB_EXPR_EVALUATOR(LIBEVAL::UNIT_RESOLVER *aUnitResolver)
PCB_EXPR_COMPILER m_compiler
LIBEVAL::VALUE * GetValue(LIBEVAL::CONTEXT *aCtx) override
LIBEVAL::VALUE * GetValue(LIBEVAL::CONTEXT *aCtx) override
LIBEVAL::VALUE * GetValue(LIBEVAL::CONTEXT *aCtx) override
virtual LIBEVAL::FUNC_CALL_REF CreateFuncCall(const wxString &aName) override
virtual std::unique_ptr< LIBEVAL::VAR_REF > CreateVarRef(const wxString &aVar, const wxString &aField) override
BOARD_ITEM * GetObject(const LIBEVAL::CONTEXT *aCtx) const
std::unordered_map< TYPE_ID, PROPERTY_BASE * > m_matchingTypes
LIBEVAL::VAR_TYPE_T m_type
LIBEVAL::VALUE * GetValue(LIBEVAL::CONTEXT *aCtx) override
PCB_LAYER_VALUE(PCB_LAYER_ID aLayer)
virtual bool EqualTo(LIBEVAL::CONTEXT *aCtx, const VALUE *b) const 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
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)
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
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".