heavyfishdesign: github.com/dustismo/heavyfishdesign/dom Index | Files

package dom

import "github.com/dustismo/heavyfishdesign/dom"

Index

Package Files

app_context.go common.go document.go draw_component.go expression_eval.go group_component.go lathe_part_transformer.go models.go param_lookup.go part.go part_splitter.go part_transform_factories.go planset.go render_context.go repeat_component.go svg_renderer.go transform_factories.go

Variables

var Inches = Units{
    "Inches", "in",
}

func ComponentsToDynMap Uses

func ComponentsToDynMap(c []Component) []*dynmap.DynMap

Converts a list of components to the list of DynMaps

func EvalExpression Uses

func EvalExpression(expression string, element Element) (interface{}, error)

func InchToMM Uses

func InchToMM(inch float64) float64

func MMToInch Uses

func MMToInch(mm float64) float64

func ParseToHFDMap Uses

func ParseToHFDMap(raw string, logger *util.HfdLog) (*dynmap.DynMap, error)

parses to an HFDMap. This should be used instead of parse json directly as we may want to change the encoding in the future.

type Attr Uses

type Attr struct {
    // contains filtered or unexported fields
}

Attributes should be local to the component Referenced params will get looked up through the stack, but it is expected that the attributes are available at the component level.

func NewAttr Uses

func NewAttr(e Element, mp *dynmap.DynMap) *Attr

func NewAttrElement Uses

func NewAttrElement(e Element) *Attr

func (*Attr) Bool Uses

func (b *Attr) Bool(param string) (bool, bool)

func (*Attr) Float64 Uses

func (b *Attr) Float64(param string) (float64, bool)

func (*Attr) Handle Uses

func (b *Attr) Handle(param string) (path.PathAttr, bool)

func (*Attr) Int Uses

func (b *Attr) Int(param string) (int, bool)

func (*Attr) MustBool Uses

func (b *Attr) MustBool(param string, def bool) bool

func (*Attr) MustFloat64 Uses

func (b *Attr) MustFloat64(param string, def float64) float64

func (*Attr) MustHandle Uses

func (b *Attr) MustHandle(param string, def path.PathAttr) path.PathAttr

func (*Attr) MustInt Uses

func (b *Attr) MustInt(param string, def int) int

func (*Attr) MustPoint Uses

func (b *Attr) MustPoint(param string, def path.Point) path.Point

func (*Attr) MustPoint2 Uses

func (b *Attr) MustPoint2(param string, from path.Point, def path.Point) path.Point

func (*Attr) MustString Uses

func (b *Attr) MustString(param string, def string) string

func (*Attr) Point Uses

func (b *Attr) Point(param string) (path.Point, bool)

func (*Attr) Point2 Uses

func (b *Attr) Point2(param string, from path.Point) (path.Point, bool)

Returns a Point either by x + y coords or by angle + length

func (*Attr) String Uses

func (b *Attr) String(param string) (string, bool)

func (*Attr) SvgString Uses

func (b *Attr) SvgString(param string) (string, bool)

func (*Attr) ToPoint Uses

func (b *Attr) ToPoint(v interface{}) (path.Point, bool)

attempt to coerce into a point

type BasicComponent Uses

type BasicComponent struct {
    // contains filtered or unexported fields
}

provides most of the component functionality Note we copy pasta the BAsicElement here because embedding does not work for the param lookup pieces

func (*BasicComponent) Attr Uses

func (b *BasicComponent) Attr() *Attr

returns an attribute finder based on the the original map of this element

func (*BasicComponent) Children Uses

func (b *BasicComponent) Children() []Element

func (*BasicComponent) Defaults Uses

func (b *BasicComponent) Defaults() *dynmap.DynMap

func (*BasicComponent) DmAttr Uses

func (b *BasicComponent) DmAttr(mp *dynmap.DynMap) *Attr

returns an attribute finder based on the passed in dynmap

