Package views

Examples of views.Star


  private EquatorialCoordinates c;
 
  @Override
  public void read(BufferedReader reader, StarStorage stars) throws IOException {
    String line;
    Star s;
    while ((line = reader.readLine()) != null) {
      s = readLine(line);
      if (s != null)
        stars.add(s);
    }
View Full Code Here


 
  public Star readLine(String line) {
    if (line.charAt(0) != '#') {
      subline = line.split(",");
      c = new EquatorialCoordinates(Double.parseDouble(subline[1]), Double.parseDouble(subline[2]));
      return new Star(subline[0], c, Double.parseDouble(subline[3]), subline[4]);
    }
    return null;
  }
View Full Code Here

 
  @Override
  public void read(BufferedReader reader, StarStorage stars) throws IOException {
    String line;
    Star s;
    while ((line = reader.readLine()) != null) {
      s = readLine(line);
      if (s != null)
        stars.add(s);
    }
View Full Code Here

      if (!datalineMatch.matches())
        return null;
      try {
        c = new EquatorialCoordinates(Coordinates.HoursMinutesSecondsToRadians(pipeTakeFirst(datalineMatch.group(3))),
                        Coordinates.DegreesMinutesSecondsToRadians(pipeTakeFirst(datalineMatch.group(4))));
        return new Star(datalineMatch.group(1),
                c,
                Double.parseDouble(datalineMatch.group(5)),
                spectralType(datalineMatch.group(2)));
      } catch (NumberFormatException e) {
        Messages.addError("Error while reading database : line "+line+" is malformed.");
View Full Code Here

   * @param b
   * @return
   */
  @Override
  public double get(Astre a, Astre b) {
    Star s1 = (Star) a;
    Star s2 = (Star) b;
    return Math.abs(s1.getMagnitude() - s2.getMagnitude());
  }
View Full Code Here

    if (!sm.mapBounds.contains(mousePosition))
      return;
    if (mousePosition == null)
      return;
   
    Star nearestStar = Helper.getNearestStarFromPosition(mousePosition);
   
    // may be null when no stars are loaded or visible
    if (nearestStar != null) {
      // get point and text
      Point ttPos = nearestStar.getPoint();
      String line1 = nearestStar.getName();
      String line2 = nearestStar.getCoodinates().toString();
      String line3 = "Magnitude : " + nearestStar.getMagnitude();
      String line4 = "Type spectral : " + nearestStar.getSpectralType();
 
      sm.drawToolTip(ttPos,
              PanelsFactory.createToolTip("<html>" + line1 + "<br/>" + line2 + "<br/>" + line3 + "<br/>" + line4 + "<br/></html>",
                            nearestStar.getColor().brighter().brighter()));
    }
  }
View Full Code Here

  protected static Star getNearestStarFromPosition(Point position) {
  // Algorithme ultra naif
      StarStorage st = Stars.getStars();
      double dist;
      double min = Double.MAX_VALUE;
      Star nearestStar = null;

      for (Star currentStar : st)
        if (currentStar.getPoint() != null) { // l'étoile est visible
          dist = position.distance(currentStar.getPoint());
          if(min > dist){
View Full Code Here

TOP

Related Classes of views.Star

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.