KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
PointObjectAppearance.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: PointObjectAppearance
32  created: 17/02/2010
33  author: Karl Jones
34 
35  purpose: Represents a point objects appearance.
36  size: 48 Bits / 6 Octet
37 *********************************************************************/
38 
39 #pragma once
40 
41 #include "./ObjectAppearance.h"
42 
43 namespace KDIS {
44 namespace DATA_TYPE {
45 
47 {
48 protected:
49 
50  union
51  {
52  struct
53  {
54  KUINT32 m_ui32Breach : 2;
55  KUINT32 m_ui32Unused : 30;
56  } m_LogCribAbatisVehicleDefiladeInf;
57 
58  struct
59  {
60  KUINT32 m_ui32Opacity : 8;
61  KUINT32 m_ui32Size : 8;
62  KUINT32 m_ui32Height : 8;
63  KUINT32 m_ui32NumBurst : 6;
64  KUINT32 m_ui32Chemical : 2;
65 
66  } m_AirBurstGroundBurst;
67 
68  struct
69  {
70  KUINT32 m_ui32Size : 8;
71  KUINT32 m_ui32Unused : 24;
72 
73  } m_Crater;
74 
75  struct
76  {
77  KUINT32 m_ui32NumSeg : 8;
78  KUINT32 m_ui32Unused : 24;
79  } m_RibbonBridge;
80 
82  } m_SpecificAppearanceUnion;
83 
84 public:
85 
86  static const KUINT16 POINT_OBJECT_APPEARANCE_SIZE = 6;
87 
89 
90  PointObjectAppearance( KDataStream & stream ) throw( KException );
91 
92  virtual ~PointObjectAppearance();
93 
94  /************************************************************************/
95  /* The following appearance values are only for points of the type: */
96  /* Log crib, Abatis, Vehicle defilade, and Infantry fighting position */
97  /************************************************************************/
98 
99  //************************************
100  // FullName: KDIS::DATA_TYPE::PointObjectAppearance::SetBreach
101  // KDIS::DATA_TYPE::PointObjectAppearance::GetBreach
102  //!Description: Describes the breached appearance of the object.
103  // Parameter: Breach2bit B
104  //************************************
105  void SetBreach( KDIS::DATA_TYPE::ENUMS::Breach2bit B );
106  KDIS::DATA_TYPE::ENUMS::Breach2bit GetBreach() const;
107 
108  /************************************************************************/
109  /* The following appearance values are only for points of the type: */
110  /* Air burst, Ground burst */
111  /************************************************************************/
112 
113  //************************************
114  // FullName: KDIS::DATA_TYPE::PointObjectAppearance::SetOpacity
115  // KDIS::DATA_TYPE::PointObjectAppearance::GetOpacity
116  //!Description: The percent opacity of the smoke, ranging from 0% opacity to 100%.
117  //! Acceptable values are 0 - 100 else throws INVALID_DATA exception.
118  // Parameter: KUINT8 O
119  //************************************
120  void SetOpacity( KUINT8 O ) throw( KException );
121  KUINT8 GetOpacity() const;
122 
123  //************************************
124  // FullName: KDIS::DATA_TYPE::PointObjectAppearance::SetBurstSize
125  // KDIS::DATA_TYPE::PointObjectAppearance::GetBurstSize
126  //!Description: Indicates the radius of the cylinder which approximates
127  //! an individual burst. The Point Object Location field
128  //! indicates the center of the bottom of the cylinder
129  //! for individual bursts. For multiple bursts, the center
130  //! bottom of each cylinder is calculated based on the model
131  //! used to represent the multiple bursts.
132  // Parameter: KUINT8 S
133  //************************************
134  void SetBurstSize( KUINT8 S );
135  KUINT8 GetBurstSize() const;
136 
137  //************************************
138  // FullName: KDIS::DATA_TYPE::PointObjectAppearance::SetHeight
139  // KDIS::DATA_TYPE::PointObjectAppearance::GetHeight
140  //!Description: The height of the cylinder which approximates an individual burst.
141  //! The Point Object Location field indicates the center of the bottom
142  //! of the cylinder for individual bursts. For multiple bursts,
143  //! the center bottom of each cylinder is calculated based on the
144  //! model used to represent the multiple bursts.
145  // Parameter: KUINT8 H
146  //************************************
147  void SetHeight( KUINT8 H );
148  KUINT8 GetHeight() const;
149 
150  //************************************
151  // FullName: KDIS::DATA_TYPE::PointObjectAppearance::SetNumBursts
152  // KDIS::DATA_TYPE::PointObjectAppearance::GetNumBursts
153  //!Description: Number of bursts in the instance of tactical smoke.
154  //! Acceptable values are 0 - 63.
155  // Parameter: KUINT8 H
156  //************************************
157  void SetNumBursts( KUINT8 N );
158  KUINT8 GetNumBursts() const;
159 
160  //************************************
161  // FullName: KDIS::DATA_TYPE::PointObjectAppearance::SetChemical
162  // KDIS::DATA_TYPE::PointObjectAppearance::GetChemical
163  //!Description: The chemical content of the smoke.
164  // Parameter: Chemical C
165  //************************************
166  void SetChemical( KDIS::DATA_TYPE::ENUMS::Chemical C );
167  KDIS::DATA_TYPE::ENUMS::Chemical GetChemical() const;
168 
169  /************************************************************************/
170  /* The following appearance values are only for points of the type: */
171  /* Crater */
172  /************************************************************************/
173 
174  //************************************
175  // FullName: KDIS::DATA_TYPE::PointObjectAppearance::SetCraterSize
176  // KDIS::DATA_TYPE::PointObjectAppearance::GetCraterSize
177  //!Description: The diameter of the crater, where the center of the
178  //! crater is at the Point Object Location.
179  // Parameter: KUINT8 S
180  //************************************
181  void SetCraterSize( KUINT8 S );
182  KUINT8 GetCraterSize() const;
183 
184  /************************************************************************/
185  /* The following appearance values are only for points of the type: */
186  /* Ribbon Bridge */
187  /************************************************************************/
188 
189  //************************************
190  // FullName: KDIS::DATA_TYPE::PointObjectAppearance::SetNumSegments
191  // KDIS::DATA_TYPE::PointObjectAppearance::GetNumSegments
192  //!Description: The number of segments composing the ribbon bridge.
193  // Parameter: KUINT8 N
194  //************************************
195  void SetNumSegments( KUINT8 N );
196  KUINT8 GetNumSegments() const;
197 
198  //************************************
199  // FullName: KDIS::DATA_TYPE::PointObjectAppearance::GetAsString
200  //!Description: Returns a string representation of the appearance
201  // Parameter: const EntityType & EntType
202  //************************************
203  virtual KString GetAsString() const;
204 
205  //************************************
206  // FullName: KDIS::DATA_TYPE::PointObjectAppearance::Decode
207  //!Description: Convert From Network Data.
208  // Parameter: KDataStream & stream
209  //************************************
210  virtual void Decode( KDataStream & stream ) throw( KException );
211 
212  //************************************
213  // FullName: KDIS::DATA_TYPE::PointObjectAppearance::Encode
214  //!Description: Convert To Network Data.
215  // Parameter: KDataStream & stream
216  //************************************
217  virtual KDataStream Encode() const;
218  virtual void Encode( KDataStream & stream ) const;
219 
220  KBOOL operator == ( const PointObjectAppearance & Value ) const;
221  KBOOL operator != ( const PointObjectAppearance & Value ) const;
222 };
223 
224 } // END namespace DATA_TYPES
225 } // END namespace KDIS
unsigned int KUINT32
Definition: KDefines.h:103
KUINT32 m_ui32SpecificAppearance
Definition: PointObjectAppearance.h:81
unsigned short int KUINT16
Definition: KDefines.h:101
Breach2bit
Definition: EnumSyntheticEnviroment.h:196
Definition: KDefines.h:182
Definition: KDataStream.h:48
Chemical
Definition: EnumSyntheticEnviroment.h:217
bool KBOOL
Definition: KDefines.h:119
Definition: PointObjectAppearance.h:46
std::string KString
Definition: KDefines.h:116
unsigned char KUINT8
Definition: KDefines.h:99
Definition: ObjectAppearance.h:46
#define KDIS_EXPORT
Definition: KDefines.h:82