#pragma once

#include "DataElement.hpp"
#include "DataGroup.hpp"
#include "PieSlice.hpp"

/*
   Class: PieSector

     Implements a pie sector data element.
     A pie sector is a grouping of several pie slice data elements and a common label.

     *Inherits* from <DataElement>.
*/
class PieSector: public DataElement {
  public:
    /*
       Constructor: PieSector

         Initializes the object.

       Parameters:

         pDataGroup - Pointer to the data group object that shall be represented by the pie sector.
         fBeginValue - Accumulated data entry values of predecessor pie sectors.
         fValueScaleFactor - Scale factor for all pie slices to scale the sum of all sectors to 100 percent.
         iMoveSlice - Index of the slice regarding all slices with a value smaller than <PIE_CHART_LABEL_OFFSET_VALUE>.
    */
    PieSector(DataGroup* pDataGroup, float fBeginValue, float fValueScaleFactor, int iMoveSlice);

    /*
       Destructor: ~PieSector

         Releases all allocated resources.
    */
    ~PieSector();


    /*
       Function: Draw

         Draws the pie sector. *Inherited* from <AlterableObject>.

       Parameters:

         pPainter - The QPainter object that shall be used for painting.
    */
    void Draw(QPainter* pPainter);

    /*
       Function: DrawLabels

         Draws the label assigned to the pie sector. *Inherited* from <AlterableObject>.

       Parameters:

         pPainter - The QPainter object that shall be used for painting.
    */
    void DrawLabels(QPainter* pPainter);

    /*
       Function: ChangePosition

         Unused function. *Inherited* from <AlterableObject>.

       Parameters:

         fDeltaLeft - Unused parameter.
         fDeltaTop - Unused parameter.
         fDeltaBottom - Unused parameter.
    */
    void ChangePosition(float fDeltaLeft, float fDeltaTop, float fDeltaBottom);

    /*
       Function: Scale

         Unused function. *Inherited* from <DataElement>.

       Parameters:

         fDeltaWidth - Unused parameter.
         fDeltaHeight - Unused parameter.
    */
    void Scale(float fDeltaWidth, float fDeltaHeight);

    /*
       Function: ChangeAlpha

         Unused function. *Inherited* from <AlterableObject>.

       Parameters:

         fDeltaAlpha - Unused parameter.
    */
    void ChangeAlpha(float fDeltaAlpha);

    /*
       Function: GetDataGroup

         Returns the data group connected to the pie sector.

       Returns:

         The data group connected to the pie sector.
    */
    DataGroup* GetDataGroup();

    /*
       Function: GetSlices

         Returns a vector containing all pie slices of the pie sector.

       Returns:

         A vector containing all pie slices of the pie sector.
    */
    std::vector<PieSlice*> GetSlices();

  private:
    std::vector<PieSlice*> vSlices;
    DataGroup* pDataGroup;
};