OpendTect-6_4  6.4
coordsystem.h
Go to the documentation of this file.
1 #ifndef coordsystem_h
2 #define coordsystem_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: K. Tingdahl
9  Date: August 2016
10 ________________________________________________________________________
11 
12 -*/
13 
14 #include "factory.h"
15 
16 #include "bufstring.h"
17 #include "callback.h"
18 #include "coord.h"
19 #include "latlong.h"
20 #include "refcount.h"
21 
22 namespace Coords
23 {
24 
33 public:
34 
35  bool operator==(const CoordSystem&) const;
36 
37  static void initRepository(NotifierAccess* = 0);
43 
44  static void getSystemNames(bool onlyorthogonal,
45  bool onlyprojection,
46  uiStringSet&,
52  static RefMan<CoordSystem> createSystem(const IOPar&);
54  virtual CoordSystem* clone() const = 0;
55 
56  virtual uiString description() const = 0;
57  virtual BufferString summary() const = 0;
58 
59  virtual bool isOK() const = 0;
60 
61  virtual bool geographicTransformOK() const = 0;
62 
63  static Coord convert(const Coord&,const CoordSystem& from,
64  const CoordSystem& to);
65  Coord convertFrom(const Coord&,
66  const CoordSystem& from) const;
67 
68  virtual uiString toUiString(const Coord&) const;
69  virtual BufferString toString(const Coord&,
70  bool withsystem=false) const;
74  virtual Coord fromString(const char*) const;
75 
76  virtual bool isOrthogonal() const = 0;
77  virtual bool isProjection() const { return false; }
78  virtual bool isFeet() const { return false; }
79  virtual bool isMeter() const { return false; }
80 
81  bool usePar(const IOPar&);
82  void fillPar(IOPar&) const;
83 
84  static const char* sKeyFactoryName();
85  static const char* sKeyUiName();
86 
87 protected:
88 
89  virtual LatLong toGeographic(const Coord&,
90  bool wgs84) const = 0;
91  virtual Coord fromGeographic(const LatLong&,
92  bool wgs84) const = 0;
93  virtual void doFillPar(IOPar&) const = 0;
94  virtual bool doUsePar(const IOPar&) = 0;
95 
96 private:
97 
98  friend class ::LatLong;
99 };
100 
101 
104 public:
105  mDefaultFactoryInstantiation( CoordSystem,UnlocatedXY,"Unlocated XY",
106  tr("Unlocated XY") );
107 
108  UnlocatedXY();
109 
110  virtual CoordSystem* clone() const;
111  virtual uiString description() const { return
112  tr("Coordinate system in an undefined projection.");}
113  virtual BufferString summary() const
114  { return sFactoryKeyword(); }
115 
116  void setIsFeet( bool isfeet ) { isfeet_ = isfeet; }
117  bool geographicTransformOK() const { return false; }
118 
119  virtual bool isOK() const { return true; }
120  virtual bool isOrthogonal() const { return true; }
121  virtual bool isFeet() const { return isfeet_; }
122  virtual bool isMeter() const { return !isfeet_; }
123 
124 private:
125 
126  virtual LatLong toGeographic(const Coord&,bool wgs84) const;
127  virtual Coord fromGeographic(const LatLong&,bool wgs84) const;
128  virtual bool doUsePar(const IOPar&);
129  virtual void doFillPar(IOPar&) const;
130 
131  bool isfeet_;
132 };
133 
134 
137 public:
138  mDefaultFactoryInstantiation( CoordSystem,AnchorBasedXY,"AnchorBased XY",
139  tr("Anchor Point Based XY") );
140 
141  AnchorBasedXY();
142  AnchorBasedXY(const LatLong&,const Coord&);
143  virtual CoordSystem* clone() const;
144  virtual uiString description() const { return
145  tr("Coordinate system has an anchor point "
146  "for which Latitude/Longitude is known");}
147  virtual BufferString summary() const;
148 
149  void setIsFeet( bool isfeet ) { isfeet_ = isfeet; }
150  bool geographicTransformOK() const;
151  void setLatLongEstimate(const LatLong&,const Coord&);
152 
153  virtual bool isOK() const { return true; }
154  virtual bool isOrthogonal() const { return true; }
155  virtual bool isFeet() const { return isfeet_; }
156  virtual bool isMeter() const { return !isfeet_; }
157 
158  const Coord& refCoord() const { return refcoord_; }
159  const LatLong& refLatLong() const { return reflatlng_; }
160 
161 private:
162 
163  virtual LatLong toGeographic(const Coord&,bool wgs84) const;
165  virtual Coord fromGeographic(const LatLong&,bool wgs84) const;
166 
167  bool isfeet_;
170 
171  double lngdist_;
172 
173  virtual bool doUsePar(const IOPar&);
174  virtual void doFillPar(IOPar&) const;
175 
176 };
177 
178 } // namespace Coords
179 
180 #endif
virtual bool isFeet() const
Definition: coordsystem.h:78
#define mRefCountImpl(ClassName)
Macro to setup a class with destructor for reference counting.
Definition: refcount.h:163
#define mExpClass(module)
Definition: commondefs.h:160
bool isfeet_
Definition: coordsystem.h:131
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
T to(const F &fr)
Definition: convert.h:33
LatLong reflatlng_
Definition: coordsystem.h:169
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:53
virtual bool isProjection() const
Definition: coordsystem.h:77
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
Export_Basic uiString toUiString(ViewStyle)
Interface class for Notifier. See comments there.
Definition: callback.h:161
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:188
const Coord & refCoord() const
Definition: coordsystem.h:158
void setIsFeet(bool isfeet)
Definition: coordsystem.h:116
#define mDefaultFactoryInstantiation(baseclss, clss, keywrd, usernm)
Definition: factory.h:289
Definition: uistring.h:89
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
double lngdist_
Definition: coordsystem.h:171
Definition: coordsystem.h:31
virtual uiString description() const
Definition: coordsystem.h:144
virtual bool isOK() const
Definition: coordsystem.h:119
Coord refcoord_
Definition: coordsystem.h:168
bool geographicTransformOK() const
Definition: coordsystem.h:117
virtual bool isOK() const
Definition: coordsystem.h:153
virtual bool isOrthogonal() const
Definition: coordsystem.h:120
Definition: coordsystem.h:22
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
virtual BufferString summary() const
Definition: coordsystem.h:113
virtual bool isOrthogonal() const
Definition: coordsystem.h:154
virtual bool isMeter() const
Definition: coordsystem.h:156
#define mDefineFactoryInClass(T, funcname)
Definition: factory.h:426
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:175
const LatLong & refLatLong() const
Definition: coordsystem.h:159
virtual bool isFeet() const
Definition: coordsystem.h:121
virtual bool isMeter() const
Definition: coordsystem.h:79
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
T convert(Type inptyp, T val, Type outtyp)
Definition: angles.h:76
Definition: coordsystem.h:102
virtual bool isMeter() const
Definition: coordsystem.h:122
void setIsFeet(bool isfeet)
Definition: coordsystem.h:149
Definition: uistring.h:218
bool isfeet_
Definition: coordsystem.h:167
Definition: coordsystem.h:135
Export_Basic const char * toString(ViewStyle)
virtual bool isFeet() const
Definition: coordsystem.h:155
virtual uiString description() const
Definition: coordsystem.h:111
Definition: ptrman.h:168

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