.. oe:namespace:: OEDepict

.. meta::
   :keywords: OENearestAtom, NearestAtom


.. _OEDepict_OENearestAtom:

.. oe:class:: OENearestAtom

   .. oe:api::

      class OENearestAtom

   The :ref:`OENearestAtom <OEDepict_OENearestAtom>` class that is used by
   :oe:func:`OEDepict::OEGetNearestAtom` and
   :oe:func:`OEDepict::OEGetNearbyAtom` functions.
   It stores an atom pointer, an associated distance and the
   display position of the atom.

   .. oe:method:: Constructors

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

         .. oe:api::

            OENearestAtom(const OEChem::OEAtomBase* atom, double distance)
            OENearestAtom(const OEChem::OEAtomBase* atom, double distance,
                          const OE2DPoint& displaypos)

      .. oe:language:: python

         .. oe:api:: python

            OENearestAtom() -> OENearestAtom
            OENearestAtom(atom: OEAtomBase, dist: float) -> OENearestAtom
            OENearestAtom(atom: OEAtomBase, dist: float, pos: OE2DPoint) -> OENearestAtom
            OENearestAtom(arg2: OENearestAtom) -> OENearestAtom

      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::

         OENearestAtom & operator=(const OENearestAtom &)

      Assignment operator.



   .. ################################################################
      # GetAtom
      ################################################################

   .. oe:method:: GetAtom

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

         .. oe:api::

            const OEChem::OEAtomBase* GetAtom() const

      .. oe:language:: python

         .. oe:api:: python

            GetAtom() -> OEAtomBase

      Returns the atom pointer stored in the
      :ref:`OENearestAtom <OEDepict_OENearestAtom>` 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 nearest atom.


   .. ################################################################
      # 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 atom.


   .. ################################################################
      # 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:`OENearestAtom <OEDepict_OENearestAtom>` object is
      initialized correctly.
