def add_measurement(self, coord_a, coord_b ): # This will record a measurement and draw the successful match left = [] right = [] if ( coord_a[0] < coord_b[0] ): left = coord_a right = coord_b else: left = coord_b right = coord_a self.__picked_objects.append(self.draw_circle(left,1,"green")) self.__picked_objects.append(self.draw_circle(right,1,"green")) right[0] = right[0] - self.obj_width self.measurement1.append(ip(array(left),5)) self.measurement2.append(ip(array(right),5))
def keyPressEvent(self, e): if e.key() == QtCore.Qt.Key_D: print "Deleting last measurement" self.measurements.pop() self.update() if e.key() == QtCore.Qt.Key_S: print "Saving measurement" cube_meas = [] wac_meas = [] for m in self.measurements: cube_meas.append( ip([m.first.x(),m.first.y()],5) ) wac_meas.append( ip([m.second.x(),m.second.y()],5) ) write_match_file("wac.match",cube_meas,wac_meas) os.system(os.path.realpath(__file__)[:-24]+"libexec/generate_wac_cnet " + self.cube ) os.system("rm wac.match")