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
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
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
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
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).