Skip to content

Commit b98f9d7

Browse files
authored
Add trace method for decorated styles (#55)
* Add trace function for decorated style * Add trace function for decorated style * Add gap and width methods for decorated styles
1 parent 9f649ff commit b98f9d7

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

src/paths/contstyles/compound.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function makegrid(segments::AbstractVector{T}, styles) where {T <: Segment}
6060
return cumsum!(grid, grid)
6161
end
6262

63-
for x in (:extent, :width)
63+
for x in (:extent, :width, :trace, :gap)
6464
@eval function ($x)(s::CompoundStyle, t)
6565
sty, teff = s(t)
6666
return ($x)(sty, teff)

src/paths/contstyles/decorated.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ extent(s::AbstractDecoratedStyle, t...) = extent(undecorated(s), t...)
4242

4343
isvirtual(s::AbstractDecoratedStyle) = isvirtual(undecorated(s))
4444

45+
trace(s::AbstractDecoratedStyle, t...) = trace(undecorated(s), t...)
46+
47+
gap(s::AbstractDecoratedStyle, t...) = gap(undecorated(s), t...)
48+
49+
width(s::AbstractDecoratedStyle, t...) = width(undecorated(s), t...)
50+
4551
"""
4652
Base.copy(sty::DecoratedStyle)
4753

test/tests.jl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,29 @@ end
650650
@test_throws DimensionError launch!(pa, trace1=3.0)
651651
end
652652

653+
@testset "> Decorated Paths" begin
654+
# Bumps
655+
rr = centered(Rectangle(10μm, 10μm))
656+
cs_rr = CoordinateSystem(uniquename("test"), nm)
657+
place!(cs_rr, rr, SemanticMeta(:bump))
658+
659+
# Trace
660+
pth = Path(Point(100μm, 100μm); α0=π / 2)
661+
straight!(pth, 800μm, Paths.Trace(20.0μm))
662+
attach!(pth, sref(cs_rr), (0μm):(50μm):(800μm))
663+
@test Paths.trace(pth.nodes[1].sty) === 20.0μm
664+
@test Paths.width(pth.nodes[1].sty) === 20.0μm
665+
@test Paths.extent(pth.nodes[1].sty) === 10.0μm
666+
667+
# CPW
668+
pth = Path(Point(100μm, 100μm); α0=π / 2)
669+
straight!(pth, 800μm, Paths.SimpleCPW(10.0μm, 6.0μm))
670+
attach!(pth, sref(cs_rr), (0μm):(50μm):(800μm))
671+
@test Paths.trace(pth.nodes[1].sty) === 10.0μm
672+
@test Paths.gap(pth.nodes[1].sty) === 6.0μm
673+
@test Paths.extent(pth.nodes[1].sty) === 11.0μm
674+
end
675+
653676
@testset "> CompoundSegment" begin
654677
pa = Path{Float64}()
655678
straight!(pa, 200.0, Paths.Trace(10))

0 commit comments

Comments
 (0)