Isis 3 Programmer Reference
BulletTargetShape.cpp
Go to the documentation of this file.
1 
25 #include "BulletTargetShape.h"
26 #include "BulletDskShape.h"
27 
28 #include <iostream>
29 #include <iomanip>
30 #include <numeric>
31 #include <sstream>
32 
33 #include "FileName.h"
34 #include "IException.h"
35 #include "IString.h"
36 #include "Pvl.h"
37 
38 namespace Isis {
39 
46  : m_maximumDistance(0) { }
47 
48 
55  BulletTargetShape::BulletTargetShape(btCollisionObject *btbody, const QString &name) :
56  m_name(name), m_btbody(btbody) {
58  }
59 
60 
65 
66 
72  if (m_btbody) {
73  btVector3 center;
74  m_btbody->getCollisionShape()->getBoundingSphere(center, m_maximumDistance);
75  m_maximumDistance *= 2;
76  }
77  else {
79  }
80  }
81 
82 
88  QString BulletTargetShape::name() const {
89  return ( m_name );
90  }
91 
92 
101  BulletTargetShape *BulletTargetShape::load(const QString &dem, const Pvl *conf) {
102  FileName v_file(dem);
103 
104  QString ext = v_file.extension().toLower();
105 
106  if ( "bds" == ext) return ( loadDSK(dem) );
107  if ( "cub" == ext) return ( loadCube(dem) );
108  return ( loadPC(dem) );
109  }
110 
111 
122  BulletTargetShape *BulletTargetShape::loadPC(const QString &dem, const Pvl *conf) {
123  return (0);
124  }
125 
134  BulletTargetShape *BulletTargetShape::loadDSK(const QString &dem, const Pvl *conf) {
135  return ( new BulletDskShape(dem) );
136  }
137 
147  BulletTargetShape *BulletTargetShape::loadCube(const QString &dem, const Pvl *conf) {
148  return (0);
149  }
150 
158  void BulletTargetShape::writeBullet(const QString &btName) const {
159 
160  }
161 
167  btCollisionObject *BulletTargetShape::body() const {
168  return ( m_btbody.data() );
169  }
170 
171 
173  void BulletTargetShape::setTargetBody(btCollisionObject *body) {
174  m_btbody.reset(body);
175  m_btbody->setUserPointer(this);
177  return;
178  }
179 
180  btScalar BulletTargetShape::maximumDistance() const {
181  return m_maximumDistance;
182  }
183 
184 } // namespace Isis
void writeBullet(const QString &btName) const
Write a serialized version of the target shape to a Bullet file.
static BulletTargetShape * loadPC(const QString &dem, const Pvl *conf=0)
Load a point cloud type DEM in Bullet.
virtual ~BulletTargetShape()
Desctructor.
File name manipulation and expansion.
Definition: FileName.h:116
btScalar m_maximumDistance
! The Bullet collision object for the body
btCollisionObject * body() const
Return a pointer to the Bullet target object/shape.
static BulletTargetShape * load(const QString &dem, const Pvl *conf=0)
Load a DEM file into the target shape.
static BulletTargetShape * loadDSK(const QString &dem, const Pvl *conf=0)
Load a DSK in Bullet.
void setMaximumDistance()
Calculate and save the maximum distance across the body.
void setTargetBody(btCollisionObject *body)
Set the Bullet shape object to this object instance.
static BulletTargetShape * loadCube(const QString &dem, const Pvl *conf=0)
Load an ISIS cube type DEM in Bullet.
QSharedPointer< btCollisionObject > m_btbody
! The name of the body
Container for cube-like labels.
Definition: Pvl.h:135
QString name() const
Return name of the target shape.
Bullet Target Shape for NAIF type 2 DSK models.
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
BulletTargetShape()
Default empty constructor.
QString extension() const
Returns the last extension of the file name.
Definition: FileName.cpp:194
Bullet Target Shape for planetary bodies.