/* 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 "vtkBorderRepresentationWrap.h"
#include "vtkProgressBarRepresentationWrap.h"
#include "vtkObjectBaseWrap.h"
#include "vtkProperty2DWrap.h"
#include "vtkPropCollectionWrap.h"
#include "vtkWindowWrap.h"
#include "vtkViewportWrap.h"
#include "../../plus/plus.h"

using namespace v8;

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

VtkProgressBarRepresentationWrap::VtkProgressBarRepresentationWrap()
{ }

VtkProgressBarRepresentationWrap::VtkProgressBarRepresentationWrap(vtkSmartPointer<vtkProgressBarRepresentation> _native)
{ native = _native; }

VtkProgressBarRepresentationWrap::~VtkProgressBarRepresentationWrap()
{ }

void VtkProgressBarRepresentationWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkProgressBarRepresentation").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("ProgressBarRepresentation").ToLocalChecked(), ConstructorGetter);
}

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

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

	Nan::SetPrototypeMethod(tpl, "BuildRepresentation", BuildRepresentation);
	Nan::SetPrototypeMethod(tpl, "buildRepresentation", BuildRepresentation);

	Nan::SetPrototypeMethod(tpl, "DrawBackgroundOff", DrawBackgroundOff);
	Nan::SetPrototypeMethod(tpl, "drawBackgroundOff", DrawBackgroundOff);

	Nan::SetPrototypeMethod(tpl, "DrawBackgroundOn", DrawBackgroundOn);
	Nan::SetPrototypeMethod(tpl, "drawBackgroundOn", DrawBackgroundOn);

	Nan::SetPrototypeMethod(tpl, "GetActors2D", GetActors2D);
	Nan::SetPrototypeMethod(tpl, "getActors2D", GetActors2D);

	Nan::SetPrototypeMethod(tpl, "GetBackgroundColor", GetBackgroundColor);
	Nan::SetPrototypeMethod(tpl, "getBackgroundColor", GetBackgroundColor);

	Nan::SetPrototypeMethod(tpl, "GetDrawBackground", GetDrawBackground);
	Nan::SetPrototypeMethod(tpl, "getDrawBackground", GetDrawBackground);

	Nan::SetPrototypeMethod(tpl, "GetProgressBarColor", GetProgressBarColor);
	Nan::SetPrototypeMethod(tpl, "getProgressBarColor", GetProgressBarColor);

	Nan::SetPrototypeMethod(tpl, "GetProgressRate", GetProgressRate);
	Nan::SetPrototypeMethod(tpl, "getProgressRate", GetProgressRate);

	Nan::SetPrototypeMethod(tpl, "GetProgressRateMaxValue", GetProgressRateMaxValue);
	Nan::SetPrototypeMethod(tpl, "getProgressRateMaxValue", GetProgressRateMaxValue);

	Nan::SetPrototypeMethod(tpl, "GetProgressRateMinValue", GetProgressRateMinValue);
	Nan::SetPrototypeMethod(tpl, "getProgressRateMinValue", GetProgressRateMinValue);

	Nan::SetPrototypeMethod(tpl, "GetProperty", GetProperty);
	Nan::SetPrototypeMethod(tpl, "getProperty", GetProperty);

	Nan::SetPrototypeMethod(tpl, "GetSize", GetSize);
	Nan::SetPrototypeMethod(tpl, "getSize", GetSize);

	Nan::SetPrototypeMethod(tpl, "HasTranslucentPolygonalGeometry", HasTranslucentPolygonalGeometry);
	Nan::SetPrototypeMethod(tpl, "hasTranslucentPolygonalGeometry", HasTranslucentPolygonalGeometry);

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

	Nan::SetPrototypeMethod(tpl, "ReleaseGraphicsResources", ReleaseGraphicsResources);
	Nan::SetPrototypeMethod(tpl, "releaseGraphicsResources", ReleaseGraphicsResources);

	Nan::SetPrototypeMethod(tpl, "RenderOpaqueGeometry", RenderOpaqueGeometry);
	Nan::SetPrototypeMethod(tpl, "renderOpaqueGeometry", RenderOpaqueGeometry);

	Nan::SetPrototypeMethod(tpl, "RenderOverlay", RenderOverlay);
	Nan::SetPrototypeMethod(tpl, "renderOverlay", RenderOverlay);

	Nan::SetPrototypeMethod(tpl, "RenderTranslucentPolygonalGeometry", RenderTranslucentPolygonalGeometry);
	Nan::SetPrototypeMethod(tpl, "renderTranslucentPolygonalGeometry", RenderTranslucentPolygonalGeometry);

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

	Nan::SetPrototypeMethod(tpl, "SetBackgroundColor", SetBackgroundColor);
	Nan::SetPrototypeMethod(tpl, "setBackgroundColor", SetBackgroundColor);

	Nan::SetPrototypeMethod(tpl, "SetDrawBackground", SetDrawBackground);
	Nan::SetPrototypeMethod(tpl, "setDrawBackground", SetDrawBackground);

	Nan::SetPrototypeMethod(tpl, "SetProgressBarColor", SetProgressBarColor);
	Nan::SetPrototypeMethod(tpl, "setProgressBarColor", SetProgressBarColor);

	Nan::SetPrototypeMethod(tpl, "SetProgressRate", SetProgressRate);
	Nan::SetPrototypeMethod(tpl, "setProgressRate", SetProgressRate);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

void VtkProgressBarRepresentationWrap::GetSize(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkProgressBarRepresentationWrap *wrapper = ObjectWrap::Unwrap<VtkProgressBarRepresentationWrap>(info.Holder());
	vtkProgressBarRepresentation *native = (vtkProgressBarRepresentation *)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->GetSize(
			(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->GetSize(
			b0
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

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

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

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

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

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

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

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

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

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

		for( i = 0; i < 3; 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->SetBackgroundColor(
			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)
				{
					Nan::ThrowError("Too many parameters.");
					return;
				}
				native->SetBackgroundColor(
					info[0]->NumberValue(),
					info[1]->NumberValue(),
					info[2]->NumberValue()
				);
				return;
			}
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

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

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

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

		for( i = 0; i < 3; 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->SetProgressBarColor(
			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)
				{
					Nan::ThrowError("Too many parameters.");
					return;
				}
				native->SetProgressBarColor(
					info[0]->NumberValue(),
					info[1]->NumberValue(),
					info[2]->NumberValue()
				);
				return;
			}
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

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

