from scan import *


class Tile:
    def __init__(self, side_length=100, top_left=(0, 0), roi=(0, 0, 100, 100), img_names=None):
        self.side_length = side_length
        self.top_left = top_left
        self.roi = roi
        self.img_names = img_names

    def draw(self):
        if self.img_names is None:
            raise EmptyTileError
        pass

    def load_image(self, img_name, directory):
        pass

    def move(self):
        if self.is_out_of_roi():
            raise OutOfBoundsError

    def is_out_of_roi(self):
        pass

    def has_overlap(self, vertices):
        pass

    def check_intersections(self, data):
        pass


class EmptyTileError(Exception):
    pass


class OutOfBoundsError(Exception):
    pass


if __name__ == '__main__':
    with open('10pct_stitch_data.json', 'r') as fp:
        all_comp = json.load(fp)
    print(get_roi(all_comp))
    scaled_all = scale_data(all_comp, 10)
    for dat in all_comp:
        print(dat)
