Follow this link to skip to the main content

claraty::Composite_Bounding_Shape Class Reference

#include <bounding_shape.h>

Inheritance diagram for claraty::Composite_Bounding_Shape:

Inheritance graph
[legend]
Collaboration diagram for claraty::Composite_Bounding_Shape:

Collaboration graph
[legend]
List of all members.

Public Member Functions

Observers
bool empty ()
Tree< Bounding_Shape > & get_shape_tree ()
N_3D_Objectget_3d_object ()
Composite_Bounding_Shapeget_composite_bounding_shape ()
Mutators
void insert (Bounding_Shape *bounding_shape)
void insert_at_root (Bounding_Shape *bounding_shape)
void copy (Composite_Bounding_Shape &composite_bounding_shape)
void clear_tree ()
Observers
std::string get_name ()
std::string get_parent_name ()
bool get_containment ()
bool get_alignment ()
bool get_collision ()
Transformget_transform ()
Mutators
void set_name (std::string name)
void set_parent_name (std::string parent_name)
void set_containment (bool containment)
void set_alignment (bool alignment)
void set_collision (bool collision)
void set_tolerance (double tolerance)
double & get_tolerance ()
void set (Transform &transform)
void set (N_3D_Object &N_3D_object)

Private Member Functions

Bounding_Shape_get_top_level_bounding_shape ()

Private Attributes

Tree< Bounding_Shape_bounding_shape_tree

Friends

std::ostream & operator<< (std::ostream &os, Composite_Bounding_Shape &composite_bounding_shape)

Detailed Description

Definition at line 97 of file bounding_shape.h.


Member Function Documentation

bool claraty::Composite_Bounding_Shape::empty (  ) 

Return true if tree is empty, false if not

Returns:
True if tree is empty and false if it is not empty.

Definition at line 444 of file bounding_shape.cc.

References _bounding_shape_tree.

Referenced by claraty::ME_Body::~ME_Body().

00445 {
00446   return _bounding_shape_tree.empty();
00447 }

Tree< Bounding_Shape > & claraty::Composite_Bounding_Shape::get_shape_tree (  ) 

Get the tree

Returns:
The tree.

Definition at line 468 of file bounding_shape.cc.

References _bounding_shape_tree.

Referenced by _get_top_level_bounding_shape(), and claraty::operator<<().

00469 {
00470   return _bounding_shape_tree;
00471 }

N_3D_Object& claraty::Composite_Bounding_Shape::get_3d_object (  )  [inline]

Get shape object

Returns:
Shape

Reimplemented from claraty::Bounding_Shape.

Definition at line 106 of file bounding_shape.h.

References _get_top_level_bounding_shape(), and claraty::Bounding_Shape::get_3d_object().

Referenced by claraty::Wheel_Model::_compute_wheel_radius().

00106 { return _get_top_level_bounding_shape().get_3d_object();}

Here is the call graph for this function:

Composite_Bounding_Shape* claraty::Composite_Bounding_Shape::get_composite_bounding_shape (  )  [inline]

Definition at line 107 of file bounding_shape.h.

00108   {
00109     return this;
00110   };

void claraty::Composite_Bounding_Shape::insert ( Bounding_Shape bounding_shape  ) 

Insert a bounding_shape object to the bounding_shape tree

Parameters:
[in] bounding_shape Shape to be inserted into the tree.

Definition at line 378 of file bounding_shape.cc.

References _bounding_shape_tree, and claraty::Bounding_Shape::get_parent_name().

Referenced by claraty::ME_Body::create_bounding_shape(), claraty::ME_Body_IO::extract_from_parse_tree(), and claraty::ME_Body::ME_Body().

00379 {
00380   bool attached_new_node = false;
00381 
00382   Tree<Bounding_Shape>::Pre_Order_Iterator p_shape_tree_itr
00383     = _bounding_shape_tree.begin_pre_order();
00384   Tree<Bounding_Shape>::Pre_Order_Iterator p_end_shape_tree_itr
00385     = _bounding_shape_tree.end_pre_order();
00386   for (; p_shape_tree_itr < p_end_shape_tree_itr; ++p_shape_tree_itr)
00387     {
00388       if (p_shape_tree_itr->get_name() == bounding_shape->get_parent_name())
00389         {
00390           _bounding_shape_tree.append_child(p_shape_tree_itr, bounding_shape);
00391           attached_new_node = true;
00392           break;
00393         }
00394     }
00395   if ((!attached_new_node)||
00396       (bounding_shape->get_parent_name().length() == 0))
00397     // If parent name wasn't found or name string length is zero, attach to root
00398     {
00399       Tree<Bounding_Shape>::Pre_Order_Iterator p_shape_tree_itr
00400         = _bounding_shape_tree.begin_pre_order();
00401       _bounding_shape_tree.append_child(p_shape_tree_itr, bounding_shape);
00402       attached_new_node = true;
00403     }
00404 }

