Source

liblayout / text_shape.cpp

Full commit
/*
** This code is distributed under a modified BSD license.
** Please refer to http://www.sourceforge.net/projects/adsm/
**
*************************************************************************
**
** Copyright (c) 2004-2006 Robert W. Johnstone
** All rights reserved.
**
*************************************************************************
**
** Description not written.
**
*/

#include "layout_shapes.h"
#include <stdexcept>

using namespace liblayout;

text_shape::text_shape( char const* text, point pt )
: xy(pt)
{
	this->text = text;
	width = 0;
}

text_shape::text_shape( text_shape const& rhs )
: xy(rhs.xy)
{
	width = rhs.width;
	text = rhs.text;
}

shape::imp*	text_shape::apply( transform const& t )
{
	throw std::logic_error( "Text shapes can not be transformed." );
}

rect text_shape::bounds() const
{
	throw std::logic_error( "The boundary of text shapes can not be determined." );
}

shape::imp* text_shape::clone() const
{
	text_shape* ptr = new text_shape( *this );
	return ptr;
}

int text_shape::contains_point( point pt ) const
{
	throw std::logic_error( "Text shapes can not be tested for point inclusion." );
}

void text_shape::get_polygon( polygon& p ) const
{
	throw std::logic_error( "Text shapes can not be converted to polygons." );
}

shape::imp* text_shape::simplify()
{
	return this;
}