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
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 (*Encoder) Init ¶ added in v0.3.3
func (e *Encoder) Init(s SVGStyleMarshaler)
type SVGMarshaler ¶ added in v0.3.3
type SVGStyleMarshaler ¶ added in v0.3.3
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)
Click to show internal directories.
Click to hide internal directories.