DGtal
0.6.devel
Main Page
Related Pages
Modules
Namespaces
Data Structures
Examples
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
src
Board
ShapeList.ih
1
/* -*- mode: c++ -*- */
9
/*
10
* \@copyright This File is part of the Board library which is
11
* licensed under the terms of the GNU Lesser General Public Licence.
12
* See the LICENCE file for further details.
13
*/
14
15
#if defined( max )
16
#undef max
17
#define _HAS_MSVC_MAX_ true
18
#endif
19
20
ShapeList::ShapeList(
int
depthValue )
21
: Shape( DGtal::Color::None, DGtal::Color::None, 1.0, SolidStyle, ButtCap, MiterJoin, depthValue ),
22
_nextDepth( std::numeric_limits<int>::max() - 1 )
23
{ }
24
25
template
<
typename
T>
26
T &
27
ShapeList::last(
const
unsigned
int
position )
28
{
29
if
( position < _shapes.size() ) {
30
std::vector<Shape*>::reverse_iterator it = _shapes.rbegin() + position;
31
return
dynamic_cast<
T&
>
( *(*it) );
32
}
else
{
33
error
<<
"Trying to access an element that does not exist ("
34
<< position <<
"/"
<< _shapes.size() <<
").\n"
;
35
throw
-1;
36
}
37
}
38
39
#if defined( _HAS_MSVC_MAX_ )
40
#define max(A,B) ((A)>(B)?(A):(B))
41
#endif
Generated on Wed Dec 19 2012 19:10:35 for DGtal by
1.8.1.1