def _adjust_endpoint(arc, pt, objdict, cx, cy, ra): _layer = arc.getParent() if pt.getParent() is not _layer: raise RuntimeError, "Arc/Endpoint parent object conflict!" _pid = id(pt) _users = [] for _user in pt.getUsers(): _users.append(_user) _np = None _x, _y = _calc_coords(pt, cx, cy, ra) if len(_users) == 1 and _users[0] is arc: if _can_move(pt, objdict) and objdict.get(_pid) is not False: pt.setCoords(_x, _y) else: _pts = _layer.find('point', _x, _y) if len(_pts) == 0: _np = Point(_x, _y) _layer.addObject(_np) else: _np = _most_used(_pts) else: pt.freeUser(arc) _pts = _layer.find('point', _x, _y) if len(_pts) == 0: _np = Point(_x, _y) _layer.addObject(_np) else: _np = _most_used(_pts) if _np is not None: _np.storeUser(arc) if _adjust_dimensions(pt, _np): _layer.delObject(pt) if objdict.get(_pid) is not False: objdict[_pid] = False
def _adjust_endpoint(arc, pt, objdict, cx, cy, ra): _layer = arc.getParent() if pt.getParent() is not _layer: raise RuntimeError("Arc/Endpoint parent object conflict!") _pid = id(pt) _users = [] for _user in pt.getUsers(): _users.append(_user) _np = None _x, _y = _calc_coords(pt, cx, cy, ra) if len(_users) == 1 and _users[0] is arc: if _can_move(pt, objdict) and objdict.get(_pid) is not False: pt.setCoords(_x, _y) else: _pts = _layer.find('point', _x, _y) if len(_pts) == 0: _np = Point(_x, _y) _layer.addObject(_np) else: _np = _most_used(_pts) else: pt.freeUser(arc) _pts = _layer.find('point', _x, _y) if len(_pts) == 0: _np = Point(_x, _y) _layer.addObject(_np) else: _np = _most_used(_pts) if _np is not None: _np.storeUser(arc) if _adjust_dimensions(pt, _np): _layer.delObject(pt) if objdict.get(_pid) is not False: objdict[_pid] = False