/* 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 "vtkPolyDataAlgorithmWrap.h"
#include "vtkOutlineSourceWrap.h"
#include "vtkObjectBaseWrap.h"
#include "../../plus/plus.h"

using namespace v8;

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

VtkOutlineSourceWrap::VtkOutlineSourceWrap()
{ }

VtkOutlineSourceWrap::VtkOutlineSourceWrap(vtkSmartPointer<vtkOutlineSource> _native)
{ native = _native; }

VtkOutlineSourceWrap::~VtkOutlineSourceWrap()
{ }

void VtkOutlineSourceWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkOutlineSource").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("OutlineSource").ToLocalChecked(), ConstructorGetter);
}

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

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

	Nan::SetPrototypeMethod(tpl, "GenerateFacesOff", GenerateFacesOff);
	Nan::SetPrototypeMethod(tpl, "generateFacesOff", GenerateFacesOff);

	Nan::SetPrototypeMethod(tpl, "GenerateFacesOn", GenerateFacesOn);
	Nan::SetPrototypeMethod(tpl, "generateFacesOn", GenerateFacesOn);

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

	Nan::SetPrototypeMethod(tpl, "GetBoxType", GetBoxType);
	Nan::SetPrototypeMethod(tpl, "getBoxType", GetBoxType);

	Nan::SetPrototypeMethod(tpl, "GetCorners", GetCorners);
	Nan::SetPrototypeMethod(tpl, "getCorners", GetCorners);

	Nan::SetPrototypeMethod(tpl, "GetGenerateFaces", GetGenerateFaces);
	Nan::SetPrototypeMethod(tpl, "getGenerateFaces", GetGenerateFaces);

	Nan::SetPrototypeMethod(tpl, "GetOutputPointsPrecision", GetOutputPointsPrecision);
	Nan::SetPrototypeMethod(tpl, "getOutputPointsPrecision", GetOutputPointsPrecision);

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

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

	Nan::SetPrototypeMethod(tpl, "SetBounds", SetBounds);
	Nan::SetPrototypeMethod(tpl, "setBounds", SetBounds);

	Nan::SetPrototypeMethod(tpl, "SetBoxType", SetBoxType);
	Nan::SetPrototypeMethod(tpl, "setBoxType", SetBoxType);

	Nan::SetPrototypeMethod(tpl, "SetBoxTypeToAxisAligned", SetBoxTypeToAxisAligned);
	Nan::SetPrototypeMethod(tpl, "setBoxTypeToAxisAligned", SetBoxTypeToAxisAligned);

	Nan::SetPrototypeMethod(tpl, "SetBoxTypeToOriented", SetBoxTypeToOriented);
	Nan::SetPrototypeMethod(tpl, "setBoxTypeToOriented", SetBoxTypeToOriented);

	Nan::SetPrototypeMethod(tpl, "SetCorners", SetCorners);
	Nan::SetPrototypeMethod(tpl, "setCorners", SetCorners);

	Nan::SetPrototypeMethod(tpl, "SetGenerateFaces", SetGenerateFaces);
	Nan::SetPrototypeMethod(tpl, "setGenerateFaces", SetGenerateFaces);

	Nan::SetPrototypeMethod(tpl, "SetOutputPointsPrecision", SetOutputPointsPrecision);
	Nan::SetPrototypeMethod(tpl, "setOutputPointsPrecision", SetOutputPointsPrecision);

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

void VtkOutlineSourceWrap::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<vtkOutlineSource> native = vtkSmartPointer<vtkOutlineSource>::New();
		VtkOutlineSourceWrap* obj = new VtkOutlineSourceWrap(native);
		obj->Wrap(info.This());
	}
	else
	{
		if(info[0]->ToObject() != vtkNodeJsNoWrap )
		{
			Nan::ThrowError("Parameter Error");
			return;
		}
	}

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

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

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

void VtkOutlineSourceWrap::GetBounds(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkOutlineSourceWrap *wrapper = ObjectWrap::Unwrap<VtkOutlineSourceWrap>(info.Holder());
	vtkOutlineSource *native = (vtkOutlineSource *)wrapper->native.GetPointer();
	double const * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetBounds();
	Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(v8::Isolate::GetCurrent(), 6 * sizeof(double));
	Local<v8::Float64Array> at = v8::Float64Array::New(ab, 0, 6);
	memcpy(ab->GetContents().Data(), r, 6 * sizeof(double));
	info.GetReturnValue().Set(at);
}

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

void VtkOutlineSourceWrap::GetCorners(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkOutlineSourceWrap *wrapper = ObjectWrap::Unwrap<VtkOutlineSourceWrap>(info.Holder());
	vtkOutlineSource *native = (vtkOutlineSource *)wrapper->native.GetPointer();
	double const * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetCorners();
	Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(v8::Isolate::GetCurrent(), 24 * sizeof(double));
	Local<v8::Float64Array> at = v8::Float64Array::New(ab, 0, 24);
	memcpy(ab->GetContents().Data(), r, 24 * sizeof(double));
	info.GetReturnValue().Set(at);
}

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

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

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

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

void VtkOutlineSourceWrap::SetBounds(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkOutlineSourceWrap *wrapper = ObjectWrap::Unwrap<VtkOutlineSourceWrap>(info.Holder());
	vtkOutlineSource *native = (vtkOutlineSource *)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() < 6 )
		{
			Nan::ThrowError("Array too short.");
			return;
		}

				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetBounds(
			(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[6];
		if( a0->Length() < 6 )
		{
			Nan::ThrowError("Array too short.");
			return;
		}

		for( i = 0; i < 6; 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->SetBounds(
			b0
		);
		return;
	}
	else if(info.Length() > 0 && info[0]->IsNumber())
	{
		if(info.Length() > 1 && info[1]->IsNumber())
		{
			if(info.Length() > 2 && info[2]->IsNumber())
			{
				if(info.Length() > 3 && info[3]->IsNumber())
				{
					if(info.Length() > 4 && info[4]->IsNumber())
					{
						if(info.Length() > 5 && info[5]->IsNumber())
						{
														if(info.Length() != 6)
							{
								Nan::ThrowError("Too many parameters.");
								return;
							}
							native->SetBounds(
								info[0]->NumberValue(),
								info[1]->NumberValue(),
								info[2]->NumberValue(),
								info[3]->NumberValue(),
								info[4]->NumberValue(),
								info[5]->NumberValue()
							);
							return;
						}
					}
				}
			}
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

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

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

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

void VtkOutlineSourceWrap::SetCorners(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkOutlineSourceWrap *wrapper = ObjectWrap::Unwrap<VtkOutlineSourceWrap>(info.Holder());
	vtkOutlineSource *native = (vtkOutlineSource *)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() < 24 )
		{
			Nan::ThrowError("Array too short.");
			return;
		}

				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetCorners(
			(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[24];
		if( a0->Length() < 24 )
		{
			Nan::ThrowError("Array too short.");
			return;
		}

		for( i = 0; i < 24; 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->SetCorners(
			b0
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

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

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

