VR-Forces 4.3.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtEnvironmentRecord.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
14 
15 #include <vrfExtObjects/vrfWeatherStateEnums.h>
16 
17 #include <vector>
18 #include <string>
19 
20 namespace makArchives
21 {
26  {
27  public:
31  {
32  public:
34  DtColorRecord(float r=1.0f, float g=1.0f, float b=1.0f, float a=1.0f);
35 
37  DtColorRecord(const DtColorRecord& orig);
38 
40  DtColorRecord& operator =(DtColorRecord rhs);
41 
43  ~DtColorRecord();
44 
46  void swap(DtColorRecord& other);
47 
50  void setRed(float r);
51  float red() const;
53 
56  void setGreen(float g);
57  float green() const;
59 
62  void setBlue(float b);
63  float blue() const;
65 
68  void setAlpha(float a);
69  float alpha() const;
71 
72  protected:
73 
74  friend class boost::serialization::access;
75 
80  template<class Archive>
81  void serialize(Archive & ar, const unsigned int version)
82  {
83  ar & BOOST_SERIALIZATION_NVP(myRed);
84  ar & BOOST_SERIALIZATION_NVP(myGreen);
85  ar & BOOST_SERIALIZATION_NVP(myBlue);
86  ar & BOOST_SERIALIZATION_NVP(myAlpha);
87  }
88 
89  private:
90  static float clamp(float component);
91 
92  private:
93  float myRed;
94  float myGreen;
95  float myBlue;
96  float myAlpha;
97  };
98 
102  {
103  public:
105  DtThermoclineRecord(float depth=0.0f, float permeability=0.0);
106 
109 
111  DtThermoclineRecord& operator =(DtThermoclineRecord rhs);
112 
115 
117  void swap(DtThermoclineRecord& other);
118 
121  void setDepth(float meters);
122  float depth() const;
124 
127  void setPermeability(float normalizedValue);
128  float permeability() const;
130 
131  protected:
132 
133  friend class boost::serialization::access;
134 
139  template<class Archive>
140  void serialize(Archive & ar, const unsigned int version)
141  {
142  ar & BOOST_SERIALIZATION_NVP(myDepth);
143  ar & BOOST_SERIALIZATION_NVP(myPermeability);
144  }
145 
146  private:
147  float myDepth;
149  };
150 
151  typedef std::vector<DtCloudLayerRecord> CloudLayerRecordList;
152  typedef std::vector<DtThermoclineRecord> ThermoclineRecordList;
153  typedef std::map<std::string, std::string> OptionalParameterMap;
154 
157 
160 
162  virtual ~DtEnvironmentRecord();
163 
165  void swap(DtEnvironmentRecord& other);
166 
168  DtEnvironmentRecord& operator =(DtEnvironmentRecord rhs);
169 
172  void setEnvironmentName(const std::string& name);
173  const std::string& environmentName() const;
175 
178  void setAirTurbidity(float turbidity);
179  float airTurbidity() const;
181 
184  void setVisibleDistance(float distance);
185  float visibleDistance() const;
187 
190  void setPrecipitation(int type);
191  int precipitation() const;
193 
196  void setPrecipitationIntensity(float intensity);
197  float precipitationIntensity() const;
199 
203  CloudLayerRecordList& customCloudLayers();
204  const CloudLayerRecordList& customCloudLayers() const;
206 
209  void setCloudCoverType( DtVrfWeatherCloudState cloudCoverType );
210  DtVrfWeatherCloudState cloudCoverType() const;
212 
216  void setUseCustomCloudCover( bool enabled );
217  bool useCustomCloudCover() const;
219 
222  void setWindSpeed(float metersPerSecond);
223  float windSpeed() const;
225 
228  void setWindDirection(float radiansFromNorth);
229  float windDirection() const;
231 
234  void setAmbientAirTemperature(float celsius);
235  float ambientAirTemperature() const;
237 
240  void setSeaState(int douglasScale);
241  int seaState() const;
243 
246  void setSeaStateDirection(float radiansFromNorth);
247  float seaStateDirection() const;
249 
252  void setWindDrivenSeaStateEnabled(bool enabled);
253  bool windDrivenSeaStateEnabled() const;
255 
258  void setSwellState(int douglasScale);
259  int swellState() const;
261 
264  void setSwellStateDirection(float radiansFromNorth);
265  float swellStateDirection() const;
267 
270  void setWindFetch(float meters);
271  float windFetch() const;
273 
276  void setSeaChoppiness(float chop);
277  float seaChoppiness() const;
279 
282  void setUnderwaterVisibilityEnabled(bool enabled);
283  bool underwaterVisibilityEnabled() const;
285 
288  void setUnderwaterVisibility(float meters);
289  float underwaterVisibility() const;
291 
294  void setSurfaceTransparency(float normalizedValue);
295  float surfaceTransparency() const;
297 
300  void setSurgeDepth(float meters);
301  float surgeDepth() const;
303 
306  void setDepthOffset(float meters);
307  float depthOffset() const;
309 
312  void setAmbientWaterTemperature(float celsius);
313  float ambientWaterTemperature() const;
315 
318  void setWaterCurrentSpeed(float metersPerSecond);
319  float waterCurrentSpeed() const;
321 
324  void setWaterCurrentDirection(float radiansFromNorth);
325  float waterCurrentDirection() const;
327 
330  void setTidalOffset(float meters);
331  float tidalOffset() const;
333 
336  void setTidalDirection(bool inOut);
337  bool tidalDirection() const;
339 
342  void setFogHeight(float meters);
343  float fogHeight() const;
345 
348  void setFogColor(const DtColorRecord& color);
349  const DtColorRecord& fogColor() const;
351 
354  void setThermoclineRecord(
355  unsigned int index, const DtThermoclineRecord& tRec);
356  DtThermoclineRecord thermoclineRecord(unsigned int index) const;
357  void setThermoclineDepth(unsigned int index, float depth);
358  float thermoclineDepth(unsigned int index) const;
359  void setThermoclinePermeability(unsigned int index, float permeability);
360  float thermoclinePermeability(unsigned int index) const;
362 
365  virtual const std::string*
366  findOptionalParameter(const std::string& name) const;
367 
369  virtual void setOptionalParameter(
370  const std::string& name, const std::string& value);
371 
374  virtual void setOptionalParameters(const OptionalParameterMap&);
375 
377  virtual void removeOptionalParameter(const std::string& name);
378 
380  const OptionalParameterMap& optionalParameters() const;
382 
383  protected:
384 
385  friend class boost::serialization::access;
386 
390  template<class Archive>
391  void serialize(Archive & ar, const unsigned int version)
392  {
393  ar & BOOST_SERIALIZATION_NVP(myAirTurbidity);
394  ar & BOOST_SERIALIZATION_NVP(myVisibilityDistance);
395  if (version < 4)
396  {
397  ar & BOOST_SERIALIZATION_NVP(myPrecipitationEnabledFlag);
398  ar & BOOST_SERIALIZATION_NVP(myPrecipitationType);
399  if (myPrecipitationEnabledFlag && myPrecipitationType == "Rain")
400  {
401  myPrecipitation = 1;
402  }
403  else if (myPrecipitationEnabledFlag && myPrecipitationType == "Snow")
404  {
405  myPrecipitation = 2;
406  }
407  else
408  {
409  myPrecipitationType = "None";
410  myPrecipitation = 0;
411  }
412  }
413  ar & BOOST_SERIALIZATION_NVP(myPrecipitationIntensity);
414  ar & BOOST_SERIALIZATION_NVP(myCloudLayers);
415  if(version >= 1)
416  {
417  ar & BOOST_SERIALIZATION_NVP(myWindSpeed);
418  ar & BOOST_SERIALIZATION_NVP(myWindDirection);
419  ar & BOOST_SERIALIZATION_NVP(myAmbientAirTemperature);
420  ar & BOOST_SERIALIZATION_NVP(mySeaState);
421  ar & BOOST_SERIALIZATION_NVP(mySeaChoppiness);
422  ar & BOOST_SERIALIZATION_NVP(myUnderwaterVisibility);
423  ar & BOOST_SERIALIZATION_NVP(myAmbientWaterTemperature);
424  ar & BOOST_SERIALIZATION_NVP(myWaterCurrentSpeed);
425  ar & BOOST_SERIALIZATION_NVP(myWaterCurrentDirection);
426  ar & BOOST_SERIALIZATION_NVP(myTidalOffset);
427  ar & BOOST_SERIALIZATION_NVP(myTidalDirection);
428  }
429  if (version >= 2)
430  {
431  ar & BOOST_SERIALIZATION_NVP(myEnvironmentName);
432  ar & BOOST_SERIALIZATION_NVP(myOptionalParameters);
433  }
434  if (version >= 3)
435  {
436  ar & BOOST_SERIALIZATION_NVP(mySeaStateDirection);
437  ar & BOOST_SERIALIZATION_NVP(myWindDrivenSeaStateEnabled);
438  ar & BOOST_SERIALIZATION_NVP(mySwellState);
439  ar & BOOST_SERIALIZATION_NVP(mySwellStateDirection);
440  ar & BOOST_SERIALIZATION_NVP(myWindFetch);
441  ar & BOOST_SERIALIZATION_NVP(mySurfaceTransparency);
442  ar & BOOST_SERIALIZATION_NVP(mySurgeDepth);
443  ar & BOOST_SERIALIZATION_NVP(myDepthOffset);
444  }
445  if (version >= 4)
446  {
447  ar & BOOST_SERIALIZATION_NVP(myFogHeight);
448  ar & BOOST_SERIALIZATION_NVP(myFogColor);
449  ar & BOOST_SERIALIZATION_NVP(myPrecipitation);
450  ar & BOOST_SERIALIZATION_NVP(myThermoclineRecordList);
451  }
452  if (version >= 5)
453  {
454  ar & BOOST_SERIALIZATION_NVP(myCloudCoverType);
455  ar & BOOST_SERIALIZATION_NVP(myUseCustomCloudCover);
456  }
457  if (version >= 6)
458  {
459  ar & BOOST_SERIALIZATION_NVP(myUnderwaterVisibilityEnabled);
460  }
461  }
462 
463  std::string myEnvironmentName;
464 
470  DtVrfWeatherCloudState myCloudCoverType;
471  float myWindSpeed;
474 
480  float myWindFetch;
486 
492 
493  float myFogHeight;
495 
498 
500 
501  // obsolete as of version 4
503  std::string myPrecipitationType;
504 
506  };
507 
508 }
509 
511 BOOST_CLASS_VERSION(makArchives::DtEnvironmentRecord::DtThermoclineRecord, 0)
512 BOOST_CLASS_VERSION(makArchives::DtEnvironmentRecord, 6)

Document ID: Generated on Wed Jul 29 00:55:00 EDT 2015 from SVN revision 155257
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)