# automatically generated by the FlatBuffers compiler, do not modify

# namespace: foxglove

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

# A visual element in a 3D scene. An entity may be composed of multiple primitives which all share the same frame of reference.
class SceneEntity(object):
    __slots__ = ['_tab']

    @classmethod
    def GetRootAs(cls, buf, offset=0):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
        x = SceneEntity()
        x.Init(buf, n + offset)
        return x

    @classmethod
    def GetRootAsSceneEntity(cls, buf, offset=0):
        """This method is deprecated. Please switch to GetRootAs."""
        return cls.GetRootAs(buf, offset)
    # SceneEntity
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # Timestamp of the entity
    # SceneEntity
    def Timestamp(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            x = o + self._tab.Pos
            from .Time import Time
            obj = Time()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Frame of reference
    # SceneEntity
    def FrameId(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # Identifier for the entity. A entity will replace any prior entity on the same topic with the same `id`.
    # SceneEntity
    def Id(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # Length of time (relative to `timestamp`) after which the entity should be automatically removed. Zero value indicates the entity should remain visible until it is replaced or deleted.
    # SceneEntity
    def Lifetime(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            x = o + self._tab.Pos
            from .Duration import Duration
            obj = Duration()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Whether the entity should keep its location in the fixed frame (false) or follow the frame specified in `frame_id` as it moves relative to the fixed frame (true)
    # SceneEntity
    def FrameLocked(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
        return False

    # Additional user-provided metadata associated with the entity. Keys must be unique.
    # SceneEntity
    def Metadata(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from .KeyValuePair import KeyValuePair
            obj = KeyValuePair()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # SceneEntity
    def MetadataLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # SceneEntity
    def MetadataIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        return o == 0

    # Arrow primitives
    # SceneEntity
    def Arrows(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from .ArrowPrimitive import ArrowPrimitive
            obj = ArrowPrimitive()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # SceneEntity
    def ArrowsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # SceneEntity
    def ArrowsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        return o == 0

    # Cube primitives
    # SceneEntity
    def Cubes(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from .CubePrimitive import CubePrimitive
            obj = CubePrimitive()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # SceneEntity
    def CubesLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # SceneEntity
    def CubesIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        return o == 0

    # Sphere primitives
    # SceneEntity
    def Spheres(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from .SpherePrimitive import SpherePrimitive
            obj = SpherePrimitive()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # SceneEntity
    def SpheresLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # SceneEntity
    def SpheresIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        return o == 0

    # Cylinder primitives
    # SceneEntity
    def Cylinders(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from .CylinderPrimitive import CylinderPrimitive
            obj = CylinderPrimitive()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # SceneEntity
    def CylindersLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # SceneEntity
    def CylindersIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
        return o == 0

    # Line primitives
    # SceneEntity
    def Lines(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from .LinePrimitive import LinePrimitive
            obj = LinePrimitive()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # SceneEntity
    def LinesLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # SceneEntity
    def LinesIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
        return o == 0

    # Triangle list primitives
    # SceneEntity
    def Triangles(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from .TriangleListPrimitive import TriangleListPrimitive
            obj = TriangleListPrimitive()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # SceneEntity
    def TrianglesLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # SceneEntity
    def TrianglesIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
        return o == 0

    # Text primitives
    # SceneEntity
    def Texts(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from .TextPrimitive import TextPrimitive
            obj = TextPrimitive()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # SceneEntity
    def TextsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # SceneEntity
    def TextsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28))
        return o == 0

    # Model primitives
    # SceneEntity
    def Models(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from .ModelPrimitive import ModelPrimitive
            obj = ModelPrimitive()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # SceneEntity
    def ModelsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # SceneEntity
    def ModelsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30))
        return o == 0

def SceneEntityStart(builder): builder.StartObject(14)
def Start(builder):
    return SceneEntityStart(builder)
def SceneEntityAddTimestamp(builder, timestamp): builder.PrependStructSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(timestamp), 0)
def AddTimestamp(builder, timestamp):
    return SceneEntityAddTimestamp(builder, timestamp)
def SceneEntityAddFrameId(builder, frameId): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(frameId), 0)
def AddFrameId(builder, frameId):
    return SceneEntityAddFrameId(builder, frameId)
def SceneEntityAddId(builder, id): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0)
def AddId(builder, id):
    return SceneEntityAddId(builder, id)
def SceneEntityAddLifetime(builder, lifetime): builder.PrependStructSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(lifetime), 0)
def AddLifetime(builder, lifetime):
    return SceneEntityAddLifetime(builder, lifetime)
def SceneEntityAddFrameLocked(builder, frameLocked): builder.PrependBoolSlot(4, frameLocked, 0)
def AddFrameLocked(builder, frameLocked):
    return SceneEntityAddFrameLocked(builder, frameLocked)
def SceneEntityAddMetadata(builder, metadata): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(metadata), 0)
def AddMetadata(builder, metadata):
    return SceneEntityAddMetadata(builder, metadata)
def SceneEntityStartMetadataVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartMetadataVector(builder, numElems):
    return SceneEntityStartMetadataVector(builder, numElems)
def SceneEntityAddArrows(builder, arrows): builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(arrows), 0)
def AddArrows(builder, arrows):
    return SceneEntityAddArrows(builder, arrows)
def SceneEntityStartArrowsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartArrowsVector(builder, numElems):
    return SceneEntityStartArrowsVector(builder, numElems)
def SceneEntityAddCubes(builder, cubes): builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(cubes), 0)
def AddCubes(builder, cubes):
    return SceneEntityAddCubes(builder, cubes)
def SceneEntityStartCubesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartCubesVector(builder, numElems):
    return SceneEntityStartCubesVector(builder, numElems)
def SceneEntityAddSpheres(builder, spheres): builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(spheres), 0)
def AddSpheres(builder, spheres):
    return SceneEntityAddSpheres(builder, spheres)
def SceneEntityStartSpheresVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartSpheresVector(builder, numElems):
    return SceneEntityStartSpheresVector(builder, numElems)
def SceneEntityAddCylinders(builder, cylinders): builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(cylinders), 0)
def AddCylinders(builder, cylinders):
    return SceneEntityAddCylinders(builder, cylinders)
def SceneEntityStartCylindersVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartCylindersVector(builder, numElems):
    return SceneEntityStartCylindersVector(builder, numElems)
def SceneEntityAddLines(builder, lines): builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(lines), 0)
def AddLines(builder, lines):
    return SceneEntityAddLines(builder, lines)
def SceneEntityStartLinesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartLinesVector(builder, numElems):
    return SceneEntityStartLinesVector(builder, numElems)
def SceneEntityAddTriangles(builder, triangles): builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(triangles), 0)
def AddTriangles(builder, triangles):
    return SceneEntityAddTriangles(builder, triangles)
def SceneEntityStartTrianglesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartTrianglesVector(builder, numElems):
    return SceneEntityStartTrianglesVector(builder, numElems)
def SceneEntityAddTexts(builder, texts): builder.PrependUOffsetTRelativeSlot(12, flatbuffers.number_types.UOffsetTFlags.py_type(texts), 0)
def AddTexts(builder, texts):
    return SceneEntityAddTexts(builder, texts)
def SceneEntityStartTextsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartTextsVector(builder, numElems):
    return SceneEntityStartTextsVector(builder, numElems)
def SceneEntityAddModels(builder, models): builder.PrependUOffsetTRelativeSlot(13, flatbuffers.number_types.UOffsetTFlags.py_type(models), 0)
def AddModels(builder, models):
    return SceneEntityAddModels(builder, models)
def SceneEntityStartModelsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartModelsVector(builder, numElems):
    return SceneEntityStartModelsVector(builder, numElems)
def SceneEntityEnd(builder): return builder.EndObject()
def End(builder):
    return SceneEntityEnd(builder)