Here is the call graph for this function:

void claraty::Composite_Bounding_Shape::insert_at_root ( Bounding_Shape bounding_shape  ) 

Insert a bounding_shape object at the root of the bounding_shape tree

Parameters:
[in] bounding_shape Object to be inserted at the root of the tree.

Definition at line 414 of file bounding_shape.cc.

References _bounding_shape_tree.

00415 {
00416   Tree<Bounding_Shape>::Pre_Order_Iterator p_shape_tree_itr
00417     = _bounding_shape_tree.begin_pre_order();
00418   _bounding_shape_tree.append_child(p_shape_tree_itr, bounding_shape);
00419 }

void claraty::Composite_Bounding_Shape::copy ( Composite_Bounding_Shape composite_bounding_shape  ) 

Copy of the tree to this bounding_shape tree

Parameters:
[in] composite_bounding_shape 

Definition at line 430 of file bounding_shape.cc.

References _bounding_shape_tree.

00431 {
00432   _bounding_shape_tree.copy(composite_bounding_shape._bounding_shape_tree);
00433 }

void claraty::Composite_Bounding_Shape::clear_tree (  ) 

Clear the tree

Definition at line 455 of file bounding_shape.cc.

References _bounding_shape_tree.

Referenced by claraty::ME_Body::~ME_Body().

00456 {
00457   return _bounding_shape_tree.clear_tree();
00458 }

Bounding_Shape & claraty::Composite_Bounding_Shape::_get_top_level_bounding_shape (  )  [private]

Return the top-level bounding_shape object in the composite

Returns:
ostream with the level bounding shape.

Definition at line 506 of file bounding_shape.cc.

References get_shape_tree().

Referenced by get_3d_object().

00507 {
00508   Tree<Bounding_Shape>::Pre_Order_Iterator p_shape_tree_itr
00509     = get_shape_tree().begin_pre_order();
00510 
00511   ++p_shape_tree_itr;
00512   return *p_shape_tree_itr;
00513 
00514 }//----------------------------------------------------------------------------

Here is the call graph for this function:

std::string claraty::Bounding_Shape::get_name (  )  [inherited]

Get name parameter of the bouding shape.

Returns:
Bounding shape name

Definition at line 106 of file bounding_shape.cc.

References claraty::Bounding_Shape::_name.

Referenced by claraty::operator<<().

00107 {
00108   return _name;
00109 }

std::string claraty::Bounding_Shape::get_parent_name (  )  [inherited]

Get parent name parameter

Returns:
enum type

Definition at line 134 of file bounding_shape.cc.

References claraty::Bounding_Shape::_parent_name.

Referenced by insert(), and claraty::operator<<().

00135 {
00136   return _parent_name;
00137 }

bool claraty::Bounding_Shape::get_containment (  )  [inherited]

Get containment parameter

Returns:
A boolean if _is_containiner returns true.

Definition at line 164 of file bounding_shape.cc.

References claraty::Bounding_Shape::_is_container.

Referenced by claraty::operator<<().

00165 {
00166   return _is_container;
00167 }

bool claraty::Bounding_Shape::get_alignment (  )  [inherited]

Get alignment parameter

Returns:
booliean indicating alignment.

Definition at line 192 of file bounding_shape.cc.

References claraty::Bounding_Shape::_is_aligned.

Referenced by claraty::operator<<().

00193 {
00194   return _is_aligned;
00195 }

bool claraty::Bounding_Shape::get_collision (  )  [inherited]

Get collision parameter

Returns:
Collision boolean.

Definition at line 220 of file bounding_shape.cc.

References claraty::Bounding_Shape::_ignore_collisions.

Referenced by claraty::operator<<().

00221 {
00222   return _ignore_collisions;
00223 }

Transform & claraty::Bounding_Shape::get_transform (  )  [inherited]

Get transform

Returns:
Transform.

Definition at line 276 of file bounding_shape.cc.

References claraty::Bounding_Shape::_transform.

Referenced by claraty::Bounding_Shape_IO::extract_from_parse_tree(), and claraty::operator<<().

