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

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