Exemple #1
0
void
RONetHandler::myStartElement(int element,
                             const SUMOSAXAttributes& attrs) {
    switch (element) {
        case SUMO_TAG_EDGE:
            // in the first step, we do need the name to allocate the edge
            // in the second, we need it to know to which edge we have to add
            //  the following edges to
            parseEdge(attrs);
            break;
        case SUMO_TAG_LANE:
            if (myProcess) {
                parseLane(attrs);
            }
            break;
        case SUMO_TAG_JUNCTION:
            parseJunction(attrs);
            break;
        case SUMO_TAG_CONNECTION:
            parseConnection(attrs);
            break;
        case SUMO_TAG_BUS_STOP:
            parseBusStop(attrs);
            break;
        case SUMO_TAG_CONTAINER_STOP:
            parseContainerStop(attrs);
            break;
        case SUMO_TAG_TAZ:
            parseDistrict(attrs);
            break;
        case SUMO_TAG_TAZSOURCE:
            parseDistrictEdge(attrs, true);
            break;
        case SUMO_TAG_TAZSINK:
            parseDistrictEdge(attrs, false);
            break;
        case SUMO_TAG_TYPE: {
            bool ok = true;
            myCurrentTypeID = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
            break;
        }
        case SUMO_TAG_RESTRICTION: {
            bool ok = true;
            const SUMOVehicleClass svc = getVehicleClassID(attrs.get<std::string>(SUMO_ATTR_VCLASS, myCurrentTypeID.c_str(), ok));
            const SUMOReal speed = attrs.get<SUMOReal>(SUMO_ATTR_SPEED, myCurrentTypeID.c_str(), ok);
            if (ok) {
                myNet.addRestriction(myCurrentTypeID, svc, speed);
            }
            break;
        }
        default:
            break;
    }
}
Exemple #2
0
int loadEdges(FILE* fp, char* inbuf, IntList* adjVertices, int n) {
  int num;
  Cstring line;

  num=0;
  line = fgets(inbuf, 1024, fp);
  while (line != NULL) {
    Edge e = parseEdge(line, n);
    adjVertices[e.from] = intCons(e.to, adjVertices[e.from]);
    num++;
    line = fgets(inbuf, 1024, fp);
  }
  return num;
}
bool GraphMLHandler::startElement(const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts)
{
  if(done)
    return true;
  
  if(!localName.compare("key"))
    return parseKey(atts);
  else if(!localName.compare("graph"))
    return parseGraphElm(atts);
  else if(!localName.compare("node"))
    return parseNode(atts);
  else if(!localName.compare("edge"))
    return parseEdge(atts);
  else if(!localName.compare("data"))
    return parseData(atts);
  
  return true;
}
Exemple #4
0
EdgeList* intEdges(int m, char* instream, char line[1024], FILE* inbuff){
	int n = 0;
	EdgeList adjVertices[m];
	EdgeList* pointAdj = malloc(sizeof(EdgeList));
	for(int i = 1; i <=m; i++) adjVertices[i] = edgeNil; 
     while(instream != NULL){  
		 Edge e = parseEdge(line);
		 EdgeInfo P; 
		 P.to = e.to; 
		 P.wgt = e.weight;
		 adjVertices[e.from] = edgeCons(P, adjVertices[e.from]);
		 instream = fgets(line, 1024, inbuff);
		 n++;
	 }

	 pointAdj = adjVertices;
	 return pointAdj;
}
void
RONetHandler::myStartElement(int element,
                             const SUMOSAXAttributes& attrs) {
    switch (element) {
        case SUMO_TAG_EDGE:
            // in the first step, we do need the name to allocate the edge
            // in the second, we need it to know to which edge we have to add
            //  the following edges to
            parseEdge(attrs);
            break;
        case SUMO_TAG_LANE:
            if (myProcess) {
                parseLane(attrs);
            }
            break;
        case SUMO_TAG_JUNCTION:
            parseJunction(attrs);
            break;
        case SUMO_TAG_CONNECTION:
            parseConnection(attrs);
            break;
        case SUMO_TAG_BUS_STOP:
            parseBusStop(attrs);
            break;
        case SUMO_TAG_CONTAINER_STOP:
            parseContainerStop(attrs);
            break;
        case SUMO_TAG_TAZ:
            parseDistrict(attrs);
            break;
        case SUMO_TAG_TAZSOURCE:
            parseDistrictEdge(attrs, true);
            break;
        case SUMO_TAG_TAZSINK:
            parseDistrictEdge(attrs, false);
            break;
        default:
            break;
    }
}
Exemple #6
0
int loadEdges(FILE* fp, char* inbuf, EdgeList* adjInfo, int n, char alg) {
  int num;
  Cstring line;

  num=0;
  line = fgets(inbuf, 1024, fp);
  while (line != NULL) {
    Edge e = parseEdge(line, n);
    EdgeInfo ei;
    ei.to = e.to;
    ei.wgt = e.weight;
    adjInfo[e.from] = edgeCons(ei, adjInfo[e.from]);
    if(alg=='P') {
      EdgeInfo ei2;
      ei2.to = e.from;
      ei2.wgt = e.weight;
      adjInfo[e.to] = edgeCons(ei2, adjInfo[e.to]);
    }
    num++;
    line = fgets(inbuf, 1024, fp);
  }
  return num;
}