advictoriam

Untitled

Nov 27th, 2018
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.16 KB | None | 0 0
  1. /**
  2.    A map label has a place name, longitude and latitude
  3. */
  4. public class MapLabels
  5. {  
  6.    private String placeName;
  7.    private double latitude;
  8.    private double longitude;
  9.  
  10.    /**
  11.       Constructs a map label with place name, logitude and latitude given in decimal degrees
  12.    */
  13.    public MapLabels (String name, double aLat, double aLong)
  14.    {  
  15.       placeName = name;
  16.       latitude = aLat;
  17.       longitude = aLong;
  18.    }
  19.    
  20.    /**
  21.       Constructs a map label with place name, logitude and latitude given in degrees, minutes, seconds
  22.    */
  23.    public MapLabels (String name, int degLat, int minLat, double secLat, int degLong, int minLong, double secLong)  
  24.    {  
  25.       placeName = name;
  26.       latitude = Math.signum(degLat) * (Math.abs(degLat) + minLat/60. + secLat/3600.);
  27.       longitude = Math.signum(degLong) * (Math.abs(degLong) + minLong/60. + secLong/3600.);;
  28.    }
  29.    
  30.    /**
  31.       Gets the string in XML form
  32.       @return the string
  33.    */
  34.    public String toString()
  35.    {  
  36.       String label = "<label name=\"" + placeName + "\" latitude=\"" + latitude + "\" longitude=\"" + longitude + "\"/>";
  37.  
  38.       return label;
  39.    }  
  40. }
Add Comment
Please, Sign In to add comment