setAttribute(REQUESTOUTPUTPLOTPARAM_ID, $id); } public function getId() { return $this->getAttribute(REQUESTOUTPUTPLOTPARAM_ID); } public function setId($id) { $this->setAttribute(REQUESTOUTPUTPLOTPARAM_ID, $id); } public function addYSerie($yAxis, $index, $xId = -1, $colorSerieId = -1, $min = NULL, $max = NULL) { if ($xId != -1) { $ySerieNode = new RequestOutputPlotYSerieNodeClass(REQUESTOUTPUTPLOTYSERIE_XYPLOT_NAME); $ySerieNode->setXId($xId); $ySerieNode->setXAxisId(REQUESTOUTPUTPLOTELEMENTXY_XAXISID); } else $ySerieNode = new RequestOutputPlotYSerieNodeClass(REQUESTOUTPUTPLOTYSERIE_TIMEPLOT_NAME); $ySerieNode->setYAxisId($yAxis); if (isset($min)) $ySerieNode->setMin($min); if (isset($max)) $ySerieNode->setMax($max); if ($index >= 0) $ySerieNode->setIndex($index); if ($colorSerieId >= 0) $ySerieNode->setColorSerieId($colorSerieId); $this->addChild($ySerieNode); return $ySerieNode; } public function addOrbitSerie($yAxis, $colorSerieId = -1) { $orbitSerieNode = new RequestOutputPlotOrbitSerieNodeClass(); $orbitSerieNode->setXAxisId(REQUESTOUTPUTPLOTELEMENTXY_XAXISID); $orbitSerieNode->setYAxisId($yAxis); if ($colorSerieId >= 0) $orbitSerieNode->setColorSerieId($colorSerieId); $this->addChild($orbitSerieNode); return $orbitSerieNode; } public function addInstantSerie($yAxis) { $iserieNode = new RequestOutputPlotInstantSerieNodeClass(); $iserieNode->setXAxisId(REQUESTOUTPUTPLOTELEMENTXY_XAXISID); $iserieNode->setYAxisId($yAxis); $this->addChild($iserieNode); return $iserieNode; } public function addSpectro( $yAxis = "", $resolution = "", $index = NULL, $min = NULL, $max = NULL, $uselog0asmin = FALSE, $normalization = NULL, $bgs_type = NULL, $bgs_value = NULL, $bgs_dim = NULL ) { $spectroNode = new NodeClass(REQUESTOUTPUTPLOTSPECTRO_NAME); $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_YAXIS, $yAxis); $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_USELOG0ASMIN, $uselog0asmin ? "true" : "false"); if (isset($resolution)) $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_RESOLUTION, $resolution); if (isset($normalization)) $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_NORMALISATION, $normalization); if (isset($bgs_type)) $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_BGS_TYPE, $bgs_type); if (isset($bgs_value)) $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_BGS_VALUE, $bgs_value); if (isset($bgs_dim)) $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_BGS_DIM, $bgs_dim); if (isset($index)) $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_INDEX, $index); if (isset($min)) $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_MIN, $min); if (isset($max)) $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_MAX, $max); $this->addChild($spectroNode); return $spectroNode; } public function addSauvaud( $yAxis = "", $resolution = "", $index = NULL, $min = NULL, $max = NULL, $uselog0asmin = FALSE, $normalization = NULL, $bgs_type = NULL, $bgs_value = NULL, $bgs_dim = NULL, $rightDim = NULL ) { $sauvaudNode = new NodeClass(REQUESTOUTPUTPLOTSAUVAUD_NAME); $sauvaudNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_YAXIS, $yAxis); $sauvaudNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_USELOG0ASMIN, $uselog0asmin ? "true" : "false"); if (isset($resolution)) $sauvaudNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_RESOLUTION, $resolution); if (isset($normalization)) $sauvaudNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_NORMALISATION, $normalization); if (isset($bgs_type)) $sauvaudNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_BGS_TYPE, $bgs_type); if (isset($bgs_value)) $sauvaudNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_BGS_VALUE, $bgs_value); if (isset($bgs_dim)) $sauvaudNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_BGS_DIM, $bgs_dim); if (isset($index)) $sauvaudNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_INDEX, $index); if (isset($min)) $sauvaudNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_MIN, $min); if (isset($max)) $sauvaudNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_MAX, $max); if(isset($rightDim)) $sauvaudNode->setAttribute(REQUESTOUTPUTPLOTSAUVAUD_RIGHT_DIM, $rightDim); $this->addChild($sauvaudNode); return $sauvaudNode; } public function addInstantSpectro($yAxis, $dimOnXAxis, $index = NULL, $min = NULL, $max = NULL) { $ispectroNode = new NodeClass(REQUESTOUTPUTPLOTINSTANTSPECTRO_NAME); $ispectroNode->setAttribute(REQUESTOUTPUTPLOTINSTANTSPECTRO_XAXIS, REQUESTOUTPUTPLOTELEMENTXY_XAXISID); $ispectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_YAXIS, $yAxis); $ispectroNode->setAttribute(REQUESTOUTPUTPLOTINSTANTSPECTRO_DIMONXAXIS, $dimOnXAxis); if (isset($min)) $ispectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_MIN, $min); if (isset($max)) $ispectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_MAX, $max); $this->addChild($ispectroNode); return $ispectroNode; } public function addXSerie($index = -1, $id = 0, $min = NULL, $max = NULL) { $xSerieNode = new NodeClass(REQUESTOUTPUTPLOTXSERIE_NAME); if ($index >= 0) $xSerieNode->setAttribute(REQUESTOUTPUTPLOTXSERIE_INDEX, $index); $xSerieNode->setAttribute(REQUESTOUTPUTPLOTXSERIE_ID, $id); if (isset($min)) $xSerieNode->setAttribute(REQUESTOUTPUTPLOTXSERIE_MIN, $min); if (isset($max)) $xSerieNode->setAttribute(REQUESTOUTPUTPLOTXSERIE_MAX, $max); $this->addChild($xSerieNode); return $xSerieNode; } public function addColorSerie($id = "", $index = -1) { $colorSerieNode = new NodeClass(REQUESTOUTPUTPLOTCOLORSERIE_NAME); $colorSerieNode->setAttribute(REQUESTOUTPUTPLOTCOLORSERIE_ID, $id); if ($index >= 0) $colorSerieNode->setAttribute(REQUESTOUTPUTPLOTCOLORSERIE_INDEX, $index); $this->addChild($colorSerieNode); return $colorSerieNode; } public function addStatusBar($index, $color = NULL) { $statusBarNode = new NodeClass(REQUESTOUTPUTPLOTSTATUSBAR_NAME); if ($index >= 0) $statusBarNode->setAttribute(REQUESTOUTPUTPLOTSTATUSBAR_INDEX, $index); if ($color != NULL) { $statusBarNode->setAttribute(REQUESTOUTPUTPLOTSTATUSBAR_COLOR, $color); } $this->addChild($statusBarNode); return $statusBarNode; } public function addTickBar($index) { $tickBarNode = new NodeClass(REQUESTOUTPUTPLOTTICKBAR_NAME); if ($index >= 0) $tickBarNode->setAttribute(REQUESTOUTPUTPLOTTICKBAR_INDEX, $index); $this->addChild($tickBarNode); return $tickBarNode; } public function addIntervals($color = NULL) { $intervalsNode = new RequestOutputPlotIntervalsNodeClass(); if ($color != NULL) { $intervalsNode->setColor($color); } $this->addChild($intervalsNode); return $intervalsNode; } public function loadFromNode($xmlNode) { $this->setId($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTPARAM_ID)); foreach ($this->getXmlNodeChildren($xmlNode) as $plottypeXmlNode) { $node = NULL; switch ($this->getXmlNodeName($plottypeXmlNode)) { case REQUESTOUTPUTPLOTYSERIE_XYPLOT_NAME: $node = new RequestOutputPlotYSerieNodeClass(REQUESTOUTPUTPLOTYSERIE_XYPLOT_NAME); break; case REQUESTOUTPUTPLOTYSERIE_TIMEPLOT_NAME: $node = new RequestOutputPlotYSerieNodeClass(REQUESTOUTPUTPLOTYSERIE_TIMEPLOT_NAME); break; case REQUESTOUTPUTPLOTORBITSERIE_NAME: $node = new RequestOutputPlotOrbitSerieNodeClass(); break; case REQUESTOUTPUTPLOTINSTANTSERIE_NAME: $node = new RequestOutputPlotInstantSerieNodeClass(); break; case REQUESTOUTPUTPLOTSPECTRO_NAME: $yAxis = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTSPECTRO_YAXIS); $index = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTSPECTRO_INDEX); $min = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTSPECTRO_MIN); $max = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTSPECTRO_MAX); $resolution = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTSPECTRO_RESOLUTION); $uselog0asmin = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTSPECTRO_USELOG0ASMIN) == "true"; $node = $this->addSpectro($yAxis, $resolution, $index, $min, $max, $uselog0asmin); break; case REQUESTOUTPUTPLOTSAUVAUD_NAME: $yAxis = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTSPECTRO_YAXIS); $index = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTSPECTRO_INDEX); $min = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTSPECTRO_MIN); $max = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTSPECTRO_MAX); $resolution = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTSPECTRO_RESOLUTION); $uselog0asmin = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTSPECTRO_USELOG0ASMIN) == "true"; $rightDim = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTSAUVAUD_RIGHT_DIM); $node = $this->addSauvaud($yAxis, $resolution, $index, $min, $max, $uselog0asmin, $rightDim); break; case REQUESTOUTPUTPLOTXSERIE_NAME: $xAxis = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTXSERIE_XAXIS); $index = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTXSERIE_INDEX); if (empty($index)) $index = -1; $xId = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTXSERIE_XID); if (empty($xId)) $xId = 0; $min = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTXSERIE_MIN); $max = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTXSERIE_MAX); $node = $this->addXSerie($index, $xId, $min, $max); break; case REQUESTOUTPUTPLOTCOLORSERIE_NAME: $id = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTCOLORSERIE_ID); $index = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTCOLORSERIE_INDEX); if (empty($index)) $index = -1; $node = $this->addColorSerie($id, $index); break; case REQUESTOUTPUTPLOTSTATUSBAR_NAME: $index = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTSTATUSBAR_INDEX); if (empty($index)) $index = -1; $node = $this->addStatusBar($index); break; case REQUESTOUTPUTPLOTTICKBAR_NAME: $index = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTTICKBAR_INDEX); if (empty($index)) $index = -1; $node = $this->addTickBar($index); break; default: } if (isset($node)) { $node->loadFromNode($plottypeXmlNode); $this->addChild($node); } } } } /** * @class RequestOutputPlotParamsNodeClass * @brief Definition of a params for a plot of a plot request * @details */ class RequestOutputPlotParamsNodeClass extends NodeClass { public function __construct() { parent::__construct(REQUESTOUTPUTPLOTPARAMS_NAME); } public function getParamById($id = "") { $paramNodes = $this->getChildrenByName(REQUESTOUTPUTPLOTPARAM_NAME); foreach ($paramNodes as $paramNode) if ($paramNode->getId() == $id) return $paramNode; //create new param $paramNode = new RequestOutputPlotParamNodeClass($id); $this->addChild($paramNode); return $paramNode; } public function loadFromNode($xmlNode) { foreach ($this->getXmlNodeChildrenByTagName($xmlNode, REQUESTOUTPUTPLOTPARAM_NAME) as $paramXmlNode) { $this->getParamById()->loadFromNode($paramXmlNode); } } }