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 ¶
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) At ¶
At sets the x, y coordinates of the wrapped shape
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.
func (*Adjuster) Move ¶
Move adjusts shapes by moving them +/- in x and or y direction
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) HAlignTop ¶
HAlignTop aligns shape[1:] to shape[0] top 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
type Box ¶
type Card ¶
type Card struct {
// contains filtered or unexported fields
}
func NewCard ¶
NewCard returns a card with title optional note and text. Default width is set to 310px. You can use multiple lines for text which will be joined with newlines.
type Circle ¶
type Component ¶
type Component struct {
Title string
Font draw.Font
Pad draw.Padding
// contains filtered or unexported fields
}
func (*Component) Edge ¶
Edge returns intersecting position of a line starting at start and pointing to the components center.
type Container ¶
type Container struct {
*Group
// contains filtered or unexported fields
}
func NewContainer ¶
NewContainer returns a dashed box surrounding the given shapes, placing the label shape in the bottom left corner.
type Cylinder ¶
type Database ¶
type Diamond ¶
type Diamond struct {
// contains filtered or unexported fields
}
func (*Diamond) Position ¶
fixme should point to top left corner
type Edge ¶
type Group ¶
func NewGroup ¶
NewGroup returns a virtual group of shapes which can be moved together.
func (*Group) Edge ¶
Edge returns intersecting position of a line starting at start and pointing to the rect center.
type Hexagon ¶
type Hexagon struct {
Title string
Font draw.Font
Pad draw.Padding
// contains filtered or unexported fields
}
func NewHexagon ¶
NewHexagon with a title. Radius must be > 0 and is the distance from left/right corners to imaginary vertical line.
func (*Hexagon) Edge ¶
Edge returns intersecting position of a line starting at start and pointing to the rect center.
type Hidden ¶
type Hidden struct {
Shape
}
func NewHidden ¶
NewHidden returns a shap wrapper that is hidden, ie. not rendered.
type Internet ¶
type Label ¶
type Line ¶
type Line struct {
Start xy.Point
End xy.Point
Tail Shape
Head Shape
// contains filtered or unexported fields
}
func (*Line) Angle ¶
Angle returns value in degrees. Right = 0, down = 90, left: 180, up = -90
func (*Line) CenterPosition ¶
CenterPosition returns the center x, y values
func (*Line) DirQ1 ¶
DirQ1 returns true if the arrow points to the bottom-right quadrant.
func (*Line) DirQ2 ¶
DirQ2 returns true if the arrow points to the bottom-left quadrant.
func (*Line) DirQ3 ¶
DirQ3 returns true if the arrow points to the top-left quadrant.
func (*Line) DirQ4 ¶
DirQ4 returns true if the arrow points to the top-right quadrant.
func (*Line) Direction ¶
Direction returns vertical or horizontal direction, Other if at an angle. If Other, use arrow.DirQn() methods to check to which quadrant.
type Note ¶
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.
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.
type Shape ¶
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.
type Store ¶
type Triangle ¶
type Triangle struct {
// contains filtered or unexported fields
}
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