def generate_all(cursor):
        values = []

        point_indexes = get_all_index(cursor, 'point')
        route_indexes = get_all_index(cursor, 'route')
        routes_added = sorted(route_indexes)[-ROUTE_LEN::]

        instance = PointOnRoute()

        for route in routes_added:
            route_length = random.randint(0.8 * POINT_ON_ROUTE, POINT_ON_ROUTE)
            instance.__order = 0
            instance.__id_route = route

            for _ in range(route_length):
                random_point = random.randint(0, len(point_indexes) - 1)
                instance.__id_point = point_indexes[random_point]

                sql_string = instance.generate_sql()
                values.append(sql_string)

                instance.__order += 1

        addToFile(cursor, "pointonroute", ["IdRoute", "IdPoint", "Order_"],
                  values)
Example #2
0
    def generate_all(cursor):
        data = open("drone.txt", 'r').read().split(',')
        data.pop()

        listOfList = []
        for _ in range(values.DRONE_LEN):
            listOfList.append([data[random.randrange(0, len(data))]])

        sql_file_utils.addToFile(cursor, "drone", ["Model"], listOfList)
Example #3
0
    def generate_all(cursor):
        values = []

        instance = Route()
        for _ in range(ROUTE_LEN):
            instance.generate_instance()
            sql_string = instance.generate_sql()
            values.append(sql_string)

        addToFile(cursor, "route", ["Description"], values)
Example #4
0
    def generate_all(cursor):
        values = []

        instance = Account()
        for i in range(ACCOUNT_LEN):
            instance.generate_instance()
            sql_string = instance.generate_sql()
            values.append(sql_string)

        addToFile(cursor, "account", ["Login", "Password"], values)
Example #5
0
    def generate_all(cursor):
        data = open("Role.txt", 'r').read().split(',')
        data.pop()

        listOfList = []

        for row in data:
            listOfList.append([row])

        ROLE_LEN = len(data)
        addToFile(cursor, "role", ["NameRole"], listOfList, ignore=True)
Example #6
0
    def generate_all(cursor):
        data = open("objecttype.txt", 'r').read().split(',')
        data.pop()
        listOfList = []

        for row in data:
            listOfList.append([row])

        values.OBJECTTYPE_LEN = len(data)
        sql_file_utils.addToFile(cursor,
                                 "objecttype", ["Name"],
                                 listOfList,
                                 ignore=True)
    def generate_all(cursor):
        values = []

        user_indexes = get_all_index(cursor, 'user')
        route_indexes = get_all_index(cursor, 'route')

        instance = FlightSchedule()
        for _ in range(FLIGHTSCHEDULE_LEN):
            instance.generate_instance(user_indexes, route_indexes)
            sql_string = instance.generate_sql()
            values.append(sql_string)

        addToFile(cursor, "flightschedule", [
            "IdUser", "IdRoute", "StartDate", "StartMinute", "Interval_"], values)
Example #8
0
    def generate_all(cursor):
        values = []

        drone_indexes = get_all_index(cursor, 'drone')
        flight_sched_indexes = get_all_index(cursor, 'flightschedule')

        instance = Flight()
        for i in range(FLIGHT_LEN):
            instance.generate_instance(drone_indexes, flight_sched_indexes)
            sql_string = instance.generate_sql()
            values.append(sql_string)

        addToFile(cursor, "flight",
                  ["IdDrone", "IdFlightSchedule", "StartDate"], values)
Example #9
0
    def generate_all(cursor):
        values = []
        user_indexes = get_all_index(cursor, 'user')
        flight_indexes = get_all_index(cursor, 'flightschedule')
        drone_indexes = get_all_index(cursor, 'drone')

        instance = Flaw()
        for i in range(FLAW_LEN):
            instance.generate_instance(user_indexes, flight_indexes,
                                       drone_indexes)
            sql_string = instance.generate_sql()
            values.append(sql_string)

        addToFile(cursor, "flaw",
                  ["IdUser", "IdFlight", "IdDrone", "Description"], values,
                  True)
Example #10
0
    def generate_all(cursor):
        values = []
        roles_indexes = get_all_index(cursor, 'role')
        account_indexes = get_all_index(cursor, 'account')

        accounts_added = sorted(account_indexes)[-ACCOUNT_LEN::]

        instance = User()
        for account in accounts_added:
            instance.__account = account

            instance.generate_instance(roles_indexes)
            sql_string = instance.generate_sql()
            values.append(sql_string)

        addToFile(cursor, "user", ["IdAccount", "IdRole"], values)
Example #11
0
    def generate_all(cursor):
        lista = []
        for i in range(values.POINT_LEN):
            point_type_indexes = get_all_index(cursor, 'pointtype')
            random_point_type = random.randint(0, len(point_type_indexes) - 1)

            idPoint = point_type_indexes[random_point_type]

            longitude = round(random.uniform(
                values.Wroclaw_Longitude-1, values.Wroclaw_Longitude+1), 5)

            latitude = round(random.uniform(
                values.Wroclaw_Latitude-1, values.Wroclaw_Latitude+1), 5)

            lista.append([idPoint, longitude, latitude])

        sql_file_utils.addToFile(cursor,
                                 "point", ["IdPointType", "Longitude", "Latitude"], lista)
Example #12
0
    def generate_all(cursor):
        lista = []

        flight_indexes = get_all_index(cursor, 'flight')
        flight_added = sorted(flight_indexes)[-FLIGHT_LEN::]

        for id_flight in flight_added:
            count_obj = random.randint(0.8 * OBJECT_LEN, OBJECT_LEN)
            for i in range(count_obj):
                link = "/" + str(id_flight).zfill(6) + \
                    "_" + str(i + 1).zfill(5) + ".png"

                obj_type_indexes = get_all_index(cursor, 'objecttype')
                random_obj_type = random.randint(0, len(obj_type_indexes) - 1)
                id_obj = obj_type_indexes[random_obj_type]

                lista.append([id_flight, id_obj, link])

        sql_file_utils.addToFile(cursor, "object",
                                 ["IdFlight", "IdObjectType", "PathToPhoto"],
                                 lista)
Example #13
0
    def generate_all(cursor):
        values_logs = []

        flight_indexes = get_all_index(cursor, 'flight')
        flight_added = sorted(flight_indexes)[-FLIGHT_LEN::]

        for id_flight in flight_added:
            seconds = 0
            logslen = random.randint(LOG_LEN * 0.80, LOG_LEN)
            for log in range(logslen):
                seconds += random.randint(5, 15)
                longitude = getRandDouble(Wroclaw_Longitude)
                latitude = getRandDouble(Wroclaw_Latitude)
                altitude = round(random.random() * 40, 2)

                values_logs.append(
                    [id_flight, seconds, longitude, latitude, altitude])

        addToFile(cursor, "log", [
            "IdFlight", "SecondsSinceStart", "Longitude", "Latitude",
            "Altitude"
        ], values_logs)