예제 #1
0
void DotSceneLoader::processScene(rapidxml::xml_node<>* XMLRoot)
{
    // Process the scene parameters
    Ogre::String version = getAttrib(XMLRoot, "formatVersion", "unknown");

    Ogre::String message = "[DotSceneLoader] Parsing dotScene file with version " + version;
    if(XMLRoot->first_attribute("ID"))
        message += ", id " + Ogre::String(XMLRoot->first_attribute("ID")->value());
    if(XMLRoot->first_attribute("sceneManager"))
        message += ", scene manager " + Ogre::String(XMLRoot->first_attribute("sceneManager")->value());
    if(XMLRoot->first_attribute("minOgreVersion"))
        message += ", min. Ogre version " + Ogre::String(XMLRoot->first_attribute("minOgreVersion")->value());
    if(XMLRoot->first_attribute("author"))
        message += ", author " + Ogre::String(XMLRoot->first_attribute("author")->value());

    Ogre::LogManager::getSingleton().logMessage(message);

    rapidxml::xml_node<>* pElement;

    // Process environment (?)
    pElement = XMLRoot->first_node("environment");
    if(pElement)
        processEnvironment(pElement);

    // Process nodes (?)
    pElement = XMLRoot->first_node("nodes");
    if(pElement)
        processNodes(pElement);

    // Process externals (?)
    pElement = XMLRoot->first_node("externals");
    if(pElement)
        processExternals(pElement);

    // Process userDataReference (?)
    pElement = XMLRoot->first_node("userDataReference");
    if(pElement)
        processUserDataReference(pElement);

    // Process octree (?)
    pElement = XMLRoot->first_node("octree");
    if(pElement)
        processOctree(pElement);

    // Process light (?)
    //pElement = XMLRoot->first_node("light");
    //if(pElement)
    //   processLight(pElement);

    // Process camera (?)
    pElement = XMLRoot->first_node("camera");
    if(pElement)
        processCamera(pElement);

    // Process terrain (?)
    pElement = XMLRoot->first_node("terrain");
    if(pElement)
        processTerrain(pElement);
}
예제 #2
0
void CFG::cfgToDot(SgNode* node, const std::string& file_name)
{
    std::ofstream ofile(file_name.c_str(), std::ios::out);
    ofile << "digraph defaultName {\n";
    std::set<SgGraphNode*> explored;
    processNodes(ofile, cfgForBeginning(node), explored);
    ofile << "}\n";
}
예제 #3
0
void DotSceneLoader::processScene(TiXmlElement* xmlRoot) {
	std::string version = getAttrib(xmlRoot, "formatVersion", "unknown");

	std::string message = "[DotSceneLoader] Parsing dotScene file with version " + version;

	if(xmlRoot->Attribute("ID"))
		message += ", id " + std::string(xmlRoot->Attribute("ID"));
	if(xmlRoot->Attribute("sceneManager"))
		message += ", scene manager " + std::string(xmlRoot->Attribute("sceneManager"));
	if(xmlRoot->Attribute("minOgreVersion"))
		message += ", min. Ogre version " + std::string(xmlRoot->Attribute("minOgreVersion"));
	if(xmlRoot->Attribute("author"))
		message += ", author " + std::string(xmlRoot->Attribute("author"));

	TiXmlElement *element;

	// Process nodes (?)
	element = xmlRoot->FirstChildElement("nodes");
	if(element)
		processNodes(element);

	// Process externals (?)
	element = xmlRoot->FirstChildElement("externals");
	if(element)
		processExternals(element);

	// Process environment (?)
	element = xmlRoot->FirstChildElement("environment");
	if(element)
		processEnvironment(element);

	// Process terrain (?)
	element = xmlRoot->FirstChildElement("terrain");
	if(element)
		processTerrain(element);

	// Process userDataReference (?)
	element = xmlRoot->FirstChildElement("userDataReference");
	if(element)
		processUserDataReference(element);

	// Process octree (?)
	element = xmlRoot->FirstChildElement("octree");
	if(element)
		processOctree(element);

	// Process light (?)
	element = xmlRoot->FirstChildElement("light");
	if(element)
		processLight(element);

	// Process camera (?)
	element = xmlRoot->FirstChildElement("camera");
	if(element)
		processCamera(element);
}
예제 #4
0
void CfgToDotImpl<NodeT, EdgeT, Debug>::processNodes(NodeT n) {
  ROSE_ASSERT (n.getNode());
  pair<typename multimap<SgNode*, NodeT>::const_iterator,
       typename multimap<SgNode*, NodeT>::const_iterator> ip = exploredNodes.equal_range(n.getNode());
  for (typename multimap<SgNode*, NodeT>::const_iterator i = ip.first; i != ip.second; ++i) {
    if (i->second == n) return;
  }
  exploredNodes.insert(make_pair(n.getNode(), n));
  printNodePlusEdges<NodeT, EdgeT, Debug>(o, n);
  vector<EdgeT> outEdges = n.outEdges();
  for (unsigned int i = 0; i < outEdges.size(); ++i) {
    ROSE_ASSERT (outEdges[i].source() == n);
    processNodes(outEdges[i].target());
  }
  if (Debug) {
    vector<EdgeT> inEdges = n.inEdges();
    for (unsigned int i = 0; i < inEdges.size(); ++i) {
      ROSE_ASSERT (inEdges[i].target() == n);
      processNodes(inEdges[i].source());
    }
  }
}
예제 #5
0
void CfgToDotImpl::processNodes(SgNode* top) {
  if (nodesPrinted.find(top) != nodesPrinted.end()) return;
  nodesPrinted.insert(top);
  o << "subgraph cluster_" << uintptr_t(top) << " {" << endl;
  o << "style=invis;" << endl;
  for (multimap<SgNode*, CFGNode>::const_iterator it = exploredNodes.lower_bound(top);
       it != exploredNodes.upper_bound(top); ++it) {
    printNodePlusEdges(o, it->second);
  }
  vector<SgNode*> children = top->get_traversalSuccessorContainer();
  for (unsigned int i = 0; i < children.size(); ++i) {
    if (children[i]) {
      processNodes(children[i]);
    }
  }
  o << "}" << endl;
}
예제 #6
0
파일: reader.c 프로젝트: SynBioDex/libSBOLc
void readDocument(Document* destination, char* filename) {
	DESTINATION = destination;

	// parse
	safeXmlInitParser();
	DOCUMENT = xmlParseFile(filename);
	if (!DOCUMENT) {
		printf("Error reading %s\n", filename);
		return;
	}

	// validate
	if (!isValidSBOL(DOCUMENT)) {
		printf("%s is not a valid SBOL document.\n", filename);
		return;
	}
		
	// create XPath context
	CONTEXT = xmlXPathNewContext(DOCUMENT);
	xmlXPathRegisterNs(CONTEXT, (const xmlChar*)NSPREFIX_SBOL, (const xmlChar*)NSURL_SBOL);
	xmlXPathRegisterNs(CONTEXT, (const xmlChar*)NSPREFIX_RDF, (const xmlChar*)NSURL_RDF);

	#define GLOBAL_XPATH BAD_CAST "//" NSPREFIX_SBOL ":"

	// create all the SBOLObjects
	processNodes(readDNASequenceContent,        GLOBAL_XPATH NODENAME_DNASEQUENCE);
	processNodes(readSequenceAnnotationContent, GLOBAL_XPATH NODENAME_SEQUENCEANNOTATION);
	processNodes(readDNAComponentContent,       GLOBAL_XPATH NODENAME_DNACOMPONENT);
	processNodes(readCollectionContent,         GLOBAL_XPATH NODENAME_COLLECTION);
	
	// link them together with pointers
	processNodes(readSequenceAnnotationReferences, GLOBAL_XPATH NODENAME_SEQUENCEANNOTATION);
	processNodes(readDNAComponentReferences,       GLOBAL_XPATH NODENAME_DNACOMPONENT);
	processNodes(readCollectionReferences,         GLOBAL_XPATH NODENAME_COLLECTION);

	#undef GLOBAL_XPATH
	
	// clean up
	xmlXPathFreeContext(CONTEXT);
	xmlFreeDoc(DOCUMENT);
	DESTINATION = NULL;
	xmlCleanupParser();
}