68 std::unique_ptr<ARRAY_OPTIONS> array_opts;
72 int ret = dialog.ShowModal();
74 if( ret != wxID_OK || array_opts ==
nullptr )
84 for(
int ptN = 0; ptN < array_opts->GetArraySize(); ptN++ )
87 std::set<FOOTPRINT*> fpDeDupe;
105 if( fpDeDupe.count( parentFootprint ) == 0 )
107 fpDeDupe.emplace( parentFootprint );
108 item = parentFootprint;
124 commit.
Modify( this_item );
142 switch( item->
Type() )
165 this_item =
static_cast<PCB_GROUP*
>( item )->DeepDuplicate();
175 items_for_this_block.
Add( this_item );
201 commit.
Add( this_item );
208 if( this_item && array_opts->ShouldNumberItems() )
213 PAD&
pad =
static_cast<PAD&
>( *this_item );
215 if(
pad.CanHaveNumber() )
218 pad.SetNumber( newNumber );
230 for(
EDA_ITEM* item : items_for_this_block )
231 all_added_items.push_back( item );
237 commit.
Push(
_(
"Create Array" ) );
static void TransformItem(const ARRAY_OPTIONS &aArrOpts, int aIndex, BOARD_ITEM &aItem)
Transform a BOARD_ITEM from the given ARRAY_OPTIONS and an index into the array.
const PCB_SELECTION m_selection
PCB_BASE_FRAME & m_parent
Options that govern the setup of an "array" of multiple item.
virtual TRANSFORM GetTransform(int aN, const VECTOR2I &aPos) const =0
Get the transform of the n-th point in the array.
Simple class that sequentially provides numbers from an ARRAY_OPTIONS object, making sure that they d...
wxString GetNextPadNumber()
Get the next available pad name.
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle)
Rotate this object.
virtual BOARD_ITEM * Duplicate() const
Create a copy of this BOARD_ITEM.
virtual void Move(const VECTOR2I &aMoveVector)
Move this object.
FOOTPRINT * GetParentFootprint() const
virtual void RunOnDescendants(const std::function< void(BOARD_ITEM *)> &aFunction, int aDepth=0) const
Invoke a function on all descendants.
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Create an undo entry for an item that has been already modified.
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Notify observers that aItem has been added.
A base class for most all the KiCad significant classes used in schematics and boards.
virtual VECTOR2I GetPosition() const
KICAD_T Type() const
Returns the type of object.
static TOOL_ACTION selectionClear
Clear the current selection.
static TOOL_ACTION selectItems
Select a list of items (specified as the event parameter)
A set of BOARD_ITEMs (i.e., without duplicates).
virtual void Add(EDA_ITEM *aItem)
virtual VECTOR2I GetCenter() const
Returns the center point of the selection area bounding box.
int Size() const
Returns the number of selected parts.
std::deque< EDA_ITEM * > & Items()
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
Class to handle a set of BOARD_ITEMs.
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
@ PCB_ZONE_T
class ZONE, a copper pour area
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
@ PCB_TARGET_T
class PCB_TARGET, a target (graphic item)
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
@ PCB_PAD_T
class PAD, a pad in a footprint
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_TABLE_T
class PCB_TABLE, table of PCB_TABLECELLs
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension