示例#1
0
文件: layout.py 项目: twmht/pyVoronoi
    def step_by_step(self):
        self.parent.step_button.setEnabled(True)
        if not self.isstep_by_step == True:
            self.isstep_by_step = True
            self.prepare()
            final = self.Voronoi((0,len(self.points)-1))
            #for run after step
            self.lines = final.lines
            self.vertex = final.convex.vertex
            Line.intersect_with_edge(final.lines,Canvas.edge_painter)
            #final_vd = VD(copy.deepcopy(final.lines),copy.deepcopy(final.range_points),self)
            final_vd = savevd(final.lines,final.range_points,self,final.convex)
            final_vd.pos = 'final'
            final_vd.color = QtCore.Qt.black
            self.vd[0].append(final_vd)

        self.repaint()
        if self.vd[1] == len(self.vd[0])-1:
            self.drawDisplay.display_output()
        self.vd[1] = self.vd[1]+1
        if self.vd[1]  >= len(self.vd[0]):
            self.parent.step_button.setEnabled(False)
            self.vd = [[],0]
            self.hp = [[],0]
            self.isstep_by_step = False
示例#2
0
    def step_by_step(self):
        self.parent.step_button.setEnabled(True)
        if not self.isstep_by_step == True:
            self.isstep_by_step = True
            self.prepare()
            final = self.Voronoi((0,len(self.points)-1))
            #for run after step
            self.lines = final.lines
            self.vertex = final.convex.vertex
            Line.intersect_with_edge(final.lines,Canvas.edge_painter)
            #final_vd = VD(copy.deepcopy(final.lines),copy.deepcopy(final.range_points),self)
            final_vd = savevd(final.lines,final.range_points,self,final.convex)
            final_vd.pos = 'final'
            final_vd.color = QtCore.Qt.black
            self.vd[0].append(final_vd)

        self.repaint()
        if self.vd[1] == len(self.vd[0])-1:
            self.drawDisplay.display_output()
        self.vd[1] = self.vd[1]+1
        if self.vd[1]  >= len(self.vd[0]):
            self.parent.step_button.setEnabled(False)
            self.vd = [[],0]
            self.hp = [[],0]
            self.isstep_by_step = False
示例#3
0
文件: layout.py 项目: twmht/pyVoronoi
    def Run(self):
        if self.isstep_by_step == False:
            self.prepare()
            ans = self.Voronoi((0,len(self.points)-1))
            Line.intersect_with_edge(ans.lines,Canvas.edge_painter)
            self.lines = ans.lines
            self.vertex = ans.convex.vertex
            self.drawDisplay.display_output()
            self.update()
        else:
            #current state is step_by_step, switch to run all vd
            while True:
                self.parent.step_button.setEnabled(False)
                self.repaint()
                if self.vd[1] == len(self.vd[0])-1:
                    self.drawDisplay.display_output()
                time.sleep(1)
                self.vd[1] = self.vd[1]+1
                if self.vd[1]  >= len(self.vd[0]):
                    break

            self.vd = [[],0]
            self.hp = [[],0]
            self.isstep_by_step = False
示例#4
0
    def Run(self):
        if self.isstep_by_step == False:
            self.prepare()
            ans = self.Voronoi((0,len(self.points)-1))
            Line.intersect_with_edge(ans.lines,Canvas.edge_painter)
            self.lines = ans.lines
            self.vertex = ans.convex.vertex
            self.drawDisplay.display_output()
            self.update()
        else:
            #current state is step_by_step, switch to run all vd
            while True:
                self.parent.step_button.setEnabled(False)
                self.repaint()
                if self.vd[1] == len(self.vd[0])-1:
                    self.drawDisplay.display_output()
                time.sleep(1)
                self.vd[1] = self.vd[1]+1
                if self.vd[1]  >= len(self.vd[0]):
                    break

            self.vd = [[],0]
            self.hp = [[],0]
            self.isstep_by_step = False