/* this file has been autogenerated by vtkNodeJsWrap */
/* editing this might proof futile */

#define VTK_WRAPPING_CXX
#define VTK_STREAMS_FWD_ONLY
#include <nan.h>

#include "vtkChartLegendWrap.h"
#include "vtkColorLegendWrap.h"
#include "vtkObjectWrap.h"
#include "vtkContext2DWrap.h"
#include "vtkScalarsToColorsWrap.h"
#include "../../plus/plus.h"

using namespace v8;

extern Nan::Persistent<v8::Object> vtkNodeJsNoWrap;
Nan::Persistent<v8::FunctionTemplate> VtkColorLegendWrap::ptpl;

VtkColorLegendWrap::VtkColorLegendWrap()
{ }

VtkColorLegendWrap::VtkColorLegendWrap(vtkSmartPointer<vtkColorLegend> _native)
{ native = _native; }

VtkColorLegendWrap::~VtkColorLegendWrap()
{ }

void VtkColorLegendWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkColorLegend").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("ColorLegend").ToLocalChecked(), ConstructorGetter);
}

void VtkColorLegendWrap::ConstructorGetter(
	v8::Local<v8::String> property,
	const Nan::PropertyCallbackInfo<v8::Value>& info)
{
	InitPtpl();
	info.GetReturnValue().Set(Nan::New(ptpl)->GetFunction());
}

void VtkColorLegendWrap::InitPtpl()
{
	if (!ptpl.IsEmpty()) return;
	v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New);
	VtkChartLegendWrap::InitPtpl( );
	tpl->Inherit(Nan::New<FunctionTemplate>(VtkChartLegendWrap::ptpl));
	tpl->SetClassName(Nan::New("VtkColorLegendWrap").ToLocalChecked());
	tpl->InstanceTemplate()->SetInternalFieldCount(1);

	Nan::SetPrototypeMethod(tpl, "DrawBorderOff", DrawBorderOff);
	Nan::SetPrototypeMethod(tpl, "drawBorderOff", DrawBorderOff);

	Nan::SetPrototypeMethod(tpl, "DrawBorderOn", DrawBorderOn);
	Nan::SetPrototypeMethod(tpl, "drawBorderOn", DrawBorderOn);

	Nan::SetPrototypeMethod(tpl, "GetBounds", GetBounds);
	Nan::SetPrototypeMethod(tpl, "getBounds", GetBounds);

	Nan::SetPrototypeMethod(tpl, "GetClassName", GetClassName);
	Nan::SetPrototypeMethod(tpl, "getClassName", GetClassName);

	Nan::SetPrototypeMethod(tpl, "GetDrawBorder", GetDrawBorder);
	Nan::SetPrototypeMethod(tpl, "getDrawBorder", GetDrawBorder);

	Nan::SetPrototypeMethod(tpl, "GetOrientation", GetOrientation);
	Nan::SetPrototypeMethod(tpl, "getOrientation", GetOrientation);

	Nan::SetPrototypeMethod(tpl, "GetTransferFunction", GetTransferFunction);
	Nan::SetPrototypeMethod(tpl, "getTransferFunction", GetTransferFunction);

	Nan::SetPrototypeMethod(tpl, "IsA", IsA);
	Nan::SetPrototypeMethod(tpl, "isA", IsA);

	Nan::SetPrototypeMethod(tpl, "NewInstance", NewInstance);
	Nan::SetPrototypeMethod(tpl, "newInstance", NewInstance);

	Nan::SetPrototypeMethod(tpl, "Paint", Paint);
	Nan::SetPrototypeMethod(tpl, "paint", Paint);

	Nan::SetPrototypeMethod(tpl, "SafeDownCast", SafeDownCast);
	Nan::SetPrototypeMethod(tpl, "safeDownCast", SafeDownCast);

	Nan::SetPrototypeMethod(tpl, "SetDrawBorder", SetDrawBorder);
	Nan::SetPrototypeMethod(tpl, "setDrawBorder", SetDrawBorder);

	Nan::SetPrototypeMethod(tpl, "SetOrientation", SetOrientation);
	Nan::SetPrototypeMethod(tpl, "setOrientation", SetOrientation);

	Nan::SetPrototypeMethod(tpl, "SetPoint", SetPoint);
	Nan::SetPrototypeMethod(tpl, "setPoint", SetPoint);

	Nan::SetPrototypeMethod(tpl, "SetTextureSize", SetTextureSize);
	Nan::SetPrototypeMethod(tpl, "setTextureSize", SetTextureSize);

	Nan::SetPrototypeMethod(tpl, "SetTransferFunction", SetTransferFunction);
	Nan::SetPrototypeMethod(tpl, "setTransferFunction", SetTransferFunction);

	Nan::SetPrototypeMethod(tpl, "Update", Update);
	Nan::SetPrototypeMethod(tpl, "update", Update);

