papyrus logo

hexgrid.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This file is part of the papyrus library.                             *
00006  *                                                                         *
00007  *   papyrus is free software; you can redistribute it and/or modify       *
00008  *   it under the terms of the GNU Lesser General Public License           *
00009  *   version 3.0 as published by the Free Software Foundation.             *
00010  *                                                                         *
00011  *   papyrus is distributed in the hope that it will be useful,            *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Lesser General Public License version 3.0 for more details.       *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Lesser General Public      *
00017  *   License along with the papyrus library. If not, see                   *
00018  *   <http://www.gnu.org/licenses/>.                                       *
00019  ***************************************************************************/
00020 #ifndef HEXGRID_H
00021 #define HEXGRID_H
00022 
00023 #include <item.h>
00024 #include <matrix2d.h>
00025 
00026 namespace Papyrus {
00027 
00032 class Hexgrid : public Group
00033 {
00034 public:
00035     typedef enum STYLE {SIDE, VERTEX} Style;
00036 
00037     Hexgrid(Vertex upperleft, int width, int height, double hexrad);
00038     Hexgrid(Vertex upperleft, Glib::ustring filename, double hexrad);
00039 
00040     ~Hexgrid();
00041 
00042     virtual void pl_insert();
00043 
00044     bool has_outline() { return _use_outline; }
00045     bool use_outline(bool uo) { _use_outline = uo; }
00046     RGBA get_outline() { return _outline; }
00047     void set_outline(RGBA& outline) { _use_outline = true; _outline = outline; }
00048 
00049     double get_edge() { return _halfedge*2.0; }
00050     double get_apothem() { return _apothem; }
00051 
00052     double get_radius() { return _radius; }
00053     void set_radius(double radius);
00054 
00055     Vertex& get_upperleft() { return _upperleft; }
00056     void set_upperleft(Vertex& upperleft) { _upperleft = upperleft; }
00057 
00058     Style get_style() { return _style; }
00059     void set_style(Style s) { _style = s; }
00060 
00061     void set_color(int x, int y, RGBA& color);
00062 
00063 protected:
00064   RGBA* _colors;
00065   bool _use_outline;
00066   RGBA _outline;
00067   Vertex _upperleft;
00068   int _width, _height;
00069   double _radius, _apothem, _halfedge;
00070   Style _style;
00071 
00072 }; // class Hexgrid
00073 
00074 }; // namespace Papyrus
00075 
00076 
00077 #endif

Generated on Fri Apr 16 12:40:10 2010 for papyrus by doxygen 1.6.1