#ifndef AXES_H
#define AXES_H

#include "Range.h"

class Axes {

	/** min/max value to display */
	Range range;

	/** number of available pixels for above range */
	int pixels;

	/** whether to invert the axes */
	bool invert = false;

public:

	void setMin(const float min) {this->range.min = min;}
	float getMin() const {return this->range.min;}

	void setMax(const float max) {this->range.max = max;}
	float getMax() const {return this->range.max;}

	void setRange(const Range& range) {this->range = range;}
	const Range& getRange() const {return this->range;}

	void setPixels(const int px) {this->pixels = px;}
	int getPixels() const {return this->pixels;}

	void setInverted(const bool inverted) {this->invert = inverted;}
	bool isInverted() const {return this->invert;}

	float convert(const float val) const {
		float percent = (val - range.min) / (range.getSize());
		if (invert) {percent = 1-percent;}
		return percent * pixels;
	}

};

class AxesX : public Axes {

public:

	AxesX() {
		setInverted(false);
	}

	void setWidth(const int px) {setPixels(px);}

};

class AxesY : public Axes {

public:

	AxesY() {
		setInverted(true);
	}

	void setHeight(const int px) {setPixels(px);}

};

#endif // AXES_H
