capigraph

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SecEdgeLabelGapFromSourceInLines     float64 = 5.0
	PriEdgeLabelGapFromDestinatioInLines float64 = 2.0

	NodeHorizontalGapInPixels float64 = 20.0
	SecEdgeOffsetX            float64 = 10
)
View Source
const CapillariesIcons100x100 = `` /* 18873-byte string literal not displayed */
View Source
const FakeNodeBase int16 = 10000
View Source
const FallbackAsciiCode int = 88 // 'X'
View Source
const LabelTextDimensionMargin float64 = 0.5
View Source
const MaxAllowedLayerPermutations int64 = 100000000
View Source
const MaxIntervalsInLayer int = 20 // Max parent nodes containing more than one child on this layer
View Source
const MaxLayerLen int = 200
View Source
const MaxNodesToInsert int = 10 // Cannot insert more than this amt of new roots at a layer
View Source
const MaxSupportedFact int = 6 // Max amount of pri children originating from a node
View Source
const MissingDistanceFromRootToNode int = -2
View Source
const MissingLayer int = -4
View Source
const MissingNodeId int16 = -1
View Source
const MissingRootSubtreeHeight int = -3
View Source
const NodeTextDimensionMargin float64 = 1.0
View Source
const NodeTextIconInterval float64 = 1.0
View Source
const SelectedNodeMargin float64 = 0.0

Variables

This section is empty.

Functions

func DefaultPalette

func DefaultPalette() []int32

func FontTypefaceToString

func FontTypefaceToString(tf FontTypeface) string

func FontWeightToString

func FontWeightToString(w FontWeight) string

Types

type EdgeDef

type EdgeDef struct {
	SrcId int16
	Text  string
}

type EdgeOptions

type EdgeOptions struct {
	StrokeWidth float64
}

func DefaultEdgeOptions

func DefaultEdgeOptions() EdgeOptions

type FontOptions

type FontOptions struct {
	Typeface     FontTypeface
	Weight       FontWeight
	SizeInPixels float64
	Interval     float64
}

func DefaultEdgeLabelFontOptions

func DefaultEdgeLabelFontOptions() FontOptions

func DefaultNodeFontOptions

func DefaultNodeFontOptions() FontOptions

type FontTypeface

type FontTypeface int
const (
	FontTypefaceArial FontTypeface = iota
	FontTypefaceCourier
	FontTypefaceVerdana
)

type FontWeight

type FontWeight int
const (
	FontWeightBold FontWeight = iota
	FontWeightNormal
)

type HierarchyType

type HierarchyType int
const (
	HierarchyPri HierarchyType = iota
	HierarchySec
)

type LayerMx

type LayerMx [][]int16

func NewLayerMx

func NewLayerMx(nodeDefs []NodeDef, nodeLayerMap []int, rootNodes []int16) (LayerMx, error)

func (LayerMx) String

func (mx LayerMx) String() string

type LayerMxPermIterator

type LayerMxPermIterator struct {
	Lps             []*LayerPermutator // We need separate permutator for each layer to preserve state when we do recursion between layers
	IntervalStarts  [][]int
	IntervalLengths [][]int
	SrcMx           LayerMx
	WorkMx          LayerMx
	PriParentMap    []int16
	PriChildrenMap  [][]int16
	NodeLayerMap    []int
	RootNodes       []int16
}

func NewLayerMxPermIterator

func NewLayerMxPermIterator(nodeDefs []NodeDef, srcMx LayerMx) (*LayerMxPermIterator, error)

func (*LayerMxPermIterator) MxIterator

func (mxi *LayerMxPermIterator) MxIterator(f func(int, LayerMx))

func (*LayerMxPermIterator) MxIteratorCount

func (mxi *LayerMxPermIterator) MxIteratorCount() int64

type LayerPermutator

type LayerPermutator struct {
	P               [][][]int // Swap permutation strategy by permIdx: [interval size 2-6][permIdx 2!-6!][positions to swap with]
	Fact            []int
	SrcPerm         []int16
	WorkPerm        []int16
	IntervalStarts  []int
	IntervalLengths []int
}

func NewLayerPermutator

func NewLayerPermutator() *LayerPermutator

