layer

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInitializationInfobox      = errors.New("infobox")
	ErrInitializationInfoboxWith  = rerror.With(ErrInitializationInfobox)
	ErrInitializationProperty     = errors.New("property")
	ErrInitializationPropertyWith = rerror.With(ErrInitializationProperty)
)
View Source
var (
	ErrDuplicatedTag = errors.New("duplicated tag")
	ErrTagNotFound   = errors.New("tag not found")
)
View Source
var WalkerSkipChildren = errors.New("LAYER_WALKER_SKIP_CHILDREN")

Functions

This section is empty.

Types

type Builder

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

func New

func New() *Builder

func (*Builder) Extension

func (b *Builder) Extension(extension *id.PluginExtensionID) *Builder

func (*Builder) Group

func (b *Builder) Group() *GroupBuilder

func (*Builder) ID

func (b *Builder) ID(id id.LayerID) *Builder

func (*Builder) Infobox

func (b *Builder) Infobox(infobox *Infobox) *Builder

func (*Builder) IsVisible

func (b *Builder) IsVisible(visible bool) *Builder

func (*Builder) IsVisibleRef

func (b *Builder) IsVisibleRef(visible *bool) *Builder

func (*Builder) Item

func (b *Builder) Item() *ItemBuilder

func (*Builder) Name

func (b *Builder) Name(name string) *Builder

func (*Builder) NewID

func (b *Builder) NewID() *Builder

func (*Builder) Plugin

func (b *Builder) Plugin(plugin *id.PluginID) *Builder

func (*Builder) Property

func (b *Builder) Property(p *id.PropertyID) *Builder

func (*Builder) Scene

func (b *Builder) Scene(s id.SceneID) *Builder

func (*Builder) Tags

func (b *Builder) Tags(tags *tag.List) *Builder

type Group

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

func GroupFromLayer

func GroupFromLayer(l Layer) *Group

func GroupFromLayerRef

func GroupFromLayerRef(l *Layer) *Group

func ToLayerGroup

func ToLayerGroup(l Layer) *Group

func ToLayerGroupRef

func ToLayerGroupRef(l *Layer) *Group

func (*Group) AttachTag

func (l *Group) AttachTag(t id.TagID) error

func (*Group) DetachTag

func (l *Group) DetachTag(t id.TagID) error

func (*Group) Extension

func (l *Group) Extension() *id.PluginExtensionID

func (*Group) HasInfobox

func (l *Group) HasInfobox() bool

func (*Group) ID

func (l *Group) ID() id.LayerID

func (*Group) IDRef

func (l *Group) IDRef() *id.LayerID

func (*Group) Infobox

func (l *Group) Infobox() *Infobox

func (*Group) IsLinked

func (l *Group) IsLinked() bool

func (*Group) IsRoot

func (l *Group) IsRoot() bool

func (*Group) IsVisible

func (l *Group) IsVisible() bool

func (*Group) LayerRef

func (l *Group) LayerRef() *Layer

func (*Group) Layers

func (l *Group) Layers() *IDList
func (l *Group) Link(ds id.DatasetSchemaID)

func (*Group) LinkedDatasetSchema

func (l *Group) LinkedDatasetSchema() *id.DatasetSchemaID

func (*Group) MoveLayerFrom

func (l *Group) MoveLayerFrom(id id.LayerID, index int, fromLayerGroup *Group)

func (*Group) Name

func (l *Group) Name() string

func (*Group) Plugin

func (l *Group) Plugin() *id.PluginID

func (*Group) Properties

func (l *Group) Properties() []id.PropertyID

func (*Group) Property

func (l *Group) Property() *id.PropertyID

func (*Group) Rename

func (l *Group) Rename(name string)

func (*Group) Scene

func (l *Group) Scene() id.SceneID

func (*Group) SetInfobox

func (l *Group) SetInfobox(infobox *Infobox)

func (*Group) SetPlugin

func (l *Group) SetPlugin(plugin *id.PluginID)

func (*Group) SetVisible

func (l *Group) SetVisible(visible bool)

func (*Group) Tags

func (l *Group) Tags() *tag.List
func (l *Group) Unlink()

func (*Group) UsesPlugin

func (l *Group) UsesPlugin() bool

func (*Group) ValidateProperties

func (l *Group) ValidateProperties(pm property.Map) error

type GroupBuilder

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

func NewGroup

