Ejemplo n.º 1
0
bool TetGenInterface::readNodesFromStream (std::ifstream &ins)
{
	std::string line;
	getline (ins, line);
	size_t pos_beg (line.find_first_not_of(" "));
	size_t n_nodes, dim, n_attributes;
	bool boundary_markers;
	bool not_read_header (true);

	while (!ins.fail() && not_read_header)
	{
		line = line.substr(pos_beg);
		if (line.compare(0,1,"#") == 0)
		{
			// this line is a comment - skip
			getline (ins, line);
			pos_beg = line.find_first_not_of(" ");
		}
		else
			// read header line
			not_read_header = !parseNodesFileHeader(line,
			                                        n_nodes,
			                                        dim,
			                                        n_attributes,
			                                        boundary_markers);
	}
	if (not_read_header)
		return false;
	if (!parseNodes(ins, n_nodes, dim))
		return false;

	return true;
}
Ejemplo n.º 2
0
	void GraphvizPlotter::parseSubgraphs(Agraph_t *g, GraphComponent *g_component, processedProperties *props) {
		// nacteni zpracovanych komponent pro jejich mozne budouci preskoceni v aktualni iteraci
		string_map node_attrs_bak = props->node_attrs;
		string_map edge_attrs_bak = props->edge_attrs;
		string_map graph_attrs_bak = props->graph_attrs;

		// prochazeni vsech podgrafu daneho grafu/podgrafu
		for (Agraph_t *subg = agfstsubg(g); subg; subg = agnxtsubg(subg)) {
			// vytvoreni podgrafu v datovem modelu
			Subgraph *subgraph = g_component->addSubgraph(agnameof(subg));
			// zpracovani atributu grafu/podgrafu a ulozeni do datoveho modelu k danemu podgrafu
			parseGraphAttrs(subg, subgraph, props);
			// zpracovani podgrafu a ulozeni do datoveho modelu k danemu pdgrafu
			parseSubgraphs(subg, subgraph, props);
			// stejne zpracovani v pripade
			parseNodes(subg, subgraph, props);
			parseEdges(subg, subgraph, props);

			// pro dalsi podgraf nactu zpet zpracovane komponenty
			props->graph_attrs.clear();
			props->node_attrs.clear();
			props->edge_attrs.clear();

			props->graph_attrs = graph_attrs_bak;
			props->node_attrs = node_attrs_bak;
			props->edge_attrs = edge_attrs_bak;
		}
	}
Ejemplo n.º 3
0
void Level::parseScene(TiXmlElement *XMLNode)
{
	TiXmlElement *element;

	element = XMLNode->FirstChildElement("nodes");
	if(element)
	{
		parseNodes(element);
	}
}
Ejemplo n.º 4
0
 virtual void parse(QDomElement & resources)
 {
     QDomNodeList nodes = resources.elementsByTagName("computer");
     parseNodes(nodes);
     QDomNodeList stores = resources.elementsByTagName("storage");
     parseStores(stores);
     QDomNodeList switches = resources.elementsByTagName("router");
     parseSwitches(switches);
     QDomNodeList links = resources.elementsByTagName("link");
     parseLinks(links);
 }
Ejemplo n.º 5
0
 virtual void parse(QDomElement & demand)
 {
     this->demand = demand;
     QString name = demand.attribute("id");
     request->setName(name.toStdString());
     QDomNodeList nodes = demand.elementsByTagName("vm");
     parseNodes(nodes);
     QDomNodeList stores = demand.elementsByTagName("storage");
     parseStores(stores);
     QDomNodeList links = demand.elementsByTagName("link");
     parseLinks(links);
 }
Ejemplo n.º 6
0
	void GraphvizPlotter::parse() {
		processedProperties processed_props;

		// zpracovani atributu grafu
		parseGraphAttrs(g_graph, graph, &processed_props);
		// zpracovani podgrafu grafu
		parseSubgraphs(g_graph, graph, &processed_props);
		// zpracovani vrcholu grafu
		parseNodes(g_graph, graph, &processed_props);
		// zpracovani hran grafu
		parseEdges(g_graph, graph, &processed_props);
	}
