# automatically generated by the FlatBuffers compiler, do not modify

# namespace: foxglove

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

# A primitive representing an arrow
class ArrowPrimitive(object):
    __slots__ = ['_tab']

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

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

    # Position of the arrow's tail and orientation of the arrow. Identity orientation means the arrow points in the +x direction.
    # ArrowPrimitive
    def Pose(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from .Pose import Pose
            obj = Pose()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Length of the arrow shaft
    # ArrowPrimitive
    def ShaftLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
        return 0.0

    # Diameter of the arrow shaft
    # ArrowPrimitive
    def ShaftDiameter(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
        return 0.0

    # Length of the arrow head
    # ArrowPrimitive
    def HeadLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
        return 0.0

    # Diameter of the arrow head
    # ArrowPrimitive
    def HeadDiameter(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
        return 0.0

    # Color of the arrow
    # ArrowPrimitive
    def Color(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

def ArrowPrimitiveStart(builder): builder.StartObject(6)
def Start(builder):
    return ArrowPrimitiveStart(builder)
def ArrowPrimitiveAddPose(builder, pose): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(pose), 0)
def AddPose(builder, pose):
    return ArrowPrimitiveAddPose(builder, pose)
def ArrowPrimitiveAddShaftLength(builder, shaftLength): builder.PrependFloat64Slot(1, shaftLength, 0.0)
def AddShaftLength(builder, shaftLength):
    return ArrowPrimitiveAddShaftLength(builder, shaftLength)
def ArrowPrimitiveAddShaftDiameter(builder, shaftDiameter): builder.PrependFloat64Slot(2, shaftDiameter, 0.0)
def AddShaftDiameter(builder, shaftDiameter):
    return ArrowPrimitiveAddShaftDiameter(builder, shaftDiameter)
def ArrowPrimitiveAddHeadLength(builder, headLength): builder.PrependFloat64Slot(3, headLength, 0.0)
def AddHeadLength(builder, headLength):
    return ArrowPrimitiveAddHeadLength(builder, headLength)
def ArrowPrimitiveAddHeadDiameter(builder, headDiameter): builder.PrependFloat64Slot(4, headDiameter, 0.0)
def AddHeadDiameter(builder, headDiameter):
    return ArrowPrimitiveAddHeadDiameter(builder, headDiameter)
def ArrowPrimitiveAddColor(builder, color): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(color), 0)
def AddColor(builder, color):
    return ArrowPrimitiveAddColor(builder, color)
def ArrowPrimitiveEnd(builder): return builder.EndObject()
def End(builder):
    return ArrowPrimitiveEnd(builder)