CARMA C++
Location.h
1 #ifndef SZA_UTIL_LOCATION_H
2 #define SZA_UTIL_LOCATION_H
3 
11 #include "carma/szautil/Angle.h"
13 #include "carma/szautil/Atmosphere.h"
14 #include "carma/szautil/DecAngle.h"
15 #include "carma/szautil/Delay.h"
16 #include "carma/szautil/HourAngle.h"
17 #include "carma/szautil/Vector.h"
18 
19 namespace sza {
20  namespace util {
21 
22  class DelayLocation;
23  class DelayAntennaLocation;
24  class Source;
25 
29  class Location {
30  public:
31 
35  enum ReqParam {
36  NONE = 0x0,
37  SITE = 0x2,
38  LOCATION = 0x4,
39  ALL = SITE | LOCATION
40  };
41 
45  Location();
46  Location(Location& location);
47  Location(const Location& location);
48 
49  void operator=(Location& loc)
50  {
51  }
52 
53  void operator=(const Location& loc)
54  {
55  }
56 
60  virtual ~Location();
61 
65  void setFiducialSite(Angle longitude, Angle latitude, double altitude);
66 
70  void setOffset(double up, double east, double north);
71 
76  bool canLocate();
77 
82  bool canBracket(double mjdUtc);
83 
88  bool changed();
89 
94  inline Angle longitude(bool fiducial) {
95  return fiducial ? fiducialLongitude_ : actualLongitude_;
96  }
97 
98  inline Angle latitude(bool fiducial) {
99  return fiducial ? fiducialLatitude_ : actualLatitude_;
100  }
101 
102  inline double altitude(bool fiducial) {
103  return fiducial ? fiducialAltitude_ : actualAltitude_;
104  }
105 
112  inline Vector<double> getXyz(bool geocentric=true) {
113  if(geocentric)
114  return geocentricXyz_;
115  else
116  return topocentricXyz_;
117  }
118 
119  inline virtual double X(bool ec=true) {
120  return ec ? geocentricXyz_[0] : topocentricXyz_[0];
121  }
122 
123  inline virtual double Y(bool ec=true) {
124  return ec ? geocentricXyz_[1] : topocentricXyz_[1];
125  }
126 
127  inline virtual double Z(bool ec=true) {
128  return ec ? geocentricXyz_[2] : topocentricXyz_[2];
129  }
130 
134  inline Vector<double> getUen() {
135  return uen_;
136  }
137 
138  inline double up() {
139  return uen_[0];
140  }
141 
142  inline double east() {
143  return uen_[1];
144  }
145 
146  inline double north() {
147  return uen_[2];
148  }
149 
154  virtual Delay geometricDelay(DelayAntennaLocation* refDLoc,
155  bool doMotionCorrection);
160  virtual Delay geometricDelay(Angle az, Angle el, DelayAntennaLocation* refDLoc);
161 
166  Delay troposphericDelay(DelayAntennaLocation* refDLoc);
167 
171  void registerLocationCallback(DelayLocation* delayLocation);
172 
176  HourAngle getLst(double mjd);
177 
181  HourAngle getHa(double mjdUtc, HourAngle ra);
182  HourAngle getHa(double mjdUtc, Source* src);
183 
187  inline Astrometry& ephem() {
188  return astrom_;
189  }
190 
194  inline Atmosphere& atmos() {
195  return atmos_;
196  }
197 
198  Angle& azimuth() {
199  return azimuth_;
200  }
201 
202  Angle& elevation() {
203  return elevation_;
204  }
205 
206  protected:
207 
208  HourAngle ha_;
209  DecAngle dec_;
210  Angle azimuth_;
211  Angle elevation_;
212 
213  // A bitmask of lacking parameters required to determine a
214  // location
215 
216  unsigned lacking_;
217 
218  // True if parameters for this object have changed
219 
220  bool changed_;
221 
222  // The fiducial point
223 
224  Angle fiducialLongitude_;
225  Angle fiducialLatitude_;
226  double fiducialAltitude_;
227 
228  //------------------------------------------------------------
229  // Different representations of this location
230 
231  // Absolute (L, L, A) of this location
232 
233  Angle actualLongitude_;
234  Angle actualLatitude_;
235  double actualAltitude_;
236 
237  // (U, E, N) of this location, relative to the fiducial
238 
239  Vector<double> uen_;
240 
241  // Geocentric (X, Y, Z) relative to the fiducial
242 
243  Vector<double> geocentricXyz_;
244 
245  // Topocentric (X, Y, Z) relative to the fiducial
246 
247  Vector<double> topocentricXyz_;
248 
252  Astrometry astrom_;
253 
257  Atmosphere atmos_;
258 
262  void updateCoordinates();
263 
264  // When coordinates are updated, this class can call a
265  // DelayLocation object who has registered to be notified.
266 
267  friend class DelayLocation;
268 
269  DelayLocation* delayLocation_;
270 
271  }; // End class Location
272 
273  } // End namespace util
274 } // End namespace sza
275 
276 
277 
278 #endif // End #ifndef SZA_UTIL_LOCATION_H
HourAngle getHa(double mjdUtc, HourAngle ra)
Convert to Ha 1for the actual location of this antenna.
void registerLocationCallback(DelayLocation *delayLocation)
Register to be called back when this object&#39;s location is updated.
HourAngle getLst(double mjd)
Convert mjd to lst for the location of this antenna.
Astrometry & ephem()
Return a handle to the ephemeris handler.
Definition: Location.h:187
Atmosphere atmos_
An object for handling atmospheric calculations.
Definition: Location.h:257
Vector< double > getUen()
Return the UEN coordinates (meters) of this object.
Definition: Location.h:134
bool canBracket(double mjdUtc)
Return true if ephemeris parameters can be interpolated for this timestamp.
virtual Delay geometricDelay(DelayAntennaLocation *refDLoc, bool doMotionCorrection)
Get geometric delay for an Ha Dec source position, in nanoseconds.
void setOffset(double up, double east, double north)
A method to set an UEN offset relative to the fiducial.
Tagged: Mon Aug 9 17:32:59 UTC 2004.
Vector< double > getXyz(bool geocentric=true)
Return the XYZ coordinates (meters) of this object.
Definition: Location.h:112
Location()
Constructor.
Astrometry astrom_
An object for handling astrometric conversions.
Definition: Location.h:252
bool canLocate()
Return true if a site and offset have ben set for this location.
ReqParam
Parameters required to specify a location.
Definition: Location.h:35
Delay troposphericDelay(DelayAntennaLocation *refDLoc)
Get the delay due to the excess path length through the troposphere.
A class for specifying a location.
Definition: Location.h:29
void setFiducialSite(Angle longitude, Angle latitude, double altitude)
A method to set a fiducial LLA point.
void updateCoordinates()
Update coordinate representations of this location.
bool changed()
Return true if parameters for this location have changed since the last time this function was called...
virtual ~Location()
Destructor.
Atmosphere & atmos()
Return a handle to the atmospheric handler.
Definition: Location.h:194
Angle longitude(bool fiducial)
Return the LLA coordinates (long in rad, lat in rad, altitude in meters) of this object.
Definition: Location.h:94