void NIImporter_SUMO::myStartElement(int element, const SUMOSAXAttributes& attrs) { /* our goal is to reproduce the input net faithfully * there are different types of objects in the netfile: * 1) those which must be loaded into NBNetBuilder-Containers for processing * 2) those which can be ignored because they are recomputed based on group 1 * 3) those which are of no concern to NBNetBuilder but should be exposed to * NETEDIT. We will probably have to patch NBNetBuilder to contain them * and hand them over to NETEDIT * alternative idea: those shouldn't really be contained within the * network but rather in separate files. teach NETEDIT how to open those * (POI?) * 4) those which are of concern neither to NBNetBuilder nor NETEDIT and * must be copied over - need to patch NBNetBuilder for this. * copy unknown by default */ switch (element) { case SUMO_TAG_NET: { bool ok; myAmLefthand = attrs.getOpt<bool>(SUMO_ATTR_LEFTHAND, 0, ok, false); myCornerDetail = attrs.getOpt<int>(SUMO_ATTR_CORNERDETAIL, 0, ok, 0); myLinkDetail = attrs.getOpt<int>(SUMO_ATTR_LINKDETAIL, 0, ok, -1); break; } case SUMO_TAG_EDGE: addEdge(attrs); break; case SUMO_TAG_LANE: addLane(attrs); break; case SUMO_TAG_JUNCTION: addJunction(attrs); break; case SUMO_TAG_REQUEST: addRequest(attrs); break; case SUMO_TAG_CONNECTION: addConnection(attrs); break; case SUMO_TAG_TLLOGIC: myCurrentTL = initTrafficLightLogic(attrs, myCurrentTL); break; case SUMO_TAG_PHASE: addPhase(attrs, myCurrentTL); break; case SUMO_TAG_LOCATION: myLocation = loadLocation(attrs); break; case SUMO_TAG_PROHIBITION: addProhibition(attrs); break; case SUMO_TAG_ROUNDABOUT: addRoundabout(attrs); break; default: break; } }
void NIImporter_SUMO::myStartElement(int element, const SUMOSAXAttributes& attrs) { /* our goal is to reproduce the input net faithfully * there are different types of objects in the netfile: * 1) those which must be loaded into NBNetBuilder-Containers for processing * 2) those which can be ignored because they are recomputed based on group 1 * 3) those which are of no concern to NBNetBuilder but should be exposed to * NETEDIT. We will probably have to patch NBNetBuilder to contain them * and hand them over to NETEDIT * alternative idea: those shouldn't really be contained within the * network but rather in separate files. teach NETEDIT how to open those * (POI?) * 4) those which are of concern neither to NBNetBuilder nor NETEDIT and * must be copied over - need to patch NBNetBuilder for this. * copy unknown by default */ switch (element) { case SUMO_TAG_EDGE: addEdge(attrs); break; case SUMO_TAG_LANE: addLane(attrs); break; case SUMO_TAG_JUNCTION: addJunction(attrs); break; case SUMO_TAG_SUCC: addSuccEdge(attrs); break; case SUMO_TAG_SUCCLANE: addSuccLane(attrs); break; case SUMO_TAG_CONNECTION: addConnection(attrs); break; case SUMO_TAG_TLLOGIC__DEPRECATED: case SUMO_TAG_TLLOGIC: myCurrentTL = initTrafficLightLogic(attrs, myCurrentTL); break; case SUMO_TAG_PHASE: addPhase(attrs, myCurrentTL); break; case SUMO_TAG_LOCATION: myLocation = loadLocation(attrs); break; case SUMO_TAG_PROHIBITION: addProhibition(attrs); break; default: break; } }
bool FixPaintSelection::setJunctionValue(const Point& pt, Real height,Real weight) { JunctionMap::iterator it; if(!existJunction(pt)) it = addJunction(pt); else it = mJunctions.find(pt); it->second.height = height; it->second.weight = weight; return true; }
void NIImporter_SUMO::myStartElement(SumoXMLTag element, const SUMOSAXAttributes &attrs) throw(ProcessError) { switch (element) { case SUMO_TAG_EDGE: addEdge(attrs); break; case SUMO_TAG_LANE: if (myCurrentEdge!=0) { addLane(attrs); } break; case SUMO_TAG_JUNCTION: addJunction(attrs); break; case SUMO_TAG_SUCC: addSuccEdge(attrs); break; case SUMO_TAG_SUCCLANE: addSuccLane(attrs); break; } }
void PerlinFace::updateVertices() { const GLubyte SKIN_COLOR[] = {255, 214, 163}; const GLubyte MOUSE_COLOR[] = {200, 159, 108}; const GLubyte HAIR_COLOR[] = {0, 0, 0}; _trianglesCount = 0; _trianglesPos = _triangles; _normalsPos = _normals; _colorsPos = _colors; std::swap(_oldNormals, _newNormals); // Brows addTriangles(BROW_LEFT, BROW_MID_TOP, BROW_MID_BOTTOM, 0, 0, 0); addTriangles(BROW_MID_BOTTOM, BROW_MID_TOP, BROW_RIGHT_TOP, 0, 0, 0); addTriangles(BROW_MID_BOTTOM, BROW_RIGHT_TOP, BROW_RIGHT_BOTTOM, 0, 0, 0); // Forehead addTriangles(FOREHEAD_LEFT, FOREHEAD_RIGHT, BROW_MID_TOP, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(FOREHEAD_LEFT, BROW_MID_TOP, BROW_LEFT, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(FOREHEAD_RIGHT, BROW_RIGHT_TOP, BROW_MID_TOP, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addJunction(FOREHEAD_RIGHT, BROW_RIGHT_TOP, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addJunction(BROW_RIGHT_TOP, BROW_RIGHT_BOTTOM, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); // Eyes addTriangles(BROW_LEFT, BROW_MID_BOTTOM, EYE_LEFT, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(EYE_LEFT, BROW_MID_BOTTOM, EYE_MID_TOP, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(BROW_MID_BOTTOM, BROW_RIGHT_BOTTOM, EYE_MID_TOP, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(EYE_MID_TOP, BROW_RIGHT_BOTTOM, EYE_RIGHT, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addJunction(BROW_RIGHT_BOTTOM, EYE_RIGHT, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); // Temp eye draw addTriangles(EYE_LEFT, EYE_MID_TOP, EYEBALL_MID, 255, 255, 255); addTriangles(EYE_MID_TOP, EYE_RIGHT, EYEBALL_MID, 255, 255, 255); addTriangles(EYE_RIGHT, EYE_MID_BOTTOM, EYEBALL_MID, 255, 255, 255); addTriangles(EYE_MID_BOTTOM, EYE_LEFT, EYEBALL_MID, 255, 255, 255); // Chick addTriangles(EAR_CENTER, FOREHEAD_LEFT, BROW_LEFT, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(BROW_LEFT, CHICK_LEFT, EAR_CENTER, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(BROW_LEFT, EYE_LEFT, CHICK_LEFT, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(EYE_LEFT, EYE_MID_BOTTOM, CHICK_LEFT, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(EYE_MID_BOTTOM, EYE_RIGHT, NOSTRIL_LEFT, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(CHICK_LEFT, EYE_MID_BOTTOM, NOSTRIL_LEFT, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(CHICK_LEFT, NOSTRIL_LEFT, CHICK_MID, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(CHICK_MID, NOSTRIL_LEFT, MOUTH_TOP_OUT, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(CHICK_MID, MOUTH_TOP_OUT, MOUTH_MID_OUT, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(CHICK_MID, MOUTH_MID_OUT, CHIN_TIP, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(CHICK_MID, CHIN_TIP, CHICK_RIGHT, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(CHICK_RIGHT, CHIN_TIP, CHIN_BOTTOM, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(CHICK_LEFT, CHICK_MID, CHICK_RIGHT, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(EAR_CENTER, CHICK_LEFT, JAW_LEFT, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(JAW_LEFT, CHICK_LEFT, CHICK_RIGHT, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); // Nose addTriangles(EYE_RIGHT, NOSE_LEFT, NOSTRIL_LEFT, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(EYE_RIGHT, NOSE_RIGHT, NOSE_LEFT, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(NOSE_LEFT, NOSE_RIGHT, NOSTRIL_TOP, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addJunction(EYE_RIGHT, NOSE_RIGHT, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addJunction(NOSE_RIGHT, NOSTRIL_TOP, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(NOSTRIL_LEFT, NOSE_LEFT, NOSTRIL_TOP, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(NOSTRIL_LEFT, NOSTRIL_TOP, NOSTRIL_BOTTOM, 0, 0, 0); addJunction(NOSTRIL_TOP, NOSTRIL_BOTTOM, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(NOSTRIL_LEFT, NOSTRIL_BOTTOM, MOUTH_TOP_OUT, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addJunction(NOSTRIL_BOTTOM, MOUTH_TOP_OUT, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); // Mouth addTriangles(MOUTH_TOP_OUT, MOUTH_TOP_IN, MOUTH_MID_OUT, MOUSE_COLOR[0], MOUSE_COLOR[1], MOUSE_COLOR[2]); addTriangles(MOUTH_TOP_IN, MOUTH_MID_IN, MOUTH_MID_OUT, MOUSE_COLOR[0], MOUSE_COLOR[1], MOUSE_COLOR[2]); addTriangles(MOUTH_MID_OUT, MOUTH_MID_IN, MOUTH_BOTTOM_OUT, MOUSE_COLOR[0], MOUSE_COLOR[1], MOUSE_COLOR[2]); addTriangles(MOUTH_MID_IN, MOUTH_BOTTOM_IN, MOUTH_BOTTOM_OUT, MOUSE_COLOR[0], MOUSE_COLOR[1], MOUSE_COLOR[2]); addJunction(MOUTH_TOP_OUT, MOUTH_TOP_IN, MOUSE_COLOR[0], MOUSE_COLOR[1], MOUSE_COLOR[2]); addJunction(MOUTH_BOTTOM_OUT, MOUTH_BOTTOM_IN, MOUSE_COLOR[0], MOUSE_COLOR[1], MOUSE_COLOR[2]); addTriangles(MOUTH_MID_IN, MOUTH_TOP_IN, MOUTH_BOTTOM_IN, 0, 0, 0); addJunction(MOUTH_TOP_IN, MOUTH_BOTTOM_IN, 0, 0, 0); // Chin addTriangles(MOUTH_MID_OUT, MOUTH_BOTTOM_OUT, CHIN_IN, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(MOUTH_MID_OUT, CHIN_IN, CHIN_TIP, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addJunction(MOUTH_BOTTOM_OUT, CHIN_IN, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addJunction(CHIN_IN, CHIN_TIP, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addJunction(CHIN_TIP, CHIN_BOTTOM, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); // Jaw addTriangles(JAW_BOTTOM_LEFT, JAW_LEFT, CHICK_RIGHT, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(JAW_LEFT, JAW_BOTTOM_LEFT, EAR_CENTER, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(JAW_BOTTOM_LEFT, CHICK_RIGHT, CHIN_BOTTOM, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(JAW_BOTTOM_LEFT, CHIN_BOTTOM, JAW_BOTTOM, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addJunction(CHIN_BOTTOM, JAW_BOTTOM, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); // Ear addTriangles(FOREHEAD_LEFT, EAR_CENTER, EAR_TOP_RIGHT, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(JAW_BOTTOM_LEFT, EAR_BOTTOM_RIGHT, EAR_CENTER, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(EAR_BOTTOM_RIGHT, EAR_TOP_RIGHT, EAR_CENTER, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(EAR_BOTTOM_RIGHT, EAR_BOTTOM_LEFT, EAR_TOP_LEFT, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(EAR_TOP_LEFT, EAR_TOP_MID, EAR_TOP_RIGHT, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(EAR_TOP_RIGHT, EAR_BOTTOM_RIGHT, EAR_TOP_LEFT, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(EAR_TOP_RIGHT, EAR_TOP_MID, EAR_BACK, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(EAR_TOP_LEFT, EAR_TOP_MID, EAR_BACK, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(EAR_BOTTOM_LEFT, EAR_TOP_LEFT, EAR_BACK, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); addTriangles(EAR_BOTTOM_LEFT, EAR_BOTTOM_RIGHT, EAR_BACK, SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]); // hair addTriangles(FOREHEAD_RIGHT, FOREHEAD_LEFT, HAIR_1, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addTriangles(FOREHEAD_LEFT, HAIR_2, HAIR_1, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addTriangles(FOREHEAD_LEFT, HAIR_3, HAIR_2, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addTriangles(FOREHEAD_LEFT, HAIR_SIDE_1, HAIR_3, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addTriangles(FOREHEAD_LEFT, HAIR_SIDE_2, HAIR_SIDE_1, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addTriangles(FOREHEAD_LEFT, HAIR_SIDE_3, HAIR_SIDE_2, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addTriangles(FOREHEAD_LEFT, EAR_TOP_RIGHT, HAIR_SIDE_3, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addTriangles(EAR_TOP_RIGHT, HAIR_SIDE_4, HAIR_SIDE_3, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addTriangles(EAR_TOP_RIGHT, EAR_BOTTOM_RIGHT, HAIR_SIDE_4, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addTriangles(EAR_BOTTOM_RIGHT, HAIR_SIDE_5, HAIR_SIDE_4, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addTriangles(EAR_BOTTOM_RIGHT, JAW_BOTTOM_LEFT, HAIR_SIDE_5, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addTriangles(HAIR_3, HAIR_SIDE_1, HAIR_4, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addTriangles(HAIR_SIDE_1, HAIR_SIDE_2, HAIR_4, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addTriangles(HAIR_SIDE_2, HAIR_5, HAIR_4, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addTriangles(HAIR_SIDE_2, HAIR_6, HAIR_5, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addTriangles(HAIR_SIDE_2, HAIR_SIDE_3, HAIR_6, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addTriangles(HAIR_SIDE_3, HAIR_7, HAIR_6, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addTriangles(HAIR_SIDE_3, HAIR_SIDE_4, HAIR_7, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addTriangles(HAIR_SIDE_4, HAIR_8, HAIR_7, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addTriangles(HAIR_SIDE_4, HAIR_SIDE_5, HAIR_8, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addTriangles(HAIR_SIDE_5, HAIR_9, HAIR_8, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addTriangles(HAIR_SIDE_5, JAW_BOTTOM, HAIR_9, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addTriangles(HAIR_SIDE_5, JAW_BOTTOM, JAW_BOTTOM_LEFT, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addJunction(FOREHEAD_RIGHT, HAIR_1, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addJunction(HAIR_1, HAIR_2, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addJunction(HAIR_2, HAIR_3, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addJunction(HAIR_3, HAIR_4, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addJunction(HAIR_4, HAIR_5, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addJunction(HAIR_5, HAIR_6, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addJunction(HAIR_6, HAIR_7, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addJunction(HAIR_7, HAIR_8, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addJunction(HAIR_8, HAIR_9, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); addJunction(HAIR_9, JAW_BOTTOM, HAIR_COLOR[0], HAIR_COLOR[1], HAIR_COLOR[2]); // Now that we have summed up the normals for each point, let's normalize them. for (int i = 0; i < _vertexNumber; ++i) { _newNormals[i] = glm::normalize(_newNormals[i]); } }