// Copyright (c) 2001 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) : Carine Bonetto #include #include CGAL_BEGIN_NAMESPACE const float PS_Stream::CM=28.4; const float PS_Stream::INCH=72.0; const float PS_Stream::POINT=1.0; const DashStyle PS_Stream::SOLID="[] 0 "; const DashStyle PS_Stream::DASH2="[5 5] 0 "; const DashStyle PS_Stream::DASH3="[10 10] 0 "; const DashStyle PS_Stream::DASH6="[10 6 4 6] 0 "; const DashStyle PS_Stream::DASH4="[10 5] 0 "; const DashStyle PS_Stream::DASH5="[5 10] 0 "; const DashStyle PS_Stream::DASH1="[2 2] 0 "; extern const PS_Stream::Context CTXT_DEFAULT=PS_Stream::Context(); PS_Stream::PS_Stream(std::ostream& os, OutputMode mode) :_bbox(PS_BBox(-2,-2,2,2)),_mode(mode),_width((int)(21*CM)), _height((int)(29.7*CM)),_os(os) { insert_catalogue(); } PS_Stream::PS_Stream(const char* fname, OutputMode mode) :_bbox(PS_BBox(-2,-2,2,2)), _mode(mode), _width((int)(21*CM)), _height((int)(29.7*CM)), of(fname,std::ios::out), _os(of) { insert_catalogue(); } PS_Stream::PS_Stream(float H, std::ostream& os, OutputMode mode) :_bbox(PS_BBox(-2,-2,2,2)),_mode(mode), _height((int)(H)),_os(os) {} PS_Stream::PS_Stream(float H, const char* fname, OutputMode mode) :_bbox(PS_BBox(-2,-2,2,2)),_mode(mode),_height((int)(H)), of(fname,std::ios::out), _os(of) {} PS_Stream::PS_Stream(const PS_BBox& bb, std::ostream& os, OutputMode mode) :_bbox(bb), _mode(mode), _width((int)(21*CM)), _height((int)(29.7*CM)), _os(os) { set_scale(bb); insert_catalogue(); } PS_Stream::PS_Stream(const PS_BBox& bb, const char* fname, OutputMode mode) : _bbox(bb),_mode(mode),_width((int)(21*CM)), _height((int)(29.7*CM)), of(fname,std::ios::out), _os(of) { set_scale(bb); insert_catalogue(); } PS_Stream::PS_Stream(const PS_BBox& bb,float H, std::ostream& os, OutputMode mode) : _bbox(bb), _mode(mode), _height((int)H), _os(os) { set_window(bb,H); set_scale(bb); insert_catalogue(); } PS_Stream::PS_Stream(const PS_BBox& bb,float H, const char* fname, OutputMode m) : _bbox(bb), _mode(m), _height((int)H), of(fname,std::ios::out), _os(of) { set_window(bb,H); set_scale(bb); insert_catalogue(); } PS_Stream::PS_Stream(const PS_BBox& bb,float L, float H, std::ostream& os, OutputMode mode) : _bbox(bb), _mode(mode), _width((int)L), _height((int)H), _os(os) { set_scale(bb); insert_catalogue(); } PS_Stream::PS_Stream(const PS_BBox& bb,float L, float H, const char* fname, OutputMode mode) : _bbox(bb), _mode(mode), _width((int)L), _height((int)H), of(fname,std::ios::out), _os(of) { set_scale(bb); insert_catalogue(); } PS_Stream::~PS_Stream() { List_Label tmp=list(); if (!list().empty()) { os() << "%%}\\makeatletter\\let\\@notdefinable\\relax" < border_color(&PS_Stream::set_border_color); PS_Manipulator_creator fill_color(&PS_Stream::set_fill_color); PS_Manipulator_creator point_size(&PS_Stream::set_point_size); PS_Manipulator_creator point_style(&PS_Stream::set_point_style); PS_Manipulator_creator line_style(&PS_Stream::set_line_style); PS_Manipulator_creator line_width(&PS_Stream::set_line_width); PS_Manipulator_creator fill(&PS_Stream::set_fill); PS_Manipulator_creator current_context(&PS_Stream::set_current_context); PS_Manipulator_creator > > move_to(&PS_Stream::set_point); PS_Manipulator_creator show_axis(&PS_Stream::set_axis); PS_Manipulator_creator show_grid(&PS_Stream::set_grid); PS_Manipulator_creator ps_label(&PS_Stream::put_ps_label); PS_Manipulator_creator latex_label(&PS_Stream::put_latex_label); PS_Manipulator_creator border(&PS_Stream::put_border); PS_Manipulator_creator font(&PS_Stream::set_font); PS_Manipulator_creator font_size(&PS_Stream::set_font_size); #endif //PS_MANIP_DEF PS_Stream& PS_Stream::set_border_color(const Color& color) { if (ctxt.get_border_color()!=color) { os() << color << " setrgbcolor" < > p) { ctxt.set_current_pos(p); return *this; } PS_Stream& PS_Stream::set_axis(Axis& g) { static bool test=false; double x0=x2ps(0); double y0=y2ps(0); double i; if (!test) { os() << "gsave 0 setgray " << g.thickness() << " setlinewidth" << std::endl; os() << "[] 0 setdash" << std::endl; os() << x0 << " " << 0 << " mt" <