OverlapDef.hpp
1 #ifndef OPALS_OVERLAP_DEF_HPP_INCLUDED
2 #define OPALS_OVERLAP_DEF_HPP_INCLUDED
3 
4 #pragma once
5 
6 //OPALS
7 #include "opals/config.hpp"
8 #include "opals/String.hpp"
9 
10 namespace opals {
11 
12  /// Class implementing the potential specification of overlap areas as relative and/or absolute measures
13  class OPALS_API OverlapDef
14  {
15  public:
16  OverlapDef() : relArea(0.), absArea(0.), logAnd(true) {};
17  virtual ~OverlapDef() {};
18 
19  /// returns the minimum relative Area
20  double getRelArea() const { return relArea; };
21  /// returns the minimum absolute area
22  double getAbsArea() const { return absArea; };
23  /// returns true if a user defined limit is set
24  opals::String getLogOperator() const { return logAnd ? "and" : "or"; };
25 
26  /// set minimum relative area
27  void setRelArea( const double& area );
28  /// set minimum absolute area
29  void setAbsArea( const double& area );
30  /// set logical operator
31  void setLogOperator( const opals::String& logOp ) { logAnd = logOp == "and" ? true : false; };
32 
33  /// validate two polygon areas and their respective overlap area
34  /// returns true if the overlap area fullfills the minimum absolute and relative area
35  /// of 'this '
36  bool b_checkOverlap( const double& area1,
37  const double& area2,
38  const double& area3 ) const;
39 
40  protected:
41  bool logAnd;
42  double relArea, absArea;
43  };
44 }
45 
46 #endif //OPALS_OVERLAP_DEF_HPP_INCLUDED