Isis 3 Programmer Reference
BulletTargetShape.cpp
1
6/* SPDX-License-Identifier: CC0-1.0 */
7
8#include "BulletTargetShape.h"
9#include "BulletDskShape.h"
10
11#include <iostream>
12#include <iomanip>
13#include <numeric>
14#include <sstream>
15
16#include "FileName.h"
17#include "IException.h"
18#include "IString.h"
19#include "Pvl.h"
20
21namespace Isis {
22
29 : m_maximumDistance(0) { }
30
31
38 BulletTargetShape::BulletTargetShape(btCollisionObject *btbody, const QString &name) :
39 m_name(name), m_btbody(btbody) {
41 }
42
43
48
49
55 if (m_btbody) {
56 btVector3 center;
57 m_btbody->getCollisionShape()->getBoundingSphere(center, m_maximumDistance);
59 }
60 else {
62 }
63 }
64
65
71 QString BulletTargetShape::name() const {
72 return ( m_name );
73 }
74
75
84 BulletTargetShape *BulletTargetShape::load(const QString &dem, const Pvl *conf) {
85 FileName v_file(dem);
86
87 QString ext = v_file.extension().toLower();
88
89 if ( "bds" == ext) return ( loadDSK(dem) );
90 if ( "cub" == ext) return ( loadCube(dem) );
91 return ( loadPC(dem) );
92 }
93
94
105 BulletTargetShape *BulletTargetShape::loadPC(const QString &dem, const Pvl *conf) {
106 return (0);
107 }
108
117 BulletTargetShape *BulletTargetShape::loadDSK(const QString &dem, const Pvl *conf) {
118 return ( new BulletDskShape(dem) );
119 }
120
130 BulletTargetShape *BulletTargetShape::loadCube(const QString &dem, const Pvl *conf) {
131 return (0);
132 }
133
141 void BulletTargetShape::writeBullet(const QString &btName) const {
142
143 }
144
150 btCollisionObject *BulletTargetShape::body() const {
151 return ( m_btbody.data() );
152 }
153
154
156 void BulletTargetShape::setTargetBody(btCollisionObject *body) {
157 m_btbody.reset(body);
158 m_btbody->setUserPointer(this);
160 return;
161 }
162
163 btScalar BulletTargetShape::maximumDistance() const {
164 return m_maximumDistance;
165 }
166
167} // namespace Isis
Bullet Target Shape for NAIF type 2 DSK models.
Bullet Target Shape for planetary bodies.
static BulletTargetShape * loadCube(const QString &dem, const Pvl *conf=0)
Load an ISIS cube type DEM in Bullet.
void setTargetBody(btCollisionObject *body)
Set the Bullet shape object to this object instance
static BulletTargetShape * loadDSK(const QString &dem, const Pvl *conf=0)
Load a DSK in Bullet.
btScalar m_maximumDistance
! The Bullet collision object for the body
btCollisionObject * body() const
Return a pointer to the Bullet target object/shape.
static BulletTargetShape * loadPC(const QString &dem, const Pvl *conf=0)
Load a point cloud type DEM in Bullet.
QSharedPointer< btCollisionObject > m_btbody
! The name of the body
void writeBullet(const QString &btName) const
Write a serialized version of the target shape to a Bullet file.
static BulletTargetShape * load(const QString &dem, const Pvl *conf=0)
Load a DEM file into the target shape.
QString name() const
Return name of the target shape.
void setMaximumDistance()
Calculate and save the maximum distance across the body.
BulletTargetShape()
Default empty constructor.
virtual ~BulletTargetShape()
Desctructor.
File name manipulation and expansion.
Definition FileName.h:100
Container for cube-like labels.
Definition Pvl.h:119
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16