func NewGroup() *GroupBuilder

func (*GroupBuilder) Build

func (b *GroupBuilder) Build() (*Group, error)

func (*GroupBuilder) Extension

func (b *GroupBuilder) Extension(extension *id.PluginExtensionID) *GroupBuilder

func (*GroupBuilder) ID

func (b *GroupBuilder) ID(id id.LayerID) *GroupBuilder

func (*GroupBuilder) Infobox

func (b *GroupBuilder) Infobox(infobox *Infobox) *GroupBuilder

func (*GroupBuilder) IsVisible

func (b *GroupBuilder) IsVisible(visible bool) *GroupBuilder

func (*GroupBuilder) Layers

func (b *GroupBuilder) Layers(ll *IDList) *GroupBuilder

func (*GroupBuilder) LinkedDatasetSchema

func (b *GroupBuilder) LinkedDatasetSchema(linkedDatasetSchema *id.DatasetSchemaID) *GroupBuilder

func (*GroupBuilder) MustBuild

func (b *GroupBuilder) MustBuild() *Group

func (*GroupBuilder) Name

func (b *GroupBuilder) Name(name string) *GroupBuilder

func (*GroupBuilder) NewID

func (b *GroupBuilder) NewID() *GroupBuilder

func (*GroupBuilder) Plugin

func (b *GroupBuilder) Plugin(plugin *id.PluginID) *GroupBuilder

func (*GroupBuilder) Property

func (b *GroupBuilder) Property(property *id.PropertyID) *GroupBuilder

func (*GroupBuilder) Root

func (b *GroupBuilder) Root(root bool) *GroupBuilder

func (*GroupBuilder) Scene

func (b *GroupBuilder) Scene(s id.SceneID) *GroupBuilder

func (*GroupBuilder) Tags

func (b *GroupBuilder) Tags(tags *tag.List) *GroupBuilder

type GroupList

type GroupList []*Group

func (GroupList) Last

func (ll GroupList) Last() *Group

func (GroupList) ToLayerList

func (ll GroupList) ToLayerList() List

type IDList

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

IDList _

func NewIDList

func NewIDList(layers []id.LayerID) *IDList

NewIDList _

func (*IDList) AddLayer

func (l *IDList) AddLayer(lid id.LayerID, index int)

AddLayer _

func (*IDList) AddOrMoveLayer

func (l *IDList) AddOrMoveLayer(lid id.LayerID, index int)

AddOrMoveLayer _

func (*IDList) AppendLayers

func (l *IDList) AppendLayers(lid ...id.LayerID) *IDList

AppendLayers _

func (*IDList) AtRef

func (l *IDList) AtRef(index int) *id.LayerID

func (*IDList) Clone

func (l *IDList) Clone() (l2 *IDList)

func (*IDList) Empty

func (l *IDList) Empty()

Empty _

func (*IDList) FindLayerIndex

func (l *IDList) FindLayerIndex(id id.LayerID) int

FindLayerIndex _

func (*IDList) HasLayer

func (l *IDList) HasLayer(id id.LayerID) bool

HasLayer _

func (*IDList) LayerAt

func (l *IDList) LayerAt(index int) id.LayerID

LayerAt _

func (*IDList) LayerCount

func (l *IDList) LayerCount() int

LayerCount _

func (*IDList) Layers

func (l *IDList) Layers() []id.LayerID

Layers _

func (*IDList) Merge

func (l *IDList) Merge(l2 *IDList)

func (*IDList) MoveLayer

func (l *IDList) MoveLayer(id id.LayerID, toIndex int)

MoveLayer _

func (*IDList) MoveLayerAt

func (l *IDList) MoveLayerAt(fromIndex int, toIndex int)

MoveLayerAt _

func (*IDList) RemoveLayer

func (l *IDList) RemoveLayer(id id.LayerID)

RemoveLayer _

func (*IDList) RemoveLayerAt

func (l *IDList) RemoveLayerAt(index int)

RemoveLayerAt _

type Infobox

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

func NewInfobox

func NewInfobox(fields []*InfoboxField, p id.PropertyID) *Infobox

func (*Infobox) Add

func (i *Infobox) Add(field *InfoboxField, index int)

func (*Infobox) Count

func (i *Infobox) Count() int

func (*Infobox) Field

func (i *Infobox) Field(field id.InfoboxFieldID) *InfoboxField

func (*Infobox) FieldAt

