コード例 #1
0
def nesw(name, **i):
    """
    Make four nodes for n, e, w, s from a location.
    Keywords:
        images: ni, ei, wi, si.
        destinations: n, e, w, s.
    """

    name_ = name + ':'
    ret = []
    left = {'n': 'w', 'e': 'n', 's': 'e', 'w': 's'}
    right = {'n': 'e', 'e': 's', 's': 'w', 'w': 'n'}

    # repair missing positions.
    for d in "nesw":
        if not i.has_key(d + 'i'):
            oldleft = left[d]
            oldright = right[d]
            left[oldright] = oldleft
            right[oldleft] = oldright

    # create the nodes
    for d in "nesw":
        if i.has_key(d + 'i'):
            if i.has_key(d):
                node = lfr(name_ + d, i[d + 'i'], name_ + left[d], i[d],
                           name_ + right[d])
            else:
                node = lr(name_ + d, i[d + 'i'], name_ + left[d],
                          name_ + right[d])

            ret.append(node)

    return ret
コード例 #2
0
ファイル: NodeUtils.py プロジェクト: nedbat/natsworld
def nesw(name, **i):
    """
    Make four nodes for n, e, w, s from a location.
    Keywords:
        images: ni, ei, wi, si.
        destinations: n, e, w, s.
    """

    name_ = name + ':'
    ret = []
    left = {'n': 'w', 'e': 'n', 's': 'e', 'w': 's'}
    right = {'n': 'e', 'e': 's', 's': 'w', 'w': 'n'}
    
    # repair missing positions.
    for d in "nesw":
        if not i.has_key(d + 'i'):
            oldleft = left[d]
            oldright = right[d]
            left[oldright] = oldleft
            right[oldleft] = oldright
            
    # create the nodes                
    for d in "nesw":
        if i.has_key(d + 'i'):
            if i.has_key(d):
                node = lfr(
                        name_ + d,
                        i[d + 'i'],
                        name_ + left[d],
                        i[d],
                        name_ + right[d]
                        )
            else:
                node = lr(
                        name_ + d,
                        i[d + 'i'],
                        name_ + left[d],
                        name_ + right[d]
                        )
                
            ret.append(node)

    return ret
コード例 #3
0
ファイル: main.py プロジェクト: nedbat/natsworld
# Nodes for Nat's world

natsnodes = [
#    lfr('null', r'C:\img\vol1\20010408\dscf0038.jpg', 'hall:w', 'hall:w', 'hall:w'),

    # Inside the house: first floor

    nesw('hall',
        ni = jul12(28),     n = 'front43:n',
        ei = nov12(501),    e = 'livingroom:e',
        si = jul12(23),     s = 'playroom_right',
        wi = jul12(30),     w = 'diningroom_in',
    ),
    
    lr('playroom_right',    jul12(27),  'playroom_left',                        'hall:n'),
    lr('playroom_left',     jul12(25),  'hall:n',                               'playroom_right'),

    nesw('livingroom',
        ni = nov12(497),
        ei = nov12(494),
        si = nov12(495),    s = 'stereo_s',
        wi = nov12(496),    w = 'hall:w'
         ),

    lfr('stereo_s', nov12(498), 'stereo_e',     'menu_stereo',  'livingroom:n'),
    lfr('stereo_e', nov12(500), 'livingroom:n', 'porch:e',      'stereo_s'),
                            
    bf('porch:e',           jul12(37),   'porch:w',          'porch:e'),
    bf('porch:w',           jul12(41),   'porch:e',          'livingroom:n'),
コード例 #4
0
natsnodes = [
    #    lfr('null', r'C:\img\vol1\20010408\dscf0038.jpg', 'hall:w', 'hall:w', 'hall:w'),

    # Inside the house: first floor
    nesw(
        'hall',
        ni=jul12(28),
        n='front43:n',
        ei=nov12(501),
        e='livingroom:e',
        si=jul12(23),
        s='playroom_right',
        wi=jul12(30),
        w='diningroom_in',
    ),
    lr('playroom_right', jul12(27), 'playroom_left', 'hall:n'),
    lr('playroom_left', jul12(25), 'hall:n', 'playroom_right'),
    nesw('livingroom',
         ni=nov12(497),
         ei=nov12(494),
         si=nov12(495),
         s='stereo_s',
         wi=nov12(496),
         w='hall:w'),
    lfr('stereo_s', nov12(498), 'stereo_e', 'menu_stereo', 'livingroom:n'),
    lfr('stereo_e', nov12(500), 'livingroom:n', 'porch:e', 'stereo_s'),
    bf('porch:e', jul12(37), 'porch:w', 'porch:e'),
    bf('porch:w', jul12(41), 'porch:e', 'livingroom:n'),
    bf('diningroom_in', r'C:\img\vol1\20010405\dscf0015.jpg', 'diningroom_out',
       'diningroom_in'),
    bf('diningroom_out', r'C:\img\vol1\20010508a\dscf0016.jpg',