KiCad PCB EDA Suite
SCH_SCREEN Class Reference

#include <sch_screen.h>

Inheritance diagram for SCH_SCREEN:
BASE_SCREEN EDA_ITEM KIGFX::VIEW_ITEM INSPECTABLE

Public Member Functions

 SCH_SCREEN (EDA_ITEM *aParent=nullptr)
 
 ~SCH_SCREEN ()
 
SCHEMATICSchematic () const
 
EE_RTREEItems ()
 Gets the full RTree, usually for iterating. More...
 
const EE_RTREEItems () const
 
bool IsEmpty () const
 
bool HasItems (KICAD_T aItemType) const
 
bool HasSheets () const
 
virtual wxString GetClass () const override
 Return the class name. More...
 
void SetFileFormatVersionAtLoad (int aVersion)
 
int GetFileFormatVersionAtLoad () const
 
const PAGE_INFOGetPageSettings () const
 
void SetPageSettings (const PAGE_INFO &aPageSettings)
 
void SetFileName (const wxString &aFileName)
 Set the file name for this screen to aFileName. More...
 
const wxString & GetFileName () const
 
void SetFileReadOnly (bool aIsReadOnly)
 
bool IsReadOnly () const
 
void SetFileExists (bool aFileExists)
 
bool FileExists () const
 
const VECTOR2IGetAuxOrigin () const
 
void SetAuxOrigin (const VECTOR2I &aPosition)
 
const TITLE_BLOCKGetTitleBlock () const
 
void SetTitleBlock (const TITLE_BLOCK &aTitleBlock)
 
void DecRefCount ()
 
void IncRefCount ()
 
int GetRefCount () const
 
void SetConnectivityDirty ()
 
std::vector< SCH_SHEET_PATH > & GetClientSheetPaths ()
 Return the number of times this screen is used. More...
 
