Some tools move only preview items while keeping the real items
hidden. Those tools must use this new offset parameter.
Other tools move the real items. Those tools can ignore this
parameter (which will default to {0,0}).
Fixes https://gitlab.com/kicad/code/kicad/issues/9391
1) Implement more robust connection checking so we don't decide very
short segments with both endpoints within a single track are connected
at both ends.
2) Make use of the IS_DELETED flag to perform iteration during dryRun
so that all deletions to be made are flagged.
Fixes https://gitlab.com/kicad/code/kicad/issues/8883
They don't define a KiCad string class, so the header file name was
somewhat misleading. But the fact that they didn't match definitely
made coding more difficult.
This was leaking windows headers and partial wx headers to 1084 compilation units......
This also means math/util.h is leaking to 1084 compilation units which seems a bit high too.
Use the connecting straight tracks even if not exactly parallel - allow
an error margin configurable in ADVANCED_CFG (default 1 degree). Also
be less strict about end point matching and use the width of the track
as the criteria to determine suitability.
Finally, delete any short lengths of track at the end of the operation
and amend the arc end points to keep connectivity.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7967
CHANGED: when pad net assignments are changed in a conflicting way (i.e.,
tracks exist that short out more than one net after the change,
track nets will be updated to the net with the most pads).
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7929
Two issues found with the locking system used to prevent access to
stale connectivity data during the zone fill process:
1) a std::mutex has undefined behavior if you try to use it to guard
against access from the same thread. Because of the use of wx event
loops (and coroutines) it is entirely possible, and in some situations
inevitable, that the same thread will try to redraw the ratsnest in the
middle of zone refilling.
2) The mutex was only guarding the ZONE_FILLER::Fill method, but the callers
of that method also do connectivity updates as part of the COMMIT::Push.
Redrawing the ratsnest after the Fill but before the Push will result in
stale connectivity pointers to zone filled areas.
Fixed (1) by switching to a trivial spinlock implementation. Spinlocks would
generally not be desirable if the contention for the connectivity data crossed
thread boundaries, but at the moment I believe it's guaranteed that the reads
and writes to connectivity that are guarded by this lock happen from the main
UI thread. The writes are also quite rare compared to reads, and reads are
generally fast, so I'm not really worried about the UI thread spinning for any
real amount of time.
Fixed (2) by moving the locking location up to the call sites of
ZONE_FILLER::Fill.
This issue was quite difficult to reproduce, but I found a fairly reliable way:
It only happens (for me) on Windows, MSYS2 build, with wxWidgets 3.0
It also only happens if I restrict PcbNew to use 2 CPU cores.
With those conditions, I can reproduce the issue described in #6471 by
repeatedly editing a zone properties and changing its net. The crash is
especially easy to trigger if you press some keys (such as 'e' for edit)
while the progress dialog is displayed. It's easiest to do this in a debug
build as the slower KiCad is running, the bigger the window is to trigger this
bug.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6471
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7048
Commit 6ffb721 detects vias connected on only one layer.
But the DRC diag (marker position and error message) were not correctly initialized
for this new test.
CHANGED: manually-placed (stitching) vias won't have their nets automatically updated
(unless the via is placed directly on a track segment)
CHANGED: stitching vias can be placed on footprint pads and pick up their nets
Fixes https://gitlab.com/kicad/code/kicad/-/issues/5484
- Fix the function so it actually returns the connected items (previously it was returning aItem every time)
- Make the function const
- Rename the function so that it is not confused with the other function of the same name
- Add doxygen comments for the function
Also checks the nets when checking for a pad being flashed on a particular
layer (so we don't end up thinking the currently-routing-collided track
is a connection).
The use of printf, wxLogDebug, and std::err/std::out causes excessive
debugging output which makes finding specific debugging messages more
difficult than it needs to be.
There is still some debugging output in test code that really needs to
be moved into a unit test.
Add debugging output section to the coding policy regarding debugging
output.
The last remaining threaded operation in dynamic ratsnest was the
recalculation of the dynamic connectivity map. Because we do not
require any of the extra features of the connectivity map, we can get
away with a lightweight move of the anchors to update the ratsnest. The
resulting connectivity tree is not valid but it is not needed for the
ratsnest, which only needs a list of nets/anchors.
Connectivity takes an absolute approach to whether elements are
connected. DRC will be adjusted to check to illegal necks that are less
than the board minimum width
This option removes copper layers from pads and vias where they are not
connected to other board elements. This allows the inner layers to be
more closely routed if the via landing pad is not needed.
Fixes https://gitlab.com/kicad/code/kicad/issues/1835
Connecting zone-to-zone, we need to allow for the stroke-width in
old-style polygons.
Also, speed up the calculation by skipping zone points that do not fall
inside the matching BBox
Fixes https://gitlab.com/kicad/code/kicad/issues/5043
We need to be careful in the connectivity system to always use
dyn_cast/dynamic_cast and check the return when dealing with board
items. Getting non-connected items will result in null nets when
propagated.
Fixes https://gitlab.com/kicad/code/kicad/issues/5082
When running a hit test to check if the anchors are connected, we should
loosen the check for tracks to account for the width. Otherwise
connected anchors can be connected in the system but test positive for
IsDangling()
Fixes https://gitlab.com/kicad/code/kicad/issues/5027
Intrusive lists made the connectivity search not thread-safe. Using
iterators for item deletion provides the same order performance while
keeping the container thread-localized
Removes the TTL triangulator in favor of the delaunator triangulator.
This removes the only AGPL code in the KiCad codebase and therefore
allows the full project to be licensed under the GPLv3.
There were a lot of plotters, exporters, etc. that were rolling their
own implementations.
This also introduces a lazily-built set of SHAPE objects for doing
collision detection and some forms of rendering (and later DRC).
- CN_CONNECTIVITY_ALGO::ForEachItem
move implementation to header, so that a lambda can be inlined by the
compiler. improves iteration performance x2
- CN_ITEM::Net
move implementation to header, so that it can be inlined by the
compiler.
- CONNECTIVITY_DATA::GetNetItems
don't use std::set to filter out duplicates. use std::unique on sorted
vector. use a bitset to perform type check.
This update replaces the existing uses of unique pointer creation with
the C++14 std::make_unique call that provides proper memory release in
event of an exception.
For custom pad shapes were were calculating cardinal points off
of the bounding box. However, the bounding box must be rotated
around the pad's position, rather than its shapePos -- which is
an issue since any thermal spokes will be rotated around the
shapePos.
Of course we don't really need to sort that out because we're
doing an intersection of the pad's boundary polygon with a vector
from the shapePos out to the cardianl point -- so we really just
need the cardinal point to be "out there". So I've changed it
to use use INT_MAX / 2.
Fixes: lp:1851703
* https://bugs.launchpad.net/kicad/+bug/1851703
Pads may include offsets that allow the user to shift the connection
point of the pad. This is captured by the pad m_Pos but not by
ShapePos(). When testing connectivity, we need to get the offset
position.
With pads, we should check available anchor points for each connection,
increasing probability of finding connection to match fill algorithm
Fixes: lp:1844661
* https://bugs.launchpad.net/kicad/+bug/1844661
Pads not on copper layers now do not have a netname, and are no longer taken in account in connectivity.
Especially it avoid creating useless rats-nests for these pads.
This end was not detected as connected by the IsDangling method.
Fix incorrect cleaning of dangling tracks in track cleaner.
Remove also a dead code.
The merge co-linear track segments is still full bugged in track cleaner.
The no-connect net (0) should never drive the net of a cluster.
Otherwise, tracks connecting between unconnected pads and connected pads
can acquire net 0 incorrectly.
Give the user the option of cancelling a file open if there are
segment zones; otherwise they're converted to polygon fills.
Fixes: lp:1823087
* https://bugs.launchpad.net/kicad/+bug/1823087
Commit 6006703798 fixed a crash but broke the filled zones changes detection.
Filled zones were always seen as not up to date due to the fact the filled areas were cleared too early.
The up to date detection is also optimized: the old filled polygons are no longer stored.
Instead of, the MD5_HASH is calculated and stored before clearing the filled polygons.
Libpolygon can provide its own includes via target_include_dirs PUBLIC.
This means any linking targets do not need to specifiy them manually.
As common requires polygon, the polygon dep is also now no longer
required downstream of libcommon, as it's transisitvely implied
by libcommon's target_link_libraries.
This resolves a circular dependency previously detected and also
simplifies CMakeLists.
The bitmap definitions (BITMAP_DEF and so on) do not
have any dependencies on other libs, including WX. This
means the bitmaps library can be isolated from the other
dependencies.
Common now depends on bitmaps, and libraries that depend
on common can pick it up from the common target_link_libraries,
as it is PUBLIC. This means a lot of targets no longer
need manual bitmap linkage.
This avoids a circular dependency that was previously reported
by static analysis.
Avoiding pulling in WX and other headers into the include
tree of each bitmap .cpp is a huge speed up (around 10x) in
compilation, and the generated static library is also 10x
smaller (20MB vs 200MB)
Add common as a link library to pnsrouter,connectivity.
THese library do still use common code (including bitmaps,
via base_screen.h) and this allows them to pick up the libcommon
includes correctly.
- Added ignore netcode option to CONNECTIVITY_DATA::GetConnectedItems()
- PlaceModule() now ensures the module added to the board (and thus to the connectivity database) has correct bounding box necessary for R-trees to work
- Use recursive connected pad search so that the new net is propagated to all pads
Fixes: lp:1787961
* https://bugs.launchpad.net/kicad/+bug/1787961
Rather than depend on proper unlocking for each exit, we move the
connectivity lock mutex into an RAII-type configuration that
automatically unlocks on exit.
Rather than duplicating the connectivity calculations in determining
whether a track is dangling, we utilize the current database to find the
number of connected items for an anchor item when feasible.
Multiple anchors such as tracks still need additional logic.
Fixes: lp:1805479
* https://bugs.launchpad.net/kicad/+bug/1805479
It is possible for an async thread to simply be deferred if not
specifically set to async. In which case, until the return value is
requested, the loop may simply wait.
By decoupling from std::thread, we can avoid the wait/sleep cycle in
checking the std::atomic completion variable. The std::future variables
are immediately returning without the additional atomic check cycle.
This minimizes the thread usage, particularly during online actions such
as moving items and routing.
UpdateRatsnest: Minimized the number of atomics by utilizing future
promise. Avoided updating node-less nets. Node-less nets are common in
the dynamic ratsnest because the net vector is created from the board
nets by value but only populated with a subset. So the dynamic ratsnest
calculation always saw every net as dirty and spun up extra threads.
searchConnections: ParallelThreadCount is no longer lower bounded.
Small item counts are handled inline rather than with a separate thread.
Some windows machines seem prone to sleeping for excessive times. When
called in the main thread, this may prevent the system from responding
to Windows 'Are you alive?' calls.
Rather than forcing each thread to iterate over the full nets list to
find the dirty items, we collect the dirty items first before asking the
threads to address them. This prevents thread spinning. We also
amortize the cost of calculating on an 8-net per thread basis rather
than 2.
Locks protect the std::set in each item. Devolving the mutex to the
CN_ITEM allows multiple threads to make simultaneous connections to
different items where they do not conflict.
The connectivity files were unwieldy. This separates them logically
into data, algo and items where the items classes are those that hold,
surprise, surprise, the items, lists and clusters.