コード例 #1
0
    def create_jobs(self):
        if self.obj_stack:
            m11, m21, m12, m22, dx, dy = SK2_to_PLT_TRAFO

            if self.plt_doc.config.force_zero:
                bbox = []
                bbox += self.obj_stack[0].cache_bbox
                for obj in self.obj_stack:
                    bbox = libgeom.sum_bbox(bbox, obj.cache_bbox)

                dx = -bbox[0] * m11
                dy = -bbox[1] * m22

            trafo = [m11, m21, m12, m22, dx, dy]

            obj_num = len(self.obj_stack)
            for obj in self.obj_stack:

                self.counter += 1
                position = float(self.counter) / obj_num
                if position - self.position > 0.05:
                    msg = _('Saving in process...')
                    events.emit(events.FILTER_INFO, msg, position)
                    self.position = position

                paths = libgeom.get_flattened_path(
                    obj, trafo, self.plt_doc.config.tolerance)
                if paths is None: continue

                for path in paths:
                    if path and path[1]:
                        self.jobs.append(plt_model.PltJob('', path))
コード例 #2
0
ファイル: plt_translators.py プロジェクト: Scrik/sk1-wx
	def create_jobs(self):
		if self.obj_stack:
			m11, m21, m12, m22, dx, dy = SK2_to_PLT_TRAFO

			if self.plt_doc.config.force_zero:
				bbox = []
				bbox += self.obj_stack[0].cache_bbox
				for obj in self.obj_stack:
					bbox = libgeom.sum_bbox(bbox, obj.cache_bbox)

				dx = -bbox[0] * m11
				dy = -bbox[1] * m22

			trafo = [m11, m21, m12, m22, dx, dy]

			obj_num = len(self.obj_stack)
			for obj in self.obj_stack:

				self.counter += 1
				position = float(self.counter) / obj_num
				if position - self.position > 0.05:
					msg = _('Saving in process...')
					events.emit(events.FILTER_INFO, msg, position)
					self.position = position

				paths = libgeom.get_flattened_path(obj, trafo,
									self.plt_doc.config.tolerance)
				if paths is None: continue

				for path in paths:
					if path and path[1]:
						self.jobs.append(plt_model.PltJob('', path))
コード例 #3
0
    def create_jobs(self):
        if self.obj_stack:
            m11, m21, m12, m22, dx, dy = SK2_to_PLT_TRAFO

            if self.plt_doc.config.plt_force_zero:
                bbox = []
                bbox += self.obj_stack[0].cache_bbox
                for obj in self.obj_stack:
                    bbox = libgeom.sum_bbox(bbox, obj.cache_bbox)

                dx = -bbox[0] * m11
                dy = -bbox[1] * m22

            trafo = [
                m11 * self.plt_doc.config.plt_scale, m21, m12,
                m22 * self.plt_doc.config.plt_scale, dx, dy
            ]

            obj_num = len(self.obj_stack)
            for obj in self.obj_stack:

                self.counter += 1
                position = float(self.counter) / obj_num
                if position - self.position > 0.05:
                    msg = _('Saving in progress...')
                    events.emit(events.FILTER_INFO, msg, position)
                    self.position = position

                paths = libgeom.get_flattened_path(
                    obj, trafo, self.plt_doc.config.plt_tolerance)
                if paths is None:
                    continue
                for path in paths:
                    if self.plt_doc.config.plt_optimize:
                        rl = self.plt_doc.config.plt_rounding_level
                        path[0] = [round(x / rl) * rl for x in path[0]]
                        start0, start1 = [], path[0]
                        points = []
                        for point in path[1]:
                            point = [round(x / rl) * rl for x in point]
                            if not point == start1:
                                if point == start0:
                                    points = points[:-1]
                                    if len(points) > 1:
                                        start0, start1 = points[-1], start0
                                    elif points:
                                        start0, start1 = [], start0
                                    continue
                                start0, start1 = start1, point
                                points.append(point)
                        path[1] = points

                    if path and path[1]:
                        self.jobs.append(plt_model.PltJob('', path))