transform

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 8 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) (upserted, removed []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.

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) Resolve added in v0.0.20

func (t *AOUTransformer) Resolve(head map[string]*pb.Entity, changedID string) (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) 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 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) Resolve added in v0.0.20

func (ct *ChatTransformer) Resolve(head map[string]*pb.Entity, changedID string) (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 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 MediaTransformer added in v0.0.20

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

MediaTransformer rewrites CameraComponent stream URLs to point through the engine's media proxy endpoints. Raw source URLs pushed by builtins are stored internally and replaced with proxy URLs in the entity.

This ensures consumers (frontend, federation) only see proxy URLs, while the proxy handlers can look up the original source URL.

func NewMediaTransformer added in v0.0.20

func NewMediaTransformer() *MediaTransformer

func (*MediaTransformer) GetSourceURL added in v0.0.20

func (mt *MediaTransformer) GetSourceURL(entityID string, streamIndex int) string

GetSourceURL returns the original source URL for an entity's stream. This is used by proxy handlers to connect to the actual camera.

func (*MediaTransformer) Resolve added in v0.0.20

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

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) Resolve added in v0.0.20

func (t *PolarNormalizeTransformer) Resolve(head map[string]*pb.Entity, changedID string) (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) 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