OpenStructure
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
stage
include
ost
img
composite_mask.hh
Go to the documentation of this file.
1
//------------------------------------------------------------------------------
2
// This file is part of the OpenStructure project <www.openstructure.org>
3
//
4
// Copyright (C) 2008-2011 by the OpenStructure authors
5
// Copyright (C) 2003-2010 by the IPLT authors
6
//
7
// This library is free software; you can redistribute it and/or modify it under
8
// the terms of the GNU Lesser General Public License as published by the Free
9
// Software Foundation; either version 3.0 of the License, or (at your option)
10
// any later version.
11
// This library is distributed in the hope that it will be useful, but WITHOUT
12
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14
// details.
15
//
16
// You should have received a copy of the GNU Lesser General Public License
17
// along with this library; if not, write to the Free Software Foundation, Inc.,
18
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
//------------------------------------------------------------------------------
20
21
/*
22
Authors: Andreas Schenk, Ansgar Philippsen
23
*/
24
25
#ifndef COMPOSITE_MASK_HH_
26
#define COMPOSITE_MASK_HH_
27
28
#include "
mask_base.hh
"
29
30
namespace
ost {
namespace
img {
31
32
class
OpBase
33
{
34
public
:
35
virtual
~OpBase
() {}
36
virtual
OpBase
*
Clone
()=0;
37
virtual
bool
operator()
(
const
MaskPtr
& lhs,
const
MaskPtr
& rhs,
const
Vec2& v)
const
=0;
38
virtual
String
GetName
()
const
=0;
39
};
40
41
class
AndOp
:
public
OpBase
42
{
43
public
:
44
virtual
OpBase
*
Clone
(){
return
new
AndOp
();}
45
virtual
bool
operator()
(
const
MaskPtr
& lhs,
const
MaskPtr
& rhs,
const
Vec2& v)
const
;
46
virtual
String
GetName
()
const
{
return
"AND"
;}
47
};
48
49
class
OrOp
:
public
OpBase
50
{
51
public
:
52
virtual
OpBase
*
Clone
(){
return
new
OrOp
();}
53
virtual
bool
operator()
(
const
MaskPtr
& lhs,
const
MaskPtr
& rhs,
const
Vec2& v)
const
;
54
virtual
String
GetName
()
const
{
return
"OR"
;}
55
};
56
57
class
XorOp
:
public
OpBase
58
{
59
public
:
60
virtual
OpBase
*
Clone
(){
return
new
XorOp
();}
61
virtual
bool
operator()
(
const
MaskPtr
& lhs,
const
MaskPtr
& rhs,
const
Vec2& v)
const
;
62
virtual
String
GetName
()
const
{
return
"XOR"
;}
63
};
64
typedef
boost::shared_ptr<OpBase>
OpPtr
;
65
66
67
class
DLLEXPORT_OST_IMG_BASE
CompositeMask
:
public
MaskBase
68
{
69
public
:
70
CompositeMask
(
const
MaskPtr
& lhs,
const
MaskPtr
& rhs,
const
String
& op);
71
CompositeMask
(
const
CompositeMask
& m);
72
73
String
GetOperatorName
() {
74
return
op_->GetName();
75
}
76
77
virtual
~
CompositeMask
();
78
virtual
MaskPtr
Clone();
79
virtual
bool
IsInside(
const
Vec2& v);
80
81
virtual
void
Shift
(
const
Vec2& v);
82
virtual
void
Expand(
Real
d);
83
virtual
void
Scale(
Real
d);
84
85
// traverse mask hierarchy with a visitor
86
virtual
void
Apply(
MaskVisitor
& v);
87
88
89
protected
:
90
static
OpBase
* create_op_(
const
String
& name);
91
MaskPtr
lhs_
;
92
MaskPtr
rhs_
;
93
OpBase
*
op_
;
94
};
95
96
}}
//ns
97
98
99
#endif
/*COMPOSITE_MASK_HH_*/
Generated on Mon Nov 11 2013 09:56:12 for OpenStructure by
1.8.1.1