VectorObject2D.cpp
Go to the documentation of this file.
00001 /*******************************************************************************
00002  *  VectorObject2D.cpp
00003  *
00004  *  (C) 2007 AG Aktives Sehen <agas@uni-koblenz.de>
00005  *           Universitaet Koblenz-Landau
00006  *
00007  *  Additional information:
00008  *  $Id: $
00009  *******************************************************************************/
00010 
00011 #include "VectorObject2D.h"
00012 
00013 #define THIS VectorObject2D
00014 
00015 #include <GL/glu.h>
00016 
00017 using namespace std;
00018 
00019 //Change the class version when modifying member variables ( needed for serialization / deserialization )
00020 
00021 const unsigned short THIS::ClassVersion=12;
00022 
00023 
00024 THIS::THIS( const vector<Point2D> vertices, float r, float g, float b, float lineWidth, StyleT style )
00025 {
00026   m_Vertices=vertices;
00027   m_R=r;
00028   m_G=g;
00029   m_B=b;
00030   m_LineWidth=lineWidth;
00031   m_Style=style;
00032 }
00033 
00034 
00035 THIS::~THIS()
00036 {
00037 }
00038 
00039 void THIS::paintGl()
00040 {
00041   glColor3f( m_R, m_G, m_B );
00042   int glStyle = GL_LINE_STRIP;
00043   switch ( m_Style )
00044   {
00045     case Lines:
00046       glLineWidth( m_LineWidth );
00047       glStyle = GL_LINE_STRIP;
00048       break;
00049     case Dots:
00050       glPointSize( m_LineWidth );
00051       glStyle = GL_POINTS;
00052       break;
00053   }
00054   glBegin( glStyle );
00055   for(unsigned i=0;i<m_Vertices.size();i++)
00056   {
00057     if ( m_Vertices[i].isValid() )
00058     {
00059       glVertex3f( m_Vertices[i].x(), m_Vertices[i].y(), 0 );
00060     }
00061     else
00062     {
00063       glEnd();
00064       glBegin( glStyle );
00065     }
00066   }
00067   glEnd();
00068 }
00069 
00070 
00071 //void THIS::storer( ExtendedOutStream& extStrm ) const
00072 //{
00073 //  extStrm << unsigned( m_Vertices.size() );
00074 //  for ( unsigned i=0; i<m_Vertices.size(); i++ )
00075 //  {
00076 //    extStrm << float( m_Vertices[i].x() );
00077 //    extStrm << float( m_Vertices[i].y() );
00078 //  }
00079 //  extStrm << m_R;
00080 //  extStrm << m_G;
00081 //  extStrm << m_B;
00082 //  extStrm << m_LineWidth;
00083 //  extStrm << m_Style;
00084 //}
00085 
00086 
00087 //THIS::THIS( ExtendedInStream& extStrm, unsigned short sourceVersion )
00088 //{
00089 //  unsigned size;
00090 //  extStrm >> size;
00091 //  m_Vertices.resize( size );
00092 //  for ( unsigned i=0; i<m_Vertices.size(); i++ )
00093 //  {
00094 //    float x;
00095 //    float y;
00096 //    extStrm >> x;
00097 //    extStrm >> y;
00098 //    m_Vertices[i]=Point2D(x,y);
00099 //  }
00100 //  extStrm >> m_R;
00101 //  extStrm >> m_G;
00102 //  extStrm >> m_B;
00103 //  extStrm >> m_LineWidth;
00104 
00105 //  if ( sourceVersion >= 12 )
00106 //  {
00107 //    extStrm >> m_Style;
00108 //  }
00109 
00110 //}
00111 
00112 
00113 #undef THIS


obj_rec_gui
Author(s): AGAS/agas@uni-koblenz.de
autogenerated on Mon Oct 6 2014 02:53:43