parameters: (turn_definitions, begin, end)
return_statement: return turn_definitions_xml.toXML()
docstring: Transforms the given TurnDefinitions object into a string
          containing a valid SUMO turn-definitions file.
docstring_summary: Transforms the given TurnDefinitions object into a string
          containing a valid SUMO turn-definitions file.
docstring_tokens: Transforms the given TurnDefinitions object into a string containing a valid SUMO turn - definitions file .
function: def to_xml(turn_definitions, begin, end):
      """ Transforms the given TurnDefinitions object into a string
          containing a valid SUMO turn-definitions file. """
  
      LOGGER.info("Converting turn definitions to XML")
      LOGGER.debug("Turn definitions sources number: %i" %
                   (len(turn_definitions.get_sources())))
  
      turn_definitions_xml = sumolib.xml.create_document("turns")
  
      interval_element = turn_definitions_xml.addChild("interval")
      interval_element.setAttribute("begin", begin)
      interval_element.setAttribute("end", end)
  
      for source in turn_definitions.get_sources():
          LOGGER.debug("Converting turn definition with source %s" % (source))
  
          for destination in turn_definitions.get_destinations(source):
              edgeRelation = interval_element.addChild("edgeRelation", {"from": source})
              probability = turn_definitions.get_turning_probability(source,
                                                                     destination)
  
              LOGGER.debug("Converting turn definition destination %s "
                           "with probability %f" % (destination, probability))
              edgeRelation.setAttribute("to", destination)
              edgeRelation.setAttribute("probability", "%.10g" % probability)
  
      return turn_definitions_xml.toXML()
function_tokens: def to_xml ( turn_definitions , begin , end ) : LOGGER . info ( "Converting turn definitions to XML" ) LOGGER . debug ( "Turn definitions sources number: %i" % ( len ( turn_definitions . get_sources ( ) ) ) ) turn_definitions_xml = sumolib . xml . create_document ( "turns" ) interval_element = turn_definitions_xml . addChild ( "interval" ) interval_element . setAttribute ( "begin" , begin ) interval_element . setAttribute ( "end" , end ) for source in turn_definitions . get_sources ( ) : LOGGER . debug ( "Converting turn definition with source %s" % ( source ) ) for destination in turn_definitions . get_destinations ( source ) : edgeRelation = interval_element . addChild ( "edgeRelation" , { "from" : source } ) probability = turn_definitions . get_turning_probability ( source , destination ) LOGGER . debug ( "Converting turn definition destination %s " "with probability %f" % ( destination , probability ) ) edgeRelation . setAttribute ( "to" , destination ) edgeRelation . setAttribute ( "probability" , "%.10g" % probability ) return turn_definitions_xml . toXML ( )