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 #undef THIS


robbie_architecture
Author(s): Viktor Seib
autogenerated on Mon Oct 6 2014 02:53:09