00277 {
00278   return _transform;
00279 }

void claraty::Bounding_Shape::set_name ( std::string  name  )  [inherited]

Set name parameter

Parameters:
[in] name The name of the bounding shape.
Returns:
void

Definition at line 91 of file bounding_shape.cc.

References claraty::Bounding_Shape::_name.

Referenced by claraty::Bounding_Shape_IO::extract_from_parse_tree().

00092 {
00093   _name = name;
00094 }

void claraty::Bounding_Shape::set_parent_name ( std::string  parent_name  )  [inherited]

Set parent name parameter

Parameters:
[in] parent_name The name of the parent.

Definition at line 120 of file bounding_shape.cc.

References claraty::Bounding_Shape::_parent_name.

Referenced by claraty::Bounding_Shape_IO::extract_from_parse_tree().

00121 {
00122   _parent_name = parent_name;
00123 }

void claraty::Bounding_Shape::set_containment ( bool  containment  )  [inherited]

Set containment parameter

Parameters:
[in] containment 
Returns:
enum type

Definition at line 150 of file bounding_shape.cc.

References claraty::Bounding_Shape::_is_container.

Referenced by claraty::Bounding_Shape_IO::extract_from_parse_tree().

00151 {
00152   _is_container = containment;
00153 }

void claraty::Bounding_Shape::set_alignment ( bool  alignment  )  [inherited]

Set alignment parameter

Parameters:
[in] alignment 

Definition at line 178 of file bounding_shape.cc.

References claraty::Bounding_Shape::_is_aligned.

Referenced by claraty::Bounding_Shape_IO::extract_from_parse_tree().

00179 {
00180   _is_aligned = alignment;
00181 }

void claraty::Bounding_Shape::set_collision ( bool  collision  )  [inherited]

Set collision parameter

Parameters:
[in] collision Set boolean value.

Definition at line 206 of file bounding_shape.cc.

References claraty::Bounding_Shape::_ignore_collisions.

Referenced by claraty::Bounding_Shape_IO::extract_from_parse_tree().

00207 {
00208   _ignore_collisions = collision;
00209 }

void claraty::Bounding_Shape::set_tolerance ( double  tolerance  )  [inherited]

Set tollerance parameter

Parameters:
[in] tolerance 

Definition at line 234 of file bounding_shape.cc.

References claraty::Bounding_Shape::_tol.

Referenced by claraty::Bounding_Shape_IO::extract_from_parse_tree().

00235 {
00236   _tol = tolerance;
00237 }

double & claraty::Bounding_Shape::get_tolerance (  )  [inherited]

Get tollerance parameter

Returns:
Tolerance.

Definition at line 248 of file bounding_shape.cc.

References claraty::Bounding_Shape::_tol.

Referenced by claraty::operator<<().

00249 {
00250   return _tol;
00251 }

void claraty::Bounding_Shape::set ( Transform transform  )  [inherited]

Set transform

Parameters:
[in] transform 

Definition at line 262 of file bounding_shape.cc.

References claraty::Bounding_Shape::_transform.

00263 {
00264   _transform = transform;
00265 }

void claraty::Bounding_Shape::set ( N_3D_Object three_d_object  )  [inherited]

Set shape object

Parameters:
[in] three_d_object 

Definition at line 290 of file bounding_shape.cc.

References claraty::Bounding_Shape::_three_d_object.

00291 {
00292   _three_d_object = three_d_object;
00293 }


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
Composite_Bounding_Shape composite_bounding_shape 
) [friend]

Output to ostream

Parameters:
[out] os ostream to put output on.
[in] composite_bounding_shape The object to be output.
Returns:
ostream with output on it.

Definition at line 482 of file bounding_shape.cc.

00484 {
00485   Tree<Bounding_Shape>::Pre_Order_Iterator p_shape_tree_itr
00486     = composite_bounding_shape.get_shape_tree().begin_pre_order();
00487   Tree<Bounding_Shape>::Pre_Order_Iterator p_end_shape_tree_itr
00488     = composite_bounding_shape.get_shape_tree().end_pre_order();
00489   
00490   ++p_shape_tree_itr; // Skip the root object of the object tree
00491   
00492   for (; p_shape_tree_itr < p_end_shape_tree_itr; ++p_shape_tree_itr)
00493     {
00494       os << *p_shape_tree_itr;
00495     }
00496   return os;
00497 }


Member Data Documentation


The documentation for this class was generated from the following files: