package layered
import "sort"
type Phase uint8
const (
PhaseCycleBreaking Phase = iota
PhaseLayering
PhaseNodeOrdering
PhaseNodePlacement
PhaseEdgeRouting
)
type IntermediateProcessorStrategy uint8
const (
DirectionPreprocessor IntermediateProcessorStrategy = iota
CommentPreprocessor
EdgeAndLayerConstraintEdgeReverser
InteractiveExternalPortPositioner
PartitionPreprocessor
LabelDummyInserter
SelfLoopPreprocessor
LayerConstraintPreprocessor
PartitionMidprocessor
HighDegreeNodeLayerProcessor
NodePromotion
LayerConstraintPostprocessor
PartitionPostprocessor
HierarchicalPortConstraintProcessor
SemiInteractiveCrossMinProcessor
BreakingPointInserter
LongEdgeSplitter
PortSideProcessor
InvertedPortProcessor
PortListSorter
SortByInputOrderOfModel
NorthSouthPortPreprocessor
BreakingPointProcessor
OneSidedGreedySwitch
TwoSidedGreedySwitch
SelfLoopPortRestorer
AlternatingLayerUnzipper
SingleEdgeGraphWrapper
InLayerConstraintProcessor
EndNodePortLabelManagementProcessor
LabelAndNodeSizeProcessor
InnermostNodeMarginCalculator
SelfLoopRouter
CommentNodeMarginCalculator
EndLabelPreprocessor
LabelDummySwitcher
CenterLabelManagementProcessor
LabelSideSelector
HyperedgeDummyMerger
HierarchicalPortDummySizeProcessor
NodePlacementRepeater
LayerSizeAndGraphHeightCalculator
HierarchicalPortPositionProcessor
ConstraintsPostprocessor
CommentPostprocessor
HypernodeProcessor
HierarchicalPortOrthogonalEdgeRouter
LongEdgeJoiner
SelfLoopPostprocessor
BreakingPointRemover
NorthSouthPortPostprocessor
HorizontalCompactor
LabelDummyRemover
FinalSplineBendpointsCalculator
EndLabelSorter
ReversedEdgeRestorer
EndLabelPostprocessor
HierarchicalNodeResizer
DirectionPostprocessor
)
type LayoutProcessor interface {
Process (arena *LGraphArena , graphID LGraphID ) error
}
type ConfiguredProcessor interface {
LayoutProcessor
ProcessorConfiguration (arena *LGraphArena , graphID LGraphID ) ProcessorConfiguration
}
type ProcessorConfiguration struct {
slots [6 ][]IntermediateProcessorStrategy
}
func (configuration *ProcessorConfiguration ) AddBefore (phase Phase , processor IntermediateProcessorStrategy ) *ProcessorConfiguration {
configuration .add (int (phase ), processor )
return configuration
}
func (configuration *ProcessorConfiguration ) AddAfter (phase Phase , processor IntermediateProcessorStrategy ) *ProcessorConfiguration {
configuration .add (int (phase )+1 , processor )
return configuration
}
func (configuration *ProcessorConfiguration ) AddAll (other ProcessorConfiguration ) *ProcessorConfiguration {
for slot := range other .slots {
for _ , processor := range other .slots [slot ] {
configuration .add (slot , processor )
}
}
return configuration
}
func (configuration *ProcessorConfiguration ) Slot (slot int ) []IntermediateProcessorStrategy {
return append ([]IntermediateProcessorStrategy (nil ), configuration .slots [slot ]...)
}
func (configuration *ProcessorConfiguration ) add (slot int , processor IntermediateProcessorStrategy ) {
for _ , existing := range configuration .slots [slot ] {
if existing == processor {
return
}
}
configuration .slots [slot ] = append (configuration .slots [slot ], processor )
sort .Slice (configuration .slots [slot ], func (first , second int ) bool {
return configuration .slots [slot ][first ] < configuration .slots [slot ][second ]
})
}
type PhaseStrategies struct {
CycleBreaking CycleBreakingStrategy
Layering LayeringStrategy
CrossingMinimization CrossingMinimizationStrategy
NodePlacement NodePlacementStrategy
EdgeRouting EdgeRouting
}
type PipelineConfiguration struct {
Phases PhaseStrategies
Intermediates ProcessorConfiguration
}
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 .