Pcbnew header housekeeping round 1.

This commit is contained in:
Wayne Stambaugh 2021-06-04 09:04:30 -04:00
parent 2533fb22b3
commit 2a6c7a7c0f
14 changed files with 876 additions and 872 deletions

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -33,197 +33,183 @@
#include <pcb_edit_frame.h> #include <pcb_edit_frame.h>
/** /**
* ACTION_PLUGIN * This is the parent class from where any action plugin class must derive.
* This is the parent class from where any action plugin class must
* derive
*/ */
class ACTION_PLUGIN class ACTION_PLUGIN
{ {
public:
// association between the plugin and its menu id
// m_actionMenuId set to 0 means the corresponding menuitem to call this
// action is not yet created
int m_actionMenuId;
// Same for button id
int m_actionButtonId;
// Icon for the action button and menu entry
wxBitmap iconBitmap;
// If show_on_toolbar is true a button will be added to top toolbar
bool show_on_toolbar;
public: public:
ACTION_PLUGIN() : m_actionMenuId( 0 ), m_actionButtonId( 0 ), ACTION_PLUGIN() : m_actionMenuId( 0 ), m_actionButtonId( 0 ),
show_on_toolbar( false ) {} show_on_toolbar( false ) {}
virtual ~ACTION_PLUGIN(); virtual ~ACTION_PLUGIN();
/** /**
* Function GetCategoryName * @return the category name of the action (to be able to group action under the same submenu).
* @return the category name of the action (to be able to group action under the same submenu)
*/ */
virtual wxString GetCategoryName() = 0; virtual wxString GetCategoryName() = 0;
/** /**
* Function GetName * @return the name of the action.
* @return the name of the action
*/ */
virtual wxString GetName() = 0; virtual wxString GetName() = 0;
/** /**
* Function GetDescription * @return a description of the action plugin.
* @return a description of the action plugin
*/ */
virtual wxString GetDescription() = 0; virtual wxString GetDescription() = 0;
/** /**
* Function GetShowToolbarButton * @return true if button should be shown on top toolbar.
* @return true if button should be shown on top toolbar
*/ */
virtual bool GetShowToolbarButton() = 0; virtual bool GetShowToolbarButton() = 0;
/** /**
* Function GetIconFileName * @param aDark set to true if requesting dark theme icon.
* @param aDark true if requesting dark theme icon * @return a path to icon for the action plugin button.
* @return a path to icon for the action plugin button
*/ */
virtual wxString GetIconFileName( bool aDark ) = 0; virtual wxString GetIconFileName( bool aDark ) = 0;
/** /**
* Function GetPluginPath * @return a path this plugin was loaded from.
* @return a path this plugin was loaded from
*/ */
virtual wxString GetPluginPath() = 0; virtual wxString GetPluginPath() = 0;
/** /**
* Function GetObject * This method gets the pointer to the object from where this action constructs.
* This method gets the pointer to the object from where this action constructs *
* @return it's a void pointer, as it could be a PyObject or any other * @return it's a void pointer, as it could be a PyObject or any other
*/ */
virtual void* GetObject() = 0; virtual void* GetObject() = 0;
/** /**
* Function Run * This method the the action.
* This method the the action
*/ */
virtual void Run() = 0; virtual void Run() = 0;
/** /**
* Function register_action * It's the standard method of a "ACTION_PLUGIN" to register itself into the ACTION_PLUGINS
* It's the standard method of a "ACTION_PLUGIN" to register itself into * singleton manager.
* the ACTION_PLUGINS singleton manager
*/ */
void register_action(); void register_action();
// association between the plugin and its menu id
// m_actionMenuId set to 0 means the corresponding menuitem to call this
// action is not yet created
int m_actionMenuId;
// Same for button id
int m_actionButtonId;
// Icon for the action button and menu entry
wxBitmap iconBitmap;
// If show_on_toolbar is true a button will be added to top toolbar
bool show_on_toolbar;
}; };
/** /**
* ACTION_PLUGINS * Mainly static. Storing all plugins information.
* Mainly static. Storing all plugins informations.
*/ */
class ACTION_PLUGINS class ACTION_PLUGINS
{ {
private:
/**
* ACTION_PLUGIN system wide static list
*/
static std::vector<ACTION_PLUGIN*> m_actionsList;
static bool m_actionRunning;
public: public:
/** /**
* Function register_action
* An action calls this static method when it wants to register itself * An action calls this static method when it wants to register itself
* into the system actions * into the system actions.
* *
* @param aAction is the action plugin to be registered * @param aAction is the action plugin to be registered.
*/ */
static void register_action( ACTION_PLUGIN* aAction ); static void register_action( ACTION_PLUGIN* aAction );
/** /**
* Function deregister_object * Deregister an object which builds a action.
* Anyone calls this method to deregister an object which builds a action,
* it will lookup on the vector calling GetObject until find, then removed
* and deleted
* *
* @param aObject is the action plugin object to be deregistered * Lookup on the vector calling GetObject until find, then removed and deleted.
*
* @param aObject is the action plugin object to be deregistered.
*/ */
static bool deregister_object( void* aObject ); static bool deregister_object( void* aObject );
/** /**
* Function GetAction * @param aName is the action plugin name.
* @param aName is the action plugin name
* @return a action object by it's name or NULL if it isn't available. * @return a action object by it's name or NULL if it isn't available.
*/ */
static ACTION_PLUGIN* GetAction( const wxString& aName ); static ACTION_PLUGIN* GetAction( const wxString& aName );
/** /**
* Function SetActionMenu * Associate a menu id to an action plugin.
* Associate a menu id to an action plugin *
* @param aIndex is the action index * @param aIndex is the action index.
* @param idMenu is the associated menuitem id * @param idMenu is the associated menuitem ID.
*/ */
static void SetActionMenu( int aIndex, int idMenu ); static void SetActionMenu( int aIndex, int idMenu );
/** /**
* Function GetActionByMenu * Find action plugin associated to a menu ID.
* find action plugin associated to a menu id *
* @param aMenu is the menu id (defined with SetActionMenu) * @param aMenu is the menu id (defined with SetActionMenu).
* @return the associated ACTION_PLUGIN (or null if not found) * @return the associated ACTION_PLUGIN (or null if not found).
*/ */
static ACTION_PLUGIN* GetActionByMenu( int aMenu ); static ACTION_PLUGIN* GetActionByMenu( int aMenu );
/** /**
* Function SetActionButton * Associate a button id to an action plugin.
* Associate a button id to an action plugin *
* @param aAction is the action * @param aAction is the action.
* @param idButton is the associated menuitem id * @param idButton is the associated menuitem ID.
*/ */
static void SetActionButton( ACTION_PLUGIN* aAction, int idButton ); static void SetActionButton( ACTION_PLUGIN* aAction, int idButton );
/** /**
* Function GetActionByButton * Find action plugin associated to a button ID.
* find action plugin associated to a button id *
* @param aButton is the button id (defined with SetActionButton) * @param aButton is the button id (defined with SetActionButton).
* @return the associated ACTION_PLUGIN (or null if not found) * @return the associated ACTION_PLUGIN (or null if not found).
*/ */
static ACTION_PLUGIN* GetActionByButton( int aButton ); static ACTION_PLUGIN* GetActionByButton( int aButton );
/** /**
* Function GetActionByPath * Find action plugin by module path.
* find action plugin by module path *
* @param aPath the path of plugin * @param aPath is the path of plugin.
* @return the corresponding ACTION_PLUGIN (or null if not found) * @return the corresponding ACTION_PLUGIN (or null if not found).
*/ */
static ACTION_PLUGIN* GetActionByPath( const wxString& aPath ); static ACTION_PLUGIN* GetActionByPath( const wxString& aPath );
/** /**
* Function GetAction * @param aIndex is the action index in list.
* @return a action object by it's number or NULL if it isn't available. * @return a action object by it's number or NULL if it isn't available.
* @param aIndex is the action index in list
*/ */
static ACTION_PLUGIN* GetAction( int aIndex ); static ACTION_PLUGIN* GetAction( int aIndex );
/** /**
* Function GetActionsCount * @return the number of actions available into the system.
* @return the number of actions available into the system
*/ */
static int GetActionsCount(); static int GetActionsCount();
/** /**
* Function IsActionRunning * @return true if an action running right now otherwise false.
* @return Is an action running right now
*/ */
static bool IsActionRunning(); static bool IsActionRunning();
/** /**
* Function SetActionRunning
* @param aRunning sets whether an action is running now. * @param aRunning sets whether an action is running now.
*/ */
static void SetActionRunning( bool aRunning ); static void SetActionRunning( bool aRunning );
/** /**
* Unloads (deregisters) all action plugins * Unload (deregister) all action plugins.
*/ */
static void UnloadAll(); static void UnloadAll();
private:
/**
* ACTION_PLUGIN system wide static list.
*/
static std::vector<ACTION_PLUGIN*> m_actionsList;
static bool m_actionRunning;
}; };
#endif /* PCBNEW_ACTION_PLUGINS_H */ #endif /* PCBNEW_ACTION_PLUGINS_H */

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
* *
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
@ -60,15 +60,15 @@ wxPoint BOARD_ITEM::ZeroOffset( 0, 0 );
BOARD::BOARD() : BOARD::BOARD() :
BOARD_ITEM_CONTAINER( (BOARD_ITEM*) nullptr, PCB_T ), BOARD_ITEM_CONTAINER( (BOARD_ITEM*) nullptr, PCB_T ),
m_LegacyDesignSettingsLoaded( false ),
m_LegacyCopperEdgeClearanceLoaded( false ),
m_LegacyNetclassesLoaded( false ),
m_boardUse( BOARD_USE::NORMAL ), m_boardUse( BOARD_USE::NORMAL ),
m_timeStamp( 1 ), m_timeStamp( 1 ),
m_paper( PAGE_INFO::A4 ), m_paper( PAGE_INFO::A4 ),
m_project( nullptr ), m_project( nullptr ),
m_designSettings( new BOARD_DESIGN_SETTINGS( nullptr, "board.design_settings" ) ), m_designSettings( new BOARD_DESIGN_SETTINGS( nullptr, "board.design_settings" ) ),
m_NetInfo( this ), m_NetInfo( this )
m_LegacyDesignSettingsLoaded( false ),
m_LegacyCopperEdgeClearanceLoaded( false ),
m_LegacyNetclassesLoaded( false )
{ {
// we have not loaded a board yet, assume latest until then. // we have not loaded a board yet, assume latest until then.
m_fileFormatVersionAtLoad = LEGACY_BOARD_FILE_VERSION; m_fileFormatVersionAtLoad = LEGACY_BOARD_FILE_VERSION;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -73,7 +73,7 @@ enum LAYER_T
/** /**
* Container to hold information pertinent to a layer of a BOARD. * Container to hold information pertinent to a layer of a BOARD.
*/ */
struct LAYER struct LAYER
{ {
@ -112,16 +112,16 @@ struct LAYER
* Convert a #LAYER_T enum to a string representation of the layer type. * Convert a #LAYER_T enum to a string representation of the layer type.
* *
* @param aType The #LAYER_T to convert * @param aType The #LAYER_T to convert
* @return const char* - The string representation of the layer type. * @return The string representation of the layer type.
*/ */
static const char* ShowType( LAYER_T aType ); static const char* ShowType( LAYER_T aType );
/** /**
* Convert a string to a #LAYER_T * Convert a string to a #LAYER_T
* *
* @param aType The const char* to convert * @param aType The layer name to convert.
* @return LAYER_T - The binary representation of the layer type, or * @return The binary representation of the layer type, or
* LAYER_T(-1) if the string is invalid * LAYER_T(-1) if the string is invalid.
*/ */
static LAYER_T ParseType( const char* aType ); static LAYER_T ParseType( const char* aType );
}; };
@ -130,8 +130,6 @@ struct LAYER
// Helper class to handle high light nets // Helper class to handle high light nets
class HIGH_LIGHT_INFO class HIGH_LIGHT_INFO
{ {
friend class BOARD;
protected: protected:
std::set<int> m_netCodes; // net(s) selected for highlight (-1 when no net selected ) std::set<int> m_netCodes; // net(s) selected for highlight (-1 when no net selected )
bool m_highLightOn; // highlight active bool m_highLightOn; // highlight active
@ -146,10 +144,13 @@ protected:
{ {
Clear(); Clear();
} }
private:
friend class BOARD;
}; };
/** /**
* Provides an interface to hook into board modifications and get callbacks * Provide an interface to hook into board modifications and get callbacks
* on certain modifications that are made to the board. This allows updating * on certain modifications that are made to the board. This allows updating
* auxiliary views other than the primary board editor view. * auxiliary views other than the primary board editor view.
*/ */
@ -170,6 +171,13 @@ public:
}; };
DECL_VEC_FOR_SWIG( MARKERS, PCB_MARKER* )
DECL_VEC_FOR_SWIG( ZONES, ZONE* )
DECL_DEQ_FOR_SWIG( TRACKS, TRACK* )
// Dequeue rather than Vector just so we can use moveUnflaggedItems in pcbnew_control.cpp
DECL_DEQ_FOR_SWIG( GROUPS, PCB_GROUP* )
/** /**
* Flags to specify how the board is being used. * Flags to specify how the board is being used.
*/ */
@ -185,65 +193,6 @@ enum class BOARD_USE
*/ */
class BOARD : public BOARD_ITEM_CONTAINER class BOARD : public BOARD_ITEM_CONTAINER
{ {
friend class PCB_EDIT_FRAME;
private:
/// What is this board being used for
BOARD_USE m_boardUse;
int m_timeStamp; // actually a modification counter
wxString m_fileName;
MARKERS m_markers;
DRAWINGS m_drawings;
FOOTPRINTS m_footprints;
TRACKS m_tracks;
GROUPS m_groups;
ZONES m_zones;
LAYER m_layers[PCB_LAYER_ID_COUNT];
HIGH_LIGHT_INFO m_highLight; // current high light data
HIGH_LIGHT_INFO m_highLightPrevious; // a previously stored high light data
int m_fileFormatVersionAtLoad; // the version loaded from the file
std::map<wxString, wxString> m_properties;
std::shared_ptr<CONNECTIVITY_DATA> m_connectivity;
PAGE_INFO m_paper;
TITLE_BLOCK m_titles; // text in lower right of screen and plots
PCB_PLOT_PARAMS m_plotOptions;
PROJECT* m_project; // project this board is a part of
/**
* All of the board design settings are stored as a JSON object inside the project file. The
* object itself is located here because the alternative is to require a valid project be
* passed in when constructing a BOARD, since things in the BOARD constructor rely on access
* to the BOARD_DESIGN_SETTINGS object.
*
* A reference to this object is set up in the PROJECT_FILE for the PROJECT this board is
* part of, so that the JSON load/store operations work. This link is established when
* boards are loaded from disk.
*/
std::unique_ptr<BOARD_DESIGN_SETTINGS> m_designSettings;
NETINFO_LIST m_NetInfo; // net info list (name, design constraints...
std::vector<BOARD_LISTENER*> m_listeners;
// The default copy constructor & operator= are inadequate,
// either write one or do not use it at all
BOARD( const BOARD& aOther ) = delete;
BOARD& operator=( const BOARD& aOther ) = delete;
template <typename Func, typename... Args>
void InvokeListeners( Func&& aFunc, Args&&... args )
{
for( auto&& l : m_listeners )
( l->*aFunc )( std::forward<Args>( args )... );
}
public: public:
static inline bool ClassOf( const EDA_ITEM* aItem ) static inline bool ClassOf( const EDA_ITEM* aItem )
{ {
@ -303,7 +252,7 @@ public:
* - An item may appear in at most one group * - An item may appear in at most one group
* - Each group must contain at least one item * - Each group must contain at least one item
* - If a group specifies a name, it must be unique * - If a group specifies a name, it must be unique
* - The graph of groups containing subgroups must be acyclic. * - The graph of groups containing subgroups must be cyclic.
*/ */
GROUPS& Groups() { return m_groups; } GROUPS& Groups() { return m_groups; }
const GROUPS& Groups() const { return m_groups; } const GROUPS& Groups() const { return m_groups; }
@ -348,18 +297,22 @@ public:
void Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aMode = REMOVE_MODE::NORMAL ) override; void Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aMode = REMOVE_MODE::NORMAL ) override;
/** /**
* Must be used if Add() is used using a BULK_x ADD_MODE to generate a change event for listeners * Must be used if Add() is used using a BULK_x ADD_MODE to generate a change event for
* listeners.
*/ */
void FinalizeBulkAdd( std::vector<BOARD_ITEM*>& aNewItems ); void FinalizeBulkAdd( std::vector<BOARD_ITEM*>& aNewItems );
/** /**
* Must be used if Remove() is used using a BULK_x REMOVE_MODE to generate a change event for listeners * Must be used if Remove() is used using a BULK_x REMOVE_MODE to generate a change event
* for listeners.
*/ */
void FinalizeBulkRemove( std::vector<BOARD_ITEM*>& aRemovedItems ); void FinalizeBulkRemove( std::vector<BOARD_ITEM*>& aRemovedItems );
/** /**
* Gets the first footprint on the board or nullptr. * Get the first footprint on the board or nullptr.
*
* This is used primarily by the footprint editor which knows there is only one. * This is used primarily by the footprint editor which knows there is only one.
*
* @return first footprint or null pointer * @return first footprint or null pointer
*/ */
FOOTPRINT* GetFirstFootprint() const FOOTPRINT* GetFirstFootprint() const
@ -368,13 +321,12 @@ public:
} }
/** /**
* Removes all footprints from the deque and frees the memory associated with them * Remove all footprints from the deque and free the memory associated with them.
*/ */
void DeleteAllFootprints(); void DeleteAllFootprints();
/** /**
* @return null if aID is null. Returns an object of Type() == NOT_USED if * @return null if aID is null. Returns an object of Type() == NOT_USED if the aID is not found.
* the aID is not found.
*/ */
BOARD_ITEM* GetItem( const KIID& aID ) const; BOARD_ITEM* GetItem( const KIID& aID ) const;
@ -393,7 +345,7 @@ public:
std::shared_ptr<CONNECTIVITY_DATA> GetConnectivity() const { return m_connectivity; } std::shared_ptr<CONNECTIVITY_DATA> GetConnectivity() const { return m_connectivity; }
/** /**
* Builds or rebuilds the board connectivity database for the board, * Build or rebuild the board connectivity database for the board,
* especially the list of connected items, list of nets and rastnest data * especially the list of connected items, list of nets and rastnest data
* Needed after loading a board to have the connectivity database updated. * Needed after loading a board to have the connectivity database updated.
*/ */
@ -409,9 +361,11 @@ public:
PROJECT* GetProject() const { return m_project; } PROJECT* GetProject() const { return m_project; }
/** /**
* Links a board to a given project. Should be called immediately after loading board in * Link a board to a given project.
* order for everything to work *
* @param aProject is a loaded project to link to * Should be called immediately after loading board in order for everything to work.
*
* @param aProject is a loaded project to link to.
*/ */
void SetProject( PROJECT* aProject ); void SetProject( PROJECT* aProject );
@ -437,8 +391,9 @@ public:
/** /**
* Select the netcode to be highlighted. * Select the netcode to be highlighted.
* @param aNetCode is the net to highlight *
* @param aMulti is true if you want to add a highlighted net without clearing the old one * @param aNetCode is the net to highlight.
* @param aMulti is true if you want to add a highlighted net without clearing the old one.
*/ */
void SetHighLightNet( int aNetCode, bool aMulti = false ); void SetHighLightNet( int aNetCode, bool aMulti = false );
@ -448,9 +403,10 @@ public:
bool IsHighLightNetON() const { return m_highLight.m_highLightOn; } bool IsHighLightNetON() const { return m_highLight.m_highLightOn; }
/** /**
* Enable or disable net highlighting. If a netcode >= 0 has been set * Enable or disable net highlighting.
* with SetHighLightNet and aValue is true, the net will be highlighted. *
* If aValue is false, net highlighting will be disabled regardless of * If a netcode >= 0 has been set with SetHighLightNet and aValue is true, the net will be
* highlighted. If aValue is false, net highlighting will be disabled regardless of
* the highlight netcode being set. * the highlight netcode being set.
*/ */
void HighLightON( bool aValue = true ); void HighLightON( bool aValue = true );
@ -464,22 +420,22 @@ public:
} }
/** /**
* @return int - The number of copper layers in the BOARD. * @return The number of copper layers in the BOARD.
*/ */
int GetCopperLayerCount() const; int GetCopperLayerCount() const;
void SetCopperLayerCount( int aCount ); void SetCopperLayerCount( int aCount );
/** /**
* A proxy function that calls the corresponding function in m_BoardSettings * A proxy function that calls the corresponding function in m_BoardSettings.
* Returns a bit-mask of all the layers that are enabled *
* @return int - the enabled layers in bit-mapped form. * @return the enabled layers in bit-mapped form.
*/ */
LSET GetEnabledLayers() const; LSET GetEnabledLayers() const;
/** /**
* A proxy function that calls the correspondent function in m_BoardSettings * A proxy function that calls the correspondent function in m_BoardSettings.
* Changes the bit-mask of enabled layers *
* @param aLayerMask = The new bit-mask of enabled layers * @param aLayerMask the new bit-mask of enabled layers.
*/ */
void SetEnabledLayers( LSET aLayerMask ); void SetEnabledLayers( LSET aLayerMask );
@ -487,7 +443,7 @@ public:
* A proxy function that calls the correspondent function in m_BoardSettings * A proxy function that calls the correspondent function in m_BoardSettings
* tests whether a given layer is enabled * tests whether a given layer is enabled
* @param aLayer = The layer to be tested * @param aLayer = The layer to be tested
* @return bool - true if the layer is visible. * @return true if the layer is visible.
*/ */
bool IsLayerEnabled( PCB_LAYER_ID aLayer ) const bool IsLayerEnabled( PCB_LAYER_ID aLayer ) const
{ {
@ -497,22 +453,24 @@ public:
/** /**
* A proxy function that calls the correspondent function in m_BoardSettings * A proxy function that calls the correspondent function in m_BoardSettings
* tests whether a given layer is visible * tests whether a given layer is visible
* @param aLayer = The layer to be tested *
* @return bool - true if the layer is visible. * @param aLayer is the layer to be tested.
* @return true if the layer is visible otherwise false.
*/ */
bool IsLayerVisible( PCB_LAYER_ID aLayer ) const; bool IsLayerVisible( PCB_LAYER_ID aLayer ) const;
/** /**
* A proxy function that calls the correspondent function in m_BoardSettings * A proxy function that calls the correspondent function in m_BoardSettings.
* Returns a bit-mask of all the layers that are visible *
* @return int - the visible layers in bit-mapped form. * @return the visible layers in bit-mapped form.
*/ */
LSET GetVisibleLayers() const; LSET GetVisibleLayers() const;
/** /**
* A proxy function that calls the correspondent function in m_BoardSettings * A proxy function that calls the correspondent function in m_BoardSettings
* changes the bit-mask of visible layers * changes the bit-mask of visible layers.
* @param aLayerMask = The new bit-mask of visible layers *
* @param aLayerMask is the new bit-mask of visible layers.
*/ */
void SetVisibleLayers( LSET aLayerMask ); void SetVisibleLayers( LSET aLayerMask );
@ -520,38 +478,42 @@ public:
// are not stored in the bitmap. // are not stored in the bitmap.
/** /**
* Returns a set of all the element categories that are visible * Return a set of all the element categories that are visible.
* @return the set of visible GAL layers *
* @return the set of visible GAL layers.
* @see enum GAL_LAYER_ID * @see enum GAL_LAYER_ID
*/ */
GAL_SET GetVisibleElements() const; GAL_SET GetVisibleElements() const;
/** /**
* A proxy function that calls the correspondent function in m_BoardSettings * A proxy function that calls the correspondent function in m_BoardSettings.
* changes the bit-mask of visible element categories *
* @param aMask = The new bit-mask of visible element bitmap or-ed from enum GAL_LAYER_ID * @param aMask is the new bit-mask of visible element bitmap or-ed from enum GAL_LAYER_ID
* @see enum GAL_LAYER_ID * @see enum GAL_LAYER_ID
*/ */
void SetVisibleElements( const GAL_SET& aMask ); void SetVisibleElements( const GAL_SET& aMask );
/** /**
* Change the bit-mask of visible element categories and layers * Change the bit-mask of visible element categories and layers.
*
* @see enum GAL_LAYER_ID * @see enum GAL_LAYER_ID
*/ */
void SetVisibleAlls(); void SetVisibleAlls();
/** /**
* Test whether a given element category is visible. Keep this as an inline function. * Test whether a given element category is visible.
* @param aLayer is from the enum by the same name *
* @return bool - true if the element is visible. * @param aLayer is from the enum by the same name.
* @return true if the element is visible otherwise false.
* @see enum GAL_LAYER_ID * @see enum GAL_LAYER_ID
*/ */
bool IsElementVisible( GAL_LAYER_ID aLayer ) const; bool IsElementVisible( GAL_LAYER_ID aLayer ) const;
/** /**
* Change the visibility of an element category. * Change the visibility of an element category.
* @param aLayer is from the enum by the same name *
* @param aNewState = The new visibility state of the element category * @param aLayer is from the enum by the same name.
* @param aNewState is the new visibility state of the element category.
* @see enum GAL_LAYER_ID * @see enum GAL_LAYER_ID
*/ */
void SetElementVisibility( GAL_LAYER_ID aLayer, bool aNewState ); void SetElementVisibility( GAL_LAYER_ID aLayer, bool aNewState );
@ -559,8 +521,9 @@ public:
/** /**
* Expect either of the two layers on which a footprint can reside, and returns * Expect either of the two layers on which a footprint can reside, and returns
* whether that layer is visible. * whether that layer is visible.
* @param aLayer One of the two allowed layers for footprints: F_Cu or B_Cu *
* @return bool - true if the layer is visible, else false. * @param aLayer is one of the two allowed layers for footprints: F_Cu or B_Cu
* @return true if the layer is visible, otherwise false.
*/ */
bool IsFootprintLayerVisible( PCB_LAYER_ID aLayer ) const; bool IsFootprintLayerVisible( PCB_LAYER_ID aLayer ) const;
@ -595,13 +558,14 @@ public:
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
/** /**
* Extract the board outlines and build a closed polygon * Extract the board outlines and build a closed polygon from lines, arcs and circle items
* from lines, arcs and circle items on edge cut layer * on edge cut layer.
* Any closed outline inside the main outline is a hole
* All contours should be closed, i.e. have valid vertices to build a closed polygon
* @param aOutlines The SHAPE_POLY_SET to fill in with outlines/holes.
* @param aErrorHandler = an optional DRC_ITEM error handler
* *
* Any closed outline inside the main outline is a hole. All contours should be closed,
* i.e. have valid vertices to build a closed polygon.
*
* @param aOutlines is the #SHAPE_POLY_SET to fill in with outlines/holes.
* @param aErrorHandler is an optional DRC_ITEM error handler.
* @return true if success, false if a contour is not valid * @return true if success, false if a contour is not valid
*/ */
bool GetBoardPolygonOutlines( SHAPE_POLY_SET& aOutlines, bool GetBoardPolygonOutlines( SHAPE_POLY_SET& aOutlines,
@ -609,10 +573,13 @@ public:
/** /**
* Build a set of polygons which are the outlines of copper items (pads, tracks, vias, texts, * Build a set of polygons which are the outlines of copper items (pads, tracks, vias, texts,
* zones). Holes in vias or pads are ignored. The polygons are not merged. * zones).
* Useful to export the shape of copper layers to dxf polygons or 3D viewer *
* @param aLayer = A copper layer, like B_Cu, etc. * Holes in vias or pads are ignored. The polygons are not merged. This is useful to
* @param aOutlines The SHAPE_POLY_SET to fill in with items outline. * export the shape of copper layers to dxf polygons or 3D viewer/
*
* @param aLayer is a copper layer, like B_Cu, etc.
* @param aOutlines is the SHAPE_POLY_SET to fill in with items outline.
*/ */
void ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aOutlines ) const; void ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aOutlines ) const;
@ -625,30 +592,28 @@ public:
* Return the name of a \a aLayer. * Return the name of a \a aLayer.
* *
* @param aLayer is the #PCB_LAYER_ID of the layer. * @param aLayer is the #PCB_LAYER_ID of the layer.
* * @return a string containing the name of the layer.
* @return a string containing the appropriate layer type.
*/ */
const wxString GetLayerName( PCB_LAYER_ID aLayer ) const; const wxString GetLayerName( PCB_LAYER_ID aLayer ) const;
/** /**
* Changes the name of the layer given by aLayer. * Changes the name of the layer given by aLayer.
*
* @param aLayer A layer, like B_Cu, etc. * @param aLayer A layer, like B_Cu, etc.
* @param aLayerName The new layer name * @param aLayerName The new layer name
* @return bool - true if aLayerName was legal and unique among other * @return true if aLayerName was legal and unique among other layer names at other layer
* layer names at other layer indices and aLayer was within range, else false. * indices and aLayer was within range, else false.
*/ */
bool SetLayerName( PCB_LAYER_ID aLayer, const wxString& aLayerName ); bool SetLayerName( PCB_LAYER_ID aLayer, const wxString& aLayerName );
/** /**
* Return an "English Standard" name of a PCB layer when given \a aLayerNumber. * Return an "English Standard" name of a PCB layer when given \a aLayerNumber.
*
* This function is static so it can be called without a BOARD instance. Use * This function is static so it can be called without a BOARD instance. Use
* GetLayerName() if want the layer names of a specific BOARD, which could * GetLayerName() if want the layer names of a specific BOARD, which could
* be different than the default if the user has renamed any copper layers. * be different than the default if the user has renamed any copper layers.
* *
* @param aLayerId is the layer identifier (index) to fetch * @param aLayerId is the layer identifier (index) to fetch.
* @return const wxString - containing the layer name or "BAD INDEX" if aLayerId * @return a string containing the layer name or "BAD INDEX" if aLayerId is not legal.
* is not legal
*/ */
static wxString GetStandardLayerName( PCB_LAYER_ID aLayerId ) static wxString GetStandardLayerName( PCB_LAYER_ID aLayerId )
{ {
@ -669,8 +634,7 @@ public:
* Return the type of the copper layer given by aLayer. * Return the type of the copper layer given by aLayer.
* *
* @param aLayer A layer index, like B_Cu, etc. * @param aLayer A layer index, like B_Cu, etc.
* @return LAYER_T - the layer type, or LAYER_T(-1) if the * @return the layer type, or LAYER_T(-1) if the index was out of range.
* index was out of range.
*/ */
LAYER_T GetLayerType( PCB_LAYER_ID aLayer ) const; LAYER_T GetLayerType( PCB_LAYER_ID aLayer ) const;
@ -679,13 +643,13 @@ public:
* *
* @param aLayer A layer index, like B_Cu, etc. * @param aLayer A layer index, like B_Cu, etc.
* @param aLayerType The new layer type. * @param aLayerType The new layer type.
* @return bool - true if aLayerType was legal and aLayer was within range, else false. * @return true if aLayerType was legal and aLayer was within range, else false.
*/ */
bool SetLayerType( PCB_LAYER_ID aLayer, LAYER_T aLayerType ); bool SetLayerType( PCB_LAYER_ID aLayer, LAYER_T aLayerType );
/** /**
* @param aNet Only count nodes belonging to this net * @param aNet Only count nodes belonging to this net.
* @return the number of pads members of nets (i.e. with netcode > 0) * @return the number of pads members of nets (i.e. with netcode > 0).
*/ */
unsigned GetNodesCount( int aNet = -1 ) const; unsigned GetNodesCount( int aNet = -1 ) const;
@ -695,7 +659,7 @@ public:
unsigned GetUnconnectedNetCount() const; unsigned GetUnconnectedNetCount() const;
/** /**
* @return the number of pads in board * @return the number of pads in board.
*/ */
unsigned GetPadCount() const; unsigned GetPadCount() const;
@ -705,7 +669,7 @@ public:
* The returned list is not sorted and contains pointers to PADS, but those pointers do * The returned list is not sorted and contains pointers to PADS, but those pointers do
* not convey ownership of the respective PADs. * not convey ownership of the respective PADs.
* *
* @return D_PADS - a full list of pads * @return a full list of pads.
*/ */
const std::vector<PAD*> GetPads() const; const std::vector<PAD*> GetPads() const;
@ -716,15 +680,17 @@ public:
/** /**
* Search for a net with the given netcode. * Search for a net with the given netcode.
*
* @param aNetcode A netcode to search for. * @param aNetcode A netcode to search for.
* @return NETINFO_ITEM_ITEM* - the net or NULL if not found. * @return the net if found or NULL if not found.
*/ */
NETINFO_ITEM* FindNet( int aNetcode ) const; NETINFO_ITEM* FindNet( int aNetcode ) const;
/** /**
* Search for a net with the given name. * Search for a net with the given name.
*
* @param aNetname A Netname to search for. * @param aNetname A Netname to search for.
* @return NETINFO_ITEM* - the net or NULL if not found. * @return the net if found or NULL if not found.
*/ */
NETINFO_ITEM* FindNet( const wxString& aNetname ) const; NETINFO_ITEM* FindNet( const wxString& aNetname ) const;
@ -740,7 +706,7 @@ public:
#ifndef SWIG #ifndef SWIG
/** /**
* @return iterator to the first element of the NETINFO_ITEMs list * @return iterator to the first element of the NETINFO_ITEMs list.
*/ */
NETINFO_LIST::iterator BeginNets() const NETINFO_LIST::iterator BeginNets() const
{ {
@ -748,7 +714,7 @@ public:
} }
/** /**
* @return iterator to the last element of the NETINFO_ITEMs list * @return iterator to the last element of the NETINFO_ITEMs list.
*/ */
NETINFO_LIST::iterator EndNets() const NETINFO_LIST::iterator EndNets() const
{ {
@ -757,7 +723,7 @@ public:
#endif #endif
/** /**
* @return the number of nets (NETINFO_ITEM) * @return the number of nets (NETINFO_ITEM).
*/ */
unsigned GetNetCount() const unsigned GetNetCount() const
{ {
@ -768,7 +734,7 @@ public:
* Calculate the bounding box containing all board items (or board edge segments). * Calculate the bounding box containing all board items (or board edge segments).
* *
* @param aBoardEdgesOnly is true if we are interested in board edge segments only. * @param aBoardEdgesOnly is true if we are interested in board edge segments only.
* @return EDA_RECT - the board's bounding box * @return the board's bounding box.
*/ */
EDA_RECT ComputeBoundingBox( bool aBoardEdgesOnly = false ) const; EDA_RECT ComputeBoundingBox( bool aBoardEdgesOnly = false ) const;
@ -778,7 +744,7 @@ public:
} }
/** /**
* Returns the board bounding box calculated using exclusively the board edges (graphics * Return the board bounding box calculated using exclusively the board edges (graphics
* on Edge.Cuts layer). * on Edge.Cuts layer).
* *
* If there are items outside of the area limited by Edge.Cuts graphics, the items will * If there are items outside of the area limited by Edge.Cuts graphics, the items will
@ -802,8 +768,8 @@ public:
* @param testData Arbitrary data used by the inspector. * @param testData Arbitrary data used by the inspector.
* @param scanTypes Which KICAD_T types are of interest and the order * @param scanTypes Which KICAD_T types are of interest and the order
* is significant too, terminated by EOT. * is significant too, terminated by EOT.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan, * @return SEARCH_QUIT if the Iterator is to stop the scan, else SCAN_CONTINUE, and
* else SCAN_CONTINUE, and determined by the inspector. * determined by the inspector.
*/ */
SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override; SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
@ -813,8 +779,7 @@ public:
* Finds only the first one, if there is more than one such FOOTPRINT. * Finds only the first one, if there is more than one such FOOTPRINT.
* *
* @param aReference The reference designator of the FOOTPRINT to find. * @param aReference The reference designator of the FOOTPRINT to find.
* @return FOOTPRINT* - If found, the FOOTPRINT having the given reference designator, else * @return If found the FOOTPRINT having the given reference designator, else nullptr.
* nullptr.
*/ */
FOOTPRINT* FindFootprintByReference( const wxString& aReference ) const; FOOTPRINT* FindFootprintByReference( const wxString& aReference ) const;
@ -822,15 +787,15 @@ public:
* Search for a FOOTPRINT within this board with the given path. * Search for a FOOTPRINT within this board with the given path.
* *
* @param aPath The path ([sheetUUID, .., symbolUUID]) to search for. * @param aPath The path ([sheetUUID, .., symbolUUID]) to search for.
* @return FOOTPRINT* - If found, the FOOTPRINT having the given uuid, else NULL. * @return If found, the FOOTPRINT having the given uuid, else NULL.
*/ */
FOOTPRINT* FindFootprintByPath( const KIID_PATH& aPath ) const; FOOTPRINT* FindFootprintByPath( const KIID_PATH& aPath ) const;
/** /**
* @param aNames An array string to fill with net names. * @param aNames An array string to fill with net names.
* @param aSortbyPadsCount true = sort by active pads count, false = no sort (i.e. * @param aSortbyPadsCount set to true to sort by active pads count, false = no sort (i.e.
* leave the sort by net names) * leave the sort by net names).
* @return int - net names count. * @return net names count.
*/ */
int SortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCount ); int SortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCount );
@ -885,14 +850,14 @@ public:
* Return the Zone at a given index. * Return the Zone at a given index.
* *
* @param index The array type index into a collection of ZONE *. * @param index The array type index into a collection of ZONE *.
* @return ZONE* - a pointer to the Area or NULL if index out of range. * @return a pointer to the Area or NULL if index out of range.
*/ */
ZONE* GetArea( int index ) const ZONE* GetArea( int index ) const
{ {
if( (unsigned) index < m_zones.size() ) if( (unsigned) index < m_zones.size() )
return m_zones[index]; return m_zones[index];
return NULL; return nullptr;
} }
/** /**
@ -913,13 +878,14 @@ public:
/** /**
* Add an empty copper area to board areas list. * Add an empty copper area to board areas list.
* *
* @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new areas pickers (useful * @param aNewZonesList is a PICKED_ITEMS_LIST * where to store new areas pickers (useful
* in undo commands) can be NULL * in undo commands) can be NULL.
* @param aNetcode = the netcode of the copper area (0 = no net) * @param aNetcode is the netcode of the copper area (0 = no net).
* @param aLayer = the layer of area * @param aLayer is the layer of area.
* @param aStartPointPosition = position of the first point of the polygon outline of this area * @param aStartPointPosition is position of the first point of the polygon outline of this
* @param aHatch = hatch option * area.
* @return a reference to the new area * @param aHatch is the hatch option.
* @return a reference to the new area.
*/ */
ZONE* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer, ZONE* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer,
wxPoint aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch ); wxPoint aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch );
@ -927,29 +893,34 @@ public:
/** /**
* Process an area that has been modified, by normalizing its polygon against itself. * Process an area that has been modified, by normalizing its polygon against itself.
* i.e. convert a self-intersecting polygon to one (or more) non self-intersecting polygon(s) * i.e. convert a self-intersecting polygon to one (or more) non self-intersecting polygon(s)
*
* This may change the number and order of copper areas in the net. * This may change the number and order of copper areas in the net.
* @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new created areas pickers *
* @param aCurrArea = the zone to process * @param aNewZonesList is a PICKED_ITEMS_LIST where to store new created areas pickers.
* @return true if changes are made * @param aCurrArea is the zone to process.
* @return true if changes are made.
*/ */
bool NormalizeAreaPolygon( PICKED_ITEMS_LIST* aNewZonesList, ZONE* aCurrArea ); bool NormalizeAreaPolygon( PICKED_ITEMS_LIST* aNewZonesList, ZONE* aCurrArea );
/** /**
* Process an area that has been modified, by normalizing its polygon * Process an area that has been modified, by normalizing its polygon
* and merging the intersecting polygons for any other areas on the same net. * and merging the intersecting polygons for any other areas on the same net.
*
* This may change the number and order of copper areas in the net. * This may change the number and order of copper areas in the net.
* @param aModifiedZonesList = a PICKED_ITEMS_LIST * where to store deleted or added areas *
* (useful in undo commands can be NULL * @param aModifiedZonesList is a #PICKED_ITEMS_LIST where to store deleted or added areas
* @param modified_area = area to test * (useful in undo commands can be NULL).
* @return true if some areas modified * @param modified_area is the area to test.
* @return true if some areas modified.
*/ */
bool OnAreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList, ZONE* modified_area ); bool OnAreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList, ZONE* modified_area );
/** /**
* Test for intersection of 2 copper areas * Test for intersection of 2 copper areas.
* @param aZone1 = area reference *
* @param aZone2 = area to compare for intersection calculations * @param aZone1 is the area reference.
* @return : false if no intersection, true if intersection * @param aZone2 is the area to compare for intersection calculations.
* @return false if no intersection, true if intersection.
*/ */
bool TestZoneIntersection( ZONE* aZone1, ZONE* aZone2 ); bool TestZoneIntersection( ZONE* aZone1, ZONE* aZone2 );
@ -995,7 +966,7 @@ public:
* function. * function.
* </p> * </p>
* @note The normal pad list is sorted by increasing netcodes. * @note The normal pad list is sorted by increasing netcodes.
* @param aPadList = the list of pads candidates (a std::vector<PAD*>) * @param aPadList is the list of pads candidates (a std::vector<PAD*>).
* @param aPosition A wxPoint object containing the position to test. * @param aPosition A wxPoint object containing the position to test.
* @param aLayerMask A layer or layers to mask the hit test. * @param aLayerMask A layer or layers to mask the hit test.
* @return a PAD object pointer to the connected pad. * @return a PAD object pointer to the connected pad.
@ -1005,6 +976,7 @@ public:
/** /**
* Delete a given pad from the BOARD by removing it from its footprint and from the * Delete a given pad from the BOARD by removing it from its footprint and from the
* m_NetInfo. Makes no UI calls. * m_NetInfo. Makes no UI calls.
*
* @param aPad is the pad to delete. * @param aPad is the pad to delete.
*/ */
void PadDelete( PAD* aPad ); void PadDelete( PAD* aPad );
@ -1014,6 +986,7 @@ public:
* coordinate, and for increasing y coordinate for same values of x coordinates. The vector * coordinate, and for increasing y coordinate for same values of x coordinates. The vector
* only holds pointers to the pads and those pointers are only references to pads which are * only holds pointers to the pads and those pointers are only references to pads which are
* owned by the BOARD through other links. * owned by the BOARD through other links.
*
* @param aVector Where to put the pad pointers. * @param aVector Where to put the pad pointers.
* @param aNetCode = the netcode filter: * @param aNetCode = the netcode filter:
* = -1 to build the full pad list. * = -1 to build the full pad list.
@ -1022,7 +995,7 @@ public:
void GetSortedPadListByXthenYCoord( std::vector<PAD*>& aVector, int aNetCode = -1 ) const; void GetSortedPadListByXthenYCoord( std::vector<PAD*>& aVector, int aNetCode = -1 ) const;
/** /**
* Returns data on the length and number of track segments connected to a given track. * Return data on the length and number of track segments connected to a given track.
* This uses the connectivity data for the board to calculate connections * This uses the connectivity data for the board to calculate connections
* *
* @param aTrack Starting track (can also be a via) to check against for connection. * @param aTrack Starting track (can also be a via) to check against for connection.
@ -1033,14 +1006,15 @@ public:
/** /**
* Collect all the TRACKs and VIAs that are members of a net given by aNetCode. * Collect all the TRACKs and VIAs that are members of a net given by aNetCode.
* Used from python. * Used from python.
*
* @param aNetCode gives the id of the net. * @param aNetCode gives the id of the net.
* @return TRACKS - which are in the net identified by @a aNetCode. * @return list of track which are in the net identified by @a aNetCode.
*/ */
TRACKS TracksInNet( int aNetCode ); TRACKS TracksInNet( int aNetCode );
/** /**
* Get a footprint by its bounding rectangle at \a aPosition on \a aLayer. * Get a footprint by its bounding rectangle at \a aPosition on \a aLayer.
* <p> *
* If more than one footprint is at \a aPosition, then the closest footprint on the * If more than one footprint is at \a aPosition, then the closest footprint on the
* active layer is returned. The distance is calculated via manhattan distance from * active layer is returned. The distance is calculated via manhattan distance from
* the center of the bounding rectangle to \a aPosition. * the center of the bounding rectangle to \a aPosition.
@ -1095,14 +1069,15 @@ public:
*/ */
void OnItemsChanged( std::vector<BOARD_ITEM*>& aItems ); void OnItemsChanged( std::vector<BOARD_ITEM*>& aItems );
/* /**
* Consistency check of internal m_groups structure. * Consistency check of internal m_groups structure.
*
* @param repair if true, modify groups structure until it passes the sanity check. * @param repair if true, modify groups structure until it passes the sanity check.
* @return empty string on success. Or error description if there's a problem. * @return empty string on success. Or error description if there's a problem.
*/ */
wxString GroupsSanityCheck( bool repair = false ); wxString GroupsSanityCheck( bool repair = false );
/* /**
* @param repair if true, make one modification to groups structure that brings it * @param repair if true, make one modification to groups structure that brings it
* closer to passing the sanity check. * closer to passing the sanity check.
* @return empty string on success. Or error description if there's a problem. * @return empty string on success. Or error description if there's a problem.
@ -1117,15 +1092,14 @@ public:
bool enter : 1; bool enter : 1;
}; };
/* /**
* Check which selection tool group operations are legal given the selection. * Check which selection tool group operations are legal given the selection.
*
* @return bit field of legal ops. * @return bit field of legal ops.
*/ */
GroupLegalOpsField GroupLegalOps( const PCB_SELECTION& selection ) const; GroupLegalOpsField GroupLegalOps( const PCB_SELECTION& selection ) const;
public:
// ------------ Run-time caches ------------- // ------------ Run-time caches -------------
std::mutex m_CachesMutex; std::mutex m_CachesMutex;
std::map< std::pair<BOARD_ITEM*, BOARD_ITEM*>, bool > m_InsideCourtyardCache; std::map< std::pair<BOARD_ITEM*, BOARD_ITEM*>, bool > m_InsideCourtyardCache;
std::map< std::pair<BOARD_ITEM*, BOARD_ITEM*>, bool > m_InsideFCourtyardCache; std::map< std::pair<BOARD_ITEM*, BOARD_ITEM*>, bool > m_InsideFCourtyardCache;
@ -1133,5 +1107,65 @@ public:
std::map< std::pair<BOARD_ITEM*, BOARD_ITEM*>, bool > m_InsideAreaCache; std::map< std::pair<BOARD_ITEM*, BOARD_ITEM*>, bool > m_InsideAreaCache;
std::map< ZONE*, std::unique_ptr<DRC_RTREE> > m_CopperZoneRTrees; std::map< ZONE*, std::unique_ptr<DRC_RTREE> > m_CopperZoneRTrees;
private:
// The default copy constructor & operator= are inadequate,
// either write one or do not use it at all
BOARD( const BOARD& aOther ) = delete;
BOARD& operator=( const BOARD& aOther ) = delete;
template <typename Func, typename... Args>
void InvokeListeners( Func&& aFunc, Args&&... args )
{
for( auto&& l : m_listeners )
( l->*aFunc )( std::forward<Args>( args )... );
}
friend class PCB_EDIT_FRAME;
/// What is this board being used for
BOARD_USE m_boardUse;
int m_timeStamp; // actually a modification counter
wxString m_fileName;
MARKERS m_markers;
DRAWINGS m_drawings;
FOOTPRINTS m_footprints;
TRACKS m_tracks;
GROUPS m_groups;
ZONES m_zones;
LAYER m_layers[PCB_LAYER_ID_COUNT];
HIGH_LIGHT_INFO m_highLight; // current high light data
HIGH_LIGHT_INFO m_highLightPrevious; // a previously stored high light data
int m_fileFormatVersionAtLoad; // the version loaded from the file
std::map<wxString, wxString> m_properties;
std::shared_ptr<CONNECTIVITY_DATA> m_connectivity;
PAGE_INFO m_paper;
TITLE_BLOCK m_titles; // text in lower right of screen and plots
PCB_PLOT_PARAMS m_plotOptions;
PROJECT* m_project; // project this board is a part of
/**
* All of the board design settings are stored as a JSON object inside the project file. The
* object itself is located here because the alternative is to require a valid project be
* passed in when constructing a BOARD, since things in the BOARD constructor rely on access
* to the BOARD_DESIGN_SETTINGS object.
*
* A reference to this object is set up in the PROJECT_FILE for the PROJECT this board is
* part of, so that the JSON load/store operations work. This link is established when
* boards are loaded from disk.
*/
std::unique_ptr<BOARD_DESIGN_SETTINGS> m_designSettings;
NETINFO_LIST m_NetInfo; // net info list (name, design constraints...
std::vector<BOARD_LISTENER*> m_listeners;
}; };
#endif // CLASS_BOARD_H_ #endif // CLASS_BOARD_H_

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -48,32 +48,27 @@ enum CLEANUP_RC_CODE {
class CLEANUP_ITEM : public RC_ITEM class CLEANUP_ITEM : public RC_ITEM
{ {
private:
wxString m_errorMessage;
public: public:
CLEANUP_ITEM( int aErrorCode ); CLEANUP_ITEM( int aErrorCode );
/** /**
* Function GetErrorText * Return the string form of a drc error code.
* returns the string form of a drc error code.
*/ */
wxString GetErrorText( int aErrorCode = -1, bool aTranslate = true ) const; wxString GetErrorText( int aErrorCode = -1, bool aTranslate = true ) const;
private:
wxString m_errorMessage;
}; };
/** /**
* VECTOR_CLEANUP_ITEMS_PROVIDER * An implementation of the interface named RC_ITEMS_PROVIDER which uses a vector
* is an implementation of the interface named RC_ITEMS_PROVIDER which uses a vector
* of pointers to CLEANUP_ITEMs to fulfill the interface. No ownership is taken of the * of pointers to CLEANUP_ITEMs to fulfill the interface. No ownership is taken of the
* vector. * vector.
*/ */
class VECTOR_CLEANUP_ITEMS_PROVIDER : public RC_ITEMS_PROVIDER class VECTOR_CLEANUP_ITEMS_PROVIDER : public RC_ITEMS_PROVIDER
{ {
std::vector<std::shared_ptr<CLEANUP_ITEM> >* m_sourceVector; // owns its CLEANUP_ITEMs
public: public:
VECTOR_CLEANUP_ITEMS_PROVIDER( std::vector<std::shared_ptr<CLEANUP_ITEM> >* aList ) : VECTOR_CLEANUP_ITEMS_PROVIDER( std::vector<std::shared_ptr<CLEANUP_ITEM> >* aList ) :
m_sourceVector( aList ) m_sourceVector( aList )
{ {
@ -115,6 +110,9 @@ public:
m_sourceVector->clear(); m_sourceVector->clear();
} }
} }
private:
std::vector<std::shared_ptr<CLEANUP_ITEM> >* m_sourceVector; // owns its CLEANUP_ITEMs
}; };

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2007-2008 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2007-2008 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -59,96 +59,95 @@
*/ */
class COLLECTORS_GUIDE class COLLECTORS_GUIDE
{ {
public: public:
virtual ~COLLECTORS_GUIDE() {} virtual ~COLLECTORS_GUIDE() {}
/** /**
* @return bool - true if the given layer is locked, else false. * @return true if the given layer is locked, else false.
*/ */
virtual bool IsLayerLocked( PCB_LAYER_ID layer ) const = 0; virtual bool IsLayerLocked( PCB_LAYER_ID layer ) const = 0;
/** /**
* @return bool - true if the given layer is visible, else false. * @return true if the given layer is visible, else false.
*/ */
virtual bool IsLayerVisible( PCB_LAYER_ID layer ) const = 0; virtual bool IsLayerVisible( PCB_LAYER_ID layer ) const = 0;
/** /**
* @return bool - true if should ignore locked layers, else false. * @return true if should ignore locked layers, else false.
*/ */
virtual bool IgnoreLockedLayers() const = 0; virtual bool IgnoreLockedLayers() const = 0;
/** /**
* @return bool - true if should ignore non-visible layers, else false. * @return true if should ignore non-visible layers, else false.
*/ */
virtual bool IgnoreNonVisibleLayers() const = 0; virtual bool IgnoreNonVisibleLayers() const = 0;
/** /**
* @return int - the preferred layer for HitTest()ing. * @return the preferred layer for HitTest()ing.
*/ */
virtual PCB_LAYER_ID GetPreferredLayer() const = 0; virtual PCB_LAYER_ID GetPreferredLayer() const = 0;
/** /**
* Provide wildcard behavior regarding the preferred layer. * Provide wildcard behavior regarding the preferred layer.
* *
* @return bool - true if should ignore preferred layer, else false. * @return true if should ignore preferred layer, else false.
*/ */
virtual bool IgnorePreferredLayer() const = 0; virtual bool IgnorePreferredLayer() const = 0;
/** /**
* @return bool - true if should ignore locked items, else false. * @return true if should ignore locked items, else false.
*/ */
virtual bool IgnoreLockedItems() const = 0; virtual bool IgnoreLockedItems() const = 0;
/** /**
* Determine if the secondary criteria or 2nd choice items should be included. * Determine if the secondary criteria or 2nd choice items should be included.
* *
* @return bool - true if should include, else false. * @return true if should include, else false.
*/ */
virtual bool IncludeSecondary() const = 0; virtual bool IncludeSecondary() const = 0;
/** /**
* @return bool - true if footprint texts marked as "no show" should be ignored. * @return true if footprint texts marked as "no show" should be ignored.
*/ */
virtual bool IgnoreHiddenFPText() const = 0; virtual bool IgnoreHiddenFPText() const = 0;
/** /**
* @return bool - true if should ignore footprint text on back layers * @return true if should ignore footprint text on back layers
*/ */
virtual bool IgnoreFPTextOnBack() const = 0; virtual bool IgnoreFPTextOnBack() const = 0;
/** /**
* @return bool - true if should ignore footprint text on front layers. * @return true if should ignore footprint text on front layers.
*/ */
virtual bool IgnoreFPTextOnFront() const = 0; virtual bool IgnoreFPTextOnFront() const = 0;
/** /**
* @return bool - true if should ignore FOOTPRINTs on Back Side. * @return true if should ignore FOOTPRINTs on Back Side.
*/ */
virtual bool IgnoreFootprintsOnBack() const = 0; virtual bool IgnoreFootprintsOnBack() const = 0;
/** /**
* @return bool - ture if should ignore FOOTPRINTs on Front Side. * @return true if should ignore FOOTPRINTs on Front Side.
*/ */
virtual bool IgnoreFootprintsOnFront() const = 0; virtual bool IgnoreFootprintsOnFront() const = 0;
/** /**
* @return bool - true if should ignore Pads on Back Side. * @return true if should ignore Pads on Back Side.
*/ */
virtual bool IgnorePadsOnBack() const = 0; virtual bool IgnorePadsOnBack() const = 0;
/** /**
* @return bool - ture if should ignore PADSs on Front Side. * @return true if should ignore PADSs on Front Side.
*/ */
virtual bool IgnorePadsOnFront() const = 0; virtual bool IgnorePadsOnFront() const = 0;
/** /**
* @return bool - ture if should ignore through-hole PADSs. * @return true if should ignore through-hole PADSs.
*/ */
virtual bool IgnoreThroughHolePads() const = 0; virtual bool IgnoreThroughHolePads() const = 0;
/** /**
* @return bool - true if should ignore PADSs on Front side and Back side. * @return true if should ignore PADSs on Front side and Back side.
*/ */
virtual bool IgnorePads() const virtual bool IgnorePads() const
{ {
@ -156,12 +155,12 @@ public:
} }
/** /**
* @return bool - true if should ignore footprint values. * @return true if should ignore footprint values.
*/ */
virtual bool IgnoreFPValues() const = 0; virtual bool IgnoreFPValues() const = 0;
/** /**
* @return bool - true if should ignore footprint references. * @return true if should ignore footprint references.
*/ */
virtual bool IgnoreFPReferences() const = 0; virtual bool IgnoreFPReferences() const = 0;
@ -193,8 +192,8 @@ public:
virtual double OnePixelInIU() const = 0; virtual double OnePixelInIU() const = 0;
/** /**
* @return bool - true if Inspect() should use BOARD_ITEM::HitTest() * @return true if Inspect() should use BOARD_ITEM::HitTest()
* or false if Inspect() should use BOARD_ITEM::BoundsTest(). * or false if Inspect() should use BOARD_ITEM::BoundsTest().
virtual bool UseHitTesting() const = 0; virtual bool UseHitTesting() const = 0;
*/ */
}; };
@ -217,14 +216,14 @@ public:
* Overload the COLLECTOR::operator[](int) to return a #BOARD_ITEM instead of an #EDA_ITEM. * Overload the COLLECTOR::operator[](int) to return a #BOARD_ITEM instead of an #EDA_ITEM.
* *
* @param ndx The index into the list. * @param ndx The index into the list.
* @return BOARD_ITEM* - or something derived from it, or NULL. * @return a board item or NULL.
*/ */
BOARD_ITEM* operator[]( int ndx ) const override BOARD_ITEM* operator[]( int ndx ) const override
{ {
if( (unsigned)ndx < (unsigned)GetCount() ) if( (unsigned)ndx < (unsigned)GetCount() )
return (BOARD_ITEM*) m_list[ ndx ]; return (BOARD_ITEM*) m_list[ ndx ];
return NULL; return nullptr;
} }
}; };
@ -250,7 +249,7 @@ protected:
std::vector<BOARD_ITEM*> m_List2nd; std::vector<BOARD_ITEM*> m_List2nd;
/** /**
* Determines which items are to be collected by Inspect() * Determine which items are to be collected by Inspect().
*/ */
const COLLECTORS_GUIDE* m_Guide; const COLLECTORS_GUIDE* m_Guide;
@ -313,12 +312,9 @@ public:
*/ */
static const KICAD_T DraggableItems[]; static const KICAD_T DraggableItems[];
/**
* Constructor GENERALCOLLECTOR
*/
GENERAL_COLLECTOR() GENERAL_COLLECTOR()
{ {
m_Guide = NULL; m_Guide = nullptr;
m_PrimaryLength = 0; m_PrimaryLength = 0;
SetScanTypes( AllBoardItems ); SetScanTypes( AllBoardItems );
} }
@ -343,19 +339,19 @@ public:
const COLLECTORS_GUIDE* GetGuide() const { return m_Guide; } const COLLECTORS_GUIDE* GetGuide() const { return m_Guide; }
/** /**
* @return int - The number if items which met the primary search criteria * @return The number of items which met the primary search criteria
*/ */
int GetPrimaryCount() { return m_PrimaryLength; } int GetPrimaryCount() { return m_PrimaryLength; }
/** /**
* The examining function within the INSPECTOR which is passed to the Iterate function. * The examining function within the INSPECTOR which is passed to the Iterate function.
* *
* Searches and collects all the objects which match the test data. * Search and collect all the objects which match the test data.
* *
* @param testItem An EDA_ITEM to examine. * @param testItem An EDA_ITEM to examine.
* @param testData is not used in this class. * @param testData is not used in this class.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan, * @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE; * else SCAN_CONTINUE;
*/ */
SEARCH_RESULT Inspect( EDA_ITEM* testItem, void* testData ) override; SEARCH_RESULT Inspect( EDA_ITEM* testItem, void* testData ) override;
@ -370,7 +366,7 @@ public:
* @param aGuide The COLLECTORS_GUIDE to use in collecting items. * @param aGuide The COLLECTORS_GUIDE to use in collecting items.
*/ */
void Collect( BOARD_ITEM* aItem, const KICAD_T aScanList[], void Collect( BOARD_ITEM* aItem, const KICAD_T aScanList[],
const wxPoint& aRefPos, const COLLECTORS_GUIDE& aGuide ); const wxPoint& aRefPos, const COLLECTORS_GUIDE& aGuide );
}; };
@ -380,40 +376,6 @@ public:
*/ */
class GENERAL_COLLECTORS_GUIDE : public COLLECTORS_GUIDE class GENERAL_COLLECTORS_GUIDE : public COLLECTORS_GUIDE
{ {
private:
// the storage architecture here is not important, since this is only
// a carrier object and its functions are what is used, and data only indirectly.
PCB_LAYER_ID m_preferredLayer;
bool m_ignorePreferredLayer;
LSET m_lockedLayers; ///< bit-mapped layer locked bits
bool m_ignoreLockedLayers;
LSET m_visibleLayers; ///< bit-mapped layer visible bits
bool m_ignoreNonVisibleLayers;
bool m_ignoreLockedItems;
bool m_includeSecondary;
bool m_ignoreHiddenFPText;
bool m_ignoreFPTextOnBack;
bool m_ignoreFPTextOnFront;
bool m_ignoreFootprintsOnBack;
bool m_ignoreFootprintsOnFront;
bool m_ignorePadsOnFront;
bool m_ignorePadsOnBack;
bool m_ignoreThroughHolePads;
bool m_ignoreFPValues;
bool m_ignoreFPReferences;
bool m_ignoreThroughVias;
bool m_ignoreBlindBuriedVias;
bool m_ignoreMicroVias;
bool m_ignoreTracks;
bool m_ignoreZoneFills;
double m_onePixelInIU;
public: public:
/** /**
@ -421,8 +383,8 @@ public:
* *
* Add more constructors as needed. * Add more constructors as needed.
* *
* @param aVisibleLayerMask = current visible layers (bit mask) * @param aVisibleLayerMask is the current visible layers (bit mask).
* @param aPreferredLayer = the layer to search first * @param aPreferredLayer is the layer to search first.
*/ */
GENERAL_COLLECTORS_GUIDE( LSET aVisibleLayerMask, PCB_LAYER_ID aPreferredLayer, GENERAL_COLLECTORS_GUIDE( LSET aVisibleLayerMask, PCB_LAYER_ID aPreferredLayer,
KIGFX::VIEW* aView ) KIGFX::VIEW* aView )
@ -465,7 +427,7 @@ public:
} }
/** /**
* @return bool - true if the given layer is locked, else false. * @return true if the given layer is locked, else false.
*/ */
bool IsLayerLocked( PCB_LAYER_ID aLayerId ) const override bool IsLayerLocked( PCB_LAYER_ID aLayerId ) const override
{ {
@ -478,7 +440,7 @@ public:
} }
/** /**
* @return bool - true if the given layer is visible, else false. * @return true if the given layer is visible, else false.
*/ */
bool IsLayerVisible( PCB_LAYER_ID aLayerId ) const override bool IsLayerVisible( PCB_LAYER_ID aLayerId ) const override
{ {
@ -491,13 +453,13 @@ public:
void SetLayerVisibleBits( LSET aLayerBits ) { m_visibleLayers = aLayerBits; } void SetLayerVisibleBits( LSET aLayerBits ) { m_visibleLayers = aLayerBits; }
/** /**
* @return bool - true if should ignore locked layers, else false. * @return true if should ignore locked layers, else false.
*/ */
bool IgnoreLockedLayers() const override { return m_ignoreLockedLayers; } bool IgnoreLockedLayers() const override { return m_ignoreLockedLayers; }
void SetIgnoreLockedLayers( bool ignore ) { m_ignoreLockedLayers = ignore; } void SetIgnoreLockedLayers( bool ignore ) { m_ignoreLockedLayers = ignore; }
/** /**
* @return bool - true if should ignore non-visible layers, else false. * @return true if should ignore non-visible layers, else false.
*/ */
bool IgnoreNonVisibleLayers() const override { return m_ignoreNonVisibleLayers; } bool IgnoreNonVisibleLayers() const override { return m_ignoreNonVisibleLayers; }
void SetIgnoreNonVisibleLayers( bool ignore ) { m_ignoreLockedLayers = ignore; } void SetIgnoreNonVisibleLayers( bool ignore ) { m_ignoreLockedLayers = ignore; }
@ -511,13 +473,13 @@ public:
/** /**
* Provide wildcard behavior regarding the preferred layer. * Provide wildcard behavior regarding the preferred layer.
* *
* @return bool - true if should ignore preferred layer, else false. * @return true if should ignore preferred layer, else false.
*/ */
bool IgnorePreferredLayer() const override { return m_ignorePreferredLayer; } bool IgnorePreferredLayer() const override { return m_ignorePreferredLayer; }
void SetIgnorePreferredLayer( bool ignore ) { m_ignorePreferredLayer = ignore; } void SetIgnorePreferredLayer( bool ignore ) { m_ignorePreferredLayer = ignore; }
/** /**
* @return bool - true if should ignore locked items, else false. * @return true if should ignore locked items, else false.
*/ */
bool IgnoreLockedItems() const override { return m_ignoreLockedItems; } bool IgnoreLockedItems() const override { return m_ignoreLockedItems; }
void SetIgnoreLockedItems( bool ignore ) { m_ignoreLockedItems = ignore; } void SetIgnoreLockedItems( bool ignore ) { m_ignoreLockedItems = ignore; }
@ -525,67 +487,67 @@ public:
/** /**
* Determine if the secondary criteria, or 2nd choice items should be included. * Determine if the secondary criteria, or 2nd choice items should be included.
* *
* @return bool - true if should include, else false. * @return true if should include, else false.
*/ */
bool IncludeSecondary() const override { return m_includeSecondary; } bool IncludeSecondary() const override { return m_includeSecondary; }
void SetIncludeSecondary( bool include ) { m_includeSecondary = include; } void SetIncludeSecondary( bool include ) { m_includeSecondary = include; }
/** /**
* @return bool - true if MTexts marked as "no show" should be ignored. * @return true if MTexts marked as "no show" should be ignored.
*/ */
bool IgnoreHiddenFPText() const override { return m_ignoreHiddenFPText; } bool IgnoreHiddenFPText() const override { return m_ignoreHiddenFPText; }
void SetIgnoreMTextsMarkedNoShow( bool ignore ) { m_ignoreHiddenFPText = ignore; } void SetIgnoreMTextsMarkedNoShow( bool ignore ) { m_ignoreHiddenFPText = ignore; }
/** /**
* @return bool - true if should ignore MTexts on back layers * @return true if should ignore MTexts on back layers
*/ */
bool IgnoreFPTextOnBack() const override { return m_ignoreFPTextOnBack; } bool IgnoreFPTextOnBack() const override { return m_ignoreFPTextOnBack; }
void SetIgnoreMTextsOnBack( bool ignore ) { m_ignoreFPTextOnBack = ignore; } void SetIgnoreMTextsOnBack( bool ignore ) { m_ignoreFPTextOnBack = ignore; }
/** /**
* @return bool - true if should ignore MTexts on front layers * @return true if should ignore MTexts on front layers
*/ */
bool IgnoreFPTextOnFront() const override { return m_ignoreFPTextOnFront; } bool IgnoreFPTextOnFront() const override { return m_ignoreFPTextOnFront; }
void SetIgnoreMTextsOnFront( bool ignore ) { m_ignoreFPTextOnFront = ignore; } void SetIgnoreMTextsOnFront( bool ignore ) { m_ignoreFPTextOnFront = ignore; }
/** /**
* @return bool - true if should ignore MODULEs on the back side * @return true if should ignore MODULEs on the back side
*/ */
bool IgnoreFootprintsOnBack() const override { return m_ignoreFootprintsOnBack; } bool IgnoreFootprintsOnBack() const override { return m_ignoreFootprintsOnBack; }
void SetIgnoreModulesOnBack( bool ignore ) { m_ignoreFootprintsOnBack = ignore; } void SetIgnoreModulesOnBack( bool ignore ) { m_ignoreFootprintsOnBack = ignore; }
/** /**
* @return bool - true if should ignore MODULEs on component layer. * @return true if should ignore MODULEs on component layer.
*/ */
bool IgnoreFootprintsOnFront() const override { return m_ignoreFootprintsOnFront; } bool IgnoreFootprintsOnFront() const override { return m_ignoreFootprintsOnFront; }
void SetIgnoreModulesOnFront( bool ignore ) { m_ignoreFootprintsOnFront = ignore; } void SetIgnoreModulesOnFront( bool ignore ) { m_ignoreFootprintsOnFront = ignore; }
/** /**
* @return bool - true if should ignore Pads on Back Side. * @return true if should ignore Pads on Back Side.
*/ */
bool IgnorePadsOnBack() const override { return m_ignorePadsOnBack; } bool IgnorePadsOnBack() const override { return m_ignorePadsOnBack; }
void SetIgnorePadsOnBack(bool ignore) { m_ignorePadsOnBack = ignore; } void SetIgnorePadsOnBack(bool ignore) { m_ignorePadsOnBack = ignore; }
/** /**
* @return bool - true if should ignore PADSs on Front Side. * @return true if should ignore PADSs on Front Side.
*/ */
bool IgnorePadsOnFront() const override { return m_ignorePadsOnFront; } bool IgnorePadsOnFront() const override { return m_ignorePadsOnFront; }
void SetIgnorePadsOnFront(bool ignore) { m_ignorePadsOnFront = ignore; } void SetIgnorePadsOnFront(bool ignore) { m_ignorePadsOnFront = ignore; }
/** /**
* @return bool - true if should ignore through-hole PADSs. * @return true if should ignore through-hole PADSs.
*/ */
bool IgnoreThroughHolePads() const override { return m_ignoreThroughHolePads; } bool IgnoreThroughHolePads() const override { return m_ignoreThroughHolePads; }
void SetIgnoreThroughHolePads(bool ignore) { m_ignoreThroughHolePads = ignore; } void SetIgnoreThroughHolePads(bool ignore) { m_ignoreThroughHolePads = ignore; }
/** /**
* @return bool - true if should ignore footprints values. * @return true if should ignore footprints values.
*/ */
bool IgnoreFPValues() const override { return m_ignoreFPValues; } bool IgnoreFPValues() const override { return m_ignoreFPValues; }
void SetIgnoreModulesVals(bool ignore) { m_ignoreFPValues = ignore; } void SetIgnoreModulesVals(bool ignore) { m_ignoreFPValues = ignore; }
/** /**
* @return bool - true if should ignore footprints references. * @return true if should ignore footprints references.
*/ */
bool IgnoreFPReferences() const override { return m_ignoreFPReferences; } bool IgnoreFPReferences() const override { return m_ignoreFPReferences; }
void SetIgnoreModulesRefs(bool ignore) { m_ignoreFPReferences = ignore; } void SetIgnoreModulesRefs(bool ignore) { m_ignoreFPReferences = ignore; }
@ -607,6 +569,40 @@ public:
double OnePixelInIU() const override { return m_onePixelInIU; } double OnePixelInIU() const override { return m_onePixelInIU; }
void SetOnePixelInIU( double aValue ) { m_onePixelInIU = aValue; } void SetOnePixelInIU( double aValue ) { m_onePixelInIU = aValue; }
private:
// the storage architecture here is not important, since this is only
// a carrier object and its functions are what is used, and data only indirectly.
PCB_LAYER_ID m_preferredLayer;
bool m_ignorePreferredLayer;
LSET m_lockedLayers; ///< bit-mapped layer locked bits
bool m_ignoreLockedLayers;
LSET m_visibleLayers; ///< bit-mapped layer visible bits
bool m_ignoreNonVisibleLayers;
bool m_ignoreLockedItems;
bool m_includeSecondary;
bool m_ignoreHiddenFPText;
bool m_ignoreFPTextOnBack;
bool m_ignoreFPTextOnFront;
bool m_ignoreFootprintsOnBack;
bool m_ignoreFootprintsOnFront;
bool m_ignorePadsOnFront;
bool m_ignorePadsOnBack;
bool m_ignoreThroughHolePads;
bool m_ignoreFPValues;
bool m_ignoreFPReferences;
bool m_ignoreThroughVias;
bool m_ignoreBlindBuriedVias;
bool m_ignoreMicroVias;
bool m_ignoreTracks;
bool m_ignoreZoneFills;
double m_onePixelInIU;
}; };
@ -624,8 +620,7 @@ public:
* *
* @param testItem An EDA_ITEM to examine. * @param testItem An EDA_ITEM to examine.
* @param testData is not used in this class. * @param testData is not used in this class.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan, * @return SEARCH_QUIT if the Iterator is to stop the scan, else SCAN_CONTINUE;
* else SCAN_CONTINUE;
*/ */
SEARCH_RESULT Inspect( EDA_ITEM* testItem, void* testData ) override; SEARCH_RESULT Inspect( EDA_ITEM* testItem, void* testData ) override;
@ -646,8 +641,6 @@ public:
*/ */
class PCB_LAYER_COLLECTOR : public PCB_COLLECTOR class PCB_LAYER_COLLECTOR : public PCB_COLLECTOR
{ {
PCB_LAYER_ID m_layer_id;
public: public:
PCB_LAYER_COLLECTOR( PCB_LAYER_ID aLayerId = UNDEFINED_LAYER ) : PCB_LAYER_COLLECTOR( PCB_LAYER_ID aLayerId = UNDEFINED_LAYER ) :
m_layer_id( aLayerId ) m_layer_id( aLayerId )
@ -667,12 +660,15 @@ public:
SEARCH_RESULT Inspect( EDA_ITEM* testItem, void* testData ) override; SEARCH_RESULT Inspect( EDA_ITEM* testItem, void* testData ) override;
/** /**
* Tests a BOARD_ITEM using this class's Inspector method, which does the collection. * Test a BOARD_ITEM using this class's Inspector method, which does the collection.
* *
* @param aBoard The BOARD_ITEM to scan. * @param aBoard The BOARD_ITEM to scan.
* @param aScanList The KICAD_Ts to gather up. * @param aScanList The KICAD_Ts to gather up.
*/ */
void Collect( BOARD_ITEM* aBoard, const KICAD_T aScanList[] ); void Collect( BOARD_ITEM* aBoard, const KICAD_T aScanList[] );
private:
PCB_LAYER_ID m_layer_id;
}; };
#endif // COLLECTORS_H #endif // COLLECTORS_H

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -141,7 +141,7 @@ public:
wxString GetValueText() const; wxString GetValueText() const;
/** /**
* Updates the dimension's cached text and geometry * Update the dimension's cached text and geometry.
*/ */
void Update() void Update()
{ {
@ -195,14 +195,16 @@ public:
} }
/** /**
* Sets the override text - has no effect if m_overrideValue == false * Set the override text - has no effect if m_overrideValue == false.
* @param aNewText is the text to use as the value *
* @param aNewText is the text to use as the value.
*/ */
void SetText( const wxString& aNewText ); void SetText( const wxString& aNewText );
/** /**
* Retrieves the value text or override text, not including prefix or suffix * Retrieve the value text or override text, not including prefix or suffix.
* @return the value portion of the dimension text (either overridden or not) *
* @return the value portion of the dimension text (either overridden or not).
*/ */
const wxString GetText() const; const wxString GetText() const;
@ -210,7 +212,7 @@ public:
const PCB_TEXT& Text() const { return m_text; } const PCB_TEXT& Text() const { return m_text; }
/** /**
* @return a list of line segments that make up this dimension (for drawing, plotting, etc) * @return a list of line segments that make up this dimension (for drawing, plotting, etc).
*/ */
const std::vector<std::shared_ptr<SHAPE>>& GetShapes() const { return m_shapes; } const std::vector<std::shared_ptr<SHAPE>>& GetShapes() const { return m_shapes; }
@ -221,10 +223,12 @@ public:
void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override; void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
/** /**
* Mirror the Dimension , relative to a given horizontal axis * Mirror the dimension relative to a given horizontal axis.
* the text is not mirrored. only its position (and angle) is mirrored *
* the layer is not changed * The text is not mirrored. Only its position (and angle) is mirrored. The layer is not
* @param axis_pos : vertical axis position * changed.
*
* @param axis_pos is the vertical axis position to mirror around.
*/ */
void Mirror( const wxPoint& axis_pos, bool aMirrorLeftRight = false ); void Mirror( const wxPoint& axis_pos, bool aMirrorLeftRight = false );
@ -252,12 +256,12 @@ public:
protected: protected:
/** /**
* Updates the cached geometry of the dimension after changing any of its properties * Update the cached geometry of the dimension after changing any of its properties.
*/ */
virtual void updateGeometry() = 0; virtual void updateGeometry() = 0;
/** /**
* Updates the text field value from the current geometry (called by updateGeometry normally) * Update the text field value from the current geometry (called by updateGeometry normally).
*/ */
virtual void updateText(); virtual void updateText();
@ -265,13 +269,15 @@ protected:
void addShape( const ShapeType& aShape ); void addShape( const ShapeType& aShape );
/** /**
* Finds the intersection between a given segment and polygon outline * Find the intersection between a given segment and polygon outline.
* @param aPoly is the polygon to collide *
* @param aSeg is the segment to collide * @param aPoly is the polygon to collide.
* @param aStart if true will start from aSeg.A, otherwise aSeg.B * @param aSeg is the segment to collide.
* @return a point on aSeg that collides with aPoly closest to the start, if one exists * @param aStart if true will start from aSeg.A, otherwise aSeg.B.
* @return a point on aSeg that collides with aPoly closest to the start, if one exists.
*/ */
static OPT_VECTOR2I segPolyIntersection( const SHAPE_POLY_SET& aPoly, const SEG& aSeg, bool aStart = true ); static OPT_VECTOR2I segPolyIntersection( const SHAPE_POLY_SET& aPoly, const SEG& aSeg,
bool aStart = true );
static OPT_VECTOR2I segCircleIntersection( CIRCLE& aCircle, SEG& aSeg, bool aStart = true ); static OPT_VECTOR2I segCircleIntersection( CIRCLE& aCircle, SEG& aSeg, bool aStart = true );
// Value format // Value format
@ -304,6 +310,7 @@ protected:
static constexpr float s_arrowAngle = 27.5; static constexpr float s_arrowAngle = 27.5;
}; };
/** /**
* For better understanding of the points that make a dimension: * For better understanding of the points that make a dimension:
* *
@ -333,14 +340,6 @@ protected:
*/ */
class ALIGNED_DIMENSION : public DIMENSION_BASE class ALIGNED_DIMENSION : public DIMENSION_BASE
{ {
protected:
// Geometry
int m_height; ///< Perpendicular distance from features to crossbar
int m_extensionHeight; ///< Length of extension lines past the crossbar
wxPoint m_crossBarStart; ///< Crossbar start control point
wxPoint m_crossBarEnd; ///< Crossbar end control point
public: public:
ALIGNED_DIMENSION( BOARD_ITEM* aParent, KICAD_T aType = PCB_DIM_ALIGNED_T ); ALIGNED_DIMENSION( BOARD_ITEM* aParent, KICAD_T aType = PCB_DIM_ALIGNED_T );
@ -365,15 +364,17 @@ public:
const wxPoint& GetCrossbarEnd() const { return m_crossBarEnd; } const wxPoint& GetCrossbarEnd() const { return m_crossBarEnd; }
/** /**
* Sets the distance from the feature points to the crossbar line * Set the distance from the feature points to the crossbar line.
*
* @param aHeight is the new height. * @param aHeight is the new height.
*/ */
void SetHeight( int aHeight ) { m_height = aHeight; } void SetHeight( int aHeight ) { m_height = aHeight; }
int GetHeight() const { return m_height; } int GetHeight() const { return m_height; }
/** /**
* Updates stored height basing on points coordinates. * Update the stored height basing on points coordinates.
* @param aCrossbarStart is the start point of the crossbar *
* @param aCrossbarStart is the start point of the crossbar.
*/ */
void UpdateHeight( const wxPoint& aCrossbarStart, const wxPoint& aCrossbarEnd ); void UpdateHeight( const wxPoint& aCrossbarStart, const wxPoint& aCrossbarEnd );
@ -381,8 +382,8 @@ public:
int GetExtensionHeight() const { return m_extensionHeight; } int GetExtensionHeight() const { return m_extensionHeight; }
/** /**
* Function GetAngle * Return the angle of the crossbar.
* Returns angle of the crossbar. *
* @return Angle of the crossbar line expressed in radians. * @return Angle of the crossbar line expressed in radians.
*/ */
double GetAngle() const double GetAngle() const
@ -400,10 +401,17 @@ public:
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override; void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
protected: protected:
void updateGeometry() override; void updateGeometry() override;
void updateText() override; void updateText() override;
// Geometry
int m_height; ///< Perpendicular distance from features to crossbar
int m_extensionHeight; ///< Length of extension lines past the crossbar
wxPoint m_crossBarStart; ///< Crossbar start control point
wxPoint m_crossBarEnd; ///< Crossbar end control point
}; };
@ -420,11 +428,6 @@ public:
VERTICAL // Aligned with y-axis VERTICAL // Aligned with y-axis
}; };
private:
// Geometry
DIR m_orientation; ///< What axis to lock the dimension line to
public:
ORTHOGONAL_DIMENSION( BOARD_ITEM* aParent ); ORTHOGONAL_DIMENSION( BOARD_ITEM* aParent );
~ORTHOGONAL_DIMENSION() = default; ~ORTHOGONAL_DIMENSION() = default;
@ -441,8 +444,9 @@ public:
BITMAPS GetMenuImage() const override; BITMAPS GetMenuImage() const override;
/** /**
* Sets the orientation of the dimension line (so, perpendicular to the feature lines) * Set the orientation of the dimension line (so, perpendicular to the feature lines).
* @param aOrientation is the orientation the dimension should take *
* @param aOrientation is the orientation the dimension should take.
*/ */
void SetOrientation( DIR aOrientation ) { m_orientation = aOrientation; } void SetOrientation( DIR aOrientation ) { m_orientation = aOrientation; }
DIR GetOrientation() const { return m_orientation; } DIR GetOrientation() const { return m_orientation; }
@ -454,10 +458,14 @@ public:
void Rotate( const wxPoint& aRotCentre, double aAngle ) override; void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
protected: protected:
void updateGeometry() override; void updateGeometry() override;
void updateText() override; void updateText() override;
private:
// Geometry
DIR m_orientation; ///< What axis to lock the dimension line to.
}; };
@ -477,8 +485,6 @@ protected:
*/ */
class LEADER : public DIMENSION_BASE class LEADER : public DIMENSION_BASE
{ {
DIM_TEXT_FRAME m_textFrame;
public: public:
LEADER( BOARD_ITEM* aParent ); LEADER( BOARD_ITEM* aParent );
@ -504,19 +510,21 @@ public:
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override; void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
protected: protected:
void updateGeometry() override; void updateGeometry() override;
private:
DIM_TEXT_FRAME m_textFrame;
}; };
/** /**
* Marks the center of a circle or arc with a cross shape * Mark the center of a circle or arc with a cross shape.
*
* The size and orientation of the cross is adjustable. * The size and orientation of the cross is adjustable.
* m_start always marks the center being measured; m_end marks the end of one leg of the cross. * m_start always marks the center being measured; m_end marks the end of one leg of the cross.
*/ */
class CENTER_DIMENSION : public DIMENSION_BASE class CENTER_DIMENSION : public DIMENSION_BASE
{ {
public: public:
CENTER_DIMENSION( BOARD_ITEM* aParent ); CENTER_DIMENSION( BOARD_ITEM* aParent );
@ -541,7 +549,6 @@ public:
const BOX2I ViewBBox() const override; const BOX2I ViewBBox() const override;
protected: protected:
void updateGeometry() override; void updateGeometry() override;
}; };

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
@ -83,36 +83,6 @@ protected:
class FOOTPRINT_LIST_IMPL : public FOOTPRINT_LIST class FOOTPRINT_LIST_IMPL : public FOOTPRINT_LIST
{ {
FOOTPRINT_ASYNC_LOADER* m_loader;
std::vector<std::thread> m_threads;
SYNC_QUEUE<wxString> m_queue_in;
SYNC_QUEUE<wxString> m_queue_out;
std::atomic_size_t m_count_finished;
long long m_list_timestamp;
PROGRESS_REPORTER* m_progress_reporter;
std::atomic_bool m_cancelled;
std::mutex m_join;
/**
* Call aFunc, pushing any IO_ERRORs and std::exceptions it throws onto m_errors.
*
* @return true if no error occurred.
*/
bool CatchErrors( const std::function<void()>& aFunc );
protected:
void startWorkers( FP_LIB_TABLE* aTable, wxString const* aNickname,
FOOTPRINT_ASYNC_LOADER* aLoader, unsigned aNThreads ) override;
bool joinWorkers() override;
void stopWorkers() override;
/**
* Function loader_job
* loads footprints from m_queue_in.
*/
void loader_job();
public: public:
FOOTPRINT_LIST_IMPL(); FOOTPRINT_LIST_IMPL();
virtual ~FOOTPRINT_LIST_IMPL(); virtual ~FOOTPRINT_LIST_IMPL();
@ -122,6 +92,36 @@ public:
bool ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxString* aNickname = nullptr, bool ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxString* aNickname = nullptr,
PROGRESS_REPORTER* aProgressReporter = nullptr ) override; PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
protected:
void startWorkers( FP_LIB_TABLE* aTable, wxString const* aNickname,
FOOTPRINT_ASYNC_LOADER* aLoader, unsigned aNThreads ) override;
bool joinWorkers() override;
void stopWorkers() override;
/**
* Load footprints from m_queue_in.
*/
void loader_job();
private:
/**
* Call aFunc, pushing any IO_ERRORs and std::exceptions it throws onto m_errors.
*
* @return true if no error occurred.
*/
bool CatchErrors( const std::function<void()>& aFunc );
FOOTPRINT_ASYNC_LOADER* m_loader;
std::vector<std::thread> m_threads;
SYNC_QUEUE<wxString> m_queue_in;
SYNC_QUEUE<wxString> m_queue_out;
std::atomic_size_t m_count_finished;
long long m_list_timestamp;
PROGRESS_REPORTER* m_progress_reporter;
std::atomic_bool m_cancelled;
std::mutex m_join;
}; };
extern FOOTPRINT_LIST_IMPL GFootprintList; // KIFACE scope. extern FOOTPRINT_LIST_IMPL GFootprintList; // KIFACE scope.

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013 NBEE Embedded Systems SL, Miguel Angel Ajo <miguelangel@ajo.es> * Copyright (C) 2013 NBEE Embedded Systems SL, Miguel Angel Ajo <miguelangel@ajo.es>
* Copyright (C) 2013-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2013-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -46,8 +46,7 @@ const wxString WIZARD_PARAM_UNITS_PERCENT = "%"; // Percent (0% -> 1
const wxString WIZARD_PARAM_UNITS_STRING = "string"; // String const wxString WIZARD_PARAM_UNITS_STRING = "string"; // String
/** /**
* FOOTPRINT_WIZARD * The parent class from where any footprint wizard class must derive.
* This is the parent class from where any footprint wizard class must derive
*/ */
class FOOTPRINT_WIZARD class FOOTPRINT_WIZARD
{ {
@ -56,113 +55,98 @@ public:
virtual ~FOOTPRINT_WIZARD(); virtual ~FOOTPRINT_WIZARD();
/** /**
* Function GetName * @return the name of the wizard.
* @return the name of the wizard
*/ */
virtual wxString GetName() = 0; virtual wxString GetName() = 0;
/** /**
* Function GetImage * @return an svg image of the wizard to be rendered.
* @return an svg image of the wizard to be rendered
*/ */
virtual wxString GetImage() = 0; virtual wxString GetImage() = 0;
/** /**
* Function GetDescription * @return a description of the footprint wizard.
* @return a description of the footprint wizard
*/ */
virtual wxString GetDescription() = 0; virtual wxString GetDescription() = 0;
/** /**
* Function GetNumParameterPages * @return the number of parameter pages that this wizard will show to the user.
* @return the number of parameter pages that this wizard will show to the user
*/ */
virtual int GetNumParameterPages() = 0; virtual int GetNumParameterPages() = 0;
/** /**
* Function GetParameterPageName * @param aPage is the page we want the name of.
* @param aPage is the page we want the name of * @return a string with the page name.
* @return a string with the page name
*/ */
virtual wxString GetParameterPageName( int aPage ) = 0; virtual wxString GetParameterPageName( int aPage ) = 0;
/** /**
* Function GetParameterNames * @param aPage is the page we want the parameter names of.
* @param aPage is the page we want the parameter names of * @return an array string with the parameter names on a certain page.
* @return an array string with the parameter names on a certain page
*/ */
virtual wxArrayString GetParameterNames( int aPage ) = 0; virtual wxArrayString GetParameterNames( int aPage ) = 0;
/** /**
* Function GetParameterTypes * @param aPage is the page we want the parameter types of.
* @param aPage is the page we want the parameter types of
* @return an array string with the parameter types on a certain page * @return an array string with the parameter types on a certain page
* "IU" for internal units, "UNITS" for units (0,1,2,3...,N) * "IU" for internal units, "UNITS" for units (0,1,2,3...,N).
*/ */
virtual wxArrayString GetParameterTypes( int aPage ) = 0; virtual wxArrayString GetParameterTypes( int aPage ) = 0;
/** /**
* Function GetParameterValues * @param aPage is the page we want the parameter values of.
* @param aPage is the page we want the parameter values of * @return an array of parameter values.
* @return an array of parameter values
*/ */
virtual wxArrayString GetParameterValues( int aPage ) = 0; virtual wxArrayString GetParameterValues( int aPage ) = 0;
/** /**
* Function GetParameterErrors * @param aPage is the page we want to know the errors of.
* @param aPage is the page we want to know the errors of * @return an array of errors (if any) for the parameters, empty strings for OK parameters.
* @return an array of errors (if any) for the parameters, empty strings for OK parameters
*/ */
virtual wxArrayString GetParameterErrors( int aPage ) = 0; virtual wxArrayString GetParameterErrors( int aPage ) = 0;
/** /**
* Function GetParameterHints * @param aPage is the page we want to know the hints of.
* @param aPage is the page we want to know the hints of * @return an array of hints (if any) for the parameters, empty string for no hints.
* @return an array of hints (if any) for the parameters, empty string for no hints
*/ */
virtual wxArrayString GetParameterHints( int aPage ) = 0; virtual wxArrayString GetParameterHints( int aPage ) = 0;
/** /**
* Function GetParamaterDesignators * @param aPage is the page we want to know the designators of.
* @param aPage is the page we want to know the designators of * @return an array of designators (blank strings for no designators.
* @return an array of designators (blank strings for no designators
*/ */
virtual wxArrayString GetParameterDesignators( int aPage ) = 0; virtual wxArrayString GetParameterDesignators( int aPage ) = 0;
/** /**
* Function SetParameterValues * @param aPage is the page we want to set the parameters in.
* @param aPage is the page we want to set the parameters in * @param aValues are the values we want to set into the parameters.
* @param aValues are the values we want to set into the parameters * @return an array of parameter values.
* @return an array of parameter values
*/ */
virtual wxString SetParameterValues( int aPage, wxArrayString& aValues ) = 0; virtual wxString SetParameterValues( int aPage, wxArrayString& aValues ) = 0;
/** /**
* Function ResetParameters * Reset all wizard parameters to default values.
* Reset all wizard parameters to default values
*/ */
virtual void ResetParameters() = 0; virtual void ResetParameters() = 0;
/** /**
* Function GetFootprint * Build the footprint itself and returns it to the caller function.
* This method builds the footprint itself and returns it to the caller function *
* @return PCB footprint built from the parameters given to the class * @param aMessage is storage for messages (if any) generated by the footprint generator.
* @param aMessage a wxString to store messages (if any) generated by the * @return a footprint built from the parameters given to the class.
* footprint generator
*/ */
virtual FOOTPRINT* GetFootprint( wxString* aMessage ) = 0; virtual FOOTPRINT* GetFootprint( wxString* aMessage ) = 0;
/** /**
* Function GetObject * Get the object from where this wizard constructs.
* This method gets the pointer to the object from where this wizard constructs *
* @return it's a void pointer, as it could be a PyObject or any other * @return it's a void pointer as it could be a PyObject or any other.
*/ */
virtual void* GetObject() = 0; virtual void* GetObject() = 0;
/** /**
* Function register_wizard * The standard method of a "FOOTPRINT_WIZARD" to register itself into
* It's the standard method of a "FOOTPRINT_WIZARD" to register itself into
* the FOOTPRINT_WIZARD_LIST singleton manager * the FOOTPRINT_WIZARD_LIST singleton manager
*/ */
void register_wizard(); void register_wizard();
@ -171,54 +155,50 @@ public:
class FOOTPRINT_WIZARD_LIST class FOOTPRINT_WIZARD_LIST
{ {
private:
/**
* FOOTPRINT_WIZARD system wide static list
*/
static std::vector<FOOTPRINT_WIZARD*> m_FootprintWizards;
public: public:
/** /**
* Function register_wizard
* A footprint wizard calls this static method when it wants to register itself * A footprint wizard calls this static method when it wants to register itself
* into the system wizards * into the system wizards.
* Note: if it is already registered, this function do nothing *
* if n existing wizard with the same name exists, this existing wizard will be * @note If it is already registered, this function does nothing if an existing wizard
* unregistered. * with the same name exists, this existing wizard will be unregistered.
* @param aWizard is the footprint wizard to be registered *
* @param aWizard is the footprint wizard to be registered.
*/ */
static void register_wizard( FOOTPRINT_WIZARD* aWizard ); static void register_wizard( FOOTPRINT_WIZARD* aWizard );
/** /**
* Function deregister_object * Unregister an object which builds a wizard.
* Anyone calls this method to deregister an object which builds a wizard,
* it will lookup on the vector calling GetObject until find, then removed
* and deleted
* *
* @param aObject is the footprint wizard object to be deregistered * Lookup in the vector calling GetObject until find, then removed and deleted.
*
* @param aObject is the footprint wizard object to be unregistered.
*/ */
static bool deregister_object( void* aObject ); static bool deregister_object( void* aObject );
/** /**
* Function GetWizard * @param aName is the footprint wizard name.
* @param aName is the footprint wizard name
* @return a wizard object by it's name or NULL if it isn't available. * @return a wizard object by it's name or NULL if it isn't available.
*/ */
static FOOTPRINT_WIZARD* GetWizard( const wxString& aName ); static FOOTPRINT_WIZARD* GetWizard( const wxString& aName );
/** /**
* Function GetWizard * @param aIndex is the wizard index in list.
* @return a wizard object by it's number or NULL if it isn't available. * @return a wizard object by it's number or NULL if it isn't available.
* @param aIndex is the wizard index in list
*/ */
static FOOTPRINT_WIZARD* GetWizard( int aIndex ); static FOOTPRINT_WIZARD* GetWizard( int aIndex );
/** /**
* Function GetWizardsCount
* @return the number of wizards available into the system * @return the number of wizards available into the system
*/ */
static int GetWizardsCount(); static int GetWizardsCount();
private:
/**
* FOOTPRINT_WIZARD system wide static list
*/
static std::vector<FOOTPRINT_WIZARD*> m_FootprintWizards;
}; };
#endif /* PCBNEW_FOOTPRINT_WIZARDS_H */ #endif /* PCBNEW_FOOTPRINT_WIZARDS_H */

View File

@ -49,31 +49,9 @@ enum WizardParameterColumnNames
WIZ_COL_UNITS WIZ_COL_UNITS
}; };
/**
* FOOTPRINT_WIZARD_FRAME
*/
class FOOTPRINT_WIZARD_FRAME : public PCB_BASE_EDIT_FRAME class FOOTPRINT_WIZARD_FRAME : public PCB_BASE_EDIT_FRAME
{ {
private:
wxPanel* m_parametersPanel; ///< Panel for the page list and parameter grid
wxListBox* m_pageList; ///< The list of pages
WX_GRID* m_parameterGrid; ///< The list of parameters
int m_parameterGridPage; ///< the page currently displayed by m_parameterGrid
///< it is most of time the m_pageList selection, but
///< can differ during transitions between pages.
wxTextCtrl* m_buildMessageBox;
wxString m_auiPerspective; ///< Encoded string describing the AUI layout
bool m_wizardListShown; ///< A show-once flag for the wizard list
protected:
wxString m_wizardName; ///< name of the current wizard
wxString m_wizardDescription; ///< description of the wizard
wxString m_wizardStatus; ///< current wizard status
public: public:
FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* parent, FRAME_T aFrameType ); FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* parent, FRAME_T aFrameType );
~FOOTPRINT_WIZARD_FRAME(); ~FOOTPRINT_WIZARD_FRAME();
@ -205,6 +183,24 @@ private:
void OnEditItemRequest( BOARD_ITEM* aItem ) override {} void OnEditItemRequest( BOARD_ITEM* aItem ) override {}
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
protected:
wxString m_wizardName; ///< name of the current wizard
wxString m_wizardDescription; ///< description of the wizard
wxString m_wizardStatus; ///< current wizard status
private:
wxPanel* m_parametersPanel; ///< Panel for the page list and parameter grid
wxListBox* m_pageList; ///< The list of pages
WX_GRID* m_parameterGrid; ///< The list of parameters
int m_parameterGridPage; ///< the page currently displayed by m_parameterGrid
///< it is most of time the m_pageList selection, but
///< can differ during transitions between pages.
wxTextCtrl* m_buildMessageBox;
wxString m_auiPerspective; ///< Encoded string describing the AUI layout
bool m_wizardListShown; ///< A show-once flag for the wizard list
}; };

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2012-2015 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2012-2015 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -34,27 +34,18 @@ class PCB_BASE_FRAME;
*/ */
class PCB_LAYER_BOX_SELECTOR : public LAYER_BOX_SELECTOR class PCB_LAYER_BOX_SELECTOR : public LAYER_BOX_SELECTOR
{ {
PCB_BASE_FRAME* m_boardFrame;
LSET m_layerMaskDisable; // A mask to remove some (not allowed) layers
// from layer list
bool m_showNotEnabledBrdlayers; // true to list all allowed layers
// (with not activated layers flagged)
wxString m_undefinedLayerName; // if not empty add an item with this name which sets
// the layer to UNDEFINED_LAYER
public: public:
// If you are thinking the constructor is a bit curious, just remember it is automatically // If you are thinking the constructor is a bit curious, just remember it is automatically
// generated when used in wxFormBuilder files, and so must have the same signature as the // generated when used in wxFormBuilder files, and so must have the same signature as the
// wxBitmapComboBox constructor. In particular, value and style are not used by this class. // wxBitmapComboBox constructor. In particular, value and style are not used by this class.
PCB_LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id, PCB_LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL, int style = 0 ) : int n = 0, const wxString choices[] = nullptr, int style = 0 ) :
LAYER_BOX_SELECTOR( parent, id, pos, size, n, choices ) LAYER_BOX_SELECTOR( parent, id, pos, size, n, choices )
{ {
m_boardFrame = NULL; m_boardFrame = nullptr;
m_showNotEnabledBrdlayers = false; m_showNotEnabledBrdlayers = false;
} }
@ -63,7 +54,7 @@ public:
// use with wxFormBuilder. // use with wxFormBuilder.
void SetBoardFrame( PCB_BASE_FRAME* aFrame ) { m_boardFrame = aFrame; }; void SetBoardFrame( PCB_BASE_FRAME* aFrame ) { m_boardFrame = aFrame; };
// SetLayerSet allows disableing some layers, which are not shown in list // SetLayerSet allows disabling some layers, which are not shown in list
void SetNotAllowedLayerSet( LSET aMask ) { m_layerMaskDisable = aMask; } void SetNotAllowedLayerSet( LSET aMask ) { m_layerMaskDisable = aMask; }
// If the UNDEFINED_LAYER should be selectable, give it a name here. Usually either // If the UNDEFINED_LAYER should be selectable, give it a name here. Usually either
@ -74,7 +65,7 @@ public:
void Resync() override; void Resync() override;
// Allow (or not) the layers not activated for the current board to be shown in layer // Allow (or not) the layers not activated for the current board to be shown in layer
// selector. Not actavated layers have their names appended with "(not activated)". // selector. Not activated layers have their names appended with "(not activated)".
void ShowNonActivatedLayers( bool aShow ) { m_showNotEnabledBrdlayers = aShow; } void ShowNonActivatedLayers( bool aShow ) { m_showNotEnabledBrdlayers = aShow; }
private: private:
@ -88,6 +79,15 @@ private:
wxString getLayerName( LAYER_NUM aLayer ) const override; wxString getLayerName( LAYER_NUM aLayer ) const override;
LSET getEnabledLayers() const; LSET getEnabledLayers() const;
PCB_BASE_FRAME* m_boardFrame;
LSET m_layerMaskDisable; // A mask to remove some (not allowed) layers
// from layer list
bool m_showNotEnabledBrdlayers; // true to list all allowed layers
// (with not activated layers flagged)
wxString m_undefinedLayerName; // if not empty add an item with this name which sets
// the layer to UNDEFINED_LAYER
}; };
#endif // PCB_LAYER_BOX_SELECTOR_H #endif // PCB_LAYER_BOX_SELECTOR_H

