AugmentedView::AugmentedView(UIElementCollection * window, Engine * engine, cv::Mat _cameraMatrix)
{
	cameraMatrix = new Mat();
	_cameraMatrix.copyTo(*cameraMatrix);
	rotation = new Mat();
	position = new Mat();
	objectVector = std::vector<ARObject*>();
	LOGI(LOGTAG_POSITION, "Created AugmentedView");
	canDraw = false;

	Scalar selectColor = Colors::DodgerBlue;
	selectColor[3] = 80;
	selectionIndicator = new ARObject(OpenGLHelper::CreateSolidColorCube(1,selectColor));
	selectedObject = NULL;
	SET_TIME(&lastSelectionTime);
	testObject = new ARObject(OpenGLHelper::CreateSolidColorCube(10,Colors::OrangeRed));

	tabs = new TabDisplay(true);
	window->AddChild(tabs);

	createNext =false;

	GridLayout * myGrid = new GridLayout(cv::Size2i(5,4));

	cancelSelection = new Button("Cancel");
	cancelSelection->AddClickDelegate(ClickEventDelegate::from_method<AugmentedView,&AugmentedView::ButtonPressed>(this));
	myGrid->AddChild(cancelSelection,Point2i(4,3));		
	cancelSelection->SetVisible(false);
	cancelSelection->Name = "Cancel";
	
	releaseSelection = new Button("Release");
	releaseSelection->AddClickDelegate(ClickEventDelegate::from_method<AugmentedView,&AugmentedView::ButtonPressed>(this));
	myGrid->AddChild(releaseSelection,Point2i(4,2));	
	releaseSelection->SetVisible(false);
	releaseSelection->Name = "Release";

	Button * createCube = new Button("Create");
	createCube->AddClickDelegate(ClickEventDelegate::from_method<AugmentedView,&AugmentedView::ButtonPressed>(this));
	myGrid->AddChild(createCube,Point2i(4,1));	
	createCube->Name = "Create";
	createCube->FillColor = Colors::LightGreen;

	Button * deleteObject = new Button("Delete");
	deleteObject->AddClickDelegate(ClickEventDelegate::from_method<AugmentedView,&AugmentedView::ButtonPressed>(this));
	myGrid->AddChild(deleteObject,Point2i(4,0));	
	deleteObject->Name = "Delete";
	deleteObject->FillColor = Colors::Orange;

	tabs->AddTab("AR",myGrid);
	LOGD(LOGTAG_ARINPUT,"Laying out tabs %d,%d",engine->imageWidth,engine->imageHeight);
	tabs->DoLayout(Rect(0,0,engine->imageWidth,engine->imageHeight));
	
	tabs->SetTab(0);
}
NumberSpinner::NumberSpinner(string description, float intialValue, float delta, string _valueFormat, Point2i position, Size2i size) : GridLayout(size,Size2i(3,2),position)
{
	LOGD(LOGTAG_INPUT, "Enter NumberSpinner constructor");
	//Initialize grid base
	//gridSize = Size2i(3,2);
	//cellSize = Size_<int>((int)((float)size.width/gridSize.width),(int)((float)size.height/gridSize.height));
	//Position = position;
	//
	LOGD(LOGTAG_INPUT, "Cellsize = [%d,%d]",cellSize.width,cellSize.height);

	value = intialValue;
	clickDelta = delta;
	maxValue = MAXFLOAT;
	minValue = -MAXFLOAT;
	valueFormat = _valueFormat;


	Label * descriptionLabel = new Label(description,Point2i(0,0),Colors::Black,Colors::White);	
	descriptionLabel->FontScale = 0.9f;
	AddChild(descriptionLabel,Point2i(0,0),Size2i(3,1));

	char * str = new char[valueFormat.size()];
	sprintf(str,valueFormat.c_str(),value);
	valueLabel = new Label(string(str),Point2i(0,0),Colors::Black,Colors::White);	
	valueLabel->FontScale = 0.9f;
	GridLayout::AddChild(valueLabel,Point2i(1,1));
	delete str;


	Button * increase = new Button("+",Colors::MediumSeaGreen);	
	increase->AddClickDelegate(ClickEventDelegate::from_method<NumberSpinner,&NumberSpinner::IncreaseClick>(this));
	GridLayout::AddChild(increase,Point2i(2,1));
	
	Button * decrease = new Button("-",Colors::Gold);
	decrease->AddClickDelegate(ClickEventDelegate::from_method<NumberSpinner,&NumberSpinner::DecreaseClick>(this));
	GridLayout::AddChild(decrease,Point2i(0,1));
	
	LOGD(LOGTAG_INPUT, "NumberSpinner instantiated");

}
Example #3
0
void TabDisplay::AddTab(std::string tabName, GraphicalUIElement * tabContent)
{	
	TabPage * newTab = new TabPage();

	newTab->TabName = tabName;
	newTab->TabContent = tabContent;
	Button * tabButton = new Button(newTab->TabName,UI_BUTTON_COLOR,Colors::Black);
	tabButton->Alpha = 0.7f;
	tabButton->Name = tabName;
	tabButton->AddClickDelegate(ClickEventDelegate::from_method<TabDisplay,&TabDisplay::TabButtonPressed>(this));
	newTab->TabButton = tabButton;
	TabChildren.push_back(newTab);

	if (lastBoundaryRectangle.width != 0)
	{
		LayoutTabButtons(lastBoundaryRectangle,UI_BUTTON_SIZE);
		tabContent->DoLayout(contentRect);
	}
}