DGtal 1.3.0
Loading...
Searching...
No Matches
ShapeList.ih
1/*
2 * @file
3 */
4
5ShapeList::ShapeList( int depthValue )
6 : Shape( DGtal::Color::None, DGtal::Color::None, 1.0, SolidStyle, ButtCap, MiterJoin, depthValue ),
7 _nextDepth( std::numeric_limits<int>::max() - 1 )
8{ }
9
10template<typename T>
11T &
12ShapeList::last( const unsigned int position )
13{
14 if ( position < _shapes.size() ) {
15 std::vector<Shape*>::reverse_iterator it = _shapes.rbegin() + position;
16 return dynamic_cast<T&>( *(*it) );
17 } else {
18 error << "Trying to access an element that does not exist ("
19 << position << "/" << _shapes.size() << ").\n";
20 throw -1;
21 }
22}