svgmap

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: May 6, 2021 License: MIT Imports: 10 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: (float64(100) / 575),
		Label:    "Divergent",
	},
	{
		Position: (float64(100) / 250),
		Label:    "Convergent",
	},
	{
		Position: (float64(574) / 820),
		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: (float64(100) / 575),
		Label:    "Custom-Built",
	},
	{
		Position: (float64(100) / 250),
		Label:    "Product\n(+rental)",
	},
	{
		Position: (float64(574) / 820),
		Label:    "Commodity\n(+utility)",
	},
}

Functions

This section is empty.

Types

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 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