Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions entity/lwpolyline.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type LwPolyline struct {
Num int // 90
Closed bool
Vertices [][]float64
Bulges []float64
}

// IsEntity is for Entity interface.
Expand All @@ -28,6 +29,7 @@ func NewLwPolyline(size int) *LwPolyline {
Num: size,
Closed: false,
Vertices: vs,
Bulges: make([]float64, size),
}
return l
}
Expand All @@ -46,6 +48,9 @@ func (l *LwPolyline) Format(f format.Formatter) {
for j := 0; j < 2; j++ {
f.WriteFloat((j+1)*10, l.Vertices[i][j])
}
if l.Bulges[i] != 0 {
f.WriteFloat(42, l.Bulges[i])
}
}
}

Expand Down
5 changes: 5 additions & 0 deletions parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ func ParseLwPolyline(d *drawing.Drawing, data [][2]string) (entity.Entity, error
err = setInt(dt, func(val int) {
lw.Num = val
lw.Vertices = make([][]float64, val)
lw.Bulges = make([]float64, val)
for i := 0; i < val; i++ {
lw.Vertices[i] = make([]float64, 2)
}
Expand All @@ -730,6 +731,10 @@ func ParseLwPolyline(d *drawing.Drawing, data [][2]string) (entity.Entity, error
} else {
err = fmt.Errorf("LWPOLYLINE extra vertices")
}
case "42":
err = setFloat(dt, func(val float64) {
lw.Bulges[ind-1] = val
})
case "70":
err = setInt(dt, func(val int) {
if val == 1 {
Expand Down