From 47d455dd55be855e4cc691c32f687f723d9247ee Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kpovmodeler/pmline.h | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 kpovmodeler/pmline.h (limited to 'kpovmodeler/pmline.h') diff --git a/kpovmodeler/pmline.h b/kpovmodeler/pmline.h new file mode 100644 index 00000000..399555ea --- /dev/null +++ b/kpovmodeler/pmline.h @@ -0,0 +1,102 @@ +//-*-C++-*- +/* +************************************************************************** + description + -------------------- + copyright : (C) 2000-2001 by Andreas Zehender + email : zehender@kde.org +************************************************************************** + +************************************************************************** +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +**************************************************************************/ + + +#ifndef PMLINES_H +#define PMLINES_H + +#include +#include +#include "pmdebug.h" + +/** + * Line to display with index of start and end point. + * + * Line of a @ref PMViewStructure. Only the indices in a @ref PMPointArray + * are stored. + * + * Optimized for OpenGL + */ +class PMLine +{ +public: + /** + * Default constructor + */ + PMLine( ) + { + m_start = 0; + m_end = 0; + } + /** + * Creates a line with start point si and end point ei. If si is greater + * than ei, si and ei are swapped. + */ + PMLine( const GLuint si, const GLuint ei ) + { m_start = si; m_end = ei; checkPoints( ); } + + /** + * Sets the start point. + */ + void setStartPoint( GLuint si ) { m_start = si; checkPoints( ); } + /** + * Sets the end point. + */ + void setEndPoint( GLuint ei ) { m_end = ei; checkPoints( ); } + /** + * Returns the start point. + */ + GLuint startPoint( ) const { return m_start; } + /** + * Returns the end point. + */ + GLuint endPoint( ) const { return m_end; } + +private: + /** + * Swaps the two points. + */ + void swapPoints( ) { GLuint help = m_start; m_start = m_end; m_end = help; } + /** + * Checks, if si < ei and swaps the two points if necessary + */ + void checkPoints( ) + { + if( m_start == m_end ) kdError( PMArea ) << "Start index = end index in PMLine" << "\n"; + if( m_start > m_end ) swapPoints( ); + } + /** + * The start and end points (indices!) + * + * THESE MEMBERS HAVE TO BE THE ONLY ONE (for rendering with OpenGl) + */ + GLuint m_start, m_end; +}; + +typedef QPtrListIterator PMLineListIterator; + +/** + * A list of @ref PMLine objects. + * + * This class stores all lines of a @ref PMViewStructure. A line is + * described by a start and end point. Only the indices in a @ref PMPointArray + * are stored. + */ +typedef QMemArray PMLineArray; + +#endif -- cgit v1.2.3