VR-Vantage 3.1 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ciEnvironment.h
Go to the documentation of this file.
1 
2 // Copyright JRM Enterprises, Inc. 2004
3 // All rights reserved.
4 //
5 // This code is the intellectual property of JRM Enterprises, Inc.
6 // It may not be used or released as source or compiled binary form
7 // without the prior written consent of JRM Enterprises, Inc.
8 //
9 // Original Author: Nikolai Fedoroff
10 // Date: Oct 2004
11 //
12 // $Header: /cvsroot/CommonInterface/CILib/include/ciEnvironment.h,v 1.30 2010-10-25 17:20:32 cvsuser Exp $
13 //
14 // $Log: not supported by cvs2svn $
15 // Revision 1.30 2010/10/25 17:20:32 cvsuser
16 // CF101025 : Added Relative Humidity to XML spec.
17 //
18 // Revision 1.29 2010/08/18 13:07:19 cvsuser
19 // (Tom G) Changed parse functions to pass clXML by reference in order to remove calls to a copy constructor that was causing major delays.
20 //
21 // Revision 1.28 2009/11/09 21:45:54 cvsuser
22 // (ken) Set time from environment not scenario for OSV ***** could break Asgard
23 //
24 // Revision 1.27 2009/11/05 11:02:17 cvsuser
25 // (ken) changed to a dll to hopefully allow it to be used with different versions of vc
26 //
27 // Revision 1.26 2009/02/27 18:18:20 cvsuser
28 // (ken) changes for use with VS 2008
29 // eliminate warnings for stdio routines
30 //
31 // Revision 1.25 2008/07/21 18:10:59 cvsuser
32 // Jon G: Reformated Files to be uniform in respect to tabs and braces. replaceds tabs with spaces.
33 //
34 // Revision 1.24 2008/05/14 13:54:54 cvsuser
35 // Added doxygen tags back into header files for ci module. PS
36 //
37 // Revision 1.23 2008/05/02 15:09:46 cvsuser
38 // Modified ci library to use clXML instead of libxml. Adjusted project and solution properties and added unit test to ci. PS
39 //
40 // Revision 1.22 2007/03/05 18:17:37 cvsuser
41 // (Tim) added Doxy comments to CI
42 //
43 // Revision 1.21 2007/02/13 23:50:10 cvsuser
44 // Fix for Linux
45 // TR
46 //
47 // Revision 1.20 2007/01/05 08:09:17 cvsuser
48 // (Tim) added xml loading to the ci project
49 //
50 // Revision 1.19 2006/10/24 12:37:58 cvsuser
51 // (Tim) added rain rate and rain temp
52 //
53 // Revision 1.18 2006/09/05 18:20:45 cvsuser
54 // (Ken) Changes to remove the atm layer offset in favor of terrain altitude.
55 //
56 // Revision 1.17 2006/03/30 23:27:29 cvsuser
57 // (Tim) Cleaned up the data handers code and added missing doxeygen style comments
58 //
59 // Revision 1.16 2006/01/30 22:31:04 cvsuser
60 // (Tim) Integrated the SenSim panel into the sensor panel
61 // Creates a SenSim, Detector, Electronics, and Detector Panel for each sensor
62 // The SenSim is used from the active sensor
63 // All sensim panels get saved and loaded independantly
64 //
65 // Revision 1.15 2006/01/09 23:36:46 cvsuser
66 // (Tim) Added the Atmosphere Offset and Atmosphere Extinction Scale to the Environment panel
67 //
68 // Revision 1.14 2005/12/06 00:21:57 cvsuser
69 // (Tim)Added a star threshold to set the amount of stars that appear
70 //
71 // Revision 1.13 2005/10/31 16:03:02 cvsuser
72 // (Tim)added the round earth checkbox to the envirnment panel and coded it to enable round earth when checked
73 //
74 // Revision 1.12 2005/10/26 19:49:07 cvsuser
75 // (Tim)Added the Scenario data class to store the data for the scenario Panel
76 // removed time of day from the envirnment panel and environment data class
77 // relocated mousevelocity and logscale within interface to be in a scenario data member
78 //
79 // Revision 1.11 2005/10/21 22:23:04 cvsuser
80 // (Tim) Added the button for multiple scattering and added a cimovieplayer object class that gets used to store the movieplayer information.
81 //
82 // Revision 1.10 2005/10/13 21:30:33 cvsuser
83 // (Tim) made mouse velocity and log scale get saved
84 //
85 // Revision 1.9 2005/09/19 12:45:53 cvsuser
86 // Com Library additions
87 // Tom
88 //
89 // Revision 1.8 2005/05/16 18:52:17 cvsuser
90 // (Ken) Added the emission and scattering enable flags.
91 //
92 // Revision 1.7 2005/04/29 21:43:29 cvsuser
93 // Eric: Changed precision to double from floats but since it wrecks the config files, will have to finish upgrade till later
94 //
95 // Revision 1.6 2005/04/22 20:09:48 cvsuser
96 // Tom
97 // Added sky dome radius to environment panel GUI. Moved image display mode to combo box on menu bar. Also added fnumber and focal length to optics panel
98 //
99 // Revision 1.5 2005/03/26 02:29:12 cvsuser
100 // Tom
101 // Ta max/min in interface...
102 //
103 // Revision 1.4 2005/02/08 16:10:24 cvsuser
104 // Tom
105 // Added user defined atmospheric modcard and atm state file loading support
106 //
107 // Revision 1.3 2004/11/08 19:01:36 cvsuser
108 // Added environment changes
109 // Updated doxycution
110 //
111 // Nik
112 //
113 // Revision 1.2 2004/11/02 23:03:51 cvsuser
114 // added "upwards" messaging
115 // added initialization
116 //
117 // Nik
118 //
119 // Revision 1.1 2004/10/27 18:40:50 cvsuser
120 // added ciEnvironment class
121 //
122 // Nik
123 //
124 //
126 
127 #pragma once
128 
129 #if !defined _ciEnvironment_h_
130 #define _ciEnvironment_h_
131 
132 #include "ciApi.h"
133 #include "clXML.h"
134 #include <stdio.h>
135 #include <math.h>
136 #include <string.h>
137 #include <fstream>
138 #include <iostream>
139 #include <assert.h>
140 #include "clXMLNode.h"
141 
142 #ifndef DIURNAL
143 #define DIURNAL 24.0
144 #endif
145 
146 #ifndef SKYDOME_RANGE
147 #define SKYDOME_RANGE 1100000 //195000
148 #endif
149 
151 {
152 public: // enumerations
153 
155  // enumAtmModel
161  {
168  USER_SPEC
169  };
170 
172  // enumHazeModel
178  {
179  noAerosolAttenuation = -1,
180  noCloudOrAerosolAtten = 0,
181  ruralVis_23km = 1,
182  ruralVis_5km = 2,
183  navyMaritime = 3,
184  maritime = 4,
185  urban = 5,
186  tropospheric = 6,
187  userDef_cards2Dx = 7,
188  fog1_200m = 8,
189  fog2_500m = 9,
190  desert = 10,
191  };
192 
193 public: // methods
194 
196  // setDate
206  void setDate(int month, int day, int year)
207  {
208  m_dateMonth = month;
209  m_dateDay = day;
210  m_dateYear = year;
211  }
213  // getDate
223  void getDate(int &month, int &day, int &year)
224  {
225  month = m_dateMonth;
226  day = m_dateDay;
227  year = m_dateYear;
228  }
229 
231  // setNightSkyTableFilepath
239  void setNightSkyTableFilepath(char *nightSkyTableFilepath){strncpy(m_nightSkyTableFilepath, nightSkyTableFilepath, sizeof(m_nightSkyTableFilepath));}
240 
242  // getNightSkyTableFilepath
250  char *getNightSkyTableFilepath(){return m_nightSkyTableFilepath;}
251 
253  // setBathymetryTableFilepath
261  void setBathymetryTableFilepath(char *bathymetryTableFilepath){strncpy(m_bathymetryTableFilepath, bathymetryTableFilepath, sizeof(m_bathymetryTableFilepath));}
262 
264  // getBathymetryTableFilepath
272  char *getBathymetryTableFilepath(){return m_bathymetryTableFilepath;}
273 
275  // setMMLSTableFilepath
283  void setMMLSTableFilepath(char *mmlsTableFilepath){strncpy(m_mmlsTableFilepath, mmlsTableFilepath, sizeof(m_mmlsTableFilepath));}
284 
286  // getMMLSTableFilepath
294  char *getMMLSTableFilepath(){return m_mmlsTableFilepath;}
295 
297  //setStarThreshold
302  void setStarThreshold(double threshold){m_starThreshold = threshold; }
303 
305  //getStarThreshold
310  double getStarThreshold(){
311  if (m_starThreshold > 100)
312  m_starThreshold = 100;
313  else if (m_starThreshold < 0)
314  m_starThreshold = 0;
315  return m_starThreshold; }
316 
318  // setAtmModel
327  void setAtmModel(int atmModel){m_atmModel = atmModel;}
329  // getAtmModel
337  int getAtmModel(){return m_atmModel;}
338 
340  // setHazeModel
349  void setHazeModel(int hazeModel){m_hazeModel = hazeModel;}
350 
352  // getHazeModel
360  int getHazeModel(){return m_hazeModel;}
361 
363  // setCloudModel
371  void setCloudModel(int cldModel){m_cldModel = cldModel;}
372 
374  // getCloudModel
381  int getCloudModel(){return m_cldModel;}
382 
383 
385  // setNovamModel
393  void setNovamModel(int novamModel){m_novamModel = novamModel;}
394 
396  // getNovamModel
403  int getNovamModel(){return m_novamModel;}
404 
405 
407  // setWindVelocity
415  void setWindVelocity(double windVelocity){m_windVelocity = windVelocity;}
416 
418  // getWindVelocity
425  double getWindVelocity(){return m_windVelocity;}
426 
428  // getWindDirection
436  void setWindDirection(double windDirection) { m_windDirection = windDirection; }
437 
439  // getWindDirection
446  double getWindDirection() { return m_windDirection; }
447 
448 
450  // setVisibility
458  void setVisibility(double visibility){m_visibility = visibility;}
459 
461  // getVisibility
468  double getVisibility(){return m_visibility;}
469 
471  // archive
480  bool archive(std::ofstream &outf);
481 
483  // serialize
491  bool serialize(char *filepath);
492 
493  //
494  // loadXML
495  //
496  // \par Description:
497  // Loads attributes from an XML node
498  //
499  // \param clXMLNode* environmentNode
500  // \return bool
501  //
502  bool loadXML(clXMLNode* environmentNode);
503 
504  //
505  // parseXML
506  //
507  // \par Description:
508  // Parses an XML document for specific tags
509  //
510  // \param clXML xmlDocument
511  // \return bool
512  //
513  bool parseXML(clXML& xmlDocument);
514 
516  //loadXMLNode
523  bool loadXMLNode(std::string tag, char *nodeString);
525  //loadXMLNode
532  bool loadXMLNode(std::string tag, bool *nodeBool);
534  //loadXMLNode
541  bool loadXMLNode(std::string tag, int *nodeBool);
543  //loadXMLNode
550  bool loadXMLNode(std::string tag, double *nodeBool);
551 
552  //
553  // saveXML
554  //
555  // \par Description:
556  // Saves XML nodes to an XML document
557  //
558  // \param clXML* xmlDocument
559  //
560  void saveXML(clXML* xmlDocument);
561 
563  // ciEnvironment
569  ciEnvironment(void);
570 
572  // ~ciEnvironment
578  ~ciEnvironment(void);
579 
581  // ciEnvironment
589 
591  // operator =
598  ciEnvironment operator = (ciEnvironment &obj);
599 
601  // setUseAtmosphericAttenuation
609  void setUseAtmosphericAttenuation(bool useAtmosphericAttenuation) {m_useAtmosphericAttenuation = useAtmosphericAttenuation;}
610 
612  // getUseAtmosphericAttenuation
619  bool getUseAtmosphericAttenuation() {return m_useAtmosphericAttenuation;}
620 
622  // setUseAtmosphericScattering
630  void setUseAtmosphericScattering(bool useAtmosphericScattering) {m_useAtmosphericScattering = useAtmosphericScattering;}
631 
633  // getUseAtmosphericScattering
640  bool getUseAtmosphericScattering() {return m_useAtmosphericScattering;}
641 
643  // setUseRoundEarth
651  void setUseRoundEarth(bool useRoundEarth) {m_useRoundEarth = useRoundEarth;}
652 
654  // getUseRoundEarth
661  bool getUseRoundEarth() {return m_useRoundEarth;}
662 
664  // setUseODLimit
672  void setUseODLimit(bool useODLimit) {m_useODLimit = useODLimit;}
673 
675  // getUseODLimit
682  bool getUseODLimit() {return m_useODLimit;}
683 
684 
685 
687  // getApplyRefraction
694  bool getApplyRefraction() {return m_applyRefraction;}
695 
697  // setApplyRefraction
705  void setApplyRefraction(bool applyRefraction) {m_applyRefraction = applyRefraction;}
706 
708  // getConstEratio
715  bool getConstEratio() {return m_constEratio;}
716 
718  // setConstEratio
726  void setConstEratio(bool constEratio) {m_constEratio = constEratio;}
727 
729  // getNumAlts
736  int getNumAlts()
737  {
738  return m_numAlt;
739  }
740 
742  // setNumAlts
749  void setNumAlts(int nalts)
750  {
751  if (nalts < 8) nalts = 8;
752  m_numAlt = nalts;
753  }
754 
756  // getPowAlt
763  double getPowAlt()
764  {
765  return m_powAlt;
766  }
767 
769  // setPowAlt
776  void setPowAlt(double palt)
777  {
778  if (palt < 1.0E-15) palt = 1.0E-15;
779  m_powAlt = palt;
780  }
781 
783  // getNumRanges
790  int getNumRanges()
791  {
792  return m_numRange;
793  }
794 
796  // setNumRanges
803  void setNumRanges(int nranges)
804  {
805  if (nranges < 8) nranges = 8;
806  m_numRange = nranges;
807  }
808 
810  // getPowRange
817  double getPowRange()
818  {
819  return m_powRange;
820  }
821 
823  // setPowRange
830  void setPowRange(double prange)
831  {
832  if (prange < 1.0E-15) prange = 1.0E-15;
833  m_powRange = prange;
834  }
835 
837  // getPowDensity
844  double getPowDensity()
845  {
846  return m_powDensity;
847  }
848 
850  // setPowDensity
857  void setPowDensity(double pdense)
858  {
859  if (pdense < 1.0E-15) pdense = 1.0E-15;
860  m_powDensity = pdense;
861  }
862 
864  //setLUTPrecomputationRange
871  void setLUTPrecomputationRange(bool lut_precomp_enable, double lut_tod_start, double lut_tod_end, double lut_tod_interval)
872  {
873  if (lut_tod_interval < 1.0 / 60.0) lut_tod_interval = 1.0 / 60.0;
874  m_lut_precomp_enable = lut_precomp_enable;
875  m_lut_tod_start = fmod(lut_tod_start, DIURNAL);
876  m_lut_tod_end = fmod(lut_tod_end, DIURNAL);
877  m_lut_tod_interval = lut_tod_interval;
878  }
879 
881  //getLUTPrecomputationRange
888  void getLUTPrecomputationRange(bool &lut_precomp_enable, double &lut_tod_start, double &lut_tod_end, double &lut_tod_interval)
889  {
890  lut_precomp_enable = m_lut_precomp_enable;
891  lut_tod_start = m_lut_tod_start;
892  lut_tod_end = m_lut_tod_end;
893  lut_tod_interval = m_lut_tod_interval;
894  }
895 
896 
898  // setUseAtmosphericMultiScattering
906  void setUseAtmosphericMultiScattering(bool useAtmosphericMultiScattering) {m_useAtmosphericMultiScattering = useAtmosphericMultiScattering;}
907 
909  // getUseAtmosphericMultiScattering
916  bool getUseAtmosphericMultiScattering() {return m_useAtmosphericMultiScattering;}
917 
919  // setUseOriginalCode
927  void setUseOriginalCode(bool useOriginalCode) {m_useOriginalCode = useOriginalCode;}
928 
930  // getUseOriginalCode
937  bool getUseOriginalCode() {return m_useOriginalCode;}
938 
940  // setUseModRad
948  void setUseModRad(bool useModRad) {m_useModRad = useModRad;}
949 
951  // getUseModRad
958  bool getUseModRad() {return m_useModRad;}
959 
961  // setUseBNNATM
969  void setUseBNNATM(bool useBNNATM) {m_useBNNATM = useBNNATM;}
970 
972  // getUseBNNATM
979  bool getUseBNNATM() {return m_useBNNATM;}
980 
981 
983  // setUseFastEnvCache
991  void setUseFastEnvCache(bool useFastEnvCache) {m_useFastEnvCache = useFastEnvCache;}
992 
994  // getUseFastEnvCache
1001  bool getUseFastEnvCache() {return m_useFastEnvCache;}
1002 
1004  // setUseThermalEmission
1012  void setUseThermalEmission(bool useThermalEmission) {m_useThermalEmission = useThermalEmission;}
1013 
1015  // getUseThermalEmission
1022  bool getUseThermalEmission() {return m_useThermalEmission;}
1023 
1025  // setEnableLighting
1033  void setEnableLighting(bool enableLighting) {m_enableLighting = enableLighting;}
1034 
1036  // getEnableLighting
1043  bool getEnableLighting() {return m_enableLighting;}
1044 
1046  // setUserSpecifiedAtmFilepath
1054  void setUserSpecifiedAtmFilepath(char *userSpecifiedAtmFilepath){strcpy(m_userSpecifiedAtmFilepath, userSpecifiedAtmFilepath);}
1055 
1057  // getUserSpecifiedAtmFilepath
1065  char *getUserSpecifiedAtmFilepath(){return m_userSpecifiedAtmFilepath;}
1066 
1068  // setUserSpecifiedTaMin
1076  void setUserSpecifiedTaMin(double tempMin){m_tempMin = (float) tempMin;}
1077 
1079  // setUserSpecifiedTaMax
1087  void setUserSpecifiedTaMax(double tempMax){m_tempMax = (float) tempMax;}
1088 
1090  // getUserSpecifiedTaMin
1097  double getUserSpecifiedTaMin(){return m_tempMin;}
1098 
1100  // setUserSpecifiedTaMax
1107  double getUserSpecifiedTaMax(){return m_tempMax;}
1108 
1110  // setSkyDomeRadius
1118  void setSkyDomeRadius(double radius){m_skydomeRadius = radius;}
1119 
1121  // getSkyDomeRadius
1128  double getSkyDomeRadius(){ return m_skydomeRadius;}
1129 
1131  //setAtmExtinction
1136  void setAtmExtinction(double extinction){m_atmExtinction = extinction;}
1138  //getAtmExtinction
1143  double getAtmExtinction(){return m_atmExtinction;}
1145  //getRainRate
1150  double getRainRate(){return m_rainRate;}
1152  //setRainRate
1157  void setRainRate(double rate){m_rainRate = rate;}
1159  //getRainTemp
1164  double getRainTemp(){return m_rainTemp;}
1166  //setRainTemp
1171  void setRainTemp(double temp){m_rainTemp = temp;}
1173  //getRelativeHumidityRatio
1178  double getRelativeHumidityRatio(){return m_humidityRatio;}
1180  //setRelativeHumidityRatio
1185  void setRelativeHumidityRatio(double ratio){m_humidityRatio = ratio;}
1186 
1187 
1188  void setLogScale(bool flag){m_logScale = flag;}
1189  bool getLogScale(){return m_logScale;}
1190  void setMouseVel(double vel){m_mouseVel = vel;}
1191  double getMouseVel(){return m_mouseVel;}
1192  void setTime(float time){m_timeOfDay = time;}
1193  float getTime(){return m_timeOfDay;}
1194 
1195 private: // parts, variables, and other neat stuff...
1196 
1197  int m_dateMonth,
1198  m_dateDay,
1199  m_dateYear;
1200  float m_timeOfDay;
1201  char m_nightSkyTableFilepath[512];
1202  char m_bathymetryTableFilepath[512];
1203  char m_mmlsTableFilepath[512];
1210  double m_visibility;
1215  char m_userSpecifiedAtmFilepath[512];
1216  float m_tempMin;
1217  float m_tempMax;
1220  double m_mouseVel;
1231  double m_atmOffset; // unused now.
1233  double m_rainRate;
1234  double m_rainTemp;
1237  double m_powAlt;
1239  double m_powRange;
1246 };
1247 
1248 #endif // _ciEnvironment_h_


Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)