OpendTect-6_4  6.4
latlong.h
Go to the documentation of this file.
1 #ifndef latlong_h
2 #define latlong_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Bert
9  Date: 2008
10  Contents: Geographics lat/long <-> Coord transform (an estimate)
11  RCS: $Id$
12 ________________________________________________________________________
13 
14 -*/
15 
16 #include "basicmod.h"
17 #include "coord.h"
18 
19 namespace Coords { class CoordSystem; }
20 
21 
28 {
29 public:
30  LatLong( double la=0, double lo=0 )
31  : lat_(la), lng_(lo) {}
32  LatLong( const LatLong& ll )
33  : lat_(ll.lat_), lng_(ll.lng_) {}
34 
35  bool operator ==(const LatLong&) const;
36 
37  LatLong( const Coord& c ) { *this = transform(c); }
38  operator Coord() const { return transform(*this); }
39  //Using SI()
40 
41  bool isDefined() const {return !mIsUdf(lat_)&&!mIsUdf(lng_);}
42  static LatLong udf() { return LatLong(mUdf(double),mUdf(double)); }
43 
44  static Coord transform(const LatLong&,bool towgs84=false,
45  const Coords::CoordSystem* si=0);
46  static LatLong transform(const Coord&,bool towgs84=false,
47  const Coords::CoordSystem* si=0);
48 
49  const char* toString() const;
50  bool fromString(const char*);
51 
52  void getDMS(bool lat,int&,int&,float&) const;
53  void setDMS(bool lat,int,int,float);
54 
55  bool setFromString(const char*,bool lat);
56 
57  double lat_;
58  double lng_;
59 };
60 
61 
69 {
70 public:
71 
72  LatLong2Coord();
73  LatLong2Coord(const Coord&,const LatLong&);
74  bool isOK() const { return !mIsUdf(lngdist_); }
75 
76  void set(const LatLong&,const Coord&);
77 
78  LatLong transform(const Coord&) const;
79  Coord transform(const LatLong&) const;
80 
81  const char* toString() const;
82  bool fromString(const char*);
83 
84  Coord refCoord() const { return refcoord_; }
85  LatLong refLatLong() const { return reflatlng_; }
86 
87 protected:
88 
90  LatLong reflatlng_;
91 
92  double latdist_;
93  double lngdist_;
94  double scalefac_;
95 };
96 
97 
98 #endif
#define mExpClass(module)
Definition: commondefs.h:160
#define mIsUdf(val)
Use mIsUdf to check for undefinedness of simple types.
Definition: undefval.h:287
LatLong refLatLong() const
Definition: latlong.h:85
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:53
bool isDefined() const
Definition: latlong.h:41
double lng_
Definition: latlong.h:58
double latdist_
Definition: latlong.h:92
A cartesian coordinate in 2D space.
Definition: coord.h:25
Geographical coordinates in Decimal Degrees but with conv to deg, min, sec.
Definition: latlong.h:27
Definition: coordsystem.h:31
Coord refCoord() const
Definition: latlong.h:84
Definition: coordsystem.h:22
bool isOK() const
Definition: latlong.h:74
double scalefac_
Definition: latlong.h:94
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:272
static LatLong udf()
Definition: latlong.h:42
LatLong(const Coord &c)
Definition: latlong.h:37
double lat_
Definition: latlong.h:57
Coord refcoord_
Definition: latlong.h:89
LatLong(double la=0, double lo=0)
Definition: latlong.h:30
LatLong(const LatLong &ll)
Definition: latlong.h:32
double lngdist_
Definition: latlong.h:93
LatLong reflatlng_
Definition: latlong.h:90
Export_Basic const char * toString(ViewStyle)
Estimates to/from LatLong coordinates.
Definition: latlong.h:68

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019