211 Commits

Author SHA1 Message Date
Seth Hillbrand
b207ec8817 Remove negative index access from CPoint
Callers should be responsible for index count and/or use iterators
2025-08-08 10:46:45 -07:00
Jeff Young
400fd96ee2 Make use of new move assignment operators. 2025-08-06 15:27:58 +01:00
Tomasz Wlostowski
c5a4f9e747 router: make sure we are not committing VIAs with non-unique IDs, fixes random disappearing via issue
Note to self:
LINE_PLACER::FixRoute used to silently reclaim the UID of the transient via (as used by the SHOVE's heads tracking logic).
Depending on the particular sequence of user events (the bug is next to impossible to reproduce on a touchpad), this would
result in freshly placed vias disappearing...

Fixes https://gitlab.com/kicad/code/kicad/issues/20999
2025-05-28 13:44:49 +02:00
Seth Hillbrand
4a41f4a525 Prevent overriding existing track width
Avoids resizing existing tracks to match new track.  Adds new parameter
to AssembleLine to allow current behavior while only preventing width
overrides when creating new lines

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20031
2025-04-29 17:51:31 -07:00
Jeff Young
8e461941c0 Formatting. 2025-02-27 15:24:30 +00:00
Seth Hillbrand
bfb3875a68 Add additional handling for arc collisions
Provides nearest point calculation for circles, segments and rects

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18203
2025-01-14 13:08:45 -08:00
Tomasz Wlostowski
bf64e74188 router: fix regression in simplifyNewLine() causing unnecessary segments to be added to board (forming loops)
(note to self: OPTIMIZER now unlinks the in-place-optimized LINEs)
2025-01-10 16:01:19 +01:00
Tomasz Wlostowski
3ab59dfa67 router: fix regression in optimization of head lines 2025-01-04 19:57:12 +01:00
Tomasz Wlostowski
58f5e61186 router: pass current routing mode to rhWalkBase() so that it knows what kinds of board primitives to walk around 2025-01-04 19:57:12 +01:00
Seth Hillbrand
0b2d4d4879 Revise Copyright statement to align with TLF
Recommendation is to avoid using the year nomenclature as this
information is already encoded in the git repo.  Avoids needing to
repeatly update.

Also updates AUTHORS.txt from current repo with contributor names
2025-01-01 14:12:04 -08:00
Jon Evans
d0b2334ceb PNS: Support via stacks 2024-11-04 21:30:38 -05:00
Tomasz Wlostowski
8033b568dd router: trying to fix remaining issues 2024-11-02 19:59:09 +01:00
Tomasz Wlostowski
5e77da4902 router: make a 'tadpole' via (via at the end of a LINE) linkable item 2024-11-02 19:59:09 +01:00
Tomasz Wlostowski
d9ae8e44c2 router: fix a few more missing translations between pcbnew layers and router layers 2024-11-02 19:59:09 +01:00
Tomasz Wlostowski
6878d5f9cf router: use const ref instead of raw LINE pointers in SHOVE::AddHeads() 2024-11-02 19:59:09 +01:00
Tomasz Wlostowski
efeae50fba router: migrate drag/place algos to use new WALKAROUND class 2024-11-02 19:59:09 +01:00
Tomasz Wlostowski
0619b37b93 router: update drag/place algorithms to use the new SHOVE class 2024-11-02 19:59:08 +01:00
Seth Hillbrand
5e0abadb23 Reorganize layer numbering
F_Cu = 0
B_Cu = 2
Remaining internal copper layers are even and incrementing

Non-copper layers are odd and incrementing.

This means that we can no longer do things like:
for( PCB_LAYER_ID layer = F_Cu; layer <= B_Cu; ++layer)
Instead, we have the class LAYER_RANGE:
for( PCB_LAYER_ID layer : LAYER_RANGE( F_Cu, B_Cu) )

Similarly, gt/lt tests should not refer to the integer value of the
layer.  We have functions such as IsCopperLayer to test whether a layer
is copper or not.

When using the connectivity RTree, the third dimension is layer, so we
provide B_Cu with the special INT_MAX value, ensuring that elements
between F_Cu and B_Cu will be identified.  There is a new, special
function GetBoardLayer() for interfacing with CN_ITEMS

Similarly, PNS layers remain unchanged and sequential.  A set of
interface functions is provided to map PNS layers to Board layers and
back.  This allows the PNS_LAYER_RANGE to function as expected
2024-09-06 23:07:58 +00:00
Seth Hillbrand
586fddeec1 Avoid case where whole line is new head
If the whole line shifts, we may have no points of the old tail in the
new line.  In this case, we may not only not find the split point but we
may also have fewer points in the new line than were in the old head.
Clamping to the maximum potential point count prevents creating invalid
lines

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16591
2024-04-19 17:54:29 -07:00
Tomasz Wlostowski
82312a0fae router: SplitAdjacentSegments() should check if the end segment we are about to split is in the same net that the head segment
Otherwise, the router might add bogus segments to the node. The root of the problem is somewhere in the logic that delivers aEndItem to ROUTER::Move() though - as the end item (in line placement mode at least) should always be an item within the same net as the head and not belonging to the current head...
2024-02-20 03:20:08 +00:00
Roberto Fernandez Bautista
e9fbb36538 SHAPE_LINE_CHAIN: Fix and simplify NextShape() + remove PrevShape()
NextShape() function was too complex (trying to go back and forwards).
We only used PrevShape() in one place, so removed that usage.

Added QA tests
2024-01-31 19:17:46 +03:00
Alex
ed00cb3304 Support arcs in Break Track.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16712
2024-01-24 05:47:50 +03:00
Jeff Young
8d3a3419f8 Honour 90-degree router mode in a few more places.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/10421
2023-10-26 14:18:28 +01:00
Tomasz Wlostowski
a7ae4d8e9a router: orphaned net is not the same as null net handle 2023-09-12 16:03:55 +02:00
Jeff Young
76cd637895 Make the net identifier opaque to PNS router.
This also improves performance as we don't have to look up the
netcodes in a map.
2023-08-22 15:17:02 +00:00
Jon Evans
8776437f29 PNS: Placement is not valid if via can't be placed 2023-08-07 18:42:44 -04:00
Jeff Young
5e18287ff9 Re-implement some commented-out hole clearance checking in router. 2023-07-17 16:01:15 +01:00
Jeff Young
30336b2fe3 Unify go-back-one-step processing for drawing tools (and router).
Also warps mouse on all go-back-one-step operations for better feedback.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14981

Fixes https://gitlab.com/kicad/code/kicad/-/issues/9985
2023-06-19 17:14:32 +01:00
Jon Evans
141cc85ff3 PNS: Work around collision checking issues in shove mode
Need to special-case shove mode since 942ee13c introduced
collision checking in all modes.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14836
2023-05-29 18:19:47 -04:00
Jon Evans
942ee13cd1 PNS: Allow width-caused DRC violations at start of route
Also fix an issue where DRC violations introduced by the
width change action could be committed in walk/shove mode.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14805
2023-05-25 23:10:00 -04:00
Jon Evans
94130716a5 PNS: Collision search context may be null
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14741
2023-05-14 17:20:59 -04:00
Steve Bollinger
85f4f0d6c8 pcbnew: switching track posture may not work on first attempt
If you drag a track out and connect to a pad then press the hotkey
to switch the track posture it may not switch because the track
posture selected when the pad was reached is different than the one
that the mouse trail placer drew. As the aspect switching is done
in the mouse trail placer it does not know that the line placer
already override the track.

To correct this, in LINE_PLACER::FlipPosture() if the aspect is not
currently manually forced then copy the current aspect from the
line placer to m_mouseTrailPlacer before calling the FlipPosture()
method of m_mouseTrailPlacer. This will only be done once per
dragging session as once the aspect is manually forced it remains
manually forced. This seems to fix the issue with no undesirable
side effects.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/12369
2023-05-11 23:35:21 +00:00
Tomasz Wlostowski
1283c4713f router: rework ITEM ownership model.
- prerequisite for holes as first class objects code
- introduced the OWNABLE_ITEM interface that defines the owning container (NODE/other ITEM/ITEM_SET)
- simplified the ITEM_SET interface
- constified a lot of APIs (ownership/JOINT management) as a side effect

Rebased and cleaned up by Jeff Young <jeff@rokeby.ie> 5 April 2023
- some STL cover types removed
2023-04-05 11:21:31 +01:00
Tomasz Wlostowski
761e754294 router: trying to improve the 'guess posture' algorithm to work well with both fix-all and fix-last-segment on click 2023-01-12 23:37:07 +01:00
Tomasz Wlostowski
b507c44d74 router: fix regression in Backspace (unfix/undo last segment) caused by redesign of the line placement algo
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12835
2022-11-15 23:05:53 +01:00
Tomasz Wlostowski
a0105efc0c router: major rewrite of shove/walkaround single line placement. An attempt to fix most router blockages/non-45 stray segments and simplar stuff. Also adds a ton of debug geometry cruft.
fixes: 12258
fixes: 12067
fixes: 10807
fixes: 10632
2022-10-31 11:38:31 +01:00
Jeff Young
3e53426b6c Use same ratsnest colours in the router as the rest of KiCad. 2022-10-16 22:21:14 +01:00
Roberto Fernandez Bautista
c15a13963b Fix Build error: AddLine doesn't exist anymore 2022-09-02 11:17:28 +02:00
Roberto Fernandez Bautista
22f96bfd11 Re-route m_last_head after routing fails
This should ensure the shove state gets reverted

Fixes https://gitlab.com/kicad/code/kicad/-/issues/9023
2022-09-02 09:41:15 +02:00
Seth Hillbrand
f1261e71d4 Replace boost::optional with std::optional 2022-08-25 15:50:47 -07:00
Tomasz Wlostowski
3111b7679d router: bring back the snap-to-hull behaviour in Mark Obstacles mode 2022-07-03 23:59:27 +02:00
Tomasz Wlostowski
c8b93c39b6 router: remove some old cruft from the WALKAROUND class 2022-06-03 23:28:41 +02:00
Tomasz Wlostowski
aca9cce5d5 router: more verbose debug messages for the debugger tool 2022-06-03 23:28:41 +02:00
Tomasz Wlostowski
45f7cf9571 router: rework the DEBUG_DECORATOR a bit:
- support for dumping complete PNS::ITEMs and generic SHAPEs
- support for log nesting levels
- wxT-ized strings
- more verbose output where needed
2022-03-03 01:02:00 +01:00
Jeff Young
b2e3f03222 More wide-string declarations. 2022-02-05 22:03:04 +00:00
Tomasz Wlostowski
441e5fd486 router: don't reject non-45 degree lines in the LINE_PLACER 2022-01-22 00:28:11 +01:00
Jeff Young
e61144d45a Finish with EDA_ANGLE. 2022-01-16 21:15:40 +00:00
Jon Evans
3011ae1d51 PNS: Do not allow smart pads when in 90-degree mode
Fixes https://gitlab.com/kicad/code/kicad/-/issues/10386

(cherry picked from commit cf4d46b24d1aadcc07595669c2771fb072250388)
2022-01-13 20:38:01 -05:00
Ian McInerney
0e9cfd0af2 Add missing initialization values to variables
Flagged by Coverity.
2021-12-30 23:42:06 +00:00
Tomasz Wlostowski
57af990066 router: fix layer switch issue when starting a track on via without fixed segments
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/9915
2021-12-16 00:55:17 +01:00