/* 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 "vtkGenericCellTessellatorWrap.h"
#include "vtkSimpleCellTessellatorWrap.h"
#include "vtkObjectWrap.h"
#include "vtkGenericAdaptorCellWrap.h"
#include "vtkGenericAttributeCollectionWrap.h"
#include "vtkDoubleArrayWrap.h"
#include "vtkCellArrayWrap.h"
#include "vtkPointDataWrap.h"
#include "vtkGenericDataSetWrap.h"
#include "../../plus/plus.h"

using namespace v8;

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

VtkSimpleCellTessellatorWrap::VtkSimpleCellTessellatorWrap()
{ }

VtkSimpleCellTessellatorWrap::VtkSimpleCellTessellatorWrap(vtkSmartPointer<vtkSimpleCellTessellator> _native)
{ native = _native; }

VtkSimpleCellTessellatorWrap::~VtkSimpleCellTessellatorWrap()
{ }

void VtkSimpleCellTessellatorWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkSimpleCellTessellator").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("SimpleCellTessellator").ToLocalChecked(), ConstructorGetter);
}

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

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

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

	Nan::SetPrototypeMethod(tpl, "GetFixedSubdivisions", GetFixedSubdivisions);
	Nan::SetPrototypeMethod(tpl, "getFixedSubdivisions", GetFixedSubdivisions);

	Nan::SetPrototypeMethod(tpl, "GetGenericCell", GetGenericCell);
	Nan::SetPrototypeMethod(tpl, "getGenericCell", GetGenericCell);

	Nan::SetPrototypeMethod(tpl, "GetMaxAdaptiveSubdivisions", GetMaxAdaptiveSubdivisions);
	Nan::SetPrototypeMethod(tpl, "getMaxAdaptiveSubdivisions", GetMaxAdaptiveSubdivisions);

	Nan::SetPrototypeMethod(tpl, "GetMaxSubdivisionLevel", GetMaxSubdivisionLevel);
	Nan::SetPrototypeMethod(tpl, "getMaxSubdivisionLevel", GetMaxSubdivisionLevel);

	Nan::SetPrototypeMethod(tpl, "Initialize", Initialize);
	Nan::SetPrototypeMethod(tpl, "initialize", Initialize);

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

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

	Nan::SetPrototypeMethod(tpl, "Reset", Reset);
	Nan::SetPrototypeMethod(tpl, "reset", Reset);

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

	Nan::SetPrototypeMethod(tpl, "SetFixedSubdivisions", SetFixedSubdivisions);
	Nan::SetPrototypeMethod(tpl, "setFixedSubdivisions", SetFixedSubdivisions);

	Nan::SetPrototypeMethod(tpl, "SetMaxSubdivisionLevel", SetMaxSubdivisionLevel);
	Nan::SetPrototypeMethod(tpl, "setMaxSubdivisionLevel", SetMaxSubdivisionLevel);

	Nan::SetPrototypeMethod(tpl, "SetSubdivisionLevels", SetSubdivisionLevels);
	Nan::SetPrototypeMethod(tpl, "setSubdivisionLevels", SetSubdivisionLevels);

	Nan::SetPrototypeMethod(tpl, "Tessellate", Tessellate);
	Nan::SetPrototypeMethod(tpl, "tessellate", Tessellate);

	Nan::SetPrototypeMethod(tpl, "Triangulate", Triangulate);
	Nan::SetPrototypeMethod(tpl, "triangulate", Triangulate);

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

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

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

void VtkSimpleCellTessellatorWrap::GetClassName(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkSimpleCellTessellatorWrap *wrapper = ObjectWrap::Unwrap<VtkSimpleCellTessellatorWrap>(info.Holder());
	vtkSimpleCellTessellator *native = (vtkSimpleCellTessellator *)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 VtkSimpleCellTessellatorWrap::GetFixedSubdivisions(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkSimpleCellTessellatorWrap *wrapper = ObjectWrap::Unwrap<VtkSimpleCellTessellatorWrap>(info.Holder());
	vtkSimpleCellTessellator *native = (vtkSimpleCellTessellator *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetFixedSubdivisions();
	info.GetReturnValue().Set(Nan::New(r));
}

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

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

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

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

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

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

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

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

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

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

void VtkSimpleCellTessellatorWrap::Tessellate(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkSimpleCellTessellatorWrap *wrapper = ObjectWrap::Unwrap<VtkSimpleCellTessellatorWrap>(info.Holder());
	vtkSimpleCellTessellator *native = (vtkSimpleCellTessellator *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkGenericAdaptorCellWrap::ptpl))->HasInstance(info[0]))
	{
		VtkGenericAdaptorCellWrap *a0 = ObjectWrap::Unwrap<VtkGenericAdaptorCellWrap>(info[0]->ToObject());
		if(info.Length() > 1 && info[1]->IsObject() && (Nan::New(VtkGenericAttributeCollectionWrap::ptpl))->HasInstance(info[1]))
		{
			VtkGenericAttributeCollectionWrap *a1 = ObjectWrap::Unwrap<VtkGenericAttributeCollectionWrap>(info[1]->ToObject());
			if(info.Length() > 2 && info[2]->IsObject() && (Nan::New(VtkDoubleArrayWrap::ptpl))->HasInstance(info[2]))
			{
				VtkDoubleArrayWrap *a2 = ObjectWrap::Unwrap<VtkDoubleArrayWrap>(info[2]->ToObject());
				if(info.Length() > 3 && info[3]->IsObject() && (Nan::New(VtkCellArrayWrap::ptpl))->HasInstance(info[3]))
				{
					VtkCellArrayWrap *a3 = ObjectWrap::Unwrap<VtkCellArrayWrap>(info[3]->ToObject());
					if(info.Length() > 4 && info[4]->IsObject() && (Nan::New(VtkPointDataWrap::ptpl))->HasInstance(info[4]))
					{
						VtkPointDataWrap *a4 = ObjectWrap::Unwrap<VtkPointDataWrap>(info[4]->ToObject());
												if(info.Length() != 5)
						{
							Nan::ThrowError("Too many parameters.");
							return;
						}
						native->Tessellate(
							(vtkGenericAdaptorCell *) a0->native.GetPointer(),
							(vtkGenericAttributeCollection *) a1->native.GetPointer(),
							(vtkDoubleArray *) a2->native.GetPointer(),
							(vtkCellArray *) a3->native.GetPointer(),
							(vtkPointData *) a4->native.GetPointer()
						);
						return;
					}
				}
			}
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkSimpleCellTessellatorWrap::Triangulate(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkSimpleCellTessellatorWrap *wrapper = ObjectWrap::Unwrap<VtkSimpleCellTessellatorWrap>(info.Holder());
	vtkSimpleCellTessellator *native = (vtkSimpleCellTessellator *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkGenericAdaptorCellWrap::ptpl))->HasInstance(info[0]))
	{
		VtkGenericAdaptorCellWrap *a0 = ObjectWrap::Unwrap<VtkGenericAdaptorCellWrap>(info[0]->ToObject());
		if(info.Length() > 1 && info[1]->IsObject() && (Nan::New(VtkGenericAttributeCollectionWrap::ptpl))->HasInstance(info[1]))
		{
			VtkGenericAttributeCollectionWrap *a1 = ObjectWrap::Unwrap<VtkGenericAttributeCollectionWrap>(info[1]->ToObject());
			if(info.Length() > 2 && info[2]->IsObject() && (Nan::New(VtkDoubleArrayWrap::ptpl))->HasInstance(info[2]))
			{
				VtkDoubleArrayWrap *a2 = ObjectWrap::Unwrap<VtkDoubleArrayWrap>(info[2]->ToObject());
				if(info.Length() > 3 && info[3]->IsObject() && (Nan::New(VtkCellArrayWrap::ptpl))->HasInstance(info[3]))
				{
					VtkCellArrayWrap *a3 = ObjectWrap::Unwrap<VtkCellArrayWrap>(info[3]->ToObject());
					if(info.Length() > 4 && info[4]->IsObject() && (Nan::New(VtkPointDataWrap::ptpl))->HasInstance(info[4]))
					{
						VtkPointDataWrap *a4 = ObjectWrap::Unwrap<VtkPointDataWrap>(info[4]->ToObject());
												if(info.Length() != 5)
						{
							Nan::ThrowError("Too many parameters.");
							return;
						}
						native->Triangulate(
							(vtkGenericAdaptorCell *) a0->native.GetPointer(),
							(vtkGenericAttributeCollection *) a1->native.GetPointer(),
							(vtkDoubleArray *) a2->native.GetPointer(),
							(vtkCellArray *) a3->native.GetPointer(),
							(vtkPointData *) a4->native.GetPointer()
						);
						return;
					}
				}
			}
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

