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

 * (C) Copyright 1996-2017 ECMWF.
 *
 * This software is licensed under the terms of the Apache Licence Version 2.0
 * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
 * In applying this licence, ECMWF does not waive the privileges and immunities
 * granted to it by virtue of its status as an intergovernmental organisation nor
 * does it submit to any jurisdiction.

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

/*! \\file MarkerValuePlotMethodAttributes.h
    \\brief Definition of MarkerValuePlotMethod Attributes class.

    This file is automatically generated.
    Do Not Edit!
*/

#include "MarkerValuePlotMethodAttributes.h"
#include "MagicsParameter.h"
#include "ParameterSettings.h"

using namespace magics;

MarkerValuePlotMethodAttributes::MarkerValuePlotMethodAttributes():
	marker_height_(ParameterManager::getDouble("contour_grid_value_marker_height")),
	marker_quality_(ParameterManager::getString("contour_grid_value_marker_qual")),
	marker_index_(ParameterManager::getInt("contour_grid_value_marker_index"))
	,
	marker_colour_(MagTranslator<string, Colour>().magics("contour_grid_value_marker_colour"))
	
{
}


MarkerValuePlotMethodAttributes::~MarkerValuePlotMethodAttributes()
{

}


void MarkerValuePlotMethodAttributes::set(const std::map<string, string>& params)
{
	vector<string> prefix(3);
	int i = 0;
	prefix[i++] = "contour";
	prefix[i++] = "contour_grid_value";
	prefix[i++] = "contour_grid_value";
	
	setAttribute(prefix, "contour_grid_value_marker_height", marker_height_, params);
	setAttribute(prefix, "contour_grid_value_marker_qual", marker_quality_, params);
	setAttribute(prefix, "contour_grid_value_marker_index", marker_index_, params);
	
	setMember(prefix, "contour_grid_value_marker_colour", marker_colour_, params);
	
}

void MarkerValuePlotMethodAttributes::copy(const MarkerValuePlotMethodAttributes& other)
{
	marker_height_ = other.marker_height_;
	marker_quality_ = other.marker_quality_;
	marker_index_ = other.marker_index_;
	marker_colour_ = unique_ptr<Colour>(other.marker_colour_->clone());
	
}


bool MarkerValuePlotMethodAttributes::accept(const string& node)
{

	if ( magCompare(node, "marker")  )
		return true;
	
	return false;
}

void MarkerValuePlotMethodAttributes::set(const XmlNode& node)
{
	bool apply = false;

	if ( this->accept(node.name()) == false )
		return;

	if ( magCompare(node.name(), "marker")  )
		apply = true;
	

	if ( apply )
		set(node.attributes());
	else {
		
	}
	for (auto &elt : node.elements())
	{
		
	}
}

void MarkerValuePlotMethodAttributes::print(ostream& out)  const
{
	out << "Attributes[";
	out << " marker_height = " <<  marker_height_;
	out << " marker_quality = " <<  marker_quality_;
	out << " marker_index = " <<  marker_index_;
	out << " marker_colour = " <<  *marker_colour_;
	
	out << "]" << "\n";
}

void MarkerValuePlotMethodAttributes::toxml(ostream& out)  const
{
	out <<  "\"marker\"";
	out << ", \"contour_grid_value_marker_height\":";
	niceprint(out,marker_height_);
	out << ", \"contour_grid_value_marker_qual\":";
	niceprint(out,marker_quality_);
	out << ", \"contour_grid_value_marker_index\":";
	niceprint(out,marker_index_);
	out << ", \"contour_grid_value_marker_colour\":";
	niceprint(out, *marker_colour_);
	
}

static MagicsParameter<double> contour_grid_value_marker_height("contour_grid_value_marker_height", 0.25);
static MagicsParameter<string> contour_grid_value_marker_qual("contour_grid_value_marker_qual", "low");
static MagicsParameter<int> contour_grid_value_marker_index("contour_grid_value_marker_index", 3);
static MagicsParameter<string> contour_grid_value_marker_colour("contour_grid_value_marker_colour", "red");
