Autofill
There are some utility methods for generating "halos" of structures for use as exclusion zones and automatically filling in non-excluded areas with references.
DeviceLayout.Autofill.autofill!
— Functionautofill!(cs::AbstractCoordinateSystem,
filler_cs::AbstractCoordinateSystem,
grid_x::AbstractArray,
grid_y::AbstractArray,
exclusion)
Add references to filler_cs
inside cs
at grid points not in any exclusion
polygon.
The exclusion
argument may be
- a
Coordinate
denoting an offset used to generate the excluded region from shapes incs
- a
CoordinateSystem
orCell
containing the geometry of the excluded region - a
Function
creating aCoordinateSystem
orCell
fromcs
- an
AbstractArray{<:AbstractPolygon}
Returns the origins of references.
DeviceLayout.halo
— Functionhalo(pa::Path, outer_delta, inner_delta; only_layers=[], ignore_layers=[])
Return a Path
forming the halo of pa
, equivalent to offsetting the geometry by outer_delta
, then subtracting the offset by inner_delta
if it is not nothing
.
Extends the start and/or end by delta
(for each inner/outer offset) when pa
has nonzero extent at the endpoints. Each segment's style is the halo style of the original segment.
For the segments of the Path
and any attached references, any entities in layers in ignore_layers
will be skipped. Note that even if the segments are ignored, attachments may not be. If only_layers
is not empty, only those layers will be used to generate the halo. Layers for inclusion and exclusion can be provided as layer name Symbol
s, in which case only the layer name needs to be matched, or as full DeviceLayout.Meta
objects, in which case all metadata fields (e.g., index and level for SemanticMeta
) must match.
Returns a Path.
halo(sty::Paths.Style, outer_delta, inner_delta=nothing; kwargs...)
Return a Trace
or CPW
style covering the extent of sty
from an offset of inner_delta
to outer_delta
.
halo(ent::GeometryEntity{T}, outer_delta, inner_delta=nothing)
Return the "halo" of ent
using an offset of outer_delta
.
By default, the halo is a vector containing offset(footprint(ent), outer_delta)
, but it may contain any number of GeometryEntity
s that together fully cover ent
with a margin of outer_delta
. It is not guaranteed to cover footprint(ent)
.
If inner_delta
is provided, then the offset at inner_delta
is subtracted from the result.
A GeometryEntity
should implement a specialized halo
if there is an efficient non-Polygon
representation of the halo. If it does not, then by default offset
will be used, which first resolves the entity into Polygon
s using to_polygons
.
halo(cs::CoordinateSystem, outer_delta, inner_delta=nothing; only_layers=[],
ignore_layers=[])
halo(cs::Cell, outer_delta, inner_delta=nothing; only_layers=[], ignore_layers=[])
A coordinate system of type typeof(cs)
with halos for all entities in cs
, tracing through cs.refs
.
Any entities in layers in ignore_layers
will be skipped. If only_layers
is not empty, only those layers will be used to generate the halo. Layers for inclusion and exclusion can be provided as layer name Symbol
s, in which case only the layer name needs to be matched, or as full DeviceLayout.Meta
objects, in which case all metadata fields (e.g., index and level for SemanticMeta
) must match.
The orientations of polygons must be consistent, such that outer polygons share the same orientation, and any holes have the opposite orientation. Additionally, any holes should be contained within outer polygons; offsetting hole edges may create positive artifacts at corners.
halo(c::AbstractComponent, delta, inner_delta=nothing; only_layers=[], ignore_layers=[])
A component's halo, intended for use as an exclusion zone parameterized by a bias delta
.
By default, this applies a delta
halo to all geometry
elements whose metadata matches the inclusion/exclusion requirements. For example, polygons are offset by delta
(enlarged by growing delta
away from each original edge). Any entities in layers in ignore_layers
will be skipped. If only_layers
is not empty, only those layers will be used to generate the halo. Layers for inclusion and exclusion can be provided as layer name Symbol
s, in which case only the layer name needs to be matched, or as full DeviceLayout.Meta
objects, in which case all metadata fields (e.g., index and level for SemanticMeta
) must match.
An inner_delta
may be specified to subtract the halo at that bias from the result.
AbstractComponent
s may define their own halo
methods.
DeviceLayout.Autofill.make_halo
— Functionmake_halo(delta, inner_delta=nothing; only_layers=[], ignore_layers=[])
Returns a function (c)->halo(c, delta, inner_delta; only_layers, ignore_layers)
for generating GeometryStructure
halos.
Any entities in layers in ignore_layers
will be skipped. If only_layers
is not empty, only those layers will be used to generate the halo. Layers for inclusion and exclusion can be provided as layer name Symbol
s, in which case only the layer name needs to be matched, or as full DeviceLayout.Meta
objects, in which case all metadata fields (e.g., index and level for SemanticMeta
) must match.