25 #ifndef CLASS_BOARD_H_ 26 #define CLASS_BOARD_H_ 287 void Move(
const wxPoint& aMoveVector )
override;
333 void FillItemMap( std::map<KIID, EDA_ITEM*>& aMap );
359 void DeleteMARKERs(
bool aWarningsAndErrors,
bool aExclusions );
657 const std::vector<PAD*>
GetPads()
const;
801 return wxT(
"BOARD" );
805 void Show(
int nestLevel, std::ostream& os )
const override { ShowDummy( os ); }
832 if( (
unsigned) index <
m_zones.size() )
841 std::list<ZONE*>
GetZoneList(
bool aIncludeZonesInFootprints =
false )
const;
848 return static_cast<int>(
m_zones.size() );
884 PAD*
GetPad(
const wxPoint& aPosition,
LSET aLayerMask )
const;
924 PAD*
GetPad( std::vector<PAD*>& aPadList,
const wxPoint& aPosition,
LSET aLayerMask )
const;
978 bool aVisibleOnly,
bool aIgnoreLocked =
false )
const;
1081 template <
typename Func,
typename... Args>
1085 ( l->*aFunc )( std::forward<Args>( args )... );
1135 #endif // CLASS_BOARD_H_ std::vector< ZONE * > ZONES
BOARD_ITEM * GetItem(const KIID &aID) const
void InvokeListeners(Func &&aFunc, Args &&... args)
void AddListener(BOARD_LISTENER *aListener)
Add a listener to the board to receive calls whenever something on the board has been modified.
virtual void OnBoardItemRemoved(BOARD &aBoard, BOARD_ITEM *aBoardItem)
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
void SetFileFormatVersionAtLoad(int aVersion)
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
const PCB_LAYER_ID GetLayerID(const wxString &aLayerName) const
Return the ID of a layer.
const PAGE_INFO & GetPageSettings() const
static bool ClassOf(const EDA_ITEM *aItem)
const PCB_PLOT_PARAMS & GetPlotOptions() const
GroupLegalOpsField GroupLegalOps(const PCB_SELECTION &selection) const
Check which selection tool group operations are legal given the selection.
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideCourtyardCache
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Change the visibility of an element category.
const GROUPS & Groups() const
Container for project specific data.
bool m_LegacyDesignSettingsLoaded
True if the legacy board design settings were loaded from a file.
bool GetBoardPolygonOutlines(SHAPE_POLY_SET &aOutlines, OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr)
Extract the board outlines and build a closed polygon from lines, arcs and circle items on edge cut l...
bool operator()(const BOARD_ITEM *aFirst, const BOARD_ITEM *aSecond) const
const ZONE_SETTINGS & GetZoneSettings() const override
Fetch the zone settings for this container.
wxString m_name
The canonical name of the layer.
bool m_LegacyNetclassesLoaded
True if netclasses were loaded from the file.
ZONE * AddArea(PICKED_ITEMS_LIST *aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer, wxPoint aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch)
Add an empty copper area to board areas list.
void ConvertBrdLayerToPolygonalContours(PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aOutlines) const
Build a set of polygons which are the outlines of copper items (pads, tracks, vias,...
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
PAD * GetPad(const wxPoint &aPosition) const
void SetProperties(const std::map< wxString, wxString > &aProps)
bool operator()(const BOARD_ITEM *aFirst, const BOARD_ITEM *aSecond) const
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
const EDA_RECT GetBoardEdgesBoundingBox() const
Return the board bounding box calculated using exclusively the board edges (graphics on Edge....
GROUPS & Groups()
The groups must maintain the following invariants.
A set of BOARD_ITEMs (i.e., without duplicates).
A progress reporter interface for use in multi-threaded environments.
std::map< wxString, wxString > m_properties
bool IsHighLightNetON() const
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
void SetPageSettings(const PAGE_INFO &aPageSettings)
LAYER_T m_type
The type of the layer.
const MARKERS & Markers() const
NETINFO_LIST::iterator EndNets() const
PROJECT * GetProject() const
void SetCopperLayerCount(int aCount)
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
void HighLightOFF()
Disable net highlight.
void SetVisibleElements(const GAL_SET &aMask)
A proxy function that calls the correspondent function in m_BoardSettings.
virtual void OnBoardItemsAdded(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItem)
const NETINFO_LIST & GetNetInfo() const
void SetVisibleAlls()
Change the bit-mask of visible element categories and layers.
PAD * GetPad(const wxPoint &aPosition, LSET aLayerMask) const
Find a pad aPosition on aLayer.
ZONE * GetArea(int index) const
Return the Zone at a given index.
void SetPosition(const wxPoint &aPos) override
FOOTPRINT * FindFootprintByPath(const KIID_PATH &aPath) const
Search for a FOOTPRINT within this board with the given path.
virtual void OnBoardItemChanged(BOARD &aBoard, BOARD_ITEM *aBoardItem)
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
LAYER m_layers[PCB_LAYER_ID_COUNT]
const wxString & GetGenerator() const
bool SetLayerType(PCB_LAYER_ID aLayer, LAYER_T aLayerType)
Change the type of the layer given by aLayer.
HIGH_LIGHT_INFO m_highLight
bool IsFootprintHolder() const
Find out if the board is being used to hold a single footprint for editing/viewing.
A pure virtual class used to derive REPORTER objects from.
HIGH_LIGHT_INFO m_highLightPrevious
The base class for create windows for drawing purpose.
bool IsLayerEnabled(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
bool IsFootprintLayerVisible(PCB_LAYER_ID aLayer) const
Expect either of the two layers on which a footprint can reside, and returns whether that layer is vi...
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
const wxString & GetFileName() const
Hold the information shown in the lower right corner of a plot, printout, or editing view.
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
bool TestZoneIntersection(ZONE *aZone1, ZONE *aZone2)
Test for intersection of 2 copper areas.
virtual void OnBoardItemAdded(BOARD &aBoard, BOARD_ITEM *aBoardItem)
PCB_PLOT_PARAMS m_plotOptions
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
FOOTPRINT * GetFootprint(const wxPoint &aPosition, PCB_LAYER_ID aActiveLayer, bool aVisibleOnly, bool aIgnoreLocked=false) const
Get a footprint by its bounding rectangle at aPosition on aLayer.
const ZONES & Zones() const
const INSPECTOR_FUNC & INSPECTOR
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
NETINFO_LIST::iterator BeginNets() const
PAD * GetPadFast(const wxPoint &aPosition, LSET aLayerMask) const
Return pad found at aPosition on aLayerMask using the fast search method.
virtual void OnBoardItemsChanged(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItem)
void FinalizeBulkRemove(std::vector< BOARD_ITEM * > &aRemovedItems)
Must be used if Remove() is used using a BULK_x REMOVE_MODE to generate a change event for listeners.
static const char * ShowType(LAYER_T aType)
Convert a LAYER_T enum to a string representation of the layer type.
bool m_LegacyCopperEdgeClearanceLoaded
const std::map< wxString, wxString > & GetProperties() const
SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[]) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
std::list< ZONE * > GetZoneList(bool aIncludeZonesInFootprints=false) const
void SynchronizeNetsAndNetClasses()
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
unsigned GetNodesCount(int aNet=-1) const
BOARD_USE m_boardUse
What is this board being used for.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Adds an item to the container.
std::vector< PCB_MARKER * > ResolveDRCExclusions()
Rebuild DRC markers from the serialized data in BOARD_DESIGN_SETTINGS.
const std::vector< BOARD_CONNECTED_ITEM * > AllConnectedItems()
LSET is a set of PCB_LAYER_IDs.
void ResetNetHighLight()
Reset all high light data to the init state.
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
wxString GroupsSanityCheckInternal(bool repair)
unsigned GetNetCount() const
void RemoveListener(BOARD_LISTENER *aListener)
Remove the specified listener.
void DeleteMARKERs()
Delete all MARKERS from the board.
Container for NETINFO_ITEM elements, which are the nets.
Represent a set of closed polygons.
void SetVisibleLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
GAL_SET GetVisibleElements() const
Return a set of all the element categories that are visible.
Describe the page size and margins of a paper page on which to eventually print or plot.
const std::vector< PAD * > GetPads() const
Return a reference to a list of all the pads.
FOOTPRINTS & Footprints()
virtual void OnBoardNetSettingsChanged(BOARD &aBoard)
unsigned GetUnconnectedNetCount() const
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Changes the name of the layer given by aLayer.
BOARD & operator=(const BOARD &aOther)=delete
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
bool SetLayerDescr(PCB_LAYER_ID aIndex, const LAYER &aLayer)
Return the type of the copper layer given by aLayer.
BOARD_USE
Flags to specify how the board is being used.
void SynchronizeProperties()
Copy the current project's text variables into the boards property cache.
void OnItemsChanged(std::vector< BOARD_ITEM * > &aItems)
Notify the board and its listeners that an item on the board has been modified in some way.
Helper for storing and iterating over GAL_LAYER_IDs.
std::vector< wxString > GetNetClassAssignmentCandidates() const
Return a list of name candidates for netclass assignment.
wxString LayerName(int aLayer)
Returns the default display name for a given layer.
Handle a list of polygons defining a copper zone.
wxString m_userName
The user defined name of the layer.
void SetFileName(const wxString &aFileName)
void SetPlotOptions(const PCB_PLOT_PARAMS &aOptions)
void SetHighLightNet(int aNetCode, bool aMulti=false)
Select the netcode to be highlighted.
A holder to handle information on schematic or board items.
std::unique_ptr< BOARD_DESIGN_SETTINGS > m_designSettings
All of the board design settings are stored as a JSON object inside the project file.
static LAYER_T ParseType(const char *aType)
Convert a string to a LAYER_T.
Parameters and options when plotting/printing a board.
NETINFO_LIST & GetNetInfo()
void IncrementTimeStamp()
int SetAreasNetCodesFromNetNames()
Set the .m_NetCode member of all copper areas, according to the area Net Name The SetNetCodesFromNetN...
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
int GetFileFormatVersionAtLoad() const
Store all of the related footprint information found in a netlist.
const std::set< int > & GetHighLightNetCodes() const
ZONE_SETTINGS handles zones parameters.
TRACKS TracksInNet(int aNetCode)
Collect all the TRACKs and VIAs that are members of a net given by aNetCode.
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
void FinalizeBulkAdd(std::vector< BOARD_ITEM * > &aNewItems)
Must be used if Add() is used using a BULK_x ADD_MODE to generate a change event for listeners.
void BuildConnectivity(PROGRESS_REPORTER *aReporter=nullptr)
Build or rebuild the board connectivity database for the board, especially the list of connected item...
void SetProject(PROJECT *aProject)
Link a board to a given project.
std::map< wxString, LSET > m_LayerExpressionCache
LAYER_T GetLayerType(PCB_LAYER_ID aLayer) const
Return the type of the copper layer given by aLayer.
void Move(const wxPoint &aMoveVector) override
Move this object.
std::set< int > m_netCodes
Handle the data for a net.
void MapNets(const BOARD *aDestBoard)
Map all nets in the given board to nets with the same name (if any) in the destination board.
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
virtual void OnBoardHighlightNetChanged(BOARD &aBoard)
TITLE_BLOCK & GetTitleBlock()
void PadDelete(PAD *aPad)
Delete a given pad from the BOARD by removing it from its footprint and from the m_NetInfo.
const DRAWINGS & Drawings() const
int m_fileFormatVersionAtLoad
Container to hold information pertinent to a layer of a BOARD.
Information pertinent to a Pcbnew printed circuit board.
const FOOTPRINTS & Footprints() const
wxPoint GetPosition() const override
PCB_LAYER_ID
A quick note on layer IDs:
virtual void OnBoardItemsRemoved(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItem)
wxString ConvertCrossReferencesToKIIDs(const wxString &aSource) const
Convert cross-references back and forth between ${refDes:field} and ${kiid:field}.
void GetSortedPadListByXthenYCoord(std::vector< PAD * > &aVector, int aNetCode=-1) const
First empties then fills the vector with all pads and sorts them by increasing x coordinate,...
int GetCopperLayerCount() const
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Handle the component boundary box.
The main frame for Pcbnew.
void SetZoneSettings(const ZONE_SETTINGS &aSettings) override
Set the zone settings for this container.
void SetGenerator(const wxString &aGenerator)
void OnItemChanged(BOARD_ITEM *aItem)
Notify the board and its listeners that an item on the board has been modified in some way.
A base class for most all the KiCad significant classes used in schematics and boards.
void Remove(BOARD_ITEM *aBoardItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
wxString GetClass() const override
Return the class name.
const TRACKS & Tracks() const
EDA_RECT ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
std::map< ZONE *, std::unique_ptr< DRC_RTREE > > m_CopperZoneRTrees
unsigned GetNetCount() const
wxString ConvertKIIDsToCrossReferences(const wxString &aSource) const
wxString GroupsSanityCheck(bool repair=false)
Consistency check of internal m_groups structure.
ZONE_BORDER_DISPLAY_STYLE
Zone border styles.
virtual ~BOARD_LISTENER()
const std::function< void(const wxString &msg, BOARD_ITEM *itemA, BOARD_ITEM *itemB, const wxPoint &pt)> OUTLINE_ERROR_HANDLER
void DeleteAllFootprints()
Remove all footprints from the deque and free the memory associated with them.
const wxPoint GetFocusPosition() const override
Similar to GetPosition, but allows items to return their visual center rather than their anchor.
Abstract interface for BOARD_ITEMs capable of storing other items inside.
int m_number
The layer ID.
EDA_MSG_PANEL items for displaying messages.
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideBCourtyardCache
const wxPoint GetCenter() const
Implement an R-tree for fast spatial and layer indexing of connectable items.
bool ResolveTextVar(wxString *token, int aDepth) const
LAYER_T
The allowed types of layers, same as Specctra DSN spec.
BOARD_USE GetBoardUse() const
Get what the board use is.
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideAreaCache
void FillItemMap(std::map< KIID, EDA_ITEM * > &aMap)
LSET m_LegacyVisibleLayers
Visibility settings stored in board prior to 6.0, only used for loading legacy files.
void ClearAllNetCodes()
Reset all items' netcodes to 0 (no net).
void SetEnabledLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
std::vector< BOARD_LISTENER * > m_listeners
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
void buildListOfNets()
Rebuild the list of NETINFO_ITEMs.
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
const TITLE_BLOCK & GetTitleBlock() const
std::tuple< int, double, double > GetTrackLength(const PCB_TRACK &aTrack) const
Return data on the length and number of track segments connected to a given track.
FOOTPRINT * FindFootprintByReference(const wxString &aReference) const
Search for a FOOTPRINT within this board with the given reference designator.
KICAD_T Type() const
Returns the type of object.
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Container for design settings for a BOARD object.
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideFCourtyardCache
GAL_SET m_LegacyVisibleItems