/* 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 "vtkUnstructuredGridVolumeRayCastFunctionWrap.h"
#include "vtkUnstructuredGridBunykRayCastFunctionWrap.h"
#include "vtkObjectWrap.h"
#include "vtkRendererWrap.h"
#include "vtkVolumeWrap.h"
#include "vtkUnstructuredGridVolumeRayCastIteratorWrap.h"
#include "vtkMatrix4x4Wrap.h"
#include "../../plus/plus.h"

using namespace v8;

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

VtkUnstructuredGridBunykRayCastFunctionWrap::VtkUnstructuredGridBunykRayCastFunctionWrap()
{ }

VtkUnstructuredGridBunykRayCastFunctionWrap::VtkUnstructuredGridBunykRayCastFunctionWrap(vtkSmartPointer<vtkUnstructuredGridBunykRayCastFunction> _native)
{ native = _native; }

VtkUnstructuredGridBunykRayCastFunctionWrap::~VtkUnstructuredGridBunykRayCastFunctionWrap()
{ }

void VtkUnstructuredGridBunykRayCastFunctionWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkUnstructuredGridBunykRayCastFunction").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("UnstructuredGridBunykRayCastFunction").ToLocalChecked(), ConstructorGetter);
}

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

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

	Nan::SetPrototypeMethod(tpl, "Finalize", Finalize);
	Nan::SetPrototypeMethod(tpl, "finalize", Finalize);

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

	Nan::SetPrototypeMethod(tpl, "GetImageOrigin", GetImageOrigin);
	Nan::SetPrototypeMethod(tpl, "getImageOrigin", GetImageOrigin);

	Nan::SetPrototypeMethod(tpl, "GetImageViewportSize", GetImageViewportSize);
	Nan::SetPrototypeMethod(tpl, "getImageViewportSize", GetImageViewportSize);

	Nan::SetPrototypeMethod(tpl, "GetViewToWorldMatrix", GetViewToWorldMatrix);
	Nan::SetPrototypeMethod(tpl, "getViewToWorldMatrix", GetViewToWorldMatrix);

	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, "NewIterator", NewIterator);
	Nan::SetPrototypeMethod(tpl, "newIterator", NewIterator);

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

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

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

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

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

void VtkUnstructuredGridBunykRayCastFunctionWrap::GetClassName(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridBunykRayCastFunctionWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridBunykRayCastFunctionWrap>(info.Holder());
	vtkUnstructuredGridBunykRayCastFunction *native = (vtkUnstructuredGridBunykRayCastFunction *)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 VtkUnstructuredGridBunykRayCastFunctionWrap::GetImageOrigin(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridBunykRayCastFunctionWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridBunykRayCastFunctionWrap>(info.Holder());
	vtkUnstructuredGridBunykRayCastFunction *native = (vtkUnstructuredGridBunykRayCastFunction *)wrapper->native.GetPointer();
	int const * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetImageOrigin();
	Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(v8::Isolate::GetCurrent(), 2 * sizeof(int));
	Local<v8::Int32Array> at = v8::Int32Array::New(ab, 0, 2);
	memcpy(ab->GetContents().Data(), r, 2 * sizeof(int));
	info.GetReturnValue().Set(at);
}

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

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

void VtkUnstructuredGridBunykRayCastFunctionWrap::Initialize(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridBunykRayCastFunctionWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridBunykRayCastFunctionWrap>(info.Holder());
	vtkUnstructuredGridBunykRayCastFunction *native = (vtkUnstructuredGridBunykRayCastFunction *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkRendererWrap::ptpl))->HasInstance(info[0]))
	{
		VtkRendererWrap *a0 = ObjectWrap::Unwrap<VtkRendererWrap>(info[0]->ToObject());
		if(info.Length() > 1 && info[1]->IsObject() && (Nan::New(VtkVolumeWrap::ptpl))->HasInstance(info[1]))
		{
			VtkVolumeWrap *a1 = ObjectWrap::Unwrap<VtkVolumeWrap>(info[1]->ToObject());
						if(info.Length() != 2)
			{
				Nan::ThrowError("Too many parameters.");
				return;
			}
			native->Initialize(
				(vtkRenderer *) a0->native.GetPointer(),
				(vtkVolume *) a1->native.GetPointer()
			);
			return;
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

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

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

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

