package force
import (
"github.com/d2lang/elk-go/internal/core"
"github.com/d2lang/elk-go/internal/geometry"
"github.com/d2lang/elk-go/internal/graph"
)
const (
ModelFruchtermanReingold = "FRUCHTERMAN_REINGOLD"
ModelEades = "EADES"
)
var (
Model = graph .PropertyWithDefault ("org.eclipse.elk.force.model" , func () string { return ModelFruchtermanReingold })
Iterations = graph .PropertyWithDefault ("org.eclipse.elk.force.iterations" , func () int { return 300 })
RepulsivePower = graph .PropertyWithDefault ("org.eclipse.elk.force.repulsivePower" , func () int { return 0 })
Temperature = graph .PropertyWithDefault ("org.eclipse.elk.force.temperature" , func () float64 { return 0.001 })
Repulsion = graph .PropertyWithDefault ("org.eclipse.elk.force.repulsion" , func () float64 { return 5 })
Priority = graph .PropertyWithDefault ("org.eclipse.elk.priority" , func () int { return 1 })
SpacingNodeNode = graph .PropertyWithDefault ("org.eclipse.elk.spacing.nodeNode" , func () float64 { return 80 })
SpacingEdgeLabel = graph .PropertyWithDefault ("org.eclipse.elk.spacing.edgeLabel" , func () float64 { return 5 })
AspectRatio = graph .PropertyWithDefault ("org.eclipse.elk.aspectRatio" , func () float64 { return 1.6 })
RandomSeed = graph .PropertyWithDefault ("org.eclipse.elk.randomSeed" , func () int { return 1 })
SeparateConnectedComponents = graph .PropertyWithDefault ("org.eclipse.elk.separateConnectedComponents" , func () bool { return true })
Interactive = graph .PropertyWithDefault ("org.eclipse.elk.interactive" , func () bool { return false })
OmitNodeMicroLayout = graph .PropertyWithDefault ("org.eclipse.elk.omitNodeMicroLayout" , func () bool { return false })
EdgeLabelsInline = graph .PropertyWithDefault ("org.eclipse.elk.edgeLabels.inline" , func () bool { return false })
NodeSizeFixedGraphSize = graph .PropertyWithDefault ("org.eclipse.elk.nodeSize.fixedGraphSize" , func () bool { return false })
Padding = graph .CloneablePropertyWithDefault ("org.eclipse.elk.padding" , func () geometry .Spacing {
return geometry .UniformSpacing (50 )
})
)
func RegisterOptions (registry *core .OptionRegistry ) {
options := []core .OptionData {
{ID : Model .ID , Kind : core .EnumOption , Targets : core .Parents , EnumValues : []string {ModelEades , ModelFruchtermanReingold }},
{ID : Iterations .ID , Kind : core .IntegerOption , Targets : core .Parents },
{ID : RepulsivePower .ID , Kind : core .IntegerOption , Targets : core .Edges },
{ID : Temperature .ID , Kind : core .DoubleOption , Targets : core .Parents },
{ID : Repulsion .ID , Kind : core .DoubleOption , Targets : core .Parents },
{ID : Priority .ID , Kind : core .IntegerOption , Targets : core .Nodes | core .Edges },
{ID : SpacingNodeNode .ID , Kind : core .DoubleOption , Targets : core .Parents },
{ID : SpacingEdgeLabel .ID , Kind : core .DoubleOption , Targets : core .Parents },
{ID : AspectRatio .ID , Kind : core .DoubleOption , Targets : core .Parents },
{ID : RandomSeed .ID , Kind : core .IntegerOption , Targets : core .Parents },
{ID : SeparateConnectedComponents .ID , Kind : core .BooleanOption , Targets : core .Parents },
{ID : Interactive .ID , Kind : core .BooleanOption , Targets : core .Parents },
{ID : OmitNodeMicroLayout .ID , Kind : core .BooleanOption , Targets : core .Parents },
{ID : NodeSizeFixedGraphSize .ID , Kind : core .BooleanOption , Targets : core .Parents },
}
for _ , option := range options {
if registry .ByID (option .ID ) == nil {
if err := registry .Register (option ); err != nil {
panic (err )
}
}
}
}
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 .