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

using namespace v8;

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

VtkGeoGraticuleWrap::VtkGeoGraticuleWrap()
{ }

VtkGeoGraticuleWrap::VtkGeoGraticuleWrap(vtkSmartPointer<vtkGeoGraticule> _native)
{ native = _native; }

VtkGeoGraticuleWrap::~VtkGeoGraticuleWrap()
{ }

void VtkGeoGraticuleWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkGeoGraticule").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("GeoGraticule").ToLocalChecked(), ConstructorGetter);
}

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

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

	Nan::SetPrototypeMethod(tpl, "GetGeometryType", GetGeometryType);
	Nan::SetPrototypeMethod(tpl, "getGeometryType", GetGeometryType);

	Nan::SetPrototypeMethod(tpl, "GetLatitudeBounds", GetLatitudeBounds);
	Nan::SetPrototypeMethod(tpl, "getLatitudeBounds", GetLatitudeBounds);

	Nan::SetPrototypeMethod(tpl, "GetLatitudeDelta", GetLatitudeDelta);
	Nan::SetPrototypeMethod(tpl, "getLatitudeDelta", GetLatitudeDelta);

	Nan::SetPrototypeMethod(tpl, "GetLatitudeLevel", GetLatitudeLevel);
	Nan::SetPrototypeMethod(tpl, "getLatitudeLevel", GetLatitudeLevel);

	Nan::SetPrototypeMethod(tpl, "GetLatitudeLevelMaxValue", GetLatitudeLevelMaxValue);
	Nan::SetPrototypeMethod(tpl, "getLatitudeLevelMaxValue", GetLatitudeLevelMaxValue);

	Nan::SetPrototypeMethod(tpl, "GetLatitudeLevelMinValue", GetLatitudeLevelMinValue);
	Nan::SetPrototypeMethod(tpl, "getLatitudeLevelMinValue", GetLatitudeLevelMinValue);

	Nan::SetPrototypeMethod(tpl, "GetLongitudeBounds", GetLongitudeBounds);
	Nan::SetPrototypeMethod(tpl, "getLongitudeBounds", GetLongitudeBounds);

	Nan::SetPrototypeMethod(tpl, "GetLongitudeDelta", GetLongitudeDelta);
	Nan::SetPrototypeMethod(tpl, "getLongitudeDelta", GetLongitudeDelta);

	Nan::SetPrototypeMethod(tpl, "GetLongitudeLevel", GetLongitudeLevel);
	Nan::SetPrototypeMethod(tpl, "getLongitudeLevel", GetLongitudeLevel);

	Nan::SetPrototypeMethod(tpl, "GetLongitudeLevelMaxValue", GetLongitudeLevelMaxValue);
	Nan::SetPrototypeMethod(tpl, "getLongitudeLevelMaxValue", GetLongitudeLevelMaxValue);

	Nan::SetPrototypeMethod(tpl, "GetLongitudeLevelMinValue", GetLongitudeLevelMinValue);
	Nan::SetPrototypeMethod(tpl, "getLongitudeLevelMinValue", GetLongitudeLevelMinValue);

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

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

	Nan::SetPrototypeMethod(tpl, "SetGeometryType", SetGeometryType);
	Nan::SetPrototypeMethod(tpl, "setGeometryType", SetGeometryType);

	Nan::SetPrototypeMethod(tpl, "SetLatitudeBounds", SetLatitudeBounds);
	Nan::SetPrototypeMethod(tpl, "setLatitudeBounds", SetLatitudeBounds);

	Nan::SetPrototypeMethod(tpl, "SetLatitudeLevel", SetLatitudeLevel);
	Nan::SetPrototypeMethod(tpl, "setLatitudeLevel", SetLatitudeLevel);

	Nan::SetPrototypeMethod(tpl, "SetLongitudeBounds", SetLongitudeBounds);
	Nan::SetPrototypeMethod(tpl, "setLongitudeBounds", SetLongitudeBounds);

	Nan::SetPrototypeMethod(tpl, "SetLongitudeLevel", SetLongitudeLevel);
	Nan::SetPrototypeMethod(tpl, "setLongitudeLevel", SetLongitudeLevel);

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

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

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

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

void VtkGeoGraticuleWrap::GetLatitudeBounds(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkGeoGraticuleWrap *wrapper = ObjectWrap::Unwrap<VtkGeoGraticuleWrap>(info.Holder());
	vtkGeoGraticule *native = (vtkGeoGraticule *)wrapper->native.GetPointer();
	double const * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetLatitudeBounds();
	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 VtkGeoGraticuleWrap::GetLatitudeDelta(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkGeoGraticuleWrap *wrapper = ObjectWrap::Unwrap<VtkGeoGraticuleWrap>(info.Holder());
	vtkGeoGraticule *native = (vtkGeoGraticule *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsInt32())
	{
		double r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->GetLatitudeDelta(
			info[0]->Int32Value()
		);
		info.GetReturnValue().Set(Nan::New(r));
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

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

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

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

void VtkGeoGraticuleWrap::GetLongitudeBounds(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkGeoGraticuleWrap *wrapper = ObjectWrap::Unwrap<VtkGeoGraticuleWrap>(info.Holder());
	vtkGeoGraticule *native = (vtkGeoGraticule *)wrapper->native.GetPointer();
	double const * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetLongitudeBounds();
	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 VtkGeoGraticuleWrap::GetLongitudeDelta(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkGeoGraticuleWrap *wrapper = ObjectWrap::Unwrap<VtkGeoGraticuleWrap>(info.Holder());
	vtkGeoGraticule *native = (vtkGeoGraticule *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsInt32())
	{
		double r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->GetLongitudeDelta(
			info[0]->Int32Value()
		);
		info.GetReturnValue().Set(Nan::New(r));
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

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

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

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

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

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

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

void VtkGeoGraticuleWrap::SetLatitudeBounds(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkGeoGraticuleWrap *wrapper = ObjectWrap::Unwrap<VtkGeoGraticuleWrap>(info.Holder());
	vtkGeoGraticule *native = (vtkGeoGraticule *)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->SetLatitudeBounds(
			(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->SetLatitudeBounds(
			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->SetLatitudeBounds(
				info[0]->NumberValue(),
				info[1]->NumberValue()
			);
			return;
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

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

void VtkGeoGraticuleWrap::SetLongitudeBounds(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkGeoGraticuleWrap *wrapper = ObjectWrap::Unwrap<VtkGeoGraticuleWrap>(info.Holder());
	vtkGeoGraticule *native = (vtkGeoGraticule *)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->SetLongitudeBounds(
			(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->SetLongitudeBounds(
			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->SetLongitudeBounds(
				info[0]->NumberValue(),
				info[1]->NumberValue()
			);
			return;
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

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

