def update_arc_indexes(geometry, merged_arcs, old_arcs):
 if (geometry['type'] in ('Point', 'MultiPoint')):
  return
 elif (geometry['type'] == 'LineString'):
  for (arc_index, old_arc) in enumerate(geometry['arcs']):
   geometry['arcs'][arc_index] = len(merged_arcs)
   merged_arcs.append(old_arcs[old_arc])
 elif (geometry['type'] == 'Polygon'):
  for ring in geometry['arcs']:
   for (arc_index, old_arc) in enumerate(ring):
    ring[arc_index] = len(merged_arcs)
    merged_arcs.append(old_arcs[old_arc])
 elif (geometry['type'] == 'MultiLineString'):
  for part in geometry['arcs']:
   for (arc_index, old_arc) in enumerate(part):
    part[arc_index] = len(merged_arcs)
    merged_arcs.append(old_arcs[old_arc])
 elif (geometry['type'] == 'MultiPolygon'):
  for part in geometry['arcs']:
   for ring in part:
    for (arc_index, old_arc) in enumerate(ring):
     ring[arc_index] = len(merged_arcs)
     merged_arcs.append(old_arcs[old_arc])
 else:
  raise NotImplementedError(("Can't do %s geometries" % geometry['type']))

def update_arc_indexes ( geometry , merged_arcs , old_arcs ) : if ( geometry [ 'type' ] in ( 'Point' , 'MultiPoint' ) ) : return elif ( geometry [ 'type' ] == 'LineString' ) : for ( arc_index , old_arc ) in enumerate ( geometry [ 'arcs' ] ) : geometry [ 'arcs' ] [ arc_index ] = len ( merged_arcs ) merged_arcs . append ( old_arcs [ old_arc ] ) elif ( geometry [ 'type' ] == 'Polygon' ) : for ring in geometry [ 'arcs' ] : for ( arc_index , old_arc ) in enumerate ( ring ) : ring [ arc_index ] = len ( merged_arcs ) merged_arcs . append ( old_arcs [ old_arc ] ) elif ( geometry [ 'type' ] == 'MultiLineString' ) : for part in geometry [ 'arcs' ] : for ( arc_index , old_arc ) in enumerate ( part ) : part [ arc_index ] = len ( merged_arcs ) merged_arcs . append ( old_arcs [ old_arc ] ) elif ( geometry [ 'type' ] == 'MultiPolygon' ) : for part in geometry [ 'arcs' ] : for ring in part : for ( arc_index , old_arc ) in enumerate ( ring ) : ring [ arc_index ] = len ( merged_arcs ) merged_arcs . append ( old_arcs [ old_arc ] ) else : raise NotImplementedError ( ( "Can't do %s geometries" % geometry [ 'type' ] ) )
updated geometry arc indexes .