/** * Search all the stars that could be in the hemisphere * * @param _date It's the date that will be use to search the stars * @param _dLat It's the latitude of the star's pointer * @param _dLon It's the longitude of the star's pointer * @throws SQLException * @return Return an arraylist that contains all the stars could be possible to see */ public ArrayList<CelestialObject> starsForCoordinates(Calendar _date, double _dLat, double _dLon) throws SQLException { ArrayList<CelestialObject> al_stars = new ArrayList<CelestialObject>(); int l_Bayer = 0; int l_id; int l_HIP; int l_HD; int l_HR; String l_ProperName; double l_dRA; double l_Dec; double l_dDistance; double l_dMag; double l_dColorIndex; try { if (!isDouble(Double.toString(_dLon)) || !isDouble(Double.toString(_dLat))) throw new IllegalArgumentException( "Error : Illegal latitude/longitude. Please check the coordinates !"); } catch (IllegalArgumentException e) { log.warning(e.getMessage()); _dLat = _dLon = 0; } Mathematics l_calc = new Mathematics(_date, _dLat, _dLon); for (CelestialObject star : this.allStars) { l_id = star.getId(); l_HIP = star.getHIP(); l_HD = star.getHD(); l_HR = star.getHR(); l_ProperName = star.getProperName(); l_dRA = star.getRA(); l_Dec = star.getDec(); l_dDistance = star.getDistance(); l_dMag = star.getMag(); l_dColorIndex = star.getColorIndex(); CelestialObject l_star = new CelestialObject( l_id, l_HIP, l_HD, l_HR, l_ProperName, l_dRA, l_Dec, l_dDistance, l_dMag, l_dColorIndex, l_Bayer); if (l_id == 1) // Sun { l_calc.calculatePositionSun(); l_star.setDec(l_calc.getDeclination()); l_star.setRA(l_calc.getAscension()); } else if (l_id == 2) // Moon { l_calc.calculatePositionMoon(); l_star.setDec(l_calc.getDeclination()); l_star.setRA(l_calc.getAscension()); double l_now = l_calc.getMoonBrightness(false); double l_yes = l_calc.getMoonBrightness(true); if (l_yes > l_now) l_now *= -1; l_star.setMag(l_now); } else l_calc.calculateAll(l_star.getDec(), l_star.getRA()); if (l_calc.getHeight() >= 0) { l_star.setXReal(l_calc.getX()); l_star.setYReal(l_calc.getY()); l_star.SetAzimuth(l_calc.getAzimuth()); l_star.SetHeight(l_calc.getHeight()); al_stars.add(l_star); } l_star = null; } return al_stars; }