hexsvg.h

Go to the documentation of this file.
00001 /*                            Package   : libhex
00002  * hexsvg.h                   Created   : 2007/10/25
00003  *                            Author    : Alex Tingle
00004  *
00005  *    Copyright (C) 2007-2008, Alex Tingle.
00006  *
00007  *    This file is part of the libhex application.
00008  *
00009  *    libhex is free software; you can redistribute it and/or
00010  *    modify it under the terms of the GNU Lesser General Public
00011  *    License as published by the Free Software Foundation; either
00012  *    version 2.1 of the License, or (at your option) any later version.
00013  *
00014  *    libhex is distributed in the hope that it will be useful,
00015  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  *    Lesser General Public License for more details.
00018  *
00019  *    You should have received a copy of the GNU Lesser General Public
00020  *    License along with this library; if not, write to the Free Software
00021  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022  */
00023 
00024 #ifndef FIRETREE__HEXSVG_H
00025 #define FIRETREE__HEXSVG_H 1
00026 
00027 
00028 #include "hex.h"
00029 
00030 
00031 namespace hex {
00032 
00036 namespace svg {
00037 
00038 
00039 typedef std::map<std::string,std::string> Style;
00040 
00042 std::string style_str(const Style& st);
00043 
00045 Style style_dict(const std::string& s) throw(hex::invalid_argument);
00046 
00047 
00048 
00049 inline std::ostream&
00050 operator<<(std::ostream& os, hex::Point p)
00051 {
00052   os<<p.x<<","<<p.y;
00053   return os;
00054 }
00055 
00056 
00057 //
00058 // Document
00059 
00060 class Document
00061 {
00062   const Grid&  _grid;
00063 public:
00064   Point                   p0; 
00065   Point                   p1; 
00066   std::list<std::string>  stylesheets; 
00067   std::list<std::string>  defs; 
00068 
00069   Document(const Grid& grid);
00070 
00072   Point T(const Point& p) const;
00073 
00074   std::string  header(void) const;
00075   std::string  footer(void) const;
00076 
00078   std::string draw_simple_area(const Area& a, float bias =0.0);
00079   
00081   std::string draw_complex_area(const Area& a, float bias =0.0);
00082   
00083   std::string draw_skeleton(const Area& a, bool include_boundary =true);
00084   
00086   std::string draw_boundary(const Boundary& b, float bias =0.0);
00087   
00089   std::string draw_path(const Path& p);
00090   
00093   std::string
00094   draw_poly(
00095     std::list<Point> points,
00096     bool closed,
00097     const Identity* identity =NULL
00098   );
00099 };
00100 
00101 
00102 } // end namespace svg
00103 } // end namespace hex
00104 
00105 #endif

Generated on Thu Feb 21 00:00:54 2008 for libhex by  doxygen 1.5.1