.. role:: ts-api-decorator

####
Line
####

.. js:module:: Markup.Shapes
   :noindex:

.. container:: ts-api-section

   .. js:class:: Line

      This class represents a single line consisting of two points. P1 is considered the start and P2 is considered the end of the line.
      Each Point may have its endcap settings adjusted independently.



.. container:: api-index-section

   .. rubric:: Constructors

   .. rst-class:: api-index-list-item api-kind-constructor api-parent-kind-class

   * :js:meth:`~Markup.Shapes.Line.constructor`



.. container:: api-index-section

   .. rubric:: Methods

   .. rst-class:: api-index-list-item api-kind-method api-parent-kind-class

   * :js:meth:`~Markup.Shapes.Line.getEndEndcapColor`
   * :js:meth:`~Markup.Shapes.Line.getEndEndcapSize`
   * :js:meth:`~Markup.Shapes.Line.getEndEndcapType`
   * :js:meth:`~Markup.Shapes.Line.getEndcapsInverted`
   * :js:meth:`~Markup.Shapes.Line.getP1`
   * :js:meth:`~Markup.Shapes.Line.getP2`
   * :js:meth:`~Markup.Shapes.Line.getStartEndcapColor`
   * :js:meth:`~Markup.Shapes.Line.getStartEndcapSize`
   * :js:meth:`~Markup.Shapes.Line.getStartEndcapType`
   * :js:meth:`~Markup.Shapes.Line.getStrokeColor`
   * :js:meth:`~Markup.Shapes.Line.getStrokeWidth`
   * :js:meth:`~Markup.Shapes.Line.set`
   * :js:meth:`~Markup.Shapes.Line.setEndEndcapColor`
   * :js:meth:`~Markup.Shapes.Line.setEndEndcapSize`
   * :js:meth:`~Markup.Shapes.Line.setEndEndcapType`
   * :js:meth:`~Markup.Shapes.Line.setEndcapType`
   * :js:meth:`~Markup.Shapes.Line.setEndcapsInverted`
   * :js:meth:`~Markup.Shapes.Line.setP1`
   * :js:meth:`~Markup.Shapes.Line.setP2`
   * :js:meth:`~Markup.Shapes.Line.setStartEndcapColor`
   * :js:meth:`~Markup.Shapes.Line.setStartEndcapSize`
   * :js:meth:`~Markup.Shapes.Line.setStartEndcapType`
   * :js:meth:`~Markup.Shapes.Line.setStrokeColor`
   * :js:meth:`~Markup.Shapes.Line.setStrokeWidth`





------------

Constructors
============

.. container:: ts-api-section

   .. js:function:: Line.constructor([ p1[, p2]])

      :param p1: :ts-api-decorator:`optional` Optional first point on the line. If omitted, default value of (0,0) is used.
      :type p1: Point2
      :param p2: :ts-api-decorator:`optional` Optional second point on the line. If omitted, default value of (0,0) is used.
      :type p2: Point2


      Creates a new Line Shape

      :returns: new Line object.


      :rtype: Line



Methods
=======

.. rst-class:: ts-api-section

getEndEndcapColor
-----------------

.. js:method:: Line.getEndEndcapColor()



   Gets the color of the end endcap. Default value is black.

   :returns: color for the end endcap.


   :rtype: Color

.. rst-class:: ts-api-section

getEndEndcapSize
----------------

.. js:method:: Line.getEndEndcapSize()



   Gets the size of the end endcap in pixels. Default value is 9.

   :returns: size of the end endcap.


   :rtype: number

.. rst-class:: ts-api-section

getEndEndcapType
----------------

.. js:method:: Line.getEndEndcapType()



   Gets the end endcap type for this shape. The default value is none.

   :returns: the end endcap type


   :rtype: EndcapType

.. rst-class:: ts-api-section

getEndcapsInverted
------------------

.. js:method:: Line.getEndcapsInverted()



   Gets whether endcaps are inverted for this shape. The default value is false.

   :returns: value indicating whether endcaps are inverted


   :rtype: boolean

.. rst-class:: ts-api-section

getP1
-----

.. js:method:: Line.getP1()



   Gets the first point of the line segment

   :returns: the first point of the line segment


   :rtype: Point2

.. rst-class:: ts-api-section

getP2
-----

.. js:method:: Line.getP2()



   Gets the second point of the line segment

   :returns: the second point of the line segment


   :rtype: Point2