func (*BasicComponent) ElementType Uses

func (b *BasicComponent) ElementType() string

func (*BasicComponent) HandleTransforms Uses

func (b *BasicComponent) HandleTransforms(self Component, pth path.Path, ctx RenderContext) (path.Path, RenderContext, error)

internal method to handle the transforms

func (*BasicComponent) Id Uses

func (b *BasicComponent) Id() string

func (*BasicComponent) Measure Uses

func (b *BasicComponent) Measure() (float64, float64, error)

measure this component returns w, h Note: this typical calls render, so care should be taken when calling this

func (*BasicComponent) ParamLookerUpper Uses

func (b *BasicComponent) ParamLookerUpper() ParamLookerUpper

func (*BasicComponent) Params Uses

func (b *BasicComponent) Params() *dynmap.DynMap

func (*BasicComponent) Parent Uses

func (b *BasicComponent) Parent() Element

func (*BasicComponent) Render Uses

func (b *BasicComponent) Render(ctx RenderContext) (path.Path, RenderContext, error)

Render the path. This is typically called by the owning element, which handles the transforms

func (*BasicComponent) RenderContext Uses

func (b *BasicComponent) RenderContext() (RenderContext, bool)

func (*BasicComponent) RenderStart Uses

func (b *BasicComponent) RenderStart(ctx RenderContext)

func (*BasicComponent) SetChildren Uses

func (b *BasicComponent) SetChildren(c []Element)

func (*BasicComponent) SetComponents Uses

func (b *BasicComponent) SetComponents(c []Component)

sets the children componenets

func (*BasicComponent) SetGlobalVariable Uses

func (b *BasicComponent) SetGlobalVariable(key string, val interface{})

Sets a global variable available to all components rendered after this

func (*BasicComponent) SetLocalVariable Uses

func (b *BasicComponent) SetLocalVariable(key string, val interface{})

sets a parameter available to this component and all of its children

func (*BasicComponent) SetParent Uses

func (b *BasicComponent) SetParent(p Element)

func (*BasicComponent) ToDynMap Uses

func (b *BasicComponent) ToDynMap() *dynmap.DynMap

func (*BasicComponent) Transforms Uses

func (b *BasicComponent) Transforms() []*dynmap.DynMap

type BasicElement Uses

type BasicElement struct {
    // contains filtered or unexported fields
}

func (*BasicElement) Attr Uses

func (b *BasicElement) Attr() *Attr

returns an attribute finder based on the the original map of this element

func (*BasicElement) Defaults Uses

func (b *BasicElement) Defaults() *dynmap.DynMap

func (*BasicElement) DmAttr Uses

func (b *BasicElement) DmAttr(mp *dynmap.DynMap) *Attr

returns an attribute finder based on the passed in dynmap

func (*BasicElement) ElementType Uses

func (b *BasicElement) ElementType() string

func (*BasicElement) Id Uses

func (b *BasicElement) Id() string

func (*BasicElement) ParamLookerUpper Uses

func (b *BasicElement) ParamLookerUpper() ParamLookerUpper

func (*BasicElement) Params Uses

func (b *BasicElement) Params() *dynmap.DynMap

func (*BasicElement) SetGlobalVariable Uses

func (b *BasicElement) SetGlobalVariable(key string, val interface{})

Sets a global variable available to all components rendered after this

func (*BasicElement) SetLocalVariable Uses

func (b *BasicElement) SetLocalVariable(key string, val interface{})

sets a parameter available to this component and all of its children

func (*BasicElement) ToDynMap Uses

func (b *BasicElement) ToDynMap() *dynmap.DynMap

type BasicParamLookerUpper Uses

type BasicParamLookerUpper struct {
    // contains filtered or unexported fields
}

func (*BasicParamLookerUpper) Float64 Uses

func (p *BasicParamLookerUpper) Float64(param string) (float64, bool)

func (*BasicParamLookerUpper) Lookup Uses

func (p *BasicParamLookerUpper) Lookup(param string) (interface{}, bool)

func (*BasicParamLookerUpper) MustFloat64 Uses

func (p *BasicParamLookerUpper) MustFloat64(param string, def float64) float64

func (*BasicParamLookerUpper) MustString Uses

func (p *BasicParamLookerUpper) MustString(param string, def string) string

func (*BasicParamLookerUpper) String Uses

func (p *BasicParamLookerUpper) String(param string) (string, bool)

func (*BasicParamLookerUpper) ToFloat64 Uses

func (p *BasicParamLookerUpper) ToFloat64(obj interface{}) (float64, error)

converts the given object

type CleanupTransformFactory Uses

type CleanupTransformFactory struct {
}

func (CleanupTransformFactory) CreateTransform Uses

func (cf CleanupTransformFactory) CreateTransform(transformType string, dm *dynmap.DynMap, element Element) (path.PathTransform, error)

func (CleanupTransformFactory) TransformTypes Uses

func (cf CleanupTransformFactory) TransformTypes() []string

// The list of component types this Factory should be used for

type Component Uses

type Component interface {
    Element
    // Render the path.  This is typically called by the
    // owning element, which handles the transforms
    // Note that Render should not be ever considered threadsafe
    // and should never be called concurrently
    Render(ctx RenderContext) (path.Path, RenderContext, error)

    // If rendering is currently in progress, this should return the
    // current context
    RenderContext() (RenderContext, bool)

    Transforms() []*dynmap.DynMap
    Parent() Element
    SetParent(element Element)
    // measure this component
    // returns w, h
    // Note: this typical calls render, so care should be taken when calling this
    Measure() (float64, float64, error)
    Children() []Element
}

type ComponentFactory Uses

type ComponentFactory interface {
    CreateComponent(componentType string, dm *dynmap.DynMap, dc *DocumentContext) (Component, error)
    // The list of component types this Factory should be used for
    ComponentTypes() []string
}

type Document Uses

type Document struct {
    *BasicElement
    ElementsByID map[string]Element
    Parts        []*Part
    Context      *DocumentContext
}

top level document, has multiple parts

func ParseDocument Uses

func ParseDocument(dm *dynmap.DynMap, logger *util.HfdLog) (*Document, error)

func ParseDocumentFromJson Uses

func ParseDocumentFromJson(json string, logger *util.HfdLog) (*Document, error)

func ParseDocumentFromPath Uses

func ParseDocumentFromPath(path string, logger *util.HfdLog) (*Document, error)

func (*Document) AllElements Uses

func (d *Document) AllElements() []Element

all the elements that this document contains.

func (*Document) FindElementByID Uses

func (d *Document) FindElementByID(id string) (Element, bool)

func (*Document) FindPartByID Uses

func (d *Document) FindPartByID(id string) (*Part, bool)

type DocumentContext Uses

type DocumentContext struct {
    Params *dynmap.DynMap
    // contains filtered or unexported fields
}

func FindDocumentContext Uses

func FindDocumentContext(c Element) *DocumentContext

returns the document context of the owning document. or nil

func (*DocumentContext) CreateCustomComponent Uses

func (dc *DocumentContext) CreateCustomComponent(componentType string, dm *dynmap.DynMap) (Component, bool, error)

Creates a custom component if possible returns nil, false, nil if there is no custom component available with that type

type DocumentParser Uses

type DocumentParser interface {
    Parse(bytes []byte, logger *util.HfdLog) (*Document, error)
}

type DrawComponent Uses

type DrawComponent struct {
    *BasicComponent
    // contains filtered or unexported fields
}

func (*DrawComponent) Render Uses

func (dc *DrawComponent) Render(ctx RenderContext) (path.Path, RenderContext, error)

type DrawComponentFactory Uses

type DrawComponentFactory struct{}

func (DrawComponentFactory) ComponentTypes Uses

func (dcf DrawComponentFactory) ComponentTypes() []string

The list of component types this Factory should be used for

func (DrawComponentFactory) CreateComponent Uses

func (dcf DrawComponentFactory) CreateComponent(componentType string, dm *dynmap.DynMap, dc *DocumentContext) (Component, error)

type DynMapParamLookerUpper Uses

type DynMapParamLookerUpper struct {
    *dynmap.DynMap
}

a lookerupper based on a single dynmap. mostly useful for tests

func (*DynMapParamLookerUpper) Float64 Uses

func (p *DynMapParamLookerUpper) Float64(param string) (float64, bool)

func (*DynMapParamLookerUpper) Lookup Uses

func (p *DynMapParamLookerUpper) Lookup(param string) (interface{}, bool)

func (*DynMapParamLookerUpper) String Uses

func (p *DynMapParamLookerUpper) String(param string) (string, bool)

func (*DynMapParamLookerUpper) ToFloat64 Uses

func (p *DynMapParamLookerUpper) ToFloat64(value interface{}) (float64, error)

type Element Uses

type Element interface {
    // The id of this element.
    // note: this should be guarenteed to be set
    Id() string
    ElementType() string

    ToDynMap() *dynmap.DynMap

    // The defaults for this element.
    // Defaults should be accessed LAST, after the entire
    // graph has been searched for the value.
    // Note - defaults currently have limited use, since they
    // are not used when evaluating expressions
    Defaults() *dynmap.DynMap
    // @Deprecated
    Params() *dynmap.DynMap

    SetLocalVariable(key string, val interface{})
    SetGlobalVariable(key string, val interface{})

    // Looks up values in the params map, if no value is found
    // this should recursively search parent elements until
    // it is found
    ParamLookerUpper() ParamLookerUpper
}

func CtoE Uses

func CtoE(components []Component) []Element

Array of components to an array of elements

func FindElementByID Uses

func FindElementByID(id string, element Element) (Element, error)

type Factories Uses

type Factories struct {
    // contains filtered or unexported fields
}

func AppContext Uses

func AppContext() *Factories

Constructs a Factories instance with the components and transforms we know about..

func (*Factories) AddComponentFactory Uses

func (c *Factories) AddComponentFactory(cf ComponentFactory)

func (*Factories) AddPartTransformerFactory Uses

func (c *Factories) AddPartTransformerFactory(tf PartTransformerFactory)

func (*Factories) AddTransformFactory Uses

func (c *Factories) AddTransformFactory(tf TransformFactory)

func (*Factories) DocumentParser Uses

func (c *Factories) DocumentParser() DocumentParser

func (*Factories) FileLoader Uses

func (c *Factories) FileLoader() FileLoader

func (*Factories) Init Uses

func (c *Factories) Init(componentFactories []ComponentFactory,
    transformFactories []TransformFactory,
    partTransformerFactories []PartTransformerFactory,
    segOps path.SegmentOperators,
    documentParser DocumentParser,
    fileLoader FileLoader,
    svgParser SVGParser,
)

func (*Factories) MakeBasicComponent Uses

func (c *Factories) MakeBasicComponent(dm *dynmap.DynMap) *BasicComponent

func (*Factories) MakeBasicElement Uses

func (c *Factories) MakeBasicElement(dm *dynmap.DynMap) *BasicElement

func (*Factories) MakeComponent Uses

func (c *Factories) MakeComponent(dm *dynmap.DynMap, dc *DocumentContext) (Component, error)

Makes a component from the DynMap, there must be a field called "type"

func (*Factories) MakeComponents Uses

func (c *Factories) MakeComponents(dm []*dynmap.DynMap, dc *DocumentContext) ([]Component, error)

func (*Factories) MakePartTransformer Uses

func (c *Factories) MakePartTransformer(transformType string, dm *dynmap.DynMap, part *Part) (PartTransformer, error)

func (*Factories) MakePartTransformers Uses

func (c *Factories) MakePartTransformers(dm []*dynmap.DynMap, part *Part) ([]PartTransformer, error)

func (*Factories) MakeTransform Uses

func (c *Factories) MakeTransform(transformType string, dm *dynmap.DynMap, element Element) (path.PathTransform, error)

func (*Factories) MakeTransforms Uses

func (c *Factories) MakeTransforms(dm []*dynmap.DynMap, element Element) ([]path.PathTransform, error)

finds the transforms under the given key

func (*Factories) ParseSVG Uses

func (c *Factories) ParseSVG(svg string, logger *util.HfdLog) (path.Path, error)

func (*Factories) Precision Uses

func (c *Factories) Precision() int

func (*Factories) SegmentOperators Uses

func (c *Factories) SegmentOperators() path.SegmentOperators

func (*Factories) SetFileLoader Uses

func (c *Factories) SetFileLoader(fl FileLoader)

type FileLoader Uses

type FileLoader interface {
    LoadBytes(filename string) ([]byte, error)
}

type GroupComponent Uses

type GroupComponent struct {
    *BasicComponent
    // contains filtered or unexported fields
}

func (*GroupComponent) Children Uses

func (cc *GroupComponent) Children() []Element

func (*GroupComponent) Render Uses

func (cc *GroupComponent) Render(ctx RenderContext) (path.Path, RenderContext, error)

type GroupComponentFactory Uses

type GroupComponentFactory struct{}

func (GroupComponentFactory) ComponentTypes Uses

func (ccf GroupComponentFactory) ComponentTypes() []string

The list of component types this Factory should be used for

func (GroupComponentFactory) CreateComponent Uses

func (ccf GroupComponentFactory) CreateComponent(componentType string, mp *dynmap.DynMap, dc *DocumentContext) (Component, error)

type JoinTransformFactory Uses

type JoinTransformFactory struct {
}

func (JoinTransformFactory) CreateTransform Uses

func (tf JoinTransformFactory) CreateTransform(transformType string, dm *dynmap.DynMap, element Element) (path.PathTransform, error)

func (JoinTransformFactory) TransformTypes Uses

func (cf JoinTransformFactory) TransformTypes() []string

// The list of component types this Factory should be used for

type Label Uses

type Label struct {
    Text     string
    Position path.PathAttr
}

type LathePartTransform Uses

type LathePartTransform struct {
    // contains filtered or unexported fields
}

func (*LathePartTransform) TransformPart Uses

func (lpt *LathePartTransform) TransformPart(part *RenderedPart, ctx RenderContext) ([]*RenderedPart, error)

type MatrixTransformFactory Uses

type MatrixTransformFactory struct {
    Values []float64
}

func (MatrixTransformFactory) CreateTransform Uses

func (tf MatrixTransformFactory) CreateTransform(transformType string, dm *dynmap.DynMap, element Element) (path.PathTransform, error)

func (MatrixTransformFactory) TransformTypes Uses

func (tf MatrixTransformFactory) TransformTypes() []string

// The list of component types this Factory should be used for

type MirrorTransformFactory Uses

type MirrorTransformFactory struct {
    Axis transforms.Axis
}

func (MirrorTransformFactory) CreateTransform Uses

func (tf MirrorTransformFactory) CreateTransform(transformType string, dm *dynmap.DynMap, element Element) (path.PathTransform, error)

func (MirrorTransformFactory) TransformTypes Uses

func (tf MirrorTransformFactory) TransformTypes() []string

// The list of component types this Factory should be used for

type MoveTransformFactory Uses

type MoveTransformFactory struct {
}

func (MoveTransformFactory) CreateTransform Uses

func (tf MoveTransformFactory) CreateTransform(transformType string, dm *dynmap.DynMap, element Element) (path.PathTransform, error)

