def __init__(self, data, base=None, width=0, height=0): u"""""" assert type(data) in (list, tuple) assert base is None or os.path.isfile(base) assert type(width) in (int, long, float) assert type(height) in (int, long, float) assert width >= 0 and height >= 0 count = 0 data2 = [] for hit in data: if len(hit) == 3: x, y, n = hit elif len(hit) == 2: x, y, n = hit[0], hit[1], 1 else: raise Exception(u"length of hit is invalid!") data2.append((x, y, n)) count += n self.data = data2 self.count = count self.base = base self.width = width self.height = height if not self.base and (self.width == 0 or self.height == 0): w, h = cf.getMaxSize(data) self.width = self.width or w self.height = self.height or h
def __init__(self, data, base=None, width=0, height=0 ): u"""""" assert type(data) in (list, tuple) assert base is None or os.path.isfile(base) assert type(width) in (int, long, float) assert type(height) in (int, long, float) assert width >= 0 and height >= 0 data2 = [] for hit in data: if len(hit) == 3: x, y, n = hit elif len(hit) == 2: x, y, n = hit[0], hit[1], 1 else: raise Exception(u"length of hit is invalid!") data2.append((x, y, n)) self.data = data2 self.base = base self.width = width self.height = height if not self.base and (self.width == 0 or self.height == 0): w, h = cf.getMaxSize(data) self.width = self.width or w self.height = self.height or h
def __init__(self, data, base=None, width=0, height=0): assert type(data) in (list, tuple) assert base is None or os.path.isfile(base) assert type(width) in (int, long, float) assert type(height) in (int, long, float) assert width >= 0 and height >= 0 self.data = data self.base = base self.width = width self.height = height self.max_data = [] if not self.base and (self.width == 0 or self.height == 0): w, h = cf.getMaxSize(data) self.width = self.width or w self.height = self.height or h