View File

@ -31,12 +31,10 @@ class COLOR_SETTINGS;
class PCB_PLOT_PARAMS_PARSER; class PCB_PLOT_PARAMS_PARSER;
/** /**
* PCB_PLOT_PARAMS * Parameters and options when plotting/printing a board.
* handles plot parameters and options when plotting/printing a board.
*/ */
class PCB_PLOT_PARAMS class PCB_PLOT_PARAMS
{ {
friend class PCB_PLOT_PARAMS_PARSER;
public: public:
enum DrillMarksType { enum DrillMarksType {
NO_DRILL_SHAPE = 0, NO_DRILL_SHAPE = 0,
@ -44,149 +42,6 @@ public:
FULL_DRILL_SHAPE = 2 FULL_DRILL_SHAPE = 2
}; };
private:
// If true, do not plot NPTH pads
// (mainly used to disable NPTH pads plotting on copper layers)
bool m_skipNPTH_Pads;
/** FILLED or SKETCH selects how to plot filled objects.
* FILLED or SKETCH not available with all drivers: some have fixed mode
*/
OUTLINE_MODE m_plotMode;
/** DXF format: Plot items in outline (polygon) mode
* In polygon mode, each item to plot is converted to a polygon, and all
* polygons are merged.
*/
bool m_DXFplotPolygonMode;
/**
* DXF format: Units to use when plotting the DXF
*/
DXF_UNITS m_DXFplotUnits;
/// Plot format type (chooses the driver to be used)
PLOT_FORMAT m_format;
/// Holes can be not plotted, have a small mark or plotted in actual size
DrillMarksType m_drillMarks;
/// Choose how represent text with PS, PDF and DXF drivers
PLOT_TEXT_MODE m_textMode;
/// When true set the scale to fit the board in the page
bool m_autoScale;
/// Global scale factor, 1.0 plots a board with its actual size.
double m_scale;
/// Mirror the plot around the X axis
bool m_mirror;
/// Plot in negative color (supported only by some drivers)
bool m_negative;
/// True if vias are drawn on Mask layer (ie untented, *exposed* by mask)
bool m_plotViaOnMaskLayer;
/// True to plot/print frame references
bool m_plotFrameRef;
/// If false always plot (merge) the pcb edge layer on other layers
bool m_excludeEdgeLayer;
/// Set of layers to plot
LSET m_layerSelection;
/** When plotting gerber files, use a conventional set of Protel extensions
* instead of .gbr, that is now the offical gerber file extension
* this is a deprecated feature
*/
bool m_useGerberProtelExtensions;
/// Include attributes from the Gerber X2 format (chapter 5 in revision J2)
bool m_useGerberX2format;
/// Disable aperure macros in Gerber format (only for broken Gerber readers)
/// Ideally, should be never selected.
bool m_gerberDisableApertMacros;
/// Include netlist info (only in Gerber X2 format) (chapter ? in revision ?)
bool m_includeGerberNetlistInfo;
/// generate the auxiliary "job file" in gerber format
bool m_createGerberJobFile;
/// precision of coordinates in Gerber files: accepted 5 or 6
/// when units are in mm (6 or 7 in inches, but Pcbnew uses mm).
/// 6 is the internal resolution of Pcbnew, but not alwys accepted by board maker
/// 5 is the minimal value for professional boards.
int m_gerberPrecision;
/// precision of coordinates in SVG files: accepted 3 - 6
/// 6 is the internal resolution of Pcbnew
unsigned m_svgPrecision;
/// units for SVG plot
/// false for metric, true for inch/mils
bool m_svgUseInch;
/// Plot gerbers using auxiliary (drill) origin instead of absolue coordinates
bool m_useAuxOrigin;
/// On gerbers 'scrape' away the solder mask from silkscreen (trim silks)
bool m_subtractMaskFromSilk;
/// Autoscale the plot to fit an A4 (landscape?) sheet
bool m_A4Output;
/// Scale ratio index (UI only)
int m_scaleSelection;
/// Output directory for plot files (usually relative to the board file)
wxString m_outputDirectory;
/// Enable plotting of part references
bool m_plotReference;
/// Enable plotting of part values
bool m_plotValue;
/// Force plotting of fields marked invisible
bool m_plotInvisibleText;
/// Plots pads outlines on fab layers
bool m_sketchPadsOnFabLayers;
int m_sketchPadLineWidth;
/* These next two scale factors are intended to compensate plotters
* (mainly printers) X and Y scale error. Therefore they are expected very
* near 1.0; only X and Y dimensions are adjusted: circles are plotted as
* circles, even if X and Y fine scale differ; because of this it is mostly
* useful for printers: postscript plots would be best adjusted using
* the prologue (that would change the whole output matrix
*/
double m_fineScaleAdjustX; ///< fine scale adjust X axis
double m_fineScaleAdjustY; ///< fine scale adjust Y axis
/** This width factor is intended to compensate PS printers/ plotters that do
* not strictly obey line width settings. Only used to plot pads and tracks
*/
int m_widthAdjust;
int m_HPGLPenNum; ///< HPGL only: pen number selection(1 to 9)
int m_HPGLPenSpeed; ///< HPGL only: pen speed, always in cm/s (1 to 99 cm/s)
double m_HPGLPenDiam; ///< HPGL only: pen diameter in MILS, useful to fill areas
///< However, it is in mm in hpgl files.
/// Pointer to active color settings to be used for plotting
COLOR_SETTINGS* m_colors;
/// Dummy colors object that can be created if there is no Pgm context
std::shared_ptr<COLOR_SETTINGS> m_default_colors;
public:
PCB_PLOT_PARAMS(); PCB_PLOT_PARAMS();
void SetSkipPlotNPTH_Pads( bool aSkip ) { m_skipNPTH_Pads = aSkip; } void SetSkipPlotNPTH_Pads( bool aSkip ) { m_skipNPTH_Pads = aSkip; }
@ -196,11 +51,12 @@ public:
void Parse( PCB_PLOT_PARAMS_PARSER* aParser ); void Parse( PCB_PLOT_PARAMS_PARSER* aParser );
/** /**
* Compare current settings to aPcbPlotParams, including not saved parameters in brd file * Compare current settings to aPcbPlotParams, including not saved parameters in brd file.
* @param aPcbPlotParams = the PCB_PLOT_PARAMS to compare *
* @param aCompareOnlySavedPrms = true to compare only saved in file parameters, * @param aPcbPlotParams is the #PCB_PLOT_PARAMS to compare/
* and false to compare the full set of parameters. * @param aCompareOnlySavedPrms set to true to compare only saved in file parameters,
* @return true is parameters are same, false if one (or more) parameter does not match * or false to compare the full set of parameters.
* @return true is parameters are same, false if one (or more) parameter does not match.
*/ */
bool IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams ) const; bool IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams ) const;
@ -305,9 +161,11 @@ public:
unsigned GetSvgPrecision() const { return m_svgPrecision; } unsigned GetSvgPrecision() const { return m_svgPrecision; }
bool GetSvgUseInch() const { return m_svgUseInch; } bool GetSvgUseInch() const { return m_svgUseInch; }
/** Default precision of coordinates in Gerber files. /**
* when units are in mm (7 in inches, but Pcbnew uses mm). * Default precision of coordinates in Gerber files.
* 6 is the internal resolution of Pcbnew, so the default is 6 *
* When units are in mm (7 in inches, but Pcbnew uses mm).
* 6 is the internal resolution of Pcbnew, so the default is 6.
*/ */
static int GetGerberDefaultPrecision() { return 6; } static int GetGerberDefaultPrecision() { return 6; }
@ -337,6 +195,154 @@ public:
void SetHPGLPenNum( int aVal ) { m_HPGLPenNum = aVal; } void SetHPGLPenNum( int aVal ) { m_HPGLPenNum = aVal; }
int GetHPGLPenNum() const { return m_HPGLPenNum; } int GetHPGLPenNum() const { return m_HPGLPenNum; }
private:
friend class PCB_PLOT_PARAMS_PARSER;
// If true, do not plot NPTH pads
// (mainly used to disable NPTH pads plotting on copper layers)
bool m_skipNPTH_Pads;
/**
* FILLED or SKETCH selects how to plot filled objects.
*
* FILLED or SKETCH not available with all drivers: some have fixed mode
*/
OUTLINE_MODE m_plotMode;
/**
* DXF format: Plot items in outline (polygon) mode.
*
* In polygon mode, each item to plot is converted to a polygon and all polygons are merged.
*/
bool m_DXFplotPolygonMode;
/**
* DXF format: Units to use when plotting the DXF
*/
DXF_UNITS m_DXFplotUnits;
/// Plot format type (chooses the driver to be used)
PLOT_FORMAT m_format;
/// Holes can be not plotted, have a small mark or plotted in actual size
DrillMarksType m_drillMarks;
/// Choose how represent text with PS, PDF and DXF drivers
PLOT_TEXT_MODE m_textMode;
/// When true set the scale to fit the board in the page
bool m_autoScale;
/// Global scale factor, 1.0 plots a board with its actual size.
double m_scale;
/// Mirror the plot around the X axis
bool m_mirror;
/// Plot in negative color (supported only by some drivers)
bool m_negative;
/// True if vias are drawn on Mask layer (ie untented, *exposed* by mask)
bool m_plotViaOnMaskLayer;
/// True to plot/print frame references
bool m_plotFrameRef;
/// If false always plot (merge) the pcb edge layer on other layers
bool m_excludeEdgeLayer;
/// Set of layers to plot
LSET m_layerSelection;
/** When plotting gerber files, use a conventional set of Protel extensions
* instead of .gbr, that is now the official gerber file extension
* this is a deprecated feature
*/
bool m_useGerberProtelExtensions;
/// Include attributes from the Gerber X2 format (chapter 5 in revision J2)
bool m_useGerberX2format;
/// Disable aperture macros in Gerber format (only for broken Gerber readers)
/// Ideally, should be never selected.
bool m_gerberDisableApertMacros;
/// Include netlist info (only in Gerber X2 format) (chapter ? in revision ?)
bool m_includeGerberNetlistInfo;
/// generate the auxiliary "job file" in gerber format
bool m_createGerberJobFile;
/// precision of coordinates in Gerber files: accepted 5 or 6
/// when units are in mm (6 or 7 in inches, but Pcbnew uses mm).
/// 6 is the internal resolution of Pcbnew, but not always accepted by board maker
/// 5 is the minimal value for professional boards.
int m_gerberPrecision;
/// precision of coordinates in SVG files: accepted 3 - 6
/// 6 is the internal resolution of Pcbnew
unsigned m_svgPrecision;
/// units for SVG plot
/// false for metric, true for inch/mils
bool m_svgUseInch;
/// Plot gerbers using auxiliary (drill) origin instead of absolute coordinates
bool m_useAuxOrigin;
/// On gerbers 'scrape' away the solder mask from silkscreen (trim silks)
bool m_subtractMaskFromSilk;
/// Autoscale the plot to fit an A4 (landscape?) sheet
bool m_A4Output;
/// Scale ratio index (UI only)
int m_scaleSelection;
/// Output directory for plot files (usually relative to the board file)
wxString m_outputDirectory;
/// Enable plotting of part references
bool m_plotReference;
/// Enable plotting of part values
bool m_plotValue;
/// Force plotting of fields marked invisible
bool m_plotInvisibleText;
/// Plots pads outlines on fab layers
bool m_sketchPadsOnFabLayers;
int m_sketchPadLineWidth;
/* These next two scale factors are intended to compensate plotters
* (mainly printers) X and Y scale error. Therefore they are expected very
* near 1.0; only X and Y dimensions are adjusted: circles are plotted as
* circles, even if X and Y fine scale differ; because of this it is mostly
* useful for printers: postscript plots would be best adjusted using
* the prologue (that would change the whole output matrix
*/
double m_fineScaleAdjustX; ///< fine scale adjust X axis
double m_fineScaleAdjustY; ///< fine scale adjust Y axis
/**
* This width factor is intended to compensate PS printers/ plotters that do
* not strictly obey line width settings. Only used to plot pads and tracks.
*/
int m_widthAdjust;
int m_HPGLPenNum; ///< HPGL only: pen number selection(1 to 9)
int m_HPGLPenSpeed; ///< HPGL only: pen speed, always in cm/s (1 to 99 cm/s)
double m_HPGLPenDiam; ///< HPGL only: pen diameter in MILS, useful to fill areas
///< However, it is in mm in hpgl files.
/// Pointer to active color settings to be used for plotting
COLOR_SETTINGS* m_colors;
/// Dummy colors object that can be created if there is no Pgm context
std::shared_ptr<COLOR_SETTINGS> m_default_colors;
}; };

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2018 Jean-Pierre Charras jp.charras at wanadoo.fr * Copyright (C) 2018 Jean-Pierre Charras jp.charras at wanadoo.fr
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -41,26 +41,6 @@ class MSG_PANEL_ITEM;
class PCB_SHAPE : public BOARD_ITEM class PCB_SHAPE : public BOARD_ITEM
{ {
protected:
int m_width; // thickness of lines ...
bool m_filled; // Pretty much what it says on the tin...
wxPoint m_start; // Line start point or Circle and Arc center
wxPoint m_end; // Line end point or circle and arc start point
wxPoint m_thirdPoint; // Used only for Arcs: arc end point
PCB_SHAPE_TYPE m_shape; // Shape: line, Circle, Arc
double m_angle; // Used only for Arcs: Arc angle in 1/10 deg
wxPoint m_bezierC1; // Bezier Control Point 1
wxPoint m_bezierC2; // Bezier Control Point 2
std::vector<wxPoint> m_bezierPoints;
SHAPE_POLY_SET m_poly; // Stores the S_POLYGON shape
// Computes the bounding box for an arc
void computeArcBBox( EDA_RECT& aBBox ) const;
const std::vector<wxPoint> buildBezierToSegmentsPointsList( int aMinSegLen ) const;
public: public:
PCB_SHAPE( BOARD_ITEM* aParent = NULL, KICAD_T idtype = PCB_SHAPE_T ); PCB_SHAPE( BOARD_ITEM* aParent = NULL, KICAD_T idtype = PCB_SHAPE_T );
@ -117,10 +97,11 @@ public:
int GetWidth() const { return m_width; } int GetWidth() const { return m_width; }
/** /**
* Sets the angle for arcs, and normalizes it within the range 0 - 360 degrees. * Set the angle for arcs, and normalizes it within the range 0 - 360 degrees.
*
* @param aAngle is tenths of degrees, but will soon be degrees. * @param aAngle is tenths of degrees, but will soon be degrees.
* @param aUpdateEnd = true to update also arc end coordinates m_thirdPoint, * @param aUpdateEnd set to true to update also arc end coordinates m_thirdPoint,
* so must be called after setting m_Start and m_End * so must be called after setting m_Start and m_End.
*/ */
virtual void SetAngle( double aAngle, bool aUpdateEnd = true ); virtual void SetAngle( double aAngle, bool aUpdateEnd = true );
double GetAngle() const { return m_angle; } double GetAngle() const { return m_angle; }
@ -138,8 +119,7 @@ public:
wxPoint GetPosition() const override; wxPoint GetPosition() const override;
/** /**
* Function GetStart * Return the starting point of the graphic.
* returns the starting point of the graphic
*/ */
const wxPoint& GetStart() const { return m_start; } const wxPoint& GetStart() const { return m_start; }
int GetStartY() { return m_start.y; } int GetStartY() { return m_start.y; }
@ -149,8 +129,7 @@ public:
void SetStartX( int x ) { m_start.x = x; } void SetStartX( int x ) { m_start.x = x; }
/** /**
* Function GetEnd * Return the ending point of the graphic.
* returns the ending point of the graphic
*/ */
const wxPoint& GetEnd() const { return m_end; } const wxPoint& GetEnd() const { return m_end; }
int GetEndY() { return m_end.y; } int GetEndY() { return m_end.y; }
@ -181,27 +160,26 @@ public:
std::vector<wxPoint> GetRectCorners() const; std::vector<wxPoint> GetRectCorners() const;
/** /**
* function GetArcAngleStart() * @return the angle of the starting point of this arc, between 0 and 3600 in 0.1 deg.
* @return the angle of the starting point of this arc, between 0 and 3600 in 0.1 deg
*/ */
double GetArcAngleStart() const; double GetArcAngleStart() const;
/** /**
* function GetArcAngleEnd() * @return the angle of the ending point of this arc, between 0 and 3600 in 0.1 deg.
* @return the angle of the ending point of this arc, between 0 and 3600 in 0.1 deg
*/ */
double GetArcAngleEnd() const; double GetArcAngleEnd() const;
/** /**
* Function GetRadius * Return the radius of this item.
* returns the radius of this item *
* Has meaning only for arc and circle * Has meaning only for arcs and circles.
*/ */
int GetRadius() const; int GetRadius() const;
/** /**
* Initialize the start arc point. can be used for circles * Initialize the start arc point.
* to initialize one point of the cicumference *
* Can be used for circles to initialize one point of the cicumference.
*/ */
void SetArcStart( const wxPoint& aArcStartPoint ) void SetArcStart( const wxPoint& aArcStartPoint )
{ {
@ -209,16 +187,15 @@ public:
} }
/** /**
* Initialize the end arc point. can be used for circles * Initialize the end arc point.
* to initialize one point of the cicumference *
* Can be used for circles to initialize one point of the cicumference.
*/ */
void SetArcEnd( const wxPoint& aArcEndPoint ) void SetArcEnd( const wxPoint& aArcEndPoint )
{ {
m_thirdPoint = aArcEndPoint; m_thirdPoint = aArcEndPoint;
} }
/** For arcs and circles:
*/
void SetCenter( const wxPoint& aCenterPoint ) { m_start = aCenterPoint; } void SetCenter( const wxPoint& aCenterPoint ) { m_start = aCenterPoint; }
/** /**
@ -235,17 +212,18 @@ public:
} }
/** /**
* Function GetParentFootprint * Return the parent footprint or NULL if PCB_SHAPE does not belong to a footprint.
* returns a pointer to the parent footprint, or NULL if PCB_SHAPE does not *
* belong to a footprint. * @return the parent footprint or NULL.
* @return FOOTPRINT* - pointer to the parent footprint or NULL.
*/ */
FOOTPRINT* GetParentFootprint() const; FOOTPRINT* GetParentFootprint() const;
// Accessors: // Accessors:
const std::vector<wxPoint>& GetBezierPoints() const { return m_bezierPoints; } const std::vector<wxPoint>& GetBezierPoints() const { return m_bezierPoints; }
/** Build and return the list of corners in a std::vector<wxPoint> /**
* Build and return the list of corners in a std::vector<wxPoint>
*
* It must be used only to convert the SHAPE_POLY_SET internal corner buffer * It must be used only to convert the SHAPE_POLY_SET internal corner buffer
* to a list of wxPoints, and nothing else, because it duplicates the buffer, * to a list of wxPoints, and nothing else, because it duplicates the buffer,
* that is inefficient to know for instance the corner count * that is inefficient to know for instance the corner count
@ -273,20 +251,22 @@ public:
m_bezierPoints = aPoints; m_bezierPoints = aPoints;
} }
/** Rebuild the m_BezierPoints vertex list that approximate the Bezier curve /**
* by a list of segments * Rebuild the m_BezierPoints vertex list that approximate the Bezier curve
* Has meaning only for S_CURVE DRAW_SEGMENT shape * by a list of segments.
* @param aMinSegLen is the min length of segments approximating the shape. *
* the last segment can be shorter * Has meaning only for S_CURVE DRAW_SEGMENT shape.
* This param avoid having too many very short segment in list. *
* a good value is m_Width/2 to m_Width * @param aMinSegLen is the min length of segments approximating the he. shape last segment
* can be shorter. This parameter avoids having too many very short segment in list.
* A good value is m_Width/2 to m_Width.
*/ */
void RebuildBezierToSegmentsPointsList( int aMinSegLen ); void RebuildBezierToSegmentsPointsList( int aMinSegLen );
void SetPolyPoints( const std::vector<wxPoint>& aPoints ); void SetPolyPoints( const std::vector<wxPoint>& aPoints );
/** /**
* Makes a set of SHAPE objects representing the PCB_SHAPE. Caller owns the objects. * Make a set of SHAPE objects representing the PCB_SHAPE. Caller owns the objects.
*/ */
std::vector<SHAPE*> MakeEffectiveShapes() const; // fixme: move to shape_compound std::vector<SHAPE*> MakeEffectiveShapes() const; // fixme: move to shape_compound
std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) const override; std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) const override;
@ -304,11 +284,11 @@ public:
} }
/** /**
* Function GetLength * Return the length of the track using the hypotenuse calculation.
* returns the length of the track using the hypotenuse calculation. *
* @return double - the length of the track * @return the length of the track
*/ */
double GetLength() const; double GetLength() const;
virtual void Move( const wxPoint& aMoveVector ) override; virtual void Move( const wxPoint& aMoveVector ) override;
@ -319,15 +299,15 @@ public:
void Scale( double aScale ); void Scale( double aScale );
/** /**
* Function TransformShapeWithClearanceToPolygon * Convert the draw segment to a closed polygon.
* Convert the draw segment to a closed polygon *
* Used in filling zones calculations * Used in filling zones calculations. Circles and arcs are approximated by segments.
* Circles and arcs are approximated by segments *
* @param aCornerBuffer = a buffer to store the polygon * @param aCornerBuffer is a buffer to store the polygon.
* @param aClearanceValue = the clearance around the pad * @param aClearanceValue is the clearance around the pad.
* @param aError = the maximum deviation from a true arc * @param aError is the maximum deviation from a true arc.
* @param ignoreLineWidth = used for edge cut items where the line width is only * @param ignoreLineWidth is used for edge cut items where the line width is only
* for visualization * for visualization
*/ */
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearanceValue, PCB_LAYER_ID aLayer, int aClearanceValue,
@ -352,6 +332,26 @@ public:
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); } void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
#endif #endif
protected:
// Compute the bounding box for an arc
void computeArcBBox( EDA_RECT& aBBox ) const;
const std::vector<wxPoint> buildBezierToSegmentsPointsList( int aMinSegLen ) const;
int m_width; // thickness of lines ...
bool m_filled; // Pretty much what it says on the tin...
wxPoint m_start; // Line start point or Circle and Arc center
wxPoint m_end; // Line end point or circle and arc start point
wxPoint m_thirdPoint; // Used only for Arcs: arc end point
PCB_SHAPE_TYPE m_shape; // Shape: line, Circle, Arc
double m_angle; // Used only for Arcs: Arc angle in 1/10 deg
wxPoint m_bezierC1; // Bezier Control Point 1
wxPoint m_bezierC2; // Bezier Control Point 2
std::vector<wxPoint> m_bezierPoints;
SHAPE_POLY_SET m_poly; // Stores the S_POLYGON shape
}; };
#endif // PCB_SHAPE_H #endif // PCB_SHAPE_H

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -34,11 +34,6 @@ class LINE_READER;
class PCB_TARGET : public BOARD_ITEM class PCB_TARGET : public BOARD_ITEM
{ {
int m_shape; // bit 0 : 0 = draw +, 1 = draw X
int m_size;
int m_lineWidth;
wxPoint m_pos;
public: public:
PCB_TARGET( BOARD_ITEM* aParent ); PCB_TARGET( BOARD_ITEM* aParent );
@ -104,6 +99,12 @@ public:
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); } void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
#endif #endif
private:
int m_shape; // bit 0 : 0 = draw +, 1 = draw X
int m_size;
int m_lineWidth;
wxPoint m_pos;
}; };

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -60,10 +60,6 @@ class wxFileName;
// A helper class to plot board items // A helper class to plot board items
class BRDITEMS_PLOTTER : public PCB_PLOT_PARAMS class BRDITEMS_PLOTTER : public PCB_PLOT_PARAMS
{ {
PLOTTER* m_plotter;
BOARD* m_board;
LSET m_layerMask;
public: public:
BRDITEMS_PLOTTER( PLOTTER* aPlotter, BOARD* aBoard, const PCB_PLOT_PARAMS& aPlotOpts ) BRDITEMS_PLOTTER( PLOTTER* aPlotter, BOARD* aBoard, const PCB_PLOT_PARAMS& aPlotOpts )
: PCB_PLOT_PARAMS( aPlotOpts ) : PCB_PLOT_PARAMS( aPlotOpts )
@ -105,45 +101,48 @@ public:
/** /**
* Plot a pad. * Plot a pad.
* unlike other items, a pad had not a specific color, *
* and be drawn as a non filled item although the plot mode is filled * Unlike other items, a pad had not a specific color and be drawn as a non filled item
* color and plot mode are needed by this function * although the plot mode is filled color and plot mode are needed by this function.
*/ */
void PlotPad( const PAD* aPad, COLOR4D aColor, OUTLINE_MODE aPlotMode ); void PlotPad( const PAD* aPad, COLOR4D aColor, OUTLINE_MODE aPlotMode );
/** /**
* plot items like text and graphics, * Plot items like text and graphics but not tracks and footprints.
* but not tracks and footprints
*/ */
void PlotBoardGraphicItems(); void PlotBoardGraphicItems();
/** Function PlotDrillMarks /**
* Draw a drill mark for pads and vias. * Draw a drill mark for pads and vias.
* Must be called after all drawings, because it *
* redraw the drill mark on a pad or via, as a negative (i.e. white) shape in * Must be called after all drawings, because it redraws the drill mark on a pad or via, as
* FILLED plot mode (for PS and PDF outputs) * a negative (i.e. white) shape in FILLED plot mode (for PS and PDF outputs).
*/ */
void PlotDrillMarks(); void PlotDrillMarks();
/** /**
* Function getColor * White color is special because it cannot be seen on a white paper in B&W mode. It is
* @return the layer color * plotted as white but other colors are plotted in BLACK so the returned color is LIGHTGRAY
* @param aLayer = the layer id * when the layer color is WHITE.
* White color is special: cannot be seen on a white paper *
* and in B&W mode, is plotted as white but other colors are plotted in BLACK * @param aLayer is the layer id.
* so the returned color is LIGHTGRAY when the layer color is WHITE * @return the layer color.
*/ */
COLOR4D getColor( LAYER_NUM aLayer ) const; COLOR4D getColor( LAYER_NUM aLayer ) const;
private: private:
/** Helper function to plot a single drill mark. It compensate and clamp /**
* the drill mark size depending on the current plot options * Helper function to plot a single drill mark.
*
* It compensate and clamp the drill mark size depending on the current plot options.
*/ */
void plotOneDrillMark( PAD_DRILL_SHAPE_T aDrillShape, void plotOneDrillMark( PAD_DRILL_SHAPE_T aDrillShape, const wxPoint& aDrillPos,
const wxPoint& aDrillPos, wxSize aDrillSize, wxSize aDrillSize, const wxSize& aPadSize,
const wxSize& aPadSize,
double aOrientation, int aSmallDrill ); double aOrientation, int aSmallDrill );
PLOTTER* m_plotter;
BOARD* m_board;
LSET m_layerMask;
}; };
PLOTTER* StartPlotBoard( BOARD* aBoard, PLOTTER* StartPlotBoard( BOARD* aBoard,
@ -153,27 +152,28 @@ PLOTTER* StartPlotBoard( BOARD* aBoard,
const wxString& aSheetDesc ); const wxString& aSheetDesc );
/** /**
* Function PlotOneBoardLayer * Plot one copper or technical layer.
* main function to plot one copper or technical layer. *
* It prepare options and calls the specialized plot function, * It prepares options and calls the specialized plot function according to the layer type.
* according to the layer type *
* @param aBoard = the board to plot * @param aBoard is the board to plot.
* @param aPlotter = the plotter to use * @param aPlotter is the plotter to use.
* @param aLayer = the layer id to plot * @param aLayer is the layer id to plot.
* @param aPlotOpt = the plot options (files, sketch). Has meaning for some formats only * @param aPlotOpt is the plot options (files, sketch). Has meaning for some formats only.
*/ */
void PlotOneBoardLayer( BOARD* aBoard, PLOTTER* aPlotter, PCB_LAYER_ID aLayer, void PlotOneBoardLayer( BOARD* aBoard, PLOTTER* aPlotter, PCB_LAYER_ID aLayer,
const PCB_PLOT_PARAMS& aPlotOpt ); const PCB_PLOT_PARAMS& aPlotOpt );
/** /**
* Function PlotStandardLayer * Plot copper or technical layers.
* plot copper or technical layers. *
* not used for silk screen layers, because these layers have specific * This is not used for silk screen layers because these layers have specific requirements.
* requirements, mainly for pads * This is mainly for pads.
* @param aBoard = the board to plot *
* @param aPlotter = the plotter to use * @param aBoard is the board to plot.
* @param aLayerMask = the mask to define the layers to plot * @param aPlotter is the plotter to use.
* @param aPlotOpt = the plot options (files, sketch). Has meaning for some formats only * @param aLayerMask is the mask to define the layers to plot.
* @param aPlotOpt is the plot options (files, sketch). Has meaning for some formats only.
* *
* aPlotOpt has 3 important options to control this plot, * aPlotOpt has 3 important options to control this plot,
* which are set, depending on the layer type to plot * which are set, depending on the layer type to plot
@ -183,34 +183,34 @@ void PlotOneBoardLayer( BOARD* aBoard, PLOTTER* aPlotter, PCB_LAYER_ID aLayer,
* SetSkipPlotNPTH_Pads( bool aSkip ) * SetSkipPlotNPTH_Pads( bool aSkip )
* aSkip = true to skip NPTH Pads, when the pad size and the pad hole * aSkip = true to skip NPTH Pads, when the pad size and the pad hole
* have the same size. Used in GERBER format only. * have the same size. Used in GERBER format only.
* SetDrillMarksType( DrillMarksType aVal ) controle the actual hole: * SetDrillMarksType( DrillMarksType aVal ) control the actual hole:
* no hole, small hole, actual hole * no hole, small hole, actual hole
*/ */
void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask, void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
const PCB_PLOT_PARAMS& aPlotOpt ); const PCB_PLOT_PARAMS& aPlotOpt );
/** /**
* Function PlotLayerOutlines * Plot copper outline of a copper layer.
* plot copper outline of a copper layer. *
* @param aBoard = the board to plot * @param aBoard is the board to plot.
* @param aPlotter = the plotter to use * @param aPlotter is the plotter to use.
* @param aLayerMask = the mask to define the layers to plot * @param aLayerMask is the mask to define the layers to plot.
* @param aPlotOpt = the plot options. Has meaning for some formats only * @param aPlotOpt is the plot options. Has meaning for some formats only.
*/ */
void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter,
LSET aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt ); LSET aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt );
/** /**
* Function BuildPlotFileName (helper function) * Complete a plot filename.
* Complete a plot filename: forces the output directory, *
* add a suffix to the name and sets the specified extension * It forces the output directory, adds a suffix to the name, and sets the specified extension.
* the suffix is usually the layer name * The suffix is usually the layer name and replaces illegal file name character in the suffix
* replaces not allowed chars in suffix by '_' * with an underscore character.
* @param aFilename = the wxFileName to initialize *
* Contains the base filename * @param aFilename is the file name to initialize that contains the base filename.
* @param aOutputDir = the path * @param aOutputDir is the path.
* @param aSuffix = the suffix to add to the base filename * @param aSuffix is the suffix to add to the base filename.
* @param aExtension = the file extension * @param aExtension is the file extension.
*/ */
void BuildPlotFileName( wxFileName* aFilename, void BuildPlotFileName( wxFileName* aFilename,
const wxString& aOutputDir, const wxString& aOutputDir,
@ -219,56 +219,56 @@ void BuildPlotFileName( wxFileName* aFilename,
/** /**
* Function GetGerberProtelExtension
* @return the appropriate Gerber file extension for \a aLayer * @return the appropriate Gerber file extension for \a aLayer
* used by Protel, and still sometimes in use (although the
* official Gerber Ext is now .gbr)
*/ */
const wxString GetGerberProtelExtension( LAYER_NUM aLayer ); const wxString GetGerberProtelExtension( LAYER_NUM aLayer );
/** /**
* Function GetGerberFileFunctionAttribute * Return the "file function" attribute for \a aLayer, as defined in the
* Returns the "file function" attribute for \a aLayer, as defined in the * Gerber file format specification J1 (chapter 5).
* Gerber file format specification J1 (chapter 5). The returned string includes *
* the "%TF.FileFunction" attribute prefix and the "*%" suffix. * The returned string includes the "%TF.FileFunction" attribute prefix and the "*%" suffix.
* @param aBoard = the board, needed to get the total count of copper layers *
* @param aLayer = the layer number to create the attribute for * @param aBoard is the board, needed to get the total count of copper layers.
* @param aLayer is the layer number to create the attribute for.
* @return The attribute, as a text string * @return The attribute, as a text string
*/ */
const wxString GetGerberFileFunctionAttribute( const BOARD* aBoard, LAYER_NUM aLayer ); const wxString GetGerberFileFunctionAttribute( const BOARD* aBoard, LAYER_NUM aLayer );
/** /**
* Calculates some X2 attributes, as defined in the * Calculate some X2 attributes as defined in the Gerber file format specification J4
* Gerber file format specification J4 (chapter 5) and add them * (chapter 5) and add them the to the gerber file header.
* the to the gerber file header: *
* TF.GenerationSoftware * TF.GenerationSoftware
* TF.CreationDate * TF.CreationDate
* TF.ProjectId * TF.ProjectId
* file format attribute is not added * file format attribute is not added
* @param aPlotter = the current plotter. *
* @param aBoard = the board, needed to extract some info * @param aPlotter is the current plotter.
* @param aUseX1CompatibilityMode = false to generate X2 attributes, true to * @param aBoard is the board, needed to extract some info.
* use X1 compatibility (X2 attributes added as structured comments, * @param aUseX1CompatibilityMode set to false to generate X2 attributes, true to
* starting by "G04 #@! " followed by the X2 attribute * use X1 compatibility (X2 attributes added as structured comments,
* starting by "G04 #@! " followed by the X2 attribute
*/ */
void AddGerberX2Header( PLOTTER* aPlotter, void AddGerberX2Header( PLOTTER* aPlotter, const BOARD* aBoard,
const BOARD* aBoard, bool aUseX1CompatibilityMode = false ); bool aUseX1CompatibilityMode = false );
/** /**
* Calculates some X2 attributes, as defined in the Gerber file format * Calculate some X2 attributes as defined in the Gerber file format specification and add them
* specification and add them to the gerber file header: * to the gerber file header.
*
* TF.GenerationSoftware * TF.GenerationSoftware
* TF.CreationDate * TF.CreationDate
* TF.ProjectId * TF.ProjectId
* TF.FileFunction * TF.FileFunction
* TF.FilePolarity * TF.FilePolarity
* *
* @param aPlotter = the current plotter. * @param aPlotter is the current plotter.
* @param aBoard = the board, needed to extract some info * @param aBoard is the board, needed to extract some info.
* @param aLayer = the layer number to create the attribute for * @param aLayer is the layer number to create the attribute for.
* @param aUseX1CompatibilityMode = false to generate X2 attributes, true to * @param aUseX1CompatibilityMode set to false to generate X2 attributes, true to use X1
* use X1 compatibility (X2 attributes added as structured comments, * compatibility (X2 attributes added as structured comments, starting by "G04 #@! "
* starting by "G04 #@! " followed by the X2 attribute * followed by the X2 attribute.
*/ */
void AddGerberX2Attribute( PLOTTER* aPlotter, const BOARD* aBoard, void AddGerberX2Attribute( PLOTTER* aPlotter, const BOARD* aBoard,
LAYER_NUM aLayer, bool aUseX1CompatibilityMode ); LAYER_NUM aLayer, bool aUseX1CompatibilityMode );