KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Mine.h
Go to the documentation of this file.
1 /*********************************************************************
2 Copyright 2013 Karl Jones
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7 
8 1. Redistributions of source code must retain the above copyright notice, this
9  list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright notice,
11  this list of conditions and the following disclaimer in the documentation
12  and/or other materials provided with the distribution.
13 
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 
25 For Further Information Please Contact me at
26 Karljj1@yahoo.com
27 http://p.sf.net/kdis/UserGuide
28 *********************************************************************/
29 
30 /********************************************************************
31  class: Mine
32  created: 11/06/2010
33  author: Karl Jones
34 
35  purpose: Encapsulates the common attributes for a Mine.
36  Note: These values are not encoded sequentially into the minefield data PDU,
37  all encoding and decoding is done by the hosting PDU.
38  size: 112 bits / 14 octets
39 *********************************************************************/
40 
41 #pragma once
42 
43 #include "./MinefieldDataFilter.h"
44 #include "./Vector.h"
45 #include "./EulerAngles.h"
46 #include "./ClockTime.h"
47 #include "./MineFusing.h"
48 #include "./MinePaintScheme.h"
49 #include <vector>
50 #include <map>
51 
52 namespace KDIS {
53 namespace DATA_TYPE {
54 
55 class KDIS_EXPORT Mine : public MinefieldDataFilter // Data filter used to keep track of what fields are being used in this mine.
56 {
57 protected:
58 
60 
62 
64 
66 
68 
70 
72 
74 
76 
78 
79  std::vector<KUINT8> m_vui8SDC;
80 
82 
84 
85  std::map< KUINT16, std::vector<KDIS::DATA_TYPE::Vector> >m_mvVertices;
87 
88  //************************************
89  // FullName: KDIS::DATA_TYPE::Mine::getWire
90  //!Description: Return wire or throw exception if not found.
91  // Parameter: KUINT16 Index
92  //************************************
93  std::map< KUINT16, std::vector<Vector> >::iterator getWire( KUINT16 Index ) throw( KException );
94 
95  // Not Used. It is not possible to use this method of decoding/encoding as the values are
96  // not all stored sequentially in the Minefield Data PDU. The PDU must do all the encoding/decoding.
97  virtual void Decode( KDataStream & stream ) throw( KException ) {};
98  virtual KDataStream Encode() const {
99  return KDataStream();
100  };
101  virtual void Encode( KDataStream & stream ) const {};
102 
103 public:
104 
105  Mine();
106 
107  Mine( const Vector & Location, KUINT16 ID );
108 
109  virtual ~Mine();
110 
111  //************************************
112  // FullName: KDIS::DATA_TYPE::Mine::SetLocation
113  // KDIS::DATA_TYPE::Mine::GetLocation
114  //!Description: Location of the mine, relative to the Minefield Location
115  //! field, given in the corresponding Minefield State PDU field.
116  //! Represented by an Entity Coordinate Vector record.
117  // Parameter: const Vector & L
118  //************************************
119  void SetLocation( const Vector & L );
120  const Vector & GetLocation() const;
121 
122  //************************************
123  // FullName: KDIS::DATA_TYPE::Mine::SetID
124  // KDIS::DATA_TYPE::Mine::GetID
125  //!Description: Identifies the mine entity.
126  //! NOTE: The Minefield number in conjunction with the Site Number
127  //! and Application Number values from the Minefield ID (found in
128  //! the Minefield Data PDU) forms the unique identifier for each mine.
129  // Parameter: KUINT16 ID
130  //************************************
131  void SetID( KUINT16 ID );
132  KUINT16 GetID() const;
133 
134  /************************************************************************/
135  /* The following values are all optional however you MUST use the same */
136  /* optional values in ALL mines that go into the Minefield Data PDU. */
137  /* NOTE: */
138  /* When the set function's are called the bit in the relevant minefield */
139  /* data filter will automatically be set to 'on', if you wish to then */
140  /* turn it back to 'off' you should use the relevant filter function to */
141  /* do so. */
142  /* E.G */
143  /* SetGroundBurialDepthOffsetValue( 1.0f ); // Bit will be set to 'on' */
144  /* SetGroundBurialDepthOffset( false ); // Turn the bit back to 'off' */
145  /************************************************************************/
146 
147  //************************************
148  // FullName: KDIS::DATA_TYPE::Mine::SetGroundBurialDepthOffsetValue
149  // KDIS::DATA_TYPE::Mine::GetGroundBurialDepthOffsetValue
150  //!Description: Specifies the offset of the origin of the mine coordinate
151  //! system with respect to the ground surface. This offset can
152  //! be used in conjunction with the mine orientation to determine
153  //! the actual ground burial depth of the surfaces of a mine.
154  //! Ground burial depth offset is specified as a positive
155  //! measurement in meters below the terrain surface along the up vector.
156  //! Although mine locations are specified in three dimensions in
157  //! the Mine Location field, the ground burial depth offset field is
158  //! provided so that the positions of mines relative to the terrain
159  //! surface are accurately conveyed. Ground burial depth offset provides
160  //! the frame of reference for the other two burial depth offsets
161  //! (water and snow). If any of the three burial depth offsets are
162  //! sent in the PDU, ground burial depth offset and mine orientation
163  //! shall also be sent. If a terrain database does not include
164  //! the ground surface (such as under a water feature), an arbitrary
165  //! ground burial depth offset shall be specified.
166  // Parameter: KFLOAT32 GBO
167  //************************************
168  void SetGroundBurialDepthOffsetValue( KFLOAT32 GBO );
169  KFLOAT32 GetGroundBurialDepthOffsetValue() const;
170 
171  //************************************
172  // FullName: KDIS::DATA_TYPE::Mine::SetWaterBurialDepthOffsetValue
173  // KDIS::DATA_TYPE::Mine::GetWaterBurialDepthOffsetValue
174  //!Description: Specifies the offset of the origin of the mine coordinate
175  //! system with respect to the water surface. This offset can
176  //! be used in conjunction with the mine orientation to determine
177  //! the actual water burial depth of the surfaces of a mine. Water
178  //! burial depth offset is specified as a positive measurement in
179  //! meters below the water surface along the up vector. Although
180  //! mine locations are specified in three dimensions in the Mine
181  //! Location field, the water burial depth offset field is provided
182  //! so that the positions of mines relative to the water surface
183  //! are accurately conveyed. Ground burial depth offset provides
184  //! the frame of reference for this burial depth offset. If any of
185  //! the three burial depth offsets are sent in the PDU, ground burial
186  //! depth offset and mine orientation shall also be sent. The value
187  //! of the water burial depth offset field shall be set to the value
188  //! of the ground burial depth offset to indicate there is no water
189  //! for the mine to be buried in.
190  // Parameter: KFLOAT32 WBO
191  //************************************
192  void SetWaterBurialDepthOffsetValue( KFLOAT32 WBO );
193  KFLOAT32 GetWaterBurialDepthOffsetValue() const;
194 
195  //************************************
196  // FullName: KDIS::DATA_TYPE::Mine::SetSnowBurialDepthOffsetValue
197  //!Description: Specifies the offset of the origin of the mine coordinate system
198  //! with respect to the snow surface. This offset can be used in
199  //! conjunction with the mine orientation to determine the actual snow
200  //! burial depth of the surfaces of a mine. Snow burial depth offset is
201  //! specified as a positive measurement in meters below the snow surface
202  //! along the up vector. Although mine locations are specified in three
203  //! dimensions in the Mine Location field, the snow burial depth offset
204  //! field is provided so that the positions of mines relative to the snow
205  //! surface are accurately conveyed. Ground burial depth offset provides
206  //! the frame of reference for this burial depth offset. If any of the
207  //! three burial depth offsets are sent in the PDU, ground burial depth
208  //! offset and mine orientation shall also be sent. The value of the snow
209  //! burial depth offset field shall be set to the value of the ground
210  //! burial depth offset to indicate there is no snow.
211  // Parameter: KFLOAT32 SBO
212  //************************************
213  void SetSnowBurialDepthOffsetValue( KFLOAT32 SBO );
214  KFLOAT32 GetSnowBurialDepthOffsetValue() const;
215 
216  //************************************
217  // FullName: KDIS::DATA_TYPE::Mine::SetMineOrientationValue
218  // KDIS::DATA_TYPE::Mine::GetMineOrientationValue
219  //!Description: The orientation of the center axis direction of fire of the mine,
220  //! relative to the minefield Entity Coordinate System.
221  //! If any of the three burial depth offsets is sent in the PDU,
222  //! this field shall also be sent.
223  // Parameter: const EulerAngles & O
224  //************************************
225  void SetMineOrientationValue( const EulerAngles & O );
226  const EulerAngles & GetMineOrientationValue() const;
227  EulerAngles & GetMineOrientationValue();
228 
229  //************************************
230  // FullName: KDIS::DATA_TYPE::Mine::SetThermalContrastValue
231  // KDIS::DATA_TYPE::Mine::GetThermalContrastValue
232  //!Description: The temperature difference between the mine and the surrounding
233  //! soil in degrees Centigrade. In the case of a buried mine, the
234  //! delta temperature shall be measured between the ground surface
235  //! above the mine and the surrounding ground surface temperature.
236  // Parameter: KFLOAT32 TC
237  //************************************
238  void SetThermalContrastValue( KFLOAT32 TC );
239  KFLOAT32 GetThermalContrastValue() const;
240 
241  //************************************
242  // FullName: KDIS::DATA_TYPE::Mine::SetReflectanceValue
243  // KDIS::DATA_TYPE::Mine::GetReflectanceValue
244  //!Description: The local dielectric difference between the mine and the surrounding soil.
245  // Parameter: KFLOAT32 R
246  //************************************
247  void SetReflectanceValue( KFLOAT32 R );
248  KFLOAT32 GetReflectanceValue() const;
249 
250  //************************************
251  // FullName: KDIS::DATA_TYPE::Mine::SetMineEmplacementAgeValue
252  // KDIS::DATA_TYPE::Mine::GetMineEmplacementAgeValue
253  //!Description: The real-world (UTC) emplacement time of the mine.
254  // Parameter: const ClockTime & MET
255  //************************************
256  void SetMineEmplacementAgeValue( const ClockTime & MET );
257  const ClockTime & GetMineEmplacementAgeValue() const;
258  ClockTime & GetMineEmplacementAgeValue();
259 
260  //************************************
261  // FullName: KDIS::DATA_TYPE::Mine::SetFusingValue
262  // KDIS::DATA_TYPE::Mine::GetFusingValue
263  //!Description: The primary, secondary fuse and anti-handling device.
264  // Parameter: const MineFusing & MF
265  //************************************
266  void SetFusingValue( const MineFusing & MF );
267  const MineFusing & GetFusingValue() const;
268  MineFusing & GetFusingValue();
269 
270  //************************************
271  // FullName: KDIS::DATA_TYPE::Mine::AddScalarDetectionCoefficientValue
272  // KDIS::DATA_TYPE::Mine::SetScalarDetectionCoefficientValues
273  // KDIS::DATA_TYPE::Mine::GetScalarDetectionCoefficientValue
274  // KDIS::DATA_TYPE::Mine::ClearScalarDetectionCoefficientValues
275  //!Description: The coefficient to be utilized for proper correlation between
276  //! detectors located on different simulation platforms.
277  //! In statistically based detection system applications, the
278  //! detection system simulation will generally compare a random number
279  //! against an internally calculated probability of detection.
280  //! The scalar detection coefficient, scaled appropriately to a 0 to
281  //! 1 range, should be compared against the internally calculated
282  //! probability of detection to determine whether a detection has
283  //! occurred. If the scalar detection coefficient is equal to or less
284  //! than the probability of detection, then a detection has occurred.
285  //! If the scalar detection coefficient is greater than the probability
286  //! of detection, then a detection has not occurred. Internally generated
287  //! random numbers should not be used because they will not provide for
288  //! proper correlation across distributed detection system simulations.
289  //! Random processes within the detector that are not determined by
290  //! external environmental factors can be incorporated into the calculation
291  //! of the appropriate probability of detection prior to its comparison
292  //! with the scalar detection coefficient.
293  //! Note: The number of SDC values should be equal to the number of sensor
294  //! types in the Minefield Data PDU. I.E one SDC value per sensor type.
295  //! If the number is not equal then an exception will be thrown from the Minefield Data PDU
296  //! when you try to Encode.
297  // Parameter: KUINT8 SDC
298  //************************************
299  void AddScalarDetectionCoefficientValue( KUINT8 SDC );
300  void SetScalarDetectionCoefficientValues( const std::vector<KUINT8> & SDC );
301  const std::vector<KUINT8> & GetScalarDetectionCoefficientValues() const;
302  std::vector<KUINT8> & GetScalarDetectionCoefficientValues();
303  void ClearScalarDetectionCoefficientValues();
304 
305  //************************************
306  // FullName: KDIS::DATA_TYPE::Mine::SetPaintSchemeValue
307  // KDIS::DATA_TYPE::Mine::GetPaintSchemeValue
308  //!Description: The paint scheme of the mine including details about algae coverage.
309  // Parameter: const MinePaintScheme & MPS
310  //************************************
311  void SetPaintSchemeValue( const MinePaintScheme & MPS );
312  const MinePaintScheme & GetPaintSchemeValue() const;
313  MinePaintScheme & GetPaintSchemeValue();
314 
315  /************************************************************************/
316  /* The following functions are all related to the mines trip detonation */
317  /* wires. (bit 7 in filter) */
318 
319  //************************************
320  // FullName: KDIS::DATA_TYPE::Mine::GetNumberTripDetonationWires
321  //!Description: The number of trip/detonation wires attached to this mine.
322  //************************************
323  KUINT8 GetNumberTripDetonationWires() const;
324 
325  //************************************
326  // FullName: KDIS::DATA_TYPE::Mine::AddTripDetonationWire
327  // KDIS::DATA_TYPE::Mine::GetTripDetonationWire
328  //!Description: Add a new trip/detonation wire. Get the existing wires. Wires are stored in a map where
329  //! the key is the id/index and the second value is the Vertices.
330  //! Vertices is the location of the trip/detonation wire vertices relative to the minefield
331  //! location field given in the corresponding Minefield State PDU field.
332  //! Represented by an Entity Coordinate Vector record.
333  //! Returns the index/id which can be used to access this wire, note the index value is not transmitted
334  //! over DIS, it is just provided to allow you to access the wire.
335  // Parameter: const vector<Vector> & Vertices
336  //************************************
337  KUINT16 AddTripDetonationWire( const std::vector<Vector> & Vertices );
338  const std::map< KUINT16, std::vector<Vector> > & GetTripDetonationWire() const;
339 
340  //************************************
341  // FullName: KDIS::DATA_TYPE::Mine::ClearWires
342  //!Description: Clears all wires and resets the SetTripDetonationWire filter back to false.
343  //************************************
344  void ClearWires();
345 
346  //************************************
347  // FullName: KDIS::DATA_TYPE::Mine::AddVertexToTripDetonationWire
348  // KDIS::DATA_TYPE::Mine::SetTripDetonationWireVertices
349  // KDIS::DATA_TYPE::Mine::RemoveTripDetonationWire
350  // KDIS::DATA_TYPE::Mine::GetWireVertices
351  // KDIS::DATA_TYPE::Mine::ClearWireVertices
352  //!Description: Change/Remove an existing wire or its Vertices.
353  // Parameter: KUINT16 Index - OUT_OF_BOUNDS exception thrown if invalid.
354  // Parameter: const Vector & Vertex, const vector<Vector> & Vertices
355  //************************************
356  void AddVertexToTripDetonationWire( KUINT16 Index, const KDIS::DATA_TYPE::Vector & Vertex ) throw( KException );
357  void SetTripDetonationWireVertices( KUINT16 Index, const std::vector<KDIS::DATA_TYPE::Vector> & Vertices ) throw( KException );
358  void RemoveTripDetonationWire( KUINT16 Index ) throw( KException );
359  const std::vector<KDIS::DATA_TYPE::Vector> & GetWireVertices( KUINT16 Index ) throw( KException );
360  void ClearWireVertices( KUINT16 Index ) throw( KException );
361 
362  /* End of trip detonation wire functions */
363  /************************************************************************/
364 
365  //************************************
366  // FullName: KDIS::DATA_TYPE::Mine::GetLength
367  //!Description: Returns the total length of the mine including the
368  //! optional parameters that are set to true.
369  //************************************
370  KUINT16 GetLength() const;
371 
372  //************************************
373  // FullName: KDIS::DATA_TYPE::Mine::GetAsString
374  //!Description: Returns a string representation.
375  //************************************
376  virtual KString GetAsString() const;
377 
378  KBOOL operator == ( const Mine & Value ) const;
379  KBOOL operator != ( const Mine & Value ) const;
380 };
381 
382 } // END namespace DATA_TYPES
383 } // END namespace KDIS
EulerAngles m_Ori
Definition: Mine.h:69
MineFusing m_MF
Definition: Mine.h:77
virtual KDataStream Encode() const
Description: Convert To Network Data.
Definition: Mine.h:98
virtual void Decode(KDataStream &stream)
Description: Convert From Network Data.
Definition: Mine.h:97
KDIS::DATA_TYPE::MinePaintScheme m_MPS
Definition: Mine.h:81
unsigned short int KUINT16
Definition: KDefines.h:101
KUINT16 m_ui16ID
Definition: Mine.h:61
float KFLOAT32
Definition: KDefines.h:113
KUINT16 m_ui16NextIndex
Definition: Mine.h:86
std::vector< KUINT8 > m_vui8SDC
Definition: Mine.h:79
Definition: MineFusing.h:48
Definition: MinePaintScheme.h:47
Definition: Vector.h:71
Definition: KDefines.h:182
Definition: KDataStream.h:48
std::map< KUINT16, std::vector< KDIS::DATA_TYPE::Vector > > m_mvVertices
Definition: Mine.h:85
KFLOAT32 m_f32GrndOffset
Definition: Mine.h:63
KUINT8 m_ui8NumTrpDetWrs
Definition: Mine.h:83
KFLOAT32 m_f32Rflt
Definition: Mine.h:73
bool KBOOL
Definition: KDefines.h:119
ClockTime m_MET
Definition: Mine.h:75
Definition: EulerAngles.h:46
std::string KString
Definition: KDefines.h:116
KFLOAT32 m_f32SnwOffset
Definition: Mine.h:67
virtual void Encode(KDataStream &stream) const
Definition: Mine.h:101
unsigned char KUINT8
Definition: KDefines.h:99
Definition: Mine.h:55
#define KDIS_EXPORT
Definition: KDefines.h:82
KFLOAT32 m_f32WtrOffset
Definition: Mine.h:65
KFLOAT32 m_f32ThrmCont
Definition: Mine.h:71
Vector m_Loc
Definition: Mine.h:59
Definition: MinefieldDataFilter.h:49
Definition: ClockTime.h:49