# automatically generated by the FlatBuffers compiler, do not modify

# namespace: foxglove

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

# Array of annotations for a 2D image
class ImageAnnotations(object):
    __slots__ = ['_tab']

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

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

    # Circle annotations
    # ImageAnnotations
    def Circles(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from .CircleAnnotation import CircleAnnotation
            obj = CircleAnnotation()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # ImageAnnotations
    def CirclesLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # ImageAnnotations
    def CirclesIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        return o == 0

    # Points annotations
    # ImageAnnotations
    def Points(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from .PointsAnnotation import PointsAnnotation
            obj = PointsAnnotation()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # ImageAnnotations
    def PointsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # ImageAnnotations
    def PointsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        return o == 0

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

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

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

def ImageAnnotationsStart(builder): builder.StartObject(3)
def Start(builder):
    return ImageAnnotationsStart(builder)
def ImageAnnotationsAddCircles(builder, circles): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(circles), 0)
def AddCircles(builder, circles):
    return ImageAnnotationsAddCircles(builder, circles)
def ImageAnnotationsStartCirclesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartCirclesVector(builder, numElems):
    return ImageAnnotationsStartCirclesVector(builder, numElems)
def ImageAnnotationsAddPoints(builder, points): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(points), 0)
def AddPoints(builder, points):
    return ImageAnnotationsAddPoints(builder, points)
def ImageAnnotationsStartPointsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartPointsVector(builder, numElems):
    return ImageAnnotationsStartPointsVector(builder, numElems)
def ImageAnnotationsAddTexts(builder, texts): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(texts), 0)
def AddTexts(builder, texts):
    return ImageAnnotationsAddTexts(builder, texts)
def ImageAnnotationsStartTextsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartTextsVector(builder, numElems):
    return ImageAnnotationsStartTextsVector(builder, numElems)
def ImageAnnotationsEnd(builder): return builder.EndObject()
def End(builder):
    return ImageAnnotationsEnd(builder)