Documentation
¶
Overview ¶
Package core implements ELK metadata, JSON conversion, and recursive layout.
Index ¶
- Constants
- Variables
- func IsSelfLoop(model *graph.Model, edgeID graph.EdgeID) bool
- func RegisterCoreOptions(registry *OptionRegistry)
- func TranslateSection(model *graph.Model, sectionID graph.SectionID, offset geometry.Point)
- type AlgorithmData
- type AlgorithmRegistry
- type Codec
- type Engine
- type GraphFeature
- type IndividualSpacings
- type LayoutProvider
- type OptionData
- type OptionKind
- type OptionRegistry
- type ProgressMonitor
- type Targets
Constants ¶
View Source
const DefaultAlgorithmID = "org.eclipse.elk.layered"
Variables ¶
View Source
var ( Algorithm = graph.PropertyWithDefault("org.eclipse.elk.algorithm", func() string { return "" }) ResolvedAlgorithm = graph.NewProperty[*AlgorithmData]("org.eclipse.elk.resolvedAlgorithm") NoLayout = graph.PropertyWithDefault("org.eclipse.elk.noLayout", func() bool { return false }) Direction = graph.PropertyWithDefault("org.eclipse.elk.direction", func() string { return "UNDEFINED" }) HierarchyHandling = graph.PropertyWithDefault("org.eclipse.elk.hierarchyHandling", func() string { return "INHERIT" }) Padding = graph.CloneablePropertyWithDefault("org.eclipse.elk.padding", func() geometry.Spacing { return geometry.UniformSpacing(12) }) ContentAlignment = graph.CloneablePropertyWithDefault("org.eclipse.elk.contentAlignment", func() []string { return []string{"V_TOP", "H_LEFT"} }) AspectRatio = graph.PropertyWithDefault("org.eclipse.elk.aspectRatio", func() float64 { return 1.6 }) SpacingNodeNode = graph.PropertyWithDefault("org.eclipse.elk.spacing.nodeNode", func() float64 { return 20 }) PortSide = graph.PropertyWithDefault("org.eclipse.elk.port.side", func() string { return "UNDEFINED" }) PortAnchor = graph.NewProperty[geometry.Point]("org.eclipse.elk.port.anchor") PortConstraints = graph.PropertyWithDefault("org.eclipse.elk.portConstraints", func() string { return "UNDEFINED" }) NodeSizeMinimum = graph.CloneablePropertyWithDefault("org.eclipse.elk.nodeSize.minimum", func() geometry.Point { return geometry.Point{} }) NodeSizeConstraints = graph.CloneablePropertyWithDefault("org.eclipse.elk.nodeSize.constraints", func() []string { return nil }) JunctionPoints = graph.NewProperty[geometry.Chain]("org.eclipse.elk.junctionPoints") ScaleFactor = graph.PropertyWithDefault("org.eclipse.elk.scaleFactor", func() float64 { return 1 }) SpacingIndividual = graph.NewProperty[*IndividualSpacings]("org.eclipse.elk.spacing.individual") SoftwrappingFuzziness = graph.PropertyWithDefault("org.eclipse.elk.softwrappingFuzziness", func() float64 { return 0 }) ChildAreaWidth = graph.NewProperty[float64]("org.eclipse.elk.childAreaWidth") ChildAreaHeight = graph.NewProperty[float64]("org.eclipse.elk.childAreaHeight") JSONShapeCoords = graph.PropertyWithDefault("org.eclipse.elk.json.shapeCoords", func() string { return "INHERIT" }) JSONEdgeCoords = graph.PropertyWithDefault("org.eclipse.elk.json.edgeCoords", func() string { return "INHERIT" }) TopdownLayout = graph.PropertyWithDefault("org.eclipse.elk.topdownLayout", func() bool { return false }) TopdownSizeCategories = graph.PropertyWithDefault("org.eclipse.elk.topdown.sizeCategories", func() int { return 3 }) TopdownSizeCategoriesHierarchicalNodeWeight = graph.PropertyWithDefault( "org.eclipse.elk.topdown.sizeCategoriesHierarchicalNodeWeight", func() int { return 4 }) TopdownScaleFactor = graph.PropertyWithDefault("org.eclipse.elk.topdown.scaleFactor", func() float64 { return 1 }) TopdownSizeApproximator = graph.NewProperty[any]("org.eclipse.elk.topdown.sizeApproximator") TopdownHierarchicalNodeWidth = graph.PropertyWithDefault( "org.eclipse.elk.topdown.hierarchicalNodeWidth", func() float64 { return 150 }) TopdownHierarchicalNodeAspectRatio = graph.PropertyWithDefault( "org.eclipse.elk.topdown.hierarchicalNodeAspectRatio", func() float64 { return 1.414 }) TopdownNodeType = graph.NewProperty[string]("org.eclipse.elk.topdown.nodeType") TopdownScaleCap = graph.PropertyWithDefault("org.eclipse.elk.topdown.scaleCap", func() float64 { return 1 }) // Core graph semantics consumed by ELK Layered and node micro-layout. CommentBox = graph.PropertyWithDefault("org.eclipse.elk.commentBox", func() bool { return false }) Hypernode = graph.PropertyWithDefault("org.eclipse.elk.hypernode", func() bool { return false }) InsideSelfLoopsActivate = graph.PropertyWithDefault("org.eclipse.elk.insideSelfLoops.activate", func() bool { return false }) InsideSelfLoopsEdge = graph.PropertyWithDefault("org.eclipse.elk.insideSelfLoops.yo", func() bool { return false }) InteractiveLayout = graph.PropertyWithDefault("org.eclipse.elk.interactiveLayout", func() bool { return false }) PartitioningActivate = graph.PropertyWithDefault("org.eclipse.elk.partitioning.activate", func() bool { return false }) PartitioningPartition = graph.NewProperty[int]("org.eclipse.elk.partitioning.partition") PortAlignmentNorth = graph.NewProperty[string]("org.eclipse.elk.portAlignment.north") PortAlignmentEast = graph.NewProperty[string]("org.eclipse.elk.portAlignment.east") PortAlignmentSouth = graph.NewProperty[string]("org.eclipse.elk.portAlignment.south") PortAlignmentWest = graph.NewProperty[string]("org.eclipse.elk.portAlignment.west") PortLabelsNextToPortIfPossible = graph.PropertyWithDefault("org.eclipse.elk.portLabels.nextToPortIfPossible", func() bool { return false }) PortLabelsTreatAsGroup = graph.PropertyWithDefault("org.eclipse.elk.portLabels.treatAsGroup", func() bool { return true }) SpacingCommentComment = graph.PropertyWithDefault("org.eclipse.elk.spacing.commentComment", func() float64 { return 10 }) SpacingCommentNode = graph.PropertyWithDefault("org.eclipse.elk.spacing.commentNode", func() float64 { return 10 }) // Headless elkjs exposes these UI and programmatic options through // knownLayoutOptions, but they do not affect native layout execution. Animate = graph.PropertyWithDefault("org.eclipse.elk.animate", func() bool { return true }) AnimationFactor = graph.PropertyWithDefault("org.eclipse.elk.animTimeFactor", func() int { return 100 }) EdgeType = graph.PropertyWithDefault("org.eclipse.elk.edge.type", func() string { return "NONE" }) FontName = graph.NewProperty[string]("org.eclipse.elk.font.name") FontSize = graph.NewProperty[int]("org.eclipse.elk.font.size") LabelManager = graph.NewProperty[any]("org.eclipse.elk.labelManager") LayoutAncestors = graph.PropertyWithDefault("org.eclipse.elk.layoutAncestors", func() bool { return false }) MaxAnimationTime = graph.PropertyWithDefault("org.eclipse.elk.maxAnimTime", func() int { return 4000 }) MinAnimationTime = graph.PropertyWithDefault("org.eclipse.elk.minAnimTime", func() int { return 400 }) ProgressBar = graph.PropertyWithDefault("org.eclipse.elk.progressBar", func() bool { return false }) ValidateGraph = graph.PropertyWithDefault("org.eclipse.elk.validateGraph", func() bool { return false }) ValidateOptions = graph.PropertyWithDefault("org.eclipse.elk.validateOptions", func() bool { return true }) ZoomToFit = graph.PropertyWithDefault("org.eclipse.elk.zoomToFit", func() bool { return false }) )
Functions ¶
func RegisterCoreOptions ¶
func RegisterCoreOptions(registry *OptionRegistry)
Types ¶
type AlgorithmData ¶
type AlgorithmData struct {
ID string
Features GraphFeature
Create func() LayoutProvider
KnownOptions []string
}
type AlgorithmRegistry ¶
type AlgorithmRegistry struct {
// contains filtered or unexported fields
}
func NewAlgorithmRegistry ¶
func NewAlgorithmRegistry() *AlgorithmRegistry
func (*AlgorithmRegistry) Algorithms ¶
func (registry *AlgorithmRegistry) Algorithms() []*AlgorithmData
func (*AlgorithmRegistry) ByID ¶
func (registry *AlgorithmRegistry) ByID(id string) *AlgorithmData
func (*AlgorithmRegistry) BySuffix ¶
func (registry *AlgorithmRegistry) BySuffix(suffix string) *AlgorithmData
func (*AlgorithmRegistry) Register ¶
func (registry *AlgorithmRegistry) Register(algorithm AlgorithmData) error
type Codec ¶
type Codec struct {
Options *OptionRegistry
// contains filtered or unexported fields
}
Codec imports ELK JSON into the algorithm graph and transfers computed layout back into the same public graph objects.
func NewCodec ¶
func NewCodec(options *OptionRegistry) *Codec
type Engine ¶
type Engine struct {
Options *OptionRegistry
Algorithms *AlgorithmRegistry
Monitor ProgressMonitor
}
Engine applies registered providers recursively across graph hierarchy.
func NewEngine ¶
func NewEngine(options *OptionRegistry, algorithms *AlgorithmRegistry) *Engine
type GraphFeature ¶
type GraphFeature uint32
const ( FeatureSelfLoops GraphFeature = 1 << iota FeatureInsideSelfLoops FeatureMultiEdges FeatureEdgeLabels FeaturePorts FeatureCompound FeatureClusters FeatureDisconnected FeatureHyperedges )
func (GraphFeature) Has ¶
func (features GraphFeature) Has(feature GraphFeature) bool
type IndividualSpacings ¶
type IndividualSpacings struct{ Properties graph.PropertyMap }
type LayoutProvider ¶
type LayoutProvider interface {
Layout(model *graph.Model, parent graph.NodeID, monitor ProgressMonitor) error
}
LayoutProvider lays out one parent node and its children.
type OptionData ¶
type OptionData struct {
ID string
Group string
Kind OptionKind
Targets Targets
// MetadataOnly marks UI or programmatic metadata that the headless JSON
// layout engine preserves but does not interpret during layout.
MetadataOnly bool
LegacyIDs []string
EnumValues []string
Parse func(string) (any, error)
Format func(any) string
}
OptionData describes one layout option and how its JSON spelling is parsed.
func (*OptionData) FormatValue ¶
func (option *OptionData) FormatValue(value any) string
func (*OptionData) ParseValue ¶
func (option *OptionData) ParseValue(value string) (any, bool)
type OptionKind ¶
type OptionKind uint8
const ( StringOption OptionKind = iota BooleanOption IntegerOption DoubleOption EnumOption EnumSetOption ObjectOption UndefinedOption )
type OptionRegistry ¶
type OptionRegistry struct {
// contains filtered or unexported fields
}
OptionRegistry is insertion ordered and performs ELK's unique dot-boundary suffix lookup.
func NewOptionRegistry ¶
func NewOptionRegistry() *OptionRegistry
func (*OptionRegistry) ByID ¶
func (registry *OptionRegistry) ByID(id string) *OptionData
func (*OptionRegistry) BySuffix ¶
func (registry *OptionRegistry) BySuffix(suffix string) *OptionData
func (*OptionRegistry) Options ¶
func (registry *OptionRegistry) Options() []*OptionData
func (*OptionRegistry) Register ¶
func (registry *OptionRegistry) Register(option OptionData) error
type ProgressMonitor ¶
type ProgressMonitor interface {
Begin(task string, totalWork float64)
Worked(work float64)
Done()
Canceled() bool
Subtask(work float64) ProgressMonitor
}
ProgressMonitor is deliberately small; providers can report work while callers that do not need progress use NullProgressMonitor.
var NullProgressMonitor ProgressMonitor = nullProgressMonitor{}
Click to show internal directories.
Click to hide internal directories.