Skip to content

Commit 0d04a36

Browse files
authored
Merge pull request #69 from owulveryck/pipeline
Adding pipelines in wtg
2 parents 4c4c8b6 + bd6e756 commit 0d04a36

File tree

17 files changed

+881
-242
lines changed

17 files changed

+881
-242
lines changed

components/wardley/component.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ type Component struct {
3939
Color color.Color
4040
AbsoluteVisibility int
4141
Anchor int
42-
PipelinedComponents map[string]*Component
42+
PipelinedComponents []*Component
43+
PipelineReference *Component
4344
}
4445

4546
// GetAbsoluteVisibility returns the visibility of the component as seen from the anchor
@@ -141,8 +142,8 @@ func (c *Component) marshalSVGPipeline(e *xml.Encoder, canvas image.Rectangle, c
141142
R: image.Rect(lowestBound.X, lowestBound.Y+10, greaterBound.X, greaterBound.Y-10),
142143
Rx: 0,
143144
Ry: 0,
144-
Fill: svg.Color{},
145-
Stroke: svg.Color{},
145+
Fill: svg.Transparent,
146+
Stroke: svg.Black,
146147
StrokeWidth: "1",
147148
Style: "",
148149
})
@@ -167,8 +168,8 @@ func (c *Component) marshalSVGPipeline(e *xml.Encoder, canvas image.Rectangle, c
167168
components := make([]interface{}, 0)
168169
components = append(components, svg.Rectangle{
169170
R: image.Rectangle{
170-
Min: image.Point{-5, -5},
171-
Max: image.Point{5, 5},
171+
Min: image.Point{-5, -15},
172+
Max: image.Point{5, -5},
172173
},
173174
StrokeWidth: "3",
174175
Stroke: col,

components/wardley/component_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ func TestComponent_MarshalSVG(t *testing.T) {
3333
EvolutionPos: 0,
3434
Color: color.Gray{},
3535
AbsoluteVisibility: 0,
36-
PipelinedComponents: map[string]*Component{
37-
"p1": {
36+
PipelinedComponents: []*Component{
37+
{
3838
id: 0,
3939
Placement: image.Point{20, 50},
4040
Label: "p1",
@@ -47,7 +47,7 @@ func TestComponent_MarshalSVG(t *testing.T) {
4747
AbsoluteVisibility: 0,
4848
PipelinedComponents: nil,
4949
},
50-
"p2": {
50+
{
5151
id: 0,
5252
Placement: image.Point{70, 50},
5353
Label: "p2",

components/wardley/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"sort"
66
)
77

8-
func getBounds(cs map[string]*Component) image.Rectangle {
8+
func getBounds(cs []*Component) image.Rectangle {
99
csCopy := make([]*Component, len(cs))
1010
i := 0
1111
for _, c := range cs {

docs/wtg.wasm

27 KB
Binary file not shown.

examples/wtg2svg/sample.wtg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
a - b
22
b -- c
3-
c -- d
3+
c -- d:dd
44
c --- e
5-
e ---- f
5+
e:ee ---- f
66

77
a: |.|.|x|.|
88
b: |.|.|.x|.|

0 commit comments

Comments
 (0)