.. rst-class:: ts-api-section

getStartEndcapColor
-------------------

.. js:method:: Line.getStartEndcapColor()



   Gets the color of the start endcap. Default value is black.

   :returns: color for the start endcap.


   :rtype: Color

.. rst-class:: ts-api-section

getStartEndcapSize
------------------

.. js:method:: Line.getStartEndcapSize()



   Gets the size of the start endcap in pixels. Default value is 9.

   :returns: size of the start endcap.


   :rtype: number

.. rst-class:: ts-api-section

getStartEndcapType
------------------

.. js:method:: Line.getStartEndcapType()



   Gets the start endcap type for this shape. The default Value is none.

   :returns: the start endcap type


   :rtype: EndcapType

.. rst-class:: ts-api-section

getStrokeColor
--------------

.. js:method:: Line.getStrokeColor()



   Gets the stroke color for this shape

   :returns: the stroke color


   :rtype: Color

.. rst-class:: ts-api-section

getStrokeWidth
--------------

.. js:method:: Line.getStrokeWidth()



   Gets the stroke width for this shape in pixels

   :returns: the stroke width in pixels


   :rtype: number

.. rst-class:: ts-api-section

set
---

.. js:method:: Line.set( p1, p2)

   :param p1: first point of the line segment
   :type p1: Point2
   :param p2: second point of the line segment
   :type p2: Point2


   Sets the points that define the line segment


   :rtype: void

.. rst-class:: ts-api-section

setEndEndcapColor
-----------------

.. js:method:: Line.setEndEndcapColor( color)

   :param color: the end endcap color value.
   :type color: Color


   Sets the color for the end endcap.


   :rtype: void

.. rst-class:: ts-api-section

setEndEndcapSize
----------------

.. js:method:: Line.setEndEndcapSize( size)

   :param size: the end endcap.
   :type size: number


   Sets the size of the end endcap in pixels.


   :rtype: void

.. rst-class:: ts-api-section

setEndEndcapType
----------------

.. js:method:: Line.setEndEndcapType( endcapType)

   :param endcapType: the new endcap type
   :type endcapType: EndcapType


   Sets the end endcap type for this shape


   :rtype: void

.. rst-class:: ts-api-section

setEndcapType
-------------

.. js:method:: Line.setEndcapType( endcapType)

   :param endcapType: the new endcap type
   :type endcapType: EndcapType


   Convenience for setting the start and eend endcap type for this shape


   :rtype: void

.. rst-class:: ts-api-section

setEndcapsInverted
------------------

.. js:method:: Line.setEndcapsInverted( inverted)

   :param inverted: value indicated whether endcaps should be inverted
   :type inverted: boolean


   Sets whether endcapsare inverted for this shape.


   :rtype: void

.. rst-class:: ts-api-section

setP1
-----

.. js:method:: Line.setP1( p1)

   :param p1: first point of the line segment
   :type p1: Point2


   Sets the first point of the line segment


   :rtype: void

.. rst-class:: ts-api-section

setP2
-----

.. js:method:: Line.setP2( p2)

   :param p2: second point of the line segment
   :type p2: Point2


   sets the first point of the line segment


   :rtype: void

.. rst-class:: ts-api-section

setStartEndcapColor
-------------------

.. js:method:: Line.setStartEndcapColor( color)

   :param color: the start endcap color value.
   :type color: Color


   Sets the color for the start endcap.


   :rtype: void

.. rst-class:: ts-api-section

setStartEndcapSize
------------------

.. js:method:: Line.setStartEndcapSize( size)

   :param size: the start endcap.
   :type size: number


   Sets the size of the start endcap in pixels.


   :rtype: void

.. rst-class:: ts-api-section

setStartEndcapType
------------------

.. js:method:: Line.setStartEndcapType( endcapType)

   :param endcapType: the new endcap type
   :type endcapType: EndcapType


   Sets the start endcap type for this shape


   :rtype: void

.. rst-class:: ts-api-section

setStrokeColor
--------------

.. js:method:: Line.setStrokeColor( color)

   :param color: the stroke color
   :type color: Color


   Sets the stroke color for this shape


   :rtype: void

.. rst-class:: ts-api-section

setStrokeWidth
--------------

.. js:method:: Line.setStrokeWidth( strokeWidth)

   :param strokeWidth: the stroke width in pixels
   :type strokeWidth: number


   Sets the stroke width for this shape in pixels


   :rtype: void

