From: Braden M. <br...@us...> - 2006-08-16 19:29:24
|
Update of /cvsroot/openvrml/openvrml/src/libopenvrml/openvrml In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22424/src/libopenvrml/openvrml Modified Files: vrml97node.cpp x3d_grouping.cpp Log Message: Replaced static_casts with boost::polymorphic_downcast. Index: x3d_grouping.cpp =================================================================== RCS file: /cvsroot/openvrml/openvrml/src/libopenvrml/openvrml/x3d_grouping.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** x3d_grouping.cpp 18 May 2006 04:11:31 -0000 1.2 --- x3d_grouping.cpp 16 Aug 2006 19:29:16 -0000 1.3 *************** *** 280,288 **** { if (context.cull_flag != bounding_volume::inside) { ! assert(dynamic_cast<const bounding_sphere *> ! (&this->bounding_volume())); const bounding_sphere & bs = ! static_cast<const bounding_sphere &>( ! this->bounding_volume()); bounding_sphere bv_copy(bs); bv_copy.transform(context.matrix()); --- 280,287 ---- { if (context.cull_flag != bounding_volume::inside) { ! using boost::polymorphic_downcast; const bounding_sphere & bs = ! *polymorphic_downcast<const bounding_sphere *>( ! &this->bounding_volume()); bounding_sphere bv_copy(bs); bv_copy.transform(context.matrix()); Index: vrml97node.cpp =================================================================== RCS file: /cvsroot/openvrml/openvrml/src/libopenvrml/openvrml/vrml97node.cpp,v retrieving revision 1.108 retrieving revision 1.109 diff -C2 -d -r1.108 -r1.109 *** vrml97node.cpp 2 Aug 2006 03:20:02 -0000 1.108 --- vrml97node.cpp 16 Aug 2006 19:29:16 -0000 1.109 *************** *** 2075,2079 **** OPENVRML_THROW1(std::bad_alloc) { ! grouping_node_base<Derived> & group = dynamic_cast<grouping_node_base<Derived> &>( this->node_event_listener::node()); --- 2075,2079 ---- OPENVRML_THROW1(std::bad_alloc) { ! grouping_node_base<Derived> & group = dynamic_cast<grouping_node_base<Derived> &>( this->node_event_listener::node()); *************** *** 2221,2229 **** { if (context.cull_flag != bounding_volume::inside) { ! assert(dynamic_cast<const bounding_sphere *> ! (&this->bounding_volume())); const bounding_sphere & bs = ! static_cast<const bounding_sphere &>( ! this->bounding_volume()); bounding_sphere bv_copy(bs); bv_copy.transform(context.matrix()); --- 2221,2228 ---- { if (context.cull_flag != bounding_volume::inside) { ! using boost::polymorphic_downcast; const bounding_sphere & bs = ! *polymorphic_downcast<const bounding_sphere *>( ! &this->bounding_volume()); bounding_sphere bv_copy(bs); bv_copy.transform(context.matrix()); *************** *** 6693,6702 **** void background_node::do_initialize(double) OPENVRML_NOTHROW { ! assert(dynamic_cast<const background_metatype *>( ! &this->type().metatype())); background_metatype & nodeClass = const_cast<background_metatype &>( ! static_cast<const background_metatype &>( ! this->type().metatype())); if (!nodeClass.has_first()) { nodeClass.set_first(*this); } } --- 6692,6700 ---- void background_node::do_initialize(double) OPENVRML_NOTHROW { ! using boost::polymorphic_downcast; background_metatype & nodeClass = const_cast<background_metatype &>( ! *polymorphic_downcast<const background_metatype *>( ! &this->type().metatype())); if (!nodeClass.has_first()) { nodeClass.set_first(*this); } } *************** *** 13488,13497 **** if (context.draw_bounding_spheres) { ! assert(dynamic_cast<const bounding_sphere *>( ! &this->bounding_volume())); const bounding_sphere & bs = ! static_cast<const bounding_sphere &>(this->bounding_volume()); ! viewer.draw_bounding_sphere(bs, ! static_cast<bounding_volume::intersection>(4)); } --- 13486,13496 ---- if (context.draw_bounding_spheres) { ! using boost::polymorphic_downcast; const bounding_sphere & bs = ! *polymorphic_downcast<const bounding_sphere *>( ! &this->bounding_volume()); ! viewer.draw_bounding_sphere( ! bs, ! static_cast<bounding_volume::intersection>(4)); } *************** *** 18202,18209 **** if (context.draw_bounding_spheres) { ! assert(dynamic_cast<const bounding_sphere *> ! (&this->bounding_volume())); const bounding_sphere & bs = ! static_cast<const bounding_sphere &>(this->bounding_volume()); viewer.draw_bounding_sphere(bs, bounding_volume::intersection(4)); } --- 18201,18208 ---- if (context.draw_bounding_spheres) { ! using boost::polymorphic_downcast; const bounding_sphere & bs = ! *polymorphic_downcast<const bounding_sphere *>( ! &this->bounding_volume()); viewer.draw_bounding_sphere(bs, bounding_volume::intersection(4)); } *************** *** 24182,24186 **** * @brief enabled exposedField implementation. */ ! /** * @brief Construct. --- 24181,24185 ---- * @brief enabled exposedField implementation. */ ! /** * @brief Construct. *************** *** 25716,25723 **** { if (context.cull_flag != bounding_volume::inside) { ! assert(dynamic_cast<const bounding_sphere *> ! (&this->bounding_volume())); const bounding_sphere & bs = ! static_cast<const bounding_sphere &>(this->bounding_volume()); bounding_sphere bv_copy(bs); bv_copy.transform(context.matrix()); --- 25715,25722 ---- { if (context.cull_flag != bounding_volume::inside) { ! using boost::polymorphic_downcast; const bounding_sphere & bs = ! *polymorphic_downcast<const bounding_sphere *>( ! &this->bounding_volume()); bounding_sphere bv_copy(bs); bv_copy.transform(context.matrix()); *************** *** 26615,26626 **** OPENVRML_NOTHROW { assert(this->scene()); this->scene()->browser().add_viewpoint(*this); - assert(dynamic_cast<const viewpoint_metatype *>( - &this->type().metatype())); viewpoint_metatype & nodeClass = const_cast<viewpoint_metatype &>( ! static_cast<const viewpoint_metatype &>( ! this->type().metatype())); if (!nodeClass.has_first()) { nodeClass.set_first(*this); } } --- 26614,26624 ---- OPENVRML_NOTHROW { + using boost::polymorphic_downcast; assert(this->scene()); this->scene()->browser().add_viewpoint(*this); viewpoint_metatype & nodeClass = const_cast<viewpoint_metatype &>( ! *polymorphic_downcast<const viewpoint_metatype *>( ! &this->type().metatype())); if (!nodeClass.has_first()) { nodeClass.set_first(*this); } } *************** *** 27202,27206 **** ! class OPENVRML_LOCAL cad_layer_node : public grouping_node_base<cad_layer_node> { --- 27200,27204 ---- ! class OPENVRML_LOCAL cad_layer_node : public grouping_node_base<cad_layer_node> { *************** *** 27230,27236 **** public: ! cad_layer_node(const node_type & type, const boost::shared_ptr<openvrml::scope> & scope); ! virtual ~cad_layer_node() throw (); virtual bool modified() const; --- 27228,27234 ---- public: ! cad_layer_node(const node_type & type, const boost::shared_ptr<openvrml::scope> & scope); ! virtual ~cad_layer_node() throw (); virtual bool modified() const; *************** *** 27312,27316 **** field_value::sfvec3f_id, "bboxSize") ! }; typedef node_type_impl<cad_layer_node> node_type_t; --- 27310,27314 ---- field_value::sfvec3f_id, "bboxSize") ! }; typedef node_type_impl<cad_layer_node> node_type_t; *************** *** 27466,27470 **** try { const std::vector<bool> & visible = this->visible_.mfbool::value(); ! const mfnode::value_type & all_children = this->children_.mfnode::value(); --- 27464,27468 ---- try { const std::vector<bool> & visible = this->visible_.mfbool::value(); ! const mfnode::value_type & all_children = this->children_.mfnode::value(); *************** *** 27575,27579 **** if (this->node::modified()) { return true; } ! mfnode::value_type::const_iterator iter = current_children_.value().begin(); for (; iter != current_children_.value().end(); ++iter) --- 27573,27577 ---- if (this->node::modified()) { return true; } ! mfnode::value_type::const_iterator iter = current_children_.value().begin(); for (; iter != current_children_.value().end(); ++iter) *************** *** 27598,27602 **** do_render_child(openvrml::viewer & viewer, const rendering_context context) { ! mfnode::value_type::const_iterator iter = current_children_.value().begin(); for (; iter != current_children_.value().end(); ++iter) --- 27596,27600 ---- do_render_child(openvrml::viewer & viewer, const rendering_context context) { ! mfnode::value_type::const_iterator iter = current_children_.value().begin(); for (; iter != current_children_.value().end(); ++iter) *************** *** 27627,27631 **** this->bsphere = bounding_sphere(); ! mfnode::value_type::const_iterator iter = current_children_.value().begin(); for (; iter != current_children_.value().end(); ++iter) --- 27625,27629 ---- this->bsphere = bounding_sphere(); ! mfnode::value_type::const_iterator iter = current_children_.value().begin(); for (; iter != current_children_.value().end(); ++iter) |