GraphDrawingAttributes.h

Go to the documentation of this file.
00001 // Copyright (C) 2005 Alexander Ushakov
00002 // Contents: Definition of the graph concept
00003 //
00004 // Principal Authors: Alexander Ushakov
00005 //
00006 
00007 
00008 #ifndef _GraphDrawingAttributes_H_
00009 #define _GraphDrawingAttributes_H_
00010 
00011 
00012 #include "tuples.h"
00013 #include "map"
00014 #include "set"
00015 using namespace std;
00016 
00017 //---------------------------------------------------------------------------//
00018 //-------------------------- GraphDrawingAttributes -------------------------//
00019 //---------------------------------------------------------------------------//
00020 
00021 
00022 class GraphDrawingAttributes
00023 {
00025   //                                                     //
00026   //  Internal types:                                    //
00027   //                                                     //
00029 
00030  public:
00031 
00032   typedef triple< int , int , int > COLOR;
00033   enum NODESHAPE { 
00034     box , polygon  , ellipse , circle , point , egg , triangle , plaintext , diamond , trapezium ,
00035     parallelogram , house  , pentagon , hexagon , septagon , octagon , doublecircle , doubleoctagon ,
00036     tripleoctagon , invtriangle , invtrapezium , invhouse , Mdiamond , Msquare , Mcircle , rect ,
00037     rectangle , none };
00038   
00040   //                                                     //
00041   //  Constructors                                       //
00042   //                                                     //
00044  public:
00045   
00046   GraphDrawingAttributes( ) : 
00047     theDefaultNodeColor( 0 , 120 , 120 ),
00048     theDefaultNodeShape( circle ) { }
00049   
00050   
00052   //                                                     //
00053   //  Accessors                                          //
00054   //                                                     //
00056  public:
00057 
00059   void setNodeColor( int v , const COLOR& c ) { nodeColor[v] = c; }
00061   COLOR getNodeColor( int v ) const { 
00062     if( nodeColor.find(v)==nodeColor.end( ) ) 
00063       return theDefaultNodeColor;
00064     return nodeColor[v];
00065   }
00066 
00068   void setNodeShape( int v , const NODESHAPE& s ) { nodeShape[v] = s; }
00070   NODESHAPE getNodeShape( int v ) const {
00071     if( nodeShape.find(v)==nodeShape.end( ) ) 
00072       return theDefaultNodeShape;
00073     return nodeShape[v];
00074   }
00075 
00076   void setDefaultNodeShape( const NODESHAPE& s ) { theDefaultNodeShape = s; }
00077   
00078   static const map< int , string >& getNodeShapeNames( ) { return nodeShapeNames; }
00079   
00080   
00082   //                                                     //
00083   //  Internal functions                                 //
00084   //                                                     //
00086  private:
00087   
00088   static map< int , string > initializeNodeShapeNames( );
00089   
00091   //                                                     //
00092   //  Data members                                       //
00093   //                                                     //
00095  private:
00096 
00097   // The default color for nodes (of nodes that are not out of "nodeColor").
00098   COLOR theDefaultNodeColor;
00099   // Colors of nodes.
00100   map< int , COLOR > nodeColor;
00101 
00102   static map< int , string > nodeShapeNames;
00103   // The default shape for nodes (of nodes that are not out of "nodeShape").
00104   NODESHAPE theDefaultNodeShape;
00105   // Shapes of nodes.
00106   map< int , NODESHAPE > nodeShape;
00107 };
00108 
00109 
00110 #endif
00111 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Mon Sep 26 18:43:45 2011 for CRyptography And Groups (CRAG) by  doxygen 1.6.1