Ejemplo n.º 1
0
  public static void main(String[] args) {
    // Getting input
    Scanner scanMan = new Scanner(System.in);
    System.out.println("0 for inductive, 1 for divide and conquer");
    int type = scanMan.nextInt();
    System.out.println("What data set? (1-3 plz)");
    int set = scanMan.nextInt();

    // dataSets is the object that retrives data from the sky.dat files
    DataSets info = new DataSets();
    LinkedList<City> cloudySky = info.set(set);

    Skyline sky = new Skyline(cloudySky); // creating

    if (type == 0) sky.mergeInductive();
    else sky.mergeRecursive();

    // System.out.print(sky.toGraph());
    System.out.print(sky.toString());
  }
Ejemplo n.º 2
0
  /**
   * Get base data from database and create a dataset for analysis
   *
   * @param lat
   * @param lon
   * @throws SQLException
   */
  public void buildDataSet(int size) throws SQLException {
    DbConnection dbConn = new DbConnection();

    int latLonStep = (int) (360 / (MOON_CIRC / size));
    Double currentLat = LAT_MIN;
    Double currentLon = LON_MIN;
    String db = DataSets.getDb(size);
    ArrayList<ArrayList<DataTile>> dataTiles;
    Connection conn = dbConn.getConnection();

    updateSetConfig(conn, db, latLonStep, latLonStep);

    currentLat = LAT_MIN;
    currentLon = LON_MIN;
    while (currentLat < LAT_MAX) {
      Double startLat;
      Double endLat;
      startLat = currentLat;
      endLat = currentLat + latLonStep;
      while (currentLon < LON_MAX) {
        dataTiles = new ArrayList<ArrayList<DataTile>>();

        Double startLon;
        Double endLon;
        startLon = currentLon;
        endLon = currentLon + latLonStep;

        // Get the data

        dataTiles = getData(startLat, endLat, startLon, endLon, conn);

        DataTile tile = processTile(dataTiles, 1896, currentLat, currentLon);
        if (tile != null) {
          addTileSet(conn, db, tile);
        }
        dataTiles = null;
        currentLon += latLonStep;
      }
      currentLat += latLonStep;
    }
    dbConn.closeConnection(conn);
  }