RadialLayout.cpp

Go to the documentation of this file.
00001 //------------------------------------------------------------------------------ 00002 // @file RadialLayout.cpp @brief Contains the implementation of the methods of a 00003 // Radial Layout. 00004 00005 // Last Change: 2004/05/21 00006 // Version: 0.1 00007 00008 //---------------------------------------------------------------------includes- 00009 #include <vector> 00010 #include "../src/RadialLayout.h" 00011 #include "../src/main.h" 00012 00013 //-----------------------------------------------------------------------usings- 00014 using std::vector; 00015 00016 //-----------------------------------------------------------renderRadialLayout- 00017 // 00018 // This renders the Radial Layout. 00019 // @param quadric_object The quadric object to display it on the screen. 00020 // 00021 void RadialLayout::renderRadialLayout(GLUquadricObj *quadric_object) 00022 { 00023 // draw centre: 255, 80, 80 00024 glEnable(GL_BLEND); 00025 gluQuadricDrawStyle(quadric_object, GLU_FILL); 00026 glColor4f(1.0f, 0.3f, 0.3f, 0.3f); 00027 gluDisk(quadric_object, 0.0f, 0.03f, 200, 1); 00028 glDisable(GL_BLEND); 00029 00030 glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE_MINUS_SRC_ALPHA); 00031 glEnable(GL_POLYGON_SMOOTH); 00032 glEnable(GL_BLEND); 00033 glColor4f(0.0f, 0.0f, 0.0f, 0.3f); 00034 glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); 00035 00036 for (GLuint count = 0; count < num_displayed_rings_; count++) 00037 { 00038 gluQuadricDrawStyle(quadric_object, GLU_SILHOUETTE); 00039 radius_of_rings_[count + 1] = 00040 (GLfloat) (0.50 + (radius_of_rings_.at(count) * 0.8)); 00041 00042 gluDisk(quadric_object, 0.0f, radius_of_rings_.at(count), 200, 1); 00043 } 00044 // glDisable(GL_BLEND); 00045 glDisable(GL_POLYGON_SMOOTH); 00046 } 00047 00048 //---------------------------------------------------------setNumDisplayedRings- 00049 // 00050 // This sets the number of displayed rings. 00051 // @param num_displayed_rings The number of displayed rings. 00052 // 00053 void RadialLayout::setNumberDisplayedRings(GLuint num_displayed_rings) 00054 { 00055 num_displayed_rings_ = num_displayed_rings; 00056 } 00057 00058 //---------------------------------------------------------getNumDisplayedRings- 00059 // 00060 // This returns the number of displayed rings. 00061 // @return The number of displayed rings. 00062 // 00063 GLuint RadialLayout::getNumDisplayedRings() const 00064 { 00065 return(num_displayed_rings_); 00066 } 00067 00068 //-----------------------------------------------------------setNumOverallRings- 00069 // 00070 // This sets the number of overall rings. 00071 // @param num_overall_rings The number of overall rings. 00072 // 00073 void RadialLayout::setNumberOverallRings(GLuint num_overall_rings) 00074 { 00075 num_overall_rings_ = num_overall_rings; 00076 } 00077 00078 //-----------------------------------------------------------getNumOverallRings- 00079 // 00080 // This returns the number of overall rings. 00081 // @return The number of overall rings. 00082 // 00083 GLuint RadialLayout::getNumOverallRings() const 00084 { 00085 return(num_overall_rings_); 00086 } 00087 00088 //--------------------------------------------------------------setRadiusOfRing- 00089 // 00090 // This sets the radius of the ring. 00091 // @param ring_number The ring number. 00092 // @param ring_radius The radius of the ring. 00093 // 00094 void RadialLayout::setRadiusOfRing(GLuint ring_number, GLfloat ring_radius) 00095 { 00096 // vector<Node*>::iterator iter = radius_of_rings.begin(); 00097 // while (iter != radius_of_rings.end()) 00098 // { 00099 // radius_of_rings_[iter] = ring_radius; 00100 // } 00101 00102 } 00103 00104 //--------------------------------------------------------------getRadiusOfRing- 00105 // 00106 // This returns the radius of the ring. 00107 // @param ring_number The ring number. 00108 // @return The radius of the rings. 00109 // 00110 GLfloat RadialLayout::getRadiusOfRing(GLuint ring_number) 00111 { 00112 for (GLuint count = 0; count < num_displayed_rings_; count++) 00113 { 00114 radius_of_rings_[count + 1] = 00115 (GLfloat) (0.50 + (radius_of_rings_[count] * 0.8)); 00116 } 00117 vector<GLfloat>::iterator iter = radius_of_rings_.begin(); 00118 GLuint count = 0; 00119 while (iter != radius_of_rings_.end()) 00120 { 00121 if (ring_number == count) 00122 { 00123 return(*iter); 00124 } 00125 ++count; 00126 ++iter; 00127 } 00128 return(NULL); 00129 } 00130 00131 //------------------------------------------------------------initRadiusOfRings- 00132 // 00133 // This initializes the radius of the rings. 00134 // 00135 void RadialLayout::initRadiusOfRings(GLuint num_displayed_rings) 00136 { 00137 num_displayed_rings_ = num_displayed_rings; 00138 for (GLuint count = 0; count < num_displayed_rings_; count++) 00139 { 00140 radius_of_rings_[count + 1] = 00141 (GLfloat) (0.50 + (radius_of_rings_[count] * 0.8)); 00142 } 00143 vector<GLfloat>::iterator iter = radius_of_rings_.begin(); 00144 // cout << "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ" << endl; 00145 // while (iter != radius_of_rings_.end()) 00146 // { 00147 // cout << "RADIUS_RING: " << (*iter) << endl; 00148 // ++iter; 00149 // } 00150 } 00151 00152 // eof

Generated on Mon Jun 14 12:48:56 2004 for InfoVis by doxygen 1.3.7