package nodeshape
Import Path
github.com/pancsta/d2/d2layouts/d2talalayout/internal/nodeshape (on go.dev)
Dependency Relation
imports 4 packages, and imported by 4 packages
Involved Source Files
Package nodeshape defines the shape-specific port and label-placement policy
used by TALA nodes.
shape_c4person.go
shape_callout.go
shape_circle.go
shape_cloud.go
shape_cylinder.go
shape_diamond.go
shape_document.go
shape_hexagon.go
shape_image.go
shape_oval.go
shape_package.go
shape_page.go
shape_parallelogram.go
shape_person.go
shape_queue.go
shape_square.go
shape_step.go
shape_stored_data.go
shape_table.go
Package-Level Type Names (total 3)
Kind identifies the TALA behavior associated with a node shape.
String returns the D2 shape type represented by kind.
Kind : expvar.Var
Kind : fmt.Stringer
func New(typeName string, box *geo.Box) (Shape, Kind, bool)
const C4Person
const Callout
const Circle
const Class
const Cloud
const Code
const Cylinder
const Diamond
const Document
const Hexagon
const Image
const Oval
const Package
const Page
const Parallelogram
const Person
const Queue
const RealSquare
const Square
const Step
const StoredData
const Table
const Text
LabelTier groups label positions by how suitable they are for a shape.
func Shape.LabelPositionPreferences(tier LabelTier) map[label.Position]struct{}
const Bad
const Good
const OK
const Unideal
Shape extends D2's geometric shape with the ports and label-position policy
needed by TALA.
( Shape) AspectRatio1() bool
CenterPortIndex returns the center port for an orientation, or -1 if the
shape does not expose one.
CenterPortIndices returns the center port on each side.
( Shape) GetBox() *geo.Box
( Shape) GetDefaultPadding() (paddingX, paddingY float64)
( Shape) GetDimensionsToFit(width, height, paddingX, paddingY float64) (float64, float64)
( Shape) GetInnerBox() *geo.Box
cloud shape has different innerBoxes depending on content's aspect ratio
placing a rectangle of the given size and padding inside the shape, return the position relative to the shape's TopLeft
( Shape) GetSVGPathData() []string
( Shape) GetType() string
( Shape) Is(shape string) bool
( Shape) IsRectangular() bool
LabelPositionPreferences returns the positions in a preference tier.
MirroredPortIndices maps each port index to its reflected counterpart.
Perimeter returns a slice of geo.Intersectables that together constitute the shape border
PortIndices returns the ports available for an orientation.
( Shape) SetInnerBoxAspectRatio(aspectRatio float64)
SnapPointPercentages returns port groups in top, left, bottom, and right order.
github.com/pancsta/d2/d2layouts/d2talalayout/internal/layoutgraph.Node
Shape : github.com/pancsta/d2/lib/shape.Shape
func New(typeName string, box *geo.Box) (Shape, Kind, bool)
func NumColumns(s Shape) int
func SetNumColumns(s Shape, numColumns int)
func TableColumnPortValue(s Shape, orientation geo.Orientation, columnIndex int) (port geo.Point, ok bool)
func TablePortIndex(s Shape, orientation geo.Orientation, columnIndex int) (index int, ok bool)
Package-Level Functions (total 5)
New constructs TALA's policy wrapper around a D2 shape. An empty type uses
square behavior while retaining the empty D2 type. Unsupported nonempty types
return ok=false so callers can preserve their existing shape.
NumColumns returns the number of row-specific side ports for a table shape.
Non-table shapes do not carry this metadata.
SetNumColumns updates the row-specific side ports for a table shape.
It is a no-op for every other shape.
TableColumnPortValue returns the table column's concrete side port without
materializing all of the shape's snap points. Non-table shapes and non-side
orientations return ok=false so callers can use their generic port policy.
TablePortIndex returns the absolute snap-point index for a table column on
the requested side. Non-table shapes and non-side orientations return
ok=false so callers can use their generic port policy.
Package-Level Constants (total 27)
Label preference tiers run from Good to Bad.
Shape kinds identify the policy wrapper returned by New.
Shape kinds identify the policy wrapper returned by New.
Shape kinds identify the policy wrapper returned by New.
Shape kinds identify the policy wrapper returned by New.
Shape kinds identify the policy wrapper returned by New.
Shape kinds identify the policy wrapper returned by New.
Shape kinds identify the policy wrapper returned by New.
Shape kinds identify the policy wrapper returned by New.
Shape kinds identify the policy wrapper returned by New.
Label preference tiers run from Good to Bad.
Shape kinds identify the policy wrapper returned by New.
Shape kinds identify the policy wrapper returned by New.
Label preference tiers run from Good to Bad.
Shape kinds identify the policy wrapper returned by New.
Shape kinds identify the policy wrapper returned by New.
Shape kinds identify the policy wrapper returned by New.
Shape kinds identify the policy wrapper returned by New.
Shape kinds identify the policy wrapper returned by New.
Shape kinds identify the policy wrapper returned by New.
Shape kinds identify the policy wrapper returned by New.
Shape kinds identify the policy wrapper returned by New.
Shape kinds identify the policy wrapper returned by New.
Shape kinds identify the policy wrapper returned by New.
Shape kinds identify the policy wrapper returned by New.
Shape kinds identify the policy wrapper returned by New.
Label preference tiers run from Good to Bad.
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |