Documentation
¶
Index ¶
- func FormatRGBA(c color.RGBA) string
- func ParseMatrix(s string) ([16]float32, bool)
- func ParseRGBA(s string) (c color.RGBA, err error)
- type AppendTokenElementDecoder
- type Attr
- type CharDataElementDecoder
- type ChildElementDecoder
- type ElementDecoder
- type Encoder
- type ErrorWrapper
- type Marshaler
- type MarshalerAttr
- type PropertyGroup
- type Relationship
- type Spec
- type UnknownAttrs
- type UnknownTokens
- type UnknownTokensDecoder
- type ValidateSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatRGBA ¶
FormatRGBA returns the color as a hex string with the format #rrggbbaa.
Types ¶
type AppendTokenElementDecoder ¶
type AppendTokenElementDecoder interface {
ElementDecoder
AppendToken(xml.Token)
}
AppendTokenElementDecoder must be implemented by element decoders that need to accumulate tokens to support loseless encoding.
type CharDataElementDecoder ¶
type CharDataElementDecoder interface {
ElementDecoder
CharData([]byte)
}
CharDataElementDecoder must be implemented by element decoders that need to decode raw text.
type ChildElementDecoder ¶
type ChildElementDecoder interface {
ElementDecoder
Child(xml.Name) ElementDecoder
}
ChildElementDecoder must be implemented by element decoders that need decoding nested elements.
type ElementDecoder ¶
ElementDecoder defines the minimum contract to decode a 3MF node.
type Encoder ¶
type Encoder interface {
AddRelationship(Relationship)
FloatPresicion() int
EncodeToken(xml.Token)
Flush() error
SetAutoClose(bool)
// Use SetSkipAttrEscape(true) when there is no need to escape
// StartElement attribute values, such as as when all attributes
// are filled using strconv.
SetSkipAttrEscape(bool)
}
Encoder provides de necessary methods to encode specs. It should not be implemented by spec authors but will be provided be go3mf itself.
type ErrorWrapper ¶
type Marshaler ¶
Marshaler is the interface implemented by objects that can marshal themselves into valid XML elements.
type MarshalerAttr ¶
MarshalerAttr is the interface implemented by objects that can marshal themselves into valid XML attributes.
type PropertyGroup ¶
type PropertyGroup interface {
Len() int
}
type Relationship ¶
type Spec ¶
type Spec interface {
DecodeAttribute(parent interface{}, attr Attr) error
CreateElementDecoder(parent interface{}, name string) ElementDecoder
}
Spec is the interface that must be implemented by a 3mf spec.
Specs may implement ValidateSpec.
type UnknownAttrs ¶
An UnknownAttrs represents a list of attributes that are not supported by any loaded Spec.
func (UnknownAttrs) Marshal3MFAttr ¶
func (u UnknownAttrs) Marshal3MFAttr(enc Encoder) ([]xml.Attr, error)
type UnknownTokens ¶
UnknownTokens represents a section of an xml that cannot be decoded by any loaded Spec.
func (UnknownTokens) Marshal3MF ¶
func (u UnknownTokens) Marshal3MF(enc Encoder) error
type UnknownTokensDecoder ¶
UnknownTokensDecoder can be used by spec decoders to maintain the xml tree elements of unknown extensions.
func (*UnknownTokensDecoder) AppendToken ¶
func (d *UnknownTokensDecoder) AppendToken(t xml.Token)
func (*UnknownTokensDecoder) End ¶
func (d *UnknownTokensDecoder) End()
func (*UnknownTokensDecoder) Start ¶
func (d *UnknownTokensDecoder) Start(attrs []Attr) error
func (UnknownTokensDecoder) Tokens ¶
func (d UnknownTokensDecoder) Tokens() UnknownTokens
type ValidateSpec ¶
type ValidateSpec interface {
Spec
Validate(model interface{}, path string, element interface{}) error
}
If a Spec implemented ValidateSpec, then model.Validate will call Validate and aggregate the resulting erros.
model is guaranteed to be a *go3mf.Model element can be a *go3mf.Model, go3mf.Asset or *go3mf.Object.