cgma
DagDrawingTool.hpp
Go to the documentation of this file.
00001 
00002 #include "CubitDefines.h"
00003 
00004 #include "TopologyEntity.hpp"
00005 //for CubitLink definintion
00006 
00007 class RefFace;
00008 class RefEdge;
00009 class RefVertex;
00010 class RefVolume;
00011 template <class X> class DLIList;
00012 class RefEntity;
00013 
00014 class RefEntity;
00015 class TopologyEntity;
00016 
00017 class TopologyEntity;
00018 class RefVertex;
00019 class RefEdge;
00020 class RefFace;
00021 class RefVolume;
00022 class Body;
00023 class TopologyEntity;
00024 
00025 class CUBIT_GEOM_EXPORT DagNodeRow
00026 {
00027     public:
00028     
00029     DagNodeRow( DLIList<TopologyEntity*>& node_list );
00030         ~DagNodeRow();
00031     
00032         int length() const { return length_; }
00033     TopologyEntity*& operator[]( int index );
00034         
00035     protected:
00036     TopologyEntity** array_;
00037         int length_;
00038 };
00039 
00040 class CUBIT_GEOM_EXPORT DagNodeTable
00041 {
00042     public:
00043     
00044         DagNodeTable( int num_rows );
00045         ~DagNodeTable();
00046         
00047         int rows() const { return length_; }
00048         
00049         DagNodeRow& operator[]( int row );
00050     
00051     protected:
00052         DagNodeRow** array_;
00053         int length_;
00054 };
00055 
00056 class CUBIT_GEOM_EXPORT DagDrawingTool
00057 {
00058   public:
00059     
00060   static DagDrawingTool* instance();
00061   ~DagDrawingTool();
00062 /*      
00063         void draw_DAG( DLIList<Body*>&      body_list,           int down );
00064         void draw_DAG( DLIList<RefVolume*>& volume_list, int up, int down );
00065         void draw_DAG( DLIList<RefFace*>&   face_list,   int up, int down );
00066         void draw_DAG( DLIList<RefEdge*>&   edge_list,   int up, int down );
00067         void draw_DAG( DLIList<RefVertex*>& vertex_list, int up           );
00068         void draw_DAG( Body*      body,           int down );
00069         void draw_DAG( RefVolume* volume, int up, int down );
00070         void draw_DAG( RefFace*   face,   int up, int down );
00071         void draw_DAG( RefEdge*   edge,   int up, int down );
00072         void draw_DAG( RefVertex* vertex, int up           );
00073 */      
00074     
00075 //    void draw_host_parasite_links( CubitBoolean yes_no );
00076 //    CubitBoolean draw_host_parasite_links() const;
00077 /*      
00078         //Ways to label RefEntities:
00079         void label_ref_entity_name() { ref_entity_label_type_ = 0; }
00080         //Label with RefEntity::entity_name()
00081         void label_ref_entity_type() { ref_entity_label_type_ = 1; }
00082         //Label with type (e.g. curve) and id
00083         void label_ref_entity_short() { ref_entity_label_type_ = 2; }
00084         //Label with abbreviation and id
00085         //Body->B, RefVolume->Vm, RefFace->F, RefEdge->E, RefVertex->Vx
00086         void label_ref_entity_id() { ref_entity_label_type_ = 3; }
00087         //Label with id only
00088         
00089         //Ways to label entities other than RefEntities:
00090         void label_other_type() { other_entity_label_type_ = 0; }
00091         //Label with type (e.g. CoEdge)
00092         void label_other_short() { other_entity_label_type_ = 1; }
00093         //Label with abbreviations
00094         //CoVolume->CVm, CoFace->CF, CoEdge->CE, CoVertex->CVx
00095         //Shell->Sh, Loop->L, Chain->Ch 
00096         void label_other_none() { other_entity_label_type_ = 2; }
00097         //Do not show any labels for other entities.
00098         
00099         void primary_link_color( int color );
00100         int primary_link_color() const;
00101         //Color to draw primary links in.
00102 
00103         void secondary_link_color( int color );
00104         int secondary_link_color() const;
00105         //Color to draw secondary (directional) links in.
00106         
00107         void bad_link_color( int color );
00108         int bad_link_color() const;
00109         //Color to draw broken links in 
00110         //(hopefully you won't see any of these)
00111     
00112     void host_para_link_color( int color );
00113     int host_para_link_color() const;
00114         
00115         void node_color( int color );
00116         int node_color() const;
00117         //Color to draw nodes in,
00118         //(This currently has no effect.)
00119         
00120         void label_color( int color );
00121         int label_color() const;
00122         //Color to draw node labels in
00123         
00124         void background_color( int color );
00125         int background_color() const;
00126         //Color of the background
00127         
00128         int window_id() const;
00129         //The last window drawn in my DagDrawingTool
00130 */  
00131   
00133   void printDag(DLIList<RefFace*> &face_list, int depth);
00134 
00136   void printDag(DLIList<Body*> &body_list, int depth);
00137 
00139   void printDag(DLIList<TopologyEntity*> &entity_list, int depth);
00140   
00142   void printDag( TopologyEntity* ME_ptr, int depth );
00143 
00144     protected:
00145     
00146         DagDrawingTool();
00147         static DagDrawingTool* instance_;
00148     
00149         void draw_DAG( DLIList<RefEntity*>& enity_list, int up, int down );
00150     void draw_DAG( DLIList<TopologyEntity*>& node_list, int up, int down );
00151 
00152 //      void draw_table( );
00153         
00154     //const char* name( TopologyEntity* node_ptr );
00155         //const char* name( int row, int index );
00156         //int name_width( int row );
00157     //int name_width( TopologyEntity* node_ptr );
00158         
00159         //direction-indenpendent query stuff:
00160     void get_relatives( TopologyEntity* node_ptr,
00161                         DLIList<TopologyEntity*>& result_set,
00162                             int direction );
00163     void get_relatives( DLIList<TopologyEntity*>& source_set,
00164                         DLIList<TopologyEntity*>& result_set,
00165                                                 int direction );
00166     int link_type( TopologyEntity* source_node,
00167                    TopologyEntity* target_node,
00168                        int direction );
00169         int link_type( int source_row, int source_index,
00170                        int target_row, int target_index );
00171                        
00172         void position( int row, int index, float& x, float& y );
00173                 /*
00174         void draw_node( int row, int index );
00175         void draw_link( int source_row, int source_index,
00176                         int target_row, int target_index );
00177    void draw_host_link( int row, int source_index, int target_index );
00178 
00179 
00180         //The only methods that interact with drawing tool
00181         void draw_link( float x1, float y1, float x2, float y2, int type );
00182     void draw_host_link( float x1, float x2, float y, int top );
00183     void draw_node( float x, float y, TopologyEntity* node );
00184         void draw_ellipse( float cx, float cy, float rx, float ry, int color );
00185     void draw_arc_link( float x1, float y1, float x2, float y2 );
00186         void initialize_graphics();
00187         void finalize_graphics();
00188         float text_height() const;
00189         float arrow_size() const;
00190                 */
00191     
00192     private:
00193     
00194   void print_dag( TopologyEntity* node_ptr, int depth );
00195   
00196   void print_dag( TopologyEntity* node_ptr, int indent, int depth );
00197   
00198   void print_node( TopologyEntity* node_ptr, int indent, const char* prefix);
00199   
00200   int get_id( TopologyEntity* node_ptr );
00201   
00202         void one_sort_pass( int start_row, int end_row, float* temp_array );
00203     
00204     void sort_row( int row, int rel_row /*1 or -1*/ );
00205     
00206     /*
00207         int window_id_;
00208         int active_window_;
00209 
00210         int prim_link_color_;
00211         int sec_link_color_;
00212         int bad_link_color_;
00213         int node_color_;
00214         int label_color_;
00215         int background_color_;
00216     int host_para_color_;
00217 
00218         CubitLink link_type_;
00219     CubitBoolean draw_host_para_links_;
00220         
00221         int ref_entity_label_type_;
00222         // 0  use RefEntity:entity_name()
00223         // 1  use type and id
00224         // 2  use abbreviated type and id
00225         // 3  use only id
00226         
00227         int other_entity_label_type_;
00228         // 0  use type name
00229         // 1  use abbreviated type name
00230         // 2  no label
00231               */
00232         
00233         //Working data
00234         DagNodeTable* node_table;
00235 };
00236 
00237 class DagListTool
00238 {
00239 public:
00240     
00241 };
00242   
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines