void NBEditor::load()
{
	IGUIStaticText* sidebar = state->menu->sidebar;
	IGUIEnvironment* guienv = state->device->getGUIEnvironment();

	if (sidebar) {
		sidebar->setText(L"Node Box Tool");
		IGUIStaticText* t = guienv->addStaticText(L"No node selected",
				rect<s32>(20, 30, 140, 100),
				false, true, sidebar, ENB_GUI_MAIN_MSG);
		
		IGUIListBox* lb = guienv->addListBox(rect<s32>(20, 30, 230, 128),
				sidebar, ENB_GUI_MAIN_LISTBOX, true);

		if (lb) {
			lb->setVisible(false);
			IGUIButton* b1 = guienv->addButton(rect<s32>(0, 100, 50, 125),
					lb, GUI_PROJ_NEW_BOX, L"+", L"Add a node box");
			IGUIButton* b2 = guienv->addButton(rect<s32>(60, 100, 110,125),
					lb, GUI_PROJ_DELETE_BOX, L"-", L"Delete node box");
			b1->setNotClipped(true);
			b2->setNotClipped(true);
		}

		// Create nodebox properties
		t = guienv->addStaticText(L"Properties",
				rect<s32>(0, 170, 120, 190),
				false, true, sidebar, ENB_GUI_PROP);
		t->setVisible(false);

		// Add name properties box
		guienv->addStaticText(L"Name:", rect<s32>(10, 30, 50, 50), false,
				true, t)->setNotClipped(true);
		guienv->addEditBox(L"", rect<s32>(60, 30, 210, 50), true,
				t, ENB_GUI_PROP_NAME)->setNotClipped(true);

		// Add positioning
		addXYZ(t, guienv, vector2di(10, 60),  ENB_GUI_PROP_X1);
		addXYZ(t, guienv, vector2di(10, 160), ENB_GUI_PROP_X2); // 60

		// Add buttons
		guienv->addButton(rect<s32>(30, 250, 100, 280), t, ENB_GUI_PROP_UPDATE,
				L"Update", L"")->setNotClipped(true);
		guienv->addButton(rect<s32>(110, 250, 180, 280), t, ENB_GUI_PROP_REVERT,
				L"Revert", L"")->setNotClipped(true);
	}
	load_ui();
}
示例#2
0
ccPointCloud* sm2ccConverter::getCloud()
{
	if (!m_sm_cloud)
	{
		assert(false);
		return 0;
	}
	
	//get the fields list
	std::list<std::string> fields;
	for (std::vector< PCLScalarField >::const_iterator it = m_sm_cloud->fields.begin(); it != m_sm_cloud->fields.end(); ++it)
	{
		if (it->name != "_") //PCL padding fields
			fields.push_back(it->name);
	}

	//begin with checks and conversions
	//be sure we have x, y, and z fields
	if (!ExistField(m_sm_cloud,"x") || !ExistField(m_sm_cloud,"y") || !ExistField(m_sm_cloud,"z"))
		return 0;

	//create cloud
	ccPointCloud* cloud = new ccPointCloud();

	//push points inside
	if (!addXYZ(cloud))
	{
		delete cloud;
		return 0;
	}

	//remove x,y,z fields from the vector of field names
	fields.remove("x");
	fields.remove("y");
	fields.remove("z");

	//do we have normals?
	if (ExistField(m_sm_cloud,"normal_x") || ExistField(m_sm_cloud,"normal_y") || ExistField(m_sm_cloud,"normal_z"))
	{
		addNormals(cloud);
		
		//remove the corresponding fields
		fields.remove("normal_x");
		fields.remove("normal_y");
		fields.remove("normal_z");
	}

	//The same for colors
	if (ExistField(m_sm_cloud,"rgb"))
	{
		addRGB(cloud);
		
		//remove the corresponding field
		fields.remove("rgb");
	}

	//All the remaining fields will be stored as scalar fields
	for (std::list<std::string>::const_iterator name = fields.begin(); name != fields.end(); ++name)
	{
		addScalarField(cloud, *name);
	}

	return cloud;
}