transform

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReindexTransformers added in v1.0.0

func ReindexTransformers(transformers []Transformer, head map[string]*pb.Entity, id string)

ReindexTransformers lets all transformers register a loaded entity in their internal indexes without computing or mutating any components.

func RunTransformers

func RunTransformers(transformers []Transformer, head map[string]*pb.Entity, bus Bus, changedID string, components map[int32]meta.Component) (upserted, removed []string, generatedBy map[string]map[int32]string)

RunTransformers runs all transformers for a changed entity, applying upserts and removes to head and notifying the bus. Returns the IDs of upserted and removed entities so callers can sync secondary stores, plus generatedBy: per entity, the proto field number of each component a transformer produced mapped to that transformer's Name(). Attribution is by first producer — the transformer that first populated the field; later transformers that only adjust its value do not override it.

Types

type AOUTransformer added in v0.0.20

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

AOUTransformer computes an Area of Uncertainty (AOU) shape for entities that have a DetectionComponent and sufficient sensor accuracy data (MIL-STD-2525C §5.3.4.11.1).

Two cases:

  • Ellipse AOU: entity has detection + geo + geo.covariance → rotated ellipse polygon written to entity.Shape (GeoShapeComponent).
  • Line-of-bearing AOU: entity has detection + bearing + no geo + pose.parent → wedge/line LocalShapeComponent relative to the sensor parent. ShapeTransformer converts it to WGS84.

func NewAOUTransformer added in v0.0.20

func NewAOUTransformer() *AOUTransformer

func (*AOUTransformer) Name added in v1.0.0

func (t *AOUTransformer) Name() string

func (*AOUTransformer) Reindex added in v1.0.0

func (t *AOUTransformer) Reindex(_ map[string]*pb.Entity, _ string)

func (*AOUTransformer) Resolve added in v0.0.20

func (t *AOUTransformer) Resolve(head map[string]*pb.Entity, changedID string, _ map[int32]meta.Component) (upsert []*pb.Entity, remove []string)

func (*AOUTransformer) Validate added in v0.0.20

func (t *AOUTransformer) Validate(_ map[string]*pb.Entity, _ *pb.Entity) error

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) Name added in v1.0.0

func (ct *CameraTransformer) Name() string

func (*CameraTransformer) Reindex added in v1.0.0

func (ct *CameraTransformer) Reindex(_ map[string]*pb.Entity, _ string)

func (*CameraTransformer) Resolve

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

func (*CameraTransformer) Validate

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

type ChatTransformer added in v0.0.20

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

func NewChatTransformer added in v0.0.20

func NewChatTransformer() *ChatTransformer

func (*ChatTransformer) Name added in v1.0.0

func (ct *ChatTransformer) Name() string

func (*ChatTransformer) Reindex added in v1.0.0

func (ct *ChatTransformer) Reindex(_ map[string]*pb.Entity, _ string)

func (*ChatTransformer) Resolve added in v0.0.20

func (ct *ChatTransformer) Resolve(head map[string]*pb.Entity, changedID string, _ map[int32]meta.Component) (upsert []*pb.Entity, remove []string)

func (*ChatTransformer) SetNodeEntityID added in v0.0.20

func (ct *ChatTransformer) SetNodeEntityID(id string)

SetNodeEntityID sets the local node entity ID used to stamp outgoing chat messages.

func (*ChatTransformer) Validate added in v0.0.20

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

type ClassificationTransformer

type ClassificationTransformer struct{}

ClassificationTransformer derives classification data from MIL-STD-2525C symbol codes and vice versa.

Forward: SIDC → ClassificationComponent (deprecated fields + taxonomy) Reverse: taxonomy → SymbolComponent (when no symbol exists)

func NewClassificationTransformer

func NewClassificationTransformer() *ClassificationTransformer

func (*ClassificationTransformer) Name added in v1.0.0

func (ct *ClassificationTransformer) Name() string

func (*ClassificationTransformer) Reindex added in v1.0.0

func (ct *ClassificationTransformer) Reindex(_ map[string]*pb.Entity, _ string)

func (*ClassificationTransformer) Resolve

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

func (*ClassificationTransformer) Validate

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

type ImageBboxTransformer added in v0.0.23

type ImageBboxTransformer struct{}

ImageBboxTransformer computes PoseComponent and bearing angular extents for evidence entities that carry an ImageBoundingBox. Uses pinhole projection: camera horizontal FOV + frame dimensions → focal length in pixels, then pixel coordinates → angular offsets from the optical axis.

Must run before PoseTransformer so the generated PoseComponent is resolved into absolute bearing and geo.

func NewImageBboxTransformer added in v0.0.23

