1 #ifndef OPTIONS_H
2 #define OPTIONS_H
3 
4 #include <ctime>
5 #include <string>
6 #include <vector>
7 
8 #include "body.h"
9 
10 class PlanetProperties;
11 
12 class Options
13 {
14  public:
15     static Options* getInstance();
16 
17     Options();
18     ~Options();
19 
20     void parseArgs(int argc, char **argv);
21 
ArcFiles()22     const std::vector<std::string> & ArcFiles() const { return(arcFiles_); };
ArcSpacing()23     double ArcSpacing() const       { return(arcSpacing_); };
ArcThickness()24     int ArcThickness() const       { return(arcThickness_); };
25 
Background()26     const std::string & Background() const { return(background_); };
BaseMagnitude()27     double BaseMagnitude() const { return(baseMag_); };
28 
CenterSelected()29     bool CenterSelected() const     { return(centerSelected_); };
CenterX(const double x)30     void CenterX(const double x)    { centerX_ = x; };
CenterY(const double y)31     void CenterY(const double y)    { centerY_ = y; };
CenterX()32     double CenterX() const          { return(centerX_); };
CenterY()33     double CenterY() const          { return(centerY_); };
ConfigFile()34     const std::string & ConfigFile() const { return(configFile_); };
Color()35     const unsigned char * Color() const { return(color_); };
36 
DateFormat()37     const std::string & DateFormat() const { return(dateFormat_); };
DisplayMode()38     int DisplayMode() const { return(displayMode_); };
DrawLabel()39     bool DrawLabel() const { return(drawLabel_); };
DrawUTCLabel()40     bool DrawUTCLabel() const { return(drawUTCLabel_); };
DynamicOrigin()41     const std::string & DynamicOrigin() const { return(dynamicOrigin_); };
42 
FieldOfView()43     double FieldOfView() const           { return(fov_); };
FieldOfView(const double f)44     void FieldOfView(const double f)     { fov_ = f; };
Font()45     const std::string & Font() const { return(font_); };
FontSize()46     int FontSize() const { return(fontSize_); };
Fork()47     bool Fork() const { return(fork_); };
FOVMode()48     int FOVMode() const          { return(fovMode_); };
FOVMode(const int f)49     void FOVMode(const int f)    { fovMode_ = f; };
50 
Glare()51     double Glare() const { return(glare_); };
GRSLon()52     double GRSLon() const { return(grsLon_); };
GRSSet()53     bool GRSSet() const { return(grsSet_); };
54 
Hibernate()55     unsigned long Hibernate() const { return(hibernate_); };
56 
IdleWait()57     unsigned long IdleWait() const { return(idleWait_); };
InterpolateOriginFile()58     bool InterpolateOriginFile() const { return(interpolateOriginFile_); };
59 
JPLFile()60     const std::string & JPLFile() const { return(jplFile_); };
JPEGQuality()61     int JPEGQuality() const { return(quality_); };
JulianDay()62     double JulianDay() const { return(julianDay_); };
63 
LabelAltitude()64     bool LabelAltitude() const      { return(labelAltitude_); };
LabelBody()65     body LabelBody() const          { return(labelBody_); };
LabelMask()66     int LabelMask() const { return(labelMask_); };
LabelX()67     int LabelX() const { return(labelX_); };
LabelY()68     int LabelY() const { return(labelY_); };
LabelString()69     const std::string & LabelString() const { return(labelString_); };
Latitude()70     double Latitude() const      { return(latitude_); };
Latitude(const double b)71     void Latitude(const double b) { latitude_ = b; };
LightTime()72     bool LightTime() const       { return(lightTime_); };
LocalTime()73     double LocalTime() const { return(localTime_); };
LocalTime(const double l)74     void LocalTime(const double l) { localTime_ = l; };
LogMagnitudeStep()75     double LogMagnitudeStep() const { return(logMagStep_); };
Longitude()76     double Longitude() const     { return(longitude_); };
Longitude(const double l)77     void Longitude(const double l) { longitude_ = l; };
78 
MakeCloudMaps()79     bool MakeCloudMaps() const { return(makeCloudMaps_); };
80 
MarkerFiles()81     const std::vector<std::string> & MarkerFiles() const { return(markerFiles_); };
MarkerBounds()82     const std::string & MarkerBounds() const { return(markerBounds_); };
83 
North()84     int North() const            { return(north_); };
NumTimes()85     int NumTimes() const         { return(numTimes_); };
NumTimes(const int n)86     void NumTimes(const int n) { numTimes_ = n; };
87 
OppositeSide()88     bool OppositeSide() const { return(oppositeSide_); };
OriginMode()89     int OriginMode() const { return(originMode_); };
Origin()90     body Origin() const          { return(origin_); };
Origin(const body b)91     void Origin(const body b)    { origin_ = b; };
OriginFile()92     const std::string & OriginFile() const { return(originFile_); };
OriginID()93     int OriginID() const { return(originID_); };
OutputBase()94     const std::string & OutputBase() const      { return(outputBase_); };
OutputExtension()95     const std::string & OutputExtension() const { return(outputExt_); };
OutputMapRect()96     const std::string & OutputMapRect() const { return(outputMapRect_); };
OutputStartIndex()97     int OutputStartIndex() const { return(outputStartIndex_); };
98 
Pango()99     bool Pango() const { return(pango_); };
PathRelativeTo()100     body PathRelativeTo() const { return(pathRelativeTo_); };
PathRelativeToID()101     int PathRelativeToID() const { return(pathRelativeToID_); };
PostCommand()102     const std::string & PostCommand() const { return(post_command_); };
PrevCommand()103     const std::string & PrevCommand() const { return(prev_command_); };
Primary()104     body Primary() const { return(primary_); };
Primary(const body p)105     void Primary(const body p) { primary_ = p; };
PrintEphemeris()106     bool PrintEphemeris() const { return(printEphemeris_); };
Projection()107     int Projection() const       { return(projection_); };
Projection(const int p)108     void Projection(const int p)     { projection_ = p; };
ProjectionMode()109     int ProjectionMode() const       { return(projectionMode_); };
ProjectionParameters()110     const std::vector<double> & ProjectionParameters() const { return(projectionParameters_); };
AddProjectionParameter(double p)111     void AddProjectionParameter(double p) { projectionParameters_.push_back(p); };
112 
Radius()113     double Radius() const        { return(radius_); };
Radius(const double r)114     void Radius(const double r)  { radius_ = r; };
RandomLatLonRot()115     bool RandomLatLonRot() const { return(random_); };
Range()116     double Range() const         { return(range_); };
Range(const double r)117     void Range(const double r) { range_ = r; };
RangeSpecified()118     bool RangeSpecified() const { return(rangeSpecified_); };
RayleighFile()119     const std::string & RayleighFile() const { return(rayleighFile_); };
Rotate0(const double r)120     void Rotate0(const double r) { rotate0_ = r; };
Rotate()121     double Rotate() const        { return(rotate_); };
Rotate(const double r)122     void Rotate(const double r) { rotate_ = rotate0_ + r; };
123 
getSearchDir()124     const std::vector<std::string> & getSearchDir() const { return(searchdir); };
SaveDesktopFile()125     bool SaveDesktopFile() const { return(saveDesktopFile_); };
SpiceEphemeris()126     const std::vector<int> & SpiceEphemeris() const { return(spiceEphemeris_); };
SpiceFiles()127     const std::vector<std::string> & SpiceFiles() const { return(spiceFiles_); };
StarFreq()128     double StarFreq() const        { return(starFreq_); };
getStarMap()129     const std::string & getStarMap() const { return(star_map); };
130 
SeparationDist()131     double SeparationDist() const { return(separationDist_); };
SeparationTarget()132     body SeparationTarget() const { return(separationTarget_); };
SunLat()133     double SunLat() const      { return(sunLat_); };
SunLat(const double b)134     void SunLat(const double b) { sunLat_ = b; };
SunLon()135     double SunLon() const     { return(sunLon_); };
SunLon(const double l)136     void SunLon(const double l) { sunLon_ = l; };
137 
Target()138     body Target() const          { return(target_); };
Target(const body b)139     void Target(const body b)    { target_ = b; };
TargetID()140     int TargetID() const { return(targetID_); };
TargetMode()141     int TargetMode() const { return(targetMode_); };
142 
getTimeWarp()143     double getTimeWarp() const      { return(timewarp); };
TVSec()144     time_t TVSec() const { return(tv_sec); };
145 
TransPNG()146     bool TransPNG() const { return(transpng_); };
Transparency()147     bool Transparency() const { return(transparency_); };
148 
TmpDir()149     std::string TmpDir() const { return(tmpDir_); };
150 
UniversalTime()151     bool UniversalTime() const { return(universalTime_); };
152 
Verbosity()153     int Verbosity() const { return(verbosity_); };
VirtualRoot()154     bool VirtualRoot() const        { return(virtual_root); };
getWait()155     int getWait() const             { return(wait); };
156 
getWindowX()157     int getWindowX() const          { return(windowX_); };
getWindowY()158     int getWindowY() const          { return(windowY_); };
159 
WindowTitle()160     const std::string & WindowTitle() const { return(windowTitle_); };
161 
XID()162     unsigned long XID() const { return(xid_); };
XYZFile()163     const std::string & XYZFile() const { return(XYZFile_); };
164 
GeometrySelected()165     bool GeometrySelected() const   { return(geometrySelected_); };
GeometryMask()166     int GeometryMask() const     { return(geometryMask_); };
getWidth()167     int getWidth() const            { return((int) width); };
getHeight()168     int getHeight() const           { return((int) height); };
169 
170     void getOrigin(double &X, double &Y, double &Z);
171     void setOrigin(const double X, const double Y, const double Z);
172     void getTarget(double &X, double &Y, double &Z);
173     void setTarget(const double X, const double Y, const double Z);
UseCurrentTime()174     bool UseCurrentTime() const { return(useCurrentTime_); };
175     void incrementTime(const double sec);
176     void setTime(const double jd);
177 
178  private:
179 
180     static Options *instance_;
181 
182     std::vector<std::string> arcFiles_;
183     double arcSpacing_;
184     int arcThickness_;
185 
186     std::string background_;
187     double baseMag_;    // a star of this magnitude has a pixel
188                         // brightness of 1
189     bool centerSelected_;
190     double centerX_, centerY_;
191     unsigned char color_[3];
192     std::string configFile_;
193 
194     std::string dateFormat_;
195     int displayMode_;
196     bool drawLabel_;
197     bool drawUTCLabel_;
198     std::string dynamicOrigin_;
199 
200     std::string font_;
201     int fontSize_;
202     bool fork_;
203     double fov_;          // field of view
204     int fovMode_;
205 
206     int geometryMask_;
207     bool geometrySelected_;
208     double glare_;
209     double grsLon_;
210     bool grsSet_;
211 
212     unsigned long hibernate_;
213 
214     unsigned long idleWait_;
215     bool interpolateOriginFile_;
216 
217     std::string jplFile_;
218     double julianDay_;
219 
220     int labelMask_;
221     int labelX_;
222     int labelY_;
223     bool labelAltitude_;  // display altitude instead of distance from center
224     body labelBody_;      // print this body's info in the label
225     std::string labelString_;
226     double latitude_;
227     bool lightTime_;
228     double localTime_;
229     double logMagStep_;   // log (base 10) of brightness increase for
230                           // each step in magnitude (default 0.4)
231     double longitude_;
232 
233     bool makeCloudMaps_;
234     std::string markerBounds_;
235     std::vector<std::string> markerFiles_;
236 
237     int north_;                    // BODY, GALACTIC, ORBIT, or TERRESTRIAL
238     int numTimes_;
239 
240     bool oppositeSide_;
241     body origin_;
242     std::string originFile_;
243     int originID_;                // for NAIF or NORAD bodies
244     int originMode_;                     // BODY, LBR, RANDOM, MAJOR,
245                                          // SYSTEM, ABOVE, BELOW
246     std::string outputBase_;
247     std::string outputExt_;
248     std::string outputMapRect_;
249     int outputStartIndex_;  // start numbering output files with this
250                             // index
251     double oX_, oY_, oZ_;   // heliocentric rectangular coordinates of
252                             // the observer
253 
254     bool pango_;
255     body pathRelativeTo_;
256     int pathRelativeToID_;
257     std::string post_command_;    // command to run after xplanet renders
258     std::string prev_command_;    // command to run before xplanet renders
259     body primary_;
260     bool printEphemeris_;
261     int projection_;         // type of map projection
262     int projectionMode_;         // type of map projection
263     std::vector<double> projectionParameters_; // extra parameters
264                                                // used for projection
265 
266     int quality_;        // For JPEG images
267 
268     double radius_;      // radius of the body, as a fraction of the
269                          // height of the display
270     bool random_;
271     bool rangeSpecified_; // if the -range option is used
272     double range_;        // distance from the body, in units of its radius
273     std::string rayleighFile_; // used to create Rayleigh scattering lookup tables
274     double rotate_;       // rotate0 plus any increments
275     double rotate0_;      // rotation angle specified on command line
276 
277     bool saveDesktopFile_;
278     double separationDist_; // separation from the primary target
279     body separationTarget_;     // secondary target
280     std::vector<int> spiceEphemeris_;
281     std::vector<std::string> spiceFiles_;
282     double starFreq_;
283     std::string star_map;
284     double sunLat_, sunLon_;    // these aren't options and shouldn't
285                                 // be here, but it's a convenient way
286                                 // to put them in the label
287     body target_;
288     int targetID_;          // for NAIF or NORAD bodies
289     int targetMode_;        // BODY, RANDOM, MAJOR
290     double timewarp;        // multiplication factor for the passage of time
291     std::string tmpDir_;
292     bool transparency_;
293     bool transpng_;
294 
295     double tX_, tY_, tZ_;   // heliocentric rectangular coordinates of
296                             // the target
297 
298     bool universalTime_;
299     bool useCurrentTime_;
300 
301     int verbosity_;
302     bool virtual_root;
303 
304     int wait;           // time (in seconds) to wait between updates
305     unsigned int width, height;
306     int windowX_, windowY_;
307     std::string windowTitle_;
308 
309     unsigned long xid_;
310     std::string XYZFile_; // file containing XYZ coordinates of
311                           // target, origin, and/or north
312 
313     std::vector<std::string> searchdir; // check these directories for files
314 
315     time_t tv_sec;      // UNIX time (seconds from 00:00:00 UTC on
316                         // January 1, 1970)
317 
318     void showHelp();
319 };
320 
321 #endif
322