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

using namespace v8;

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

VtkBoundedPointSourceWrap::VtkBoundedPointSourceWrap()
{ }

VtkBoundedPointSourceWrap::VtkBoundedPointSourceWrap(vtkSmartPointer<vtkBoundedPointSource> _native)
{ native = _native; }

VtkBoundedPointSourceWrap::~VtkBoundedPointSourceWrap()
{ }

void VtkBoundedPointSourceWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkBoundedPointSource").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("BoundedPointSource").ToLocalChecked(), ConstructorGetter);
}

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

void VtkBoundedPointSourceWrap::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("VtkBoundedPointSourceWrap").ToLocalChecked());
	tpl->InstanceTemplate()->SetInternalFieldCount(1);

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

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

	Nan::SetPrototypeMethod(tpl, "GetProduceCellOutput", GetProduceCellOutput);
	Nan::SetPrototypeMethod(tpl, "getProduceCellOutput", GetProduceCellOutput);

	Nan::SetPrototypeMethod(tpl, "GetProduceRandomScalars", GetProduceRandomScalars);
	Nan::SetPrototypeMethod(tpl, "getProduceRandomScalars", GetProduceRandomScalars);

	Nan::SetPrototypeMethod(tpl, "GetScalarRange", GetScalarRange);
	Nan::SetPrototypeMethod(tpl, "getScalarRange", GetScalarRange);

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

	Nan::SetPrototypeMethod(tpl, "ProduceCellOutputOff", ProduceCellOutputOff);
	Nan::SetPrototypeMethod(tpl, "produceCellOutputOff", ProduceCellOutputOff);

	Nan::SetPrototypeMethod(tpl, "ProduceCellOutputOn", ProduceCellOutputOn);
	Nan::SetPrototypeMethod(tpl, "produceCellOutputOn", ProduceCellOutputOn);

	Nan::SetPrototypeMethod(tpl, "ProduceRandomScalarsOff", ProduceRandomScalarsOff);
	Nan::SetPrototypeMethod(tpl, "produceRandomScalarsOff", ProduceRandomScalarsOff);

	Nan::SetPrototypeMethod(tpl, "ProduceRandomScalarsOn", ProduceRandomScalarsOn);
	Nan::SetPrototypeMethod(tpl, "produceRandomScalarsOn", ProduceRandomScalarsOn);

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

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

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

	Nan::SetPrototypeMethod(tpl, "SetProduceCellOutput", SetProduceCellOutput);
	Nan::SetPrototypeMethod(tpl, "setProduceCellOutput", SetProduceCellOutput);

	Nan::SetPrototypeMethod(tpl, "SetProduceRandomScalars", SetProduceRandomScalars);
	Nan::SetPrototypeMethod(tpl, "setProduceRandomScalars", SetProduceRandomScalars);

	Nan::SetPrototypeMethod(tpl, "SetScalarRange", SetScalarRange);
	Nan::SetPrototypeMethod(tpl, "setScalarRange", SetScalarRange);

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

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

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

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

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

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

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

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

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

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

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

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

void VtkBoundedPointSourceWrap::SetBounds(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkBoundedPointSourceWrap *wrapper = ObjectWrap::Unwrap<VtkBoundedPointSourceWrap>(info.Holder());
	vtkBoundedPointSource *native = (vtkBoundedPointSource *)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 VtkBoundedPointSourceWrap::SetOutputPointsPrecision(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkBoundedPointSourceWrap *wrapper = ObjectWrap::Unwrap<VtkBoundedPointSourceWrap>(info.Holder());
	vtkBoundedPointSource *native = (vtkBoundedPointSource *)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");
}

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

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

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

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

		for( i = 0; i < 2; 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->SetScalarRange(
			b0
		);
		return;
	}
	else 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->SetScalarRange(
				info[0]->NumberValue(),
				info[1]->NumberValue()
			);
			return;
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

