/* 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 "vtkPlotWrap.h"
#include "vtkPlotParallelCoordinatesWrap.h"
#include "vtkObjectBaseWrap.h"
#include "vtkContext2DWrap.h"
#include "vtkTableWrap.h"
#include "vtkScalarsToColorsWrap.h"
#include "../../plus/plus.h"

using namespace v8;

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

VtkPlotParallelCoordinatesWrap::VtkPlotParallelCoordinatesWrap()
{ }

VtkPlotParallelCoordinatesWrap::VtkPlotParallelCoordinatesWrap(vtkSmartPointer<vtkPlotParallelCoordinates> _native)
{ native = _native; }

VtkPlotParallelCoordinatesWrap::~VtkPlotParallelCoordinatesWrap()
{ }

void VtkPlotParallelCoordinatesWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkPlotParallelCoordinates").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("PlotParallelCoordinates").ToLocalChecked(), ConstructorGetter);
}

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

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

	Nan::SetPrototypeMethod(tpl, "CreateDefaultLookupTable", CreateDefaultLookupTable);
	Nan::SetPrototypeMethod(tpl, "createDefaultLookupTable", CreateDefaultLookupTable);

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

	Nan::SetPrototypeMethod(tpl, "GetLookupTable", GetLookupTable);
	Nan::SetPrototypeMethod(tpl, "getLookupTable", GetLookupTable);

	Nan::SetPrototypeMethod(tpl, "GetScalarVisibility", GetScalarVisibility);
	Nan::SetPrototypeMethod(tpl, "getScalarVisibility", GetScalarVisibility);

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

	Nan::SetPrototypeMethod(tpl, "Paint", Paint);
	Nan::SetPrototypeMethod(tpl, "paint", Paint);

	Nan::SetPrototypeMethod(tpl, "ResetSelectionRange", ResetSelectionRange);
	Nan::SetPrototypeMethod(tpl, "resetSelectionRange", ResetSelectionRange);

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

	Nan::SetPrototypeMethod(tpl, "ScalarVisibilityOff", ScalarVisibilityOff);
	Nan::SetPrototypeMethod(tpl, "scalarVisibilityOff", ScalarVisibilityOff);

	Nan::SetPrototypeMethod(tpl, "ScalarVisibilityOn", ScalarVisibilityOn);
	Nan::SetPrototypeMethod(tpl, "scalarVisibilityOn", ScalarVisibilityOn);

	Nan::SetPrototypeMethod(tpl, "SetInputData", SetInputData);
	Nan::SetPrototypeMethod(tpl, "setInputData", SetInputData);

	Nan::SetPrototypeMethod(tpl, "SetLookupTable", SetLookupTable);
	Nan::SetPrototypeMethod(tpl, "setLookupTable", SetLookupTable);

	Nan::SetPrototypeMethod(tpl, "SetScalarVisibility", SetScalarVisibility);
	Nan::SetPrototypeMethod(tpl, "setScalarVisibility", SetScalarVisibility);

	Nan::SetPrototypeMethod(tpl, "SetSelectionRange", SetSelectionRange);
	Nan::SetPrototypeMethod(tpl, "setSelectionRange", SetSelectionRange);

	Nan::SetPrototypeMethod(tpl, "Update", Update);
	Nan::SetPrototypeMethod(tpl, "update", Update);

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

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

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

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

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

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

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

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

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

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

void VtkPlotParallelCoordinatesWrap::Paint(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkPlotParallelCoordinatesWrap *wrapper = ObjectWrap::Unwrap<VtkPlotParallelCoordinatesWrap>(info.Holder());
	vtkPlotParallelCoordinates *native = (vtkPlotParallelCoordinates *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkContext2DWrap::ptpl))->HasInstance(info[0]))
	{
		VtkContext2DWrap *a0 = ObjectWrap::Unwrap<VtkContext2DWrap>(info[0]->ToObject());
		bool r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->Paint(
			(vtkContext2D *) a0->native.GetPointer()
		);
		info.GetReturnValue().Set(Nan::New(r));
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

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

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

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

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

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

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

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

void VtkPlotParallelCoordinatesWrap::SetSelectionRange(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkPlotParallelCoordinatesWrap *wrapper = ObjectWrap::Unwrap<VtkPlotParallelCoordinatesWrap>(info.Holder());
	vtkPlotParallelCoordinates *native = (vtkPlotParallelCoordinates *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsInt32())
	{
		if(info.Length() > 1 && info[1]->IsNumber())
		{
			if(info.Length() > 2 && info[2]->IsNumber())
			{
				bool r;
				if(info.Length() != 3)
				{
					Nan::ThrowError("Too many parameters.");
					return;
				}
				r = native->SetSelectionRange(
					info[0]->Int32Value(),
					info[1]->NumberValue(),
					info[2]->NumberValue()
				);
				info.GetReturnValue().Set(Nan::New(r));
				return;
			}
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

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

