#pragma once

#include "CompoundTransition.hpp"

/*
   Class: FilteringTransition

     Implements a complex sequence of transitions that filters the smallest values data elements of a chart such that only the <FILTER_SIZE> biggest elements remain visible.

     *Inherits* from <CompoundTransition>.
*/
class FilteringTransition: public CompoundTransition {
  public:
    /*
       Constructor: FilteringTransition

         Initializes the object by creating all transitions and intermediate objects.

       Parameters:

         pInitialChart - Pointer to the chart to be modified.
    */
    FilteringTransition(Chart* pInitialChart);

    /*
       Destructor: ~FilteringTransition

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


    /*
       Function: Update

         Updates the transition by executing the active child transition. *Inherited* from <Transition>.
    */
    void Update();

    /*
       Function: Draw

         Draws the transition by drawing the initial chart. *Inherited* from <CompoundTransition>.

       Parameters:

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

    /*
       Function: Complete

         Checks if all child transitions are completed. *Inherited* from <Transition>.

       Returns:

         A boolean value indicating if all child transitions are completed.
    */
    bool Complete();

    /*
       Function: GetActiveChart

         Returns the active chart of the transition. This is the active chart of the active transition if present, else the initial chart. *Inherited* from <CompoundTransition>.

       Returns:

         Returns the active chart of the transition.
    */
    Chart* GetActiveChart();

  private:
    /*
       Function: CloneMissingDataElements

         Creates and returns a vector containing clones of the data elements connected to all data entries of the result chart which are not represented in the current chart.

       Returns:

         A vector containing clones of the result chart's data elements which are not present in the current chart.
    */
    std::vector<DataElement*> CloneMissingDataElements();
};