#ifdef VTK_NODE_PLUS_VTKCOLORLEGENDWRAP_INITPTPL
	VTK_NODE_PLUS_VTKCOLORLEGENDWRAP_INITPTPL
#endif
	ptpl.Reset( tpl );
}

void VtkColorLegendWrap::New(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	if(!info.IsConstructCall())
	{
		Nan::ThrowError("Constructor not called in a construct call.");
		return;
	}

	if(info.Length() == 0)
	{
		vtkSmartPointer<vtkColorLegend> native = vtkSmartPointer<vtkColorLegend>::New();
		VtkColorLegendWrap* obj = new VtkColorLegendWrap(native);
		obj->Wrap(info.This());
	}
	else
	{
		if(info[0]->ToObject() != vtkNodeJsNoWrap )
		{
			Nan::ThrowError("Parameter Error");
			return;
		}
	}

	info.GetReturnValue().Set(info.This());
}

void VtkColorLegendWrap::DrawBorderOff(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkColorLegendWrap *wrapper = ObjectWrap::Unwrap<VtkColorLegendWrap>(info.Holder());
	vtkColorLegend *native = (vtkColorLegend *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->DrawBorderOff();
}

void VtkColorLegendWrap::DrawBorderOn(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkColorLegendWrap *wrapper = ObjectWrap::Unwrap<VtkColorLegendWrap>(info.Holder());
	vtkColorLegend *native = (vtkColorLegend *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->DrawBorderOn();
}

void VtkColorLegendWrap::GetBounds(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkColorLegendWrap *wrapper = ObjectWrap::Unwrap<VtkColorLegendWrap>(info.Holder());
	vtkColorLegend *native = (vtkColorLegend *)wrapper->native.GetPointer();
	size_t i;
	if(info.Length() > 0 && info[0]->IsFloat64Array())
	{
		v8::Local<v8::Float64Array>a0(v8::Local<v8::Float64Array>::Cast(info[0]->ToObject()));
		if( a0->Length() < 4 )
		{
			Nan::ThrowError("Array too short.");
			return;
		}

				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->GetBounds(
			(double *)(a0->Buffer()->GetContents().Data())
		);
		return;
	}
	else if(info.Length() > 0 && info[0]->IsArray())
	{
		v8::Local<v8::Array>a0(v8::Local<v8::Array>::Cast(info[0]->ToObject()));
		double b0[4];
		if( a0->Length() < 4 )
		{
			Nan::ThrowError("Array too short.");
			return;
		}

		for( i = 0; i < 4; i++ )
		{
			if( !a0->Get(i)->IsNumber() )
			{
				Nan::ThrowError("Array contents invalid.");
				return;
			}
			b0[i] = a0->Get(i)->NumberValue();
		}
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->GetBounds(
			b0
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkColorLegendWrap::GetClassName(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkColorLegendWrap *wrapper = ObjectWrap::Unwrap<VtkColorLegendWrap>(info.Holder());
	vtkColorLegend *native = (vtkColorLegend *)wrapper->native.GetPointer();
	char const * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetClassName();
	info.GetReturnValue().Set(Nan::New(r).ToLocalChecked());
}

void VtkColorLegendWrap::GetDrawBorder(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkColorLegendWrap *wrapper = ObjectWrap::Unwrap<VtkColorLegendWrap>(info.Holder());
	vtkColorLegend *native = (vtkColorLegend *)wrapper->native.GetPointer();
	bool r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetDrawBorder();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkColorLegendWrap::GetOrientation(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkColorLegendWrap *wrapper = ObjectWrap::Unwrap<VtkColorLegendWrap>(info.Holder());
	vtkColorLegend *native = (vtkColorLegend *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetOrientation();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkColorLegendWrap::GetTransferFunction(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkColorLegendWrap *wrapper = ObjectWrap::Unwrap<VtkColorLegendWrap>(info.Holder());
	vtkColorLegend *native = (vtkColorLegend *)wrapper->native.GetPointer();
	vtkScalarsToColors * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetTransferFunction();
	VtkScalarsToColorsWrap::InitPtpl();
	v8::Local<v8::Value> argv[1] =
		{ Nan::New(vtkNodeJsNoWrap) };
	v8::Local<v8::Function> cons =
		Nan::New<v8::FunctionTemplate>(VtkScalarsToColorsWrap::ptpl)->GetFunction();
	v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
	VtkScalarsToColorsWrap *w = new VtkScalarsToColorsWrap();
	w->native = r;
	w->Wrap(wo);
	info.GetReturnValue().Set(wo);
}

void VtkColorLegendWrap::IsA(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkColorLegendWrap *wrapper = ObjectWrap::Unwrap<VtkColorLegendWrap>(info.Holder());
	vtkColorLegend *native = (vtkColorLegend *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsString())
	{
		Nan::Utf8String a0(info[0]);
		int r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->IsA(
			*a0
		);
		info.GetReturnValue().Set(Nan::New(r));
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkColorLegendWrap::NewInstance(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkColorLegendWrap *wrapper = ObjectWrap::Unwrap<VtkColorLegendWrap>(info.Holder());
	vtkColorLegend *native = (vtkColorLegend *)wrapper->native.GetPointer();
	vtkColorLegend * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->NewInstance();
	VtkColorLegendWrap::InitPtpl();
	v8::Local<v8::Value> argv[1] =
		{ Nan::New(vtkNodeJsNoWrap) };
	v8::Local<v8::Function> cons =
		Nan::New<v8::FunctionTemplate>(VtkColorLegendWrap::ptpl)->GetFunction();
	v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
	VtkColorLegendWrap *w = new VtkColorLegendWrap();
	w->native = r;
	w->Wrap(wo);
	info.GetReturnValue().Set(wo);
}

void VtkColorLegendWrap::Paint(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkColorLegendWrap *wrapper = ObjectWrap::Unwrap<VtkColorLegendWrap>(info.Holder());
	vtkColorLegend *native = (vtkColorLegend *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkContext2DWrap::ptpl))->HasInstance(info[0]))
	{
		VtkContext2DWrap *a0 = ObjectWrap::Unwrap<VtkContext2DWrap>(info[0]->ToObject());
		bool r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->Paint(
			(vtkContext2D *) a0->native.GetPointer()
		);
		info.GetReturnValue().Set(Nan::New(r));
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkColorLegendWrap::SafeDownCast(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkColorLegendWrap *wrapper = ObjectWrap::Unwrap<VtkColorLegendWrap>(info.Holder());
	vtkColorLegend *native = (vtkColorLegend *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkObjectWrap::ptpl))->HasInstance(info[0]))
	{
		VtkObjectWrap *a0 = ObjectWrap::Unwrap<VtkObjectWrap>(info[0]->ToObject());
		vtkColorLegend * r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->SafeDownCast(
			(vtkObject *) a0->native.GetPointer()
		);
		VtkColorLegendWrap::InitPtpl();
		v8::Local<v8::Value> argv[1] =
			{ Nan::New(vtkNodeJsNoWrap) };
		v8::Local<v8::Function> cons =
			Nan::New<v8::FunctionTemplate>(VtkColorLegendWrap::ptpl)->GetFunction();
		v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
		VtkColorLegendWrap *w = new VtkColorLegendWrap();
		w->native = r;
		w->Wrap(wo);
		info.GetReturnValue().Set(wo);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkColorLegendWrap::SetDrawBorder(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkColorLegendWrap *wrapper = ObjectWrap::Unwrap<VtkColorLegendWrap>(info.Holder());
	vtkColorLegend *native = (vtkColorLegend *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsBoolean())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetDrawBorder(
			info[0]->BooleanValue()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkColorLegendWrap::SetOrientation(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkColorLegendWrap *wrapper = ObjectWrap::Unwrap<VtkColorLegendWrap>(info.Holder());
	vtkColorLegend *native = (vtkColorLegend *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsInt32())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetOrientation(
			info[0]->Int32Value()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkColorLegendWrap::SetPoint(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkColorLegendWrap *wrapper = ObjectWrap::Unwrap<VtkColorLegendWrap>(info.Holder());
	vtkColorLegend *native = (vtkColorLegend *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsNumber())
	{
		if(info.Length() > 1 && info[1]->IsNumber())
		{
						if(info.Length() != 2)
			{
				Nan::ThrowError("Too many parameters.");
				return;
			}
			native->SetPoint(
				info[0]->NumberValue(),
				info[1]->NumberValue()
			);
			return;
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkColorLegendWrap::SetTextureSize(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkColorLegendWrap *wrapper = ObjectWrap::Unwrap<VtkColorLegendWrap>(info.Holder());
	vtkColorLegend *native = (vtkColorLegend *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsNumber())
	{
		if(info.Length() > 1 && info[1]->IsNumber())
		{
						if(info.Length() != 2)
			{
				Nan::ThrowError("Too many parameters.");
				return;
			}
			native->SetTextureSize(
				info[0]->NumberValue(),
				info[1]->NumberValue()
			);
			return;
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkColorLegendWrap::SetTransferFunction(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkColorLegendWrap *wrapper = ObjectWrap::Unwrap<VtkColorLegendWrap>(info.Holder());
	vtkColorLegend *native = (vtkColorLegend *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkScalarsToColorsWrap::ptpl))->HasInstance(info[0]))
	{
		VtkScalarsToColorsWrap *a0 = ObjectWrap::Unwrap<VtkScalarsToColorsWrap>(info[0]->ToObject());
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetTransferFunction(
			(vtkScalarsToColors *) a0->native.GetPointer()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkColorLegendWrap::Update(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkColorLegendWrap *wrapper = ObjectWrap::Unwrap<VtkColorLegendWrap>(info.Holder());
	vtkColorLegend *native = (vtkColorLegend *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->Update();
}