Ejemplo n.º 7
0
void DevicePluginOsdomotics::networkManagerReplyReady(QNetworkReply *reply)
{
    int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();

    // create user finished
    if (m_asyncSetup.contains(reply)) {
        Device *device = m_asyncSetup.take(reply);

        // check HTTP status code
        if (status != 200) {
            qCWarning(dcOsdomotics) << "Setup reply HTTP error:" << reply->errorString();
            emit deviceSetupFinished(device, DeviceManager::DeviceSetupStatusFailure);
            reply->deleteLater();
            return;
        }

        QByteArray data = reply->readAll();
        parseNodes(device, data);

        emit deviceSetupFinished(device, DeviceManager::DeviceSetupStatusSuccess);
    } else if (m_asyncNodeRescans.contains(reply)) {
        Device *device = m_asyncSetup.take(reply);

        // check HTTP status code
        if (status != 200) {
            qCWarning(dcOsdomotics) << "Setup reply HTTP error:" << reply->errorString();
            emit deviceSetupFinished(device, DeviceManager::DeviceSetupStatusFailure);
            reply->deleteLater();
            return;
        }

        QByteArray data = reply->readAll();
        parseNodes(device, data);
    }
    reply->deleteLater();
}
Ejemplo n.º 8
0
bool procTree_c::loadProcFile( const char* fname )
{
	parser_c p;
	if ( p.openFile( fname ) )
	{
		g_core->RedWarning( "procTree_c::loadProcFile: cannot open %s\n", fname );
		return true; // error
	}
	
	// check for Doom3 ident first
	if ( p.atWord( "mapProcFile003" ) == false )
	{
		if ( p.atWord( "PROC" ) )
		{
			// Quake4 ident
			str version = p.getToken();
		}
		else
		{
			g_core->RedWarning( "procTree_c::loadProcFile: %s has bad ident %s, should be %s or %s\n", fname, p.getToken(), "mapProcFile003", "PROC" );
			return true; // error
		}
	}
	
	while ( p.atEOF() == false )
	{
		if ( p.atWord( "model" ) )
		{
			r_model_c* newModel = new r_model_c;
			this->models.push_back( newModel );
			if ( newModel->parseProcModel( p ) )
			{
				return true; // error occured during model parsing
			}
			newModel->recalcModelTBNs();
			model_c* m = RF_AllocModel( newModel->getName() );
			m->initProcModel( this, newModel );
			
			if ( newModel->isAreaModel() )
			{
				u32 areaNum = newModel->getAreaNumber();
				this->setAreaModel( areaNum, newModel );
			}
		}
		else if ( p.atWord( "interAreaPortals" ) )
		{
			if ( parseAreaPortals( p, fname ) )
			{
				return true;
			}
		}
		else if ( p.atWord( "nodes" ) )
		{
			if ( parseNodes( p, fname ) )
			{
				return true;
			}
		}
		else if ( p.atWord( "shadowModel" ) )
		{
			p.skipCurlyBracedBlock();
		}
		else
		{
			g_core->RedWarning( "procTree_c::loadProcFile: skipping unknown token %s in file %s at line %i\n", p.getToken(), fname, p.getCurrentLineNumber() );
		}
	}
	
	this->procFileName = fname;
	
	// create model VBOs and IBOs
	for ( u32 i = 0; i < models.size(); i++ )
	{
		r_model_c* m = models[i];
		m->createVBOsAndIBOs();
	}
	
	g_core->RedWarning( "procTree_c::loadProcFile: %s has %i models, %i areas, %i portals, and %i nodes\n",
						fname, models.size(), areas.size(), portals.size(), nodes.size() );
						
	return false; // OK
}