hexgrid.h

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

Generated on Sun Mar 11 10:01:28 2007 by  doxygen 1.5.1