Beispiel #1
0
    def __init__(self, directory, *args, **kwargs):
        self.directory = directory
        self.figures = []

        if 'json_dict' in kwargs:
            self.file_name = kwargs['json_dict']['file_name']

            if 'draw_scale' in kwargs['json_dict']:
                self.draw_scale = kwargs['json_dict']['draw_scale']
            else:
                self.draw_scale = 1.0

            if 'draw_offset' in kwargs['json_dict']:
                self.draw_offset = dict2qpoint(kwargs['json_dict']['draw_offset'])
            else:
                self.draw_offset = QPoint()

            self.figures = [Rectangle(figure=figure_dict['rect']) if figure_dict.keys()[0] == 'rect' else
                            Circle(figure=figure_dict['circle']) if figure_dict.keys()[0] == 'circle' else
                            Polygon(figure=figure_dict['polygon']) for figure_dict in kwargs['json_dict']['figures']]
        else:
            self.draw_scale = 1.0
            self.draw_offset = QPoint()
            self.file_name = kwargs['file_name']

        self.image = None
Beispiel #2
0
    def __init__(self, *args, **kwargs):

        self.add_point = AddPoint()
        self.control = Control()

        Figure.__init__(self, self.add_point)

        self.decomposer = BayazitDecomposer()

        self.polygon = []
        self.convex_polygons = []

        if 'figure' in kwargs:
            self.polygon = [dict2qpoint(p) for p in kwargs['figure']['editor']]
            self.decompose()
            self.state = self.control

        if len(args) > 0:
            self.polygon = args