void Append (SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
 
void Append (SCH_SCREEN *aScreen)
 Copy the contents of aScreen into this SCH_SCREEN object. More...
 
void Clear (bool aFree=true)
 Delete all draw items and clears the project settings. More...
 
void FreeDrawList ()
 Free all the items from the schematic associated with the screen. More...
 
SCH_ITEMGetItem (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. More...
 
void UpdateSymbolLinks (REPORTER *aReporter=nullptr)
 Initialize the LIB_SYMBOL reference for each SCH_SYMBOL found in this schematic from the project SYMBOL_LIB_TABLE. More...
 
void UpdateLocalLibSymbolLinks ()
 Initialize the LIB_SYMBOL reference for each SCH_SYMBOL found in this schematic with the local project library symbols. More...
 
void Print (const RENDER_SETTINGS *aSettings)
 Print all the items in the screen to aDC. More...
 
void Plot (PLOTTER *aPlotter) const
 Plot all the schematic objects to aPlotter. More...
 
bool Remove (SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
 Remove aItem from the schematic associated with this screen. More...
 
void Update (SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
 Update aItem's bounding box in the tree. More...
 
void DeleteItem (SCH_ITEM *aItem)
 Removes aItem from the linked list and deletes the object. More...
 
bool CheckIfOnDrawList (const SCH_ITEM *aItem) 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. More...
 
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. More...
 
void ClearDrawingState ()
 Clear the state flags of all the items in the screen. More...
 
size_t CountConnectedItems (const VECTOR2I &aPos, bool aTestJunctions) const
 
bool IsJunction (const VECTOR2I &aPosition) const
 Test if a junction is required for the items at aPosition on the screen. More...
 
bool IsExplicitJunction (const VECTOR2I &aPosition) const
 Indicates that a junction dot is necessary at the given location. More...
 
bool IsExplicitJunctionNeeded (const VECTOR2I &aPosition) const
 Indicates that a junction dot is necessary at the given location, and does not yet exist. More...
 
TEXT_SPIN_STYLE GetLabelOrientationForPoint (const VECTOR2I &aPosition, TEXT_SPIN_STYLE aDefaultOrientation, const SCH_SHEET_PATH *aSheet) const
 
bool IsExplicitJunctionAllowed (const VECTOR2I &aPosition) const
 Indicates that a juction dot may be placed at the given location. More...
 
bool IsTerminalPoint (const VECTOR2I &aPosition, int aLayer) const
 Test if aPosition is a connection point on aLayer. More...
 
LIB_PINGetPin (const VECTOR2I &aPosition, SCH_SYMBOL **aSymbol=nullptr, bool aEndPointOnly=false) const
 Test the screen for a symbol pin item at aPosition. More...
 
SCH_SHEET_PINGetSheetPin (const VECTOR2I &aPosition) const
 Test the screen if aPosition is a sheet label object. More...
 
void ClearAnnotation (SCH_SHEET_PATH *aSheetPath, bool aResetPrefix)
 Clear the annotation for the symbols in aSheetPath on the screen. More...
 
void EnsureAlternateReferencesExist ()
 For screens shared by many sheetpaths (complex hierarchies): to be able to clear or modify any reference related sharing this screen (i.e. More...
 
void GetHierarchicalItems (std::vector< SCH_ITEM * > *aItems) const
 Add all schematic sheet and symbol objects in the screen to aItems. More...
 
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, T-B) for sheet numbering. More...
 
SCH_LINEGetLine (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. More...
 
SCH_LINEGetWire (const VECTOR2I &aPosition, int aAccuracy=0, SCH_LINE_TEST_T aSearchType=ENTIRE_LENGTH_T) const
 
SCH_LINEGetBus (const VECTOR2I &aPosition, int aAccuracy=0, SCH_LINE_TEST_T aSearchType=ENTIRE_LENGTH_T) const
 
std::vector< SCH_LINE * > GetBusesAndWires (const VECTOR2I &aPosition, bool aIgnoreEndpoints=false) const
 Return buses and wires passing through aPosition. More...
 
std::vector< VECTOR2IGetConnections () const
 Collect a unique list of all possible connection points in the schematic. More...
 
std::vector< VECTOR2IGetNeededJunctions (const std::deque< EDA_ITEM * > &aItems) const
 Return the unique set of points belonging to aItems where a junction is needed. More...
 
SCH_LABEL_BASEGetLabel (const VECTOR2I &aPosition, int aAccuracy=0) const
 Return a label item located at aPosition. More...
 
std::map< wxString, LIB_SYMBOL * > & GetLibSymbols ()
 Fetch a list of unique LIB_SYMBOL object pointers required to properly render each SCH_SYMBOL in this schematic. More...
 
const std::map< wxString, LIB_SYMBOL * > & GetLibSymbols () const
 
void AddLibSymbol (LIB_SYMBOL *aLibSymbol)
 Add aLibSymbol to the library symbol map. More...
 
void AddBusAlias (std::shared_ptr< BUS_ALIAS > aAlias)
 Add a bus alias definition (and transfers ownership of the pointer). More...
 
void ClearBusAliases ()
 Remove all bus alias definitions. More...
 
std::set< std::shared_ptr< BUS_ALIAS > > GetBusAliases () const
 Return a list of bus aliases defined in this screen. More...
 
const std::vector< SCH_SYMBOL_INSTANCE > & GetSymbolInstances () const
 
const std::vector< SCH_SHEET_INSTANCE > & GetSheetInstances () const
 
const KIIDGetUuid () const
 
void AssignNewUuid ()
 
void SetLegacySymbolInstanceData ()
 Update the symbol value and footprint instance data for legacy designs. More...
 
void FixLegacyPowerSymbolMismatches ()
 Fix legacy power symbols that have mismatched value text fields and invisible power pin names. More...
 
bool AllSymbolDefaultInstancesNotSet ()
 Check all symbol default instance to see if they are not set yet. More...
 
void MigrateSimModels ()
 Migrate any symbols having V6 simulation models to their V7 equivalents. More...
 
void InitDataPoints (const VECTOR2I &aPageSizeInternalUnits)
 
void SetContentModified (bool aModified=true)
 
bool IsContentModified () const
 
int GetPageCount () const
 
void SetPageCount (int aPageCount)
 
int GetVirtualPageNumber () const
 
void SetVirtualPageNumber (int aPageNumber)
 
const wxString & GetPageNumber () const
 
void SetPageNumber (const wxString &aPageNumber)
 
KICAD_T Type () const
 Returns the type of object. More...
 
EDA_ITEMGetParent () const
 
virtual void SetParent (EDA_ITEM *aParent)
 
bool IsModified () const
 
bool IsNew () const
 
bool IsMoving () const
 
bool IsSelected () const
 
bool IsEntered () const
 
bool IsBrightened () const
 
bool IsRollover () const
 
void SetSelected ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (EDA_ITEM_FLAGS type) const
 
void SetState (EDA_ITEM_FLAGS type, bool state)
 
EDA_ITEM_FLAGS GetStatus () const
 
void SetStatus (EDA_ITEM_FLAGS aStatus)
 
void SetFlags (EDA_ITEM_FLAGS aMask)
 
void XorFlags (EDA_ITEM_FLAGS aMask)
 
void ClearFlags (EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
EDA_ITEM_FLAGS GetFlags () const
 
bool HasFlag (EDA_ITEM_FLAGS aFlag) const
 
EDA_ITEM_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
virtual bool RenderAsBitmap (double aWorldScale) const
 
void SetIsShownAsBitmap (bool aBitmap)
 
bool IsShownAsBitmap () const
 
virtual bool IsType (const std::vector< KICAD_T > &aScanTypes) const
 Check whether the item is one of the listed types. More...
 
void SetForceVisible (bool aEnable)
 Set and clear force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
bool IsForceVisible () const
 
virtual void GetMsgPanelInfo (EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
 Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes. More...
 
virtual wxString GetFriendlyName () const
 
virtual bool HitTest (const VECTOR2I &aPosition, int aAccuracy=0) const
 Test if aPosition is inside or on the boundary of this item. More...
 
virtual bool HitTest (const BOX2I &aRect, bool aContained, int aAccuracy=0) const
 Test if aRect intersects this item. More...
 
virtual const BOX2I GetBoundingBox () const
 Return the orthogonal bounding box of this object for display purposes. More...
 
virtual VECTOR2I GetPosition () const
 
virtual void SetPosition (const VECTOR2I &aPos)
 
virtual const VECTOR2I GetFocusPosition () const
 Similar to GetPosition, but allows items to return their visual center rather than their anchor. More...
 
virtual VECTOR2I GetSortPosition () const
 Return the coordinates that should be used for sorting this element visually compared to other elements. More...
 
virtual EDA_ITEMClone () const
 Create a duplicate of this item with linked list members set to NULL. More...
 
virtual INSPECT_RESULT Visit (INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes)
 May be re-implemented for each derived class in order to handle all the types given by its member data. More...
 
wxString GetTypeDesc () const
 Return a translated description of the type for this EDA_ITEM for display in user facing messages. More...
 
virtual wxString GetItemDescription (UNITS_PROVIDER *aUnitsProvider) const
 Return a user-visible description string of this item. More...
 
virtual BITMAPS GetMenuImage () const
 Return a pointer to an image to be used in menus. More...
 
virtual bool Matches (const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
 Compare the item against the search criteria in aSearchData. More...
 
virtual bool Replace (const EDA_SEARCH_DATA &aSearchData, void *aAuxData=nullptr)
 Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Override this method in any derived object that supports test find and replace. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual const BOX2I ViewBBox () const override
 Return the bounding box of the item covering all its layers. More...
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 Return the all the layers within the VIEW the object is painted on. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Draw the parts of the object belonging to layer aLayer. More...
 
virtual double ViewGetLOD (int aLayer, VIEW *aView) const
 Return the level of detail (LOD) of the item. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 
bool Set (PROPERTY_BASE *aProperty, wxAny &aValue)
 
template<typename T >
bool Set (PROPERTY_BASE *aProperty, T aValue)
 
template<typename T >
bool Set (const wxString &aProperty, T aValue)
 
wxAny Get (PROPERTY_BASE *aProperty) const
 
template<typename T >
Get (PROPERTY_BASE *aProperty) const
 
template<typename T >
std::optional< T > Get (const wxString &aProperty) const
 

Static Public Member Functions

static bool ClassOf (const EDA_ITEM *aItem)
 
template<class T >
static INSPECT_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes)
 This changes first parameter to avoid the DList and use the main queue instead. More...
 
template<class T >
static INSPECT_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes)
 Change first parameter to avoid the DList and use std::vector instead. More...
 
static bool Replace (const EDA_SEARCH_DATA &aSearchData, wxString &aText)
 Perform a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
static bool Sort (const EDA_ITEM *aLeft, const EDA_ITEM *aRight)
 Helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers. More...
 

Public Attributes

double m_LastZoomLevel
 last value for the zoom level, useful in Eeschema when changing the current displayed sheet to reuse the same zoom level when back to the sheet using this screen More...
 
VECTOR2I m_DrawOrg
 offsets for drawing the circuit on the screen More...
 
VECTOR2D m_LocalOrigin
 Relative Screen cursor coordinate (on grid) in user units. More...
 
VECTOR2I m_StartVisu
 Coordinates in drawing units of the current view position (upper left corner of device) More...
 
bool m_Center
 Center on screen. More...
 
VECTOR2D m_ScrollCenter
 Current scroll center point in logical units. More...
 
const KIID m_Uuid
 

Static Public Attributes

static wxString m_DrawingSheetFileName
 the name of the drawing sheet file, or empty to use the default drawing sheet More...
 

Protected Member Functions

bool Matches (const wxString &aText, const EDA_SEARCH_DATA &aSearchData) const
 Compare aText against search criteria in aSearchData. More...
 

Protected Attributes

int m_pageCount
 The number of BASE_SCREEN objects in this design. More...
 
int m_virtualPageNumber
 An integer based page number used for printing a range of pages. More...
 
wxString m_pageNumber
 A user defined string page number used for printing and plotting. More...
 
EDA_ITEM_FLAGS m_status
 
EDA_ITEMm_parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
EDA_ITEM_FLAGS m_flags
 

Private Member Functions

bool doIsJunction (const VECTOR2I &aPosition, bool aBreakCrossings, bool *aHasExplicitJunctionDot, bool *aHasBusEntry) const
 
void clearLibSymbols ()
 
size_t getLibSymbolNameMatches (const SCH_SYMBOL &aSymbol, std::vector< wxString > &aMatches)
 Return a list of potential library symbol matches for aSymbol. More...
 

Private Attributes

friend SCH_EDIT_FRAME
 
friend SCH_SEXPR_PARSER
 
friend SCH_SEXPR_PLUGIN
 
friend SCH_ALTIUM_PLUGIN
 
wxString m_fileName
 
int m_fileFormatVersionAtLoad
 
int m_refCount
 
std::vector< SCH_SHEET_PATHm_clientSheetPathList
 The list of sheet paths sharing this screen. More...
 
PAGE_INFO m_paper
 
TITLE_BLOCK m_titles
 
VECTOR2I m_aux_origin
 
EE_RTREE m_rtree
 
int m_modification_sync
 
bool m_zoomInitialized
 
bool m_isReadOnly
 Read only status of the screen file. More...
 
bool m_fileExists
 
std::set< std::shared_ptr< BUS_ALIAS > > m_aliases
 List of bus aliases stored in this screen. More...
 
std::map< wxString, LIB_SYMBOL * > m_libSymbols
 Library symbols required for this schematic. More...
 
std::vector< SCH_SYMBOL_INSTANCEm_symbolInstances
 The list of symbol instances loaded from the schematic file. More...
 
std::vector< SCH_SHEET_INSTANCEm_sheetInstances
 
KIID m_uuid
 A unique identifier for each schematic file. More...
 
bool m_flagModified
 Indicates current drawing has been modified. More...
 
KICAD_T m_structType
 Run time identification, keep private so it can never be changed after a ctor sets it. More...
 
VIEW_ITEM_DATA * m_viewPrivData
 

Detailed Description

Definition at line 91 of file sch_screen.h.

Constructor & Destructor Documentation

◆ SCH_SCREEN()

SCH_SCREEN::SCH_SCREEN ( EDA_ITEM aParent = nullptr)

Definition at line 66 of file sch_screen.cpp.

66 :
67 BASE_SCREEN( aParent, SCH_SCREEN_T ),
69 m_paper( wxT( "A4" ) ),
70 m_isReadOnly( false ),
71 m_fileExists( false )
72{
74 m_refCount = 0;
75 m_zoomInitialized = false;
76 m_LastZoomLevel = 1.0;
77
78 // Suitable for schematic only. For symbol_editor and viewlib, must be set to true
79 m_Center = false;
80
82}
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
bool m_Center
Center on screen.
Definition: base_screen.h:96
BASE_SCREEN(EDA_ITEM *aParent, KICAD_T aType=SCREEN_T)
Definition: base_screen.cpp:35
void InitDataPoints(const VECTOR2I &aPageSizeInternalUnits)
Definition: base_screen.cpp:46
const VECTOR2I GetSizeIU(double aIUScale) const
Gets the page size in internal units.
Definition: page_info.h:162
bool m_fileExists
Definition: sch_screen.h:617
int m_refCount
Definition: sch_screen.h:591
int m_modification_sync
Definition: sch_screen.h:608
double m_LastZoomLevel
last value for the zoom level, useful in Eeschema when changing the current displayed sheet to reuse ...
Definition: sch_screen.h:586
int m_fileFormatVersionAtLoad
Definition: sch_screen.h:590
bool m_zoomInitialized
Definition: sch_screen.h:611
PAGE_INFO m_paper
Definition: sch_screen.h:603
bool m_isReadOnly
Read only status of the screen file.
Definition: sch_screen.h:614
const double IU_PER_MILS
Definition: base_units.h:78
@ SCH_SCREEN_T
Definition: typeinfo.h:186

References PAGE_INFO::GetSizeIU(), BASE_SCREEN::InitDataPoints(), EDA_IU_SCALE::IU_PER_MILS, BASE_SCREEN::m_Center, m_LastZoomLevel, m_modification_sync, m_paper, m_refCount, m_zoomInitialized, and schIUScale.

◆ ~SCH_SCREEN()

SCH_SCREEN::~SCH_SCREEN ( )

Definition at line 85 of file sch_screen.cpp.

86{
89}
void clearLibSymbols()
Definition: sch_screen.cpp:101
void FreeDrawList()
Free all the items from the schematic associated with the screen.
Definition: sch_screen.cpp:281

References clearLibSymbols(), and FreeDrawList().

Member Function Documentation

◆ AddBusAlias()

void SCH_SCREEN::AddBusAlias ( std::shared_ptr< BUS_ALIAS aAlias)

Add a bus alias definition (and transfers ownership of the pointer).

Definition at line 1557 of file sch_screen.cpp.

1558{
1559 m_aliases.insert( aAlias );
1560}
std::set< std::shared_ptr< BUS_ALIAS > > m_aliases
List of bus aliases stored in this screen.
Definition: sch_screen.h:620

References m_aliases.

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::loadBusses(), SCH_LEGACY_PLUGIN::LoadContent(), and SCH_SEXPR_PARSER::parseBusAlias().

◆ AddLibSymbol()

void SCH_SCREEN::AddLibSymbol ( LIB_SYMBOL aLibSymbol)

Add aLibSymbol to the library symbol map.

The symbol is mapped to the result of LIB_ID::Format(). If a symbol is already mapped, the existing symbol is replaced with aLibSymbol. The screen object takes ownership of the pointer.

Parameters
aLibSymbolA pointer the LIB_SYMBOL to be added to the symbol map.

Definition at line 1539 of file sch_screen.cpp.

1540{
1541 wxCHECK( aLibSymbol, /* void */ );
1542
1543 wxString libSymbolName = aLibSymbol->GetLibId().Format().wx_str();
1544
1545 auto it = m_libSymbols.find( libSymbolName );
1546
1547 if( it != m_libSymbols.end() )
1548 {
1549 delete it->second;
1550 m_libSymbols.erase( it );
1551 }
1552
1553 m_libSymbols[libSymbolName] = aLibSymbol;
1554}
UTF8 Format() const
Definition: lib_id.cpp:117
LIB_ID GetLibId() const override
Definition: lib_symbol.h:141
std::map< wxString, LIB_SYMBOL * > m_libSymbols
Library symbols required for this schematic.
Definition: sch_screen.h:623
wxString wx_str() const
Definition: utf8.cpp:46

References LIB_ID::Format(), LIB_SYMBOL::GetLibId(), m_libSymbols, and UTF8::wx_str().

Referenced by SCH_SEXPR_PARSER::ParseSchematic().

◆ AllSymbolDefaultInstancesNotSet()

bool SCH_SCREEN::AllSymbolDefaultInstancesNotSet ( )

Check all symbol default instance to see if they are not set yet.

◆ Append() [1/2]

void SCH_SCREEN::Append ( SCH_ITEM aItem,
bool  aUpdateLibSymbol = true 
)

Definition at line 145 of file sch_screen.cpp.

146{
147 if( aItem->Type() != SCH_SHEET_PIN_T && aItem->Type() != SCH_FIELD_T )
148 {
149 // Ensure the item can reach the SCHEMATIC through this screen
150 aItem->SetParent( this );
151
152 if( aItem->Type() == SCH_SYMBOL_T && aUpdateLibSymbol )
153 {
154 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( aItem );
155
156 if( symbol->GetLibSymbolRef() )
157 {
158 symbol->GetLibSymbolRef()->GetDrawItems().sort();
159
160 auto it = m_libSymbols.find( symbol->GetSchSymbolLibraryName() );
161
162 if( it == m_libSymbols.end() || !it->second )
163 {
165 new LIB_SYMBOL( *symbol->GetLibSymbolRef() );
166 }
167 else
168 {
169 // The original library symbol may have changed since the last time
170 // it was added to the schematic. If it has changed, then a new name
171 // must be created for the library symbol list to prevent all of the
172 // other schematic symbols referencing that library symbol from changing.
173 LIB_SYMBOL* foundSymbol = it->second;
174
175 foundSymbol->GetDrawItems().sort();
176
177 if( *foundSymbol != *symbol->GetLibSymbolRef() )
178 {
179 wxString newName;
180 std::vector<wxString> matches;
181
182 getLibSymbolNameMatches( *symbol, matches );
183 foundSymbol = nullptr;
184
185 for( const wxString& libSymbolName : matches )
186 {
187 it = m_libSymbols.find( libSymbolName );
188
189 if( it == m_libSymbols.end() )
190 continue;
191
192 foundSymbol = it->second;
193
194 wxCHECK2( foundSymbol, continue );
195
196 if( *foundSymbol == *symbol->GetLibSymbolRef() )
197 {
198 newName = libSymbolName;
199 break;
200 }
201
202 foundSymbol = nullptr;
203 }
204
205 if( !foundSymbol )
206 {
207 int cnt = 1;
208
209 newName.Printf( wxT( "%s_%d" ),
211 cnt );
212
213 while( m_libSymbols.find( newName ) != m_libSymbols.end() )
214 {
215 cnt += 1;
216 newName.Printf( wxT( "%s_%d" ),
218 cnt );
219 }
220 }
221
222 // Update the schematic symbol library link as this symbol only exists
223 // in the schematic.
224 symbol->SetSchSymbolLibraryName( newName );
225
226 if( !foundSymbol )
227 {
228 // Update the schematic symbol library link as this symbol does not
229 // exist in any symbol library.
230 LIB_ID newLibId( wxEmptyString, newName );
231 LIB_SYMBOL* newLibSymbol = new LIB_SYMBOL( *symbol->GetLibSymbolRef() );
232
233 newLibSymbol->SetLibId( newLibId );
234 newLibSymbol->SetName( newName );
235 symbol->SetLibSymbol( newLibSymbol->Flatten().release() );
236 m_libSymbols[newName] = newLibSymbol;
237 }
238 }
239 }
240 }
241 }
242
243 m_rtree.insert( aItem );
245 }
246}
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:100
void insert(SCH_ITEM *aItem)
Insert an item into the tree.
Definition: sch_rtree.h:59
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
const wxString GetUniStringLibItemName() const
Get strings for display messages in dialogs.
Definition: lib_id.h:112
Define a library symbol object.
Definition: lib_symbol.h:99
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
Definition: lib_symbol.h:508
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
Definition: lib_symbol.cpp:453
void SetLibId(const LIB_ID &aLibId)
Definition: lib_symbol.h:142
virtual void SetName(const wxString &aName)
Definition: lib_symbol.cpp:437
void sort()
Definition: multivector.h:247
EE_RTREE m_rtree
Definition: sch_screen.h:606
size_t getLibSymbolNameMatches(const SCH_SYMBOL &aSymbol, std::vector< wxString > &aMatches)
Return a list of potential library symbol matches for aSymbol.
Schematic symbol object.
Definition: sch_symbol.h:81
wxString GetSchSymbolLibraryName() const
Definition: sch_symbol.cpp:294
void SetSchSymbolLibraryName(const wxString &aName)
The name of the symbol in the schematic library symbol list.
Definition: sch_symbol.h:188
const LIB_ID & GetLibId() const
Definition: sch_symbol.h:175
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition: sch_symbol.h:192
void SetLibSymbol(LIB_SYMBOL *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
Definition: sch_symbol.cpp:303
@ SCH_SYMBOL_T
Definition: typeinfo.h:156
@ SCH_FIELD_T
Definition: typeinfo.h:155
@ SCH_SHEET_PIN_T
Definition: typeinfo.h:157

References LIB_SYMBOL::Flatten(), LIB_SYMBOL::GetDrawItems(), SCH_SYMBOL::GetLibId(), getLibSymbolNameMatches(), SCH_SYMBOL::GetLibSymbolRef(), SCH_SYMBOL::GetSchSymbolLibraryName(), LIB_ID::GetUniStringLibItemName(), EE_RTREE::insert(), m_libSymbols, m_modification_sync, m_rtree, SCH_FIELD_T, SCH_SHEET_PIN_T, SCH_SYMBOL_T, LIB_SYMBOL::SetLibId(), SCH_SYMBOL::SetLibSymbol(), LIB_SYMBOL::SetName(), EDA_ITEM::SetParent(), SCH_SYMBOL::SetSchSymbolLibraryName(), MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::sort(), and EDA_ITEM::Type().

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), SCH_EAGLE_PLUGIN::addImplicitConnections(), SCH_ALTIUM_PLUGIN::AddTextBox(), Append(), CONNECTION_GRAPH::ercCheckBusToBusConflicts(), CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts(), CONNECTION_GRAPH::ercCheckBusToNetConflicts(), CONNECTION_GRAPH::ercCheckFloatingWires(), CONNECTION_GRAPH::ercCheckHierSheets(), CONNECTION_GRAPH::ercCheckLabels(), CONNECTION_GRAPH::ercCheckMultipleDrivers(), CONNECTION_GRAPH::ercCheckNoConnects(), SCHEMATIC::FixupJunctions(), CADSTAR_SCH_ARCHIVE_LOADER::loadBusses(), SCH_LEGACY_PLUGIN::LoadContent(), CADSTAR_SCH_ARCHIVE_LOADER::loadHierarchicalSheetPins(), SCH_EAGLE_PLUGIN::loadInstance(), SCH_EAGLE_PLUGIN::loadSchematic(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances(), SCH_EAGLE_PLUGIN::loadSegments(), SCH_EAGLE_PLUGIN::loadSheet(), CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets(), SCH_EDIT_FRAME::LoadSheetFromFile(), DIALOG_ERC::OnRunERCClick(), DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged(), SCH_ALTIUM_PLUGIN::ParseArc(), SCH_ALTIUM_PLUGIN::ParseBezier(), SCH_ALTIUM_PLUGIN::ParseBus(), SCH_ALTIUM_PLUGIN::ParseBusEntry(), SCH_ALTIUM_PLUGIN::ParseComponent(), SCH_ALTIUM_PLUGIN::ParseEllipse(), SCH_ALTIUM_PLUGIN::ParseHarnessConnector(), SCH_ALTIUM_PLUGIN::ParseHarnessPort(), SCH_ALTIUM_PLUGIN::ParseImage(), SCH_ALTIUM_PLUGIN::ParseJunction(), SCH_ALTIUM_PLUGIN::ParseLabel(), SCH_ALTIUM_PLUGIN::ParseLine(), SCH_ALTIUM_PLUGIN::ParseNetLabel(), SCH_ALTIUM_PLUGIN::ParseNoERC(), SCH_ALTIUM_PLUGIN::ParsePolygon(), SCH_ALTIUM_PLUGIN::ParsePolyline(), SCH_ALTIUM_PLUGIN::ParsePort(), SCH_ALTIUM_PLUGIN::ParsePowerPort(), SCH_ALTIUM_PLUGIN::ParseRectangle(), SCH_ALTIUM_PLUGIN::ParseRoundRectangle(), SCH_SEXPR_PARSER::ParseSchematic(), SCH_ALTIUM_PLUGIN::ParseSheetSymbol(), SCH_ALTIUM_PLUGIN::ParseSignalHarness(), SCH_ALTIUM_PLUGIN::ParseWire(), SCH_EDITOR_CONTROL::Paste(), DIALOG_CHANGE_SYMBOLS::processSymbols(), SCH_EDIT_FRAME::ResolveERCExclusions(), ERC_TESTER::TestDuplicateSheetNames(), ERC_TESTER::TestMissingUnits(), ERC_TESTER::TestMultiunitFootprints(), ERC_TESTER::TestMultUnitPinConflicts(), ERC_TESTER::TestSimilarLabels(), ERC_TESTER::TestTextVars(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), Update(), and UpdateSymbolLinks().

◆ Append() [2/2]

void SCH_SCREEN::Append ( SCH_SCREEN aScreen)

Copy the contents of aScreen into this SCH_SCREEN object.

Warning
The contents of Screen cannot contain any duplicate sheet names or any hierarchy recursion issues or bad things will happen.
Parameters
aScreenis the screen to append to this one.
Returns
false if there are any duplicate sheet names or any hierarchy recursion issues the calling this method or KiCad will crash.

Definition at line 249 of file sch_screen.cpp.

250{
251 wxCHECK_RET( aScreen, "Invalid screen object." );
252
253 // No need to descend the hierarchy. Once the top level screen is copied, all of its
254 // children are copied as well.
255 for( SCH_ITEM* aItem : aScreen->m_rtree )
256 Append( aItem );
257
258 aScreen->Clear( false );
259}
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
void Append(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
Definition: sch_screen.cpp:145
void Clear(bool aFree=true)
Delete all draw items and clears the project settings.
Definition: sch_screen.cpp:262

References Append(), Clear(), and m_rtree.

◆ AssignNewUuid()

void SCH_SCREEN::AssignNewUuid ( )
inline

Definition at line 528 of file sch_screen.h.

528{ m_uuid = KIID(); }
Definition: kiid.h:48
KIID m_uuid
A unique identifier for each schematic file.
Definition: sch_screen.h:648

References m_uuid.

Referenced by SCH_EDIT_FRAME::SaveProject().

◆ CheckIfOnDrawList()

bool SCH_SCREEN::CheckIfOnDrawList ( const SCH_ITEM aItem) const

Definition at line 370 of file sch_screen.cpp.

371{
372 return m_rtree.contains( aItem, true );
373}
bool contains(const SCH_ITEM *aItem, bool aRobust=false) const
Determine if a given item exists in the tree.
Definition: sch_rtree.h:125

References EE_RTREE::contains(), and m_rtree.

Referenced by SCH_EDIT_FRAME::AddItemToScreenAndUndoList().

◆ ClassOf()

bool SCH_SCREEN::ClassOf ( const EDA_ITEM aItem)
static

Definition at line 139 of file sch_screen.cpp.

140{
141 return aItem && SCH_SCREEN_T == aItem->Type();
142}

References SCH_SCREEN_T, and EDA_ITEM::Type().

◆ Clear()

void SCH_SCREEN::Clear ( bool  aFree = true)

Delete all draw items and clears the project settings.

Definition at line 262 of file sch_screen.cpp.

263{
264 if( aFree )
265 {
266 FreeDrawList();
268 }
269 else
270 {
271 m_rtree.clear();
272 }
273
274 // Clear the project settings
276
277 m_titles.Clear();
278}
int m_virtualPageNumber
An integer based page number used for printing a range of pages.
Definition: base_screen.h:119
int m_pageCount
The number of BASE_SCREEN objects in this design.
Definition: base_screen.h:111
void clear()
Remove all items from the RTree.
Definition: sch_rtree.h:111
TITLE_BLOCK m_titles
Definition: sch_screen.h:604
void Clear()
Definition: title_block.h:113

References EE_RTREE::clear(), TITLE_BLOCK::Clear(), clearLibSymbols(), FreeDrawList(), BASE_SCREEN::m_pageCount, m_rtree, m_titles, and BASE_SCREEN::m_virtualPageNumber.

Referenced by Append(), SCH_EDIT_FRAME::doCloseWindow(), and SCH_EDITOR_CONTROL::Paste().

◆ ClearAnnotation()

void SCH_SCREEN::ClearAnnotation ( SCH_SHEET_PATH aSheetPath,
bool  aResetPrefix 
)

Clear the annotation for the symbols in aSheetPath on the screen.

Parameters
[in]aSheetPathThe sheet path of the symbol annotation to clear. If NULL then the entire hierarchy is cleared.
[in]aResetPrefixThe annotation prefix ('R', 'U', etc.) should be reset to the symbol library prefix.

Definition at line 1293 of file sch_screen.cpp.

1294{
1295
1296 for( SCH_ITEM* item : Items().OfType( SCH_SYMBOL_T ) )
1297 {
1298 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
1299
1300 symbol->ClearAnnotation( aSheetPath, aResetPrefix );
1301 }
1302}
EE_RTREE & Items()
Gets the full RTree, usually for iterating.
Definition: sch_screen.h:109
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath, bool aResetPrefix)
Clear exiting symbol annotation.

References SCH_SYMBOL::ClearAnnotation(), Items(), and SCH_SYMBOL_T.

Referenced by SCH_SCREENS::ClearAnnotationOfNewSheetPaths(), and SCH_EDIT_TOOL::Properties().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 119 of file eda_item.h.

void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:141
#define BRIGHTENED
item is drawn with a bright contour

References BRIGHTENED, and EDA_ITEM::ClearFlags().

Referenced by SCH_EDIT_FRAME::FocusOnItem(), PCB_BASE_FRAME::FocusOnItems(), EE_SELECTION_TOOL::unhighlight(), PL_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlightInternal(), and SCH_EDITOR_CONTROL::UpdateNetHighlighting().

◆ ClearBusAliases()

void SCH_SCREEN::ClearBusAliases ( )
inline

Remove all bus alias definitions.

Definition at line 503 of file sch_screen.h.

504 {
505 m_aliases.clear();
506 }

References m_aliases.

◆ ClearDrawingState()

void SCH_SCREEN::ClearDrawingState ( )

Clear the state flags of all the items in the screen.

Definition at line 1206 of file sch_screen.cpp.

1207{
1208 for( SCH_ITEM* item : Items() )
1209 item->ClearTempFlags();
1210}

References Items().

Referenced by SCH_EDIT_FRAME::OpenProjectFiles(), and EE_SELECTION_TOOL::SelectConnection().

◆ ClearEditFlags()

◆ ClearFlags()

void EDA_ITEM::ClearFlags ( EDA_ITEM_FLAGS  aMask = EDA_ITEM_ALL_FLAGS)
inlineinherited

Definition at line 141 of file eda_item.h.

141{ m_flags &= ~aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:498

References EDA_ITEM::m_flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_MOVE_TOOL::AlignElements(), SCH_EDIT_TOOL::BreakWire(), FOOTPRINT::BuildCourtyardCaches(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), SCH_EDIT_FRAME::ConvertPart(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), SYMBOL_EDITOR_PIN_TOOL::CreateImagePins(), MICROWAVE_TOOL::createMicrowaveInductor(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), BOARD_COMMIT::dirtyIntersectingZones(), PCB_TOOL_BASE::doInteractiveItemPlacement(), KIGFX::SCH_PAINTER::draw(), SCH_ITEM::Duplicate(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PCB_EDIT_FRAME::ExchangeFootprint(), PCB_SELECTION_TOOL::ExitGroup(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), DRC_INTERACTIVE_COURTYARD_CLEARANCE::Init(), EE_COLLECTOR::Inspect(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), DIALOG_SYMBOL_PROPERTIES::OnUnitChoice(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceFootprint(), SYMBOL_EDITOR_PIN_TOOL::PlacePin(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), PAD_TOOL::RecombinePad(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo(), DRC_TEST_PROVIDER_DISALLOW::Run(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN_CACHE::savePin(), EE_SELECTION_TOOL::selectMultiple(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetIsShownAsBitmap(), BOARD_COMMIT::Stage(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), SCH_DRAWING_TOOLS::TwoClickPlace(), and EE_SELECTION_TOOL::unhighlight().

◆ clearLibSymbols()

void SCH_SCREEN::clearLibSymbols ( )
private

Definition at line 101 of file sch_screen.cpp.

102{
103 for( const std::pair<const wxString, LIB_SYMBOL*>& libSymbol : m_libSymbols )
104 delete libSymbol.second;
105
106 m_libSymbols.clear();
107}

References m_libSymbols.

Referenced by Clear(), UpdateSymbolLinks(), and ~SCH_SCREEN().

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 153 of file eda_item.h.

154 {
156 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
#define SELECTED_BY_DRAG
Item was algorithmically selected as a dragged item.
#define SKIP_STRUCT
flag indicating that the structure should be ignored
#define CANDIDATE
flag indicating that the structure is connected

References CANDIDATE, EDA_ITEM::ClearFlags(), IS_LINKED, SELECTED_BY_DRAG, and SKIP_STRUCT.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles(), and SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 143 of file view_item.h.

144 {
145 m_viewPrivData = nullptr;
146 }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:151

References KIGFX::VIEW_ITEM::m_viewPrivData.

Referenced by KIGFX::VIEW::OnDestroy().

◆ Clone()

EDA_ITEM * EDA_ITEM::Clone ( ) const
virtualinherited

Create a duplicate of this item with linked list members set to NULL.

The default version will return NULL in release builds and likely crash the program. In debug builds, a warning message indicating the derived class has not implemented cloning. This really should be a pure virtual function. Due to the fact that there are so many objects derived from EDA_ITEM, the decision was made to return NULL until all the objects derived from EDA_ITEM implement cloning. Once that happens, this function should be made pure.

Returns
A clone of the item.

Reimplemented in LIB_FIELD, LIB_PIN, LIB_SHAPE, LIB_TEXT, LIB_TEXTBOX, SCH_BITMAP, SCH_BUS_WIRE_ENTRY, SCH_BUS_BUS_ENTRY, SCH_FIELD, SCH_JUNCTION, SCH_LABEL, SCH_DIRECTIVE_LABEL, SCH_GLOBALLABEL, SCH_HIERLABEL, SCH_LINE, SCH_MARKER, SCH_NO_CONNECT, SCH_PIN, SCH_SHAPE, SCH_SHEET, SCH_SHEET_PIN, SCH_SYMBOL, SCH_TEXT, SCH_TEXTBOX, KIGFX::ORIGIN_VIEWITEM, PCB_GROUP, FOOTPRINT, FP_SHAPE, FP_TEXT, FP_TEXTBOX, NETINFO_ITEM, PAD, PCB_BITMAP, PCB_DIM_ALIGNED, PCB_DIM_ORTHOGONAL, PCB_DIM_RADIAL, PCB_DIM_LEADER, PCB_DIM_CENTER, PCB_MARKER, PCB_SHAPE, PCB_TARGET, PCB_TEXT, PCB_TEXTBOX, PCB_TRACK, PCB_ARC, PCB_VIA, ZONE, and FP_ZONE.

Definition at line 82 of file eda_item.cpp.

83{
84 wxCHECK_MSG( false, nullptr, wxT( "Clone not implemented in derived class " ) + GetClass() +
85 wxT( ". Bad programmer!" ) );
86}
virtual wxString GetClass() const =0
Return the class name.

References EDA_ITEM::GetClass().

Referenced by SCH_EDIT_FRAME::AddCopyForRepeatItem(), BOARD_ITEM::Duplicate(), SCH_ITEM::Duplicate(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), LIB_SYMBOL::LIB_SYMBOL(), BOARD_COMMIT::makeImage(), new_clone(), LIB_SYMBOL::operator=(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_LIB_PLUGIN_CACHE::removeSymbol(), PCB_BASE_EDIT_FRAME::saveCopyInUndoList(), CLIPBOARD_IO::SaveSelection(), LIB_SYMBOL::SetConversion(), LIB_SYMBOL::SetUnitCount(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace().

◆ CountConnectedItems()

size_t SCH_SCREEN::CountConnectedItems ( const VECTOR2I aPos,
bool  aTestJunctions 
) const

Definition at line 1279 of file sch_screen.cpp.

1280{
1281 size_t count = 0;
1282
1283 for( const SCH_ITEM* item : Items().Overlapping( aPos ) )
1284 {
1285 if( ( item->Type() != SCH_JUNCTION_T || aTestJunctions ) && item->IsConnected( aPos ) )
1286 count++;
1287 }
1288
1289 return count;
1290}
@ SCH_JUNCTION_T
Definition: typeinfo.h:142

References Items(), and SCH_JUNCTION_T.

◆ DecRefCount()

void SCH_SCREEN::DecRefCount ( )

Definition at line 124 of file sch_screen.cpp.

125{
126 wxCHECK_RET( m_refCount != 0, wxT( "Screen reference count already zero. Bad programmer!" ) );
127 m_refCount--;
128}

References m_refCount.

Referenced by SCH_SHEET::SetScreen(), and SCH_SHEET::~SCH_SHEET().

◆ DeleteItem()

void SCH_SCREEN::DeleteItem ( SCH_ITEM aItem)

Removes aItem from the linked list and deletes the object.

If aItem is a schematic sheet label, it is removed from the screen associated with the sheet that contains the label to be deleted.

Parameters
[in]aItemThe schematic object to be deleted from the screen.

Definition at line 345 of file sch_screen.cpp.

346{
347 wxCHECK_RET( aItem, wxT( "Cannot delete invalid item from screen." ) );
348
349 // Markers are not saved in the file, no need to flag as modified.
350 // TODO: Maybe we should have a listing somewhere of items that aren't saved?
351 if( aItem->Type() != SCH_MARKER_T )
353
354 Remove( aItem );
355
356 if( aItem->Type() == SCH_SHEET_PIN_T )
357 {
358 // This structure is attached to a sheet, get the parent sheet object.
359 SCH_SHEET_PIN* sheetPin = (SCH_SHEET_PIN*) aItem;
360 SCH_SHEET* sheet = sheetPin->GetParent();
361 wxCHECK_RET( sheet, wxT( "Sheet pin parent not properly set, bad programmer!" ) );
362 sheet->RemovePin( sheetPin );
363 return;
364 }
365
366 delete aItem;
367}
void SetContentModified(bool aModified=true)
Definition: base_screen.h:59
bool Remove(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
Remove aItem from the schematic associated with this screen.
Definition: sch_screen.cpp:307
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet_pin.h:66
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.
Definition: sch_sheet.h:57
void RemovePin(const SCH_SHEET_PIN *aSheetPin)
Remove aSheetPin from the sheet.
Definition: sch_sheet.cpp:380
@ SCH_MARKER_T
Definition: typeinfo.h:141

References SCH_SHEET_PIN::GetParent(), Remove(), SCH_SHEET::RemovePin(), SCH_MARKER_T, SCH_SHEET_PIN_T, BASE_SCREEN::SetContentModified(), and EDA_ITEM::Type().

◆ doIsJunction()

bool SCH_SCREEN::doIsJunction ( const VECTOR2I aPosition,
bool  aBreakCrossings,
bool *  aHasExplicitJunctionDot,
bool *  aHasBusEntry 
) const
private

Definition at line 716 of file sch_screen.cpp.

718{
719 enum layers { WIRES = 0, BUSES };
720
721 *aHasExplicitJunctionDot = false;
722 *aHasBusEntry = false;
723
724 bool breakLines[ 2 ] = { false };
725 std::unordered_set<int> exitAngles[ 2 ];
726 std::vector<const SCH_LINE*> midPointLines[ 2 ];
727
728 // A pin at 90° still shouldn't match a line at 90° so just give pins unique numbers
729 int uniqueAngle = 10000;
730
731 for( const SCH_ITEM* item : Items().Overlapping( aPosition ) )
732 {
733 if( item->GetEditFlags() & STRUCT_DELETED )
734 continue;
735
736 switch( item->Type() )
737 {
738 case SCH_JUNCTION_T:
739 if( item->HitTest( aPosition, -1 ) )
740 *aHasExplicitJunctionDot = true;
741
742 break;
743
744 case SCH_LINE_T:
745 {
746 const SCH_LINE* line = static_cast<const SCH_LINE*>( item );
747 int layer;
748
749 if( line->GetStartPoint() == line->GetEndPoint() )
750 break;
751 else if( line->GetLayer() == LAYER_WIRE )
752 layer = WIRES;
753 else if( line->GetLayer() == LAYER_BUS )
754 layer = BUSES;
755 else
756 break;
757
758 if( line->IsConnected( aPosition ) )
759 {
760 breakLines[ layer ] = true;
761 exitAngles[ layer ].insert( line->GetAngleFrom( aPosition ) );
762 }
763 else if( line->HitTest( aPosition, -1 ) )
764 {
765 if( aBreakCrossings )
766 breakLines[ layer ] = true;
767
768 // Defer any line midpoints until we know whether or not we're breaking them
769 midPointLines[ layer ].push_back( line );
770 }
771 }
772 break;
773
775 if( item->IsConnected( aPosition ) )
776 {
777 breakLines[ BUSES ] = true;
778 exitAngles[ BUSES ].insert( uniqueAngle++ );
779 breakLines[ WIRES ] = true;
780 exitAngles[ WIRES ].insert( uniqueAngle++ );
781 *aHasBusEntry = true;
782 }
783
784 break;
785
786 case SCH_SYMBOL_T:
787 case SCH_SHEET_T:
788 if( item->IsConnected( aPosition ) )
789 {
790 breakLines[ WIRES ] = true;
791 exitAngles[ WIRES ].insert( uniqueAngle++ );
792 }
793
794 break;
795
796 default:
797 break;
798 }
799 }
800
801 for( int layer : { WIRES, BUSES } )
802 {
803 if( breakLines[ layer ] )
804 {
805 for( const SCH_LINE* line : midPointLines[ layer ] )
806 {
807 exitAngles[ layer ].insert( line->GetAngleFrom( aPosition ) );
808 exitAngles[ layer ].insert( line->GetReverseAngleFrom( aPosition ) );
809 }
810 }
811 }
812
813 return exitAngles[ WIRES ].size() >= 3 || exitAngles[ BUSES ].size() >= 3;
814}
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:246
bool IsConnected(const VECTOR2I &aPoint) const
Test the item to see if it is connected to aPoint.
Definition: sch_item.cpp:137
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:40
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition: sch_line.cpp:807
int GetReverseAngleFrom(const VECTOR2I &aPoint) const
Definition: sch_line.cpp:445
int GetAngleFrom(const VECTOR2I &aPoint) const
Definition: sch_line.cpp:432
VECTOR2I GetEndPoint() const
Definition: sch_line.h:143
VECTOR2I GetStartPoint() const
Definition: sch_line.h:138
#define STRUCT_DELETED
flag indication structures to be erased
@ LAYER_WIRE
Definition: layer_ids.h:344
@ LAYER_BUS
Definition: layer_ids.h:345
boost::ptr_vector< WIRE > WIRES
Definition: specctra.h:2983
@ SCH_LINE_T
Definition: typeinfo.h:146
@ SCH_SHEET_T
Definition: typeinfo.h:158
@ SCH_BUS_WIRE_ENTRY_T
Definition: typeinfo.h:144

References SCH_LINE::GetAngleFrom(), SCH_LINE::GetEndPoint(), SCH_ITEM::GetLayer(), SCH_LINE::GetStartPoint(), SCH_LINE::HitTest(), SCH_ITEM::IsConnected(), Items(), LAYER_BUS, LAYER_WIRE, SCH_BUS_WIRE_ENTRY_T, SCH_JUNCTION_T, SCH_LINE_T, SCH_SHEET_T, SCH_SYMBOL_T, and STRUCT_DELETED.

Referenced by IsExplicitJunction(), IsExplicitJunctionAllowed(), IsExplicitJunctionNeeded(), and IsJunction().

◆ EnsureAlternateReferencesExist()

void SCH_SCREEN::EnsureAlternateReferencesExist ( )

For screens shared by many sheetpaths (complex hierarchies): to be able to clear or modify any reference related sharing this screen (i.e.

the list of symbols), an entry for each screen path must exist. This function creates missing entries, using as default reference the current reference field and unit number Note: m_clientSheetPathList must be up to date ( built by SCH_SCREENS::BuildClientSheetPathList() )

Definition at line 1305 of file sch_screen.cpp.

1306{
1307 if( GetClientSheetPaths().size() <= 1 ) // No need for alternate reference
1308 return;
1309
1310 for( SCH_ITEM* item : Items().OfType( SCH_SYMBOL_T ) )
1311 {
1312 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
1313
1314 // Add (when not existing) all sheet path entries
1315 for( const SCH_SHEET_PATH& sheet : GetClientSheetPaths() )
1316 symbol->AddSheetPathReferenceEntryIfMissing( sheet.Path() );
1317 }
1318}
std::vector< SCH_SHEET_PATH > & GetClientSheetPaths()
Return the number of times this screen is used.
Definition: sch_screen.h:178
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
bool AddSheetPathReferenceEntryIfMissing(const KIID_PATH &aSheetPath)
Add an instance to the alternate references list (m_instanceReferences), if this entry does not alrea...

References SCH_SYMBOL::AddSheetPathReferenceEntryIfMissing(), GetClientSheetPaths(), Items(), and SCH_SYMBOL_T.

Referenced by SCH_SCREENS::ClearAnnotationOfNewSheetPaths().

◆ FileExists()

bool SCH_SCREEN::FileExists ( ) const
inline

Definition at line 150 of file sch_screen.h.

150{ return m_fileExists; }

References m_fileExists.

Referenced by SCH_EDIT_FRAME::updateTitle().

◆ FixLegacyPowerSymbolMismatches()

void SCH_SCREEN::FixLegacyPowerSymbolMismatches ( )

Fix legacy power symbols that have mismatched value text fields and invisible power pin names.

Definition at line 1579 of file sch_screen.cpp.

1580{
1581 for( SCH_ITEM* item : Items().OfType( SCH_SYMBOL_T ) )
1582 {
1583 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
1584
1585 // Fix pre-8.0 legacy power symbols with invisible pins
1586 // that have mismatched pin names and value fields
1587 if( symbol->GetLibSymbolRef()
1588 && symbol->GetLibSymbolRef()->IsPower()
1589 && symbol->GetAllLibPins().size() > 0
1590 && symbol->GetAllLibPins()[0]->IsGlobalPower()
1591 && !symbol->GetAllLibPins()[0]->IsVisible() )
1592 {
1593 symbol->SetValueFieldText( symbol->GetAllLibPins()[0]->GetName() );
1594 }
1595 }
1596}
void SetValueFieldText(const wxString &aValue)
Definition: sch_symbol.cpp:844
std::vector< LIB_PIN * > GetAllLibPins() const

References SCH_SYMBOL::GetAllLibPins(), SCH_SYMBOL::GetLibSymbolRef(), Items(), SCH_SYMBOL_T, and SCH_SYMBOL::SetValueFieldText().

◆ FreeDrawList()

void SCH_SCREEN::FreeDrawList ( )

Free all the items from the schematic associated with the screen.

This does not delete any sub hierarchies.

Definition at line 281 of file sch_screen.cpp.

282{
283 // We don't know which order we will encounter dependent items (e.g. pins or fields), so
284 // we store the items to be deleted until we've fully cleared the tree before deleting
285 std::vector<SCH_ITEM*> delete_list;
286
287 std::copy_if( m_rtree.begin(), m_rtree.end(), std::back_inserter( delete_list ),
288 []( SCH_ITEM* aItem )
289 {
290 return ( aItem->Type() != SCH_SHEET_PIN_T && aItem->Type() != SCH_FIELD_T );
291 } );
292
293 m_rtree.clear();
294
295 for( SCH_ITEM* item : delete_list )
296 delete item;
297}
iterator end()
Returns a read/write iterator that points to one past the last element in the EE_RTREE.
Definition: sch_rtree.h:285
iterator begin()
Returns a read/write iterator that points to the first element in the EE_RTREE N.B.
Definition: sch_rtree.h:276

References EE_RTREE::begin(), EE_RTREE::clear(), EE_RTREE::end(), and m_rtree.

Referenced by Clear(), and ~SCH_SCREEN().

◆ Get() [1/3]

template<typename T >
std::optional< T > INSPECTABLE::Get ( const wxString &  aProperty) const
inlineinherited

Definition at line 104 of file inspectable.h.

105 {
107 TYPE_ID thisType = TYPE_HASH( *this );
108 PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
109 std::optional<T> ret;
110
111 if( prop )
112 {
113 const void* object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
114
115 if( object )
116 ret = prop->get<T>( object );
117 }
118
119 return ret;
120 }
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.
T get(const void *aObject) const
Definition: property.h:352
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:74
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:76
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
#define TYPE_HASH(x)
Definition: property.h:63
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:46

References PROPERTY_BASE::get(), PROPERTY_MANAGER::GetProperty(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Get() [2/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty) const
inlineinherited

Definition at line 84 of file inspectable.h.

85 {
87 const void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
88 return object ? aProperty->getter( object ) : wxAny();
89 }
virtual wxAny getter(const void *aObject) const =0

References PROPERTY_BASE::getter(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

Referenced by BOOST_AUTO_TEST_CASE(), CLASS_D_DESC::CLASS_D_DESC(), EDA_SHAPE_DESC::EDA_SHAPE_DESC(), PROPERTIES_PANEL::getItemValue(), PCB_EXPR_VAR_REF::GetValue(), and PAD_DESC::PAD_DESC().

◆ Get() [3/3]

template<typename T >
T INSPECTABLE::Get ( PROPERTY_BASE aProperty) const
inlineinherited

Definition at line 92 of file inspectable.h.

93 {
95 const void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
96
97 if( !object )
98 throw std::runtime_error( "Could not cast INSPECTABLE to the requested type" );
99
100 return aProperty->get<T>( object );
101 }

References PROPERTY_BASE::get(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ GetAuxOrigin()

const VECTOR2I & SCH_SCREEN::GetAuxOrigin ( ) const
inline

Definition at line 152 of file sch_screen.h.

152{ return m_aux_origin; }
VECTOR2I m_aux_origin
Definition: sch_screen.h:605

References m_aux_origin.

◆ GetBoundingBox()

const BOX2I EDA_ITEM::GetBoundingBox ( ) const
virtualinherited

Return the orthogonal bounding box of this object for display purposes.

This box should be an enclosing perimeter for visible components of this object, and the units should be in the pcb or schematic coordinate system. It is OK to overestimate the size by a few counts.

Reimplemented in LIB_FIELD, LIB_ITEM, LIB_PIN, LIB_SHAPE, LIB_SYMBOL, LIB_TEXT, SCH_BITMAP, SCH_BUS_ENTRY_BASE, SCH_FIELD, SCH_JUNCTION, SCH_LABEL_BASE, SCH_LINE, SCH_MARKER, SCH_NO_CONNECT, SCH_PIN, SCH_SHAPE, SCH_SHEET, SCH_SYMBOL, SCH_TEXT, GBR_LAYOUT, GERBER_DRAW_ITEM, DS_DRAW_ITEM_LINE, DS_DRAW_ITEM_POLYPOLYGONS, DS_DRAW_ITEM_RECT, DS_DRAW_ITEM_PAGE, DS_DRAW_ITEM_TEXT, DS_DRAW_ITEM_BITMAP, PCB_GROUP, BOARD, FOOTPRINT, FP_TEXT, NETINFO_ITEM, PAD, PCB_BITMAP, PCB_DIMENSION_BASE, PCB_DIM_CENTER, PCB_MARKER, PCB_SHAPE, PCB_TARGET, PCB_TEXT, PCB_TRACK, ZONE, and DS_DRAW_ITEM_BASE.

Definition at line 74 of file eda_item.cpp.

75{
76 // return a zero-sized box per default. derived classes should override
77 // this
78 return BOX2I( VECTOR2I( 0, 0 ), VECTOR2I( 0, 0 ) );
79}
BOX2< VECTOR2I > BOX2I
Definition: box2.h:847
VECTOR2< int > VECTOR2I
Definition: vector2d.h:590

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), CN_ITEM::BBox(), SCH_EDIT_TOOL::ChangeTextType(), TEST_BOARD_ITEM_FIXTURE::CompareItems(), TEST_EE_ITEM_FIXTURE::CompareItems(), EE_RTREE::contains(), BOARD_COMMIT::dirtyIntersectingZones(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), SCH_DRAWING_TOOLS::DrawSheet(), enclosedByAreaFunc(), PCB_SELECTION_TOOL::FindItem(), SCH_FIND_REPLACE_TOOL::FindNext(), LIB_ITEM::GetBoundingBox(), GetBoundingBoxes(), BOARD_ITEM::GetCenter(), SCH_MOVE_TOOL::getConnectedDragItems(), SCH_MOVE_TOOL::getConnectedItems(), EE_SELECTION_TOOL::GuessSelectionCandidates(), EE_RTREE::insert(), intersectsAreaFunc(), MarkConnections(), SCH_EDIT_TOOL::Mirror(), DRC_RTREE::QueryColliding(), EE_RTREE::remove(), SCH_EDIT_TOOL::Rotate(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZone(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstZones(), DRC_TEST_PROVIDER_SOLDER_MASK::testMaskBridges(), GERBVIEW_SELECTION::ViewBBox(), and EDA_ITEM::ViewBBox().

◆ GetBus()

SCH_LINE * SCH_SCREEN::GetBus ( const VECTOR2I aPosition,
int  aAccuracy = 0,
SCH_LINE_TEST_T  aSearchType = ENTIRE_LENGTH_T 
) const
inline

Definition at line 435 of file sch_screen.h.

437 {
438 return GetLine( aPosition, aAccuracy, LAYER_BUS, aSearchType );
439 }
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.

References GetLine(), and LAYER_BUS.

Referenced by IsTerminalPoint(), and CONNECTION_GRAPH::updateItemConnectivity().

◆ GetBusAliases()

std::set< std::shared_ptr< BUS_ALIAS > > SCH_SCREEN::GetBusAliases ( ) const
inline

Return a list of bus aliases defined in this screen.

Definition at line 511 of file sch_screen.h.

512 {
513 return m_aliases;
514 }

References m_aliases.

Referenced by SCH_SEXPR_PLUGIN::Format(), and SCH_LEGACY_PLUGIN::Format().

◆ GetBusesAndWires()

std::vector< SCH_LINE * > SCH_SCREEN::GetBusesAndWires ( const VECTOR2I aPosition,
bool  aIgnoreEndpoints = false 
) const

Return buses and wires passing through aPosition.

Parameters
aPositionPosition to search for
aIgnoreEndpointsIf true, ignore wires/buses with end points matching aPosition
Returns
Buses and wires

Definition at line 1416 of file sch_screen.cpp.

1418{
1419 std::vector<SCH_LINE*> retVal;
1420
1421 for( SCH_ITEM* item : Items().Overlapping( SCH_LINE_T, aPosition ) )
1422 {
1423 if( item->IsType( { SCH_ITEM_LOCATE_WIRE_T, SCH_ITEM_LOCATE_BUS_T } ) )
1424 {
1425 SCH_LINE* wire = static_cast<SCH_LINE*>( item );
1426
1427 if( aIgnoreEndpoints && wire->IsEndPoint( aPosition ) )
1428 continue;
1429
1430 if( IsPointOnSegment( wire->GetStartPoint(), wire->GetEndPoint(), aPosition ) )
1431 retVal.push_back( wire );
1432 }
1433 }
1434
1435 return retVal;
1436}
bool IsEndPoint(const VECTOR2I &aPoint) const
Definition: sch_line.h:92
bool IsPointOnSegment(const VECTOR2I &aSegStart, const VECTOR2I &aSegEnd, const VECTOR2I &aTestPoint)
Test if aTestPoint is on line defined by aSegStart and aSegEnd.
Definition: trigo.cpp:42

References SCH_LINE::GetEndPoint(), SCH_LINE::GetStartPoint(), SCH_LINE::IsEndPoint(), IsPointOnSegment(), Items(), and SCH_LINE_T.

Referenced by SCH_EDIT_FRAME::BreakSegments(), and SCHEMATIC::FixupJunctions().

◆ GetClass()

virtual wxString SCH_SCREEN::GetClass ( ) const
inlineoverridevirtual

Return the class name.

Returns
wxString

Reimplemented from BASE_SCREEN.

Definition at line 123 of file sch_screen.h.

124 {
125 return wxT( "SCH_SCREEN" );
126 }

◆ GetClientSheetPaths()

std::vector< SCH_SHEET_PATH > & SCH_SCREEN::GetClientSheetPaths ( )
inline

Return the number of times this screen is used.

In the legacy file formats: if this screen is used only once (not a complex hierarchy) the reference field can be used to store the symbol reference. If this screen is used more than once (a complex hierarchy), then symbols must have a full alternate reference management via sheet paths.

In the new schematic file format, all instance data is stored in the root sheet even for simple hierarchies.

Returns
the sheet paths sharing this screen.

Definition at line 178 of file sch_screen.h.

179 {
181 }
std::vector< SCH_SHEET_PATH > m_clientSheetPathList
The list of sheet paths sharing this screen.
Definition: sch_screen.h:600

References m_clientSheetPathList.

Referenced by SCH_SCREENS::BuildClientSheetPathList(), EnsureAlternateReferencesExist(), and SCH_EDIT_FRAME::SaveProject().

◆ GetConnections()

std::vector< VECTOR2I > SCH_SCREEN::GetConnections ( ) const

Collect a unique list of all possible connection points in the schematic.

Returns
vector of connections

Definition at line 1439 of file sch_screen.cpp.

1440{
1441 std::vector<VECTOR2I> retval;
1442
1443 for( SCH_ITEM* item : Items() )
1444 {
1445 // Avoid items that are changing
1446 if( !( item->GetEditFlags() & ( IS_MOVING | IS_DELETED ) ) )
1447 {
1448 std::vector<VECTOR2I> pts = item->GetConnectionPoints();
1449 retval.insert( retval.end(), pts.begin(), pts.end() );
1450 }
1451 }
1452
1453 // We always have some overlapping connection points. Drop duplicates here
1454 std::sort( retval.begin(), retval.end(),
1455 []( const VECTOR2I& a, const VECTOR2I& b ) -> bool
1456 {
1457 return a.x < b.x || ( a.x == b.x && a.y < b.y );
1458 } );
1459 retval.erase( std::unique( retval.begin(), retval.end() ), retval.end() );
1460
1461 return retval;
1462}
#define IS_DELETED
#define IS_MOVING
Item being moved.

References IS_DELETED, IS_MOVING, and Items().

Referenced by SCH_LINE_WIRE_BUS_TOOL::finishSegments(), and GetNeededJunctions().

◆ GetEditFlags()

EDA_ITEM_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 145 of file eda_item.h.

146 {
147 constexpr int mask =
149
150 return m_flags & mask;
151 }
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
#define IS_CHANGED
Item was edited, and modified.
#define IS_NEW
New item, just created.
#define IS_BROKEN
Is a segment just broken by BreakSegment.

References IS_BROKEN, IS_CHANGED, IS_MOVING, IS_NEW, IS_PASTED, EDA_ITEM::m_flags, and STRUCT_DELETED.

Referenced by SCH_EDIT_TOOL::ChangeTextType(), EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), SYMBOL_EDITOR_PIN_TOOL::EditPinProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), SCH_SYMBOL::GetMsgPanelInfo(), SELECTION_CONDITIONS::Idle(), SELECTION_CONDITIONS::IdleSelection(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_IMAGE_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), and DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow().

◆ GetFileFormatVersionAtLoad()

int SCH_SCREEN::GetFileFormatVersionAtLoad ( ) const
inline

◆ GetFileName()

◆ GetFlags()

◆ GetFocusPosition()

virtual const VECTOR2I EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

Similar to GetPosition, but allows items to return their visual center rather than their anchor.

Reimplemented in BOARD, PCB_SHAPE, and PCB_TRACK.

Definition at line 256 of file eda_item.h.

256{ return GetPosition(); }
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:249

References EDA_ITEM::GetPosition().

Referenced by SCH_EDIT_FRAME::FocusOnItem().

◆ GetFriendlyName()

wxString EDA_ITEM::GetFriendlyName ( ) const
virtualinherited

Reimplemented in PCB_SHAPE, PCB_TRACK, and ZONE.

Definition at line 310 of file eda_item.cpp.

311{
312 return GetTypeDesc();
313}
wxString GetTypeDesc() const
Return a translated description of the type for this EDA_ITEM for display in user facing messages.
Definition: eda_item.cpp:301

References EDA_ITEM::GetTypeDesc().

Referenced by PROPERTIES_PANEL::rebuildProperties().

◆ GetHierarchicalItems()

void SCH_SCREEN::GetHierarchicalItems ( std::vector< SCH_ITEM * > *  aItems) const

Add all schematic sheet and symbol objects in the screen to aItems.

Parameters
[out]aItemsHierarchical item list to fill.

Definition at line 1321 of file sch_screen.cpp.

1322{
1323 for( SCH_ITEM* item : Items() )
1324 {
1325 if( item->IsType( { SCH_SYMBOL_T, SCH_SHEET_T, SCH_LABEL_LOCATE_ANY_T } ) )
1326 aItems->push_back( item );
1327 }
1328}

References Items().

◆ GetItem()

SCH_ITEM * SCH_SCREEN::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.

Parameters
[in]aPositionPosition in drawing units.
aAccuracyThe maximum distance within Position to check for an item.
aTypeThe type of item to find.
Returns
The item found that meets the search criteria or NULL if none found.

Definition at line 376 of file sch_screen.cpp.

377{
378 BOX2I bbox;
379 bbox.SetOrigin( aPosition );
380 bbox.Inflate( aAccuracy );
381
382 for( SCH_ITEM* item : Items().Overlapping( aType, bbox ) )
383 {
384 if( item->HitTest( aPosition, aAccuracy ) )
385 return item;
386 }
387
388 return nullptr;
389}
void SetOrigin(const Vec &pos)
Definition: box2.h:202
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:506

References BOX2< Vec >::Inflate(), Items(), and BOX2< Vec >::SetOrigin().

Referenced by SCH_EDIT_TOOL::DoDelete(), IsTerminalPoint(), MarkConnections(), and SCH_DRAWING_TOOLS::SingleClickPlace().

◆ GetItemDescription()

wxString EDA_ITEM::GetItemDescription ( UNITS_PROVIDER aUnitsProvider) const
virtualinherited

Return a user-visible description string of this item.

This description is used in disambiguation menus, the message panel, ERC/DRC reports, etc.

The default version of this function raises an assertion in the debug mode and returns a string to indicate that it was not overridden to provide the object specific text.

Returns
The menu text string.

Reimplemented in LIB_FIELD, LIB_PIN, LIB_SHAPE, LIB_TEXT, LIB_TEXTBOX, SCH_BITMAP, SCH_BUS_WIRE_ENTRY, SCH_BUS_BUS_ENTRY, SCH_FIELD, SCH_JUNCTION, SCH_LABEL, SCH_DIRECTIVE_LABEL, SCH_GLOBALLABEL, SCH_HIERLABEL, SCH_LINE, SCH_MARKER, SCH_NO_CONNECT, SCH_PIN, SCH_SHAPE, SCH_SHEET, DELETED_SHEET_ITEM, SCH_SHEET_PIN, SCH_SYMBOL, SCH_TEXT, SCH_TEXTBOX, GERBER_DRAW_ITEM, DELETED_BOARD_ITEM, DS_DRAW_ITEM_LINE, DS_DRAW_ITEM_POLYPOLYGONS, DS_DRAW_ITEM_RECT, DS_DRAW_ITEM_PAGE, DS_DRAW_ITEM_TEXT, DS_DRAW_ITEM_BITMAP, PCB_GROUP, BOARD, FOOTPRINT, FP_SHAPE, FP_TEXT, FP_TEXTBOX, PAD, PCB_BITMAP, PCB_DIMENSION_BASE, PCB_MARKER, PCB_SHAPE, PCB_TARGET, PCB_TEXT, PCB_TEXTBOX, PCB_TRACK, PCB_VIA, and ZONE.

Definition at line 108 of file eda_item.cpp.

109{
110 wxFAIL_MSG( wxT( "GetItemDescription() was not overridden for schematic item type " ) +
111 GetClass() );
112
113 return wxString( wxT( "Undefined item description for " ) + GetClass() );
114}

References EDA_ITEM::GetClass().

Referenced by CONNECTION_GRAPH::collectAllDriverValues(), DIALOG_GROUP_PROPERTIES::DoAddMember(), SELECTION_TOOL::doSelectionMenu(), DRC_ENGINE::EvalRules(), BOARD_INSPECTION_TOOL::getItemDescription(), PCB_MARKER::GetMsgPanelInfo(), ERC_TREE_MODEL::GetValue(), RC_TREE_MODEL::GetValue(), RC_ITEM::ShowReport(), DIALOG_POSITION_RELATIVE::updateAnchorInfo(), and PCB_CONTROL::UpdateMessagePanel().

◆ GetLabel()

SCH_LABEL_BASE * SCH_SCREEN::GetLabel ( const VECTOR2I aPosition,
int  aAccuracy = 0 
) const

Return a label item located at aPosition.

Parameters
[in]aPositionThe VECTOR2I to test for label items.
aAccuracyAmount to inflate the item hit test bounding box.
Returns
The SCH_LABEL_BASE* of the label item found or nullptr.

Definition at line 1515 of file sch_screen.cpp.

1516{
1517 for( SCH_ITEM* item : Items().Overlapping( aPosition, aAccuracy ) )
1518 {
1519 switch( item->Type() )
1520 {
1521 case SCH_LABEL_T:
1522 case SCH_GLOBAL_LABEL_T:
1523 case SCH_HIER_LABEL_T:
1525 if( item->HitTest( aPosition, aAccuracy ) )
1526 return static_cast<SCH_LABEL_BASE*>( item );
1527
1528 break;
1529
1530 default:
1531 ;
1532 }
1533 }
1534
1535 return nullptr;
1536}
@ SCH_DIRECTIVE_LABEL_T
Definition: typeinfo.h:154
@ SCH_LABEL_T
Definition: typeinfo.h:151
@ SCH_HIER_LABEL_T
Definition: typeinfo.h:153
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:152

References Items(), SCH_DIRECTIVE_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, and SCH_LABEL_T.

Referenced by IsTerminalPoint().

◆ GetLabelOrientationForPoint()

TEXT_SPIN_STYLE SCH_SCREEN::GetLabelOrientationForPoint ( const VECTOR2I aPosition,
TEXT_SPIN_STYLE  aDefaultOrientation,
const SCH_SHEET_PATH aSheet 
) const

Definition at line 487 of file sch_screen.cpp.

490{
491 auto ret = aDefaultOrientation;
492 for( SCH_ITEM* item : Items().Overlapping( aPosition ) )
493 {
494 if( item->GetEditFlags() & STRUCT_DELETED )
495 continue;
496
497 switch( item->Type() )
498 {
500 {
501 auto busEntry = static_cast<const SCH_BUS_WIRE_ENTRY*>( item );
502 if( busEntry->m_connected_bus_item )
503 {
504 // bus connected, take the bus direction into consideration ony if it is
505 // vertical or horizontal
506 auto bus = static_cast<const SCH_LINE*>( busEntry->m_connected_bus_item );
507 if( bus->Angle().AsDegrees() == 90.0 )
508 {
509 // bus is vertical -> label shall be horizontal and
510 // shall be placed to the side where the bus entry is
511 if( aPosition.x < bus->GetPosition().x )
513 else if( aPosition.x > bus->GetPosition().x )
515 }
516 else if( bus->Angle().AsDegrees() == 0.0 )
517 {
518 // bus is horizontal -> label shall be vertical and
519 // shall be placed to the side where the bus entry is
520 if( aPosition.y < bus->GetPosition().y )
522 else if( aPosition.y > bus->GetPosition().y )
524 }
525 }
526 }
527 break;
528
529 case SCH_LINE_T:
530 {
531 auto line = static_cast<const SCH_LINE*>( item );
532 // line angles goes between -90 and 90 degrees, but normalize
533 auto angle = line->Angle().Normalize90().AsDegrees();
534
535 if( -45 < angle && angle <= 45 )
536 {
537 if( line->GetStartPoint().x <= line->GetEndPoint().x )
538 {
539 ret = line->GetEndPoint() == aPosition ? TEXT_SPIN_STYLE::RIGHT
541 }
542 else
543 {
544 ret = line->GetEndPoint() == aPosition ? TEXT_SPIN_STYLE::LEFT
546 }
547 }
548 else
549 {
550 if( line->GetStartPoint().y <= line->GetEndPoint().y )
551 {
552 ret = line->GetEndPoint() == aPosition ? TEXT_SPIN_STYLE::BOTTOM
554 }
555 else
556 {
557 ret = line->GetEndPoint() == aPosition ? TEXT_SPIN_STYLE::UP
559 }
560 }
561 }
562 break;
563
564 case SCH_SYMBOL_T:
565 {
566 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
567
568 for( SCH_PIN* pin : symbol->GetPins( aSheet ) )
569 {
570 if( pin->GetPosition() == aPosition )
571 {
572 if( pin->GetOrientation() == PIN_RIGHT )
573 {
575 }
576 else if( pin->GetOrientation() == PIN_LEFT )
577 {
579 }
580 else if( pin->GetOrientation() == PIN_UP )
581 {
583 }
584 else if( pin->GetOrientation() == PIN_DOWN )
585 {
587 }
588
589 switch( static_cast<SYMBOL_ORIENTATION_T>(
590 symbol->GetOrientation() & ( ~( SYM_MIRROR_X | SYM_MIRROR_Y ) ) ) )
591 {
593 case SYM_ORIENT_90:
594 if( ret == TEXT_SPIN_STYLE::UP )
596 else if( ret == TEXT_SPIN_STYLE::BOTTOM )
598 else if( ret == TEXT_SPIN_STYLE::LEFT )
600 else if( ret == TEXT_SPIN_STYLE::RIGHT )
602
603 if( symbol->GetOrientation() & SYM_MIRROR_X )
604 {
605 if( ret == TEXT_SPIN_STYLE::UP )
607 else if( ret == TEXT_SPIN_STYLE::BOTTOM )
609 }
610
611 if( symbol->GetOrientation() & SYM_MIRROR_Y )
612 {
613 if( ret == TEXT_SPIN_STYLE::LEFT )
615 else if( ret == TEXT_SPIN_STYLE::RIGHT )
617 }
618 break;
620 case SYM_ORIENT_270:
621 if( ret == TEXT_SPIN_STYLE::UP )
623 else if( ret == TEXT_SPIN_STYLE::BOTTOM )
625 else if( ret == TEXT_SPIN_STYLE::LEFT )
627 else if( ret == TEXT_SPIN_STYLE::RIGHT )
629
630 if( symbol->GetOrientation() & SYM_MIRROR_X )
631 {
632 if( ret == TEXT_SPIN_STYLE::UP )
634 else if( ret == TEXT_SPIN_STYLE::BOTTOM )
636 }
637
638 if( symbol->GetOrientation() & SYM_MIRROR_Y )
639 {
640 if( ret == TEXT_SPIN_STYLE::LEFT )
642 else if( ret == TEXT_SPIN_STYLE::RIGHT )
644 }
645 break;
646 case SYM_ORIENT_180:
647 if( ret == TEXT_SPIN_STYLE::UP )
649 else if( ret == TEXT_SPIN_STYLE::BOTTOM )
651 else if( ret == TEXT_SPIN_STYLE::LEFT )
653 else if( ret == TEXT_SPIN_STYLE::RIGHT )
655
656 if( symbol->GetOrientation() & SYM_MIRROR_X )
657 {
658 if( ret == TEXT_SPIN_STYLE::UP )
660 else if( ret == TEXT_SPIN_STYLE::BOTTOM )
662 }
663
664 if( symbol->GetOrientation() & SYM_MIRROR_Y )
665 {
666 if( ret == TEXT_SPIN_STYLE::LEFT )
668 else if( ret == TEXT_SPIN_STYLE::RIGHT )
670 }
671 break;
672 case SYM_ORIENT_0:
673 case SYM_NORMAL:
674 default:
675 if( symbol->GetOrientation() & SYM_MIRROR_X )
676 {
677 if( ret == TEXT_SPIN_STYLE::UP )
679 else if( ret == TEXT_SPIN_STYLE::BOTTOM )
681 }
682
683 if( symbol->GetOrientation() & SYM_MIRROR_Y )
684 {
685 if( ret == TEXT_SPIN_STYLE::LEFT )
687 else if( ret == TEXT_SPIN_STYLE::RIGHT )
689 }
690 break;
691 }
692
693 break;
694 }
695 }
696 }
697 break;
698 default: break;
699 }
700 }
701 return ret;
702}
Class for a wire to bus entry.
std::vector< SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve a list of the SCH_PINs for the given sheet path.
int GetOrientation() const
Get the display symbol orientation.
@ PIN_LEFT
Definition: lib_pin.h:46
@ PIN_RIGHT
Definition: lib_pin.h:45
@ PIN_UP
Definition: lib_pin.h:47
@ PIN_DOWN
Definition: lib_pin.h:48
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
SYMBOL_ORIENTATION_T
enum used in RotationMiroir()
@ SYM_ORIENT_270
@ SYM_ROTATE_CLOCKWISE
@ SYM_ROTATE_COUNTERCLOCKWISE
@ SYM_MIRROR_Y
@ SYM_ORIENT_180
@ SYM_MIRROR_X
@ SYM_NORMAL
@ SYM_ORIENT_90
@ SYM_ORIENT_0

References PNS::angle(), TEXT_SPIN_STYLE::BOTTOM, SCH_SYMBOL::GetOrientation(), SCH_SYMBOL::GetPins(), Items(), TEXT_SPIN_STYLE::LEFT, pin, PIN_DOWN, PIN_LEFT, PIN_RIGHT, PIN_UP, TEXT_SPIN_STYLE::RIGHT, SCH_BUS_WIRE_ENTRY_T, SCH_LINE_T, SCH_SYMBOL_T, STRUCT_DELETED, SYM_MIRROR_X, SYM_MIRROR_Y, SYM_NORMAL, SYM_ORIENT_0, SYM_ORIENT_180, SYM_ORIENT_270, SYM_ORIENT_90, SYM_ROTATE_CLOCKWISE, SYM_ROTATE_COUNTERCLOCKWISE, TEXT_SPIN_STYLE::UP, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by SCH_EDIT_FRAME::AutoRotateItem().

◆ getLibSymbolNameMatches()

size_t SCH_SCREEN::getLibSymbolNameMatches ( const SCH_SYMBOL aSymbol,
std::vector< wxString > &  aMatches 
)
private

Return a list of potential library symbol matches for aSymbol.

When and existing library symbol named with the full LIB_ID object is found, there may be more potential matches if the SCH_SCREEN::Append() method need to create an alternate symbol due to differences from the original symbol. This process creates a new library symbol name by adding a "_#" suffix to the existing LIB_ID item name.

Parameters
[in]aSymbolis the schematic symbol to search for potential library symbol matches.
[out]aMatchescontains library cache names of all of the potential matches.
Returns
the number of potential matches found for aSymbol.

Definition at line 1599 of file sch_screen.cpp.

1601{
1602 wxString searchName = aSymbol.GetLibId().GetUniStringLibId();
1603
1604 if( m_libSymbols.find( searchName ) != m_libSymbols.end() )
1605 aMatches.emplace_back( searchName );
1606
1607 searchName = aSymbol.GetLibId().GetUniStringLibItemName() + wxS( "_" );
1608
1609 long tmp;
1610 wxString suffix;
1611
1612 for( auto pair : m_libSymbols )
1613 {
1614 if( pair.first.StartsWith( searchName, &suffix ) && suffix.ToLong( &tmp ) )
1615 aMatches.emplace_back( pair.first );
1616 }
1617
1618 return aMatches.size();
1619}
wxString GetUniStringLibId() const
Definition: lib_id.h:148

References SCH_SYMBOL::GetLibId(), LIB_ID::GetUniStringLibId(), LIB_ID::GetUniStringLibItemName(), and m_libSymbols.

Referenced by Append().

◆ GetLibSymbols() [1/2]

std::map< wxString, LIB_SYMBOL * > & SCH_SCREEN::GetLibSymbols ( )
inline

Fetch a list of unique LIB_SYMBOL object pointers required to properly render each SCH_SYMBOL in this schematic.

Returns
The list of unique LIB_SYMBOL object pointers.

Definition at line 481 of file sch_screen.h.

481{ return m_libSymbols; }

References m_libSymbols.

Referenced by SCH_EDIT_FRAME::CommonSettingsChanged(), NETLIST_EXPORTER_BASE::findNextSymbol(), SCH_SEXPR_PLUGIN::Format(), SCH_EDIT_FRAME::HardRedraw(), and SCH_EDITOR_CONTROL::Paste().

◆ GetLibSymbols() [2/2]

const std::map< wxString, LIB_SYMBOL * > & SCH_SCREEN::GetLibSymbols ( ) const
inline

Definition at line 482 of file sch_screen.h.

482{ return m_libSymbols; }

References m_libSymbols.

◆ GetLine()

SCH_LINE * SCH_SCREEN::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.

Parameters
[in]aPositionThe VECTOR2I to test for a line item.
aAccuracyAmount to inflate the item hit test bounding box.
aLayerThe layer the line is drawn upon.
aSearchTypeAdditional line test criteria.
Returns
The SCH_LINE* of the wire item found at aPosition or NULL if item not found.

Definition at line 1379 of file sch_screen.cpp.

1381{
1382 // an accuracy of 0 had problems with rounding errors; use at least 1
1383 aAccuracy = std::max( aAccuracy, 1 );
1384
1385 for( SCH_ITEM* item : Items().Overlapping( aPosition, aAccuracy ) )
1386 {
1387 if( item->Type() != SCH_LINE_T )
1388 continue;
1389
1390 if( item->GetLayer() != aLayer )
1391 continue;
1392
1393 if( !item->HitTest( aPosition, aAccuracy ) )
1394 continue;
1395
1396 switch( aSearchType )
1397 {
1398 case ENTIRE_LENGTH_T:
1399 return (SCH_LINE*) item;
1400
1402 if( !( (SCH_LINE*) item )->IsEndPoint( aPosition ) )
1403 return (SCH_LINE*) item;
1404 break;
1405
1406 case END_POINTS_ONLY_T:
1407 if( ( (SCH_LINE*) item )->IsEndPoint( aPosition ) )
1408 return (SCH_LINE*) item;
1409 }
1410 }
1411
1412 return nullptr;
1413}
@ ENTIRE_LENGTH_T
Definition: sch_screen.h:72
@ EXCLUDE_END_POINTS_T
Definition: sch_screen.h:74
@ END_POINTS_ONLY_T
Definition: sch_screen.h:73

References END_POINTS_ONLY_T, ENTIRE_LENGTH_T, EXCLUDE_END_POINTS_T, Items(), and SCH_LINE_T.

Referenced by GetBus(), GetWire(), and IsTerminalPoint().

◆ GetMenuImage()

BITMAPS EDA_ITEM::GetMenuImage ( ) const
virtualinherited

Return a pointer to an image to be used in menus.

The default version returns the right arrow image. Override this function to provide object specific menu images.

Returns
The menu image associated with the item.

Reimplemented in LIB_FIELD, LIB_PIN, LIB_SHAPE, LIB_TEXT, LIB_TEXTBOX, SCH_BITMAP, SCH_BUS_WIRE_ENTRY, SCH_BUS_BUS_ENTRY, SCH_FIELD, SCH_JUNCTION, SCH_LABEL, SCH_GLOBALLABEL, SCH_HIERLABEL, SCH_LINE, SCH_MARKER, SCH_NO_CONNECT, SCH_SHAPE, SCH_SHEET, SCH_SHEET_PIN, SCH_SYMBOL, SCH_TEXT, SCH_TEXTBOX, GERBER_DRAW_ITEM, PCB_GROUP, FOOTPRINT, FP_SHAPE, FP_TEXT, FP_TEXTBOX, PAD, PCB_BITMAP, PCB_DIM_ALIGNED, PCB_DIM_ORTHOGONAL, PCB_DIM_RADIAL, PCB_DIM_LEADER, PCB_DIM_CENTER, PCB_MARKER, PCB_SHAPE, PCB_TARGET, PCB_TEXT, PCB_TEXTBOX, PCB_TRACK, PCB_VIA, and ZONE.

Definition at line 269 of file eda_item.cpp.

270{
271 return BITMAPS::dummy_item;
272}

References dummy_item.

Referenced by SELECTION_TOOL::doSelectionMenu().

◆ GetMsgPanelInfo()

◆ GetNeededJunctions()

std::vector< VECTOR2I > SCH_SCREEN::GetNeededJunctions ( const std::deque< EDA_ITEM * > &  aItems) const

Return the unique set of points belonging to aItems where a junction is needed.

Parameters
aItemsList of objects to check
Returns
Points where a junction is needed

Definition at line 1465 of file sch_screen.cpp.

1466{
1467 std::vector<VECTOR2I> pts;
1468 std::vector<VECTOR2I> connections = GetConnections();
1469
1470 for( const EDA_ITEM* edaItem : aItems )
1471 {
1472 const SCH_ITEM* item = dynamic_cast<const SCH_ITEM*>( edaItem );
1473
1474 if( !item || !item->IsConnectable() )
1475 continue;
1476
1477 std::vector<VECTOR2I> new_pts = item->GetConnectionPoints();
1478 pts.insert( pts.end(), new_pts.begin(), new_pts.end() );
1479
1480 // If the item is a line, we also add any connection points from the rest of the schematic
1481 // that terminate on the line after it is moved.
1482 if( item->Type() == SCH_LINE_T )
1483 {
1484 SCH_LINE* line = (SCH_LINE*) item;
1485
1486 for( const VECTOR2I& pt : connections )
1487 {
1488 if( IsPointOnSegment( line->GetStartPoint(), line->GetEndPoint(), pt ) )
1489 pts.push_back( pt );
1490 }
1491 }
1492 }
1493
1494 // We always have some overlapping connection points. Drop duplicates here
1495 std::sort( pts.begin(), pts.end(),
1496 []( const VECTOR2I& a, const VECTOR2I& b ) -> bool
1497 {
1498 return a.x < b.x || ( a.x == b.x && a.y < b.y );
1499 } );
1500
1501 pts.erase( unique( pts.begin(), pts.end() ), pts.end() );
1502
1503 // We only want the needed junction points, remove all the others
1504 pts.erase( std::remove_if( pts.begin(), pts.end(),
1505 [this]( const VECTOR2I& a ) -> bool
1506 {
1507 return !IsExplicitJunctionNeeded( a );
1508 } ),
1509 pts.end() );
1510
1511 return pts;
1512}
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
virtual bool IsConnectable() const
Definition: sch_item.h:349
virtual std::vector< VECTOR2I > GetConnectionPoints() const
Add all the connection points for this item to aPoints.
Definition: sch_item.h:364
std::vector< VECTOR2I > GetConnections() const
Collect a unique list of all possible connection points in the schematic.

References SCH_ITEM::GetConnectionPoints(), GetConnections(), SCH_LINE::GetEndPoint(), SCH_LINE::GetStartPoint(), SCH_ITEM::IsConnectable(), IsPointOnSegment(), SCH_LINE_T, and EDA_ITEM::Type().

Referenced by SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded(), and SCHEMATIC::FixupJunctions().

◆ GetPageCount()

◆ GetPageNumber()

const wxString & BASE_SCREEN::GetPageNumber ( ) const
inherited

Definition at line 71 of file base_screen.cpp.

72{
73 static wxString pageNumber;
74
75 if( m_pageNumber.IsEmpty() )
76 pageNumber.Printf( wxS( "%d" ), m_virtualPageNumber );
77 else
78 pageNumber = m_pageNumber;
79
80 return pageNumber;
81}
wxString m_pageNumber
A user defined string page number used for printing and plotting.
Definition: base_screen.h:129

References BASE_SCREEN::m_pageNumber, and BASE_SCREEN::m_virtualPageNumber.

Referenced by KIGFX::SCH_VIEW::DisplaySheet(), SCH_PLOTTER::plotOneSheetDXF(), SCH_PLOTTER::plotOneSheetHpgl(), SCH_PLOTTER::plotOneSheetPDF(), SCH_PLOTTER::plotOneSheetPS(), SCH_PLOTTER::plotOneSheetSVG(), EDA_DRAW_FRAME::PrintDrawingSheet(), PCB_EDIT_FRAME::SetPageSettings(), and DIALOG_PAGES_SETTINGS::UpdateDrawingSheetExample().

◆ GetPageSettings()

◆ GetParent()

◆ GetPin()

LIB_PIN * SCH_SCREEN::GetPin ( const VECTOR2I aPosition,
SCH_SYMBOL **  aSymbol = nullptr,
bool  aEndPointOnly = false 
) const

Test the screen for a symbol pin item at aPosition.

Parameters
[in]aPositionPosition to test.
[out]aSymbolThe symbol if a pin was found, otherwise NULL.
aEndPointOnlySet to true to test if aPosition is the connection point of the pin.
Returns
The pin item if found, otherwise NULL.

Definition at line 1213 of file sch_screen.cpp.

1215{
1216 SCH_SYMBOL* candidate = nullptr;
1217 LIB_PIN* pin = nullptr;
1218
1219 for( SCH_ITEM* item : Items().Overlapping( SCH_SYMBOL_T, aPosition ) )
1220 {
1221 candidate = static_cast<SCH_SYMBOL*>( item );
1222
1223 if( aEndPointOnly )
1224 {
1225 pin = nullptr;
1226
1227 if( !candidate->GetLibSymbolRef() )
1228 continue;
1229
1230 std::vector<LIB_PIN*> pins;
1231 candidate->GetLibPins( pins );
1232
1233 for( LIB_PIN* test_pin : pins )
1234 {
1235 if( candidate->GetPinPhysicalPosition( test_pin ) == aPosition )
1236 {
1237 pin = test_pin;
1238 break;
1239 }
1240 }
1241
1242 if( pin )
1243 break;
1244 }
1245 else
1246 {
1247 pin = (LIB_PIN*) candidate->GetDrawItem( aPosition, LIB_PIN_T );
1248
1249 if( pin )
1250 break;
1251 }
1252 }
1253
1254 if( pin && aSymbol )
1255 *aSymbol = candidate;
1256
1257 return pin;
1258}
void GetLibPins(std::vector< LIB_PIN * > &aPinsList) const
Populate a vector with all the pins from the library object.
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.
VECTOR2I GetPinPhysicalPosition(const LIB_PIN *Pin) const
@ LIB_PIN_T
Definition: typeinfo.h:202

References SCH_SYMBOL::GetDrawItem(), SCH_SYMBOL::GetLibPins(), SCH_SYMBOL::GetLibSymbolRef(), SCH_SYMBOL::GetPinPhysicalPosition(), Items(), LIB_PIN_T, pin, and SCH_SYMBOL_T.

Referenced by IsTerminalPoint().

◆ GetPosition()

virtual VECTOR2I EDA_ITEM::GetPosition ( ) const
inlinevirtualinherited

Reimplemented in LIB_FIELD, LIB_PIN, LIB_SHAPE, LIB_TEXT, SCH_BITMAP, SCH_BUS_ENTRY_BASE, SCH_FIELD, SCH_JUNCTION, SCH_LINE, SCH_MARKER, SCH_NO_CONNECT, SCH_PIN, SCH_SHAPE, SCH_SHEET, SCH_SYMBOL, SCH_TEXT, GERBER_DRAW_ITEM, DELETED_BOARD_ITEM, DS_DRAW_ITEM_LINE, DS_DRAW_ITEM_POLYPOLYGONS, DS_DRAW_ITEM_RECT, DS_DRAW_ITEM_PAGE, DS_DRAW_ITEM_TEXT, DS_DRAW_ITEM_BITMAP, KIGFX::ORIGIN_VIEWITEM, PCB_GROUP, BOARD, FOOTPRINT, FP_TEXT, NETINFO_ITEM, PAD, PCB_BITMAP, PCB_DIMENSION_BASE, PCB_MARKER, PCB_SHAPE, PCB_TARGET, PCB_TEXT, PCB_TRACK, PCB_ARC, PCB_VIA, and ZONE.

Definition at line 249 of file eda_item.h.

249{ return VECTOR2I(); }

Referenced by SCH_MOVE_TOOL::AlignElements(), SCH_EDITOR_CONTROL::AssignNetclass(), SCH_EDIT_TOOL::ChangeTextType(), TEST_BOARD_ITEM_FIXTURE::CompareItems(), TEST_EE_ITEM_FIXTURE::CompareItems(), PCB_GRID_HELPER::computeAnchors(), EE_GRID_HELPER::computeAnchors(), CONVERT_TOOL::CreatePolys(), SCH_EDIT_FRAME::DeleteJunction(), EDIT_TOOL::doMoveSelection(), KIGFX::PCB_PAINTER::draw(), CONNECTION_GRAPH::ercCheckBusToBusConflicts(), CONNECTION_GRAPH::ercCheckBusToNetConflicts(), CONNECTION_GRAPH::ercCheckMultipleDrivers(), CONNECTION_GRAPH::ercCheckNetclassConflicts(), CONNECTION_GRAPH::ercCheckNoConnects(), PCB_SELECTION_TOOL::FindItem(), GERBVIEW_SELECTION::GetCenter(), EDA_ITEM::GetFocusPosition(), getMinDist(), SCH_FIELD::GetParentPosition(), EDA_ITEM::GetSortPosition(), PCB_SELECTION::GetTopLeftItem(), EE_SELECTION::GetTopLeftItem(), BOARD_ITEM::GetX(), BOARD_ITEM::GetY(), SCH_MOVE_TOOL::Main(), SCH_EDIT_TOOL::Mirror(), SYMBOL_EDITOR_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_FIND_REPLACE_TOOL::nextMatch(), DIALOG_MIGRATE_BUSES::onItemSelected(), BOARD::cmp_items::operator()(), SCH_ITEM::operator<(), SCH_EDITOR_CONTROL::Paste(), PL_EDIT_TOOL::Paste(), PCB_CONTROL::placeBoardItems(), POSITION_RELATIVE_TOOL::PositionRelative(), BACK_ANNOTATE::processNetNameChange(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_EDIT_TOOL::Rotate(), SYMBOL_EDITOR_EDIT_TOOL::Rotate(), test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run(), DRC_TEST_PROVIDER_TEXT_DIMS::Run(), RC_ITEM::ShowReport(), SCH_EDIT_TOOL::Swap(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testShapeLineChain(), DRC_TEST_PROVIDER_MISC::testTextVars(), TransformItem(), DIALOG_POSITION_RELATIVE::UpdateAnchor(), EDIT_TOOL::updateModificationPoint(), and PL_EDIT_TOOL::updateModificationPoint().

◆ GetRefCount()

int SCH_SCREEN::GetRefCount ( ) const
inline

Definition at line 161 of file sch_screen.h.

161{ return m_refCount; }

References m_refCount.

Referenced by SCH_SHEET::GetScreenCount(), SCH_SHEET::SetScreen(), and SCH_SHEET::~SCH_SHEET().

◆ GetSheetInstances()

const std::vector< SCH_SHEET_INSTANCE > & SCH_SCREEN::GetSheetInstances ( ) const
inline

Definition at line 521 of file sch_screen.h.

522 {
523 return m_sheetInstances;
524 }
std::vector< SCH_SHEET_INSTANCE > m_sheetInstances
Definition: sch_screen.h:640

References m_sheetInstances.

Referenced by EESCHEMA_HELPERS::LoadSchematic(), and SCH_EDITOR_CONTROL::setClipboardInstances().

◆ GetSheetPin()

SCH_SHEET_PIN * SCH_SCREEN::GetSheetPin ( const VECTOR2I aPosition) const

Test the screen if aPosition is a sheet label object.

Parameters
[in]aPositionThe position to test.
Returns
The sheet label object if found otherwise NULL.

Definition at line 1261 of file sch_screen.cpp.

1262{
1263 SCH_SHEET_PIN* sheetPin = nullptr;
1264
1265 for( SCH_ITEM* item : Items().Overlapping( SCH_SHEET_T, aPosition ) )
1266 {
1267 SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
1268
1269 sheetPin = sheet->GetPin( aPosition );
1270
1271 if( sheetPin )
1272 break;
1273 }
1274
1275 return sheetPin;
1276}
SCH_SHEET_PIN * GetPin(const VECTOR2I &aPosition)
Return the sheet pin item found at aPosition in the sheet.
Definition: sch_sheet.cpp:582

References SCH_SHEET::GetPin(), Items(), and SCH_SHEET_T.

Referenced by IsTerminalPoint().

◆ GetSheets()

void SCH_SCREEN::GetSheets ( std::vector< SCH_ITEM * > *  aItems) const

Similar to Items().OfType( SCH_SHEET_T ), but return the sheets in a deterministic order (L-R, T-B) for sheet numbering.

Definition at line 1331 of file sch_screen.cpp.

1332{
1333 for( SCH_ITEM* item : Items().OfType( SCH_SHEET_T ) )
1334 aItems->push_back( item );
1335
1336 std::sort( aItems->begin(), aItems->end(),
1337 []( EDA_ITEM* a, EDA_ITEM* b ) -> bool
1338 {
1339 if( a->GetPosition().x == b->GetPosition().x )
1340 {
1341 // Ensure deterministic sort
1342 if( a->GetPosition().y == b->GetPosition().y )
1343 return a->m_Uuid < b->m_Uuid;
1344
1345 return a->GetPosition().y < b->GetPosition().y;
1346 }
1347 else
1348 {
1349 return a->GetPosition().x < b->GetPosition().x;
1350 }
1351 } );
1352}

References Items(), and SCH_SHEET_T.

Referenced by SCH_EDIT_FRAME::AnnotateSymbols(), HIERARCHY_PANE::buildHierarchyTree(), SCH_SHEET_LIST::BuildSheetList(), SCH_EDIT_FRAME::CheckAnnotate(), and SCH_EDIT_FRAME::DeleteAnnotation().

◆ GetSortPosition()

virtual VECTOR2I EDA_ITEM::GetSortPosition ( ) const
inlinevirtualinherited

Return the coordinates that should be used for sorting this element visually compared to other elements.

For instance, for lines the midpoint might be a better sorting point than either end.

Returns
X,Y coordinate of the sort point

Reimplemented in SCH_LINE.

Definition at line 265 of file eda_item.h.

265{ return GetPosition(); }

References EDA_ITEM::GetPosition().

◆ GetState()

int EDA_ITEM::GetState ( EDA_ITEM_FLAGS  type) const
inlineinherited

Definition at line 123 of file eda_item.h.

124 {
125 return m_status & type;
126 }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:495

References EDA_ITEM::m_status.

◆ GetStatus()

EDA_ITEM_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 136 of file eda_item.h.

136{ return m_status; }

References EDA_ITEM::m_status.

◆ GetSymbolInstances()

const std::vector< SCH_SYMBOL_INSTANCE > & SCH_SCREEN::GetSymbolInstances ( ) const
inline

Definition at line 516 of file sch_screen.h.

517 {
518 return m_symbolInstances;
519 }
std::vector< SCH_SYMBOL_INSTANCE > m_symbolInstances
The list of symbol instances loaded from the schematic file.
Definition: sch_screen.h:639

References m_symbolInstances.

Referenced by EESCHEMA_HELPERS::LoadSchematic(), SCH_EDIT_FRAME::LoadSheetFromFile(), and SCH_EDITOR_CONTROL::setClipboardInstances().

◆ GetTitleBlock()

◆ GetTypeDesc()

wxString EDA_ITEM::GetTypeDesc ( ) const
inherited

Return a translated description of the type for this EDA_ITEM for display in user facing messages.

Definition at line 301 of file eda_item.cpp.

302{
303 //@see EDA_ITEM_DESC for definition of ENUM_MAP<KICAD_T>
304 wxString typeDescr = ENUM_MAP<KICAD_T>::Instance().ToString( Type() );
305
306 return wxGetTranslation( typeDescr );
307}
static ENUM_MAP< T > & Instance()
Definition: property.h:623

References ENUM_MAP< T >::Instance(), and EDA_ITEM::Type().

Referenced by PCB_GROUP::AddItem(), EDIT_TOOL::doMoveSelection(), and EDA_ITEM::GetFriendlyName().

◆ GetUuid()

◆ GetVirtualPageNumber()

◆ GetWire()

SCH_LINE * SCH_SCREEN::GetWire ( const VECTOR2I aPosition,
int  aAccuracy = 0,
SCH_LINE_TEST_T  aSearchType = ENTIRE_LENGTH_T 
) const
inline

Definition at line 429 of file sch_screen.h.

431 {
432 return GetLine( aPosition, aAccuracy, LAYER_WIRE, aSearchType );
433 }

References GetLine(), and LAYER_WIRE.

Referenced by IsTerminalPoint().

◆ HasFlag()

◆ HasItems()

bool SCH_SCREEN::HasItems ( KICAD_T  aItemType) const

Definition at line 131 of file sch_screen.cpp.

132{
133 EE_RTREE::EE_TYPE sheets = m_rtree.OfType( aItemType );
134
135 return sheets.begin() != sheets.end();
136}
EE_TYPE OfType(KICAD_T aType) const
Definition: sch_rtree.h:238
The EE_TYPE struct provides a type-specific auto-range iterator to the RTree.
Definition: sch_rtree.h:192
iterator begin()
Definition: sch_rtree.h:222
iterator end()
Definition: sch_rtree.h:227

References EE_RTREE::EE_TYPE::begin(), EE_RTREE::EE_TYPE::end(), m_rtree, and EE_RTREE::OfType().

Referenced by HasSheets().

◆ HasSheets()

bool SCH_SCREEN::HasSheets ( ) const
inline

Definition at line 119 of file sch_screen.h.

119{ return HasItems( SCH_SHEET_T ); }
bool HasItems(KICAD_T aItemType) const
Definition: sch_screen.cpp:131

References HasItems(), and SCH_SHEET_T.

◆ HitTest() [1/2]

virtual bool EDA_ITEM::HitTest ( const BOX2I aRect,
bool  aContained,
int  aAccuracy = 0 
) const
inlinevirtualinherited

Test if aRect intersects this item.

Parameters
aRectA reference to a BOX2I object containing the rectangle to test.
aContainedSet to true to test for containment instead of an intersection.
aAccuracyIncrease aRect by this amount.
Returns
True if aRect contains or intersects the item bounding box.

Reimplemented in LIB_ITEM, LIB_PIN, LIB_SHAPE, LIB_TEXT, LIB_TEXTBOX, SCH_BITMAP, SCH_BUS_ENTRY_BASE, SCH_FIELD, SCH_JUNCTION, SCH_LABEL_BASE, SCH_LINE, SCH_NO_CONNECT, SCH_PIN, SCH_SHAPE, SCH_SHEET, SCH_SYMBOL, SCH_TEXT, SCH_TEXTBOX, DS_DRAW_ITEM_BASE, DS_DRAW_ITEM_POLYPOLYGONS, DS_DRAW_ITEM_RECT, DS_DRAW_ITEM_TEXT, DS_DRAW_ITEM_BITMAP, PCB_GROUP, FOOTPRINT, FP_TEXT, FP_TEXTBOX, PAD, PCB_BITMAP, PCB_DIMENSION_BASE, PCB_SHAPE, PCB_TARGET, PCB_TEXT, PCB_TEXTBOX, PCB_TRACK, PCB_VIA, PCB_ARC, ZONE, and GERBER_DRAW_ITEM.

Definition at line 235 of file eda_item.h.

236 {
237 return false; // derived classes should override this function
238 }

◆ HitTest() [2/2]

virtual bool EDA_ITEM::HitTest ( const VECTOR2I aPosition,
int  aAccuracy = 0 
) const
inlinevirtualinherited

◆ IncRefCount()

void SCH_SCREEN::IncRefCount ( )

Definition at line 118 of file sch_screen.cpp.

119{
120 m_refCount++;
121}

References m_refCount.

Referenced by SCH_SHEET::SCH_SHEET(), and SCH_SHEET::SetScreen().

◆ InitDataPoints()

void BASE_SCREEN::InitDataPoints ( const VECTOR2I aPageSizeInternalUnits)
inherited

Definition at line 46 of file base_screen.cpp.

47{
48 if( m_Center )
49 {
50 m_DrawOrg.x = -aPageSizeIU.x / 2;
51 m_DrawOrg.y = -aPageSizeIU.y / 2;
52 }
53 else
54 {
55 m_DrawOrg.x = 0;
56 m_DrawOrg.y = 0;
57 }
58
59 m_LocalOrigin = { 0, 0 };
60}
VECTOR2I m_DrawOrg
offsets for drawing the circuit on the screen
Definition: base_screen.h:88
VECTOR2D m_LocalOrigin
Relative Screen cursor coordinate (on grid) in user units.
Definition: base_screen.h:90

References BASE_SCREEN::m_Center, BASE_SCREEN::m_DrawOrg, BASE_SCREEN::m_LocalOrigin, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by BASE_SCREEN::BASE_SCREEN(), FOOTPRINT_EDIT_FRAME::Clear_Pcb(), PCB_EDIT_FRAME::Clear_Pcb(), SCH_SCREEN(), PL_EDITOR_FRAME::SetPageSettings(), GERBVIEW_FRAME::SetPageSettings(), and PCB_BASE_FRAME::SetPageSettings().

◆ IsBrightened()

◆ IsContentModified()

◆ IsEmpty()

bool SCH_SCREEN::IsEmpty ( ) const
inline

Definition at line 112 of file sch_screen.h.

113 {
114 return m_rtree.empty();
115 }
bool empty() const
Definition: sch_rtree.h:176

References EE_RTREE::empty(), and m_rtree.

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 107 of file eda_item.h.

107{ return m_flags & ENTERED; }
#define ENTERED
indicates a group has been entered

References ENTERED, and EDA_ITEM::m_flags.

Referenced by KIGFX::PCB_PAINTER::draw().

◆ IsExplicitJunction()

bool SCH_SCREEN::IsExplicitJunction ( const VECTOR2I aPosition) const

Indicates that a junction dot is necessary at the given location.

See IsJunctionNeeded for more info.

Definition at line 468 of file sch_screen.cpp.

469{
470 bool hasExplicitJunction;
471 bool hasBusEntry;
472 bool isJunction = doIsJunction( aPosition, false, &hasExplicitJunction, &hasBusEntry );
473
474 return isJunction && !hasBusEntry;
475}
bool doIsJunction(const VECTOR2I &aPosition, bool aBreakCrossings, bool *aHasExplicitJunctionDot, bool *aHasBusEntry) const
Definition: sch_screen.cpp:716

References doIsJunction().

Referenced by SCH_EDIT_TOOL::DoDelete(), and SCH_EDIT_FRAME::SchematicCleanUp().

◆ IsExplicitJunctionAllowed()

bool SCH_SCREEN::IsExplicitJunctionAllowed ( const VECTOR2I aPosition) const

Indicates that a juction dot may be placed at the given location.

See IsJunctionNeeded for more info.

Definition at line 705 of file sch_screen.cpp.

706{
707 bool hasExplicitJunction;
708 bool hasBusEntry;
709 bool isJunction = doIsJunction( aPosition, true, &hasExplicitJunction, &hasBusEntry );
710
711 return isJunction && !hasBusEntry;
712}

References doIsJunction().

Referenced by SCH_DRAWING_TOOLS::SingleClickPlace().

◆ IsExplicitJunctionNeeded()

bool SCH_SCREEN::IsExplicitJunctionNeeded ( const VECTOR2I aPosition) const

Indicates that a junction dot is necessary at the given location, and does not yet exist.

See IsJunctionNeeded for more info.

Definition at line 478 of file sch_screen.cpp.

479{
480 bool hasExplicitJunction;
481 bool hasBusEntry;
482 bool isJunction = doIsJunction( aPosition, false, &hasExplicitJunction, &hasBusEntry );
483
484 return isJunction && !hasBusEntry && !hasExplicitJunction;
485}

References doIsJunction().

Referenced by SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), and SCH_MOVE_TOOL::Main().

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 201 of file eda_item.h.

201{ return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:497

References EDA_ITEM::m_forceVisible.

Referenced by KIGFX::SCH_PAINTER::draw(), and SCH_FIELD::Print().

◆ IsJunction()

bool SCH_SCREEN::IsJunction ( const VECTOR2I aPosition) const

Test if a junction is required for the items at aPosition on the screen.

Note that this coule be either an implied junction (bus entry) or an explicit junction (dot).

A junction is required at aPosition if one of the following criteria is satisfied:

  • One wire midpoint and one or more wire endpoints.
  • Three or more wire endpoints.
  • One wire midpoint and a symbol pin.
  • Two or more wire endpoints and a symbol pin.
  • One bus midpoint or endpoint and a bus entry.
Parameters
[in]aPositionThe position to test.
Returns
True if a junction is required at aPosition.

Definition at line 458 of file sch_screen.cpp.

459{
460 bool hasExplicitJunction;
461 bool hasBusEntry;
462 bool isJunction = doIsJunction( aPosition, false, &hasExplicitJunction, &hasBusEntry );
463
464 return isJunction;
465}

References doIsJunction().

Referenced by SCH_LINE::MergeOverlap().

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 102 of file eda_item.h.

102{ return m_flags & IS_CHANGED; }

References IS_CHANGED, and EDA_ITEM::m_flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNew()

◆ IsReadOnly()

bool SCH_SCREEN::IsReadOnly ( ) const
inline

Definition at line 147 of file sch_screen.h.

147{ return m_isReadOnly; }

References m_isReadOnly.

Referenced by SCH_EDIT_FRAME::updateTitle().

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

Override this method in any derived object that supports test find and replace.

Returns
True if the item has replaceable text that can be modified using the find and replace dialog.

Reimplemented in LIB_TEXTBOX, SCH_FIELD, SCH_LABEL, SCH_SHEET, SCH_SHEET_PIN, SCH_SYMBOL, SCH_TEXT, and SCH_TEXTBOX.

Definition at line 420 of file eda_item.h.

420{ return false; }

Referenced by EDA_ITEM::Matches().

◆ IsRollover()

bool EDA_ITEM::IsRollover ( ) const
inlineinherited

Definition at line 110 of file eda_item.h.

111 {
112 return ( m_flags & ( IS_ROLLOVER | IS_MOVING ) ) == IS_ROLLOVER;
113 }
#define IS_ROLLOVER
Rollover active. Used for hyperlink highlighting.

References IS_MOVING, IS_ROLLOVER, and EDA_ITEM::m_flags.

Referenced by KIGFX::SCH_PAINTER::draw().

◆ IsSelected()

bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 106 of file eda_item.h.

106{ return m_flags & SELECTED; }

References EDA_ITEM::m_flags, and SELECTED.

Referenced by ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), SCH_EDIT_TOOL::ChangeTextType(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), EDIT_TOOL::doMoveSelection(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), DS_PROXY_UNDO_ITEM::DS_PROXY_UNDO_ITEM(), RENDER_3D_OPENGL::get3dModelsFromFootprint(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_PAINTER::getLineWidth(), DIALOG_EXCHANGE_FOOTPRINTS::isMatch(), DIALOG_CHANGE_SYMBOLS::isMatch(), MarkConnections(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), KIGFX::SCH_PAINTER::nonCached(), SCH_MOVE_TOOL::orthoLineDrag(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), BOARD_COMMIT::Push(), EE_SELECTION_TOOL::RebuildSelection(), PCB_SELECTION_TOOL::RebuildSelection(), SCH_FIND_REPLACE_TOOL::ReplaceAll(), SCH_EDIT_TOOL::Rotate(), EE_TOOL_BASE< T >::saveCopyInUndoList(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::select(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), KIGFX::SCH_PAINTER::setDeviceColors(), GERBVIEW_SELECTION_TOOL::unselect(), SCH_FIND_REPLACE_TOOL::UpdateFind(), HIERARCHY_PANE::UpdateHierarchySelection(), PCB_BASE_FRAME::UpdateUserUnits(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem(), and DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem().

◆ IsShownAsBitmap()

bool EDA_ITEM::IsShownAsBitmap ( ) const
inlineinherited

Definition at line 173 of file eda_item.h.

173{ return m_flags & IS_SHOWN_AS_BITMAP; }
#define IS_SHOWN_AS_BITMAP

References IS_SHOWN_AS_BITMAP, and EDA_ITEM::m_flags.

◆ IsTerminalPoint()

bool SCH_SCREEN::IsTerminalPoint ( const VECTOR2I aPosition,
int  aLayer 
) const

Test if aPosition is a connection point on aLayer.

Parameters
[in]aPositionPosition to test.
aLayerThe layer type to test against. Valid layer types are LAYER_NOTES, LAYER_BUS, and LAYER_WIRE.
Returns
True if Position is a connection point on aLayer.

Definition at line 817 of file sch_screen.cpp.

818{
819 wxCHECK_MSG( aLayer == LAYER_NOTES || aLayer == LAYER_BUS || aLayer == LAYER_WIRE, false,
820 wxT( "Invalid layer type passed to SCH_SCREEN::IsTerminalPoint()." ) );
821
822 SCH_SHEET_PIN* sheetPin;
823 SCH_LABEL_BASE* label;
824
825 switch( aLayer )
826 {
827 case LAYER_BUS:
828 if( GetBus( aPosition ) )
829 return true;
830
831 sheetPin = GetSheetPin( aPosition );
832
833 if( sheetPin && sheetPin->IsConnected( aPosition ) )
834 return true;
835
836 label = GetLabel( aPosition );
837
838 if( label && label->IsConnected( aPosition ) )
839 return true;
840
841 break;
842
843 case LAYER_NOTES:
844 if( GetLine( aPosition ) )
845 return true;
846
847 break;
848
849 case LAYER_WIRE:
850 if( GetItem( aPosition, 1, SCH_BUS_WIRE_ENTRY_T) )
851 return true;
852
853 if( GetItem( aPosition, 1, SCH_JUNCTION_T ) )
854 return true;
855
856 if( GetPin( aPosition, nullptr, true ) )
857 return true;
858
859 if( GetWire( aPosition ) )
860 return true;
861
862 label = GetLabel( aPosition, 1 );
863
864 if( label && label->IsConnected( aPosition ) )
865 return true;
866
867 sheetPin = GetSheetPin( aPosition );
868
869 if( sheetPin && sheetPin->IsConnected( aPosition ) )
870 return true;
871
872 break;
873
874 default:
875 break;
876 }
877
878 return false;
879}
LIB_PIN * GetPin(const VECTOR2I &aPosition, SCH_SYMBOL **aSymbol=nullptr, bool aEndPointOnly=false) const
Test the screen for a symbol pin item at aPosition.
SCH_LINE * GetWire(const VECTOR2I &aPosition, int aAccuracy=0, SCH_LINE_TEST_T aSearchType=ENTIRE_LENGTH_T) const
Definition: sch_screen.h:429
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.
Definition: sch_screen.cpp:376
SCH_LINE * GetBus(const VECTOR2I &aPosition, int aAccuracy=0, SCH_LINE_TEST_T aSearchType=ENTIRE_LENGTH_T) const
Definition: sch_screen.h:435
SCH_SHEET_PIN * GetSheetPin(const VECTOR2I &aPosition) const
Test the screen if aPosition is a sheet label object.
SCH_LABEL_BASE * GetLabel(const VECTOR2I &aPosition, int aAccuracy=0) const
Return a label item located at aPosition.
@ LAYER_NOTES
Definition: layer_ids.h:358

References GetBus(), GetItem(), GetLabel(), GetLine(), GetPin(), GetSheetPin(), GetWire(), SCH_ITEM::IsConnected(), LAYER_BUS, LAYER_NOTES, LAYER_WIRE, SCH_BUS_WIRE_ENTRY_T, and SCH_JUNCTION_T.

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), and SCH_ALTIUM_PLUGIN::ParsePort().

◆ IsType()

virtual bool EDA_ITEM::IsType ( const std::vector< KICAD_T > &  aScanTypes) const
inlinevirtualinherited

Check whether the item is one of the listed types.

Parameters
aScanTypesList of item types
Returns
true if the item type is contained in the list aScanTypes

Reimplemented in SCH_FIELD, SCH_ITEM, SCH_LABEL_BASE, SCH_LINE, FP_SHAPE, FP_TEXT, FP_TEXTBOX, PAD, PCB_DIMENSION_BASE, PCB_SHAPE, PCB_TEXT, PCB_TEXTBOX, and PCB_VIA.

Definition at line 181 of file eda_item.h.

182 {
183 for( KICAD_T scanType : aScanTypes )
184 {
185 if( scanType == SCH_LOCATE_ANY_T || scanType == m_structType )
186 return true;
187 }
188
189 return false;
190 }
KICAD_T m_structType
Run time identification, keep private so it can never be changed after a ctor sets it.
Definition: eda_item.h:505
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ SCH_LOCATE_ANY_T
Definition: typeinfo.h:183

References EDA_ITEM::m_structType, and SCH_LOCATE_ANY_T.

Referenced by SCH_EDIT_TOOL::AutoplaceFields(), ROUTER_TOOL::CanInlineDrag(), DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES(), SCH_FIELD::GetCanonicalName(), KIGFX::SCH_PAINTER::getLineWidth(), SCH_FIELD::GetName(), KIGFX::SCH_PAINTER::getRenderColor(), SCH_FIELD::GetShownText(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLine(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire(), SCH_ITEM::IsType(), FP_TEXT::IsType(), FP_TEXTBOX::IsType(), PAD::IsType(), PCB_DIMENSION_BASE::IsType(), PCB_SHAPE::IsType(), PCB_TEXT::IsType(), PCB_TEXTBOX::IsType(), PCB_VIA::IsType(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), CONVERT_TOOL::makePolysFromChainedSegs(), EE_SELECTION_TOOL::RequestSelection(), SCH_FIELD::SetId(), SCH_BASE_FRAME::UpdateItem(), and EDA_ITEM::Visit().

◆ Items() [1/2]

EE_RTREE & SCH_SCREEN::Items ( )
inline

Gets the full RTree, usually for iterating.

N.B. The iteration order of the RTree is not readily apparent and will change if/when you add or move items and the RTree is re-balanced. Any exposure of the RTree contents to the user MUST be sorted before being presented. See SCH_SEXPR_PLUGIN::Format() or SCH_EDITOR_CONTROL::nextMatch() for examples.

Returns
Complete RTree of the screen's items

Definition at line 109 of file sch_screen.h.

109{ return m_rtree; }

References m_rtree.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), SCH_MOVE_TOOL::AlignElements(), SCH_SHEET_LIST::AnnotatePowerSymbols(), SCH_EDIT_FRAME::AutoRotateItem(), SCH_EDIT_FRAME::BreakSegmentsOnJunctions(), CONNECTION_GRAPH::buildConnectionGraph(), SCH_SCREENS::buildScreenList(), SCH_SCREENS::ChangeSymbolLibNickname(), SCH_SHEET::CleanupSheet(), ClearAnnotation(), ClearDrawingState(), EE_COLLECTOR::Collect(), SCH_EDIT_FRAME::CommonSettingsChanged(), CountConnectedItems(), SCH_SHEET::CountSheets(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_FRAME::DisplayCurrentSheet(), KIGFX::SCH_VIEW::DisplaySheet(), doIsJunction(), EnsureAlternateReferencesExist(), CONNECTION_GRAPH::ercCheckHierSheets(), SCH_SHEET_LIST::FillItemMap(), findItemsFromSyncSelection(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), FixLegacyPowerSymbolMismatches(), SCHEMATIC::FixupJunctions(), SCH_SEXPR_PLUGIN::Format(), SCH_LEGACY_PLUGIN::Format(), GetBusesAndWires(), SCH_MOVE_TOOL::getConnectedDragItems(), SCH_MOVE_TOOL::getConnectedItems(), GetConnections(), SCH_EDIT_FRAME::GetDocumentExtents(), GetHierarchicalItems(), GetItem(), GetLabel(), GetLabelOrientationForPoint(), GetLine(), GetPin(), AUTOPLACER::getPossibleCollisions(), getSheetBbox(), SCH_LINE_WIRE_BUS_TOOL::getSheetPin(), GetSheetPin(), GetSheets(), SCH_EDIT_FRAME::HardRedraw(), SCH_SHEET::HasUndefinedPins(), SCH_DRAWING_TOOLS::importHierLabel(), SCH_EDIT_TOOL::Init(), CADSTAR_SCH_ARCHIVE_LOADER::Load(), SCH_SEXPR_PLUGIN::loadHierarchy(), SCH_LEGACY_PLUGIN::loadHierarchy(), KI_TEST::LoadHierarchy(), SCH_EAGLE_PLUGIN::loadSheet(), SCH_SHEET::LocatePathOfScreen(), SCH_MOVE_TOOL::Main(), EDIT_POINTS_FACTORY::Make(), NETLIST_EXPORTER_XML::makeSymbols(), MarkConnections(), MigrateSimModels(), SCH_EAGLE_PLUGIN::moveLabels(), SCH_FIND_REPLACE_TOOL::nextMatch(), DIALOG_SHEET_PIN_PROPERTIES::onComboBox(), DIALOG_ERC::OnERCItemRClick(), SCH_ALTIUM_PLUGIN::ParseAltiumSch(), SCH_EDITOR_CONTROL::Paste(), Plot(), Print(), DIALOG_CHANGE_SYMBOLS::processMatchingSymbols(), EE_SELECTION_TOOL::RebuildSelection(), SCH_EDIT_FRAME::RefreshOperatingPointDisplay(), DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable(), Remove(), SCH_EDITOR_CONTROL::RepairSchematic(), SCH_EDIT_FRAME::SaveProject(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_SHEET::SearchHierarchy(), SetConnectivityDirty(), SetLegacySymbolInstanceData(), SCH_EDIT_FRAME::setupUIConditions(), SCH_SHEET::SymbolCount(), TestDanglingEnds(), ERC_TESTER::TestDuplicateSheetNames(), DIALOG_ERC::testErc(), ERC_TESTER::TestTextVars(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow(), DIALOG_SHEET_PROPERTIES::TransferDataFromWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataToWindow(), SCH_LINE_WIRE_BUS_TOOL::TrimOverLappingWires(), SCH_EDIT_FRAME::TrimWire(), SCH_DRAWING_TOOLS::TwoClickPlace(), DIALOG_CHANGE_SYMBOLS::updateFieldsList(), SCH_FIND_REPLACE_TOOL::UpdateFind(), UpdateLocalLibSymbolLinks(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), SCH_EDITOR_CONTROL::updatePastedSheet(), SCH_SHEET_LIST::UpdateSymbolInstanceData(), UpdateSymbolLinks(), and NETLIST_EXPORTER_ORCADPCB2::WriteNetlist().

◆ Items() [2/2]

const EE_RTREE & SCH_SCREEN::Items ( ) const
inline

Definition at line 110 of file sch_screen.h.

110{ return m_rtree; }

References m_rtree.

◆ IterateForward() [1/2]

template<class T >
static INSPECT_RESULT EDA_ITEM::IterateForward ( std::deque< T > &  aList,
INSPECTOR  inspector,
void *  testData,
const std::vector< KICAD_T > &  scanTypes 
)
inlinestaticinherited

This changes first parameter to avoid the DList and use the main queue instead.

Definition at line 302 of file eda_item.h.

304 {
305 for( const auto& it : aList )
306 {
307 if( static_cast<EDA_ITEM*>( it )->Visit( inspector,
308 testData,
309 scanTypes ) == INSPECT_RESULT::QUIT )
310 {
312 }
313 }
314
316 }
virtual INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes)
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:91

References CONTINUE, QUIT, and EDA_ITEM::Visit().

Referenced by GERBER_FILE_IMAGE::Visit().

◆ IterateForward() [2/2]

template<class T >
static INSPECT_RESULT EDA_ITEM::IterateForward ( std::vector< T > &  aList,
INSPECTOR  inspector,
void *  testData,
const std::vector< KICAD_T > &  scanTypes 
)
inlinestaticinherited

Change first parameter to avoid the DList and use std::vector instead.

Definition at line 322 of file eda_item.h.

324 {
325 for( const auto& it : aList )
326 {
327 if( static_cast<EDA_ITEM*>( it )->Visit( inspector,
328 testData,
329 scanTypes ) == INSPECT_RESULT::QUIT )
330 {
332 }
333 }
334
336 }

References CONTINUE, QUIT, and EDA_ITEM::Visit().

◆ MarkConnections()

std::set< SCH_ITEM * > SCH_SCREEN::MarkConnections ( SCH_LINE aSegment,
bool  aSecondPass 
)

Return all wires and junctions connected to aSegment which are not connected any symbol pin.

Parameters
aSegmentThe segment to test for connections.

Definition at line 392 of file sch_screen.cpp.

393{
394#define PROCESSED CANDIDATE // Don't use SKIP_STRUCT; IsConnected() returns false if it's set.
395
396 std::set<SCH_ITEM*> retval;
397 std::stack<SCH_LINE*> to_search;
398
399 wxCHECK_MSG( aSegment && aSegment->Type() == SCH_LINE_T, retval, wxT( "Invalid pointer." ) );
400
401 to_search.push( aSegment );
402
403 while( !to_search.empty() )
404 {
405 SCH_ITEM* item = to_search.top();
406 to_search.pop();
407
408 if( item->HasFlag( PROCESSED ) )
409 continue;
410
411 item->SetFlags( PROCESSED );
412
413 for( SCH_ITEM* candidate : Items().Overlapping( SCH_LINE_T, item->GetBoundingBox() ) )
414 {
415 SCH_LINE* line = static_cast<SCH_LINE*>( candidate );
416
417 if( line->HasFlag( PROCESSED ) )
418 continue;
419
420 // Skip connecting lines on different layers (e.g. buses)
421 if( item->GetLayer() != line->GetLayer() )
422 continue;
423
424 for( VECTOR2I pt : { line->GetStartPoint(), line->GetEndPoint() } )
425 {
426 if( item->IsConnected( pt ) )
427 {
428 SCH_ITEM* junction = GetItem( pt, 0, SCH_JUNCTION_T );
429 SCH_ITEM* pin = GetItem( pt, 0, SCH_PIN_T );
430
431 if( item->IsSelected() && aSecondPass )
432 {
433 if( junction )
434 retval.insert( junction );
435
436 retval.insert( line );
437 to_search.push( line );
438 }
439 else if( !junction && !pin )
440 {
441 retval.insert( line );
442 to_search.push( line );
443 }
444
445 break;
446 }
447 }
448 }
449 }
450
451 for( SCH_ITEM* item : Items() )
452 item->ClearTempFlags();
453
454 return retval;
455}
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:74
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:139
void ClearTempFlags()
Definition: eda_item.h:153
bool IsSelected() const
Definition: eda_item.h:106
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
Definition: eda_item.h:143
#define PROCESSED
@ SCH_PIN_T
Definition: typeinfo.h:159

References EDA_ITEM::GetBoundingBox(), SCH_LINE::GetEndPoint(), GetItem(), SCH_ITEM::GetLayer(), SCH_LINE::GetStartPoint(), EDA_ITEM::HasFlag(), SCH_ITEM::IsConnected(), EDA_ITEM::IsSelected(), Items(), pin, PROCESSED, SCH_JUNCTION_T, SCH_LINE_T, SCH_PIN_T, EDA_ITEM::SetFlags(), and EDA_ITEM::Type().

Referenced by EE_SELECTION_TOOL::SelectConnection().

◆ Matches() [1/2]

virtual bool EDA_ITEM::Matches ( const EDA_SEARCH_DATA aSearchData,
void *  aAuxData 
) const
inlinevirtualinherited

Compare the item against the search criteria in aSearchData.

The base class returns false since many of the objects derived from EDA_ITEM do not have any text to search.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search criteria.
aAuxDataA pointer to optional data required for the search or NULL if not used.
Returns
True if the item's text matches the search criteria in aSearchData.

Reimplemented in SCH_MARKER, LIB_TEXTBOX, SCH_FIELD, SCH_LABEL_BASE, SCH_PIN, SCH_SHEET, SCH_SHEET_PIN, SCH_SYMBOL, SCH_TEXT, SCH_TEXTBOX, FP_TEXT, FP_TEXTBOX, NETINFO_ITEM, PCB_MARKER, PCB_TEXT, PCB_TEXTBOX, and ZONE.

Definition at line 382 of file eda_item.h.

383 {
384 return false;
385 }

Referenced by SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SCH_FIND_REPLACE_TOOL::HasMatch(), SCH_MARKER::Matches(), LIB_TEXTBOX::Matches(), SCH_FIELD::Matches(), SCH_LABEL_BASE::Matches(), SCH_PIN::Matches(), SCH_SHEET_PIN::Matches(), SCH_TEXT::Matches(), SCH_TEXTBOX::Matches(), FP_TEXT::Matches(), FP_TEXTBOX::Matches(), NETINFO_ITEM::Matches(), PCB_MARKER::Matches(), PCB_TEXT::Matches(), PCB_TEXTBOX::Matches(), ZONE::Matches(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_FIND_REPLACE_TOOL::UpdateFind().

◆ Matches() [2/2]

bool EDA_ITEM::Matches ( const wxString &  aText,
const EDA_SEARCH_DATA aSearchData 
) const
protectedinherited

Compare aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

Parameters
aTextA reference to a wxString object containing the string to test.
aSearchDataThe criteria to search against.
Returns
True if aText matches the search criteria in aSearchData.

Definition at line 117 of file eda_item.cpp.

118{
119 wxString text = aText;
120 wxString searchText = aSearchData.findString;
121
122 // Don't match if searching for replaceable item and the item doesn't support text replace.
123 if( aSearchData.searchAndReplace && !IsReplaceable() )
124 return false;
125
126 if( !aSearchData.matchCase )
127 {
128 text.MakeUpper();
129 searchText.MakeUpper();
130 }
131
133 {
134 int ii = 0;
135
136 while( ii < (int) text.length() )
137 {
138 int next = text.find( searchText, ii );
139
140 if( next == wxNOT_FOUND )
141 return false;
142
143 ii = next;
144 next += searchText.length();
145
146 bool startOK = ( ii == 0 || !wxIsalnum( text.GetChar( ii - 1 ) ) );
147 bool endOK = ( next == (int) text.length() || !wxIsalnum( text.GetChar( next ) ) );
148
149 if( startOK && endOK )
150 return true;
151 else
152 ii++;
153 }
154
155 return false;
156 }
157 else if( aSearchData.matchMode == EDA_SEARCH_MATCH_MODE::WILDCARD )
158 {
159 return text.Matches( searchText );
160 }
161 else
162 {
163 return text.Find( searchText ) != wxNOT_FOUND;
164 }
165}
virtual bool IsReplaceable() const
Override this method in any derived object that supports test find and replace.
Definition: eda_item.h:420
CITER next(CITER it)
Definition: ptree.cpp:126
EDA_SEARCH_MATCH_MODE matchMode

References EDA_SEARCH_DATA::findString, EDA_ITEM::IsReplaceable(), EDA_SEARCH_DATA::matchCase, EDA_SEARCH_DATA::matchMode, next(), EDA_SEARCH_DATA::searchAndReplace, text, WHOLEWORD, and WILDCARD.

◆ MigrateSimModels()

void SCH_SCREEN::MigrateSimModels ( )

Migrate any symbols having V6 simulation models to their V7 equivalents.

Definition at line 2032 of file sch_screen.cpp.

2033{
2034 LOCALE_IO toggle;
2035
2036 // V6 schematics may specify model names in Value fields, which we don't do in V7.
2037 // Migrate by adding an equivalent model for these symbols.
2038
2039 for( SCH_ITEM* item : Items().OfType( SCH_SYMBOL_T ) )
2040 {
2041 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
2042 SIM_MODEL::MigrateSimModel<SCH_SYMBOL, SCH_FIELD>( *symbol, &Schematic()->Prj() );
2043 }
2044}
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:41
SCHEMATIC * Schematic() const
Definition: sch_screen.cpp:92
PROJECT & Prj()
Definition: kicad.cpp:573

References Items(), Prj(), SCH_SYMBOL_T, and Schematic().

Referenced by SCH_EDIT_FRAME::LoadSheetFromFile(), and SCH_EDITOR_CONTROL::Paste().

◆ operator<()

bool EDA_ITEM::operator< ( const EDA_ITEM aItem) const
inherited

Test if another item is less than this object.

Parameters
aItem- Item to compare against.
Returns
- True if aItem is less than the item.

Definition at line 231 of file eda_item.cpp.

232{
233 wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
234 GetClass() ) );
235
236 return false;
237}
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200

References Format(), and EDA_ITEM::GetClass().

◆ Plot()

void SCH_SCREEN::Plot ( PLOTTER aPlotter) const

Plot all the schematic objects to aPlotter.

Note
This function is useful only for schematic. The library editor and library viewer do not use a draw list and therefore plots nothing.
Parameters
[in]aPlotterThe plotter object to plot to.

Sort to ensure plot-order consistency with screen drawing

Definition at line 1113 of file sch_screen.cpp.

1114{
1115 // Ensure links are up to date, even if a library was reloaded for some reason:
1116 std::vector<SCH_ITEM*> junctions;
1117 std::vector<SCH_ITEM*> bitmaps;
1118 std::vector<SCH_SYMBOL*> symbols;
1119 std::vector<SCH_ITEM*> other;
1120
1121 for( SCH_ITEM* item : Items() )
1122 {
1123 if( item->IsMoving() )
1124 continue;
1125
1126 if( item->Type() == SCH_JUNCTION_T )
1127 junctions.push_back( item );
1128 else if( item->Type() == SCH_BITMAP_T )
1129 bitmaps.push_back( item );
1130 else
1131 other.push_back( item );
1132
1133 // Where the symbols overlap each other, we need to plot the text items a second
1134 // time to get them on top of the overlapping element. This collection is in addition
1135 // to the symbols already collected in `other`
1136 if( item->Type() == SCH_SYMBOL_T )
1137 {
1138 for( SCH_ITEM* sym : m_rtree.Overlapping( SCH_SYMBOL_T, item->GetBoundingBox() ) )
1139 {
1140 if( sym != item )
1141 {
1142 symbols.push_back( static_cast<SCH_SYMBOL*>( item ) );
1143 break;
1144 }
1145 }
1146 }
1147 }
1148
1150 std::sort( other.begin(), other.end(),
1151 []( const SCH_ITEM* a, const SCH_ITEM* b )
1152 {
1153 if( a->Type() == b->Type() )
1154 return a->GetLayer() > b->GetLayer();
1155
1156 return a->Type() > b->Type();
1157 } );
1158
1159 int defaultPenWidth = aPlotter->RenderSettings()->GetDefaultPenWidth();
1160 constexpr bool background = true;
1161
1162 // Bitmaps are drawn first to ensure they are in the background
1163 // This is particularly important for the wxPostscriptDC (used in *nix printers) as
1164 // the bitmap PS command clears the screen
1165 for( const SCH_ITEM* item : bitmaps )
1166 {
1167 aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
1168 item->Plot( aPlotter, background );
1169 }
1170
1171 for( const SCH_ITEM* item : other )
1172 {
1173 aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
1174 item->Plot( aPlotter, background );
1175 }
1176
1177 for( const SCH_ITEM* item : other )
1178 {
1179 aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
1180 item->Plot( aPlotter, !background );
1181 }
1182
1183 // After plotting the symbols as a group above (in `other`), we need to overplot the pins
1184 // and symbols to ensure that they are always visible
1185 for( const SCH_SYMBOL* sym :symbols )
1186 {
1187 aPlotter->SetCurrentLineWidth( std::max( sym->GetPenWidth(), defaultPenWidth ) );
1188
1189 for( SCH_FIELD field : sym->GetFields() )
1190 field.Plot( aPlotter, false );
1191
1192 sym->PlotPins( aPlotter );
1193
1194 if( sym->GetDNP() )
1195 sym->PlotDNP( aPlotter );
1196 }
1197
1198 for( const SCH_ITEM* item : junctions )
1199 {
1200 aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
1201 item->Plot( aPlotter, !background );
1202 }
1203}
EE_TYPE Overlapping(const BOX2I &aRect) const
Definition: sch_rtree.h:243
int GetDefaultPenWidth() const
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:141
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:51
@ SCH_BITMAP_T
Definition: typeinfo.h:148

References KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), Items(), m_rtree, EE_RTREE::Overlapping(), PLOTTER::RenderSettings(), SCH_BITMAP_T, SCH_JUNCTION_T, SCH_SYMBOL_T, and PLOTTER::SetCurrentLineWidth().

Referenced by SCH_PLOTTER::plotOneSheetDXF(), SCH_PLOTTER::plotOneSheetHpgl(), SCH_PLOTTER::plotOneSheetPDF(), SCH_PLOTTER::plotOneSheetPS(), and SCH_PLOTTER::plotOneSheetSVG().

◆ Print()

void SCH_SCREEN::Print ( const RENDER_SETTINGS aSettings)

Print all the items in the screen to aDC.

Note
This function is useful only for schematic. The library editor and library viewer do not use a draw list and therefore draws nothing.

Sort to ensure plot-order consistency with screen drawing

Definition at line 1069 of file sch_screen.cpp.

1070{
1071 // Ensure links are up to date, even if a library was reloaded for some reason:
1072 std::vector<SCH_ITEM*> junctions;
1073 std::vector<SCH_ITEM*> bitmaps;
1074 std::vector<SCH_ITEM*> other;
1075
1076 for( SCH_ITEM* item : Items() )
1077 {
1078 if( item->IsMoving() )
1079 continue;
1080
1081 if( item->Type() == SCH_JUNCTION_T )
1082 junctions.push_back( item );
1083 else if( item->Type() == SCH_BITMAP_T )
1084 bitmaps.push_back( item );
1085 else
1086 other.push_back( item );
1087 }
1088
1090 std::stable_sort( other.begin(), other.end(),
1091 []( const SCH_ITEM* a, const SCH_ITEM* b )
1092 {
1093 if( a->Type() == b->Type() )
1094 return a->GetLayer() > b->GetLayer();
1095
1096 return a->Type() < b->Type();
1097 } );
1098
1099 for( SCH_ITEM* item : bitmaps )
1100 item->Print( aSettings, VECTOR2I( 0, 0 ) );
1101
1102 for( SCH_ITEM* item : other )
1103 item->PrintBackground( aSettings, VECTOR2I( 0, 0 ) );
1104
1105 for( SCH_ITEM* item : other )
1106 item->Print( aSettings, VECTOR2I( 0, 0 ) );
1107
1108 for( SCH_ITEM* item : junctions )
1109 item->Print( aSettings, VECTOR2I( 0, 0 ) );
1110}

References Items(), SCH_BITMAP_T, and SCH_JUNCTION_T.

Referenced by SCH_EDIT_FRAME::PrintPage(), and SCH_PRINTOUT::PrintPage().

◆ Remove()

bool SCH_SCREEN::Remove ( SCH_ITEM aItem,
bool  aUpdateLibSymbol = true 
)

Remove aItem from the schematic associated with this screen.

Note
The removed item is not deleted. It is only unlinked from the item list.
Parameters
[in]aItemItem to be removed from schematic.
aUpdateLibSymbolremoves the library symbol as required when true.
Returns
True if we successfully removed the item

Definition at line 307 of file sch_screen.cpp.

308{
309 bool retv = m_rtree.remove( aItem );
310
311 // Check if the library symbol for the removed schematic symbol is still required.
312 if( retv && aItem->Type() == SCH_SYMBOL_T && aUpdateLibSymbol )
313 {
314 SCH_SYMBOL* removedSymbol = static_cast<SCH_SYMBOL*>( aItem );
315
316 bool removeUnusedLibSymbol = true;
317
318 for( SCH_ITEM* item : Items().OfType( SCH_SYMBOL_T ) )
319 {
320 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
321
322 if( removedSymbol->GetSchSymbolLibraryName() == symbol->GetSchSymbolLibraryName() )
323 {
324 removeUnusedLibSymbol = false;
325 break;
326 }
327 }
328
329 if( removeUnusedLibSymbol )
330 {
331 auto it = m_libSymbols.find( removedSymbol->GetSchSymbolLibraryName() );
332
333 if( it != m_libSymbols.end() )
334 {
335 delete it->second;
336 m_libSymbols.erase( it );
337 }
338 }
339 }
340
341 return retv;
342}
bool remove(SCH_ITEM *aItem)
Remove an item from the tree.
Definition: sch_rtree.h:78

References SCH_SYMBOL::GetSchSymbolLibraryName(), Items(), m_libSymbols, m_rtree, EE_RTREE::OfType(), EE_RTREE::remove(), SCH_SYMBOL_T, and EDA_ITEM::Type().

Referenced by SCH_SHEET_LIST::BuildSheetList(), DeleteItem(), DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged(), DIALOG_CHANGE_SYMBOLS::processSymbols(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), Update(), and UpdateSymbolLinks().

◆ RenderAsBitmap()

virtual bool EDA_ITEM::RenderAsBitmap ( double  aWorldScale) const
inlinevirtualinherited

Reimplemented in SCH_ITEM.

Definition at line 163 of file eda_item.h.

163{ return false; }

◆ Replace() [1/2]

virtual bool EDA_ITEM::Replace ( const EDA_SEARCH_DATA aSearchData,
void *  aAuxData = nullptr 
)
inlinevirtualinherited

Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace.

This function must be overridden for items that support text replace.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search and replace criteria.
aAuxDataA pointer to optional data required for the search or NULL if not used.
Returns
True if the item text was modified, otherwise false.

Reimplemented in LIB_TEXTBOX, SCH_LABEL_BASE, SCH_PIN, SCH_TEXT, SCH_TEXTBOX, SCH_FIELD, and SCH_SHEET_PIN.

Definition at line 409 of file eda_item.h.

410 {
411 return false;
412 }

◆ Replace() [2/2]

bool EDA_ITEM::Replace ( const EDA_SEARCH_DATA aSearchData,
wxString &  aText 
)
staticinherited

Perform a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search and replace criteria.
aTextA reference to a wxString object containing the text to be replaced.
Returns
True if aText was modified, otherwise false.

Definition at line 168 of file eda_item.cpp.

169{
170 wxString text = aText;
171 wxString searchText = aSearchData.findString;
172 wxString result;
173 bool replaced = false;
174
175 if( !aSearchData.matchCase )
176 {
177 text = text.Upper();
178 searchText = searchText.Upper();
179 }
180
181 int ii = 0;
182
183 while( ii < (int) text.length() )
184 {
185 int next = text.find( searchText, ii );
186
187 if( next == wxNOT_FOUND )
188 {
189 result += aText.Mid( ii, wxString::npos );
190 break;
191 }
192
193 if( next > ii )
194 result += aText.Mid( ii, next - ii );
195
196 ii = next;
197 next += searchText.length();
198
199 bool startOK;
200 bool endOK;
201
203 {
204 startOK = ( ii == 0 || !wxIsalnum( text.GetChar( ii - 1 ) ) );
205 endOK = ( next == (int) text.length() || !wxIsalnum( text.GetChar( next ) ) );
206 }
207 else
208 {
209 startOK = true;
210 endOK = true;
211 }
212
213 if( startOK && endOK )
214 {
215 result += aSearchData.replaceString;
216 replaced = true;
217 ii = next;
218 }
219 else
220 {
221 result += aText.GetChar( ii );
222 ii++;
223 }
224 }
225
226 aText = result;
227 return replaced;
228}
wxString replaceString

References EDA_SEARCH_DATA::findString, EDA_SEARCH_DATA::matchCase, EDA_SEARCH_DATA::matchMode, next(), EDA_SEARCH_DATA::replaceString, text, and WHOLEWORD.

Referenced by EDA_TEXT::Replace(), SCH_FIELD::Replace(), SCH_FIND_REPLACE_TOOL::ReplaceAll(), and SCH_FIND_REPLACE_TOOL::ReplaceAndFindNext().

◆ Schematic()

◆ Set() [1/3]

template<typename T >
bool INSPECTABLE::Set ( const wxString &  aProperty,
aValue 
)
inlineinherited

Definition at line 66 of file inspectable.h.

67 {
69 TYPE_ID thisType = TYPE_HASH( *this );
70 PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
71 void* object = nullptr;
72
73 if( prop )
74 {
75 object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
76
77 if( object )
78 prop->set<T>( object, aValue );
79 }
80
81 return object != nullptr;
82 }
void set(void *aObject, T aValue)
Definition: property.h:325

References PROPERTY_MANAGER::GetProperty(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::set(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Set() [2/3]

template<typename T >
bool INSPECTABLE::Set ( PROPERTY_BASE aProperty,
aValue 
)
inlineinherited

Definition at line 54 of file inspectable.h.

55 {
57 void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
58
59 if( object )
60 aProperty->set<T>( object, aValue );
61
62 return object != nullptr;
63 }

References PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::set(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Set() [3/3]

bool INSPECTABLE::Set ( PROPERTY_BASE aProperty,
wxAny &  aValue 
)
inlineinherited

Definition at line 42 of file inspectable.h.

43 {
45 void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
46
47 if( object )
48 aProperty->setter( object, aValue );
49
50 return object != nullptr;
51 }
virtual void setter(void *aObject, wxAny &aValue)=0

References PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::setter(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

Referenced by PCB_PROPERTIES_PANEL::valueChanged().

◆ SetAuxOrigin()

void SCH_SCREEN::SetAuxOrigin ( const VECTOR2I aPosition)
inline

Definition at line 153 of file sch_screen.h.

153{ m_aux_origin = aPosition; }

References m_aux_origin.

◆ SetBrightened()

◆ SetConnectivityDirty()

void SCH_SCREEN::SetConnectivityDirty ( )

Definition at line 1062 of file sch_screen.cpp.

1063{
1064 for( SCH_ITEM* item : Items() )
1065 item->SetConnectivityDirty( true );
1066}

References Items().

◆ SetContentModified()

void BASE_SCREEN::SetContentModified ( bool  aModified = true)
inlineinherited

Definition at line 59 of file base_screen.h.

59{ m_flagModified = aModified; }

References BASE_SCREEN::m_flagModified.

Referenced by SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_SHEET_LIST::BuildSheetList(), FOOTPRINT_EDIT_FRAME::Clear_Pcb(), PCB_EDIT_FRAME::Clear_Pcb(), SYMBOL_LIBRARY_MANAGER::ClearLibraryModified(), FOOTPRINT_EDIT_FRAME::ClearModify(), SCH_SHEET_LIST::ClearModifyStatus(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), DeleteItem(), SCH_EDIT_FRAME::doAutoSave(), PCB_EDIT_FRAME::doAutoSave(), PCB_EDIT_FRAME::ExportSpecctraFile(), PL_EDITOR_FRAME::Files_io(), PCB_EDIT_FRAME::Files_io_from_id(), SCH_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::InitSheet(), PL_EDITOR_FRAME::LoadDrawingSheetFile(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary(), SCH_LEGACY_PLUGIN::loadSymbol(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), SCH_EDIT_FRAME::OnModify(), SYMBOL_EDIT_FRAME::OnModify(), PCB_BASE_FRAME::OnModify(), PL_EDITOR_FRAME::OnModify(), PL_EDITOR_FRAME::OnNewDrawingSheet(), SCH_EDIT_FRAME::OpenProjectFiles(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), SCH_SEXPR_PARSER::parseSchSheetInstances(), DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable(), FOOTPRINT_EDIT_FRAME::RevertFootprint(), SYMBOL_EDIT_FRAME::Save(), SYMBOL_EDIT_FRAME::saveCurrentSymbol(), PL_EDITOR_FRAME::SaveDrawingSheetFile(), PCB_EDIT_FRAME::SavePcbFile(), SCH_EDIT_FRAME::saveSchematicFile(), DIALOG_PAGES_SETTINGS::TransferDataFromWindow(), and SYMBOL_LIBRARY_MANAGER::UpdateSymbol().

◆ SetFileExists()

void SCH_SCREEN::SetFileExists ( bool  aFileExists)
inline

◆ SetFileFormatVersionAtLoad()

void SCH_SCREEN::SetFileFormatVersionAtLoad ( int  aVersion)
inline

Definition at line 128 of file sch_screen.h.

128{ m_fileFormatVersionAtLoad = aVersion; }

References m_fileFormatVersionAtLoad.

Referenced by SCH_SEXPR_PARSER::ParseSchematic().

◆ SetFileName()

void SCH_SCREEN::SetFileName ( const wxString &  aFileName)

Set the file name for this screen to aFileName.

Note
Screen file names must be absolute or empty. Absolute file names do not have to exist yet in the case of a new schematic file but file names cannot be relative.
Parameters
aFileNameis the absolute file name and path of the screen.

Definition at line 110 of file sch_screen.cpp.

111{
112 wxASSERT( aFileName.IsEmpty() || wxIsAbsolutePath( aFileName ) );
113
114 m_fileName = aFileName;
115}

References m_fileName.

Referenced by SCH_EDIT_FRAME::CreateScreens(), SCH_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::InitSheet(), SCH_ALTIUM_PLUGIN::Load(), CADSTAR_SCH_ARCHIVE_PLUGIN::Load(), SCH_EAGLE_PLUGIN::Load(), SCH_SEXPR_PLUGIN::loadHierarchy(), SCH_LEGACY_PLUGIN::loadHierarchy(), KI_TEST::LoadHierarchy(), SCH_EAGLE_PLUGIN::loadSchematic(), SCH_EAGLE_PLUGIN::loadSheet(), CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets(), CADSTAR_SCH_ARCHIVE_LOADER::loadSheets(), DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_ALTIUM_PLUGIN::ParseAltiumSch(), SCH_ALTIUM_PLUGIN::ParseHarnessType(), SCH_EDIT_FRAME::SaveProject(), and DIALOG_SHEET_PROPERTIES::TransferDataFromWindow().

◆ SetFileReadOnly()

void SCH_SCREEN::SetFileReadOnly ( bool  aIsReadOnly)
inline

Definition at line 146 of file sch_screen.h.

146{ m_isReadOnly = aIsReadOnly; }

References m_isReadOnly.

Referenced by SCH_SEXPR_PLUGIN::loadHierarchy(), and SCH_LEGACY_PLUGIN::loadHierarchy().

◆ SetFlags()

void EDA_ITEM::SetFlags ( EDA_ITEM_FLAGS  aMask)
inlineinherited

Definition at line 139 of file eda_item.h.

139{ m_flags |= aMask; }

References EDA_ITEM::m_flags.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), PCB_BASE_FRAME::AddFootprintToBoard(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), SCH_ALTIUM_PLUGIN::AddTextBox(), SCH_MOVE_TOOL::AlignElements(), PCB_CONTROL::AppendBoard(), SCH_EDIT_FRAME::BreakSegment(), SCH_EDIT_TOOL::BreakWire(), FOOTPRINT::BuildCourtyardCaches(), SCH_EDIT_TOOL::ChangeTextType(), GRAPHICS_CLEANER::cleanupShapes(), ConvertOutlineToPolygon(), SCH_EDIT_FRAME::ConvertPart(), SCH_DRAWING_TOOLS::createNewText(), SCH_DRAWING_TOOLS::createSheetPin(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCBNEW_JOBS_HANDLER::doFpExportSvg(), PCB_TOOL_BASE::doInteractiveItemPlacement(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), EDIT_TOOL::DragArcTrack(), KIGFX::SCH_PAINTER::draw(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), DRAWING_TOOL::DrawRectangle(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PCB_SELECTION_TOOL::EnterGroup(), PAD_TOOL::explodePad(), SCH_MOVE_TOOL::getConnectedDragItems(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), EE_COLLECTOR::Inspect(), CONVERT_TOOL::makePolysFromChainedSegs(), CONVERT_TOOL::makePolysFromClosedGraphics(), CONVERT_TOOL::makePolysFromOpenGraphics(), MarkConnections(), TRACKS_CLEANER::mergeCollinearSegments(), SCH_MOVE_TOOL::moveItem(), SYMBOL_EDITOR_MOVE_TOOL::moveItem(), DIALOG_SYMBOL_PROPERTIES::OnUnitChoice(), KIGFX::ORIGIN_VIEWITEM::ORIGIN_VIEWITEM(), SCH_MOVE_TOOL::orthoLineDrag(), SCH_ALTIUM_PLUGIN::ParseBezier(), SCH_ALTIUM_PLUGIN::ParseBus(), SCH_ALTIUM_PLUGIN::ParseBusEntry(), SCH_ALTIUM_PLUGIN::ParseHarnessPort(), SCH_ALTIUM_PLUGIN::ParseJunction(), SCH_ALTIUM_PLUGIN::ParseLabel(), SCH_ALTIUM_PLUGIN::ParseLine(), SCH_ALTIUM_PLUGIN::ParseNetLabel(), SCH_ALTIUM_PLUGIN::ParseNoERC(), SCH_ALTIUM_PLUGIN::ParsePolygon(), SCH_ALTIUM_PLUGIN::ParsePolyline(), SCH_ALTIUM_PLUGIN::ParsePort(), SCH_ALTIUM_PLUGIN::ParseRectangle(), SCH_ALTIUM_PLUGIN::ParseRoundRectangle(), SCH_ALTIUM_PLUGIN::ParseSheetSymbol(), SCH_ALTIUM_PLUGIN::ParseSignalHarness(), SCH_ALTIUM_PLUGIN::ParseWire(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), DRAWING_TOOL::PlaceText(), SCH_SYMBOL::Plot(), BACK_ANNOTATE::processNetNameChange(), SCH_EDIT_FRAME::PutDataInPreviousState(), PCB_SELECTION_TOOL::RebuildSelection(), BOARD::Remove(), FOOTPRINT::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_EDIT_TOOL::Rotate(), SYMBOL_EDIT_FRAME::SaveCopyInUndoList(), EE_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::selectMultiple(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetBrightened(), EDA_ITEM::SetIsShownAsBitmap(), EDA_ITEM::SetModified(), EDA_ITEM::SetSelected(), SCH_DRAWING_TOOLS::SingleClickPlace(), BOARD_COMMIT::Stage(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), DS_DATA_ITEM::SyncDrawItems(), DS_DATA_ITEM_BITMAP::SyncDrawItems(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace().

◆ SetForceVisible()

void EDA_ITEM::SetForceVisible ( bool  aEnable)
inlineinherited

Set and clear force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible.

Parameters
aEnableTrue forces the item to be drawn. False uses the item's visibility setting to determine if the item is to be drawn.

Definition at line 199 of file eda_item.h.

199{ m_forceVisible = aEnable; }

References EDA_ITEM::m_forceVisible.

Referenced by SCH_FIND_REPLACE_TOOL::FindNext(), and SCH_FIND_REPLACE_TOOL::UpdateFind().

◆ SetIsShownAsBitmap()

void EDA_ITEM::SetIsShownAsBitmap ( bool  aBitmap)
inlineinherited

Definition at line 165 of file eda_item.h.

166 {
167 if( aBitmap )
169 else
171 }

References EDA_ITEM::ClearFlags(), IS_SHOWN_AS_BITMAP, and EDA_ITEM::SetFlags().

◆ SetLegacySymbolInstanceData()

void SCH_SCREEN::SetLegacySymbolInstanceData ( )

Update the symbol value and footprint instance data for legacy designs.

Definition at line 1563 of file sch_screen.cpp.

1564{
1565 for( SCH_ITEM* item : Items().OfType( SCH_SYMBOL_T ) )
1566 {
1567 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
1568
1569 // Add missing value and footprint instance data for legacy schematics.
1570 for( const SCH_SYMBOL_INSTANCE& instance : symbol->GetInstanceReferences() )
1571 {
1572 symbol->AddHierarchicalReference( instance.m_Path, instance.m_Reference,
1573 instance.m_Unit );
1574 }
1575 }
1576}
const std::vector< SCH_SYMBOL_INSTANCE > & GetInstanceReferences()
Definition: sch_symbol.h:140
void AddHierarchicalReference(const KIID_PATH &aPath, const wxString &aRef, int aUnit)
Add a full hierarchical reference to this symbol.
Definition: sch_symbol.cpp:572
A simple container for schematic symbol instance information.

References SCH_SYMBOL::AddHierarchicalReference(), SCH_SYMBOL::GetInstanceReferences(), Items(), and SCH_SYMBOL_T.

Referenced by SCH_SEXPR_PARSER::ParseSchematic().

◆ SetModified()

◆ SetPageCount()

void BASE_SCREEN::SetPageCount ( int  aPageCount)
inherited

Definition at line 63 of file base_screen.cpp.

64{
65 wxCHECK( aPageCount > 0, /* void */ );
66
67 m_pageCount = aPageCount;
68}

References BASE_SCREEN::m_pageCount.

Referenced by SCH_LEGACY_PLUGIN::loadPageSettings(), and SCHEMATIC::SetSheetNumberAndCount().

◆ SetPageNumber()

void BASE_SCREEN::SetPageNumber ( const wxString &  aPageNumber)
inlineinherited

◆ SetPageSettings()

◆ SetParent()

virtual void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlinevirtualinherited

Reimplemented in LIB_SYMBOL.

Definition at line 100 of file eda_item.h.

100{ m_parent = aParent; }

References EDA_ITEM::m_parent.

Referenced by BOARD::Add(), FOOTPRINT::Add(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), BOARD_NETLIST_UPDATER::addNewFootprint(), SCH_SHEET::AddPin(), PAD::AddPrimitive(), PAD::AddPrimitiveAnnotationBox(), PAD::AddPrimitiveArc(), PAD::AddPrimitiveCircle(), PAD::AddPrimitiveCurve(), PAD::AddPrimitivePoly(), PAD::AddPrimitiveRect(), PAD::AddPrimitiveSegment(), SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic(), Append(), LIB_FIELD::Copy(), SYMBOL_EDIT_FRAME::CreateNewSymbol(), SCH_DRAWING_TOOLS::createNewText(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES(), PCBNEW_JOBS_HANDLER::doFpExportSvg(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PCB_EDIT_FRAME::ExchangeFootprint(), LIB_SYMBOL::Flatten(), FOOTPRINT::FOOTPRINT(), PCB_PLUGIN::FootprintSave(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), CADSTAR_SCH_ARCHIVE_LOADER::getKiCadSchText(), LIB_SYMBOL::LIB_SYMBOL(), SCH_LEGACY_PLUGIN_CACHE::loadAliases(), CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), SCH_SEXPR_PLUGIN::loadHierarchy(), SCH_LEGACY_PLUGIN::loadHierarchy(), KI_TEST::LoadHierarchy(), LIB_SYMBOL::operator=(), FOOTPRINT::operator=(), PCB_PARSER::parseFOOTPRINT_unchecked(), SCH_SEXPR_PARSER::ParseSchematic(), SCH_SEXPR_PARSER::ParseSymbol(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PCB_CONTROL::Paste(), pasteFootprintItemsToFootprintEditor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), BACK_ANNOTATE::processNetNameChange(), BOARD_COMMIT::Push(), SCH_LIB_PLUGIN_CACHE::removeSymbol(), PCB_BASE_EDIT_FRAME::saveCopyInUndoList(), SaveCopyOfZones(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), CLIPBOARD_IO::SaveSelection(), SCH_SHEET_PIN::SCH_SHEET_PIN(), LIB_SYMBOL::SetFields(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), SCH_LABEL_BASE::SwapData(), SCH_SHEET::SwapData(), SCH_SYMBOL::SwapData(), BOARD_ITEM::SwapItemData(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ SetPosition()

◆ SetSelected()

◆ SetState()

void EDA_ITEM::SetState ( EDA_ITEM_FLAGS  type,
bool  state 
)
inlineinherited

Definition at line 128 of file eda_item.h.

129 {
130 if( state )
131 m_status |= type; // state = ON or OFF
132 else
133 m_status &= ~type;
134 }

References EDA_ITEM::m_status.

Referenced by LEGACY_PLUGIN::loadTrackList(), and TRACKS_CLEANER::mergeCollinearSegments().

◆ SetStatus()

void EDA_ITEM::SetStatus ( EDA_ITEM_FLAGS  aStatus)
inlineinherited

Definition at line 137 of file eda_item.h.

137{ m_status = aStatus; }

References EDA_ITEM::m_status.

Referenced by BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ SetTitleBlock()

void SCH_SCREEN::SetTitleBlock ( const TITLE_BLOCK aTitleBlock)
inline

◆ SetVirtualPageNumber()

void BASE_SCREEN::SetVirtualPageNumber ( int  aPageNumber)
inlineinherited

◆ Sort()

static bool EDA_ITEM::Sort ( const EDA_ITEM aLeft,
const EDA_ITEM aRight 
)
inlinestaticinherited

Helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers.

Parameters
aLeftThe left hand item to compare.
aRightThe right hand item to compare.
Returns
True if aLeft is less than aRight.

Definition at line 438 of file eda_item.h.

438{ return *aLeft < *aRight; }

◆ TestDanglingEnds()

void SCH_SCREEN::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.

Parameters
aPathis a sheet path to pass to UpdateDanglingState if desired.
aChangedHandleris an optional callback to make on each changed item.

Definition at line 1355 of file sch_screen.cpp.

1357{
1358 std::vector<DANGLING_END_ITEM> endPoints;
1359
1360 for( SCH_ITEM* item : Items() )
1361 {
1362 if( item->IsConnectable() )
1363 {
1364 endPoints.clear();
1365
1366 for( SCH_ITEM* overlapping : Items().Overlapping( item->GetBoundingBox() ) )
1367 overlapping->GetEndPoints( endPoints );
1368
1369 if( item->UpdateDanglingState( endPoints, aPath ) )
1370 {
1371 if( aChangedHandler )
1372 (*aChangedHandler)( item );
1373 }
1374 }
1375 }
1376}

References Items().

Referenced by SCH_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::TestDanglingEnds(), and SCH_MOVE_TOOL::trimDanglingLines().

◆ Type()

KICAD_T EDA_ITEM::Type ( ) const
inlineinherited

Returns the type of object.

This attribute should never be changed after a ctor sets it, so there is no public "setter" method.

Returns
the type of object.

Definition at line 97 of file eda_item.h.

97{ return m_structType; }

References EDA_ITEM::m_structType.

Referenced by CN_CONNECTIVITY_ALGO::Add(), BOARD::Add(), FOOTPRINT::Add(), CN_CLUSTER::Add(), KIGFX::PCB_VIEW::Add(), PCB_POINT_EDITOR::addCorner(), PCB_GROUP::AddItem(), CONNECTION_SUBGRAPH::AddItem(), DRC_TEST_PROVIDER_SOLDER_MASK::addItemToRTrees(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), ZONE_FILLER::addKnockout(), SCH_SHEET::AddPin(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), SCH_MOVE_TOOL::AlignElements(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), CN_ITEM::AnchorCount(), Append(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), PNS::TOPOLOGY::AssembleTuningPath(), SCH_LABEL_BASE::AutoplaceFields(), EE_SELECTION_TOOL::autostartEvent(), DIALOG_NET_INSPECTOR::buildNewItem(), SCH_SCREENS::buildScreenList(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), PCB_POINT_EDITOR::canAddCorner(), SCH_BUS_WIRE_ENTRY::CanConnect(), SCH_BUS_BUS_ENTRY::CanConnect(), SCH_JUNCTION::CanConnect(), SCH_LABEL_BASE::CanConnect(), SCH_LINE::CanConnect(), SCH_NO_CONNECT::CanConnect(), SCH_SHEET::CanConnect(), SCH_SYMBOL::CanConnect(), SCH_EDIT_TOOL::ChangeTextType(), KI_TEST::CheckFootprint(), KI_TEST::CheckFpShape(), KI_TEST::CheckFpZone(), CN_VISITOR::checkZoneItemConnection(), LIB_TEXTBOX::ClassOf(), SCH_BITMAP::ClassOf(), SCH_BUS_WIRE_ENTRY::ClassOf(), SCH_BUS_BUS_ENTRY::ClassOf(), SCH_FIELD::ClassOf(), SCH_JUNCTION::ClassOf(), SCH_LABEL::ClassOf(), SCH_DIRECTIVE_LABEL::ClassOf(), SCH_GLOBALLABEL::ClassOf(), SCH_HIERLABEL::ClassOf(), SCH_LINE::ClassOf(), SCH_MARKER::ClassOf(), SCH_NO_CONNECT::ClassOf(), SCH_PIN::ClassOf(), ClassOf(), SCH_SHEET::ClassOf(), SCH_SHEET_PIN::ClassOf(), SCH_SYMBOL::ClassOf(), SCH_TEXT::ClassOf(), SCH_TEXTBOX::ClassOf(), PCB_GROUP::ClassOf(), BOARD::ClassOf(), BOARD_CONNECTED_ITEM::ClassOf(), FOOTPRINT::ClassOf(), FP_SHAPE::ClassOf(), FP_TEXT::ClassOf(), FP_TEXTBOX::ClassOf(), NETINFO_ITEM::ClassOf(), PAD::ClassOf(), PCB_BITMAP::ClassOf(), PCB_DIM_ALIGNED::ClassOf(), PCB_DIM_ORTHOGONAL::ClassOf(), PCB_DIM_RADIAL::ClassOf(), PCB_DIM_LEADER::ClassOf(), PCB_DIM_CENTER::ClassOf(), PCB_MARKER::ClassOf(), PCB_SHAPE::ClassOf(), PCB_TARGET::ClassOf(), PCB_TEXT::ClassOf(), PCB_TEXTBOX::ClassOf(), PCB_TRACK::ClassOf(), PCB_ARC::ClassOf(), PCB_VIA::ClassOf(), ZONE::ClassOf(), CONNECTION_GRAPH::collectAllDriverValues(), collidesWithArea(), LIB_ITEM::compare(), LIB_FIELD::compare(), LIB_PIN::compare(), LIB_TEXT::compare(), LIB_TEXTBOX::compare(), LIB_SYMBOL::Compare(), EXPORTER_STEP::composePCB(), PCB_GRID_HELPER::computeAnchors(), EE_GRID_HELPER::computeAnchors(), TEARDROP_MANAGER::ComputePointsOnPadVia(), SCH_BUS_WIRE_ENTRY::ConnectionPropagatesTo(), SCH_LINE::ConnectionPropagatesTo(), EE_RTREE::contains(), BOARD::ConvertKIIDsToCrossReferences(), SCHEMATIC::ConvertKIIDsToRefs(), PAD_TOOL::copyPadSettings(), FOOTPRINT::CoverageRatio(), BOARD_ADAPTER::createLayers(), PCB_BASE_FRAME::CreateNewFootprint(), SCH_DRAWING_TOOLS::createNewText(), ZONE_CREATE_HELPER::createNewZone(), BOARD_ADAPTER::createTrack(), DRC_TOOL::CrossProbe(), DeleteItem(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES(), DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES(), BOARD_COMMIT::dirtyIntersectingZones(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDIT_TOOL::DoDelete(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), APPEARANCE_CONTROLS::doesBoardItemNeedRebuild(), DIALOG_GLOBAL_DELETION::DoGlobalDeletions(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), DRAWING_TOOL::DrawDimension(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawVia(), CONNECTION_SUBGRAPH::driverName(), CN_ITEM::Dump(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), FOOTPRINT::DuplicateItem(), EDA_ITEM_DESC::EDA_ITEM_DESC(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), SYMBOL_EDITOR_EDIT_TOOL::editTextBoxProperties(), SYMBOL_EDITOR_EDIT_TOOL::editTextProperties(), CONNECTION_GRAPH::ercCheckBusToBusConflicts(), CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts(), CONNECTION_GRAPH::ercCheckBusToNetConflicts(), CONNECTION_GRAPH::ercCheckFloatingWires(), CONNECTION_GRAPH::ercCheckLabels(), CONNECTION_GRAPH::ercCheckMultipleDrivers(), CONNECTION_GRAPH::ercCheckNoConnects(), DRC_ENGINE::EvalRules(), DRC_ENGINE::EvalZoneConnection(), EDIT_TOOL::FilletTracks(), PCB_SELECTION_TOOL::FilterCollectorForFreePads(), PCB_SELECTION_TOOL::FilterCollectorForHierarchy(), PCB_SELECTION_TOOL::FilterCollectorForMarkers(), TEARDROP_MANAGER::findAnchorPointsOnTrack(), PCB_SELECTION_TOOL::FindItem(), NETLIST_EXPORTER_BASE::findNextSymbol(), CADSTAR_ARCHIVE_PARSER::FixTextPositionNoAlignment(), PCB_BASE_FRAME::FocusOnItems(), EDIT_TOOL::FootprintFilter(), PCB_PLUGIN::Format(), PCB_PLUGIN::format(), SCH_SEXPR_PLUGIN::Format(), SCH_LEGACY_PLUGIN::Format(), FormatProbeItem(), FP_TEXT::FP_TEXT(), PCB_POINT_EDITOR::get45DegConstrainer(), CN_ITEM::GetAnchor(), BOARD_ITEM::GetBoard(), SCH_FIELD::GetBoundingBox(), SCH_LABEL_BASE::GetBoundingBox(), PCB_TRACK::GetBoundingBox(), SCH_FIELD::GetCanonicalName(), getClosestGroup(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), SCH_MOVE_TOOL::getConnectedItems(), FOOTPRINT::GetCoverageArea(), CONNECTION_GRAPH::getDefaultConnection(), SCH_FIELD::GetDrawRotation(), getDrilledHoleShape(), CONNECTION_SUBGRAPH::GetDriverPriority(), getFieldFunc(), PCB_TRACK::GetFriendlyName(), getInferredSymbols(), PCB_TRACK::GetItemDescription(), PL_EDITOR_FRAME::GetLayoutFromRedoList(), PL_EDITOR_FRAME::GetLayoutFromUndoList(), SCH_FIELD::GetMenuImage(), getMinDist(), SCH_LABEL_BASE::GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfo(), SCH_FIELD::GetName(), GetNeededJunctions(), CONNECTION_SUBGRAPH::GetNetclassForDriver(), CONNECTIVITY_DATA::GetNetItems(), BOARD_ITEM::GetParentFootprint(), SCH_SYMBOL::GetPinPhysicalPosition(), SCH_FIELD::GetPosition(), KIGFX::SCH_PAINTER::getRenderColor(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), SCH_FIELD::GetShownText(), CONVERT_TOOL::getStartEndPoints(), KIGFX::SCH_PAINTER::getTextThickness(), EDA_ITEM::GetTypeDesc(), PCB_EXPR_TYPE_REF::GetValue(), PCB_SELECTION_TOOL::grabUnconnected(), GROUP_TOOL::Group(), PCB_SELECTION_TOOL::GuessSelectionCandidates(), hasDrilledHole(), hash_fp_item(), EE_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlightInternal(), BOARD_INSPECTION_TOOL::HighlightItem(), BOARD_INSPECTION_TOOL::highlightNet(), highlightNet(), SCH_FIELD::HitTest(), SCH_LABEL_BASE::HitTest(), PCB_SELECTION_TOOL::hitTestDistance(), SCH_EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRC_RTREE::Insert(), EE_RTREE::insert(), EE_COLLECTOR::Inspect(), GENERAL_COLLECTOR::Inspect(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), BOARD_INSPECTION_TOOL::InspectDRCError(), ARRAY_CREATOR::Invoke(), CONNECTIVITY_DATA::IsConnectedOnLayer(), isCopper(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus(), PNS_KICAD_IFACE_BASE::IsFlashedOnLayer(), CADSTAR_PCB_ARCHIVE_LOADER::isFootprint(), SCH_FIELD::IsHypertext(), isKeepoutZone(), isMaskAperture(), isNPTHPad(), PCB_TRACK::IsNull(), isNullAperture(), SCH_LINE::IsParallel(), isPlatedFunc(), SCH_FIELD::IsReplaceable(), PNS::ROUTER::isStartingPointRoutable(), SCH_ITEM::IsType(), itemIsIncludedByFilter(), PCB_SELECTION_TOOL::itemPassesFilter(), CLIPBOARD_IO::Load(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), CADSTAR_SCH_ARCHIVE_LOADER::loadHierarchicalSheetPins(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), EDIT_POINTS_FACTORY::Make(), PCB_POINT_EDITOR::makePoints(), CONVERT_TOOL::makePolysFromChainedSegs(), MarkConnections(), CONNECTIVITY_DATA::MarkItemNetAsDirty(), CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), SCH_FIELD::Matches(), memberOfFunc(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), DIALOG_DRC::OnDRCItemSelected(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), EDA_3D_CANVAS::OnMouseMove(), CN_VISITOR::operator()(), BOARD_ITEM::ptr_cmp::operator()(), BOARD::cmp_items::operator()(), BOARD::cmp_drawings::operator()(), PCB_SHAPE::cmp_drawings::operator()(), FOOTPRINT::cmp_drawings::operator()(), KI_TEST::kitest_cmp_drawings::operator()(), PCB_TRACK::cmp_tracks::operator()(), LIB_ITEM::operator<(), SCH_ITEM::operator<(), SCH_BUS_ENTRY_BASE::operator<(), SCH_FIELD::operator<(), SCH_JUNCTION::operator<(), SCH_LINE::operator<(), SCH_SHEET::operator<(), SCH_SYMBOL::operator<(), SCH_TEXT::operator<(), SCH_TEXTBOX::operator<(), PCB_BITMAP::operator=(), SCH_BITMAP::operator=(), SCH_SYMBOL::operator=(), SCH_SHEET::operator=(), LIB_ITEM::operator==(), PAD::PAD(), EDIT_TOOL::PadFilter(), BOARD_COMMIT::parentObject(), SCH_SEXPR_PARSER::parseSchField(), SCH_EDITOR_CONTROL::Paste(), PCB_CONTROL::Paste(), DRAWING_TOOL::PlaceImportedGraphics(), SCH_FIELD::Plot(), SCH_LABEL_BASE::Plot(), BRDITEMS_PLOTTER::PlotPcbGraphicItem(), SCH_FIELD::Print(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), BACK_ANNOTATE::processNetNameChange(), CONNECTION_GRAPH::processSubGraphs(), SCH_EDIT_TOOL::Properties(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), PCB_GRID_HELPER::queryVisible(), BOARD_REANNOTATE_TOOL::ReannotateDuplicates(), SCH_CONNECTION::recacheName(), SCH_BASE_FRAME::RefreshZoomDependentItems(), BOARD::Remove(), CN_CONNECTIVITY_ALGO::Remove(), FOOTPRINT::Remove(), EE_RTREE::remove(), Remove(), KIGFX::PCB_VIEW::Remove(), PCB_POINT_EDITOR::removeCorner(), PCB_POINT_EDITOR::removeCornerCondition(), LIB_SYMBOL::RemoveDrawItem(), SCH_SHEET::RemovePin(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_FIELD::Replace(), SCH_FIND_REPLACE_TOOL::ReplaceAll(), PCB_SELECTION_TOOL::RequestSelection(), CONNECTION_GRAPH::resolveAllDrivers(), SCHEMATIC::ResolveCrossReference(), PCB_PARSER::resolveGroups(), SCH_LABEL_BASE::ResolveTextVar(), BOARD::ResolveTextVar(), DS_PROXY_UNDO_ITEM::Restore(), BOARD_COMMIT::Revert(), PL_EDITOR_FRAME::RollbackFromUndo(), SCH_EDIT_TOOL::Rotate(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::Run(), DRC_TEST_PROVIDER_TEXT_DIMS::Run(), DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal(), EE_TOOL_BASE< T >::saveCopyInUndoList(), PCB_BASE_EDIT_FRAME::saveCopyInUndoList(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::savePin(), SCH_SEXPR_PLUGIN_CACHE::savePin(), CLIPBOARD_IO::SaveSelection(), SCH_SEXPR_PLUGIN_CACHE::saveSymbolDrawItem(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveText(), SCH_SEXPR_PLUGIN::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveTextBox(), SCH_ITEM::Schematic(), Schematic(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectSameSheet(), PCB_SELECTION_TOOL::selectUnconnected(), PCB_EDIT_FRAME::SetActiveLayer(), PCB_POINT_EDITOR::setAltConstraint(), SCH_FIELD::SetId(), ITEM_PICKER::SetItem(), SCH_FIELD::SetPosition(), PCB_EDIT_FRAME::SetTrackSegmentWidth(), PCB_EDIT_FRAME::ShowFindDialog(), SCH_EDIT_FRAME::ShowFindReplaceDialog(), BOARD_COMMIT::Stage(), PNS::LINE_PLACER::Start(), SCH_EDIT_TOOL::Swap(), PCB_GROUP::swapData(), FOOTPRINT::swapData(), PAD::swapData(), PCB_DIM_ALIGNED::swapData(), PCB_DIM_ORTHOGONAL::swapData(), PCB_DIM_RADIAL::swapData(), PCB_DIM_LEADER::swapData(), PCB_DIM_CENTER::swapData(), PCB_TARGET::swapData(), PCB_TEXT::swapData(), PCB_TEXTBOX::swapData(), PCB_TRACK::swapData(), PCB_ARC::swapData(), PCB_VIA::swapData(), ZONE::swapData(), PCB_BITMAP::swapData(), SCH_BITMAP::SwapData(), SCH_FIELD::SwapData(), SCH_JUNCTION::SwapData(), SCH_NO_CONNECT::SwapData(), SCH_SHEET::SwapData(), SCH_SHEET_PIN::SwapData(), SCH_SYMBOL::SwapData(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZone(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstZones(), DRC_TEST_PROVIDER_SOLDER_MASK::testMaskItemAgainstZones(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackClearances(), CONNECTIVITY_DATA::TestTrackEndpointDangling(), DIALOG_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_PROPERTIES::TransferDataToWindow(), DIALOG_SYMBOL_FIELDS_TABLE::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), PCB_TRACK::TransformShapeToPolygon(), SCH_LINE_WIRE_BUS_TOOL::TrimOverLappingWires(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), EE_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlightInternal(), KIGFX::PCB_VIEW::Update(), SCH_SHEET_PATH::UpdateAllScreenReferences(), DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog(), DIALOG_SCH_FIELD_PROPERTIES::UpdateField(), PL_POINT_EDITOR::updateItem(), PCB_POINT_EDITOR::updateItem(), EE_TOOL_BASE< T >::updateItem(), SCH_BASE_FRAME::UpdateItem(), PCB_CONTROL::UpdateMessagePanel(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updateParentItem(), SCH_EDITOR_CONTROL::updatePastedSheet(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), PCB_POINT_EDITOR::updatePoints(), SCH_BUS_ENTRY_BASE::ViewGetLayers(), PCB_GROUP::Visit(), SCH_SHEET::Visit(), GERBER_DRAW_ITEM::Visit(), PCB_TRACK::Visit(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ Update()

void SCH_SCREEN::Update ( SCH_ITEM aItem,
bool  aUpdateLibSymbol = true 
)

Update aItem's bounding box in the tree.

Parameters
[in]aItemItem that needs to be updated.
aUpdateLibSymbolremoves the library symbol as required when true.

Definition at line 300 of file sch_screen.cpp.

301{
302 if( Remove( aItem, aUpdateLibSymbol ) )
303 Append( aItem, aUpdateLibSymbol );
304}

References Append(), and Remove().

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::Load(), SCH_EAGLE_PLUGIN::loadSheet(), SCH_DRAWING_TOOLS::PlaceSymbol(), SCH_EDIT_FRAME::RecalculateConnections(), SCHEMATIC::RecomputeIntersheetRefs(), SCH_SHEET_PATH::UpdateAllScreenReferences(), and SCH_BASE_FRAME::UpdateItem().

◆ UpdateLocalLibSymbolLinks()

void SCH_SCREEN::UpdateLocalLibSymbolLinks ( )

Initialize the LIB_SYMBOL reference for each SCH_SYMBOL found in this schematic with the local project library symbols.

Definition at line 1036 of file sch_screen.cpp.

1037{
1038 std::vector<SCH_SYMBOL*> symbols;
1039
1040 for( SCH_ITEM* item : Items().OfType( SCH_SYMBOL_T ) )
1041 symbols.push_back( static_cast<SCH_SYMBOL*>( item ) );
1042
1043 for( SCH_SYMBOL* symbol : symbols )
1044 {
1045 // Changing the symbol may adjust the bbox of the symbol; remove and reinsert it afterwards.
1046 m_rtree.remove( symbol );
1047
1048 auto it = m_libSymbols.find( symbol->GetSchSymbolLibraryName() );
1049
1050 LIB_SYMBOL* libSymbol = nullptr;
1051
1052 if( it != m_libSymbols.end() )
1053 libSymbol = new LIB_SYMBOL( *it->second );
1054
1055 symbol->SetLibSymbol( libSymbol );
1056
1057 m_rtree.insert( symbol );
1058 }
1059}

References EE_RTREE::insert(), Items(), m_libSymbols, m_rtree, EE_RTREE::remove(), and SCH_SYMBOL_T.

Referenced by SCH_SEXPR_PARSER::ParseSchematic().

◆ UpdateSymbolLinks()

void SCH_SCREEN::UpdateSymbolLinks ( REPORTER aReporter = nullptr)

Initialize the LIB_SYMBOL reference for each SCH_SYMBOL found in this schematic from the project SYMBOL_LIB_TABLE.

Symbol library links are set using the symbol library table and will fall back to the cache only if the cache is loaded. The cache should only be loaded when opening legacy schematic files.

Note
This should only be called when the user specifically requests all library symbol links to be updated or when the legacy schematic is opened for the last time. All subsequent schematic loads with the new s-expression will contain the library symbols and should call UpdateLocalLibSymbolLinks.
Parameters
[in]aReporterOptional REPORTER object to write status and error messages into.

Definition at line 882 of file sch_screen.cpp.

883{
884 wxCHECK_RET( Schematic(), "Cannot call SCH_SCREEN::UpdateSymbolLinks with no SCHEMATIC" );
885
886 wxString msg;
887 std::unique_ptr< LIB_SYMBOL > libSymbol;
888 std::vector<SCH_SYMBOL*> symbols;
889 SYMBOL_LIB_TABLE* libs = Schematic()->Prj().SchSymbolLibTable();
890
891 // This will be a nullptr if an s-expression schematic is loaded.
892 SYMBOL_LIBS* legacyLibs = Schematic()->Prj().SchLibs();
893
894 for( SCH_ITEM* item : Items().OfType( SCH_SYMBOL_T ) )
895 symbols.push_back( static_cast<SCH_SYMBOL*>( item ) );
896
897 // Remove them from the R tree. There bounding box size may change.
898 for( SCH_SYMBOL* symbol : symbols )
899 Remove( symbol );
900
901 // Clear all existing symbol links.
903
904 for( SCH_SYMBOL* symbol : symbols )
905 {
906 LIB_SYMBOL* tmp = nullptr;
907 libSymbol.reset();
908
909 // If the symbol is already in the internal library, map the symbol to it.
910 auto it = m_libSymbols.find( symbol->GetSchSymbolLibraryName() );
911
912 if( ( it != m_libSymbols.end() ) )
913 {
914 if( aReporter )
915 {
916 msg.Printf( _( "Setting schematic symbol '%s %s' library identifier to '%s'." ),
917 symbol->GetField( REFERENCE_FIELD )->GetText(),
918 symbol->GetField( VALUE_FIELD )->GetText(),
919 UnescapeString( symbol->GetLibId().Format() ) );
920 aReporter->ReportTail( msg, RPT_SEVERITY_INFO );
921 }
922
923 // Internal library symbols are already flattened so just make a copy.
924 symbol->SetLibSymbol( new LIB_SYMBOL( *it->second ) );
925 continue;
926 }
927
928 if( !symbol->GetLibId().IsValid() )
929 {
930 if( aReporter )
931 {
932 msg.Printf( _( "Schematic symbol reference '%s' library identifier is not valid. "
933 "Unable to link library symbol." ),
934 UnescapeString( symbol->GetLibId().Format() ) );
935 aReporter->ReportTail( msg, RPT_SEVERITY_WARNING );
936 }
937
938 continue;
939 }
940
941 // LIB_TABLE_BASE::LoadSymbol() throws an IO_ERROR if the library nickname
942 // is not found in the table so check if the library still exists in the table
943 // before attempting to load the symbol.
944 if( !libs->HasLibrary( symbol->GetLibId().GetLibNickname() ) && !legacyLibs )
945 {
946 if( aReporter )
947 {
948 msg.Printf( _( "Symbol library '%s' not found and no fallback cache library "
949 "available. Unable to link library symbol." ),
950 symbol->GetLibId().GetLibNickname().wx_str() );
951 aReporter->ReportTail( msg, RPT_SEVERITY_WARNING );
952 }
953
954 continue;
955 }
956
957 if( libs->HasLibrary( symbol->GetLibId().GetLibNickname() ) )
958 {
959 try
960 {
961 tmp = libs->LoadSymbol( symbol->GetLibId() );
962 }
963 catch( const IO_ERROR& ioe )
964 {
965 if( aReporter )
966 {
967 msg.Printf( _( "I/O error %s resolving library symbol %s" ), ioe.What(),
968 UnescapeString( symbol->GetLibId().Format() ) );
969 aReporter->ReportTail( msg, RPT_SEVERITY_ERROR );
970 }
971 }
972 }
973
974 if( !tmp && legacyLibs && legacyLibs->GetLibraryCount() )
975 {
976 SYMBOL_LIB& legacyCacheLib = legacyLibs->back();
977
978 // It better be the cache library.
979 wxCHECK2( legacyCacheLib.IsCache(), continue );
980
981 wxString id = symbol->GetLibId().Format();
982
983 id.Replace( ':', '_' );
984
985 if( aReporter )
986 {
987 msg.Printf( _( "Falling back to cache to set symbol '%s:%s' link '%s'." ),
988 symbol->GetField( REFERENCE_FIELD )->GetText(),
989 symbol->GetField( VALUE_FIELD )->GetText(),
990 UnescapeString( id ) );
991 aReporter->ReportTail( msg, RPT_SEVERITY_WARNING );
992 }
993
994 tmp = legacyCacheLib.FindSymbol( id );
995 }
996
997 if( tmp )
998 {
999 // We want a full symbol not just the top level child symbol.
1000 libSymbol = tmp->Flatten();
1001 libSymbol->SetParent();
1002
1003 m_libSymbols.insert( { symbol->GetSchSymbolLibraryName(),
1004 new LIB_SYMBOL( *libSymbol.get() ) } );
1005
1006 if( aReporter )
1007 {
1008 msg.Printf( _( "Setting schematic symbol '%s %s' library identifier to '%s'." ),
1009 symbol->GetField( REFERENCE_FIELD )->GetText(),
1010 symbol->GetField( VALUE_FIELD )->GetText(),
1011 UnescapeString( symbol->GetLibId().Format() ) );
1012 aReporter->ReportTail( msg, RPT_SEVERITY_INFO );
1013 }
1014 }
1015 else
1016 {
1017 if( aReporter )
1018 {
1019 msg.Printf( _( "No library symbol found for schematic symbol '%s %s'." ),
1020 symbol->GetField( REFERENCE_FIELD )->GetText(),
1021 symbol->GetField( VALUE_FIELD )->GetText() );
1022 aReporter->ReportTail( msg, RPT_SEVERITY_ERROR );
1023 }
1024 }
1025
1026 symbol->SetLibSymbol( libSymbol.release() );
1027 }
1028
1029 // Changing the symbol may adjust the bbox of the symbol. This re-inserts the
1030 // item with the new bbox
1031 for( SCH_SYMBOL* symbol : symbols )
1032 Append( symbol );
1033}
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
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.
Definition: reporter.h:99
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
Definition: schematic.h:76
A collection of SYMBOL_LIB objects.
int GetLibraryCount()
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.
bool IsCache() const
LIB_SYMBOL * FindSymbol(const wxString &aName) const
Find LIB_SYMBOL by aName.
#define _(s)
@ RPT_SEVERITY_WARNING
@ RPT_SEVERITY_ERROR
@ RPT_SEVERITY_INFO
wxString UnescapeString(const wxString &aSource)
@ VALUE_FIELD
Field Value of part, i.e. "3.3K".
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".

References _, Append(), clearLibSymbols(), SYMBOL_LIB::FindSymbol(), LIB_SYMBOL::Flatten(), SYMBOL_LIBS::GetLibraryCount(), LIB_TABLE::HasLibrary(), SYMBOL_LIB::IsCache(), Items(), SYMBOL_LIB_TABLE::LoadSymbol(), m_libSymbols, SCHEMATIC::Prj(), REFERENCE_FIELD, Remove(), REPORTER::ReportTail(), RPT_SEVERITY_ERROR, RPT_SEVERITY_INFO, RPT_SEVERITY_WARNING, SCH_SYMBOL_T, Schematic(), UnescapeString(), VALUE_FIELD, and IO_ERROR::What().

Referenced by SCH_EDITOR_CONTROL::ExportSymbolsToLibrary().

◆ ViewBBox()

◆ ViewDraw()

virtual void KIGFX::VIEW_ITEM::ViewDraw ( int  aLayer,
VIEW aView 
) const
inlinevirtualinherited

Draw the parts of the object belonging to layer aLayer.

An alternative way for drawing objects if there is no #PAINTER assigned for the view or if the PAINTER doesn't know how to paint this particular implementation of VIEW_ITEM. The preferred way of drawing is to design an appropriate PAINTER object, the method below is intended only for quick hacks and debugging purposes.

Parameters
aLayeris the current drawing layer.
aViewis a pointer to the VIEW device we are drawing on.

Reimplemented in DS_PROXY_VIEW_ITEM, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, EDIT_POINTS, RATSNEST_VIEW_ITEM, ROUTER_PREVIEW_ITEM, MY_DRAWING, KIGFX::PREVIEW::ARC_ASSISTANT, KIGFX::PREVIEW::RULER_ITEM, KIGFX::PREVIEW::SELECTION_AREA, KIGFX::PREVIEW::TWO_POINT_ASSISTANT, KIGFX::ORIGIN_VIEWITEM, KIGFX::VIEW_GROUP, and KIGFX::VIEW_OVERLAY.

Definition at line 106 of file view_item.h.

107 {}

Referenced by KIGFX::VIEW::draw(), and KIGFX::VIEW::updateItemGeometry().

◆ ViewGetLayers()

void EDA_ITEM::ViewGetLayers ( int  aLayers[],
int &  aCount 
) const
overridevirtualinherited

Return the all the layers within the VIEW the object is painted on.

For instance, a PAD spans zero or more copper layers and a few technical layers. ViewDraw() or PAINTER::Draw() is repeatedly called for each of the layers returned by ViewGetLayers(), depending on the rendering order.

Parameters
aLayers[]is the output layer index array.
aCountis the number of layer indices in aLayers[].

Implements KIGFX::VIEW_ITEM.

Reimplemented in LIB_FIELD, LIB_ITEM, LIB_PIN, LIB_SHAPE, LIB_SYMBOL, LIB_TEXT, LIB_TEXTBOX, SCH_BITMAP, SCH_BUS_ENTRY_BASE, SCH_ITEM, SCH_JUNCTION, SCH_LABEL_BASE, SCH_GLOBALLABEL, SCH_LINE, SCH_MARKER, SCH_NO_CONNECT, SCH_PIN, SCH_SHAPE, SCH_SHEET, SCH_SYMBOL, SCH_TEXT, GERBER_DRAW_ITEM, BOARD_ITEM, DS_DRAW_ITEM_BASE, DS_PROXY_VIEW_ITEM, KIGFX::ORIGIN_VIEWITEM, PCB_GROUP, KIGFX::PREVIEW::ARC_ASSISTANT, KIGFX::PREVIEW::RULER_ITEM, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, KIGFX::PREVIEW::TWO_POINT_ASSISTANT, EDIT_POINTS, FOOTPRINT, FP_TEXT, FP_TEXTBOX, PAD, PCB_BITMAP, PCB_MARKER, PCB_TRACK, PCB_VIA, RATSNEST_VIEW_ITEM, ROUTER_PREVIEW_ITEM, ZONE, and MY_DRAWING.

Definition at line 261 of file eda_item.cpp.

262{
263 // Basic fallback
264 aCount = 1;
265 aLayers[0] = 0;
266}

◆ ViewGetLOD()

virtual double KIGFX::VIEW_ITEM::ViewGetLOD ( int  aLayer,
VIEW aView 
) const
inlinevirtualinherited

Return the level of detail (LOD) of the item.

A level of detail is the minimal VIEW scale that is sufficient for an item to be shown on a given layer.

Parameters
aLayeris the current drawing layer.
aViewis a pointer to the VIEW device we are drawing on.
Returns
the level of detail. 0 always show the item, because the actual zoom level (or VIEW scale) is always > 0

Reimplemented in SCH_LINE, GERBER_DRAW_ITEM, PCB_GROUP, FOOTPRINT, FP_SHAPE, FP_TEXT, FP_TEXTBOX, PAD, PCB_BITMAP, PCB_SHAPE, PCB_TEXT, PCB_TEXTBOX, PCB_TRACK, PCB_VIA, ZONE, and FP_ZONE.

Definition at line 132 of file view_item.h.

133 {
134 // By default always show the item
135 return 0.0;
136 }

Referenced by PNS_KICAD_IFACE::IsItemVisible(), KIGFX::VIEW::DRAW_ITEM_VISITOR::operator()(), EE_GRID_HELPER::queryVisible(), and PCB_GRID_HELPER::queryVisible().

◆ viewPrivData()

◆ Visit()

INSPECT_RESULT EDA_ITEM::Visit ( INSPECTOR  inspector,
void *  testData,
const std::vector< KICAD_T > &  aScanTypes 
)
virtualinherited

May be re-implemented for each derived class in order to handle all the types given by its member data.

Implementations should call inspector->Inspect() on types in aScanTypes, and may use IterateForward() to do so on lists of such data.

Parameters
inspectorAn INSPECTOR instance to use in the inspection.
testDataArbitrary data used by the inspector.
aScanTypesWhich KICAD_T types are of interest and the order in which they should be processed.
Returns
#SEARCH_RESULT SEARCH_QUIT if the Iterator is to stop the scan, else #SCAN_CONTINUE, and determined by the inspector.

Reimplemented in PCB_GROUP, LIB_SYMBOL, SCH_SHEET, SCH_SYMBOL, GBR_LAYOUT, GERBER_DRAW_ITEM, GERBER_FILE_IMAGE, FOOTPRINT, PCB_TRACK, SCH_LABEL_BASE, and BOARD.

Definition at line 91 of file eda_item.cpp.

93{
94#if 0 && defined(DEBUG)
95 std::cout << GetClass().mb_str() << ' ';
96#endif
97
98 if( IsType( aScanTypes ) )
99 {
100 if( INSPECT_RESULT::QUIT == inspector( this, testData ) )
102 }
103
105}
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition: eda_item.h:181

References CONTINUE, EDA_ITEM::GetClass(), EDA_ITEM::IsType(), and QUIT.

Referenced by PCB_TYPE_COLLECTOR::Collect(), PCB_LAYER_COLLECTOR::Collect(), GENERAL_COLLECTOR::Collect(), GERBER_COLLECTOR::Collect(), EDA_ITEM::IterateForward(), and PCB_BASE_FRAME::UpdateUserUnits().

◆ XorFlags()

void EDA_ITEM::XorFlags ( EDA_ITEM_FLAGS  aMask)
inlineinherited

Definition at line 140 of file eda_item.h.

140{ m_flags ^= aMask; }

References EDA_ITEM::m_flags.

Referenced by EE_SELECTION_TOOL::selectMultiple().

Member Data Documentation

◆ m_aliases

std::set< std::shared_ptr< BUS_ALIAS > > SCH_SCREEN::m_aliases
private

List of bus aliases stored in this screen.

Definition at line 620 of file sch_screen.h.

Referenced by AddBusAlias(), ClearBusAliases(), and GetBusAliases().

◆ m_aux_origin

VECTOR2I SCH_SCREEN::m_aux_origin
private

Definition at line 605 of file sch_screen.h.

Referenced by GetAuxOrigin(), and SetAuxOrigin().

◆ m_Center

bool BASE_SCREEN::m_Center
inherited

Center on screen.

If true (0.0) is centered on screen coordinates can be < 0 and > 0 except for schematics. false: when coordinates can only be >= 0 (schematics).

Definition at line 96 of file base_screen.h.

Referenced by BASE_SCREEN::BASE_SCREEN(), BASE_SCREEN::InitDataPoints(), SCH_SCREEN(), and SYMBOL_VIEWER_FRAME::SYMBOL_VIEWER_FRAME().

◆ m_clientSheetPathList

std::vector<SCH_SHEET_PATH> SCH_SCREEN::m_clientSheetPathList
private

The list of sheet paths sharing this screen.

Used in some annotation calculations to update alternate references.

Note: a screen having a m_refCount = 1 (only one sheet path using it) can have many sheet paths sharing this screen if it is inside another sheet having many instances.

Definition at line 600 of file sch_screen.h.

Referenced by GetClientSheetPaths().

◆ m_DrawingSheetFileName

◆ m_DrawOrg

VECTOR2I BASE_SCREEN::m_DrawOrg
inherited

offsets for drawing the circuit on the screen

Definition at line 88 of file base_screen.h.

Referenced by SCH_EDIT_FRAME::DrawCurrentSheetToClipboard(), BASE_SCREEN::InitDataPoints(), PLEDITOR_PRINTOUT::PrintPage(), and SCH_PRINTOUT::PrintPage().

◆ m_fileExists

bool SCH_SCREEN::m_fileExists
private

Definition at line 617 of file sch_screen.h.

Referenced by FileExists(), and SetFileExists().

◆ m_fileFormatVersionAtLoad

int SCH_SCREEN::m_fileFormatVersionAtLoad
private

Definition at line 590 of file sch_screen.h.

Referenced by GetFileFormatVersionAtLoad(), and SetFileFormatVersionAtLoad().

◆ m_fileName

wxString SCH_SCREEN::m_fileName
private

Definition at line 589 of file sch_screen.h.

Referenced by GetFileName(), and SetFileName().

◆ m_flagModified

bool BASE_SCREEN::m_flagModified
privateinherited

Indicates current drawing has been modified.

Definition at line 132 of file base_screen.h.

Referenced by BASE_SCREEN::BASE_SCREEN(), BASE_SCREEN::IsContentModified(), and BASE_SCREEN::SetContentModified().

◆ m_flags

◆ m_forceVisible

bool EDA_ITEM::m_forceVisible
protectedinherited

◆ m_isReadOnly

bool SCH_SCREEN::m_isReadOnly
private

Read only status of the screen file.

Flag to indicate the file associated with this screen has been created.

Definition at line 614 of file sch_screen.h.

Referenced by IsReadOnly(), and SetFileReadOnly().

◆ m_LastZoomLevel

double SCH_SCREEN::m_LastZoomLevel

last value for the zoom level, useful in Eeschema when changing the current displayed sheet to reuse the same zoom level when back to the sheet using this screen

Definition at line 586 of file sch_screen.h.

Referenced by SCH_NAVIGATE_TOOL::changeSheet(), SCH_EDIT_FRAME::OnPageSettingsChange(), SCH_EDITOR_CONTROL::Revert(), and SCH_SCREEN().

◆ m_libSymbols

std::map<wxString, LIB_SYMBOL*> SCH_SCREEN::m_libSymbols
private

Library symbols required for this schematic.

Definition at line 623 of file sch_screen.h.

Referenced by AddLibSymbol(), Append(), clearLibSymbols(), getLibSymbolNameMatches(), GetLibSymbols(), Remove(), UpdateLocalLibSymbolLinks(), and UpdateSymbolLinks().

◆ m_LocalOrigin

VECTOR2D BASE_SCREEN::m_LocalOrigin
inherited

◆ m_modification_sync

int SCH_SCREEN::m_modification_sync
private

Definition at line 608 of file sch_screen.h.

Referenced by Append(), and SCH_SCREEN().

◆ m_pageCount

int BASE_SCREEN::m_pageCount
protectedinherited

The number of BASE_SCREEN objects in this design.

This currently only has meaning for SCH_SCREEN objects because PCB_SCREEN object are limited to a single file. The count is virtual because SCH_SCREEN objects can be used more than once so the screen (page) count can be more than the number of screen objects.

Definition at line 111 of file base_screen.h.

Referenced by BASE_SCREEN::BASE_SCREEN(), Clear(), BASE_SCREEN::GetPageCount(), and BASE_SCREEN::SetPageCount().

◆ m_pageNumber

wxString BASE_SCREEN::m_pageNumber
protectedinherited

A user defined string page number used for printing and plotting.

This currently only has meaning for SCH_SCREEN objects because PCB_SCREEN object are limited to a single file. This must be set before displaying, printing, or plotting the current sheet. If empty, the m_virtualPageNumber value is converted to a string.

Definition at line 129 of file base_screen.h.

Referenced by BASE_SCREEN::GetPageNumber(), and BASE_SCREEN::SetPageNumber().

◆ m_paper

PAGE_INFO SCH_SCREEN::m_paper
private

Definition at line 603 of file sch_screen.h.

Referenced by GetPageSettings(), SCH_SCREEN(), and SetPageSettings().

◆ m_parent

◆ m_refCount

int SCH_SCREEN::m_refCount
private

Definition at line 591 of file sch_screen.h.

Referenced by DecRefCount(), GetRefCount(), IncRefCount(), and SCH_SCREEN().

◆ m_rtree

EE_RTREE SCH_SCREEN::m_rtree
private

◆ m_ScrollCenter

VECTOR2D BASE_SCREEN::m_ScrollCenter
inherited

Current scroll center point in logical units.

Definition at line 100 of file base_screen.h.

Referenced by EDA_DRAW_PANEL_GAL::DoRePaint(), and DIALOG_ERC::OnERCItemSelected().

◆ m_sheetInstances

std::vector<SCH_SHEET_INSTANCE> SCH_SCREEN::m_sheetInstances
private

◆ m_StartVisu

VECTOR2I BASE_SCREEN::m_StartVisu
inherited

Coordinates in drawing units of the current view position (upper left corner of device)

Definition at line 93 of file base_screen.h.

Referenced by SCH_EDIT_FRAME::DrawCurrentSheetToClipboard(), PLEDITOR_PRINTOUT::PrintPage(), SCH_PRINTOUT::PrintPage(), and DIALOG_FIND::search().

◆ m_status

◆ m_structType

KICAD_T EDA_ITEM::m_structType
privateinherited

Run time identification, keep private so it can never be changed after a ctor sets it.

See comment near SetType() regarding virtual functions.

Definition at line 505 of file eda_item.h.

Referenced by EDA_ITEM::IsType(), EDA_ITEM::operator=(), and EDA_ITEM::Type().

◆ m_symbolInstances

std::vector<SCH_SYMBOL_INSTANCE> SCH_SCREEN::m_symbolInstances
private

The list of symbol instances loaded from the schematic file.

This list is only used to as temporary storage when the schematic file is loaded. If the screen is the root sheet, then this information is used to update the SCH_SYMBOL instance reference and unit information after the entire schematic is loaded and is never used again. If this screen is not the root sheet, then the schematic file is the root sheet of another project and this information is saved unchanged back to the schematic file.

Warning
Under no circumstances is this information to be modified or used after the schematic file is loaded. It is read only and it is only written to non-root schematic files.

Definition at line 639 of file sch_screen.h.

Referenced by GetSymbolInstances(), and SCH_SEXPR_PARSER::parseSchSymbolInstances().

◆ m_titles

TITLE_BLOCK SCH_SCREEN::m_titles
private

Definition at line 604 of file sch_screen.h.

Referenced by Clear(), GetTitleBlock(), and SetTitleBlock().

◆ m_uuid

KIID SCH_SCREEN::m_uuid
private

A unique identifier for each schematic file.

As of right now, this only has meaning for the root schematic. In the future, it may be useful to detect unexpected hierarchy changes.

Definition at line 648 of file sch_screen.h.

Referenced by AssignNewUuid(), SCH_SEXPR_PLUGIN::Format(), GetUuid(), and SCH_SEXPR_PARSER::ParseSchematic().

◆ m_Uuid

const KIID EDA_ITEM::m_Uuid
inherited

Definition at line 492 of file eda_item.h.

Referenced by FIELDS_EDITOR_GRID_DATA_MODEL::AddColumn(), SCH_SYMBOL::AddHierarchicalReference(), SCH_SHEET::addInstance(), RC_ITEM::AddItem(), SCH_EDIT_FRAME::AnnotateSymbols(), FIELDS_EDITOR_GRID_DATA_MODEL::ApplyData(), SCH_SHEET_PATH::Cmp(), SCHEMATIC::ConvertRefsToKIIDs(), MICROWAVE_TOOL::createMicrowaveInductor(), SCH_EDIT_FRAME::CreateScreens(), ZONE_FILLER_TOOL::DirtyZone(), DRAWING_TOOL::DrawVia(), LIB_SYMBOL::Duplicate(), BOARD_ITEM::Duplicate(), FOOTPRINT::Duplicate(), SCH_ITEM::Duplicate(), FOOTPRINT::DuplicateItem(), PCB_EDIT_FRAME::ExchangeFootprint(), PAD_TOOL::explodePad(), SCH_SHEET_LIST::FillItemMap(), BOARD::FillItemMap(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), SCH_EDIT_FRAME::FocusOnItem(), PCB_PLUGIN::format(), SCH_SEXPR_PLUGIN::Format(), SCH_PIN::GetDefaultNetName(), SCH_SHEET_PATH::GetItem(), BOARD::GetItem(), PAD::GetMsgPanelInfo(), DIALOG_BOARD_REANNOTATE::GetNewRefDes(), SCH_SHEET::getPageNumber(), FP_SHAPE::GetParentAsString(), FP_TEXT::GetParentAsString(), FP_TEXTBOX::GetParentAsString(), PAD::GetParentAsString(), SCH_MARKER::GetUUID(), PCB_MARKER::GetUUID(), FIELDS_EDITOR_GRID_DATA_MODEL::GetValue(), FIELDS_EDITOR_GRID_DATA_MODEL::groupMatch(), ZONE::HigherPriority(), SCH_SHEET_PATH::IsContainedWithin(), SCH_ALTIUM_PLUGIN::Load(), SCH_EAGLE_PLUGIN::Load(), LEGACY_PLUGIN::loadFOOTPRINT(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), PCB_EDIT_FRAME::LoadFootprints(), SCH_LEGACY_PLUGIN::loadHierarchy(), LEGACY_PLUGIN::loadPCB_TARGET(), LEGACY_PLUGIN::loadPCB_TEXT(), SCH_EDIT_FRAME::LoadSheetFromFile(), SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic(), LEGACY_PLUGIN::loadTrackList(), PNS::LOGGER::Log(), NETLIST_EXPORTER_XML::makeSymbols(), SCH_EDIT_FRAME::mapExistingAnnotation(), BOARD_ITEM::ptr_cmp::operator()(), BOARD::cmp_items::operator()(), BOARD::cmp_drawings::operator()(), PCB_SHAPE::cmp_drawings::operator()(), FOOTPRINT::cmp_drawings::operator()(), FOOTPRINT::cmp_zones::operator()(), FOOTPRINT::cmp_pads::operator()(), PCB_TRACK::cmp_tracks::operator()(), SCH_ITEM::operator<(), SCH_SYMBOL::operator<(), PAD::PAD(), SCH_SEXPR_PARSER::ParseSchematic(), SCH_EDITOR_CONTROL::Paste(), SCH_SHEET_PATH::PathAsString(), PCB_VIA::PCB_VIA(), SCH_EDIT_FRAME::RecalculateConnections(), FIELDS_EDITOR_GRID_DATA_MODEL::RemoveColumn(), SCH_SYMBOL::RemoveInstance(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), SCH_SYMBOL::ReplaceInstanceSheetPath(), PCB_PARSER::resolveGroups(), SCH_SEXPR_PLUGIN::saveBitmap(), SCH_SEXPR_PLUGIN::saveBusEntry(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN::saveJunction(), SCH_SEXPR_PLUGIN::saveLine(), SCH_SEXPR_PLUGIN::saveNoConnect(), SCH_EDIT_FRAME::SaveProject(), SCH_SEXPR_PLUGIN::saveShape(), SCH_LEGACY_PLUGIN::saveSheet(), SCH_SEXPR_PLUGIN::saveSheet(), SCH_LEGACY_PLUGIN::saveSymbol(), SCH_SEXPR_PLUGIN::saveSymbol(), SCH_SEXPR_PLUGIN::saveText(), SCH_SEXPR_PLUGIN::saveTextBox(), SCH_REFERENCE::SCH_REFERENCE(), SCH_SHEET::SCH_SHEET(), SCH_SYMBOL::SCH_SYMBOL(), RC_ITEM::SetItems(), SCH_SHEET::setPageNumber(), FIELDS_EDITOR_GRID_DATA_MODEL::SetValue(), SCH_DRAWING_TOOLS::SingleClickPlace(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), testGroupEqual(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), SCH_EDITOR_CONTROL::updatePastedSheet(), SCH_SHEET_LIST::UpdateSymbolInstanceData(), and NETLIST_EXPORTER_ORCADPCB2::WriteNetlist().

◆ m_viewPrivData

VIEW_ITEM_DATA* KIGFX::VIEW_ITEM::m_viewPrivData
privateinherited

◆ m_virtualPageNumber

int BASE_SCREEN::m_virtualPageNumber
protectedinherited

An integer based page number used for printing a range of pages.

This page number is set before printing and plotting because page numbering does not reflect the actual page number in complex hiearachies in SCH_SCREEN objects.

Definition at line 119 of file base_screen.h.

Referenced by BASE_SCREEN::BASE_SCREEN(), Clear(), BASE_SCREEN::GetPageNumber(), BASE_SCREEN::GetVirtualPageNumber(), and BASE_SCREEN::SetVirtualPageNumber().

◆ m_zoomInitialized

bool SCH_SCREEN::m_zoomInitialized
private

◆ SCH_ALTIUM_PLUGIN

friend SCH_SCREEN::SCH_ALTIUM_PLUGIN
private

Definition at line 559 of file sch_screen.h.

◆ SCH_EDIT_FRAME

friend SCH_SCREEN::SCH_EDIT_FRAME
private

Definition at line 556 of file sch_screen.h.

◆ SCH_SEXPR_PARSER

friend SCH_SCREEN::SCH_SEXPR_PARSER
private

Definition at line 557 of file sch_screen.h.

◆ SCH_SEXPR_PLUGIN

friend SCH_SCREEN::SCH_SEXPR_PLUGIN
private

Definition at line 558 of file sch_screen.h.


The documentation for this class was generated from the following files: