def newDecode(self, tree):
        room_class = []
        room_area = []
        room_sizes = []
        max_val = self.params['max_scale']
        min_val = self.params['min_scale']

        for branch in tree.branch:
            for ind in branch:
                ind.computePos(max_val, min_val)
                room_area.append(ind.getArea())
                room_class.extend([ind.w, ind.l])
                room_sizes.append(list(ind.getPos()))

        room_desc = ['R'] * len(room_area)
        revisedArea = room_area[:]
        revisedArea.sort()

        # call the room-classification routine
        room_desc, num_room = roomClassifier.f1(room_desc, room_sizes,
                                                revisedArea, room_class)

        # call the adjoining-room calculation routine 
        shared_walls = sharedWalls.f1(num_room, room_desc, room_sizes)

        return [num_room, room_area, shared_walls, room_desc, room_sizes]
def decodePlan(room_list):

    rooms, roomDesc, roomSizes = [],[],[]
    roomarea, roomlist = [],[]
    
    # call the room-classification routine
    rooms = roomClassifier.f1(room_list)
    roomNum = rooms[-1:]
    rooms = rooms[:-1]

    numRoom = 0

    for k in xrange(0,len(rooms)/2):
        roomDesc.append(rooms[2*k])
        roomSizes.append(rooms[2*k+1])

    for k in xrange(len(roomDesc)):
        if roomDesc[k] != 'S':
            numRoom = numRoom + 1

    # call the area calculation routine
    roomarea = roomArea.f1(roomDesc,roomSizes)
    # call the adjoining-room calculation routine 
    roomlist = sharedWalls.f1(roomNum,roomDesc,roomSizes)

    return [numRoom, roomarea, roomlist, roomDesc, roomSizes]
def decodePlan(roomDesc, roomSizes):

    # call the room-classification routine
    roomDesc, numRoom = roomClassifier.f1(roomDesc, roomSizes)

    # call the area calculation routine
    roomarea, roomClass = roomArea(roomDesc,roomSizes)
    # call the adjoining-room calculation routine 
    shared_walls = sharedWalls.f1(numRoom,roomDesc,roomSizes)

    return [numRoom, roomarea, shared_walls, roomDesc, roomSizes]
def decodePlan(roomDesc, roomSizes):

    # call the room-classification routine
    roomDesc, numRoom = roomClassifier.f1(roomDesc, roomSizes)

    ## count number of rooms, long way
    #numRoom = 0
    #for k in xrange(len(roomDesc)):
    #    if roomDesc[k] != 'S':
    #        numRoom = numRoom + 1
    ## count number of rooms
    #v = len(roomDesc) - roomDesc.count('S')

    # call the area calculation routine
    roomarea, roomClass = roomArea(roomDesc,roomSizes)
    # call the adjoining-room calculation routine 
    sharedwalls_roomlist = sharedWalls.f1(numRoom,roomDesc,roomSizes)

    return [numRoom, roomarea, sharedwalls_roomlist, roomDesc, roomSizes]