68 m_fileFormatVersionAtLoad( 0 ),
69 m_paper( wxT(
"A4" ) ),
70 m_isReadOnly( false ),
95 wxT(
"SCH_SCREEN must have a SCHEMATIC parent!" ) );
103 for(
const std::pair<const wxString, LIB_SYMBOL*>& libSymbol :
m_libSymbols )
104 delete libSymbol.second;
112 wxASSERT( aFileName.IsEmpty() || wxIsAbsolutePath( aFileName ) );
126 wxCHECK_RET(
m_refCount != 0, wxT(
"Screen reference count already zero. Bad programmer!" ) );
135 return sheets.
begin() != sheets.
end();
197 LIB_ID newLibId( wxEmptyString, newName );
200 newLibSymbol->
SetName( newName );
216 wxCHECK_RET( aScreen,
"Invalid screen object." );
223 aScreen->
Clear(
false );
250 std::vector<SCH_ITEM*> delete_list;
255 return ( aItem->Type() != SCH_SHEET_PIN_T && aItem->Type() != SCH_FIELD_T );
281 bool removeUnusedLibSymbol =
true;
289 removeUnusedLibSymbol =
false;
294 if( removeUnusedLibSymbol )
312 wxCHECK_RET( aItem, wxT(
"Cannot delete invalid item from screen." ) );
326 wxCHECK_RET( sheet, wxT(
"Sheet pin parent not properly set, bad programmer!" ) );
349 if( item->HitTest( aPosition, aAccuracy ) )
359#define PROCESSED CANDIDATE
361 std::set<SCH_ITEM*> retval;
362 std::stack<SCH_LINE*> to_search;
364 wxCHECK_MSG( aSegment && aSegment->
Type() ==
SCH_LINE_T, retval, wxT(
"Invalid pointer." ) );
366 to_search.push( aSegment );
368 while( !to_search.empty() )
399 retval.insert( junction );
401 retval.insert( line );
402 to_search.push( line );
404 else if( !junction && !
pin )
406 retval.insert( line );
407 to_search.push( line );
417 item->ClearTempFlags();
425 bool hasExplicitJunction;
427 bool isJunction =
doIsJunction( aPosition,
false, &hasExplicitJunction, &hasBusEntry );
435 bool hasExplicitJunction;
437 bool isJunction =
doIsJunction( aPosition,
false, &hasExplicitJunction, &hasBusEntry );
439 return isJunction && !hasBusEntry;
445 bool hasExplicitJunction;
447 bool isJunction =
doIsJunction( aPosition,
false, &hasExplicitJunction, &hasBusEntry );
449 return isJunction && !hasBusEntry && !hasExplicitJunction;
456 auto ret = aDefaultOrientation;
462 switch( item->Type() )
467 if( busEntry->m_connected_bus_item )
471 auto bus =
static_cast<const SCH_LINE*
>( busEntry->m_connected_bus_item );
472 if( bus->Angle().AsDegrees() == 90.0 )
476 if( aPosition.
x < bus->GetPosition().x )
478 else if( aPosition.
x > bus->GetPosition().x )
481 else if( bus->Angle().AsDegrees() == 0.0 )
485 if( aPosition.
y < bus->GetPosition().y )
487 else if( aPosition.
y > bus->GetPosition().y )
496 auto line =
static_cast<const SCH_LINE*
>( item );
498 auto angle = line->Angle().Normalize90().AsDegrees();
502 if( line->GetStartPoint().x <= line->GetEndPoint().x )
515 if( line->GetStartPoint().y <= line->GetEndPoint().y )
535 if(
pin->GetPosition() == aPosition )
545 else if(
pin->GetOrientation() ==
PIN_UP )
672 bool hasExplicitJunction;
674 bool isJunction =
doIsJunction( aPosition,
true, &hasExplicitJunction, &hasBusEntry );
676 return isJunction && !hasBusEntry;
682 bool* aHasExplicitJunctionDot,
bool* aHasBusEntry )
const
684 enum layers {
WIRES = 0, BUSES };
686 *aHasExplicitJunctionDot =
false;
687 *aHasBusEntry =
false;
689 bool breakLines[ 2 ] = {
false };
690 std::unordered_set<int> exitAngles[ 2 ];
691 std::vector<const SCH_LINE*> midPointLines[ 2 ];
694 int uniqueAngle = 10000;
696 for(
const SCH_ITEM* item :
Items().Overlapping( aPosition ) )
701 switch( item->Type() )
704 if( item->HitTest( aPosition, -1 ) )
705 *aHasExplicitJunctionDot =
true;
725 breakLines[ layer ] =
true;
726 exitAngles[ layer ].insert( line->
GetAngleFrom( aPosition ) );
728 else if( line->
HitTest( aPosition, -1 ) )
730 if( aBreakCrossings )
731 breakLines[ layer ] =
true;
734 midPointLines[ layer ].push_back( line );
740 if( item->IsConnected( aPosition ) )
742 breakLines[ BUSES ] =
true;
743 exitAngles[ BUSES ].insert( uniqueAngle++ );
744 breakLines[
WIRES ] =
true;
745 exitAngles[
WIRES ].insert( uniqueAngle++ );
746 *aHasBusEntry =
true;
753 if( item->IsConnected( aPosition ) )
755 breakLines[
WIRES ] =
true;
756 exitAngles[
WIRES ].insert( uniqueAngle++ );
766 for(
int layer : {
WIRES, BUSES } )
768 if( breakLines[ layer ] )
770 for(
const SCH_LINE* line : midPointLines[ layer ] )
772 exitAngles[ layer ].insert( line->GetAngleFrom( aPosition ) );
773 exitAngles[ layer ].insert( line->GetReverseAngleFrom( aPosition ) );
778 return exitAngles[
WIRES ].size() >= 3 || exitAngles[ BUSES ].size() >= 3;
785 wxT(
"Invalid layer type passed to SCH_SCREEN::IsTerminalPoint()." ) );
798 if( sheetPin && sheetPin->
IsConnected( aPosition ) )
821 if(
GetPin( aPosition,
nullptr,
true ) )
834 if( sheetPin && sheetPin->
IsConnected( aPosition ) )
849 wxCHECK_RET(
Schematic(),
"Cannot call SCH_SCREEN::UpdateSymbolLinks with no SCHEMATIC" );
852 std::unique_ptr< LIB_SYMBOL > libSymbol;
853 std::vector<SCH_SYMBOL*> symbols;
860 symbols.push_back(
static_cast<SCH_SYMBOL*
>( item ) );
875 auto it =
m_libSymbols.find( symbol->GetSchSymbolLibraryName() );
881 msg.Printf(
_(
"Setting schematic symbol '%s %s' library identifier to '%s'." ),
889 symbol->SetLibSymbol(
new LIB_SYMBOL( *it->second ) );
893 if( !symbol->GetLibId().IsValid() )
897 msg.Printf(
_(
"Schematic symbol reference '%s' library identifier is not valid. "
898 "Unable to link library symbol." ),
909 if( !libs->
HasLibrary( symbol->GetLibId().GetLibNickname() ) && !legacyLibs )
913 msg.Printf(
_(
"Symbol library '%s' not found and no fallback cache library "
914 "available. Unable to link library symbol." ),
915 symbol->GetLibId().GetLibNickname().wx_str() );
922 if( libs->
HasLibrary( symbol->GetLibId().GetLibNickname() ) )
932 msg.Printf(
_(
"I/O error %s resolving library symbol %s" ), ioe.
What(),
941 SYMBOL_LIB& legacyCacheLib = legacyLibs->back();
944 wxCHECK2( legacyCacheLib.
IsCache(),
continue );
946 wxString
id = symbol->GetLibId().Format();
948 id.Replace(
':',
'_' );
952 msg.Printf(
_(
"Falling back to cache to set symbol '%s:%s' link '%s'." ),
966 libSymbol->SetParent();
968 m_libSymbols.insert( { symbol->GetSchSymbolLibraryName(),
973 msg.Printf(
_(
"Setting schematic symbol '%s %s' library identifier to '%s'." ),
984 msg.Printf(
_(
"No library symbol found for schematic symbol '%s %s'." ),
991 symbol->SetLibSymbol( libSymbol.release() );
1003 std::vector<SCH_SYMBOL*> symbols;
1006 symbols.push_back(
static_cast<SCH_SYMBOL*
>( item ) );
1013 auto it =
m_libSymbols.find( symbol->GetSchSymbolLibraryName() );
1020 symbol->SetLibSymbol( libSymbol );
1030 item->SetConnectivityDirty(
true );
1037 std::vector<SCH_ITEM*> junctions;
1038 std::vector<SCH_ITEM*> bitmaps;
1039 std::vector<SCH_ITEM*> other;
1043 if( item->IsMoving() )
1047 junctions.push_back( item );
1049 bitmaps.push_back( item );
1051 other.push_back( item );
1055 std::stable_sort( other.begin(), other.end(),
1058 if( a->Type() == b->Type() )
1059 return a->GetLayer() > b->GetLayer();
1061 return a->Type() < b->Type();
1065 item->Print( aSettings,
VECTOR2I( 0, 0 ) );
1068 item->PrintBackground( aSettings,
VECTOR2I( 0, 0 ) );
1071 item->Print( aSettings,
VECTOR2I( 0, 0 ) );
1074 item->Print( aSettings,
VECTOR2I( 0, 0 ) );
1081 std::vector<SCH_ITEM*> junctions;
1082 std::vector<SCH_ITEM*> bitmaps;
1083 std::vector<SCH_SYMBOL*> symbols;
1084 std::vector<SCH_ITEM*> other;
1088 if( item->IsMoving() )
1092 junctions.push_back( item );
1094 bitmaps.push_back( item );
1096 other.push_back( item );
1107 symbols.push_back(
static_cast<SCH_SYMBOL*
>( item ) );
1115 std::sort( other.begin(), other.end(),
1118 if( a->Type() == b->Type() )
1119 return a->GetLayer() > b->GetLayer();
1121 return a->Type() > b->Type();
1125 constexpr bool background =
true;
1130 for(
const SCH_ITEM* item : bitmaps )
1133 item->Plot( aPlotter, background );
1136 for(
const SCH_ITEM* item : other )
1139 item->Plot( aPlotter, background );
1142 for(
const SCH_ITEM* item : other )
1145 item->Plot( aPlotter, !background );
1154 for(
SCH_FIELD field : sym->GetFields() )
1155 field.Plot( aPlotter,
false );
1157 sym->PlotPins( aPlotter );
1160 sym->PlotDNP( aPlotter );
1163 for(
const SCH_ITEM* item : junctions )
1166 item->Plot( aPlotter, !background );
1174 item->ClearTempFlags();
1179 bool aEndPointOnly )
const
1186 candidate =
static_cast<SCH_SYMBOL*
>( item );
1195 std::vector<LIB_PIN*> pins;
1198 for(
LIB_PIN* test_pin : pins )
1219 if(
pin && aSymbol )
1220 *aSymbol = candidate;
1234 sheetPin = sheet->
GetPin( aPosition );
1250 if( ( item->Type() !=
SCH_JUNCTION_T || aTestJunctions ) && item->IsConnected( aPos ) )
1290 if( item->IsType( { SCH_SYMBOL_T, SCH_SHEET_T, SCH_LABEL_LOCATE_ANY_T } ) )
1291 aItems->push_back( item );
1299 aItems->push_back( item );
1301 std::sort( aItems->begin(), aItems->end(),
1304 if( a->GetPosition().x == b->GetPosition().x )
1307 if( a->GetPosition().y == b->GetPosition().y )
1308 return a->m_Uuid < b->m_Uuid;
1310 return a->GetPosition().y < b->GetPosition().y;
1314 return a->GetPosition().x < b->GetPosition().x;
1321 std::function<
void(
SCH_ITEM* )>* aChangedHandler )
const
1323 std::vector<DANGLING_END_ITEM> endPoints;
1327 if( item->IsConnectable() )
1331 for(
SCH_ITEM* overlapping :
Items().Overlapping( item->GetBoundingBox() ) )
1332 overlapping->GetEndPoints( endPoints );
1334 if( item->UpdateDanglingState( endPoints, aPath ) )
1336 if( aChangedHandler )
1337 (*aChangedHandler)( item );
1348 aAccuracy = std::max( aAccuracy, 1 );
1350 for(
SCH_ITEM* item :
Items().Overlapping( aPosition, aAccuracy ) )
1355 if( item->GetLayer() != aLayer )
1358 if( !item->HitTest( aPosition, aAccuracy ) )
1361 switch( aSearchType )
1367 if( !( (
SCH_LINE*) item )->IsEndPoint( aPosition ) )
1372 if( ( (
SCH_LINE*) item )->IsEndPoint( aPosition ) )
1382 bool aIgnoreEndpoints )
const
1384 std::vector<SCH_LINE*> retVal;
1388 if( item->IsType( { SCH_ITEM_LOCATE_WIRE_T, SCH_ITEM_LOCATE_BUS_T } ) )
1392 if( aIgnoreEndpoints && wire->
IsEndPoint( aPosition ) )
1396 retVal.push_back( wire );
1406 std::vector<VECTOR2I> retval;
1413 std::vector<VECTOR2I> pts = item->GetConnectionPoints();
1414 retval.insert( retval.end(), pts.begin(), pts.end() );
1419 std::sort( retval.begin(), retval.end(),
1422 return a.x < b.x || ( a.x == b.x && a.y < b.y );
1424 retval.erase( std::unique( retval.begin(), retval.end() ), retval.end() );
1432 std::vector<VECTOR2I> pts;
1435 for(
const EDA_ITEM* edaItem : aItems )
1443 pts.insert( pts.end(), new_pts.begin(), new_pts.end() );
1451 for(
const VECTOR2I& pt : connections )
1454 pts.push_back( pt );
1460 std::sort( pts.begin(), pts.end(),
1463 return a.x < b.x || ( a.x == b.x && a.y < b.y );
1466 pts.erase( unique( pts.begin(), pts.end() ), pts.end() );
1469 pts.erase( std::remove_if( pts.begin(), pts.end(),
1470 [
this](
const VECTOR2I& a ) ->
bool
1472 return !IsExplicitJunctionNeeded( a );
1482 for(
SCH_ITEM* item :
Items().Overlapping( aPosition, aAccuracy ) )
1484 switch( item->Type() )
1490 if( item->HitTest( aPosition, aAccuracy ) )
1506 wxCHECK( aLibSymbol, );
1545void SCH_SCREEN::Show(
int nestLevel, std::ostream& os )
const
1548 NestedSpace( nestLevel, os ) <<
'<' <<
GetClass().Lower().mb_str() <<
">\n";
1551 item->Show( nestLevel + 1, os );
1553 NestedSpace( nestLevel, os ) <<
"</" <<
GetClass().Lower().mb_str() <<
">\n";
1610 if( aScreen ==
nullptr )
1615 if( screen == aScreen )
1630 wxCHECK_RET( screen,
"No screen for aSheet" );
1649 wxCHECK_RET( sch,
"Null schematic in SCH_SCREENS::ClearAnnotationOfNewSheetPaths" );
1659 bool path_exists =
false;
1661 for(
const SCH_SHEET_PATH& existing_sheetpath: aInitialSheetPathList )
1663 if( existing_sheetpath.Path() == sheetpath.Path() )
1673 SCH_SCREEN* curr_screen = sheetpath.LastScreen();
1688 std::vector<SCH_ITEM*> items;
1693 return a->
m_Uuid < b->m_Uuid;
1696 std::set<
EDA_ITEM*,
decltype( timestamp_cmp )> unique_stamps( timestamp_cmp );
1699 screen->GetHierarchicalItems( &items );
1701 if( items.size() < 2 )
1706 if( !unique_stamps.insert( item ).second )
1711 const_cast<KIID&
>( item->m_Uuid ) =
KIID();
1728 for(
SCH_ITEM* item : screen->Items() )
1729 item->ClearEditFlags();
1740 if( item == aMarker )
1742 screen->DeleteItem( item );
1751 bool aIncludeExclusions )
1755 std::vector<SCH_ITEM*> markers;
1760 std::shared_ptr<RC_ITEM>rcItem = marker->
GetRCItem();
1763 && ( aErrorCode ==
ERCE_UNSPECIFIED || rcItem->GetErrorCode() == aErrorCode )
1764 && ( !marker->
IsExcluded() || aIncludeExclusions ) )
1766 markers.push_back( item );
1771 screen->DeleteItem( marker );
1777 bool aIncludeExclusions )
1786 screen->UpdateSymbolLinks( aReporter );
1795 wxCHECK_RET( sch,
"Null schematic in SCH_SCREENS::UpdateSymbolLinks" );
1808 bool has_symbols =
false;
1823 return has_symbols ? true :
false;
1836 if( !nickname.
empty() && ( aLibNicknames.Index( nickname ) == wxNOT_FOUND ) )
1837 aLibNicknames.Add( nickname );
1841 return aLibNicknames.GetCount();
1874 if( screen->GetFileName() == aSchematicFileName )
1887 wxFileName rhs = aSchematicFileName;
1889 wxCHECK( rhs.IsAbsolute(),
false );
1893 lhs = screen->GetFileName();
1895 if( lhs.GetPath() != rhs.GetPath() )
1898 lhsLower = lhs.GetFullName().Lower();
1899 rhsLower = rhs.GetFullName().Lower();
1901 if( lhsLower == rhsLower && lhs.GetFullName() != rhs.GetFullName() )
1918 wxCHECK_RET( sch,
"Null schematic in SCH_SCREENS::BuildClientSheetPathList" );
1921 curr_screen->GetClientSheetPaths().clear();
1925 SCH_SCREEN* used_screen = sheetpath.LastScreen();
1930 if( used_screen == curr_screen )
1943 screen->SetLegacySymbolInstanceData();
1957 SIM_MODEL::MigrateSimModel<SCH_SYMBOL, SCH_FIELD>( *symbol, &
Schematic()->
Prj() );
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 InitDataPoints(const wxSize &aPageSizeInternalUnits)
void SetContentModified(bool aModified=true)
void SetOrigin(const Vec &pos)
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
void Recalculate(const SCH_SHEET_LIST &aSheetList, bool aUnconditional=false, std::function< void(SCH_ITEM *)> *aChangedItemHandler=nullptr)
Updates the connection graph for the given list of sheets.
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
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.
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()
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
int GetDefaultPenWidth() const
A logical library item identifier and consists of various portions much like a URI.
const wxString GetUniStringLibItemName() const
Get strings for display messages in dialogs.
int SetLibNickname(const UTF8 &aNickname)
Override the logical library name portion of the LIB_ID to aNickname.
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Define a library symbol object.
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
LIB_ID GetLibId() 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 TYPEMARKER GetMarkerType() const
const wxSize 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 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 GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
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,...
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
int GetAngleFrom(const VECTOR2I &aPoint) const
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 buildScreenList(SCH_SHEET *aSheet)
void DeleteMarkers(enum MARKER_BASE::TYPEMARKER aMarkerTyp, int aErrorCode, bool aIncludeExclusions=true)
Delete all markers of a particular type and error code.
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
void ClearAnnotationOfNewSheetPaths(SCH_SHEET_LIST &aInitialSheetPathList)
Clear the annotation for the symbols inside new sheetpaths when a complex hierarchy is modified and n...
bool CanCauseCaseSensitivityIssue(const wxString &aSchematicFileName) const
Check aSchematicFileName for a potential file name case sensitivity issue.
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...
void DeleteAllMarkers(enum MARKER_BASE::TYPEMARKER aMarkerType, bool aIncludeExclusions)
Delete all electronic rules check markers of aMarkerType from all the screens in the list.
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.
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 Update(SCH_ITEM *aItem)
Update aItem's bounding box in the tree.
void AddLibSymbol(LIB_SYMBOL *aLibSymbol)
Add aLibSymbol to the library symbol map.
void AddBusAlias(std::shared_ptr< BUS_ALIAS > aAlias)
Add a bus alias definition (and transfers ownership of the pointer).
bool HasItems(KICAD_T aItemType) const
void Clear(bool aFree=true)
Delete all draw items and clears the project settings.
LIB_PIN * GetPin(const VECTOR2I &aPosition, SCH_SYMBOL **aSymbol=nullptr, bool aEndPointOnly=false) const
Test the screen for a symbol pin item at aPosition.
bool Remove(SCH_ITEM *aItem)
Remove aItem from the schematic associated with this screen.
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...
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.
void Print(const RENDER_SETTINGS *aSettings)
Print all the items in the screen to aDC.
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.
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...
std::set< std::shared_ptr< BUS_ALIAS > > m_aliases
List of bus aliases stored in this screen.
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
SCH_SCREEN(EDA_ITEM *aParent=nullptr)
SCHEMATIC * Schematic() const
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 Plot(PLOTTER *aPlotter) const
Plot all the schematic objects to aPlotter.
void FreeDrawList()
Free all the items from the schematic associated with the screen.
virtual wxString GetClass() const override
Return the class name.
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.
TEXT_SPIN_STYLE GetLabelOrientationForPoint(const VECTOR2I &aPosition, TEXT_SPIN_STYLE aDefaultOrientation, const SCH_SHEET_PATH *aSheet) const
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.
void ClearAnnotation(SCH_SHEET_PATH *aSheetPath, bool aResetPrefix)
Clear the annotation for the symbols in aSheetPath on the screen.
bool doIsJunction(const VECTOR2I &aPosition, bool aBreakCrossings, bool *aHasExplicitJunctionDot, bool *aHasBusEntry) const
size_t CountConnectedItems(const VECTOR2I &aPos, bool aTestJunctions) const
void MigrateSimModels()
Migrate any symbols having V6 simulation models to their V7 equivalents.
void Append(SCH_ITEM *aItem)
void DeleteItem(SCH_ITEM *aItem)
Removes aItem from the linked list and deletes the object.
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.
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.
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
void GetLibPins(std::vector< LIB_PIN * > &aPinsList) const
Populate a vector with all the pins from the library object.
void SetLibId(const LIB_ID &aName)
LIB_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 > & GetInstanceReferences()
wxString GetSchSymbolLibraryName() const
bool AddSheetPathReferenceEntryIfMissing(const KIID_PATH &aSheetPath)
Add an instance to the alternate references list (m_instanceReferences), if this entry does not alrea...
VECTOR2I GetPinPhysicalPosition(const LIB_PIN *Pin) const
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath, bool aResetPrefix)
Clear exiting symbol annotation.
std::vector< SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve a list of the SCH_PINs for the given sheet path.
void AddHierarchicalReference(const KIID_PATH &aPath, const wxString &aRef, int aUnit)
Add a full hierarchical reference to this symbol.
void SetSchSymbolLibraryName(const wxString &aName)
The name of the symbol in the schematic library symbol list.
int GetOrientation() const
Get the display symbol orientation.
const LIB_ID & GetLibId() const
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
void SetLibSymbol(LIB_SYMBOL *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
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.
boost::ptr_vector< WIRE > WIRES
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
Plot settings, and plotting engines (PostScript, Gerber, HPGL and DXF)
SYMBOL_ORIENTATION_T
enum used in RotationMiroir()
@ SYM_ROTATE_COUNTERCLOCKWISE
wxString UnescapeString(const wxString &aSource)
The EE_TYPE struct provides a type-specific auto-range iterator to the RTree.
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".
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.