mesh_object_switcher.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2011, Willow Garage, Inc.
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions are met:
00007  *
00008  *     * Redistributions of source code must retain the above copyright
00009  *       notice, this list of conditions and the following disclaimer.
00010  *     * Redistributions in binary form must reproduce the above copyright
00011  *       notice, this list of conditions and the following disclaimer in the
00012  *       documentation and/or other materials provided with the distribution.
00013  *     * Neither the name of the Willow Garage, Inc. nor the names of its
00014  *       contributors may be used to endorse or promote products derived from
00015  *       this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00021  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00022  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00023  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00024  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00025  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00026  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00027  * POSSIBILITY OF SUCH DAMAGE.
00028  */
00029 
00030 #ifndef MESH_OBJECT_SWITCHER_H_
00031 #define MESH_OBJECT_SWITCHER_H_
00032 
00033 #include <string>
00034 #include <vector>
00035 
00036 #include <boost/shared_ptr.hpp>
00037 
00038 namespace rviz_interaction_tools
00039 {
00040 
00041 class MeshObject;
00042 
00043 // allows to switch between different meshes and display modes
00044 class MeshObjectSwitcher
00045 {
00046 public:
00047 
00049   MeshObjectSwitcher( std::string valid_mat_name,
00050       std::string valid_sel_mat_name,
00051       std::string invalid_mat_name,
00052       std::string invalid_sel_mat_name );
00053 
00054   virtual ~MeshObjectSwitcher();
00055 
00056   // add another mesh object to the list (take ownership)
00057   void addObject( MeshObject* mesh_object );
00058 
00059   // change the currently visible mesh
00060   void setVisible( unsigned index );
00061 
00062   // change 'valid' flag
00063   void setValid( bool valid );
00064 
00065   // change 'selected' flag
00066   void setSelected( bool selected );
00067 
00069   void next( );
00070 
00072   unsigned getVisible( ) { return visible_mesh_; }
00073 
00074   unsigned isValid( ) { return valid_; }
00075   unsigned isSelected( ) { return selected_; }
00076 
00078   unsigned size( ) { return mesh_objects_.size(); }
00079 
00080 private:
00081 
00082   void updateMaterials();
00083 
00084   MeshObjectSwitcher( const MeshObjectSwitcher& );
00085   MeshObjectSwitcher& operator=( const MeshObjectSwitcher& );
00086 
00087   std::vector< boost::shared_ptr<MeshObject> > mesh_objects_;
00088 
00089   unsigned visible_mesh_;
00090 
00091   bool valid_;
00092   bool selected_;
00093 
00094   std::string valid_mat_name_;
00095   std::string valid_sel_mat_name_;
00096   std::string invalid_mat_name_;
00097   std::string invalid_sel_mat_name_;
00098 };
00099 
00100 }
00101 
00102 #endif /* MESH_OBJECT_SWITCHER_H_ */


rviz_interaction_tools
Author(s): David Gossow
autogenerated on Mon Oct 6 2014 03:03:25