My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
Location.h
Go to the documentation of this file.
1 #ifndef GCP_UTIL_LOCATION_H
2 #define GCP_UTIL_LOCATION_H
3 
11 #include "gcp/util/common/Angle.h"
12 #include "gcp/util/common/Astrometry.h"
13 #include "gcp/util/common/DecAngle.h"
14 #include "gcp/util/common/Delay.h"
15 #include "gcp/util/common/HourAngle.h"
16 #include "gcp/util/common/Vector.h"
17 
18 namespace gcp {
19  namespace util {
20 
21  class DelayLocation;
22  class Source;
23 
27  class Location {
28  public:
29 
33  enum ReqParam {
34  NONE = 0x0,
35  SITE = 0x2,
36  LOCATION = 0x4,
37  ALL = SITE | LOCATION
38  };
39 
43  Location();
44 
48  virtual ~Location();
49 
53  void setFiducialSite(Angle longitude, Angle latitude, double altitude);
54 
58  void setOffset(double up, double east, double north);
59 
64  bool canLocate();
65 
70  bool canBracket(double mjdUtc);
71 
76  bool changed();
77 
82  inline Angle longitude(bool fiducial) {
83  return fiducial ? fiducialLongitude_ : actualLongitude_;
84  }
85 
86  inline Angle latitude(bool fiducial) {
87  return fiducial ? fiducialLatitude_ : actualLatitude_;
88  }
89 
90  inline double altitude(bool fiducial) {
91  return fiducial ? fiducialAltitude_ : actualAltitude_;
92  }
93 
100  inline Vector<double> getXyz(bool geocentric=true) {
101  if(geocentric)
102  return geocentricXyz_;
103  else
104  return topocentricXyz_;
105  }
106 
107  inline double X(bool ec=true) {
108  return ec ? geocentricXyz_[0] : topocentricXyz_[0];
109  }
110 
111  inline double Y(bool ec=true) {
112  return ec ? geocentricXyz_[1] : topocentricXyz_[1];
113  }
114 
115  inline double Z(bool ec=true) {
116  return ec ? geocentricXyz_[2] : topocentricXyz_[2];
117  }
118 
123  return uen_;
124  }
125 
126  inline double up() {
127  return uen_[0];
128  }
129 
130  inline double east() {
131  return uen_[1];
132  }
133 
134  inline double north() {
135  return uen_[2];
136  }
137 
142  Delay geometricDelay(HourAngle ha, DecAngle dec,
143  Location& refLoc,
144  bool doMotionCorrection);
149  Delay geometricDelay(Angle az, Angle el,
150  Location& refLoc);
151 
155  void registerLocationCallback(DelayLocation* delayLocation);
156 
160  HourAngle getLst(double mjd);
161 
165  HourAngle getHa(double mjdUtc, HourAngle ra);
166  HourAngle getHa(double mjdUtc, Source* src);
167 
171  inline Astrometry& ephem() {
172  return astrom_;
173  }
174 
175  private:
176 
177  // A bitmask of lacking parameters required to determine a
178  // location
179 
180  unsigned lacking_;
181 
182  // True if parameters for this object have changed
183 
184  bool changed_;
185 
186  // The fiducial point
187 
188  Angle fiducialLongitude_;
189  Angle fiducialLatitude_;
190  double fiducialAltitude_;
191 
192  //------------------------------------------------------------
193  // Different representations of this location
194 
195  // Absolute (L, L, A) of this location
196 
197  Angle actualLongitude_;
198  Angle actualLatitude_;
199  double actualAltitude_;
200 
201  // (U, E, N) of this location, relative to the fiducial
202 
203  Vector<double> uen_;
204 
205  // Geocentric (X, Y, Z) relative to the fiducial
206 
207  Vector<double> geocentricXyz_;
208 
209  // Topocentric (X, Y, Z) relative to the fiducial
210 
211  Vector<double> topocentricXyz_;
212 
216  Astrometry astrom_;
217 
221  void updateCoordinates();
222 
223  // When coordinates are updated, this class can call a
224  // DelayLocation object who has registered to be notified.
225 
226  friend class DelayLocation;
227 
228  DelayLocation* delayLocation_;
229 
230  }; // End class Location
231 
232  } // End namespace util
233 } // End namespace gcp
234 
235 
236 
237 
238 #endif // End #ifndef GCP_UTIL_LOCATION_H
void setFiducialSite(Angle longitude, Angle latitude, double altitude)
Definition: Location.cc:52
Definition: DelayLocation.h:18
virtual ~Location()
Definition: Location.cc:47
HourAngle getLst(double mjd)
Definition: Location.cc:199
Definition: Astrometry.h:19
bool canLocate()
Definition: Location.cc:91
Angle longitude(bool fiducial)
Definition: Location.h:82
Location()
Definition: Location.cc:17
Vector< double > getUen()
Definition: Location.h:122
bool canBracket(double mjdUtc)
Definition: Location.h:27
ReqParam
Definition: Location.h:33
HourAngle getHa(double mjdUtc, HourAngle ra)
Definition: Location.cc:213
Vector< double > getXyz(bool geocentric=true)
Definition: Location.h:100
Definition: Angle.h:20
void setOffset(double up, double east, double north)
Definition: Location.cc:73
Delay geometricDelay(HourAngle ha, DecAngle dec, Location &refLoc, bool doMotionCorrection)
Definition: Location.cc:147
Definition: logfile.c:20
void registerLocationCallback(DelayLocation *delayLocation)
Definition: Location.cc:136
Astrometry & ephem()
Definition: Location.h:171