.. oe:namespace:: OEDepict


.. meta::
   :keywords: OENearestBond, NearestBond


.. _OEDepict_OENearestBond:

.. oe:class:: OENearestBond

   .. oe:api::

      class OENearestBond

   The :ref:`OENearestBond <OEDepict_OENearestBond>` class, used by
   :oe:func:`OEDepict::OEGetNearestBond` and
   :oe:func:`OEDepict::OEGetNearbyBond` functions.
   It stores a bond pointer, the associated distance and
   the display position of the bond.

   .. oe:method:: Constructors

      .. oe:language:: c++ java csharp

         .. oe:api::

            OENearestBond()
            OENearestBond(const OEChem::OEBondBase* bond, double dist)
            OENearestBond(const OEChem::OEBondBase* bond, double dist,
                          const OE2DPoint& pos)
            OENearestBond(const OENearestBond&)

      .. oe:language:: python

         .. oe:api:: python

            OENearestBond() -> OENearestBond
            OENearestBond(bond: OEBondBase, dist: float) -> OENearestBond
            OENearestBond(bond: OEBondBase, dist: float, pos: OE2DPoint) -> OENearestBond
            OENearestBond(arg2: OENearestBond) -> OENearestBond

      Constructors.

      If no display position is given then it will be initialized to
      `OE2DPoint(0.0, 0.0)`.


   .. oe:method:: operator=
      :language: c++

      .. oe:api::

         OENearestBond & operator=(const OENearestBond &)

      Assignment operator.



   .. ################################################################
      # GetBond
      ################################################################

   .. oe:method:: GetBond

      .. oe:language:: c++ java csharp

         .. oe:api::

            const OEChem::OEBondBase* GetBond() const

      .. oe:language:: python

         .. oe:api:: python

            GetBond() -> OEBondBase

      Returns the bond pointer stored in the
      :ref:`OENearestBond <OEDepict_OENearestBond>` object.


   .. ################################################################
      # GetDisplayPosition
      ################################################################

   .. oe:method:: GetDisplayPosition

      .. oe:language:: c++ java csharp

         .. oe:api::

            const OE2DPoint& GetDisplayPosition() const

      .. oe:language:: python

         .. oe:api:: python

            GetDisplayPosition() -> OE2DPoint

      Returns the display position of the middle of the nearest bond.


   .. ################################################################
      # GetDist
      ################################################################

   .. oe:method:: GetDist

      .. oe:language:: c++ java csharp

         .. oe:api::

            double GetDist() const

      .. oe:language:: python

         .. oe:api:: python

            GetDist() -> float

      Returns the distance associated with the bond.


   .. ################################################################
      # IsValid
      ################################################################

   .. oe:method:: IsValid

      .. oe:language:: c++ java csharp

         .. oe:api::

            bool IsValid() const

      .. oe:language:: python

         .. oe:api:: python

            IsValid() -> bool

      Returns whether the :ref:`OENearestBond <OEDepict_OENearestBond>` object is
      initialized correctly.

