From 725796d69a512a03e03a0b4a2967ed7a06412162 Mon Sep 17 00:00:00 2001 From: Olivier Wulveryck Date: Tue, 13 Jun 2023 09:12:36 +0200 Subject: [PATCH 1/2] feat: add the options to display chains etc... --- examples/wtg2svglive/main.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/examples/wtg2svglive/main.go b/examples/wtg2svglive/main.go index 0bea0b5..3772c33 100644 --- a/examples/wtg2svglive/main.go +++ b/examples/wtg2svglive/main.go @@ -21,9 +21,13 @@ import ( ) type configuration struct { - Width int `default:"1500"` - Height int `default:"900"` - Port string `default:"8080"` + Width int `default:"1500"` + Height int `default:"900"` + Port string `default:"8080"` + WithSpace bool `default:"true"` + WithControls bool `default:"true"` + WithValueChain bool `default:"true"` + WithIndicators bool `default:"false"` } var config configuration @@ -182,8 +186,15 @@ func generateSVG(filePath string) ([]byte, error) { return nil, err } defer e.Close() - style := svgmap.NewOctoStyle(p.EvolutionStages) + indicators := []svgmap.Annotator{} + if config.WithIndicators { + indicators = svgmap.AllEvolutionIndications() + } + style := svgmap.NewOctoStyle(p.EvolutionStages, indicators...) style.WithControls = true + style.WithSpace = config.WithSpace + style.WithControls = config.WithControls + style.WithValueChain = config.WithValueChain e.Init(style) err = e.Encode(p.WMap) if err != nil { From 5517d28b3972d0b9fea0da9c1f6b19a727f27366 Mon Sep 17 00:00:00 2001 From: Olivier Wulveryck Date: Tue, 13 Jun 2023 09:15:25 +0200 Subject: [PATCH 2/2] feat: generate an empty canvas is map is empty --- examples/wtg2svglive/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/wtg2svglive/main.go b/examples/wtg2svglive/main.go index 3772c33..e06042c 100644 --- a/examples/wtg2svglive/main.go +++ b/examples/wtg2svglive/main.go @@ -165,7 +165,7 @@ func generateSVG(filePath string) ([]byte, error) { } defer f.Close() err = p.Parse(f) - if err != nil { + if err != nil && err != wtg.ErrEmptyMap { return nil, err } if len(p.InvalidEntries) != 0 {