func (i *Infobox) FieldAt(index int) *InfoboxField

func (*Infobox) Fields

func (i *Infobox) Fields() []*InfoboxField

func (*Infobox) Has

func (i *Infobox) Has(id id.InfoboxFieldID) bool

func (*Infobox) Move

func (i *Infobox) Move(field id.InfoboxFieldID, toIndex int)

func (*Infobox) MoveAt

func (i *Infobox) MoveAt(fromIndex int, toIndex int)

func (*Infobox) Property

func (i *Infobox) Property() id.PropertyID

func (*Infobox) PropertyRef

func (i *Infobox) PropertyRef() *id.PropertyID

func (*Infobox) Remove

func (i *Infobox) Remove(field id.InfoboxFieldID)

func (*Infobox) RemoveAllByPlugin

func (i *Infobox) RemoveAllByPlugin(pid id.PluginID) []id.PropertyID

func (*Infobox) RemoveAt

func (i *Infobox) RemoveAt(index int)

func (*Infobox) ValidateProperties

func (i *Infobox) ValidateProperties(pm property.Map) error

type InfoboxField

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

func (*InfoboxField) Extension

func (i *InfoboxField) Extension() id.PluginExtensionID

func (*InfoboxField) ID

func (i *InfoboxField) ID() id.InfoboxFieldID

func (*InfoboxField) Plugin

func (i *InfoboxField) Plugin() id.PluginID

func (*InfoboxField) Property

func (i *InfoboxField) Property() id.PropertyID

func (*InfoboxField) PropertyRef

func (i *InfoboxField) PropertyRef() *id.PropertyID

func (*InfoboxField) ValidateProperty

func (i *InfoboxField) ValidateProperty(pm property.Map) error

type InfoboxFieldBuilder

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

InfoboxFieldBuilder _

func NewInfoboxField

func NewInfoboxField() *InfoboxFieldBuilder

func (*InfoboxFieldBuilder) Build

func (b *InfoboxFieldBuilder) Build() (*InfoboxField, error)

func (*InfoboxFieldBuilder) Extension

func (*InfoboxFieldBuilder) ID

func (*InfoboxFieldBuilder) MustBuild

func (b *InfoboxFieldBuilder) MustBuild() *InfoboxField

func (*InfoboxFieldBuilder) NewID

func (*InfoboxFieldBuilder) Plugin

func (*InfoboxFieldBuilder) Property

type Initializer

type Initializer struct {
	ID                  *id.LayerID           `json:"id"`
	Plugin              *id.PluginID          `json:"plugin"`
	Extension           *id.PluginExtensionID `json:"extension"`
	Name                string                `json:"name"`
	Infobox             *InitializerInfobox   `json:"infobox"`
	PropertyID          *id.PropertyID        `json:"propertyId"`
	Property            *property.Initializer `json:"property"`
	Layers              []*Initializer        `json:"layers"`
	LayerIDs            []id.LayerID          `json:"layerIds"`
	IsVisible           *bool                 `json:"isVisible"`
	LinkedDatasetSchema *id.DatasetSchemaID   `json:"linkedDatasetSchema"`
	LinkedDataset       *id.DatasetID         `json:"linkedDataset"`
}

func (*Initializer) Clone

func (i *Initializer) Clone() *Initializer

func (*Initializer) Layer

func (i *Initializer) Layer(sid id.SceneID) (r InitializerResult, err error)

func (*Initializer) MustBeLayer

func (i *Initializer) MustBeLayer(sid id.SceneID) InitializerResult

type InitializerInfobox

type InitializerInfobox struct {
	PropertyID *id.PropertyID             `json:"propertyId"`
	Property   *property.Initializer      `json:"property"`
	Fields     []*InitializerInfoboxField `json:"fields"`
}

func (*InitializerInfobox) Clone

func (*InitializerInfobox) Infobox

func (i *InitializerInfobox) Infobox(scene id.SceneID) (*Infobox, property.Map, error)

type InitializerInfoboxField

type InitializerInfoboxField struct {
	ID         *id.InfoboxFieldID    `json:"id"`
	Plugin     id.PluginID           `json:"plugin"`
	Extension  id.PluginExtensionID  `json:"extension"`
	PropertyID *id.PropertyID        `json:"propertyId"`
	Property   *property.Initializer `json:"property"`
}

func (*InitializerInfoboxField) Clone

