Commit Graph

6 Commits

Author SHA1 Message Date
John Beard 311f041421 ADDED: Polygon boolean operations in PCB editor
This allows common operations like merging a pin courtyard
into the body courtyard in the fooprint editor, taking a
"bite" out of a polygon and so on,

For now, this only supports polygons made of straight lines.

There are some wierd cases when the operations result in nothing
(e.g. wen a big polygon is substracted from a smaller one that
it contains entirely). I have tried to do something senisble in
these cases, but there may be more optimal ways to handle it.

Relates-To: https://gitlab.com/kicad/code/kicad/-/issues/13025
2023-10-01 00:10:10 +01:00
John Beard b6cd7e3b4a Make ITEM_MODIFICATION_ROUTINE status messages more general and easier to call 2023-10-01 00:10:10 +01:00
John Beard 478df24f36 Fix fillets and chamfers when the original lines become zero-length
This needs the ITEM_MODIFICATION_ROUTINE to learn to delete items.
Condense the item change handlers into a single injected object
(ITEM_MODIFICATION_ROUTINE::CHANGE_HANDLER) and provide the basic
implementation that just takes some callables.

This simplifies the construction of the routines and also would make
a CHANGE_HANDLER object possible that can be reused between different
tools.
2023-07-30 15:12:28 +01:00
Ian McInerney a8f628d0df Add virtual destructor for base class 2023-07-12 19:39:15 +01:00
John Beard 046d978ba7 ADDED: Pcbnew chamfer and extend tools
Using the new ITEM_MODIFICATION_ROUTINE system, drop in two new
tools: chamfer and line extend. These are two geometric operations
that are relatively common when editing footprints in particular.

Chamfer delegates the geometric calculations to a dedicated unit
in kimath/geometry.
2023-07-12 19:21:37 +01:00
John Beard 8e0e9ce752 Generalise fillet tool
Describe the actions of the fillet tools is a generic way, so that the
same general pattern can be used for other tools that modify shapes on
the BOARD.

Basically, an "ITEM_MODIFICATION_ROUTINE" is defined, which is
configured and called multiple times, calling back to the EDIT_TOOL when
it modifies or creates an item.

The motivation here is to make it easier to slot in new line-based
tools like chamfer, extend and so on without having to redo the
complicated item, selection and commit handling each time, and keep the
core "routines" simple and decoupled from the EDIT_TOOL's
internals.

This also resolves #15094 because the new commit handling does the right
thing when items were "conjured up" for the fillet (e.g. when a
rectangle is decomposed into lines).

Fixes: #15094
2023-07-12 19:21:26 +01:00