PolyLineNodeT.hh

00001 /*===========================================================================*\
00002  *                                                                           *
00003  *                              OpenFlipper                                  *
00004  *      Copyright (C) 2001-2009 by Computer Graphics Group, RWTH Aachen      *
00005  *                           www.openflipper.org                             *
00006  *                                                                           *
00007  *---------------------------------------------------------------------------*
00008  *  This file is part of OpenFlipper.                                        *
00009  *                                                                           *
00010  *  OpenFlipper is free software: you can redistribute it and/or modify      *
00011  *  it under the terms of the GNU Lesser General Public License as           *
00012  *  published by the Free Software Foundation, either version 3 of           *
00013  *  the License, or (at your option) any later version with the              *
00014  *  following exceptions:                                                    *
00015  *                                                                           *
00016  *  If other files instantiate templates or use macros                       *
00017  *  or inline functions from this file, or you compile this file and         *
00018  *  link it with other files to produce an executable, this file does        *
00019  *  not by itself cause the resulting executable to be covered by the        *
00020  *  GNU Lesser General Public License. This exception does not however       *
00021  *  invalidate any other reasons why the executable file might be            *
00022  *  covered by the GNU Lesser General Public License.                        *
00023  *                                                                           *
00024  *  OpenFlipper is distributed in the hope that it will be useful,           *
00025  *  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
00026  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            *
00027  *  GNU Lesser General Public License for more details.                      *
00028  *                                                                           *
00029  *  You should have received a copy of the GNU LesserGeneral Public          *
00030  *  License along with OpenFlipper. If not,                                  *
00031  *  see <http://www.gnu.org/licenses/>.                                      *
00032  *                                                                           *
00033 \*===========================================================================*/
00034 
00035 /*===========================================================================*\
00036  *                                                                           *
00037  *   $Revision: 6743 $                                                       *
00038  *   $Author: moebius $                                                      *
00039  *   $Date: 2009-08-05 11:03:10 +0200 (Mi, 05. Aug 2009) $                   *
00040  *                                                                           *
00041 \*===========================================================================*/
00042 
00043 
00044 
00045 
00046 //=============================================================================
00047 //
00048 // CLASS PolyLineNodeT
00049 //
00050 // Author:  David Bommes <bommes@cs.rwth-aachen.de>
00051 //
00052 //=============================================================================
00053 
00054 
00055 #ifndef ACG_POLYLINENODET_HH
00056 #define ACG_POLYLINENODET_HH
00057 
00058 
00059 //== INCLUDES =================================================================
00060 
00061 #include <ACG/Scenegraph/MaterialNode.hh>
00062 #include <ACG/Scenegraph/DrawModes.hh>
00063 
00064 //== FORWARDDECLARATIONS ======================================================
00065 
00066 //== NAMESPACES ===============================================================
00067 
00068 namespace ACG {
00069 namespace SceneGraph {
00070 
00071 //== CLASS DEFINITION =========================================================
00072 
00073 
00074 
00075 
00083 template <class PolyLine>
00084 class PolyLineNodeT : public MaterialNode
00085 {
00086 public:
00087 
00088   // typedefs for easy access
00089   typedef typename PolyLine::Point Point;
00090 
00092   PolyLineNodeT(PolyLine& _pl,
00093                 BaseNode*    _parent=0,
00094                 std::string  _name="<PolyLineNode>" ) :
00095     MaterialNode(_parent,
00096                  _name,
00097                  MaterialNode::BaseColor |
00098                  MaterialNode::LineWidth |
00099                  MaterialNode::PointSize |
00100                  MaterialNode::RoundPoints),
00101     polyline_(_pl)
00102   {
00103     drawMode(DrawModes::WIREFRAME | DrawModes::POINTS);
00104     set_point_size(8.0);
00105     set_line_width(3.0);
00106     set_round_points(true);
00107     set_random_color();
00108   }
00109 
00111   ~PolyLineNodeT() {}
00112 
00113   void set_random_color();
00114 
00115   PolyLine& polyline() { return polyline_; }
00116 
00118   ACG_CLASSNAME(PolyLineNodeT);
00119 
00121   unsigned int availableDrawModes() const;
00122 
00124   void boundingBox(Vec3f& _bbMin, Vec3f& _bbMax);
00125 
00127   void draw(GLState& /*_state*/, unsigned int _drawMode);
00128 
00130   void pick(GLState& _state, PickTarget _target);
00131 
00132 
00133 private:
00134 
00135   void pick_vertices( GLState& _state );
00136   void pick_edges( GLState& _state, unsigned int _offset);
00137 
00138 
00139   void draw_cylinder( const Point& _p0, const Point& _axis, double _r, GLState& _state);
00140 
00141 
00143   PolyLineNodeT(const PolyLineNodeT& _rhs);
00144 
00146   PolyLineNodeT& operator=(const PolyLineNodeT& _rhs);
00147 
00148 private:
00149 
00150   PolyLine& polyline_;
00151 };
00152 
00153 
00154 //=============================================================================
00155 } // namespace SceneGraph
00156 } // namespace ACG
00157 //=============================================================================
00158 #if defined(INCLUDE_TEMPLATES) && !defined(ACG_POLYLINENODET_C)
00159 #define ACG_POLYLINENODET_TEMPLATES
00160 #include "PolyLineNodeT.cc"
00161 #endif
00162 //=============================================================================
00163 #endif // ACG_POLYLINENODET_HH defined
00164 //=============================================================================
00165 

acg pic Project OpenFlipper, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .