def bounds(points, wrap=True, LatLon=None): '''DEPRECATED, use function L{boundsOf}. @return: 2-Tuple C{(latlonSW, latlonNE)} as B{C{LatLon}} or 4-Tuple C{(latS, lonW, latN, lonE)} if B{C{LatLon}} is C{None}. ''' from pygeodesy.points import boundsOf return tuple(boundsOf(points, wrap=wrap, LatLon=LatLon))
def __init__(self, corners, name): n, cs = 0, corners try: # check the clip box/region n, cs = len2(cs) if n == 2: # make a box b, l, t, r = boundsOf(cs, wrap=False) cs = LL_(b, l), LL_(t, l), LL_(t, r), LL_(b, r) n, cs = points2(cs, closed=True) self._cs = cs = cs[:n] self._nc = n self._cw = 1 if isclockwise(cs, adjust=False, wrap=False) else -1 if self._cw != isconvex_(cs, adjust=False, wrap=False): raise ClipError except (ClipError, PointsError, TypeError, ValueError): raise ClipError(n, cs, name) self._name = name
def __init__(self, corners): n = '' try: n, cs = len2(corners) if n == 2: # make a box b, l, t, r = boundsOf(cs, wrap=False) cs = LL_(b, l), LL_(t, l), LL_(t, r), LL_(b, r) n, cs = points2(cs, closed=True) self._corners = cs = cs[:n] self._nc = n self._cw = 1 if isclockwise(cs, adjust=False, wrap=False) else -1 if self._cw != isconvex_(cs, adjust=False, wrap=False): raise ValueError except ValueError: raise ValueError('%s[%s] invalid: %r' % ('corners', n, corners)) self._clipped = self._points = []
def __init__(self, corners, name=__name__): n, cs = 0, corners try: # check the clip box/region n, cs = len2(cs) if n == 2: # make a box b, l, t, r = boundsOf(cs, wrap=False) cs = LL_(b, l), LL_(t, l), LL_(t, r), LL_(b, r) n, cs = points2(cs, closed=True) self._cs = cs = cs[:n] self._nc = n self._cw = isconvex_(cs, adjust=False, wrap=False) if not self._cw: raise ValueError(_not_convex_) if areaOf(cs, adjust=True, radius=1, wrap=True) < EPS: raise ValueError('near-zero area') except (PointsError, TypeError, ValueError) as x: raise ClipError(name, n, cs, txt=str(x)) self.name = name