/**
 * @file
 * $Id$
 * $Revision$
 * $Author$
 * $Date$
 *
 * This file is part of The iWear Framework.
 * In particular this file is part of the iWear Database Access Library.
 *
 * The iWear Framework is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by the
 * Free Software Foundation as in version 2 of the License.

 * 
 * The iWear Framework is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * The iWear Framework; if not, write to the Free Software Foundation, Inc., 59
 * Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef __DCAGIMAGEMARK_H
#define __DCAGIMAGEMARK_H

#ifndef __IWEAR_H
#include <iwear/iwear.h>
#endif

#ifndef __CAR_H
#include <iwear_dcag_mark_assistant/car.h>
#endif

#ifndef __WELDPOINT_H
#include <iwear_dcag_mark_assistant/weldpoint.h>
#endif

#ifndef __WELDPOINTPICTUREDATA_H
#include <iwear_dcag_mark_assistant/weldpointpicturedata.h>
#endif

#include <string>
#include <list>

#include <gd.h>

using namespace std;

namespace iwear {
    namespace dcag {

enum positioning {XY_PLAIN, XZ_PLAIN, YZ_PLAIN};
enum viewdir {POS, NEG};
     
	
/**
 * This class is a representation of the iwear dcag imagemark.
 */
class ImageMark
{
private:
    inline static void draw_spot(gdImagePtr im, int cx, int cy, int r, int color)
    {
	gdImageFilledRectangle(im, cx-r, cy-r, cx+r, cy+r, color);
    }
    
    inline static void draw_crosshair(gdImagePtr im, int cx, int cy, int wd, int color)
    {
	gdImageFilledRectangle(im, cx-wd, 0, cx+wd, im->sy, color);
	gdImageFilledRectangle(im, 0, cy-wd, im->sx, cy+wd, color);
    }

    static void calc_coordinates(list<WeldpointPictureData*>::iterator wppdi, int& cx, int& cy, int sx, int sy);
  
public:
   static list<string> mark_point(Car* current_car, list<Weldpoint*>::iterator current_weldpoint, string image_path, string tmp_image_path, const uint32_t radius = 5, const uint32_t previous_points = 2, const uint32_t next_points = 2);
   static string zoom_picture(list<Weldpoint*>::iterator current_weldpoint, string current_image, string tmp_image_path);

   //static list<string>* markpicture(int point);
   
};
} // namespace dcag
} // namespace iwear
#endif
