Commit Graph

21 Commits

Author SHA1 Message Date
Seth Hillbrand f1261e71d4 Replace boost::optional with std::optional 2022-08-25 15:50:47 -07:00
Jeff Young d5a2059c21 Error messages for zone merging.
Also fixes a bug where zones meeting at a point would get merged
resulting in a self-intersecting zone.

Also fixes a bug where undo would not be handled correctly when zones
could not be merged.

Fixes https://gitlab.com/kicad/code/kicad/issues/10466
2022-01-21 19:55:57 +00:00
Jeff Young 17c9f7c61f Cleanup formatting. 2020-11-07 21:21:56 +00:00
Jon Evans 56ca842ec4 Fix H/V/45 zone snapping behavior
Fixes https://gitlab.com/kicad/code/kicad/-/issues/5122
2020-09-26 14:27:08 -04:00
Seth Hillbrand af064eacdd Silence boost:optional compiler warning 2020-07-02 19:23:58 -07:00
jean-pierre charras d714773c22 Fix a minor compil warning. Add a wxASSERT in hierarch.cpp. 2020-01-18 18:23:21 +01:00
Seth Hillbrand eb3d32f967 SHAPE_LINE_CHAIN: Unify constructors
Keeps the multi element SHAPE_LINE_CHAIN constructors in a single
routine using std::vector and implicit construction.
2019-12-12 13:54:48 +00:00
Seth Hillbrand bae50fab9f pcbnew: Fix 45° snapping polygons
The constrained draw was constraining the polygon size to fit the
existing points rather than extending the existing points to fit the
user's intent.

This adds a 90° double-joint for the completion polygon that allows the
user to complete common constrained polygons visually based on the
preview with a double-click to finish.
2019-10-24 16:01:14 -07:00
Seth Hillbrand 2e1af66a2b pcbnew: Commit polygon points to new constrained zone
Adds leader points if they are not already existing in the zone

Fixes: lp:1846028
* https://bugs.launchpad.net/kicad/+bug/1846028
2019-10-20 09:29:35 -07:00
Seth Hillbrand 70c64d93e4 pcbnew: prevent assert with first pt
Finding the pt-to-end intersection requires a segment, so check for
multiple points.

Fixes: lp:1846431
* https://bugs.launchpad.net/kicad/+bug/1846431
2019-10-20 07:39:48 -07:00
Seth Hillbrand b3615b36bb pcbnew: Retain 45° constraint
This also finishes the polygon with 45° lines when chosen as a create
option.

Fixes: lp:1833673
* https://bugs.launchpad.net/kicad/+bug/1833673

(cherry picked from commit fccce265aa)
2019-08-26 14:36:23 -07:00
Seth Hillbrand efe880bb79 pcbnew: Fix zone cutout duplication
When creating the zone cutout, we delete the old zone and add a new one
with each cutout.  This requires resetting the source zone and clearing
our previous selection if we would like to continue using the cutout
tool on the new zone.

Fixes: lp:1812339
* https://bugs.launchpad.net/kicad/+bug/1812339
2019-01-23 06:42:07 -08:00
Seth Hillbrand dfe4b3412a pcbnew: Fix bug in adding new zone/poly
The next point wasn't updated unless the line was in 45-degree mode.

Fixes: lp:1807591
* https://bugs.launchpad.net/kicad/+bug/1807591
2018-12-09 07:28:41 -08:00
Seth Hillbrand 4fc81bb923 pcbnew: Graphic lines snap as single segments
Graphic lines and polygons are drawn to fit specific areas for which it
is helpful to have the endpoint controlled by the cursor even when
constraining the angle.

Fixes: lp:1805502
* https://bugs.launchpad.net/kicad/+bug/1805502
2018-12-08 07:26:58 -08:00
Jon Evans b8c282fa6f Don't complain about perfectly-closed polygons as self-intersecting 2018-03-29 22:20:00 -04:00
Maciej Suminski 52fcddf4f4 Allow drawing self-intersecting polygons, just display a warning
Fixes: lp:1751654
* https://bugs.launchpad.net/kicad/+bug/1751654
2018-03-02 10:58:43 +01:00
Maciej Suminski 4da47f2c01 Forbid drawing self-intersecting polygons. 2018-02-22 16:24:08 +01:00
Maciej Suminski 7775f59eec Converted zone drawing tools to store points in a SHAPE_LINE_CHAIN
Simplifies the code a bit, removes redundant conversions to/from
std::vector.
2018-02-22 15:18:52 +01:00
Jeff Young cd81254262 Respect 45-degree mode when set from zone dialog.
Fixes: lp:1655073
* https://bugs.launchpad.net/kicad/+bug/1655073
2018-02-20 17:38:20 +01:00
Jeff Young 658d181ec7 Don't capture cursor if zone or polygon cancelled.
If the client tool indicates it isn't happy for us to continue
(because, for instance, the user has cancelled the Zone Properties
dialog), then make sure we don't capture the mouse.

Fixes: lp: 1740780
* https://bugs.launchpad.net/kicad/+bug/1740780
2018-01-04 13:10:37 -05:00
John Beard 9fe780f1b3 Rework zone creation in GAL
The zone creation in DRAWING_TOOL was a complex event loop whici
simultaneously managed the event handling, construction of the preview
polygon and the creation and commiting of the zone, all in the same
scope. This has been broken into several pieces:

* POLYGON_ITEM preview item, used to preview the polygon in progress
* POLYGON_GEOM_MANAGER is a class that collects points from user input
  and used them to describe a polygon's geometry, including calculation
  of 45-degree constrained leader lines
* ZONE_CREATE_HELPER is a class which deals with creating zones based on
  geometry from a geometry manager and parameters from the DRAWING_TOOL
* The (much simpler) event loop in DRAWING_TOOL drives the
  POLYGON_GEOM_MANAGER. With a minor refactor, this loop can be reused
  in future for other polygonal tools if wanted.

The polygon preview now has a translucent fill which makes it easier to
visualise the zone.

This also adds the Close Zone Outline and Delete Last Corner actions as
part of the new event loop.

Fixes: lp:1663885
* https://bugs.launchpad.net/kicad/+bug/1663885

Fixes: lp:1667885
* https://bugs.launchpad.net/kicad/+bug/1667885
2017-03-22 17:18:12 +01:00