Documentation ¶
Overview ¶
Package shape provides various SVG shapes
Index ¶
- Constants
- func Move(m Movable, xd, yd int)
- func SetClass(class string, shapes ...Shape)
- type Actor
- type Adjuster
- func (a *Adjuster) Above(o Shape, space ...int) *Adjuster
- func (a *Adjuster) At(x, y int) *Adjuster
- func (a *Adjuster) Below(o Shape, space ...int) *Adjuster
- func (a *Adjuster) LeftOf(o Shape, space ...int) *Adjuster
- func (a *Adjuster) Move(dx, dy int) *Adjuster
- func (a *Adjuster) RightOf(o Shape, space ...int) *Adjuster
- type Aligner
- type Alignment
- type Anchor
- type Box
- type Card
- func (c *Card) Direction() Direction
- func (c *Card) Edge(start xy.Point) xy.Point
- func (c *Card) Height() int
- func (c *Card) Position() (x, y int)
- func (c *Card) SetClass(v string)
- func (c *Card) SetHeight(v int)
- func (c *Card) SetIcon(v Shape)
- func (c *Card) SetNote(v string)
- func (c *Card) SetText(v string)
- func (c *Card) SetTitle(v string)
- func (c *Card) SetWidth(v int)
- func (c *Card) SetX(v int)
- func (c *Card) SetY(v int)
- func (c *Card) Width() int
- func (c *Card) WriteSVG(out io.Writer) error
- type Circle
- type Component
- func (c *Component) Direction() Direction
- func (c *Component) Edge(start xy.Point) xy.Point
- func (c *Component) Height() int
- func (c *Component) Position() (x int, y int)
- func (c *Component) SetClass(v string)
- func (c *Component) SetFont(f draw.Font)
- func (c *Component) SetHref(v string)
- func (c *Component) SetTextPad(pad draw.Padding)
- func (c *Component) SetX(x int)
- func (c *Component) SetY(y int)
- func (c *Component) Width() int
- func (c *Component) WriteSVG(out io.Writer) error
- type Container
- type Cylinder
- func (c *Cylinder) Direction() Direction
- func (c *Cylinder) Edge(start xy.Point) xy.Point
- func (c *Cylinder) Height() int
- func (c *Cylinder) Position() (x int, y int)
- func (c *Cylinder) SetClass(class string)
- func (c *Cylinder) SetX(x int)
- func (c *Cylinder) SetY(y int)
- func (c *Cylinder) Width() int
- func (c *Cylinder) WriteSVG(out io.Writer) error
- type Database
- type Diamond
- func (d *Diamond) Direction() Direction
- func (d *Diamond) Edge(start xy.Point) xy.Point
- func (d *Diamond) Height() int
- func (d *Diamond) Position() (x int, y int)
- func (d *Diamond) SetClass(c string)
- func (d *Diamond) SetX(x int)
- func (d *Diamond) SetY(y int)
- func (d *Diamond) Width() int
- func (d *Diamond) WriteSVG(out io.Writer) error
- type Direction
- type Dot
- func (d *Dot) Direction() Direction
- func (d *Dot) Edge(start xy.Point) xy.Point
- func (d *Dot) Height() int
- func (d *Dot) Position() (x int, y int)
- func (d *Dot) SetClass(class string)
- func (d *Dot) SetX(x int)
- func (d *Dot) SetY(y int)
- func (d *Dot) Width() int
- func (d *Dot) WriteSVG(out io.Writer) error
- type Edge
- type ExitDot
- func (e *ExitDot) Direction() Direction
- func (e *ExitDot) Edge(start xy.Point) xy.Point
- func (e *ExitDot) Height() int
- func (e *ExitDot) Position() (x int, y int)
- func (e *ExitDot) SetClass(class string)
- func (e *ExitDot) SetX(x int)
- func (e *ExitDot) SetY(y int)
- func (e *ExitDot) Width() int
- func (e *ExitDot) WriteSVG(out io.Writer) error
- type Group
- func (g *Group) BottomRightPos() (x, y int)
- func (g *Group) Direction() Direction
- func (g *Group) Edge(start xy.Point) xy.Point
- func (g *Group) Height() int
- func (g *Group) Position() (x, y int)
- func (g *Group) SetClass(c string)
- func (g *Group) SetPad(pad draw.Padding)
- func (g *Group) SetX(x int)
- func (g *Group) SetY(y int)
- func (g *Group) TopLeftPos() (x, y int)
- func (g *Group) Width() int
- func (g *Group) WriteSVG(out io.Writer) error
- type HasFont
- type HasTextPad
- type Hexagon
- func (r *Hexagon) Direction() Direction
- func (r *Hexagon) Edge(start xy.Point) xy.Point
- func (r *Hexagon) Height() int
- func (r *Hexagon) Position() (x int, y int)
- func (r *Hexagon) SetClass(c string)
- func (r *Hexagon) SetFont(f draw.Font)
- func (r *Hexagon) SetHeight(h int)
- func (r *Hexagon) SetTextPad(pad draw.Padding)
- func (r *Hexagon) SetWidth(w int)
- func (r *Hexagon) SetX(x int)
- func (r *Hexagon) SetY(y int)
- func (r *Hexagon) Width() int
- func (r *Hexagon) WriteSVG(out io.Writer) error
- type Hidden
- type Internet
- type Label
- func (l *Label) Direction() Direction
- func (l *Label) Edge(start xy.Point) xy.Point
- func (l *Label) Height() int
- func (l *Label) Position() (x int, y int)
- func (l *Label) SetClass(c string)
- func (l *Label) SetHref(v string)
- func (l *Label) SetText(v string)
- func (l *Label) SetX(x int)
- func (l *Label) SetY(y int)
- func (l *Label) Text() string
- func (l *Label) Width() int
- func (l *Label) WriteSVG(out io.Writer) error
- type Labeled
- type Line
- func (a *Line) AbsAngle() int
- func (a *Line) Angle() int
- func (a *Line) CenterPosition() (x int, y int)
- func (a *Line) DirQ1() bool
- func (a *Line) DirQ2() bool
- func (a *Line) DirQ3() bool
- func (a *Line) DirQ4() bool
- func (a *Line) Direction() Direction
- func (a *Line) Height() int
- func (a *Line) Position() (x int, y int)
- func (a *Line) SetClass(c string)
- func (a *Line) SetX(x int)
- func (a *Line) SetY(y int)
- func (a *Line) Width() int
- func (a *Line) WriteSVG(out io.Writer) error
- type Movable
- type Note
- func (n *Note) Direction() Direction
- func (n *Note) Edge(start xy.Point) xy.Point
- func (n *Note) Height() int
- func (n *Note) Position() (x int, y int)
- func (n *Note) SetClass(c string)
- func (n *Note) SetText(v string)
- func (n *Note) SetX(x int)
- func (n *Note) SetY(y int)
- func (n *Note) Text() string
- func (n *Note) Width() int
- func (n *Note) WriteSVG(out io.Writer) error
- type Process
- type Record
- func (r *Record) Direction() Direction
- func (r *Record) Edge(start xy.Point) xy.Point
- func (r *Record) Height() int
- func (r *Record) HideFields()
- func (r *Record) HideMethod(m string) (found bool)
- func (r *Record) HideMethods()
- func (r *Record) Position() (x int, y int)
- func (r *Record) SetClass(c string)
- func (r *Record) SetFont(f draw.Font)
- func (r *Record) SetTextPad(pad draw.Padding)
- func (r *Record) SetX(x int)
- func (r *Record) SetY(y int)
- func (r *Record) Width() int
- func (r *Record) WriteSVG(out io.Writer) error
- type Rect
- func (r *Rect) Direction() Direction
- func (r *Rect) Edge(start xy.Point) xy.Point
- func (r *Rect) Height() int
- func (r *Rect) Position() (x int, y int)
- func (r *Rect) SetClass(c string)
- func (r *Rect) SetFont(f draw.Font)
- func (r *Rect) SetHeight(h int)
- func (r *Rect) SetTextPad(pad draw.Padding)
- func (r *Rect) SetWidth(w int)
- func (r *Rect) SetX(x int)
- func (r *Rect) SetY(y int)
- func (r *Rect) Width() int
- func (r *Rect) WriteSVG(out io.Writer) error
- type Shape
- type State
- func (r *State) Direction() Direction
- func (r *State) Edge(start xy.Point) xy.Point
- func (r *State) Height() int
- func (r *State) Position() (x int, y int)
- func (r *State) SetClass(c string)
- func (r *State) SetFont(f draw.Font)
- func (r *State) SetTextPad(pad draw.Padding)
- func (r *State) SetX(x int)
- func (r *State) SetY(y int)
- func (r *State) Width() int
- func (r *State) WriteSVG(out io.Writer) error
- type Store
- func (r *Store) Direction() Direction
- func (r *Store) Edge(start xy.Point) xy.Point
- func (r *Store) Height() int
- func (r *Store) Position() (x int, y int)
- func (r *Store) SetClass(c string)
- func (r *Store) SetFont(f draw.Font)
- func (r *Store) SetHeight(h int)
- func (r *Store) SetTextPad(pad draw.Padding)
- func (r *Store) SetWidth(w int)
- func (r *Store) SetX(x int)
- func (r *Store) SetY(y int)
- func (r *Store) Width() int
- func (r *Store) WriteSVG(out io.Writer) error
- type Triangle
Constants ¶
const ( DirectionRight Direction = (1 << iota) DirectionLeft DirectionUp DirectionDown DirectionDownRight = DirectionDown | DirectionRight DirectionDownLeft = DirectionDown | DirectionLeft DirectionUpLeft = DirectionUp | DirectionLeft DirectionUpRight = DirectionUp | DirectionRight )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Actor ¶ added in v0.8.0
type Adjuster ¶
type Adjuster struct { Spacing int // contains filtered or unexported fields }
Adjuster is used to position a shape relative to other shapes or at a specific xy position.
func NewAdjuster ¶
NewAdjuster returns an adjuster using DefaultSpacing.
func (*Adjuster) Above ¶
Above places the wrapped shape above o. Optional space to override default.
func (*Adjuster) Below ¶
Below places the wrapped shape below o. Optional space to override default.
func (*Adjuster) LeftOf ¶
LeftOf places the wrapped shape to the left of o. Optional space to override default.
type Aligner ¶
type Aligner struct{}
Aligner type aligns multiple shapes
func (Aligner) HAlignBottom ¶
HAlignBottom aligns shape[1:] to shape[0] bottom coordinates horizontally
func (Aligner) HAlignCenter ¶
HAlignCenter aligns shape[1:] to shape[0] center coordinates horizontally
func (Aligner) VAlignCenter ¶
VAlignCenter aligns shape[1:] to shape[0] center coordinates vertically
func (Aligner) VAlignLeft ¶
VAlignLeft aligns shape[1:] to shape[0] left coordinates vertically
func (Aligner) VAlignRight ¶
VAlignRight aligns shape[1:] to shape[0] right coordinates vertically
type Anchor ¶ added in v0.29.0
type Card ¶ added in v0.26.0
type Card struct {
// contains filtered or unexported fields
}
type Component ¶
type Component struct { Title string Font draw.Font Pad draw.Padding // contains filtered or unexported fields }
func NewComponent ¶
func (*Component) Edge ¶
Edge returns intersecting position of a line starting at start and pointing to the components center.
func (*Component) SetHref ¶ added in v0.20.0
SetHref links the title of the component. As of v0.29.0 you can use Anchor to link the entire shape.
func (*Component) SetTextPad ¶
type Container ¶ added in v0.28.0
type Container struct { *Group // contains filtered or unexported fields }
func NewContainer ¶ added in v0.28.0
NewContainer returns a dashed box surrounding the given shapes, placing the label shape in the bottom left corner.
type Cylinder ¶ added in v0.10.0
type Cylinder struct { Radius int Font draw.Font Pad draw.Padding // contains filtered or unexported fields }
func NewCylinder ¶ added in v0.10.0
type Database ¶ added in v0.10.0
func NewDatabase ¶ added in v0.10.0
type Diamond ¶
type Diamond struct {
// contains filtered or unexported fields
}
func NewDecision ¶
func NewDecision() *Diamond
func NewDiamond ¶
func NewDiamond() *Diamond
type ExitDot ¶
type ExitDot struct { Radius int // contains filtered or unexported fields }
func NewExitDot ¶
func NewExitDot() *ExitDot
type Group ¶ added in v0.28.0
func NewGroup ¶ added in v0.28.0
NewGroup returns a virtual group of shapes which can be moved together.
func (*Group) BottomRightPos ¶ added in v0.28.0
func (*Group) Edge ¶ added in v0.28.0
Edge returns intersecting position of a line starting at start and pointing to the rect center.
func (*Group) TopLeftPos ¶ added in v0.28.0
type HasTextPad ¶
type Hexagon ¶ added in v0.19.0
type Hexagon struct { Title string Font draw.Font Pad draw.Padding // contains filtered or unexported fields }
func NewHexagon ¶ added in v0.19.0
NewHexagon with a title. Radius must be > 0 and is the distance from left/right corners to imaginary vertical line.
func (*Hexagon) Edge ¶ added in v0.19.0
Edge returns intersecting position of a line starting at start and pointing to the rect center.
func (*Hexagon) SetTextPad ¶ added in v0.19.0
type Hidden ¶ added in v0.29.0
type Hidden struct {
Shape
}
type Internet ¶ added in v0.13.0
type Internet struct { Circle Title string Font draw.Font Pad draw.Padding // contains filtered or unexported fields }
func NewInternet ¶ added in v0.13.0
func NewInternet() *Internet
func (*Internet) SetTextPad ¶ added in v0.13.0
type Labeled ¶ added in v0.30.0
type Labeled struct {
*Group
}
func NewLabeled ¶ added in v0.30.0
NewLabeled returns a shape with the text as a label below it.
type Line ¶
type Line struct { Start xy.Point End xy.Point Tail Shape Head Shape // contains filtered or unexported fields }
func NewArrowBetween ¶
func (*Line) Angle ¶ added in v0.22.0
Angle returns value in degrees. Right = 0, down = 90, left: 180, up = -90
func (*Line) CenterPosition ¶ added in v0.22.0
CenterPosition returns the center x, y values
func (*Line) DirQ1 ¶ added in v0.22.0
DirQ1 returns true if the arrow points to the bottom-right quadrant.
func (*Line) DirQ2 ¶ added in v0.22.0
DirQ2 returns true if the arrow points to the bottom-left quadrant.
func (*Line) DirQ3 ¶ added in v0.22.0
DirQ3 returns true if the arrow points to the top-left quadrant.
func (*Line) DirQ4 ¶ added in v0.22.0
DirQ4 returns true if the arrow points to the top-right quadrant.
type Process ¶ added in v0.24.0
type Process struct { Circle // contains filtered or unexported fields }
func NewProcess ¶ added in v0.24.0
type Record ¶
type Record struct { Title string Fields []string Methods []string Font draw.Font Pad draw.Padding // contains filtered or unexported fields }
func (*Record) Edge ¶
Edge returns intersecting position of a line starting at start and pointing to the records center.
func (*Record) HideFields ¶
func (r *Record) HideFields()
func (*Record) HideMethod ¶
func (*Record) HideMethods ¶
func (r *Record) HideMethods()
func (*Record) SetTextPad ¶
type Rect ¶
type Rect struct { Title string Font draw.Font Pad draw.Padding // contains filtered or unexported fields }
func (*Rect) Edge ¶
Edge returns intersecting position of a line starting at start and pointing to the rect center.
func (*Rect) SetTextPad ¶
type State ¶
type State struct { Title string Font draw.Font Pad draw.Padding // contains filtered or unexported fields }
func (*State) Edge ¶
Edge returns intersecting position of a line starting at start and pointing to the rect center.
func (*State) SetTextPad ¶
type Store ¶ added in v0.24.0
type Store struct { Title string Font draw.Font Pad draw.Padding // contains filtered or unexported fields }
func (*Store) SetTextPad ¶ added in v0.24.0
type Triangle ¶
type Triangle struct {
// contains filtered or unexported fields
}
func NewTriangle ¶
func NewTriangle() *Triangle
Source Files ¶
- actor.go
- adjust.go
- align.go
- anchor.go
- card.go
- circle.go
- component.go
- container.go
- cylinder.go
- database.go
- defaults.go
- diamond.go
- dot.go
- exitdot.go
- group.go
- hexagon.go
- hidden.go
- internet.go
- label.go
- labeled.go
- line.go
- move.go
- note.go
- package.go
- process.go
- record.go
- rect.go
- shape.go
- state.go
- store.go
- triangle.go