KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
BoundingSphereRecord.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: BoundingSphereRecord
32  created: 18:08:2009
33  author: Karl Jones
34 
35  purpose: A geometry record representing a bounding sphere.
36  size: 320 bits / 40 octets
37 *********************************************************************/
38 
39 #pragma once
40 
41 #include "./EnvironmentRecord.h"
42 #include "./WorldCoordinates.h"
43 
44 namespace KDIS {
45 namespace DATA_TYPE {
46 
48 {
49 protected:
50 
52 
54 
56 
57 public:
58 
59  static const KUINT16 BOUNDING_SPHERE_RECORD_SIZE = 40;
60 
62 
63  BoundingSphereRecord( KDataStream & stream ) throw( KException );
64 
65  BoundingSphereRecord( KUINT8 Index, const WorldCoordinates & CentroidLocation, KFLOAT32 Radius );
66 
67  virtual ~BoundingSphereRecord();
68 
69  //************************************
70  // FullName: KDIS::DATA_TYPE::BoundingSphereRecord::SetCentroidLocation
71  // KDIS::DATA_TYPE::BoundingSphereRecord::GetCentroidLocation
72  //!Description: Specifies the location of the center of the sphere.
73  // Parameter: const WorldCoordinates & CL
74  //************************************
75  void SetCentroidLocation( const WorldCoordinates & CL );
76  const WorldCoordinates & GetCentroidLocation() const;
77  WorldCoordinates & GetCentroidLocation();
78 
79  //************************************
80  // FullName: KDIS::DATA_TYPE::BoundingSphereRecord::SetRadius
81  // KDIS::DATA_TYPE::BoundingSphereRecord::GetRadius
82  //!Description: Specifies the radius of the spehere in meters.
83  // Parameter: KFLOAT32 R
84  //************************************
85  void SetRadius( KFLOAT32 R );
86  KFLOAT32 GetRadius() const;
87 
88  //************************************
89  // FullName: KDIS::DATA_TYPE::BoundingSphereRecord::GetAsString
90  //!Description: Returns a string representation
91  //************************************
92  virtual KString GetAsString() const;
93 
94  //************************************
95  // FullName: KDIS::DATA_TYPE::BoundingSphereRecord::Decode
96  //!Description: Convert From Network Data.
97  // Parameter: KDataStream & stream
98  //************************************
99  virtual void Decode( KDataStream & stream ) throw( KException );
100 
101  //************************************
102  // FullName: KDIS::DATA_TYPE::BoundingSphereRecord::Encode
103  //!Description: Convert To Network Data.
104  // Parameter: KDataStream & stream
105  //************************************
106  virtual KDataStream Encode() const;
107  virtual void Encode( KDataStream & stream ) const;
108 
109  KBOOL operator == ( const BoundingSphereRecord & Value )const;
110  KBOOL operator != ( const BoundingSphereRecord & Value )const;
111 };
112 
113 } // END namespace DATA_TYPES
114 } // END namespace KDIS
unsigned int KUINT32
Definition: KDefines.h:103
unsigned short int KUINT16
Definition: KDefines.h:101
KUINT32 m_ui32Padding
Definition: BoundingSphereRecord.h:55
float KFLOAT32
Definition: KDefines.h:113
Definition: KDefines.h:182
Definition: BoundingSphereRecord.h:47
Definition: KDataStream.h:48
Definition: WorldCoordinates.h:52
bool KBOOL
Definition: KDefines.h:119
std::string KString
Definition: KDefines.h:116
unsigned char KUINT8
Definition: KDefines.h:99
KFLOAT32 m_f32Rad
Definition: BoundingSphereRecord.h:53
#define KDIS_EXPORT
Definition: KDefines.h:82
WorldCoordinates m_CentLocation
Definition: BoundingSphereRecord.h:51
Definition: EnvironmentRecord.h:59