@staticmethod
def extent_placement(place, x, y, x_off, y_off, w, h, dcw=0, dch=0):
    """Perform map- and view-relative placement for an extent object.

        place         placement key string
        x, y          point relative to placement origin
        x_off, y_off  offset from point
        w, h          width, height of the image
        dcw, dcw      width/height of the view draw context

        Returns a tuple (x, y).
        """
    w2 = w / 2
    h2 = h / 2
    dcw2 = dcw / 2
    dch2 = dch / 2
    if place == 'cc':
        x += dcw2 - w2
        y += dch2 - h2
    elif place == 'nw':
        x += x_off
        y += y_off
    elif place == 'cn':
        x += dcw2 - w2
        y += y_off
    elif place == 'ne':
        x += dcw - w - x_off
        y += y_off
    elif place == 'ce':
        x += dcw - w - x_off
        y += dch2 - h2
    elif place == 'se':
        x += dcw - w - x_off
        y += dch - h - y_off
    elif place == 'cs':
        x += dcw2 - w2
        y += dch - h - y_off
    elif place == 'sw':
        x += x_off
        y += dch - h - y_off
    elif place == 'cw':
        x += x_off
        y += dch2 - h2
    return x, y
