svgmap

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Example (CustomMarshaler)
package main

import (
	"encoding/xml"
	"image"
	"image/color"
	"os"

	"github.com/owulveryck/wardleyToGo/internal/svg"
)

type component struct{}

func (c *component) MarshalSVG(e *xml.Encoder, bounds image.Rectangle) error {
	e.Encode(&svg.Transform{
		Translate: image.Point{50, 100},
		Components: []interface{}{
			&svg.Circle{
				Fill: svg.Color{color.Black},
			},
		},
	})
	return nil
}
func main() {
	c := &component{}
	enc := xml.NewEncoder(os.Stdout)
	c.MarshalSVG(enc, image.Rectangle{})
}
Output:

Example (Style)
package main

import (
	"image"
	"log"
	"os"

	svgmap "github.com/owulveryck/wardleyToGo/encoding/svg"
)

func main() {
	f, _ := os.Create("/tmp/test.svg")
	defer f.Close()
	e, err := svgmap.NewEncoder(f, image.Rect(0, 0, 1100, 900), image.Rect(30, 50, 1070, 850))
	if err != nil {
		log.Fatal(err)
	}
	defer e.Close()
	style := svgmap.NewWardleyStyle(svgmap.DefaultEvolution)
	e.Init(style)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

View Source
var DataEvolution = []Evolution{
	{
		Position: 0,
		Label:    "Unmodeled",
	},
	{
		Position: stage12,
		Label:    "Divergent",
	},
	{
		Position: stage23,
		Label:    "Convergent",
	},
	{
		Position: stage34,
		Label:    "Modeled",
	},
}
DataEvolution

https://learnwardleymapping.com/2020/01/22/visualizing-the-interaction-of-evolution-and-data-measurement/

View Source
var DefaultEvolution = []Evolution{
	{
		Position: 0,
		Label:    "🧪 Genesis",
	},
	{
		Position: stage12,
		Label:    "⚒️  Custom-Built",
	},
	{
		Position: stage23,
		Label:    "🛒 Product\n(+rental)",
	},
	{
		Position: stage34,
		Label:    "⛽ Commodity\n(+utility)",
	},
}

Functions

This section is empty.

Types

type Annotator added in v0.9.2

type Annotator interface {
	MarshalSVG(enc *xml.Encoder, box, canvas image.Rectangle)
}

func AllEvolutionIndications added in v0.9.2

func AllEvolutionIndications() []Annotator

type Encoder added in v0.3.3

type Encoder struct {
	// contains filtered or unexported fields
}

func NewEncoder added in v0.3.3

func NewEncoder(w io.Writer, box image.Rectangle, canvas image.Rectangle) (*Encoder, error)

func (*Encoder) Close added in v0.3.3

func (e *Encoder) Close()

func (*Encoder) Encode added in v0.3.3

func (e *Encoder) Encode(m *wardleyToGo.Map) error

func (*Encoder) Init added in v0.3.3

func (e *Encoder) Init(s SVGStyleMarshaler)

type Evolution added in v0.3.3

type Evolution struct {
	Position float64
	Label    string
}

type EvolutionIndication added in v0.9.2

type EvolutionIndication struct {
	Y      int
	Labels []string
}

func (*EvolutionIndication) MarshalSVG added in v0.9.2

func (e *EvolutionIndication) MarshalSVG(enc *xml.Encoder, box image.Rectangle, canvas image.Rectangle)

type OctoStyle added in v0.6.0

type OctoStyle struct {
	WithValueChain bool
	WithSpace      bool
	WithControls   bool
	Annotators     []Annotator
	// contains filtered or unexported fields
}

func NewOctoStyle added in v0.6.0

func NewOctoStyle(evolutionSteps []Evolution, annotators ...Annotator) *OctoStyle

func (*OctoStyle) MarshalStyleSVG added in v0.6.0

func (w *OctoStyle) MarshalStyleSVG(enc *xml.Encoder, box, canvas image.Rectangle)

type SVGMarshaler added in v0.3.3

type SVGMarshaler interface {
	MarshalSVG(e *xml.Encoder, bounds image.Rectangle) error
}

type SVGStyleMarshaler added in v0.3.3

type SVGStyleMarshaler interface {
	MarshalStyleSVG(e *xml.Encoder, box, canvas image.Rectangle)
}

type WardleyStyle added in v0.3.3

type WardleyStyle struct {
	// contains filtered or unexported fields
}

func NewWardleyStyle added in v0.3.3

func NewWardleyStyle(evolutionSteps []Evolution) *WardleyStyle

func (*WardleyStyle) MarshalStyleSVG added in v0.3.3

func (w *WardleyStyle) MarshalStyleSVG(enc *xml.Encoder, box, canvas image.Rectangle)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL