KiCad PCB EDA Suite
Loading...
Searching...
No Matches
zones_functions_for_undo_redo.cpp File Reference
#include <pcb_edit_frame.h>
#include <board.h>
#include <zone.h>
#include <zones.h>
#include <zones_functions_for_undo_redo.h>

Go to the source code of this file.

Functions

void SaveCopyOfZones (PICKED_ITEMS_LIST &aPickList, BOARD *aPcb)
 Function SaveCopyOfZones creates a copy of zones having a given netcode on a given layer, and fill a pick list with pickers to handle these copies the UndoRedo status is set to CHANGED for all items in list Later, UpdateCopyOfZonesList will change and update these pickers after a zone editing.
 
void UpdateCopyOfZonesList (PICKED_ITEMS_LIST &aPickList, PICKED_ITEMS_LIST &aAuxiliaryList, BOARD *aPcb)
 Function UpdateCopyOfZonesList Check a pick list to remove zones identical to their copies and set the type of operation in picker (DELETED, CHANGED).
 

Function Documentation

◆ SaveCopyOfZones()

void SaveCopyOfZones ( PICKED_ITEMS_LIST aPickList,
BOARD aPcb 
)

Function SaveCopyOfZones creates a copy of zones having a given netcode on a given layer, and fill a pick list with pickers to handle these copies the UndoRedo status is set to CHANGED for all items in list Later, UpdateCopyOfZonesList will change and update these pickers after a zone editing.

Parameters
aPickList= the pick list
aPcb= the Board

Definition at line 142 of file zones_functions_for_undo_redo.cpp.

References CHANGED, PICKED_ITEMS_LIST::PushItem(), ITEM_PICKER::SetLink(), EDA_ITEM::SetParent(), BOARD_ITEM::SetParentGroup(), and BOARD::Zones().

◆ UpdateCopyOfZonesList()

void UpdateCopyOfZonesList ( PICKED_ITEMS_LIST aPickList,
PICKED_ITEMS_LIST aAuxiliaryList,
BOARD aPcb 
)

Function UpdateCopyOfZonesList Check a pick list to remove zones identical to their copies and set the type of operation in picker (DELETED, CHANGED).

If an item is deleted, the initial values are retrievered, because they can have changed during editing.

Parameters
aPickList= the main pick list
aAuxiliaryList= the list of deleted or added (new created) items after calculations
aPcb= the Board

aAuxiliaryList is a list of pickers updated by zone algorithms: This list contains zones which were added or deleted during the zones combine process aPickList :is a list of zones that can be modified (changed or deleted, or not modified) Typically, this is the list of existing zones on the layer of the edited zone, before any change.

‍if the picked zone is not changed, it is removed from list if the picked zone was deleted (i.e. not found in board list), the picker is modified: its status becomes DELETED the aAuxiliaryList corresponding picker is removed (if not found : set an error) if the picked zone was flagged as NEWITEM, and was after deleted , perhaps combined with another zone (i.e. not found in board list): the picker is removed the zone itself if really deleted the aAuxiliaryList corresponding picker is removed (if not found : set an error)

After aPickList is cleaned, the aAuxiliaryList is read All pickers flagged NEWITEM are moved to aPickList (the corresponding zones are zone that were created by the zone normalize and combine process, mainly when adding cutout areas, or creating self intersecting contours) All pickers flagged DELETED are removed, and the corresponding zones actually deleted (the corresponding zones are new zone that were created by the zone normalize process, when creating self intersecting contours, and after combined with an existing zone. At the end of the update process the aAuxiliaryList must be void, because all pickers created by the combine process must have been removed (removed for new and deleted zones, or moved in aPickList.) If not an error is set.

Definition at line 192 of file zones_functions_for_undo_redo.cpp.

References DELETED, BOARD::GetArea(), PICKED_ITEMS_LIST::GetCount(), PICKED_ITEMS_LIST::GetItemWrapper(), PICKED_ITEMS_LIST::GetPickedItem(), PICKED_ITEMS_LIST::GetPickedItemLink(), PICKED_ITEMS_LIST::GetPickedItemStatus(), NEWITEM, PICKED_ITEMS_LIST::PushItem(), PICKED_ITEMS_LIST::RemovePicker(), PICKED_ITEMS_LIST::SetPickedItemLink(), PICKED_ITEMS_LIST::SetPickedItemStatus(), and BOARD_ITEM::SwapItemData().