func (MoveTransformFactory) TransformTypes Uses

func (tf MoveTransformFactory) TransformTypes() []string

// The list of component types this Factory should be used for

type OffsetTransformFactory Uses

type OffsetTransformFactory struct {
}

func (OffsetTransformFactory) CreateTransform Uses

func (tf OffsetTransformFactory) CreateTransform(transformType string, dm *dynmap.DynMap, element Element) (path.PathTransform, error)

func (OffsetTransformFactory) TransformTypes Uses

func (tf OffsetTransformFactory) TransformTypes() []string

// The list of component types this Factory should be used for

type OversizeStrategy Uses

type OversizeStrategy int32

What to do when a rendered piece is too big for the document?

const (
    // break the piece using the specified CutLine
    Split OversizeStrategy = 0
    // leave the document the same size but spill off the edge
    Spill OversizeStrategy = 1
)

type ParamLookerUpper Uses

type ParamLookerUpper interface {
    Lookup(param string) (interface{}, bool)
    // attempt to convert the given object to a float.
    // if this is a number than that will be returned
    // if it is a string, the string will be evaluated
    ToFloat64(value interface{}) (float64, error)
    MustString(param string, def string) string
    String(param string) (string, bool)
    MustFloat64(param string, def float64) float64
    Float64(param string) (float64, bool)
}

type Part Uses

type Part struct {
    *BasicComponent
    PartTransformers []PartTransformer
}

individual part (like a box face) Each part should have its own 0,0 base coordinate system.

func (*Part) Document Uses

func (p *Part) Document() *Document

gets the owning document

func (*Part) Render Uses

func (p *Part) Render(ctx RenderContext) (path.Path, RenderContext, error)

render a single part. This satisfies the Component interface, typically RenderPart should be used instead as that will honor the repeats or splits

func (*Part) RenderPart Uses

func (p *Part) RenderPart(ctx RenderContext) ([]*RenderedPart, error)

type PartFactory Uses

type PartFactory struct{}

since Part is also a component we use a factory for it

func (PartFactory) ComponentTypes Uses

func (pf PartFactory) ComponentTypes() []string

The list of component types this Factory should be used for

func (PartFactory) CreateComponent Uses

func (pf PartFactory) CreateComponent(componentType string, mp *dynmap.DynMap, dc *DocumentContext) (Component, error)

type PartLatheTransformerFactory Uses

type PartLatheTransformerFactory struct{}

func (PartLatheTransformerFactory) CreateTransformer Uses

func (pf PartLatheTransformerFactory) CreateTransformer(transformType string, dm *dynmap.DynMap, part *Part) (PartTransformer, error)

func (PartLatheTransformerFactory) TransformerTypes Uses

func (cf PartLatheTransformerFactory) TransformerTypes() []string

// The list of component types this Factory should be used for

type PartSplitter Uses

type PartSplitter struct {
    // contains filtered or unexported fields
}

func (*PartSplitter) TransformPart Uses

func (ps *PartSplitter) TransformPart(part *RenderedPart, ctx RenderContext) ([]*RenderedPart, error)

type PartSplitterTransformerFactory Uses

type PartSplitterTransformerFactory struct{}

func (PartSplitterTransformerFactory) CreateTransformer Uses

func (pf PartSplitterTransformerFactory) CreateTransformer(transformType string, dm *dynmap.DynMap, part *Part) (PartTransformer, error)

func (PartSplitterTransformerFactory) TransformerTypes Uses

func (cf PartSplitterTransformerFactory) TransformerTypes() []string

// The list of component types this Factory should be used for

type PartTransformer Uses

type PartTransformer interface {
    TransformPart(part *RenderedPart, ctx RenderContext) ([]*RenderedPart, error)
}

type PartTransformerFactory Uses

type PartTransformerFactory interface {
    CreateTransformer(transformType string, dm *dynmap.DynMap, part *Part) (PartTransformer, error)
    // The list of component types this Factory should be used for
    TransformerTypes() []string
}

