/*******************************  LICENSE  *******************************


 Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
 
 Licensed under the Apache License, Version 2.0 (the "License"); 
 you may not use this file except in compliance with the License. 
 You may obtain a copy of the License at 
 
 	http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software 
 distributed under the License is distributed on an "AS IS" BASIS, 
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 See the License for the specific language governing permissions and 
 limitations under the License.


 *******************************  LICENSE  *******************************/

/*! \file BoxPlotWhiskerBorderAttributes.cc
    \brief Implemtation of BoxPlotWhiskerBorder Attributes class.
    \author MeteoroMagLogical Visualisation Section, ECMWF

    This file is automatically generated.
    Do Not Edit!
   
    Generated: Tue Nov 22 10:53:40 2011
*/    

#include "BoxPlotWhiskerBorderAttributes.h"
#include "MagicsParameter.h"
#include "Factory.h"
#include "MagTranslator.h"
#include "XmlNode.h"
#include "ParameterSettings.h"


using namespace magics;


BoxPlotWhiskerBorderAttributes::BoxPlotWhiskerBorderAttributes():
	colour_(MagTranslator<string, Colour>().magics("boxplot_whisker_box_border_colour")),
	thickness_(ParameterManager::getInt("boxplot_whisker_box_border_thickness")),
	style_(MagTranslator<string, LineStyle>().magics("boxplot_whisker_box_border_line_style"))
{
} 



BoxPlotWhiskerBorderAttributes::~BoxPlotWhiskerBorderAttributes()
{
}

    
void BoxPlotWhiskerBorderAttributes::set(const std::map<string, string>& params)
{
	vector<string> prefix(4);
	prefix[0] = "boxplot_whisker_box_border";
	prefix[1] = "boxplot_whisker_box";
	prefix[2] = "boxplot_whisker";
	prefix[3] = "boxplot";

	setAttribute(prefix, "boxplot_whisker_box_border_colour", colour_, params);
	setAttribute(prefix, "boxplot_whisker_box_border_thickness", thickness_, params);
	setAttribute(prefix, "boxplot_whisker_box_border_line_style", style_, params);
}

void BoxPlotWhiskerBorderAttributes::copy(const BoxPlotWhiskerBorderAttributes& other)
{
	setColour(other.colour_->clone());
	thickness_ = other.thickness_;
	style_ = other.style_;
} 


bool BoxPlotWhiskerBorderAttributes::accept(const string& node)
{	
	if ( magCompare(node, "whisker_border")  )
		return true;
	return false;
}

void BoxPlotWhiskerBorderAttributes::set(const XmlNode& node)
{
	if ( this->accept(node.name()) == false ) 
		return;

	if ( magCompare(node.name(), "whisker_border") )
		set(node.attributes());
	else {
	}
	for (XmlNode::ElementIterator elt = node.firstElement(); elt != node.lastElement(); ++elt) {
	}
}

void BoxPlotWhiskerBorderAttributes::print(ostream& out)  const
{
	out << "BoxPlotWhiskerBorderAttributes[";
	out << "colour = " << *colour_;
	out << ", thickness = " << thickness_;
	out << ", style = " << style_;
	out << "]" << "\n";
}


void BoxPlotWhiskerBorderAttributes::toxml(ostream& out, const string& tag, int tabs)  const
{
     out <<  "\"whisker_border\"";
	 out << ", \"boxplot_whisker_box_border_colour\":";
	 niceprint(out, *colour_);
	 out << ", \"boxplot_whisker_box_border_thickness\":";
	 niceprint(out,thickness_);
	 out << ", \"boxplot_whisker_box_border_line_style\":";
	 niceprint(out,style_);
}
static MagicsParameter<string> boxplot_whisker_box_border_colour("boxplot_whisker_box_border_colour", "navy", "");
static MagicsParameter<int> boxplot_whisker_box_border_thickness("boxplot_whisker_box_border_thickness", 1, "");
static MagicsParameter<string> boxplot_whisker_box_border_line_style("boxplot_whisker_box_border_line_style", "solid", "");
