示例#1
0
 def get_all_rows(self):
     if self.is_teacher:
         raise Exception('Unsupported Operation')
     table = pd.read_csv(self.path, sep=',')
     table = table.to_dict(orient='records')
     for i in range(len(table)):
         row = table[i]
         table[i] = TableRow(row.get('path'),
                             Point(row.get('feature').split(' ')),
                             Point(row.get('cluster').split(' ')))
     return table
示例#2
0
 def get_feature(self, filename: str):
     table = pd.read_csv(self.path, sep=',')
     table = table[table.path == filename]
     table = table.to_dict(orient='records')
     if len(table) == 0:
         return None
     return Point(table[0].get('feature').split(' '))
示例#3
0
    def run(self):
        self.dir_watcher.start()
        old_name = None

        while True:
            changes = self.queue.get()

            for action, filename in changes:
                if filename is None or filename[-4:] != '.tif':
                    continue
                full_filename = os.path.join(self.target_path, filename)

                if action == 2 or os.path.getsize(full_filename) != 0:
                    if action == 1:
                        pass

                    elif action == 2:
                        row = TableRow(filename, None)
                        self.job_queue.put({
                            "teacher": self.is_teacher,
                            "action": action,
                            "row": row
                        })
                        pass

                    elif action == 3:
                        point = Point(self.content_grubber.get_info(full_filename))
                        row = TableRow(filename, point)
                        self.job_queue.put({
                            "teacher": self.is_teacher,
                            "action": action,
                            "row": row
                        })
                        pass

                    elif action == 4:
                        old_name = full_filename
                        pass

                    elif action == 5:
                        self.job_queue.put({
                            "teacher": self.is_teacher,
                            "action": action,
                            "old_name": old_name,
                            "new_name": full_filename,
                            "row": None
                        })
                        pass

                    else:
                        raise Exception("Unsupported Operation")
示例#4
0
from geometry.Point import Point
from geometry.Tesseract import Tesseract

tesseract = Tesseract(Point([0,0,0]))
current_neighbors = [Point([0,1,0]), Point([0,2,0])]
other_points = [Point([1,0,0]), Point([0, -1, 0]), Point([-1, 0, 0]), Point([0, 0, 1]), Point([0, 0, -1]), Point([0, 0, -2])]

for point in tesseract.get_new_neighbors(current_neighbors, other_points):
    print(point)
 def get(self, geometry_name):
     return {
         'Polygon': Polygon(),
         'MultiPolygon': MultiPolygon(),
         'Point': Point()
     }[geometry_name]