writer

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithBufferRatio

func WithBufferRatio(n int) func(*StandardWriter)

WithBufferRation defines how many jobs per writer worker to allow enqueuing.

func WithGeometryEncoder

func WithGeometryEncoder(e GeometryEncoder) func(*StandardConsumer)

WithGeometryEncoder sets the consumer geometry encoder to the given one

func WithNumWorkers

func WithNumWorkers(n int) func(*StandardWriter)

WithNumWorkers defines how many writer goroutines to launch when writing the tiles.

func WithTilesetVersion

func WithTilesetVersion(v version.TilesetVersion) func(*StandardWriter)

WithTilesetVersion sets the version of the generated tilesets. version 1.0 generates .pnts gemetries while version 1.1 generates .glb (gltf) geometries.

Types

type Asset

type Asset struct {
	Version version.TilesetVersion `json:"version"`
}

type BoundingVolume

type BoundingVolume struct {
	Box [12]float64 `json:"box"`
}

type Child

type Child struct {
	Content        Content        `json:"content"`
	BoundingVolume BoundingVolume `json:"boundingVolume"`
	GeometricError float64        `json:"geometricError"`
	Refine         string         `json:"refine"`
}

type Consumer

type Consumer interface {
	Consume(workchan chan *WorkUnit, errchan chan error, waitGroup *sync.WaitGroup)
}

func NewStandardConsumer

func NewStandardConsumer(optFn ...func(*StandardConsumer)) Consumer

type Content

type Content struct {
	Url string `json:"uri"`
}

type GeometryEncoder

type GeometryEncoder interface {
	Write(n tree.Node, folderPath string) error
	TilesetVersion() version.TilesetVersion
	Filename() string
}

GeometryEncoder encodes a tree.Node into a binary file, like a .pnts or .glb/.gltf files.

type GltfEncoder

type GltfEncoder struct{}

GltfEncoder writes a node data as Gltf/Glb binary file (3D Tiles 1.1 specs) Encodes intensity and classification using the EXT_structural_metadata GLTF extension

func NewGltfEncoder

func NewGltfEncoder() *GltfEncoder

func (*GltfEncoder) Filename

func (e *GltfEncoder) Filename() string

func (*GltfEncoder) TilesetVersion

func (e *GltfEncoder) TilesetVersion() version.TilesetVersion

func (*GltfEncoder) Write

func (e *GltfEncoder) Write(node tree.Node, folderPath string) error

type MockConsumer

type MockConsumer struct {
	Wc  chan *WorkUnit
	Ec  chan error
	Err error
}

func (*MockConsumer) Consume

func (m *MockConsumer) Consume(workchan chan *WorkUnit, errchan chan error, waitGroup *sync.WaitGroup)

type MockProducer

type MockProducer struct {
	Wc  chan *WorkUnit
	Ec  chan error
	Err error
	Wu  *WorkUnit
}

func (*MockProducer) Produce

func (m *MockProducer) Produce(workchan chan *WorkUnit, errchan chan error, wg *sync.WaitGroup, node tree.Node, ctx context.Context)

type MockWriter

type MockWriter struct {
	Err         error
	Tr          tree.Tree
	FolderName  string
	Ctx         context.Context
	WriteCalled bool
}

func (*MockWriter) Write

func (m *MockWriter) Write(t tree.Tree, folderName string, ctx context.Context) error

type PntsEncoder

type PntsEncoder struct{}

PntsEncoder writes a node data as Pnts file (3D Tiles 1.0 specs)

func NewPntsEncoder

func NewPntsEncoder() *PntsEncoder

func (*PntsEncoder) Filename

func (e *PntsEncoder) Filename() string

func (*PntsEncoder) TilesetVersion

func (e *PntsEncoder) TilesetVersion() version.TilesetVersion

func (*PntsEncoder) Write

func (e *PntsEncoder) Write(node tree.Node, folderPath string) error

type Producer

type Producer interface {
	Produce(work chan *WorkUnit, errchan chan error, wg *sync.WaitGroup, node tree.Node, ctx context.Context)
}

func NewStandardProducer

func NewStandardProducer(basepath string, subfolder string) Producer

type Root

type Root struct {
	Children       []Child        `json:"children"`
	Content        Content        `json:"content"`
	BoundingVolume BoundingVolume `json:"boundingVolume"`
	GeometricError float64        `json:"geometricError"`
	Refine         string         `json:"refine"`
	Transform      *[16]float64   `json:"transform,omitempty"`
}

type StandardConsumer

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

func (*StandardConsumer) Consume

func (c *StandardConsumer) Consume(workchan chan *WorkUnit, errchan chan error, waitGroup *sync.WaitGroup)

Continually consumes WorkUnits submitted to a work channel producing corresponding gometry .pnts/.glb files and tileset.json files continues working until work channel is closed or if an error is raised. In this last case submits the error to an error channel before quitting

type StandardProducer

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

func (*StandardProducer) Produce

func (p *StandardProducer) Produce(work chan *WorkUnit, errchan chan error, wg *sync.WaitGroup, node tree.Node, ctx context.Context)

Parses a tree node and submits WorkUnits the the provided workchannel. Should be called only on the tree root node. Closes the channel when all work is submitted.

type StandardWriter

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

func NewWriter

func NewWriter(basePath string, options ...func(*StandardWriter)) (*StandardWriter, error)

func (*StandardWriter) Write

func (w *StandardWriter) Write(t tree.Tree, folderName string, ctx context.Context) error

type Tileset

type Tileset struct {
	Asset          Asset   `json:"asset"`
	GeometricError float64 `json:"geometricError"`
	Root           Root    `json:"root"`
}

type WorkUnit

type WorkUnit struct {
	// Node contains the data for the current tile
	Node tree.Node
	// BasePath is the path of the folder where to write the content.pnts and tileset.json files for this workunit
	BasePath string
}

WorkUnit contains the minimal data needed to produce a single 3d tile, i.e. a binary content.pnts file, a tileset.json file

type Writer

type Writer interface {
	Write(t tree.Tree, folderName string, ctx context.Context) error
}

Writer writes a tree as a 3D Cesium Point cloud to the given output folder

Jump to

Keyboard shortcuts

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