func (*InitializerInfoboxField) InfoboxField

func (i *InitializerInfoboxField) InfoboxField(scene id.SceneID) (*InfoboxField, *property.Property, error)

type InitializerResult

type InitializerResult struct {
	Root       id.LayerID
	Layers     Map
	Properties property.Map
}

func (InitializerResult) RootLayer

func (r InitializerResult) RootLayer() Layer

func (InitializerResult) RootLayerGroup

func (r InitializerResult) RootLayerGroup() *Group

func (InitializerResult) RootLayerItem

func (r InitializerResult) RootLayerItem() *Item

func (InitializerResult) RootLayerRef

func (r InitializerResult) RootLayerRef() *Layer

type Item

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

func ItemFromLayer

func ItemFromLayer(l Layer) *Item

func ItemFromLayerRef

func ItemFromLayerRef(l *Layer) *Item

func ToLayerItem

func ToLayerItem(l Layer) *Item

func ToLayerItemRef

func ToLayerItemRef(l *Layer) *Item

func (*Item) AttachTag

func (l *Item) AttachTag(t id.TagID) error

func (*Item) DetachTag

func (l *Item) DetachTag(t id.TagID) error

func (*Item) Extension

func (l *Item) Extension() *id.PluginExtensionID

func (*Item) HasInfobox

func (l *Item) HasInfobox() bool

func (*Item) ID

func (l *Item) ID() id.LayerID

func (*Item) IDRef

func (l *Item) IDRef() *id.LayerID

func (*Item) Infobox

func (l *Item) Infobox() *Infobox

func (*Item) IsLinked

func (l *Item) IsLinked() bool

func (*Item) IsVisible

func (l *Item) IsVisible() bool

func (*Item) LayerRef

func (l *Item) LayerRef() *Layer
func (l *Item) Link(ds id.DatasetID)

func (*Item) LinkedDataset

func (l *Item) LinkedDataset() *id.DatasetID

func (*Item) Name

func (l *Item) Name() string

func (*Item) Plugin

func (l *Item) Plugin() *id.PluginID

func (*Item) Properties

func (l *Item) Properties() []id.PropertyID

func (*Item) Property

func (l *Item) Property() *id.PropertyID

func (*Item) Rename

func (l *Item) Rename(name string)

func (*Item) Scene

func (l *Item) Scene() id.SceneID

func (*Item) SetInfobox

func (l *Item) SetInfobox(infobox *Infobox)

func (*Item) SetPlugin

func (l *Item) SetPlugin(plugin *id.PluginID)

func (*Item) SetVisible

func (l *Item) SetVisible(visible bool)

func (*Item) Tags

func (l *Item) Tags() *tag.List
func (l *Item) Unlink()

func (*Item) UsesPlugin

func (l *Item) UsesPlugin() bool

func (*Item) ValidateProperties

func (l *Item) ValidateProperties(pm property.Map) error

type ItemBuilder

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

func NewItem

func NewItem() *ItemBuilder

func (*ItemBuilder) Build

func (b *ItemBuilder) Build() (*Item, error)

func (*ItemBuilder) Extension

func (b *ItemBuilder) Extension(extension *id.PluginExtensionID) *ItemBuilder

func (*ItemBuilder) ID

func (b *ItemBuilder) ID(id id.LayerID) *ItemBuilder

func (*ItemBuilder) Infobox

func (b *ItemBuilder) Infobox(infobox *Infobox) *ItemBuilder

func (*ItemBuilder) IsVisible

func (b *ItemBuilder) IsVisible(visible bool) *ItemBuilder

func (*ItemBuilder) LinkedDataset

func (b *ItemBuilder) LinkedDataset(linkedDataset *id.DatasetID) *ItemBuilder

func (*ItemBuilder) MustBuild

func (b *ItemBuilder) MustBuild() *Item

func (*ItemBuilder) Name

func (b *ItemBuilder) Name(name string) *ItemBuilder

func (*ItemBuilder) NewID

func (b *ItemBuilder) NewID() *ItemBuilder

func (*ItemBuilder) Plugin

func (b *ItemBuilder) Plugin(plugin *id.PluginID) *ItemBuilder

func (*ItemBuilder) Property

func (b *ItemBuilder) Property(p *id.PropertyID) *ItemBuilder

func (*ItemBuilder) Scene

func (b *ItemBuilder) Scene(s id.SceneID) *ItemBuilder

