/* 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 "vtkPlotPointsWrap.h"
#include "vtkPlotBagWrap.h"
#include "vtkObjectBaseWrap.h"
#include "vtkContext2DWrap.h"
#include "vtkStringArrayWrap.h"
#include "vtkTableWrap.h"
#include "vtkPenWrap.h"
#include "../../plus/plus.h"

using namespace v8;

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

VtkPlotBagWrap::VtkPlotBagWrap()
{ }

VtkPlotBagWrap::VtkPlotBagWrap(vtkSmartPointer<vtkPlotBag> _native)
{ native = _native; }

VtkPlotBagWrap::~VtkPlotBagWrap()
{ }

void VtkPlotBagWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkPlotBag").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("PlotBag").ToLocalChecked(), ConstructorGetter);
}

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

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

	Nan::SetPrototypeMethod(tpl, "GetBagVisible", GetBagVisible);
	Nan::SetPrototypeMethod(tpl, "getBagVisible", GetBagVisible);

	Nan::SetPrototypeMethod(tpl, "GetLabels", GetLabels);
	Nan::SetPrototypeMethod(tpl, "getLabels", GetLabels);

	Nan::SetPrototypeMethod(tpl, "GetLinePen", GetLinePen);
	Nan::SetPrototypeMethod(tpl, "getLinePen", GetLinePen);

	Nan::SetPrototypeMethod(tpl, "GetPointPen", GetPointPen);
	Nan::SetPrototypeMethod(tpl, "getPointPen", GetPointPen);

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

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

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

	Nan::SetPrototypeMethod(tpl, "SetBagVisible", SetBagVisible);
	Nan::SetPrototypeMethod(tpl, "setBagVisible", SetBagVisible);

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

	Nan::SetPrototypeMethod(tpl, "SetLinePen", SetLinePen);
	Nan::SetPrototypeMethod(tpl, "setLinePen", SetLinePen);

	Nan::SetPrototypeMethod(tpl, "SetPointPen", SetPointPen);
	Nan::SetPrototypeMethod(tpl, "setPointPen", SetPointPen);

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

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

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

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

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

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

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

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

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

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

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

void VtkPlotBagWrap::SetInputData(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkPlotBagWrap *wrapper = ObjectWrap::Unwrap<VtkPlotBagWrap>(info.Holder());
	vtkPlotBag *native = (vtkPlotBag *)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 VtkPlotBagWrap::SetLinePen(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkPlotBagWrap *wrapper = ObjectWrap::Unwrap<VtkPlotBagWrap>(info.Holder());
	vtkPlotBag *native = (vtkPlotBag *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkPenWrap::ptpl))->HasInstance(info[0]))
	{
		VtkPenWrap *a0 = ObjectWrap::Unwrap<VtkPenWrap>(info[0]->ToObject());
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetLinePen(
			(vtkPen *) a0->native.GetPointer()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

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

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

