Fawkes API  Fawkes Development Version
grid.h
00001 
00002 /***************************************************************************
00003  *  grid.h - Scanline model implementation: grid
00004  *
00005  *  Created: Sun May 08 21:54:49 2005
00006  *  Copyright  2005  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023 
00024 #ifndef __FIREVISION_SCANLINE_GRID_H_
00025 #define __FIREVISION_SCANLINE_GRID_H_
00026 
00027 #include <fvmodels/scanlines/scanlinemodel.h>
00028 #include <fvutils/base/roi.h>
00029 #include <fvutils/base/types.h>
00030 
00031 namespace firevision {
00032 #if 0 /* just to make Emacs auto-indent happy */
00033 }
00034 #endif
00035 
00036 class ScanlineGrid : public ScanlineModel
00037 {
00038 
00039  public:
00040 
00041         ScanlineGrid(unsigned int width, unsigned int height,
00042                unsigned int offset_x, unsigned int offset_y,
00043                ROI* roi = NULL, bool horizontal_grid = true);
00044         virtual ~ScanlineGrid();
00045 
00046   fawkes::point_t    operator*();
00047   fawkes::point_t *  operator->();
00048   fawkes::point_t *  operator++();
00049   fawkes::point_t *  operator++(int);
00050 
00051   bool          finished();
00052   void          reset();
00053   const char *  get_name();
00054   unsigned int  get_margin();
00055 
00056   virtual void  set_robot_pose(float x, float y, float ori);
00057   virtual void  set_pan_tilt(float pan, float tilt);
00058   virtual void  set_roi(ROI* roi = NULL);
00059 
00060   void setDimensions(unsigned int width, unsigned int height, ROI* roi = NULL);
00061   void setOffset(unsigned int offset_x, unsigned int offset_y);
00062   void setGridParams(unsigned int width, unsigned int height,
00063                      unsigned int offset_x, unsigned int offset_y,
00064                      ROI* roi = NULL, bool horizontal_grid = true);
00065 
00066  private:
00067   unsigned int width;
00068   unsigned int height;
00069   unsigned int offset_x;
00070   unsigned int offset_y;
00071 
00072   ROI* roi;
00073 
00074   bool horizontal_grid;
00075   bool more_to_come;
00076 
00077   fawkes::point_t coord;
00078   fawkes::point_t tmp_coord;
00079 
00080   void calc_next_coord();
00081 };
00082 
00083 } // end namespace firevision
00084 
00085 #endif