32#include <unordered_set>
60 class INSTANCE_FIELD :
public SCH_FIELD
63 INSTANCE_FIELD(
const SCH_FIELD& aField,
const SCH_SHEET_PATH& aPath ) :
67 ClearBoundingBoxCache();
72 const wxString variant = Schematic() ? Schematic()->GetCurrentVariant() : wxString();
77 const SCH_SHEET_PATH& m_path;
81 void SortUnique( std::vector<T>& aValues )
83 std::sort( aValues.begin(), aValues.end() );
84 aValues.erase( std::unique( aValues.begin(), aValues.end() ), aValues.end() );
87 constexpr auto ById = [](
const auto& a,
const auto& b )
92 void ReadLabel(
ITEM_FACT& aFact,
const SCH_LABEL_BASE& aLabel )
94 aFact.rawText = aLabel.
GetText();
97 for(
const SCH_FIELD& field : aLabel.
GetFields() )
99 if( field.GetUntranslatedName() == wxS(
"Netclass" ) )
100 aFact.netclassFields.push_back( field.GetText() );
112 result.style.m_Font =
nullptr;
123 if( ( aCompareFlags & FLAGS::FIELD_SIZE_AND_STYLE )
129 if( ( aCompareFlags & FLAGS::FIELD_VISIBILITY )
136 && ( !( aCompareFlags & FLAGS::FIELD_POSITIONS ) ||
position == aOther.
position );
140 const wxString& aVariantName )
142 wxASSERT( wxThread::IsMain() );
145 throw std::logic_error(
"Simulation sources require published connectivity text" );
147 std::vector<SIMULATION_MODEL_FACT>
result;
155 const auto* symbol =
static_cast<const SCH_SYMBOL*
>( item );
157 if( symbol->GetRef( &aPath ).StartsWith(
'#' ) || symbol->ResolveExcludedFromSim( &aPath, aVariantName ) )
160 result.push_back( { symbol->m_Uuid, symbol->GetPosition(),
171 wxASSERT( wxIsMainThread() );
182 if( variant.m_SymbolOverride )
183 result.overrides.emplace(
name, *variant.m_SymbolOverride );
186 if(
result.overrides.empty() )
194 wxASSERT( wxIsMainThread() );
196 result.hasEmbeddedSymbol =
true;
205 result.pins.push_back(
static_cast<const SCH_PIN&
>(
pin ).ComparisonData() );
209 const auto& shape =
static_cast<const SCH_SHAPE&
>( drawing );
210 result.shapes.push_back( { shape.m_Uuid, shape.GetUnit(), shape.GetBodyStyle(), shape.IsPrivate(),
211 shape.GetPosition(), shape } );
216 result.inheritedPins.emplace();
219 result.inheritedPins->push_back(
pin->ComparisonData() );
228 std::vector<std::pair<wxString, size_t>> logical;
230 for(
size_t i = 0; i < source.size(); ++i )
235 if( !valid || numbers.empty() )
236 numbers = { source[i].number };
238 for(
const auto& number : numbers )
239 logical.emplace_back( number, i );
242 std::sort( logical.begin(), logical.end(), [&](
const auto& a,
const auto& b )
244 return std::tie( a.first, source[a.second].bodyStyle, source[a.second].unit, a.second )
245 < std::tie( b.first, source[b.second].bodyStyle, source[b.second].unit, b.second );
248 const auto clash = [&](
const auto& a,
const auto& b )
250 const int first = source[a.second].bodyStyle;
251 const int second = source[b.second].bodyStyle;
252 return a.first == b.first && a.second != b.second && ( !first || !second || first == second );
255 return std::ranges::adjacent_find( logical, clash ) != logical.end();
261 wxCHECK_MSG( !( aCompareFlags & FLAGS::IDENTITY ),
false,
262 "Captured library comparison requires content-only flags" );
275 return a->
Compare( *b, ~FLAGS::UUID ) < 0;
280 for(
const auto& shape :
shapes )
281 lhsShapes.insert( &shape );
283 for(
const auto& shape : aOther.
shapes )
284 rhsShapes.insert( &shape );
286 if( lhsShapes.size() != rhsShapes.size() )
289 for(
auto lhs = lhsShapes.begin(), rhs = rhsShapes.begin(); lhs != lhsShapes.end(); ++lhs, ++rhs )
291 if( ( *lhs )->Compare( **rhs, aCompareFlags ) != 0 )
300 for(
const auto& candidate : candidates )
302 if( candidate.number == aPin.number
303 && ( !aPin.unit || !candidate.unit || aPin.unit == candidate.unit )
304 && ( !aPin.bodyStyle || !candidate.bodyStyle || aPin.bodyStyle == candidate.bodyStyle ) )
315 const auto* other = findPin( aOther,
pin );
317 if( !other ||
pin.Compare( *other, aCompareFlags ) != 0 )
321 for(
const auto&
pin : aOther.
pins )
323 if( !findPin( *
this,
pin ) )
330 for(
const auto& candidate : aSource.
fields )
332 if( aField.mandatory ? candidate.id == aField.id : candidate.name == aField.name )
339 for(
const auto& field :
fields )
341 const auto* other =
findField( aOther, field );
345 if( aCompareFlags & FLAGS::EXTRA_FIELDS )
348 else if( !field.Matches( *other, aCompareFlags ) )
354 if( aCompareFlags & FLAGS::MISSING_FIELDS )
356 for(
const auto& field : aOther.
fields )
369 const auto sign = [](
int aLeft,
int aRight )
371 return ( aLeft > aRight ) - ( aLeft < aRight );
399 return id < aOther.
id ? -1 : 1;
424 for(
int i = 0; i <
polygon.OutlineCount(); ++i )
426 const auto& first =
polygon.CPolygon( i );
429 if( first.size() != second.size() )
432 for(
size_t j = 0; j < first.size(); ++j )
434 if( first[j].CPoints() != second[j].CPoints() || first[j].CArcs() != second[j].CArcs()
435 || first[j].CShapes() != second[j].CShapes() || first[j].IsClosed() != second[j].IsClosed() )
462 wxASSERT( wxIsMainThread() );
465 std::vector<const SCH_RULE_AREA*> areas;
466 std::unordered_set<KIID> identities;
470 aUnchangedNonLines =
nullptr;
472 if( aUnchangedNonLines )
474 result = *aUnchangedNonLines;
475 std::erase_if(
result.items, [](
const ITEM_FACT& fact ) { return fact.type == SCH_LINE_T; } );
476 aLibrarySymbols =
result.librarySymbols;
479 identities.reserve( items.
size() );
481 auto libraries = aLibrarySymbols ? nullptr : std::make_shared<LIBRARY_SYMBOL_FACTS>();
482 result.librarySymbols = aLibrarySymbols ? std::move( aLibrarySymbols ) : libraries;
486 libraries->reserve( std::count_if( items.
begin(), items.
end(), [](
const SCH_ITEM* item )
488 return item->Type() == SCH_SYMBOL_T;
492 const auto checkIdentity = [&](
const KIID& aId )
494 if( !identities.insert( aId ).second )
495 throw std::runtime_error(
"Duplicate connectivity source identity" );
500 checkIdentity( item->m_Uuid );
502 if( aUnchangedNonLines && item->Type() !=
SCH_LINE_T )
506 for(
const auto&
pin :
static_cast<const SCH_SYMBOL*
>( item )->GetRawPins() )
507 checkIdentity(
pin->m_Uuid );
512 checkIdentity(
pin->m_Uuid );
518 bool hasNetclass =
false;
525 const auto* field =
static_cast<SCH_FIELD*
>( child );
527 if( field->GetUntranslatedName() == wxS(
"Netclass" ) )
532 const wxString
name = field->GetName();
533 wxString trimmed =
name;
535 if( trimmed.Trim(
false ).Trim(
true ) !=
name )
537 result.invalidFieldNames.push_back(
538 { item->m_Uuid, field->m_Uuid, field->GetPosition(),
name } );
547 result.netclassOwners.push_back( item->m_Uuid );
551 areas.push_back(
static_cast<const SCH_RULE_AREA*
>( item ) );
557 const auto& symbol = *
static_cast<const SCH_SYMBOL*
>( item );
558 const auto&
library = symbol.GetLibSymbolRef();
562 auto& librarySource = libraries->emplace_back();
567 librarySource.id = symbol.m_Uuid;
568 librarySource.position = symbol.GetPosition();
569 librarySource.library = symbol.GetLibId();
577 result.footprints.push_back( { symbol.m_Uuid, symbol.GetPosition(),
581 result.pinMaps.push_back( std::move( *maps ) );
583 std::map<std::tuple<wxString, int, int>,
size_t> groups;
584 std::map<wxString, std::vector<size_t>> numbers;
585 const bool hasJumperGroups =
library && !
library->JumperPinGroups().IsEmpty();
588 const bool joinApart =
library &&
library->GetDuplicatePinNumbersAreJumpers();
590 for(
const std::unique_ptr<SCH_PIN>&
pin : symbol.GetRawPins() )
592 checkIdentity(
pin->m_Uuid );
595 const auto key = std::make_tuple(
pin->GetNumber(), contact.
x, contact.
y );
596 auto found = nc ? groups.end() : groups.find( key );
599 if( found == groups.end() )
603 fact.
id =
pin->m_Uuid;
605 fact.
owner = symbol.m_Uuid;
608 result.items.push_back( std::move( fact ) );
611 groups.emplace( key,
index );
615 index = found->second;
620 const bool valid =
pin->GetLibPin() &&
library && !symbol.IsMissingLibSymbol();
622 member.
id =
pin->m_Uuid;
637 if(
const SCH_PIN* libPin =
pin->GetLibPin() )
640 member.
padNumber = libPin->GetSmallestStackedPadNumber();
643 fact.
pins.push_back( std::move( member ) );
645 if( !nc && hasJumperGroups )
647 numbers[
pin->GetNumber()].push_back(
index );
649 for(
const wxString& number :
pin->GetStackedPinNumbers() )
650 numbers[number].push_back(
index );
654 if( hasJumperGroups )
658 std::vector<size_t> indices;
660 for(
const wxString& number :
group.GetNames() )
662 if(
auto it = numbers.find( number ); it != numbers.end() )
663 indices.insert( indices.end(), it->second.begin(), it->second.end() );
666 SortUnique( indices );
668 for(
size_t first : indices )
670 for(
size_t second : indices )
672 if( first != second )
673 result.items[first].jumperedWith.push_back(
result.items[second].id );
686 checkIdentity(
pin->m_Uuid );
688 fact.
id =
pin->m_Uuid;
690 fact.
owner = item->m_Uuid;
692 ReadLabel( fact, *
pin );
693 result.items.push_back( std::move( fact ) );
699 if( !item->IsConnectable() )
703 fact.
id = item->m_Uuid;
704 fact.
type = item->Type();
709 const auto& line = *
static_cast<const SCH_LINE*
>( item );
711 fact.
segment.emplace( line.GetStartPoint(), line.GetEndPoint() );
719 fact.
ports = { { entry.GetPosition(), kind }, { entry.GetEnd(), kind } };
723 for(
const VECTOR2I& point : item->GetConnectionPoints() )
724 fact.
ports.push_back( { point, kind } );
728 ReadLabel( fact, *label );
730 result.items.push_back( std::move( fact ) );
735 std::ranges::sort( *libraries, ById );
737 if( !aUnchangedNonLines )
739 std::ranges::sort(
result.footprints, ById );
740 std::ranges::sort(
result.pinMaps, ById );
741 std::ranges::sort(
result.multiUnits, ById );
744 SortUnique(
result.netclassOwners );
745 std::ranges::sort(
result.invalidFieldNames,
746 [](
const auto& a,
const auto& b )
748 return std::tie( a.owner, a.field ) < std::tie( b.owner, b.field );
753 std::ranges::sort( fact.
pins, ById );
757 std::ranges::sort(
result.items, ById );
762 fact.
id = area->m_Uuid;
763 fact.
polygon = area->GetPolyShape();
764 const auto& polygon = fact.
polygon;
770 if( !item.
ports.empty() && polygon.CollideEdge( item.
ports.front().position,
nullptr, 5 ) )
777 if( polygon.Collide( &segment ) )
784 if( polygon.Collide( port.
position ) )
790 if( polygon.Collide(
pin.position ) )
798 result.ruleAreas.push_back( std::move( fact ) );
801 std::ranges::sort(
result.ruleAreas, ById );
807 wxASSERT( wxThread::IsMain() );
808 std::vector<TEXT_ASSERTION>
result;
810 if( !aText.Contains( wxS(
"${" ) ) )
813 static wxRegEx warningExpr( wxS(
"(^|[^\\\\])\\$\\{ERC_WARNING\\s*([^}]*)\\}" ) );
814 static wxRegEx errorExpr( wxS(
"(^|[^\\\\])\\$\\{ERC_ERROR\\s*([^}]*)\\}" ) );
816 for(
bool warning : {
true,
false } )
818 wxRegEx& expression = warning ? warningExpr : errorExpr;
819 wxString remaining = aText;
821 while( expression.Matches( remaining ) )
823 result.push_back( { warning, expression.GetMatch( remaining, 2 ) } );
827 if( !expression.GetMatch( &start, &length, 0 ) || length == 0 )
830 remaining = remaining.Mid( start + length );
839 wxASSERT( wxThread::IsMain() );
840 std::vector<TEXT_CHECK_FACT>
result;
852 drawing.
SetVariantDesc( schematic->GetVariantDescription( schematic->GetCurrentVariant() ) );
865 const wxString shown = assertions.empty() ?
text->GetShownText(
FOR_ERC_DRC ) : wxString();
867 if( !assertions.empty() || shown.Contains( wxS(
"${" ) ) )
870 std::move( assertions ), shown } );
880 wxASSERT( wxThread::IsMain() );
881 std::vector<TEXT_CHECK_FACT>
result;
882 auto append = [&](
const KIID& assertionItem,
const KIID& item,
const VECTOR2I& assertionPosition,
883 const wxString& raw,
bool expandEnvironment,
auto&& resolve )
887 if( !assertions.empty() )
889 result.push_back( { assertionItem, item, assertionPosition, assertionPosition,
890 std::move( assertions ), wxString() } );
894 auto [shown, position] = resolve();
895 const auto* schematic = aScreen.
Schematic();
897 if( expandEnvironment && shown.find_first_of( wxS(
"$%" ) ) != wxString::npos )
900 if( shown.Contains( wxS(
"${" ) ) )
901 result.push_back( { assertionItem, item, assertionPosition, position, {}, std::move( shown ) } );
903 auto fields = [&](
const auto& owner )
905 for(
const SCH_FIELD& field : owner.GetFields() )
907 append( field.m_Uuid, owner.m_Uuid, field.GetPosition(), field.GetText(),
true, [&]
909 return std::make_pair( field.GetShownText( &aPath, FOR_ERC_DRC ), field.GetPosition() );
918 const auto& symbol = *
static_cast<SCH_SYMBOL*
>( item );
921 if(
const auto&
library = symbol.GetLibSymbolRef() )
925 auto text = [&](
const auto& source,
auto&& shown )
927 append( symbol.m_Uuid, symbol.m_Uuid, source.GetPosition(), source.GetText(),
true, [&]
929 wxString shownText = shown();
930 const BOX2I box = symbol.GetTransform().TransformCoordinate( source.GetBoundingBox() );
931 return std::make_pair( std::move( shownText ), box.Centre() + symbol.GetPosition() );
937 const auto& source = *
static_cast<SCH_TEXT*
>( child );
938 text( source, [&] {
return source.GetShownText( &aPath,
FOR_ERC_DRC ); } );
942 const auto& source = *
static_cast<SCH_TEXTBOX*
>( child );
943 text( source, [&] {
return source.GetShownText(
nullptr, &aPath,
FOR_ERC_DRC ); } );
948 else if(
const auto* label =
dynamic_cast<SCH_LABEL_BASE*
>( item ) )
954 auto& sheet = *
static_cast<SCH_SHEET*
>( item );
961 append(
niluuid,
pin->m_Uuid,
pin->GetPosition(), wxString(),
false, [&]
963 return std::make_pair(
pin->GetShownText( &childPath,
FOR_ERC_DRC ),
pin->GetPosition() );
967 else if(
const auto*
text =
dynamic_cast<SCH_TEXT*
>( item ) )
969 append(
text->m_Uuid,
text->m_Uuid,
text->GetPosition(),
text->GetText(),
false, [&]
971 return std::make_pair( text->GetShownText( &aPath, FOR_ERC_DRC ), text->GetPosition() );
974 else if(
const auto* textbox =
dynamic_cast<SCH_TEXTBOX*
>( item ) )
976 append( textbox->m_Uuid, textbox->m_Uuid, textbox->GetPosition(), textbox->GetText(),
false, [&]
978 return std::make_pair( textbox->GetShownText( nullptr, &aPath, FOR_ERC_DRC ), textbox->GetPosition() );
995 const auto& footprints = lib->GetEffectiveAssociatedFootprints();
997 if( maps.IsEmpty() && footprints.empty() )
1004 result.footprints = footprints;
1005 result.jumperGroups = lib->JumperPinGroups();
1008 result.pinNumbers.insert(
pin->GetNumber() );
1015 std::vector<UNIT_FACT>
result;
1017 for(
int unit = 1; unit <= aSymbol.
GetUnitCount(); ++unit )
1029 result.push_back( std::move( fact ) );
1038 wxASSERT( wxIsMainThread() );
1041 throw std::invalid_argument(
"Connectivity instance does not reference its screen" );
1043 std::optional<TEXT_EVAL_VCS::CONTEXT_PATH_SCOPE> vcs;
1045 if(
const auto* schematic = aScreen.
Schematic(); schematic && schematic->
IsValid() )
1047 if(
const wxString
path = schematic->Project().GetProjectPath(); !
path.IsEmpty() )
1048 vcs.emplace(
path );
1055 wxString plainReference;
1056 std::map<wxString, std::set<wxString>> numbersByName;
1061 std::map<KIID, int> units;
1062 std::map<KIID, SYMBOL_TEXT> symbols;
1063 std::set<KIID> inactivePins;
1073 throw std::runtime_error(
"Footprint symbol disappeared during extraction" );
1075 result.footprints.emplace_back( fact.
id, symbol->GetFootprintFieldText( &aPath,
RESOLVED ) );
1078 result.variantSymbols.push_back( std::move( *source ) );
1083 if( fact.footprints.empty() )
1089 throw std::runtime_error(
"Pin-map symbol disappeared during extraction" );
1091 const wxString footprint = symbol->GetFootprintFieldText( &aPath,
RESOLVED );
1094 if( footprint.IsEmpty() || footprintId.
Parse( footprint,
true ) >= 0 )
1097 for(
const SCH_PIN*
pin : symbol->GetPins( &aPath ) )
1100 pin->GetEffectivePadNumber( aPath, variant, footprintId,
nullptr, &state );
1102 if( state == SCH_PIN::PAD_RESOLUTION::MAPPED )
1105 const auto type =
pin->GetType();
1106 result.pinMapCandidates.push_back( {
pin->m_Uuid,
pin->GetPosition(),
pin->GetNumber(), footprint,
1116 throw std::runtime_error(
"Multiunit symbol disappeared during extraction" );
1118 result.multiUnits.push_back( { fact.
id, symbol->GetRef( &aPath ), symbol->GetRef( &aPath,
true ),
1119 symbol->GetFootprintFieldText( &aPath,
RESOLVED ), symbol->GetUnitSelection( &aPath ) } );
1125 const auto* sheet =
static_cast<const SCH_SHEET*
>( item );
1126 result.childSheets.push_back( { sheet->m_Uuid, sheet->GetPosition(),
1135 throw std::invalid_argument(
"Netclass field owner is missing from its captured screen" );
1143 const auto* field =
static_cast<SCH_FIELD*
>( child );
1145 if( field->GetUntranslatedName() == wxS(
"Netclass" ) )
1150 result.netclassReferences.push_back(
1163 auto [entry, inserted] = symbols.try_emplace( fact.owner );
1164 SYMBOL_TEXT& cached = entry->second;
1170 if( !cached.symbol )
1171 throw std::runtime_error(
"Connectivity symbol disappeared during extraction" );
1173 units.emplace( fact.owner, cached.symbol->GetUnitSelection( &aPath ) );
1175 const bool hasInstance = cached.symbol->GetInstance( instance, aPath.
Path() );
1176 cached.reference.symbolUuid = cached.symbol->m_Uuid.AsString();
1180 cached.reference.reference = instance.
m_Reference;
1181 cached.reference.referenceWithUnit = cached.symbol->GetRef( &aPath,
true );
1184 cached.plainReference = cached.symbol->GetRef( &aPath );
1186 for(
const SCH_PIN*
pin : cached.symbol->GetPins( &aPath ) )
1189 cached.numbersByName[
pin->GetShownName()].insert(
pin->GetShownNumber() );
1194 const int unit = units.at( fact.owner );
1197 for(
const PIN_FACT& member : fact.pins )
1199 if( unit && member.
unit && unit != member.
unit )
1201 inactivePins.insert( member.
id );
1208 throw std::runtime_error(
"Connectivity pin disappeared during extraction" );
1213 text.reference = cached.plainReference;
1219 :
pin->GetLibPin()->GetName(),
1229 name.number = libPin ? libPin->
GetNumber() : wxString(
"??" );
1233 const auto names = cached.numbersByName.find(
pin->GetShownName() );
1235 if( names != cached.numbersByName.end() )
1237 const auto& numbers = names->second;
1238 name.hasDuplicateName = numbers.size() > 1 || !numbers.contains(
pin->GetShownNumber() );
1244 && !reference.
reference.StartsWith( wxS(
"#" ) );
1269 for(
const SCH_FIELD& field : label->GetFields() )
1271 if( field.GetUntranslatedName() == wxS(
"Netclass" ) )
1275 if( !value.empty() )
1276 text.netclasses.push_back( std::move( value ) );
1280 SortUnique(
text.netclasses );
1284 std::map<KIID, BOX2I> ownerBoxes;
1292 const auto& symbol = *
static_cast<const SCH_SYMBOL*
>( item );
1294 units.emplace( symbol.m_Uuid, unit );
1300 BOX2I box =
library->GetBodyBoundingBox( unit, symbol.GetBodyStyle(),
true,
false );
1301 box = symbol.GetTransform().TransformCoordinate( box );
1303 box.
Offset( symbol.GetPosition() );
1305 for(
const SCH_FIELD& field : symbol.GetFields() )
1307 if( field.IsVisible() )
1308 box.
Merge( INSTANCE_FIELD( field, aPath ).GetBoundingBox() );
1311 ownerBoxes.emplace( symbol.m_Uuid, box );
1315 const auto& sheet = *
static_cast<const SCH_SHEET*
>( item );
1316 BOX2I box = sheet.GetBodyBoundingBox();
1318 for(
const SCH_FIELD& field : sheet.GetFields() )
1319 box.
Merge( INSTANCE_FIELD( field, aPath ).GetBoundingBox() );
1321 ownerBoxes.emplace( sheet.m_Uuid, box );
1329 resolved.
id = area.
id;
1332 std::erase_if( resolved.
containedItems, [&](
const KIID&
id ) { return inactivePins.contains( id ); } );
1334 for(
const auto& [
id, box] : ownerBoxes )
1350 result.ruleAreas.push_back( std::move( resolved ) );
1353 result.units.assign( units.begin(), units.end() );
1354 std::ranges::sort(
result.items, ById );
constexpr EDA_IU_SCALE schIUScale
constexpr BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
constexpr void Offset(coord_type dx, coord_type dy)
Base class to handle basic graphic items.
Store the list of graphic items: rect, lines, polygons and texts to draw/plot the title block and fra...
DS_DRAW_ITEM_BASE * GetFirst()
void SetVariantName(const wxString &aVariant)
Set the current variant name and description to draw/plot.
void BuildDrawItemsList(const PAGE_INFO &aPageInfo, const TITLE_BLOCK &aTitleBlock)
Drawing or plot the drawing sheet.
void SetSheetPath(const wxString &aSheetPath)
Set the sheet path to draw/plot.
void SetFileName(const wxString &aFileName)
Set the filename to draw/plot.
void SetVariantDesc(const wxString &aDesc)
void SetSheetName(const wxString &aSheetName)
Set the sheet name to draw/plot.
void SetIsFirstPage(bool aIsFirstPage)
Set if the page is the first page.
void SetSheetLayer(const wxString &aSheetLayer)
Set the sheet layer to draw/plot.
void SetSheetCount(int aSheetCount)
Set the value of the count of sheets, for basic inscriptions.
void SetPageNumber(const wxString &aPageNumber)
Set the value of the sheet number.
DS_DRAW_ITEM_BASE * GetNext()
void SetProject(const PROJECT *aProject)
virtual VECTOR2I GetPosition() const
KICAD_T Type() const
Returns the type of object.
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
const std::vector< VECTOR2I > & GetBezierPoints() const
VECTOR2I GetArcMid() const
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual bool IsVisible() const
KIFONT::FONT * GetFont() const
const TEXT_ATTRIBUTES & GetAttributes() const
Implement an R-tree for fast spatial and type indexing of schematic items.
size_t size() const
Return the number of items in the tree.
ee_rtree::Iterator begin() const
Return a read/write iterator that points to the first.
ee_rtree::Iterator end() const
Return a read/write iterator that points to one past the last element in the EE_RTREE.
EE_TYPE OfType(KICAD_T aType) const
Represents a group of jumper pins or pads, keyed by name.
A logical library item identifier and consists of various portions much like a URI.
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
Define a library symbol object.
std::vector< const SCH_PIN * > GetGraphicalPins(int aUnit=0, int aBodyStyle=0) const
Graphical pins: Return schematic pin objects as drawn (unexpanded), filtered by unit/body.
static LIB_SYMBOL * GetDummy()
Returns a dummy LIB_SYMBOL, used when one is missing in the schematic.
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
const PIN_MAP_SET & GetEffectivePinMaps() const
int GetBodyStyleCount() const override
The body styles are a property of the drawings, which a derived symbol inherits from its root symbol ...
LIB_SYMBOL_ATTRIBUTES ComparisonAttributes() const
int GetUnitCount() const override
wxString GetUnitDisplayName(int aUnit, bool aLabel) const override
Return the user-defined display name for aUnit for symbols with units.
Holds all the data relating to one schematic.
wxString GetCurrentVariant() const
Return the current variant being edited.
bool IsValid() const
A simple test if the schematic is loaded, not a complete one.
Base class for a bus or wire entry.
Excludes derived graph text and shares dynamic source values through nested resolvers.
VECTOR2I GetPosition() const override
virtual const wxString & GetText() const override
Return the string associated with the text object.
wxString GetShownText(const SCH_SHEET_PATH *aPath, RESOLUTION_CONTEXT aContext, const wxString &aVariantName=wxEmptyString, int aDepth=0) const
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
Base class for any item which can be embedded within the SCHEMATIC container class,...
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode)
COMPARE_FLAGS
The list of flags used by various compare functions.
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
LABEL_FLAG_SHAPE GetShape() const
std::vector< SCH_FIELD > & GetFields()
Segment description base class to describe items which have 2 end points (track, wire,...
PAD_RESOLUTION
Outcome of pin-to-pad resolution (issue #2282).
const wxString & GetShownName() const
const wxString & GetShownNumber() const
const wxString & GetNumber() const
wxString GetSmallestStackedPadNumber() const
Return the pin number to be used for deterministic operations such as auto‑generated net names.
const PAGE_INFO & GetPageSettings() const
EE_RTREE & Items()
Get the full RTree, usually for iterating.
const wxString & GetFileName() const
SCHEMATIC * Schematic() const
SCH_ITEM * GetConnectivityItem(const KIID &aId) const
Resolve a drawing item or a connectable child on this screen; ambiguous IDs return null.
TITLE_BLOCK & GetTitleBlock()
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
SCH_SCREEN * LastScreen()
wxString GetPageNumber() const
wxString PathHumanReadable(bool aUseShortRootName=true, bool aStripTrailingSeparator=false, bool aEscapeSheetNames=false) const
Return the sheet path in a human readable form made from the sheet names.
bool GetExcludedFromSim() const
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
const KIID_PATH & PathRef() const
Borrow the cached path until this sheet path is modified or destroyed.
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
int GetVirtualPageNumber() const
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
VECTOR2I GetPosition() const override
bool GetInstance(SCH_SYMBOL_INSTANCE &aInstance, const KIID_PATH &aSheetPath, bool aTestFromEnd=false) const
bool GetExcludedFromBoard(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
const wxString GetValue(const SCH_SHEET_PATH *aPath, RESOLUTION_CONTEXT aContext, const wxString &aVariantName=wxEmptyString) const override
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
Return the instance-specific unit selection for the given sheet path.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
bool Collide(const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance,...
int OutlineCount() const
Return the number of outlines in the set.
const POLYGON & CPolygon(int aIndex) const
static SIM_MODEL_INPUT CaptureModelInput(const SCH_SHEET_PATH *aSheetPath, const SCH_SYMBOL &aSymbol, int aDepth, const wxString &aVariantName, const wxString &aMergedSimPins=wxEmptyString)
Resolve instance fields once; editors use the field-based overloads for unresolved input.
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
static bool empty(const wxTextEntryBase *aCtrl)
Value keys and the key session of the schematic connectivity engine.
LIBRARY_FIELD_FACT ExtractLibraryFieldFact(const SCH_FIELD &aField)
std::optional< PIN_MAP_FACT > ExtractPinMapFacts(const SCH_SYMBOL &aSymbol)
INSTANCE_FACTS ExtractInstanceFacts(const SCREEN_FACTS &aFacts, const SCH_SCREEN &aScreen, const SCH_SHEET_PATH &aPath)
std::vector< SIMULATION_MODEL_FACT > ExtractSimulationModelFacts(const SCH_SHEET_PATH &aPath, const wxString &aVariantName)
std::vector< TEXT_CHECK_FACT > ExtractTextChecks(const SCH_SCREEN &aScreen, const SCH_SHEET_PATH &aPath)
wxString RenderPinNetName(const PIN_NAME_FACT &aPin, const PIN_NAME_REFERENCE &aReference, bool aForceNoConnect)
Render a non-power pin name from unescaped values; an absent reference uses the symbol UUID.
LIBRARY_SYMBOL_FACT ExtractLibrarySymbolFact(const LIB_SYMBOL &aSymbol)
std::vector< TEXT_ASSERTION > ExtractTextAssertions(const wxString &aText)
std::vector< TEXT_CHECK_FACT > ExtractDrawingSheetTextChecks(const SCH_SCREEN &aScreen, const SCH_SHEET_PATH &aPath)
SCREEN_FACTS ExtractScreenFacts(const SCH_SCREEN &aScreen, std::shared_ptr< const LIBRARY_SYMBOL_FACTS > aLibrarySymbols, const SCREEN_FACTS *aUnchangedNonLines)
Main-thread snapshots; no derived connectivity or model pointers survive extraction.
std::vector< LIBRARY_SYMBOL_FACT > LIBRARY_SYMBOL_FACTS
std::optional< VARIANT_SYMBOL_FACT > ExtractVariantSymbolFact(const SCH_SYMBOL &aSymbol, const SCH_SHEET_PATH &aPath)
std::vector< UNIT_FACT > ExtractUnitFacts(const LIB_SYMBOL &aSymbol)
@ PT_INPUT
usual pin input: must be connected
@ PT_NC
not connected (must be left open)
@ PT_NIC
not internally connected (may be connected to anything)
@ PT_BIDI
input or output (like port for a microprocessor)
@ PT_POWER_IN
power input (GND, VCC for ICs). Must be connected to a power output.
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
std::vector< wxString > ExpandStackedPinNotation(const wxString &aPinName, bool *aValid)
Expand stacked pin notation like [1,2,3], [1-4], [A1-A4], or [AA1-AA3,AB4,CD12-CD14] into individual ...
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
Owned library-pin inputs; no parent, layout cache or schematic pointers.
The text and unit data that one sheet instance resolves for the items of its screen.
std::vector< KIID > containedItems
std::vector< wxString > netclasses
std::vector< KIID > attachedDirectives
A value copy of one connectable item, or of one group of pins that share a number and a position.
KIID id
The item KIID, or the smallest member KIID of a pin group.
std::vector< PIN_FACT > pins
KIID owner
The parent symbol or sheet, or niluuid.
std::vector< KIID > jumperedWith
std::optional< SEG > segment
std::vector< PORT_FACT > ports
bool Matches(const LIBRARY_FIELD_FACT &aOther, int aCompareFlags) const
int Compare(const LIBRARY_SHAPE_FACT &aOther, int aCompareFlags) const
bool operator==(const LIBRARY_SHAPE_FACT &aOther) const
std::vector< LIBRARY_FIELD_FACT > fields
std::vector< PIN_COMPARISON_DATA > pins
std::optional< std::vector< PIN_COMPARISON_DATA > > inheritedPins
bool HasDuplicatePins() const
bool Matches(const LIBRARY_SYMBOL_FACT &aOther, int aCompareFlags) const
LIB_SYMBOL_ATTRIBUTES attributes
std::vector< LIBRARY_SHAPE_FACT > shapes
One connection point of an item.
std::vector< KIID > attachedDirectives
std::vector< KIID > containedItems
bool operator==(const RULE_AREA_FACT &aOther) const
The value copy of one screen.
bool operator==(const SCREEN_FACTS &aOther) const
std::vector< KIID > netclassOwners
std::vector< MULTI_UNIT_FACT > multiUnits
std::vector< FIELD_NAME_FACT > invalidFieldNames
std::vector< ITEM_FACT > items
const LIBRARY_SYMBOL_FACTS & LibrarySymbols() const
std::vector< RULE_AREA_FACT > ruleAreas
std::vector< PIN_MAP_FACT > pinMaps
std::vector< FOOTPRINT_FACT > footprints
std::shared_ptr< const LIBRARY_SYMBOL_FACTS > librarySymbols
A simple container for schematic symbol instance information.
std::map< wxString, SCH_SYMBOL_VARIANT > m_Variants
A list of symbol variants.
@ REFERENCE
Field Reference of part, i.e. "IC21".
@ VALUE
Field Value of part, i.e. "3.3K".
static const HTTP_LIB_PART::field_type * findField(const HTTP_LIB_PART &aPart, const std::string &aName)
Issue #23023.
wxString result
Test unit parsing edge cases and error handling.
constexpr int sign(T val)
VECTOR2< int32_t > VECTOR2I