Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

mapgen/map.h

00001 /***************************************************************************
00002                         map.h  -  description
00003                             -------------------
00004     begin                : july 2nd, 2006
00005     copyright            : (C) 2006 by Frédéric RODRIGO
00006     email                : f.rodrigo free.fr
00007     
00008     $Id: map.h 83 2006-11-05 20:46:42Z neoneurone $
00009  ***************************************************************************/
00010 
00011 /***************************************************************************
00012  *                                                                         *
00013  *   This program is free software; you can redistribute it and/or modify  *
00014  *   it under the terms of the GNU General Public License as published by  *
00015  *   the Free Software Foundation; either version 2 of the License, or     *
00016  *   any later version.                                                    *
00017  *                                                                         *
00018  ***************************************************************************/
00019 
00020 #ifndef _OPENCITY_MAP_H_
00021 #define _OPENCITY_MAP_H_ 1
00022 
00023 #define MAP_NDEBUG 1            // Debugging off
00024 #undef MAP_NDEBUG
00025 
00026 #include "macros.h"             
00027 
00028 #include <string>               // C++ string
00029 using std::string;
00030 
00031 #ifndef MAP_NDEBUG
00032     #define MAP_DEBUG( msg ) OPENCITY_DEBUG( msg )
00033 #else
00034     #define MAP_DEBUG( msg )
00035 #endif
00036 
00037 namespace MapGen
00038 {
00039 
00043 class Map {
00044 public:
00045     Map(
00046         const uint w,
00047         const uint h );
00048 
00049     ~Map();
00050 
00051     /* module setter */
00052     void setAt(
00053         int x,
00054         int y,
00055         float value );
00056 
00057     /* modulo getter */
00058     float getAt(
00059         int x,
00060         int y ) const;
00061 
00062     bool save( const string &file );
00063 
00064     inline uint getW() const { return _w; }
00065 
00066     inline uint getH() const { return _h; }
00067 
00068     /* Return a sub-map */
00069     Map* crop(
00070         const uint w,
00071         const uint h ) const;
00072 
00073     /* Convert the private float array to an allocated int array */
00074     int *toIntArray() const;
00075 
00076 private:
00077     uint    _w;
00078     uint    _h;
00079     float   **_map;
00080 
00081 };
00082 
00083 }
00084 
00085 #endif

Generated on Sat Nov 11 10:21:10 2006 for OpenCity by  doxygen 1.4.2