暫無描述

gispoi.h 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef GISPOI_H
  2. #define GISPOI_H
  3. #include <QString>
  4. #include <iostream>
  5. #include <QDebug>
  6. #include <cmath>
  7. #include "doublepoint.h"
  8. using namespace std;
  9. const double EARTH_RADIUS = 6372.8;
  10. const double TWOPI = 2 * acos(-1);
  11. inline double deg2rad(double deg) {
  12. return deg/360.0 * TWOPI;
  13. }
  14. class GISPOI
  15. {
  16. private:
  17. QString name;
  18. double lat, lon;
  19. public:
  20. GISPOI();
  21. GISPOI(QString s, double latitude, double longitude)
  22. {name = s; lat = latitude; lon = longitude;}
  23. double getLat() const {return lat;}
  24. double getLon() const {return lon;}
  25. QString getName() const {return name;}
  26. void setAll(QString s, double latitude, double longitude)
  27. {name = s; lat = latitude; lon = longitude;}
  28. void setAll(string s, double latitude, double longitude)
  29. {name = QString::fromStdString(s); lat = latitude; lon = longitude;}
  30. void print() {
  31. qDebug() << name << " " << lat << " "
  32. << lon << endl;
  33. }
  34. double odDistance(const GISPOI &B) const;
  35. // Function odDistance(A,B)
  36. // Given two objects A and B of type GISPOI, uses their longitudes and
  37. // latitudes to compute and return their orthodromic distance in kilometers.
  38. };
  39. #endif // GISPOI_H