76 m_fileFormatVersionAtLoad( 0 ),
77 m_paper( wxT(
"A4" ) ),
78 m_isReadOnly( false ),
103 wxT(
"SCH_SCREEN must have a SCHEMATIC parent!" ) );
111 for(
const std::pair<const wxString, LIB_SYMBOL*>& libSymbol :
m_libSymbols )
112 delete libSymbol.second;
120 wxASSERT( aFileName.IsEmpty() || wxIsAbsolutePath( aFileName ) );
134 wxCHECK_RET(
m_refCount != 0, wxT(
"Screen reference count already zero. Bad programmer!" ) );
143 return sheets.
begin() != sheets.
end();
188 std::vector<wxString> matches;
191 foundSymbol =
nullptr;
193 for(
const wxString& libSymbolName : matches )
200 foundSymbol = it->second;
202 wxCHECK2( foundSymbol,
continue );
212 newName = libSymbolName;
218 foundSymbol =
nullptr;
225 newName.Printf( wxT(
"%s_%d" ),
232 newName.Printf( wxT(
"%s_%d" ),
246 LIB_ID newLibId( wxEmptyString, newName );
250 newLibSymbol->
SetName( newName );
267 wxCHECK_RET( aScreen,
"Invalid screen object." );
274 aScreen->
Clear(
false );
301 std::vector<SCH_ITEM*> delete_list;
306 return ( aItem->Type() != SCH_SHEET_PIN_T && aItem->Type() != SCH_FIELD_T );
318 if(
Remove( aItem, aUpdateLibSymbol ) )
319 Append( aItem, aUpdateLibSymbol );
332 bool removeUnusedLibSymbol =
true;
340 removeUnusedLibSymbol =
false;
345 if( removeUnusedLibSymbol )
363 wxCHECK_RET( aItem, wxT(
"Cannot delete invalid item from screen." ) );
377 wxCHECK_RET( sheet, wxT(
"Sheet pin parent not properly set, bad programmer!" ) );
400 if( item->HitTest( aPosition, aAccuracy ) )
410#define PROCESSED CANDIDATE
412 std::set<SCH_ITEM*> retval;
413 std::stack<SCH_LINE*> to_search;
415 wxCHECK_MSG( aSegment && aSegment->
Type() ==
SCH_LINE_T, retval, wxT(
"Invalid pointer." ) );
417 to_search.push( aSegment );
419 while( !to_search.empty() )
450 retval.insert( junction );
452 retval.insert( line );
453 to_search.push( line );
455 else if( !junction && !
pin )
457 retval.insert( line );
458 to_search.push( line );
465 retval.insert( line );
466 to_search.push( line );
473 item->ClearTempFlags();
483 return info.isJunction;
492 return info.isJunction && ( !
info.hasBusEntry ||
info.hasBusEntryToMultipleWires );
501 return info.isJunction && ( !
info.hasBusEntry ||
info.hasBusEntryToMultipleWires )
502 && !
info.hasExplicitJunctionDot;
511 return info.isJunction && (!
info.hasBusEntry ||
info.hasBusEntryToMultipleWires );
519 auto ret = aDefaultOrientation;
525 switch( item->Type() )
530 if( busEntry->m_connected_bus_item )
534 auto bus =
static_cast<const SCH_LINE*
>( busEntry->m_connected_bus_item );
535 if( bus->Angle().AsDegrees() == 90.0 )
539 if( aPosition.
x < bus->GetPosition().x )
541 else if( aPosition.
x > bus->GetPosition().x )
544 else if( bus->Angle().AsDegrees() == 0.0 )
548 if( aPosition.
y < bus->GetPosition().y )
550 else if( aPosition.
y > bus->GetPosition().y )
559 auto line =
static_cast<const SCH_LINE*
>( item );
563 if( -45 < angle && angle <= 45 )
565 if( line->GetStartPoint().x <= line->GetEndPoint().x )
572 if( line->GetStartPoint().y <= line->GetEndPoint().y )
586 if(
pin->GetPosition() == aPosition )
604 wxT(
"Invalid layer type passed to SCH_SCREEN::IsTerminalPoint()." ) );
617 if( sheetPin && sheetPin->
IsConnected( aPosition ) )
640 if(
GetPin( aPosition,
nullptr,
true ) )
653 if( sheetPin && sheetPin->
IsConnected( aPosition ) )
668 wxCHECK_RET(
Schematic(),
"Cannot call SCH_SCREEN::UpdateSymbolLinks with no SCHEMATIC" );
671 std::unique_ptr< LIB_SYMBOL > libSymbol;
672 std::vector<SCH_SYMBOL*> symbols;
679 symbols.push_back(
static_cast<SCH_SYMBOL*
>( item ) );
694 auto it =
m_libSymbols.find( symbol->GetSchSymbolLibraryName() );
700 msg.Printf(
_(
"Setting schematic symbol '%s %s' library identifier to '%s'." ),
708 symbol->SetLibSymbol(
new LIB_SYMBOL( *it->second ) );
712 if( !symbol->GetLibId().IsValid() )
716 msg.Printf(
_(
"Schematic symbol reference '%s' library identifier is not valid. "
717 "Unable to link library symbol." ),
728 if( !libs->
HasLibrary( symbol->GetLibId().GetLibNickname() ) && !legacyLibs )
732 msg.Printf(
_(
"Symbol library '%s' not found and no fallback cache library "
733 "available. Unable to link library symbol." ),
734 symbol->GetLibId().GetLibNickname().wx_str() );
741 if( libs->
HasLibrary( symbol->GetLibId().GetLibNickname() ) )
751 msg.Printf(
_(
"I/O error %s resolving library symbol %s" ), ioe.
What(),
760 SYMBOL_LIB& legacyCacheLib = legacyLibs->back();
763 wxCHECK2( legacyCacheLib.
IsCache(),
continue );
765 wxString
id = symbol->GetLibId().Format();
767 id.Replace(
':',
'_' );
771 msg.Printf(
_(
"Falling back to cache to set symbol '%s:%s' link '%s'." ),
785 libSymbol->SetParent();
787 m_libSymbols.insert( { symbol->GetSchSymbolLibraryName(),
792 msg.Printf(
_(
"Setting schematic symbol '%s %s' library identifier to '%s'." ),
803 msg.Printf(
_(
"No library symbol found for schematic symbol '%s %s'." ),
810 if( libSymbol.get() )
811 symbol->SetLibSymbol( libSymbol.release() );
823 std::vector<SCH_SYMBOL*> symbols;
826 symbols.push_back(
static_cast<SCH_SYMBOL*
>( item ) );
833 auto it =
m_libSymbols.find( symbol->GetSchSymbolLibraryName() );
840 symbol->SetLibSymbol( libSymbol );
850 item->SetConnectivityDirty(
true );
857 std::vector<SCH_ITEM*> junctions;
858 std::vector<SCH_ITEM*> bitmaps;
859 std::vector<SCH_ITEM*> other;
863 if( item->IsMoving() )
867 junctions.push_back( item );
869 bitmaps.push_back( item );
871 other.push_back( item );
875 std::stable_sort( other.begin(), other.end(),
878 if( a->Type() == b->Type() )
879 return a->GetLayer() > b->GetLayer();
881 return a->Type() < b->Type();
885 item->Print( aSettings, 0, 0,
VECTOR2I( 0, 0 ),
false,
false );
888 item->PrintBackground( aSettings, 0, 0,
VECTOR2I( 0, 0 ),
false );
891 item->Print( aSettings, 0, 0,
VECTOR2I( 0, 0 ),
false,
false );
894 item->Print( aSettings, 0, 0,
VECTOR2I( 0, 0 ),
false,
false );
901 std::vector<SCH_ITEM*> junctions;
902 std::vector<SCH_ITEM*> bitmaps;
903 std::vector<SCH_SYMBOL*> symbols;
904 std::vector<SCH_ITEM*> other;
908 if( item->IsMoving() )
912 junctions.push_back( item );
914 bitmaps.push_back( item );
916 other.push_back( item );
927 symbols.push_back(
static_cast<SCH_SYMBOL*
>( item ) );
935 std::sort( other.begin(), other.end(),
938 if( a->Type() == b->Type() )
939 return a->GetLayer() > b->GetLayer();
941 return a->Type() > b->Type();
945 constexpr bool background =
true;
953 item->Plot( aPlotter, background, aPlotOpts, 0, 0, { 0, 0 }, false );
960 item->Plot( aPlotter, background, aPlotOpts, 0, 0, { 0, 0 }, false );
967 item->Plot( aPlotter, !background, aPlotOpts, 0, 0, { 0, 0 }, false );
972 TRANSFORM savedTransform = renderSettings->m_Transform;
976 renderSettings->m_Transform = sym->GetTransform();
979 for(
SCH_FIELD field : sym->GetFields() )
981 field.ClearRenderCache();
982 field.Plot( aPlotter,
false, aPlotOpts, sym->GetUnit(), sym->GetBodyStyle(), { 0, 0 },
986 sym->PlotPins( aPlotter );
989 sym->PlotDNP( aPlotter );
992 renderSettings->m_Transform = savedTransform;
997 item->Plot( aPlotter, !background, aPlotOpts, 0, 0, { 0, 0 }, false );
1005 item->ClearTempFlags();
1010 bool aEndPointOnly )
const
1017 candidate =
static_cast<SCH_SYMBOL*
>( item );
1047 if(
pin && aSymbol )
1048 *aSymbol = candidate;
1062 sheetPin = sheet->
GetPin( aPosition );
1078 if( ( item->Type() !=
SCH_JUNCTION_T || aTestJunctions ) && item->IsConnected( aPos ) )
1116 static const std::vector<KICAD_T> hierarchicalTypes = {
SCH_SYMBOL_T,
1122 if( item->IsType( hierarchicalTypes ) )
1123 aItems->push_back( item );
1131 aItems->push_back( item );
1133 std::sort( aItems->begin(), aItems->end(),
1136 if( a->GetPosition().x == b->GetPosition().x )
1139 if( a->GetPosition().y == b->GetPosition().y )
1140 return a->m_Uuid < b->m_Uuid;
1142 return a->GetPosition().y < b->GetPosition().y;
1146 return a->GetPosition().x < b->GetPosition().x;
1153 std::function<
void(
SCH_ITEM* )>* aChangedHandler )
const
1157 std::vector<DANGLING_END_ITEM> endPointsByPos;
1158 std::vector<DANGLING_END_ITEM> endPointsByType;
1163 if( item->IsConnectable() )
1164 item->GetEndPoints( endPointsByType );
1170 if( item->UpdateDanglingState( endPointsByType, endPointsByPos, aPath ) )
1172 if( aChangedHandler )
1173 ( *aChangedHandler )( item );
1180 item->RunOnChildren( get_ends );
1183 PROF_TIMER sortTimer(
"SCH_SCREEN::TestDanglingEnds pre-sort" );
1184 endPointsByPos = endPointsByType;
1193 update_state( item );
1194 item->RunOnChildren( update_state );
1206 aAccuracy = std::max( aAccuracy, 1 );
1208 for(
SCH_ITEM* item :
Items().Overlapping( aPosition, aAccuracy ) )
1213 if( item->GetLayer() != aLayer )
1216 if( !item->HitTest( aPosition, aAccuracy ) )
1219 switch( aSearchType )
1225 if( !( (
SCH_LINE*) item )->IsEndPoint( aPosition ) )
1230 if( ( (
SCH_LINE*) item )->IsEndPoint( aPosition ) )
1240 bool aIgnoreEndpoints )
const
1242 std::vector<SCH_LINE*> retVal;
1246 if( item->IsType( { SCH_ITEM_LOCATE_WIRE_T, SCH_ITEM_LOCATE_BUS_T } ) )
1250 if( aIgnoreEndpoints && wire->
IsEndPoint( aPosition ) )
1254 retVal.push_back( wire );
1264 std::vector<VECTOR2I> retval;
1271 std::vector<VECTOR2I> pts = item->GetConnectionPoints();
1272 retval.insert( retval.end(), pts.begin(), pts.end() );
1277 std::sort( retval.begin(), retval.end(),
1280 return a.x < b.x || ( a.x == b.x && a.y < b.y );
1282 retval.erase( std::unique( retval.begin(), retval.end() ), retval.end() );
1290 std::vector<VECTOR2I> pts;
1293 for(
const EDA_ITEM* edaItem : aItems )
1301 pts.insert( pts.end(), new_pts.begin(), new_pts.end() );
1309 for(
const VECTOR2I& pt : connections )
1312 pts.push_back( pt );
1318 std::sort( pts.begin(), pts.end(),
1321 return a.x < b.x || ( a.x == b.x && a.y < b.y );
1324 pts.erase( unique( pts.begin(), pts.end() ), pts.end() );
1327 pts.erase( std::remove_if( pts.begin(), pts.end(),
1328 [
this](
const VECTOR2I& a ) ->
bool
1330 return !IsExplicitJunctionNeeded( a );
1340 for(
SCH_ITEM* item :
Items().Overlapping( aPosition, aAccuracy ) )
1342 switch( item->Type() )
1348 if( item->HitTest( aPosition, aAccuracy ) )
1364 wxCHECK( aLibSymbol, );
1388 for(
auto& [filename, embeddedFile] : libSym->EmbeddedFileMap() )
1396 embeddedFile->data_hash = file->
data_hash;
1397 embeddedFile->is_valid = file->
is_valid;
1401 libSym->RunOnChildren(
1405 textItem->ResolveFont( embeddedFonts );
1409 std::vector<SCH_ITEM*> items_to_update;
1413 bool update =
false;
1416 update |= textItem->ResolveFont( embeddedFonts );
1418 item->RunOnChildren(
1422 update |= textItem->ResolveFont( embeddedFonts );
1426 items_to_update.push_back( item );
1429 for(
SCH_ITEM* item : items_to_update )
1477 std::vector<wxString>& aMatches )
1482 aMatches.emplace_back( searchName );
1491 if( pair.first.StartsWith( searchName, &suffix ) && suffix.ToLong( &tmp ) )
1492 aMatches.emplace_back( pair.first );
1495 return aMatches.size();
1507 if( aProjectName.IsEmpty() )
1514 wxCHECK2( symbol,
continue );
1516 std::set<KIID_PATH> pathsToPrune;
1517 const std::vector<SCH_SYMBOL_INSTANCE> instances = symbol->
GetInstances();
1522 if( aProjectName != instance.m_ProjectName )
1525 std::optional<SCH_SHEET_PATH> pathFound =
1531 pathsToPrune.emplace( instance.m_Path );
1532 else if( pathFound.value().LastScreen() !=
this )
1533 pathsToPrune.emplace( pathFound.value().Path() );
1536 for(
const KIID_PATH& sheetPath : pathsToPrune )
1539 aProjectName, sheetPath.AsString() );
1554 if( aProjectName.IsEmpty() )
1561 wxCHECK2( sheet,
continue );
1563 std::set<KIID_PATH> pathsToPrune;
1564 const std::vector<SCH_SHEET_INSTANCE> instances = sheet->
GetInstances();
1569 if( aProjectName != instance.m_ProjectName )
1572 std::optional<SCH_SHEET_PATH> pathFound =
1578 pathsToPrune.emplace( instance.m_Path );
1579 else if( pathFound.value().LastScreen() !=
this )
1580 pathsToPrune.emplace( pathFound.value().Path() );
1583 for(
const KIID_PATH& sheetPath : pathsToPrune )
1586 aProjectName, sheetPath.AsString() );
1595 wxString trimmedFieldName;
1601 wxCHECK2( symbol,
continue );
1605 trimmedFieldName = field.GetName();
1606 trimmedFieldName.Trim();
1607 trimmedFieldName.Trim(
false );
1609 if( field.GetName() != trimmedFieldName )
1619void SCH_SCREEN::Show(
int nestLevel, std::ostream& os )
const
1622 NestedSpace( nestLevel, os ) <<
'<' <<
GetClass().Lower().mb_str() <<
">\n";
1625 item->Show( nestLevel + 1, os );
1627 NestedSpace( nestLevel, os ) <<
"</" <<
GetClass().Lower().mb_str() <<
">\n";
1684 if( aScreen ==
nullptr )
1689 if( screen == aScreen )
1704 wxCHECK_RET( screen,
"No screen for aSheet" );
1723 wxCHECK_RET( sch,
"Null schematic in SCH_SCREENS::ClearAnnotationOfNewSheetPaths" );
1733 bool path_exists =
false;
1735 for(
const SCH_SHEET_PATH& existing_sheetpath: aInitialSheetPathList )
1737 if( existing_sheetpath.Path() == sheetpath.Path() )
1747 SCH_SCREEN* curr_screen = sheetpath.LastScreen();
1762 std::vector<SCH_ITEM*> items;
1767 return a->
m_Uuid < b->m_Uuid;
1770 std::set<
EDA_ITEM*,
decltype( timestamp_cmp )> unique_stamps( timestamp_cmp );
1773 screen->GetHierarchicalItems( &items );
1775 if( items.size() < 2 )
1780 if( !unique_stamps.insert( item ).second )
1785 const_cast<KIID&
>( item->m_Uuid ) =
KIID();
1802 for(
SCH_ITEM* item : screen->Items() )
1803 item->ClearEditFlags();
1814 if( item == aMarker )
1816 screen->DeleteItem( item );
1825 bool aIncludeExclusions )
1829 std::vector<SCH_ITEM*> markers;
1834 std::shared_ptr<RC_ITEM>rcItem = marker->
GetRCItem();
1837 && ( aErrorCode ==
ERCE_UNSPECIFIED || rcItem->GetErrorCode() == aErrorCode )
1838 && ( !marker->
IsExcluded() || aIncludeExclusions ) )
1840 markers.push_back( item );
1845 screen->DeleteItem( marker );
1851 bool aIncludeExclusions )
1860 screen->UpdateSymbolLinks( aReporter );
1869 wxCHECK_RET( sch,
"Null schematic in SCH_SCREENS::UpdateSymbolLinks" );
1882 bool has_symbols =
false;
1897 return has_symbols ? true :
false;
1910 if( !nickname.
empty() && ( aLibNicknames.Index( nickname ) == wxNOT_FOUND ) )
1911 aLibNicknames.Add( nickname );
1915 return aLibNicknames.GetCount();
1948 if( screen->GetFileName() == aSchematicFileName )
1965 wxCHECK_RET( sch,
"Null schematic in SCH_SCREENS::BuildClientSheetPathList" );
1968 curr_screen->GetClientSheetPaths().clear();
1972 SCH_SCREEN* used_screen = sheetpath.LastScreen();
1977 if( used_screen == curr_screen )
1990 screen->SetLegacySymbolInstanceData();
1997 screen->FixLegacyPowerSymbolMismatches();
2011 SIM_MODEL::MigrateSimModel<SCH_SYMBOL>( *symbol, &
Schematic()->
Prj() );
2019 if( aProjectName.IsEmpty() )
2023 screen->PruneOrphanedSymbolInstances( aProjectName, aValidSheetPaths );
2030 if( aProjectName.IsEmpty() )
2034 screen->PruneOrphanedSheetInstances( aProjectName, aValidSheetPaths );
2042 if( screen->HasSymbolFieldNamesWithWhiteSpace() )
constexpr EDA_IU_SCALE schIUScale
Handles how to draw a screen (a board, a schematic ...)
int m_virtualPageNumber
An integer based page number used for printing a range of pages.
bool m_Center
Center on screen.
int m_pageCount
The number of BASE_SCREEN objects in this design.
void SetContentModified(bool aModified=true)
void InitDataPoints(const VECTOR2I &aPageSizeInternalUnits)
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr void SetOrigin(const Vec &pos)
void Recalculate(const SCH_SHEET_LIST &aSheetList, bool aUnconditional=false, std::function< void(SCH_ITEM *)> *aChangedItemHandler=nullptr)
Update the connection graph for the given list of sheets.
static void sort_dangling_end_items(std::vector< DANGLING_END_ITEM > &aItemListByType, std::vector< DANGLING_END_ITEM > &aItemListByPos)
Both contain the same information.
A base class for most all the KiCad significant classes used in schematics and boards.
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
void SetFlags(EDA_ITEM_FLAGS aMask)
KICAD_T Type() const
Returns the type of object.
virtual void SetParent(EDA_ITEM *aParent)
EDA_ITEM * GetParent() const
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
EE_TYPE Overlapping(const BOX2I &aRect) const
bool remove(SCH_ITEM *aItem)
Remove an item from the tree.
void insert(SCH_ITEM *aItem)
Insert an item into the tree.
bool contains(const SCH_ITEM *aItem, bool aRobust=false) const
Determine if a given item exists in the tree.
iterator end()
Returns a read/write iterator that points to one past the last element in the EE_RTREE.
iterator begin()
Returns a read/write iterator that points to the first element in the EE_RTREE N.B.
EE_TYPE OfType(KICAD_T aType) const
void clear()
Remove all items from the RTree.
EMBEDDED_FILE * GetEmbeddedFile(const wxString &aName) const
Returns the embedded file with the given name or nullptr if it does not exist.
const std::vector< wxString > * UpdateFontFiles()
Helper function to get a list of fonts for fontconfig to add to the library.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString What() const
A composite of Problem() and Where()
A logical library item identifier and consists of various portions much like a URI.
int SetLibNickname(const UTF8 &aLibNickname)
Override the logical library name portion of the LIB_ID to aLibNickname.
wxString GetUniStringLibId() const
const wxString GetUniStringLibItemName() const
Get strings for display messages in dialogs.
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Define a library symbol object.
const LIB_ID & GetLibId() const override
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
wxString GetName() const override
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
void SetLibId(const LIB_ID &aLibId)
virtual void SetName(const wxString &aName)
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
std::shared_ptr< RC_ITEM > GetRCItem() const
enum MARKER_T GetMarkerType() const
const VECTOR2D GetSizeIU(double aIUScale) const
Gets the page size in internal units.
Base plotter engine class.
RENDER_SETTINGS * RenderSettings()
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
A small class to help profiling.
void Show(std::ostream &aStream=std::cerr)
Print the elapsed time (in a suitable unit) to a stream.
void Stop()
Save the time when this function was called, and set the counter stane to stop.
static SYMBOL_LIB_TABLE * SchSymbolLibTable(PROJECT *aProject)
Accessor for project symbol library table.
static SYMBOL_LIBS * SchLibs(PROJECT *aProject)
A pure virtual class used to derive REPORTER objects from.
virtual REPORTER & ReportTail(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Places the report at the end of the list, for objects that support report ordering.
Holds all the data relating to one schematic.
CONNECTION_GRAPH * ConnectionGraph() const override
SCH_SHEET_LIST Hierarchy() const override
Return the full schematic flattened hierarchical sheet list.
EMBEDDED_FILES * GetEmbeddedFiles() override
Class for a wire to bus entry.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Base class for any item which can be embedded within the SCHEMATIC container class,...
virtual bool IsConnectable() const
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
bool IsConnected(const VECTOR2I &aPoint) const
Test the item to see if it is connected to aPoint.
virtual std::vector< VECTOR2I > GetConnectionPoints() const
Add all the connection points for this item to aPoints.
Segment description base class to describe items which have 2 end points (track, wire,...
EDA_ANGLE Angle() const
Gets the angle between the start and end lines.
VECTOR2I GetEndPoint() const
VECTOR2I GetStartPoint() const
bool IsEndPoint(const VECTOR2I &aPoint) const
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
std::vector< SCH_SHEET * > m_sheets
SCH_SCREEN * GetScreen(unsigned int aIndex) const
void UpdateSymbolLinks(REPORTER *aReporter=nullptr)
Initialize the LIB_SYMBOL reference for each SCH_SYMBOL found in the full schematic.
void DeleteMarker(SCH_MARKER *aMarker)
Delete a specific marker.
void DeleteMarkers(enum MARKER_BASE::MARKER_T aMarkerTyp, int aErrorCode, bool aIncludeExclusions=true)
Delete all markers of a particular type and error code.
void buildScreenList(SCH_SHEET *aSheet)
void FixLegacyPowerSymbolMismatches()
Fix legacy power symbols that have mismatched value text fields and invisible power pin names.
void DeleteAllMarkers(enum MARKER_BASE::MARKER_T aMarkerType, bool aIncludeExclusions)
Delete all electronic rules check markers of aMarkerType from all the screens in the list.
void PruneOrphanedSheetInstances(const wxString &aProjectName, const SCH_SHEET_LIST &aValidSheetPaths)
int ChangeSymbolLibNickname(const wxString &aFrom, const wxString &aTo)
Change all of the symbol library nicknames.
SCH_SCREENS(SCH_SHEET *aSheet)
void BuildClientSheetPathList()
built the list of sheet paths sharing a screen for each screen in use
bool HasSymbolFieldNamesWithWhiteSpace() const
void ClearAnnotationOfNewSheetPaths(SCH_SHEET_LIST &aInitialSheetPathList)
Clear the annotation for the symbols inside new sheetpaths when a complex hierarchy is modified and n...
void PruneOrphanedSymbolInstances(const wxString &aProjectName, const SCH_SHEET_LIST &aValidSheetPaths)
bool HasNoFullyDefinedLibIds()
Test all of the schematic symbols to see if all LIB_ID objects library nickname is not set.
SCH_SHEET * GetSheet(unsigned int aIndex) const
int ReplaceDuplicateTimeStamps()
Test all sheet and symbol objects in the schematic for duplicate time stamps and replaces them as nec...
std::vector< SCH_SCREEN * > m_screens
bool HasSchematic(const wxString &aSchematicFileName)
Check if one of the schematics in the list of screens is aSchematicFileName.
size_t GetLibNicknames(wxArrayString &aLibNicknames)
Fetch all of the symbol library nicknames into aLibNicknames.
void SetLegacySymbolInstanceData()
Update the symbol value and footprint instance data for legacy designs.
void addScreenToList(SCH_SCREEN *aScreen, SCH_SHEET *aSheet)
std::map< wxString, LIB_SYMBOL * > m_libSymbols
Library symbols required for this schematic.
SCH_PIN * GetPin(const VECTOR2I &aPosition, SCH_SYMBOL **aSymbol=nullptr, bool aEndPointOnly=false) const
Test the screen for a symbol pin item at aPosition.
void ClearDrawingState()
Clear the state flags of all the items in the screen.
SCH_LINE * GetLine(const VECTOR2I &aPosition, int aAccuracy=0, int aLayer=LAYER_NOTES, SCH_LINE_TEST_T aSearchType=ENTIRE_LENGTH_T) const
Return a line item located at aPosition.
void Append(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
void AddLibSymbol(LIB_SYMBOL *aLibSymbol)
Add aLibSymbol to the library symbol map.
bool HasSymbolFieldNamesWithWhiteSpace() const
void AddBusAlias(std::shared_ptr< BUS_ALIAS > aAlias)
Add a bus alias definition (and transfers ownership of the pointer).
void FixLegacyPowerSymbolMismatches()
Fix legacy power symbols that have mismatched value text fields and invisible power pin names.
bool HasItems(KICAD_T aItemType) const
void Clear(bool aFree=true)
Delete all draw items and clears the project settings.
void PruneOrphanedSymbolInstances(const wxString &aProjectName, const SCH_SHEET_LIST &aValidSheetPaths)
Remove all invalid symbol instance data in this screen object for the project defined by aProjectName...
std::vector< SCH_SHEET_PATH > & GetClientSheetPaths()
Return the number of times this screen is used.
void UpdateSymbolLinks(REPORTER *aReporter=nullptr)
Initialize the LIB_SYMBOL reference for each SCH_SYMBOL found in this schematic from the project SYMB...
SCH_LINE * GetWire(const VECTOR2I &aPosition, int aAccuracy=0, SCH_LINE_TEST_T aSearchType=ENTIRE_LENGTH_T) const
void TestDanglingEnds(const SCH_SHEET_PATH *aPath=nullptr, std::function< void(SCH_ITEM *)> *aChangedHandler=nullptr) const
Test all of the connectable objects in the schematic for unused connection points.
void EnsureAlternateReferencesExist()
For screens shared by many sheetpaths (complex hierarchies): to be able to clear or modify any refere...
void PruneOrphanedSheetInstances(const wxString &aProjectName, const SCH_SHEET_LIST &aValidSheetPaths)
Remove all invalid sheet instance data in this screen object for the project defined by aProjectName ...
std::vector< SCH_LINE * > GetBusesAndWires(const VECTOR2I &aPosition, bool aIgnoreEndpoints=false) const
Return buses and wires passing through aPosition.
double m_LastZoomLevel
last value for the zoom level, useful in Eeschema when changing the current displayed sheet to reuse ...
bool IsExplicitJunction(const VECTOR2I &aPosition) const
Indicates that a junction dot is necessary at the given location.
EE_RTREE & Items()
Gets the full RTree, usually for iterating.
std::set< SCH_ITEM * > MarkConnections(SCH_LINE *aSegment, bool aSecondPass)
Return all wires and junctions connected to aSegment which are not connected any symbol pin.
void Print(const SCH_RENDER_SETTINGS *aSettings)
Print all the items in the screen to aDC.
SCH_ITEM * GetItem(const VECTOR2I &aPosition, int aAccuracy=0, KICAD_T aType=SCH_LOCATE_ANY_T) const
Check aPosition within a distance of aAccuracy for items of type aFilter.
bool IsExplicitJunctionAllowed(const VECTOR2I &aPosition) const
Indicates that a juction dot may be placed at the given location.
bool IsTerminalPoint(const VECTOR2I &aPosition, int aLayer) const
Test if aPosition is a connection point on aLayer.
void UpdateLocalLibSymbolLinks()
Initialize the LIB_SYMBOL reference for each SCH_SYMBOL found in this schematic with the local projec...
void SetFileName(const wxString &aFileName)
Set the file name for this screen to aFileName.
static bool ClassOf(const EDA_ITEM *aItem)
void SetLegacySymbolInstanceData()
Update the symbol value and footprint instance data for legacy designs.
SCH_LINE * GetBus(const VECTOR2I &aPosition, int aAccuracy=0, SCH_LINE_TEST_T aSearchType=ENTIRE_LENGTH_T) const
bool Remove(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
Remove aItem from the schematic associated with this screen.
SCH_SCREEN(EDA_ITEM *aParent=nullptr)
SCHEMATIC * Schematic() const
void FixupEmbeddedData()
After loading a file from disk, the library symbols do not yet contain the full data for their embedd...
void GetHierarchicalItems(std::vector< SCH_ITEM * > *aItems) const
Add all schematic sheet and symbol objects in the screen to aItems.
bool IsExplicitJunctionNeeded(const VECTOR2I &aPosition) const
Indicates that a junction dot is necessary at the given location, and does not yet exist.
SCH_SHEET_PIN * GetSheetPin(const VECTOR2I &aPosition) const
Test the screen if aPosition is a sheet label object.
void FreeDrawList()
Free all the items from the schematic associated with the screen.
void Plot(PLOTTER *aPlotter, const SCH_PLOT_OPTS &aPlotOpts) const
Plot all the schematic objects to aPlotter.
virtual wxString GetClass() const override
Return the class name.
void Update(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
Update aItem's bounding box in the tree.
void SetConnectivityDirty()
std::vector< VECTOR2I > GetNeededJunctions(const std::deque< EDA_ITEM * > &aItems) const
Return the unique set of points belonging to aItems where a junction is needed.
bool IsJunction(const VECTOR2I &aPosition) const
Test if a junction is required for the items at aPosition on the screen.
void GetSheets(std::vector< SCH_ITEM * > *aItems) const
Similar to Items().OfType( SCH_SHEET_T ), but return the sheets in a deterministic order (L-R,...
bool CheckIfOnDrawList(const SCH_ITEM *aItem) const
std::vector< VECTOR2I > GetConnections() const
Collect a unique list of all possible connection points in the schematic.
SPIN_STYLE GetLabelOrientationForPoint(const VECTOR2I &aPosition, SPIN_STYLE aDefaultOrientation, const SCH_SHEET_PATH *aSheet) const
void ClearAnnotation(SCH_SHEET_PATH *aSheetPath, bool aResetPrefix)
Clear the annotation for the symbols in aSheetPath on the screen.
size_t CountConnectedItems(const VECTOR2I &aPos, bool aTestJunctions) const
void MigrateSimModels()
Migrate any symbols having V6 simulation models to their V7 equivalents.
void DeleteItem(SCH_ITEM *aItem)
Removes aItem from the linked list and deletes the object.
std::set< std::shared_ptr< BUS_ALIAS >, BusAliasCmp > m_aliases
List of bus aliases stored in this screen.
size_t getLibSymbolNameMatches(const SCH_SYMBOL &aSymbol, std::vector< wxString > &aMatches)
Return a list of potential library symbol matches for aSymbol.
SCH_LABEL_BASE * GetLabel(const VECTOR2I &aPosition, int aAccuracy=0) const
Return a label item located at aPosition.
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
std::optional< SCH_SHEET_PATH > GetSheetPathByKIIDPath(const KIID_PATH &aPath, bool aIncludeLastSheet=true) const
Finds a SCH_SHEET_PATH that matches the provided KIID_PATH.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Define a sheet pin (label) used in sheets to create hierarchical schematics.
SCH_SHEET * GetParent() const
Get the parent sheet object of this sheet pin.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
void RemoveInstance(const KIID_PATH &aInstancePath)
SCH_SHEET_PIN * GetPin(const VECTOR2I &aPosition)
Return the sheet pin item found at aPosition in the sheet.
void RemovePin(const SCH_SHEET_PIN *aSheetPin)
Remove aSheetPin from the sheet.
SCH_SCREEN * GetScreen() const
const std::vector< SCH_SHEET_INSTANCE > & GetInstances() const
void SetLibId(const LIB_ID &aName)
SCH_ITEM * GetDrawItem(const VECTOR2I &aPosition, KICAD_T aType=TYPE_NOT_INIT)
Return the symbol library item at aPosition that is part of this symbol.
const std::vector< SCH_SYMBOL_INSTANCE > & GetInstances() const
void RemoveInstance(const SCH_SHEET_PATH &aInstancePath)
void SetValueFieldText(const wxString &aValue)
wxString GetSchSymbolLibraryName() const
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly) override
Populate a std::vector with SCH_FIELDs.
bool AddSheetPathReferenceEntryIfMissing(const KIID_PATH &aSheetPath)
Add an instance to the alternate references list (m_instanceReferences), if this entry does not alrea...
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath, bool aResetPrefix)
Clear exiting symbol annotation.
std::vector< SCH_PIN * > GetAllLibPins() const
void AddHierarchicalReference(const KIID_PATH &aPath, const wxString &aRef, int aUnit)
Add a full hierarchical reference to this symbol.
std::vector< SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet) const
Retrieve a list of the SCH_PINs for the given sheet path.
const LIB_ID & GetLibId() const override
void SetSchSymbolLibraryName(const wxString &aName)
The name of the symbol in the schematic library symbol list.
std::vector< SCH_PIN * > GetLibPins() const
Populate a vector with all the pins from the library object that match the current unit and bodyStyle...
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
void SetLibSymbol(LIB_SYMBOL *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
VECTOR2I GetPinPhysicalPosition(const SCH_PIN *Pin) const
A collection of SYMBOL_LIB objects.
LIB_SYMBOL * LoadSymbol(const wxString &aNickname, const wxString &aName)
Load a LIB_SYMBOL having aName from the library given by aNickname.
Object used to load, save, search, and otherwise manipulate symbol library files.
LIB_SYMBOL * FindSymbol(const wxString &aName) const
Find LIB_SYMBOL by aName.
An 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and fro...
#define STRUCT_DELETED
flag indication structures to be erased
#define IS_MOVING
Item being moved.
static const wxChar DanglingProfileMask[]
Flag to enable connectivity profiling.
const wxChar *const traceSchSheetPaths
Flag to enable debug output of schematic symbol sheet path manipulation code.
Common command IDs shared by more than one of the KiCad applications.
POINT_INFO AnalyzePoint(const EE_RTREE &aItem, const VECTOR2I &aPosition, bool aBreakCrossings)
Check a tree of items for a confluence at a given point and work out what kind of junction it is,...
static const wxChar DanglingProfileMask[]
wxString UnescapeString(const wxString &aSource)
The EE_TYPE struct provides a type-specific auto-range iterator to the RTree.
std::vector< char > decompressedData
std::string compressedEncodedData
A selection of information about a point in the schematic that might be eligible for turning into a j...
A simple container for sheet instance information.
A simple container for schematic symbol instance information.
Definition for symbol library class.
@ VALUE_FIELD
Field Value of part, i.e. "3.3K".
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".
wxLogTrace helper definitions.
bool IsPointOnSegment(const VECTOR2I &aSegStart, const VECTOR2I &aSegEnd, const VECTOR2I &aTestPoint)
Test if aTestPoint is on line defined by aSegStart and aSegEnd.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
VECTOR2< int32_t > VECTOR2I