Esempio n. 1
0
VirtualRobot::ScenePtr SceneIO::createSceneFromString( const std::string &xmlString, const std::string &basePath /*= ""*/ )
{
	// copy string content to char array
	char* y = new char[xmlString.size() + 1];
	strncpy(y, xmlString.c_str(), xmlString.size() + 1);

	VirtualRobot::ScenePtr scene;

	try
	{
		rapidxml::xml_document<char> doc;    // character type defaults to char
		doc.parse<0>(y);    // 0 means default parse flags
		rapidxml::xml_node<char>* sceneXMLNode = doc.first_node("Scene");
		scene = processScene(sceneXMLNode, basePath);
	}
	catch (rapidxml::parse_error& e)
	{
		delete[] y;
		THROW_VR_EXCEPTION("Could not parse data in xml definition" << endl
			<< "Error message:" << e.what() << endl
			<< "Position: " << endl << e.where<char>() << endl);
		return ScenePtr();
	}
	catch (VirtualRobot::VirtualRobotException&)
	{
		// rethrow the current exception
		delete[] y;
		throw;
	}
	catch (std::exception& e)
	{
		delete[] y;
		THROW_VR_EXCEPTION("Error while parsing xml definition" << endl
			<< "Error code:" << e.what() << endl);
		return ScenePtr();
	}
	catch (...)
	{
		delete[] y;
		THROW_VR_EXCEPTION("Error while parsing xml definition" << endl);
		return ScenePtr();
	}

	delete[] y;
	return scene;
}
SceneStructureWindow::~SceneStructureWindow()
{
    ConfigAPI &cfg = *framework->Config();
    cfg.Write(cShowGroupsSetting, cShowGroupsSetting.key, showGroups);
    cfg.Write(cShowComponentsSetting, cShowComponentsSetting.key, showComponents);
    cfg.Write(cAttributeVisibilitySetting, cAttributeVisibilitySetting.key, attributeVisibility);

    SetShownScene(ScenePtr());
}
SceneEditorBase::SceneEditorBase(void) :
    _mfEditors                (), 
    _sfEditingScene           (ScenePtr(NullFC)), 
    Inherited() 
{
}