func NewImageBboxTransformer() *ImageBboxTransformer

func (*ImageBboxTransformer) Name added in v1.0.0

func (t *ImageBboxTransformer) Name() string

func (*ImageBboxTransformer) Reindex added in v1.0.0

func (t *ImageBboxTransformer) Reindex(_ map[string]*pb.Entity, _ string)

func (*ImageBboxTransformer) Resolve added in v0.0.23

func (t *ImageBboxTransformer) Resolve(head map[string]*pb.Entity, changedID string, _ map[int32]meta.Component) (upsert []*pb.Entity, remove []string)

func (*ImageBboxTransformer) Validate added in v0.0.23

func (t *ImageBboxTransformer) Validate(_ map[string]*pb.Entity, _ *pb.Entity) error

type MediaTransformer added in v0.0.20

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

MediaTransformer stamps epoch timestamps onto CameraComponent streams. Source URLs are kept as-is in the entity — proxy handlers read them directly from the entity when needed.

func NewMediaTransformer added in v0.0.20

func NewMediaTransformer() *MediaTransformer

func (*MediaTransformer) Name added in v1.0.0

func (mt *MediaTransformer) Name() string

func (*MediaTransformer) Reindex added in v1.0.0

func (mt *MediaTransformer) Reindex(_ map[string]*pb.Entity, _ string)

func (*MediaTransformer) Resolve added in v0.0.20

func (mt *MediaTransformer) Resolve(head map[string]*pb.Entity, changedID string, _ map[int32]meta.Component) (upsert []*pb.Entity, remove []string)

func (*MediaTransformer) SetEpoch added in v0.0.23

func (mt *MediaTransformer) SetEpoch(entityID string, streamIndex int, t time.Time)

SetEpoch records the wall-clock time of the first frame for a stream.

func (*MediaTransformer) Validate added in v0.0.20

func (mt *MediaTransformer) Validate(_ map[string]*pb.Entity, _ *pb.Entity) error

type PolarNormalizeTransformer added in v0.0.20

type PolarNormalizeTransformer struct{}

PolarNormalizeTransformer ensures that PolarOffset entities have both the convenience error fields (azimuth_error_deg, elevation_error_deg, range_error_m) and the CovarianceMatrix populated. If only one form is set, it fills in the other. This must run before PoseTransformer so that downstream consumers see both forms.

func NewPolarNormalizeTransformer added in v0.0.20

func NewPolarNormalizeTransformer() *PolarNormalizeTransformer

func (*PolarNormalizeTransformer) Name added in v1.0.0

func (*PolarNormalizeTransformer) Reindex added in v1.0.0

func (t *PolarNormalizeTransformer) Reindex(_ map[string]*pb.Entity, _ string)

func (*PolarNormalizeTransformer) Resolve added in v0.0.20

func (t *PolarNormalizeTransformer) Resolve(head map[string]*pb.Entity, changedID string, _ map[int32]meta.Component) (upsert []*pb.Entity, remove []string)

func (*PolarNormalizeTransformer) Validate added in v0.0.20

func (t *PolarNormalizeTransformer) Validate(_ map[string]*pb.Entity, _ *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) Name added in v1.0.0

func (pt *PoseTransformer) Name() string

func (*PoseTransformer) Reindex added in v1.0.0

func (pt *PoseTransformer) Reindex(head map[string]*pb.Entity, id string)

func (*PoseTransformer) Resolve

func (pt *PoseTransformer) Resolve(head map[string]*pb.Entity, changedID string, _ map[int32]meta.Component) (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) Name added in v1.0.0

func (st *ShapeTransformer) Name() string

func (*ShapeTransformer) Reindex added in v1.0.0

func (st *ShapeTransformer) Reindex(head map[string]*pb.Entity, id string)

func (*ShapeTransformer) Resolve

func (st *ShapeTransformer) Resolve(head map[string]*pb.Entity, changedID string, _ map[int32]meta.Component) (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 {
	// Name returns a stable identifier (e.g. "pose", "aou"), recorded as the
	// generator of any component the transformer produces.
	Name() string

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

	// Reindex registers a loaded entity in internal indexes without
	// computing or mutating any components.
	// this is called by engine when loading a cold entity into hot
	Reindex(head map[string]*pb.Entity, id string)

	// Resolve is called AFTER an entity is merged into head.
	// components contains per-component metadata for the changed entity,
	// keyed by proto field number. Transformers can check Generated to know
	// whether a component was set by another transformer or externally pushed.
	// Returns entities to upsert and entity IDs to delete.
	Resolve(head map[string]*pb.Entity, changedID string, components map[int32]meta.Component) (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