line_segment_drawer.cpp

00001 
00002 /***************************************************************************
00003  *  line_segment_drawer.cpp - Drawer for the LineSegment class
00004  *
00005  *  Created: Thu Oct 09 14:49:20 2008
00006  *  Copyright  2008  Daniel Beck
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 #include <geometry/gtk/line_segment_drawer.h>
00025 #include <geometry/line_segment.h>
00026 
00027 /** @class fawkes::LineSegmentDrawer <geometry/gtk/line_segment_drawer.h>
00028  * Drawer for LineSegment objects.
00029  * @author Daniel Beck
00030  */
00031 
00032 namespace fawkes {
00033 
00034 /** Constructor.
00035  * @param l the LineSegement to drawer
00036  */
00037 LineSegmentDrawer::LineSegmentDrawer(LineSegment l)
00038 {
00039   m_line_segment = new LineSegment( l );
00040 }
00041 
00042 /** Destructor. */
00043 LineSegmentDrawer::~LineSegmentDrawer()
00044 {
00045   delete m_line_segment;
00046 }
00047 
00048 void
00049 LineSegmentDrawer::draw(Cairo::RefPtr<Cairo::Context>& context)
00050 {
00051   context->save();
00052   context->move_to( m_line_segment->p1().x(),
00053                     m_line_segment->p1().y() );
00054   context->line_to( m_line_segment->p2().x(),
00055                     m_line_segment->p2().y() );
00056   context->stroke();
00057   context->restore();
00058 }
00059 
00060 } // end namespace fawkes

Generated on Tue Feb 22 13:31:26 2011 for Fawkes API by  doxygen 1.4.7