// - - - - - - - - - - - - - - - - - - - - - - - - -
// File: visual_ann.h                               |
// Purpose: provides interface for class VisualANN  |
// Author: Taivo Lints, Estonia                     |
// Date: May, 2003                                  |
// Copyright: see copyright.txt                     |
// - - - - - - - - - - - - - - - - - - - - - - - - -

#ifndef VISUAL_ANN_H
#define VISUAL_ANN_H

#include "ann/neuralnetwork.h"
#include "allegro.h"
#include <vector>
using namespace std;

class VisualANN : public NeuralNetwork {
                      // Adds some functionality to NeuralNetwork class,
                      // namely the ability to visualize itsself.
  public:

    // ******************************
    // * Construction & Destruction *
    // ******************************

    VisualANN(char* config_file);  
                 // VisualANN constructor. Creates a network from your
                 // configuration file (using NeuralNetwork constructor).


    // *******************
    // * Some parameters *
    // *******************

    int neuron_radius;            // Size of the circle representing a neuron.
                                  // Default is 15 and it is reduced
                                  // automatically in constructor when neurons
                                  // are too close to each other.

                                  // After construction there is no automatical
                                  // reduction anymore (i.e. when you change it
                                  // manually).

    int edge_x;                   // How far should neurons be from the left
                                  // and right edges of bitmap.

    // *************************
    // * Functions for drawing *
    // *************************

    void draw(BITMAP* pBitmap);   // Draws network on given bitmap (which
                                  // should be the right size, i.e. the
                                  // size of screen when VisualANN object
                                  // was created).


  // *****************
  // * Private stuff *
  // *****************

  // You can't use that stuff from outside code.

  private:

    class Position {              // Just a useful class for storing the
      public:                     // position of something (e.g. a neuron).
        int x,
            y;
    };

    vector<Position> vPositions;  // Contains the positions of neurons,
                                  // exactly mirroring vpNeurons vector
                                  // (i.e. position of the first neuron in
                                  // vpNeurons is stored first in vPositions,
                                  // second is second, etc.)

    // Some colors (on the palette). // NB! Visualizer needs 8 bit color depth.
    int color_of_pin;                // Palette colors 100 and higher are used
    int color_of_txt;                // here, so please don't change them in
    int color_of_node_circle;        // your own program.
    int start_of_blue;
    int start_of_white;

    // Some network parameters duplicated for quicker / easier access.
    int num_of_nodes;
    int second_layer_start;  // If second layer doesn't exist, then it will be
                             // set to num_of_nodes value.

    int output_layer_start;  // If input layer is the only one, then it will
                             // be set to 0, because then input layer is also
                             // output layer.
    double max_weight;

};

#endif // VISUAL_ANN_H