func (*LayerPermutator) InsertIterator

func (lp *LayerPermutator) InsertIterator(insertSrcStart int, insertSrcLen int, in []int16, f func(int, []int16))

func (*LayerPermutator) SwapAndInsertIterator

func (lp *LayerPermutator) SwapAndInsertIterator(intervalStarts []int, intervalLengths []int, totalIntervals int, insertSrcStart int, insertSrcLen int, in []int16, f func(int, []int16))

func (*LayerPermutator) SwapIterator

func (lp *LayerPermutator) SwapIterator(intervalStarts []int, intervalLengths []int, totalIntervals int, in []int16, f func(int, []int16))

type NodeDef

type NodeDef struct {
	Id       int16
	Text     string
	PriIn    EdgeDef
	SecIn    []EdgeDef
	IconId   string
	Color    int32
	Selected bool
}

type RectDimension

type RectDimension struct {
	W float64
	H float64
}

type VizEdge

type VizEdge struct {
	Edge          EdgeDef
	HierarchyType HierarchyType
	X             float64
	Y             float64
	W             float64
	H             float64
}

type VizNode

type VizNode struct {
	Def                         *NodeDef
	IncomingVizEdges            []VizEdge
	RootId                      int16
	Layer                       int
	TotalW                      float64
	X                           float64 // Total X
	Y                           float64
	NodeW                       float64
	NodeH                       float64
	PriChildrenAndEnclosedRoots []*VizNode
}

func DrawOptimized

func DrawOptimized(nodeDefs []NodeDef, nodeFo FontOptions, edgeFo FontOptions, edgeOptions EdgeOptions, defsOverride string, cssOverride string, palette []int32) (string, []VizNode, int64, float64, float64, error)

func DrawUnoptimized

func DrawUnoptimized(nodeDefs []NodeDef, nodeFo FontOptions, edgeFo FontOptions, edgeOptions EdgeOptions, defsOverride string, cssOverride string, palette []int32) (string, []VizNode, error)

func (*VizNode) String

func (vn *VizNode) String() string

type VizNodeHierarchy

type VizNodeHierarchy struct {
	VizNodeMap         []VizNode
	NodeDefs           []NodeDef
	PriParentMap       []int16
	RootMap            []int16
	NodeFo             FontOptions
	EdgeFo             FontOptions
	NodeDimensionMap   []RectDimension
	PriEdgeLabelDimMap []RectDimension
	SecEdgeLabelDimMap [][]RectDimension
	TotalLayers        int
	UpperLayerGapMap   []float64
}

func NewVizNodeHierarchy

func NewVizNodeHierarchy(nodeDefs []NodeDef, nodeFo FontOptions, edgeFo FontOptions) *VizNodeHierarchy

func (*VizNodeHierarchy) CalculateTotalHorizontalShift

func (vnh *VizNodeHierarchy) CalculateTotalHorizontalShift() float64

func (*VizNodeHierarchy) PopulateEdgeLabelCoords

func (vnh *VizNodeHierarchy) PopulateEdgeLabelCoords()

func (*VizNodeHierarchy) PopulateEdgeLabelDimensions

func (vnh *VizNodeHierarchy) PopulateEdgeLabelDimensions()

Merely copies pre-calculated edge label dimensions to the hierarchy vizitems

func (*VizNodeHierarchy) PopulateNodeTotalWidth

func (vnh *VizNodeHierarchy) PopulateNodeTotalWidth()

func (*VizNodeHierarchy) PopulateNodesXCoords

func (vnh *VizNodeHierarchy) PopulateNodesXCoords()

func (*VizNodeHierarchy) PopulateNodesYCoords

func (vnh *VizNodeHierarchy) PopulateNodesYCoords()

func (*VizNodeHierarchy) PopulateUpperLayerGapMap

func (vnh *VizNodeHierarchy) PopulateUpperLayerGapMap(edgeFontSizeInPixels float64)

func (*VizNodeHierarchy) RemoveDuplicateSecEdgeLabels

func (vnh *VizNodeHierarchy) RemoveDuplicateSecEdgeLabels()

func (*VizNodeHierarchy) String

func (vnh *VizNodeHierarchy) String() string

Jump to

Keyboard shortcuts

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