moab
vtkMOABUtils.h
Go to the documentation of this file.
00001 #ifndef VTKMOABUTILS
00002 #define VTKMOABUTILS
00003 
00004 // Utility class to support use of MOAB in vtk
00005 //
00006 // mostly static variables
00007 //
00008 
00009 #include "MBInterface.hpp"
00010 #include "MBRange.hpp"
00011 #include <map>
00012 #include "vtkUnstructuredGrid.h"
00013 class vtkRenderer;
00014 class vtkActor;
00015 class vtkMapper;
00016 class vtkExtractCells;
00017 class vtkActor2D;
00018 class vtkProp;
00019 class vtkIdList;
00020 class vtkCellPicker;
00021 class vtkCallbackCommand;
00022 class vtkProperty;
00023 class vtkPropAssembly;
00024 class vtkImplicitFunction;
00025 class vtkLookupTable;
00026 class DrawDual;
00027 class DualTool;
00028 
00029 class VTK_EXPORT vtkMOABUtils //: public vtkObject
00030 {
00031 public:
00032 
00034 //  static vtkMOABUtils *New();
00035 
00037   static MBInterface *mbImpl;
00038 
00040   static DualTool *dualTool;
00041 
00043   static vtkRenderer *myRen;
00044 
00046   static vtkUnstructuredGrid *myUG;
00047   
00049   static vtkProperty *topProperty;
00050   
00052   static vtkProperty *highlightProperty;
00053   
00056   static std::map<vtkActor*, vtkProperty*> actorProperties;
00057 
00060   static std::map<vtkProp*, MBEntityHandle> propSetMap;
00061 
00063   static vtkPropAssembly *topContainsAssy;
00064   
00066   static vtkPropAssembly *topParentAssy;
00067   
00069   static MBTag vtkTopContainsTag;
00070 
00072   static const char *vtkTopContainsTagName;
00073   
00075   static MBTag vtkTopParentTag;
00076 
00078   static const char *vtkTopParentTagName;
00079   
00081   static MBTag vtkCellTag;
00082   
00084   static const char *vtkCellTagName;
00085 
00087   static MBTag vtkSetActorTag;
00088   
00090   static const char *vtkSetActorTagName;
00091 
00094   static MBTag vtkSetPropAssemblyTag;
00095   
00097   static const char *vtkSetPropAssemblyTagName;
00098 
00100   static MBTag vtkPointAllocatedTag;
00101   
00103   static const char *vtkPointAllocatedTagName;
00104 
00106   static MBRange pickedEntities;
00107 
00108   static DrawDual *drawDual;
00109   
00112   static vtkCallbackCommand *eventCallbackCommand;
00113 
00115   static MBTag globalIdTag;
00116   static MBTag globalId_tag();
00117   static MBTag categoryTag;
00118   static MBTag category_tag();
00119   
00121   static const int vtk_cell_types[];
00122 
00124   static int totalColors;
00125 
00127   static vtkLookupTable *lookupTable;
00128 
00130   static MBErrorCode init(MBInterface *impl, 
00131                           vtkRenderer *this_ren);
00132 
00134   static void make_properties();
00135 
00137   static void destroy();
00138   
00141   static MBErrorCode make_cells(MBRange &ents, 
00142                                 vtkUnstructuredGrid *&ug);
00143   
00145   static MBErrorCode make_cells(MBEntityType in_type,
00146                                 vtkUnstructuredGrid *&ug);
00147   
00149   static MBErrorCode make_cells(vtkUnstructuredGrid *&ug);
00150   
00153   static MBErrorCode make_vertex_points(vtkUnstructuredGrid *&ug);
00154   
00157   static MBErrorCode update_all_actors(MBEntityHandle this_set,
00158                                        vtkUnstructuredGrid *ug,
00159                                        const bool shaded = true,
00160                                        const bool tubed = false,
00161                                        const bool colored = false);
00162   
00165   static MBErrorCode update_set_actors(const MBRange &update_sets,
00166                                        vtkUnstructuredGrid *ug,
00167                                        const bool shaded = true,
00168                                        const bool tubed = false,
00169                                        const bool colored = false);
00170   
00172   static MBErrorCode setup_tube_filter(MBEntityHandle this_set, 
00173                                        vtkExtractCells *ec,
00174                                        vtkMapper *&this_mapper);
00175   
00177   static MBErrorCode get_id_list(MBEntityHandle this_set, vtkIdList *&ids);
00178   
00180   static MBErrorCode get_id_list(MBRange &ents, vtkIdList *&ids);
00181   
00183   static MBErrorCode empty_assy(vtkPropAssembly *this_assy);
00184 
00186   static MBErrorCode get_top_contains_sets(MBRange &top_sets);
00187   
00190   static MBErrorCode get_top_parent_sets(MBRange &top_sets);
00191 
00193   static MBErrorCode get_colors(MBEntityHandle dual_set,
00194                                 const int total_colors, int &global_id,
00195                                 double &red, double &green, double &blue);
00196   
00198   static void construct_lookup_table(const int max_scalars);
00199   
00201   static MBErrorCode set_color(MBEntityHandle dual_set,
00202                                vtkProperty *this_property,
00203                                const int total_colors = totalColors);
00204   
00207   static vtkProperty *get_property(MBEntityHandle this_set, const bool make_if_missing = false);
00208 
00211   static vtkProperty *get_property(vtkActor *this_actor, const bool make_if_missing = false);
00212 
00214   static vtkActor *get_actor(MBEntityHandle this_set,
00215                              const bool make_if_missing = false);
00216   
00218   static MBEntityHandle get_set(vtkProp *this_prop);
00219   
00221   static MBErrorCode get_set_category_name( MBEntityHandle this_set, char *this_name );
00222 
00224   static void print_debug();
00225   
00227   static void change_set_visibility( MBRange &visible_sets, MBRange &invisible_sets );
00228   
00230   static void change_set_properties(MBRange &high_mbsets, MBRange &unhigh_mbsets);
00231 
00233   static void toggle_wireframe_shaded(MBRange &high_mbsets);
00234 
00236   static void add_geom_extractors(vtkImplicitFunction *this_func);
00237 
00239   static void remove_geom_extractors();
00240 
00242   static void update_display(vtkUnstructuredGrid *ug = NULL);
00243 
00245   static void reset_drawing_data();
00246 
00248   static void assign_global_ids();
00249 
00251   static bool debug;
00252   
00253   static MBErrorCode create_tags();
00254   
00255 private:
00257   vtkMOABUtils();
00258   
00259 };
00260 
00261 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines