RequestOutputPlotAxisElementNodeClass.php 6.85 KB
<?php

define ("REQUESTOUTPUTPLOTAXISELEMENT_POSITION", "position");
define ("REQUESTOUTPUTPLOTAXISELEMENT_REVERSE", "reverse");
define ("REQUESTOUTPUTPLOTAXISELEMENT_VISIBLE", "visible");
define ("REQUESTOUTPUTPLOTAXISELEMENT_SCALE", "scale");
define ("REQUESTOUTPUTPLOTAXISELEMENT_COLOR", "color");
define ("REQUESTOUTPUTPLOTAXISELEMENT_THICKNESS", "thickness");
define ("REQUESTOUTPUTPLOTAXISELEMENT_SHOWLEGEND", "showLegend");
define ("REQUESTOUTPUTPLOTAXISELEMENT_TICKMARKS", "showTickMark");

define ("REQUESTOUTPUTPLOTAXISELEMENTRANGE_NAME", "range");
define ("REQUESTOUTPUTPLOTAXISELEMENTRANGE_MIN", "min");
define ("REQUESTOUTPUTPLOTAXISELEMENTRANGE_MAX", "max");
define ("REQUESTOUTPUTPLOTAXISELEMENTRANGE_EXTEND", "extend");

define ("REQUESTOUTPUTPLOTAXISELEMENTTICK_NAME", "tick");
define ("REQUESTOUTPUTPLOTAXISELEMENTTICK_POSITION", "position");
define ("REQUESTOUTPUTPLOTAXISELEMENTTICK_MINORGRID", "minorGrid");
define ("REQUESTOUTPUTPLOTAXISELEMENTTICK_MAJORGRID", "majorGrid");

define ("REQUESTOUTPUTPLOTAXISELEMENTLEGEND_NAME", "legend");
define ("REQUESTOUTPUTPLOTAXISELEMENTLEGEND_TEXT", "text");

abstract class RequestOutputPlotAxisElementScale
{
	const LINEAR      = "linear";
	const LOGARITHMIC = "logarithmic";
}

abstract class RequestOutputPlotAxisElementTickPosition
{
	const INWARDS  = "inwards";
	const OUTWARDS = "outwards";
}

abstract class RequestOutputPlotAxisElementPosition
{
	const TOP    = "top";
	const BOTTOM = "bottom";
	const LEFT   = "bottom";
	const RIGHT  = "right";
}

/**
 * @class RequestOutputPlotAxisElementRangeNodeClass
 * @brief Definition of range for an axis
 * @details
*/
class RequestOutputPlotAxisElementRangeNodeClass extends NodeClass
{
	public function __construct()
	{
		parent::__construct(REQUESTOUTPUTPLOTAXISELEMENTRANGE_NAME);
	}

	public function setMinMax($min, $max)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENTRANGE_MIN, $min);
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENTRANGE_MAX, $max);
	}

	public function getMin()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENTRANGE_MIN);
	}

	public function getMax()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENTRANGE_MAX);
	}

	public function setExtend($extend)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENTRANGE_EXTEND, $extend);
	}

	public function getExtend()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENTRANGE_EXTEND);
	}
}

/**
 * @class RequestOutputPlotAxisElementTickClass
 * @brief Definition of ticks for an axis
 * @details
 */
class RequestOutputPlotAxisElementTickClass extends NodeClass
{
	public function __construct()
	{
		parent::__construct(REQUESTOUTPUTPLOTAXISELEMENTTICK_NAME);
	}
	
	public function setPosition($position)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_POSITION, $position);
	}
	
	public function getPosition()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_POSITION);
	}
	
	public function setMinorGrid($minorGrid)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_MINORGRID, $minorGrid);
	}
	
	public function getMinorGrid()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_MINORGRID);
	}
	
	public function setMajorGrid($majorGrid)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_MAJORGRID, $majorGrid);
	}
	
	public function getMajorGrid()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_MAJORGRID);
	}
}

/**
 * @class RequestOutputPlotAxisElementLegendNodeClass
 * @brief Definition of legend for an axis
 * @details
 */
class RequestOutputPlotAxisElementLegendNodeClass extends RequestOutputPlotLabelNodeClass
{
	public function __construct()
	{
		parent::__construct(REQUESTOUTPUTPLOTAXISELEMENTLEGEND_NAME);
	}

	public function setText($text)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENTLEGEND_TEXT, $text);
	}

	public function getText()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENTLEGEND_TEXT);
	}
}

/**
 * @class RequestOutputPlotAxisElementNodeClass
 * @brief Definition of a plot axis element for a plot element of a plot request
 * @details
 */
class RequestOutputPlotAxisElementNodeClass extends NodeClass
{
	public function __construct($axisElementName)
	{
		parent::__construct($axisElementName);

		//create axis element skeleton

		//range
		$node = new RequestOutputPlotAxisElementRangeNodeClass();
		$this->addChild($node);

		//tick
		$node = new RequestOutputPlotAxisElementTickClass();
		$this->addChild($node);
		
		//legend
		$node = new RequestOutputPlotAxisElementLegendNodeClass();
		$this->addChild($node);
	}

	public function getRange()
	{
		return $this->getFirstChildByName(REQUESTOUTPUTPLOTAXISELEMENTRANGE_NAME);
	}

	public function getTick()
	{
		return $this->getFirstChildByName(REQUESTOUTPUTPLOTAXISELEMENTTICK_NAME);
	}

	public function getLegend()
	{
		return $this->getFirstChildByName(REQUESTOUTPUTPLOTAXISELEMENTLEGEND_NAME);
	}

	/* ToDo constantLine */

	/* ToDo origin */

	public function setPosition($position)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENT_POSITION, $position);
	}

	public function getPosition()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENT_POSITION);
	}

	public function setThickness($thickness)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENT_THICKNESS, $thickness);
	}

	public function getThickness()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENT_THICKNESS);
	}
	
	public function setColor($color)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENT_COLOR, $color);
	}
	
	public function getColor()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENT_COLOR);
	}

	public function setReverse($reverse)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENT_REVERSE, $reverse);
	}

	public function getReverse()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENT_REVERSE);
	}

	public function setVisible($visible)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENT_VISIBLE, $visible);
	}

	public function getVisible()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENT_VISIBLE);
	}

	public function setScale($scale)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENT_SCALE, $scale);
	}

	public function getScale()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENT_SCALE);
	}

	public function setShowLegend($show)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENT_SHOWLEGEND, $show);
	}
	
	public function getShowLegend()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENT_SHOWLEGEND);
	}
	
	public function setShowTickMarks($show)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENT_TICKMARKS, $show);
	}
	
	public function getShowTickMarks()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENT_TICKMARKS);
	}
}

?>