# automatically generated by the FlatBuffers compiler, do not modify

# namespace: foxglove

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

# An array of points on a 2D image
class PointsAnnotation(object):
    __slots__ = ['_tab']

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

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

    # Timestamp of annotation
    # PointsAnnotation
    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

    # Type of points annotation to draw
    # PointsAnnotation
    def Type(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
        return 0

    # Points in 2D image coordinates (pixels).
    # These coordinates use the top-left corner of the top-left pixel of the image as the origin.
    # PointsAnnotation
    def Points(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 .Point2 import Point2
            obj = Point2()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

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

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

    # Outline color
    # PointsAnnotation
    def OutlineColor(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from .Color import Color
            obj = Color()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Per-point colors, if `type` is `POINTS`, or per-segment stroke colors, if `type` is `LINE_LIST`, `LINE_STRIP` or `LINE_LOOP`.
    # PointsAnnotation
    def OutlineColors(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from .Color import Color
            obj = Color()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # PointsAnnotation
    def OutlineColorsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # PointsAnnotation
    def OutlineColorsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        return o == 0

    # Fill color
    # PointsAnnotation
    def FillColor(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from .Color import Color
            obj = Color()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Stroke thickness in pixels
    # PointsAnnotation
    def Thickness(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
        return 0.0

def PointsAnnotationStart(builder): builder.StartObject(7)
def Start(builder):
    return PointsAnnotationStart(builder)
def PointsAnnotationAddTimestamp(builder, timestamp): builder.PrependStructSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(timestamp), 0)
def AddTimestamp(builder, timestamp):
    return PointsAnnotationAddTimestamp(builder, timestamp)
def PointsAnnotationAddType(builder, type): builder.PrependUint8Slot(1, type, 0)
def AddType(builder, type):
    return PointsAnnotationAddType(builder, type)
def PointsAnnotationAddPoints(builder, points): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(points), 0)
def AddPoints(builder, points):
    return PointsAnnotationAddPoints(builder, points)
def PointsAnnotationStartPointsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartPointsVector(builder, numElems):
    return PointsAnnotationStartPointsVector(builder, numElems)
def PointsAnnotationAddOutlineColor(builder, outlineColor): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(outlineColor), 0)
def AddOutlineColor(builder, outlineColor):
    return PointsAnnotationAddOutlineColor(builder, outlineColor)
def PointsAnnotationAddOutlineColors(builder, outlineColors): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(outlineColors), 0)
def AddOutlineColors(builder, outlineColors):
    return PointsAnnotationAddOutlineColors(builder, outlineColors)
def PointsAnnotationStartOutlineColorsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartOutlineColorsVector(builder, numElems):
    return PointsAnnotationStartOutlineColorsVector(builder, numElems)
def PointsAnnotationAddFillColor(builder, fillColor): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(fillColor), 0)
def AddFillColor(builder, fillColor):
    return PointsAnnotationAddFillColor(builder, fillColor)
def PointsAnnotationAddThickness(builder, thickness): builder.PrependFloat64Slot(6, thickness, 0.0)
def AddThickness(builder, thickness):
    return PointsAnnotationAddThickness(builder, thickness)
def PointsAnnotationEnd(builder): return builder.EndObject()
def End(builder):
    return PointsAnnotationEnd(builder)