func (*ItemBuilder) Tags

func (b *ItemBuilder) Tags(tags *tag.List) *ItemBuilder

type ItemList

type ItemList []*Item

func (ItemList) FindByDataset

func (ll ItemList) FindByDataset(ds id.DatasetID) *Item

func (ItemList) Last

func (ll ItemList) Last() *Item

func (ItemList) ToLayerList

func (ll ItemList) ToLayerList() List

type Layer

type Layer interface {
	ID() id.LayerID
	Name() string
	IsVisible() bool
	Plugin() *id.PluginID
	Extension() *id.PluginExtensionID
	UsesPlugin() bool
	Property() *id.PropertyID
	HasInfobox() bool
	Infobox() *Infobox
	Scene() id.SceneID
	Tags() *tag.List
	Rename(string)
	SetVisible(bool)
	SetInfobox(*Infobox)
	SetPlugin(*id.PluginID)
	Properties() []id.PropertyID
	ValidateProperties(property.Map) error
	AttachTag(t id.TagID) error
	DetachTag(t id.TagID) error
}

type List

type List []*Layer

func (List) Deref

func (ll List) Deref() []Layer

func (List) Find

func (ll List) Find(lid id.LayerID) *Layer

func (List) FindByDataset

func (ll List) FindByDataset(ds id.DatasetID) *Item

func (List) Last

func (ll List) Last() *Layer

func (List) Loader

func (ll List) Loader() Loader

func (List) Map

func (ll List) Map() Map

func (List) Pick

func (ll List) Pick(il *IDList) List

func (List) Remove

func (ll List) Remove(lids ...id.LayerID) List

func (List) SeparateLayerItemAndGroup

func (ll List) SeparateLayerItemAndGroup() (ItemList, GroupList)

func (List) ToLayerGroupList

func (ll List) ToLayerGroupList() GroupList

func (List) ToLayerItemList

func (ll List) ToLayerItemList() ItemList

type Loader

type Loader func(context.Context, ...id.LayerID) (List, error)

func LoaderFrom

func LoaderFrom(data []Layer) Loader

func LoaderFromMap

func LoaderFromMap(data map[id.LayerID]Layer) Loader

func (Loader) Walk

func (l Loader) Walk(ctx context.Context, walker func(Layer, GroupList) error, init []id.LayerID) error

type LoaderByScene

type LoaderByScene func(context.Context, id.SceneID) (List, error)

type Map

type Map map[id.LayerID]*Layer

func MapFrom

func MapFrom(l Layer) Map

func (Map) Add

func (m Map) Add(layers ...*Layer) Map

func (Map) Clone

func (m Map) Clone() Map

func (Map) Group

func (m Map) Group(i id.LayerID) *Group

func (Map) Item

func (m Map) Item(i id.LayerID) *Item

func (Map) Keys

func (m Map) Keys() []id.LayerID

func (Map) Layer

func (m Map) Layer(i id.LayerID) Layer

func (Map) Len

func (m Map) Len() int

func (Map) List

func (m Map) List() List

func (Map) Merge

func (m Map) Merge(m2 Map) Map

func (Map) Pick

func (m Map) Pick(il *IDList) List

type Merged

type Merged struct {
	Original    id.LayerID
	Parent      *id.LayerID
	Name        string
	Scene       id.SceneID
	Property    *property.MergedMetadata
	Infobox     *MergedInfobox
	PluginID    *id.PluginID
	ExtensionID *id.PluginExtensionID
}

Merged represents a merged layer from two layers

func Merge

func Merge(o Layer, p *Group) *Merged

Merge merges two layers

func (*Merged) Properties

func (m *Merged) Properties() []id.PropertyID

Properties returns all property IDs in Merged

type MergedInfobox

type MergedInfobox struct {
	Property *property.MergedMetadata
	Fields   []*MergedInfoboxField
}

MergedInfobox represents a merged info box from two layers

func MergeInfobox

func MergeInfobox(o *Infobox, p *Infobox, linked *id.DatasetID) *MergedInfobox

MergeInfobox merges two infoboxes

type MergedInfoboxField

type MergedInfoboxField struct {
	ID        id.InfoboxFieldID
	Plugin    id.PluginID
	Extension id.PluginExtensionID
	Property  *property.MergedMetadata
}

MergedInfoboxField represents a field of MergedInfobox

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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