type PlanSet Uses

type PlanSet struct {
    // contains filtered or unexported fields
}

a collection of documents as you add items this will create more documents potentially splitting items when they wont fit.

func NewPlanSet Uses

func NewPlanSet(doc *Document) *PlanSet

func (*PlanSet) Document Uses

func (p *PlanSet) Document() *Document

ONLY FOR TESTING

func (*PlanSet) Init Uses

func (p *PlanSet) Init(ctx RenderContext) error

func (*PlanSet) RenderZip Uses

func (ps *PlanSet) RenderZip(filename string, w *zip.Writer, ctx RenderContext) error

renders all the documents into the passed in zip writer

func (*PlanSet) SVGDocuments Uses

func (p *PlanSet) SVGDocuments() []*SVGDocument

type RenderContext Uses

type RenderContext struct {
    Origin path.Point
    Cursor path.Point
    Log    *util.HfdLog
}

func RepeatRender Uses

func RepeatRender(ctx RenderContext, component Component, maxX, maxY float64) (path.Path, RenderContext, error)

func (RenderContext) Clone Uses

func (c RenderContext) Clone() RenderContext

type RenderStrategy Uses

type RenderStrategy int32

What is the strategy when all the pieces don't fit in the Document?

const (
    // Render into multiple documents
    MultiDocument RenderStrategy = 0
    // Resize a single document
    // THis will scale the document in both directions
    ResizeDocument RenderStrategy = 1
)

type RenderedPart Uses

type RenderedPart struct {
    Part   *Part
    Path   path.Path
    Width  float64
    Height float64
    Label  Label
}

type ReorderTransformFactory Uses

type ReorderTransformFactory struct {
}

func (ReorderTransformFactory) CreateTransform Uses

func (tf ReorderTransformFactory) CreateTransform(transformType string, dm *dynmap.DynMap, element Element) (path.PathTransform, error)

func (ReorderTransformFactory) TransformTypes Uses

func (cf ReorderTransformFactory) TransformTypes() []string

// The list of component types this Factory should be used for

type RepeatComponent Uses

type RepeatComponent struct {
    *BasicComponent
    // contains filtered or unexported fields
}

func (*RepeatComponent) Render Uses

func (rc *RepeatComponent) Render(ctx RenderContext) (path.Path, RenderContext, error)

type RepeatComponentFactory Uses

type RepeatComponentFactory struct{}

func (RepeatComponentFactory) ComponentTypes Uses

func (rcf RepeatComponentFactory) ComponentTypes() []string

The list of component types this Factory should be used for

func (RepeatComponentFactory) CreateComponent Uses

func (rcf RepeatComponentFactory) CreateComponent(componentType string, dm *dynmap.DynMap, dc *DocumentContext) (Component, error)

type ReverseTransformFactory Uses

type ReverseTransformFactory struct {
}

func (ReverseTransformFactory) CreateTransform Uses

func (tf ReverseTransformFactory) CreateTransform(transformType string, dm *dynmap.DynMap, element Element) (path.PathTransform, error)

func (ReverseTransformFactory) TransformTypes Uses

func (cf ReverseTransformFactory) TransformTypes() []string

// The list of component types this Factory should be used for

type RotateScaleTransformFactory Uses

type RotateScaleTransformFactory struct {
}

func (RotateScaleTransformFactory) CreateTransform Uses

func (tf RotateScaleTransformFactory) CreateTransform(transformType string, dm *dynmap.DynMap, element Element) (path.PathTransform, error)

func (RotateScaleTransformFactory) TransformTypes Uses

func (tf RotateScaleTransformFactory) TransformTypes() []string

// The list of component types this Factory should be used for

type RotateTransformFactory Uses

type RotateTransformFactory struct {
}

func (RotateTransformFactory) CreateTransform Uses

func (tf RotateTransformFactory) CreateTransform(transformType string, dm *dynmap.DynMap, element Element) (path.PathTransform, error)

func (RotateTransformFactory) TransformTypes Uses

func (tf RotateTransformFactory) TransformTypes() []string

// The list of component types this Factory should be used for

type SVGDocument Uses

type SVGDocument struct {
    Name string

    // document width
    Width float64

    // document height
    Height float64

    Units Units

    // how much padding between things in the document?
    Padding float64

    // render the size into the document?
    // most cases this should be true,
    // false is useful for resizable in a browser window
    RenderSize bool

    // how many decimal places to render
    Precision int

    SegmentOperators path.SegmentOperators

    CutStyle   string
    LabelStyle string
    // contains filtered or unexported fields
}

a standard document

func NewSVGDocument Uses

func NewSVGDocument(w float64, h float64, unit Units) *SVGDocument

Creates a new document defaults to settings for .2" Lowes style plywood

func (*SVGDocument) Add Uses

func (d *SVGDocument) Add(p *RenderedPart, ctx RenderContext) (bool, error)

adds a renderable creator into this document. Returns true if it was able to fit, false otherwise.

func (*SVGDocument) Clone Uses

func (d *SVGDocument) Clone() *SVGDocument

clones this document meta data, minus any items in it TODO: do we want to clone the renderables as well?

func (*SVGDocument) Parts Uses

func (d *SVGDocument) Parts() []*Part

func (*SVGDocument) WriteSVG Uses

func (d *SVGDocument) WriteSVG(ctx RenderContext, writer io.Writer)

writes the whole svg document

type SVGParser Uses

type SVGParser interface {
    ParseSVG(svg string, logger *util.HfdLog) (path.Path, error)
}

type ScaleTransformFactory Uses

type ScaleTransformFactory struct {
}

func (ScaleTransformFactory) CreateTransform Uses

func (tf ScaleTransformFactory) CreateTransform(transformType string, dm *dynmap.DynMap, element Element) (path.PathTransform, error)

func (ScaleTransformFactory) TransformTypes Uses

func (tf ScaleTransformFactory) TransformTypes() []string

// The list of component types this Factory should be used for

type SliceTransformFactory Uses

type SliceTransformFactory struct {
}

func (SliceTransformFactory) CreateTransform Uses

func (tf SliceTransformFactory) CreateTransform(transformType string, dm *dynmap.DynMap, element Element) (path.PathTransform, error)

func (SliceTransformFactory) TransformTypes Uses

func (tf SliceTransformFactory) TransformTypes() []string

The list of component types this Factory should be used for

type TransformFactory Uses

type TransformFactory interface {
    CreateTransform(transformType string, dm *dynmap.DynMap, element Element) (path.PathTransform, error)
    // The list of component types this Factory should be used for
    TransformTypes() []string
}

type TrimTransformFactory Uses

type TrimTransformFactory struct {
}

func (TrimTransformFactory) CreateTransform Uses

func (tf TrimTransformFactory) CreateTransform(transformType string, dm *dynmap.DynMap, element Element) (path.PathTransform, error)

func (TrimTransformFactory) TransformTypes Uses

func (tf TrimTransformFactory) TransformTypes() []string

The list of component types this Factory should be used for

type Units Uses

type Units struct {
    Name string
    Abv  string
}
var MilliMeters Units = Units{
    "MilliMeters", "mm",
}

func MustUnits Uses

func MustUnits(in string, defaultUnits Units) Units

func NewUnits Uses

func NewUnits(in string) (Units, bool)

* Returns the requested units. and true. * Else returns MM, false

func (Units) FromInch Uses

func (u Units) FromInch(in float64) float64

func (Units) FromMM Uses

func (u Units) FromMM(mm float64) float64

Package dom imports 12 packages (graph) and is imported by 3 packages. Updated 2020-07-19. Refresh now. Tools for package owners.