/*============================================================================

The Medical Imaging Interaction Toolkit (MITK)

Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.

Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.

============================================================================*/

#ifndef mitkVtkRepresentationProperty_h
#define mitkVtkRepresentationProperty_h

#include <mitkEnumerationProperty.h>

namespace mitk
{
  /**
   * \brief Encapsulates the VTK representation enumeration as an EnumerationProperty.
   *
   * Valid values are (VTK constant / Id / string representation):
   * VTK_POINTS/0/Points, VTK_WIREFRAME/1/Wireframe, VTK_SURFACE/2/Surface.
   * Default is the Surface representation.
   */
  class MITKCORE_EXPORT VtkRepresentationProperty : public EnumerationProperty
  {
  public:
    mitkClassMacro(VtkRepresentationProperty, EnumerationProperty);

    itkFactorylessNewMacro(Self);

    itkCloneMacro(Self);

      mitkNewMacro1Param(VtkRepresentationProperty, const IdType &);

    mitkNewMacro1Param(VtkRepresentationProperty, const std::string &);

    /**
     * \brief Return the current representation value as defined by VTK constants.
     * \return The current representation as a VTK constant.
     */
    virtual int GetVtkRepresentation();

    /** \brief Set the representation type to VTK_POINTS. */
    virtual void SetRepresentationToPoints();

    /** \brief Set the representation type to VTK_WIREFRAME. */
    virtual void SetRepresentationToWireframe();

    /** \brief Set the representation type to VTK_SURFACE. */
    virtual void SetRepresentationToSurface();

    using BaseProperty::operator=;

  protected:
    /** \brief Constructor. Sets the representation to a default value of Surface(2). */
    VtkRepresentationProperty();

    /**
     * \brief Constructor. Sets the representation to the given value.
     *
     * If the value is not valid, the representation is set to Surface(2).
     *
     * \param[in] value The integer representation of the representation type.
     */
    VtkRepresentationProperty(const IdType &value);

    /**
     * \brief Constructor. Sets the representation to the given value.
     *
     * If the value is not valid, the representation is set to Surface(2).
     *
     * \param[in] value The string representation of the representation type.
     */
    VtkRepresentationProperty(const std::string &value);

    VtkRepresentationProperty(const VtkRepresentationProperty &other);

    /**
     * \brief Overridden as protected to prevent adding invalid representation types.
     */
    bool AddEnum(const std::string &name, const IdType &id) override;

    /**
     * \brief Add the VTK-defined representation types to the enumeration.
     */
    virtual void AddRepresentationTypes();

    mitkCloneMacro(VtkRepresentationProperty);

  private:
    // purposely not implemented
    VtkRepresentationProperty &operator=(const VtkRepresentationProperty &);
  };


} // end of namespace mitk
#endif
