d2elklayout

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: MPL-2.0 Imports: 12 Imported by: 11

Documentation

Overview

d2elklayout is a wrapper around the Javascript port of ELK.

Coordinates are relative to parents. See https://www.eclipse.org/elk/documentation/tooldevelopers/graphdatastructure/coordinatesystem.html

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Layout

func Layout(ctx context.Context, g *d2graph.Graph) (err error)

Types

type ELKEdge

type ELKEdge struct {
	ID        string           `json:"id"`
	Sources   []string         `json:"sources"`
	Targets   []string         `json:"targets"`
	Sections  []ELKEdgeSection `json:"sections,omitempty"`
	Labels    []*ELKLabel      `json:"labels,omitempty"`
	Container string           `json:"container"`
}

type ELKEdgeSection

type ELKEdgeSection struct {
	Start      ELKPoint   `json:"startPoint"`
	End        ELKPoint   `json:"endPoint"`
	BendPoints []ELKPoint `json:"bendPoints,omitempty"`
}

type ELKGraph

type ELKGraph struct {
	ID            string            `json:"id"`
	LayoutOptions *ELKLayoutOptions `json:"layoutOptions"`
	Children      []*ELKNode        `json:"children,omitempty"`
	Edges         []*ELKEdge        `json:"edges,omitempty"`
}

type ELKLabel

type ELKLabel struct {
	Text   string  `json:"text"`
	X      float64 `json:"x"`
	Y      float64 `json:"y"`
	Width  float64 `json:"width"`
	Height float64 `json:"height"`
}

type ELKLayoutOptions

type ELKLayoutOptions struct {
	Algorithm         string  `json:"elk.algorithm,omitempty"`
	HierarchyHandling string  `json:"elk.hierarchyHandling,omitempty"`
	NodeSpacing       float64 `json:"spacing.nodeNodeBetweenLayers,omitempty"`
	Padding           string  `json:"elk.padding,omitempty"`
	EdgeNodeSpacing   float64 `json:"spacing.edgeNodeBetweenLayers,omitempty"`
	Direction         string  `json:"elk.direction"`
	SelfLoopSpacing   float64 `json:"elk.spacing.nodeSelfLoop"`
}

type ELKNode

type ELKNode struct {
	ID            string            `json:"id"`
	X             float64           `json:"x"`
	Y             float64           `json:"y"`
	Width         float64           `json:"width"`
	Height        float64           `json:"height"`
	Children      []*ELKNode        `json:"children,omitempty"`
	Labels        []*ELKLabel       `json:"labels,omitempty"`
	LayoutOptions *ELKLayoutOptions `json:"layoutOptions,omitempty"`
}

type ELKPoint

type ELKPoint struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL