// Copyright (c) 1999 Utrecht University (The Netherlands), // ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), // INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg // (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), // and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org); you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public License as // published by the Free Software Foundation; version 2.1 of the License. // See the file LICENSE.LGPL distributed with CGAL. // // Licensees holding a valid commercial license may use this file in // accordance with the commercial license agreement provided with the software. // // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // $URL$ // $Id$ // // // Author(s) : Francois Rebufat #ifndef CGAL_VIEWER_STREAM_H #define CGAL_VIEWER_STREAM_H #include #include #include #include #include #include #include #include #include #include #include #include #include CGAL_BEGIN_NAMESPACE // Transform a point_3 to a drawable_point_3 with Viewer attributs. template Drawable_point_3 >* convert_type(const Point_3 p, Viewer_3 &W) { Drawable_point_3 >* dp = new Drawable_point_3 >(p,W.get_color(1),W.get_style(),W.get_size(),W.get_precision()); return(dp); } template Drawable_point_3 >* convert_type(const std::vector &p, Viewer_3 &W) { Drawable_point_3 >* dp = new Drawable_point_3 >(p[0],p[1],p[2],W.get_color(1),W.get_style(),W.get_size(),W.get_precision()); return(dp); } template Drawable_segment_3 >* convert_type(const Segment_3 &s, Viewer_3 &W) { Drawable_segment_3 >* sp = new Drawable_segment_3 >(s,W.get_color(1),W.get_style(),W.get_size(),W.get_precision()); return(sp); } template Drawable_triangle_3 >* convert_type(const Triangle_3 &s, Viewer_3 &W) { Drawable_triangle_3 >* sp = new Drawable_triangle_3 >(s,W.get_color(1),W.get_style(),W.get_size(),W.get_precision()); return(sp); } template Drawable_tetrahedron_3 >* convert_type(const Tetrahedron_3 &s, Viewer_3 &W) { Drawable_tetrahedron_3 >* sp = new Drawable_tetrahedron_3 >(s,W.get_color(1),W.get_style(),W.get_size(),W.get_precision()); return(sp); } template Drawable_line_3 >* convert_type(const Line_3 &s, Viewer_3 &W) { Drawable_line_3 >* sp = new Drawable_line_3 >(s,W.get_color(1),W.get_style(),W.get_size(),W.get_precision()); return(sp); } template Drawable_ray_3 >* convert_type(const Ray_3 &s, Viewer_3 &W) { Drawable_ray_3 >* sp = new Drawable_ray_3 >(s,W.get_color(1),W.get_style(),W.get_size(),W.get_precision()); return(sp); } template Drawable_point_2 >* convert_type(const Point_2 &s, Viewer_3 &W) { Drawable_point_2 >* sp = new Drawable_point_2 >(s,W.get_color(1),W.get_style(),W.get_size(),W.get_precision()); return(sp); } template Drawable_segment_2 >* convert_type(const Segment_2 &s, Viewer_3 &W) { Drawable_segment_2 >* sp = new Drawable_segment_2 >(s,W.get_color(1),W.get_style(),W.get_size(),W.get_precision()); return(sp); } template Drawable_line_2 >* convert_type(const Line_2 &s, Viewer_3 &W) { Drawable_line_2 >* sp = new Drawable_line_2 >(s,W.get_color(1),W.get_style(),W.get_size(),W.get_precision()); return(sp); } template Drawable_ray_2 >* convert_type(const Ray_2 &s, Viewer_3 &W) { Drawable_ray_2 >* sp = new Drawable_ray_2 >(s,W.get_color(1),W.get_style(),W.get_size(),W.get_precision()); return(sp); } template Drawable_triangle_2 >* convert_type(const Triangle_2 &s, Viewer_3 &W) { Drawable_triangle_2 >* sp = new Drawable_triangle_2 >(s,W.get_color(1),W.get_style(),W.get_size(),W.get_precision()); return(sp); } template Drawable_circle_2 >* convert_type(const Circle_2 &s, Viewer_3 &W) { Drawable_circle_2 >* sp = new Drawable_circle_2 >(s,W.get_color(1),W.get_style(),W.get_size(),W.get_precision()); return(sp); } // ######## The Stream Manipulator ############################### template class O_manip; template< class Obj > Viewer_3& operator<<(Viewer_3& W, const O_manip &m); template class O_manip { #ifdef _MSC_VER public: #endif Viewer_3& (*f)(Viewer_3&,Obj); Obj i; public: O_manip(Viewer_3& (*ff)(Viewer_3&,Obj), Obj ii) : f(ff), i(ii){} friend Viewer_3& operator<< <> (Viewer_3& W, const O_manip& m); }; template Viewer_3& operator<<(Viewer_3& W, const O_manip& m) { return m.f(W,m.i); } // ######## The Stream Manipulator END############################### // functions used for precision Viewer_3& precision(Viewer_3& W, Precision s) { W.set_precision(s); return W; } O_manip set_precision(Precision i) { return O_manip(&precision, i); } // functions used for colors Viewer_3& color_1(Viewer_3& W, Color c) { W.set_color(c,1); return W; } O_manip set_color_1(Color i) { return O_manip(&color_1, i); } // -------------------- Viewer_3& color_2(Viewer_3& W, Color c) { W.set_color(c,2); return W; } O_manip set_color_2(Color i) { return O_manip(&color_2, i); } // functions used for size Viewer_3& size_f(Viewer_3& W, Size c) { W.set_size(c); return W; } O_manip set_size(Size i) { return O_manip(&size_f, i); } // functions used for style Viewer_3& style_f(Viewer_3& W, Style c) { W.set_style(c); return W; } O_manip