transform

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunTransformers

func RunTransformers(transformers []Transformer, head map[string]*pb.Entity, bus Bus, changedID string)

RunTransformers runs all transformers for a changed entity, applying upserts and removes to head and notifying the bus.

Types

type Bus

type Bus interface {
	Dirty(id string, entity *pb.Entity, changeType pb.EntityChange)
}

Bus is an interface for the subset of engine.Bus that transformers need.

type CameraTransformer

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

CameraTransformer generates a LocalShapeComponent coverage wedge for an entity's CameraComponent when fov and range are set. Generated shape entities have IDs of the form "{entityID}~coverage~0". All generated IDs are written into SensorComponent.coverage on the source entity.

func NewCameraTransformer

func NewCameraTransformer() *CameraTransformer

func (*CameraTransformer) Resolve

func (ct *CameraTransformer) Resolve(head map[string]*pb.Entity, changedID string) (upsert []*pb.Entity, remove []string)

func (*CameraTransformer) Validate

func (ct *CameraTransformer) Validate(head map[string]*pb.Entity, incoming *pb.Entity) error

type ClassificationTransformer

type ClassificationTransformer struct{}

ClassificationTransformer derives a ClassificationComponent from the MIL-STD-2525C symbol code in SymbolComponent when no explicit ClassificationComponent is present.

MIL-STD-2525C SIDC positions:

  • Position 2 (index 1): Identity/Affiliation
  • Position 3 (index 2): Battle Dimension

func NewClassificationTransformer

func NewClassificationTransformer() *ClassificationTransformer

func (*ClassificationTransformer) Resolve

func (ct *ClassificationTransformer) Resolve(head map[string]*pb.Entity, changedID string) (upsert []*pb.Entity, remove []string)

func (*ClassificationTransformer) Validate

func (ct *ClassificationTransformer) Validate(head map[string]*pb.Entity, incoming *pb.Entity) error

type PoseTransformer

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

PoseTransformer resolves PoseComponent into absolute GeoSpatialComponent and OrientationComponent by walking the parent chain. When a parent entity changes, all children referencing it are re-resolved.

For CartesianOffset: the ENU offset is applied to the parent's geo position. For PolarOffset with range: azimuth/elevation/range are converted to ENU, then applied. For PolarOffset without range (bearing-only): no geo is produced, but BearingComponent is set.

func NewPoseTransformer

func NewPoseTransformer() *PoseTransformer

func (*PoseTransformer) Resolve

func (pt *PoseTransformer) Resolve(head map[string]*pb.Entity, changedID string) (upsert []*pb.Entity, remove []string)

func (*PoseTransformer) Validate

func (pt *PoseTransformer) Validate(head map[string]*pb.Entity, incoming *pb.Entity) error

type ShapeTransformer

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

ShapeTransformer resolves LocalShapeComponent (ENU local shapes) with a non-empty RelativeTo into GeoShapeComponent (WGS84 geo shapes) on the same entity. It looks up the parent entity's GeoSpatialComponent and OrientationComponent to perform the transform.

func NewShapeTransformer

func NewShapeTransformer() *ShapeTransformer

func (*ShapeTransformer) Resolve

func (st *ShapeTransformer) Resolve(head map[string]*pb.Entity, changedID string) (upsert []*pb.Entity, remove []string)

func (*ShapeTransformer) Validate

func (st *ShapeTransformer) Validate(head map[string]*pb.Entity, incoming *pb.Entity) error

type Transformer

type Transformer interface {
	// Validate is called BEFORE merge. Return error to reject the push.
	Validate(head map[string]*pb.Entity, incoming *pb.Entity) error

	// Resolve is called AFTER an entity is merged into head.
	// Returns entities to upsert and entity IDs to delete.
	Resolve(head map[string]*pb.Entity, changedID string) (upsert []*pb.Entity, remove []string)
}

Transformer is a callback-based interface for managing derived entities. Transformers watch pushes and GC events to maintain generated entities that are derived from source entities (e.g. sensor coverage from sensor range).

Jump to

Keyboard shortcuts

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