parameters: (osmid, tags, members, wayRefList)
docstring: Add a new Multipolygon to the list.
docstring_summary: Add a new Multipolygon to the list.
docstring_tokens: Add a new Multipolygon to the list .
function: def add(osmid, tags, members, wayRefList):
          """Add a new Multipolygon to the list."""
          multipolygon = OSMMultipolygon()
          multipolygon.OSMID = osmid
          multipolygon.tags = tags
  
          for member in members:
              reference = member['reference']
              type = member['type']
              role = member['role']
              if type == 'way' and role == 'outer' and reference in wayRefList:
                  refToAdd = wayRefList[reference]
                  # if the new ref to be added are not defined in the same direction than the one already added
                  if not len(multipolygon.ref) == 0 and not multipolygon.ref[-1] == refToAdd[0]:
                      refToAdd.reverse()
                      if not multipolygon.ref[-1] == refToAdd[0]:
                          multipolygon.ref.reverse()
                          if not multipolygon.ref[-1] == refToAdd[0]:
                              refToAdd.reverse()
                  if len(multipolygon.ref) == 0:
                      multipolygon.ref = multipolygon.ref + refToAdd
                  else:
                      for ref in refToAdd:
                          # if this point is already in the list (but it is equal to previous one) => loop closed
                          if ref in multipolygon.ref and not ref == multipolygon.ref[-1]:
                              multipolygon.ref = multipolygon.ref + refToAdd
                              # clean multipolygon
                              for index in range(len(multipolygon.ref) - 1, 0, -1):
                                  if multipolygon.ref[index] == multipolygon.ref[index - 1]:
                                      del multipolygon.ref[index]
                              OSMMultipolygon.multipolygonList.append(multipolygon)  # add this multipolygon to the list
                              break
                      # if loop not close add this part of multipolygon and continue
                      if len(OSMMultipolygon.multipolygonList) > 0 and not OSMMultipolygon.multipolygonList[-1] == multipolygon:
                          multipolygon.ref = multipolygon.ref + refToAdd
                      # otherwise this multipolygon is done
                      else:
                          break
          # this multipolygon is only partial (but we still want to add it to the list)
          if (not len(multipolygon.ref) == 0 and not
                  (len(OSMMultipolygon.multipolygonList) > 0 and OSMMultipolygon.multipolygonList[-1] == multipolygon)):
              OSMMultipolygon.multipolygonList.append(multipolygon)
function_tokens: def add ( osmid , tags , members , wayRefList ) : multipolygon = OSMMultipolygon ( ) multipolygon . OSMID = osmid multipolygon . tags = tags for member in members : reference = member [ 'reference' ] type = member [ 'type' ] role = member [ 'role' ] if type == 'way' and role == 'outer' and reference in wayRefList : refToAdd = wayRefList [ reference ] # if the new ref to be added are not defined in the same direction than the one already added if not len ( multipolygon . ref ) == 0 and not multipolygon . ref [ - 1 ] == refToAdd [ 0 ] : refToAdd . reverse ( ) if not multipolygon . ref [ - 1 ] == refToAdd [ 0 ] : multipolygon . ref . reverse ( ) if not multipolygon . ref [ - 1 ] == refToAdd [ 0 ] : refToAdd . reverse ( ) if len ( multipolygon . ref ) == 0 : multipolygon . ref = multipolygon . ref + refToAdd else : for ref in refToAdd : # if this point is already in the list (but it is equal to previous one) => loop closed if ref in multipolygon . ref and not ref == multipolygon . ref [ - 1 ] : multipolygon . ref = multipolygon . ref + refToAdd # clean multipolygon for index in range ( len ( multipolygon . ref ) - 1 , 0 , - 1 ) : if multipolygon . ref [ index ] == multipolygon . ref [ index - 1 ] : del multipolygon . ref [ index ] OSMMultipolygon . multipolygonList . append ( multipolygon ) # add this multipolygon to the list break # if loop not close add this part of multipolygon and continue if len ( OSMMultipolygon . multipolygonList ) > 0 and not OSMMultipolygon . multipolygonList [ - 1 ] == multipolygon : multipolygon . ref = multipolygon . ref + refToAdd # otherwise this multipolygon is done else : break # this multipolygon is only partial (but we still want to add it to the list) if ( not len ( multipolygon . ref ) == 0 and not ( len ( OSMMultipolygon . multipolygonList ) > 0 and OSMMultipolygon . multipolygonList [ - 1 ] == multipolygon ) ) : OSMMultipolygon . multipolygonList . append ( multipolygon )