GridLimit.hpp
1 #ifndef OPALS_GRID_LIMIT_HPP_INCLUDED
2 #define OPALS_GRID_LIMIT_HPP_INCLUDED
3 
4 #pragma once
5 
6 //OPALS
7 #include "opals/config.hpp"
8 #include "opals/Array.hpp"
9 #include "opals/CustomOptionType.hpp"
10 
11 namespace opals {
12 
13  /// Class describing xy-limits for grid datasets
14  class OPALS_API GridLimit : public CustomOptionType<GridLimit>
15  {
16  public:
17  typedef opals::Array<double,4> ArrayD4; ///< limit coordinate array
18 
19  public:
20  GridLimit();
21  virtual ~GridLimit();
22 
23  /// returns true if limit refers to pixel corner
24  bool isPixelCorner() const { return pixRef==0; };
25  /// returns true if limit refers to pixel center
26  bool isPixelCenter() const { return pixRef==1; };
27  /// returns true if a user defined limit is set
28  bool isUserDef() const { return limType==0; };
29  // returns true if rounding of the limits required
30  bool isRoundLimits() const { return forceRound; };
31 
32  /// set limit reference to pixel corner
33  void setPixelCorner();
34  /// set limit reference to pixel center
35  void setPixelCenter();
36  /// set limit as intersection of multiple datasets
37  /// set user defined limits
38  void setForceRound( const bool& Irb_active );
39  /// set/reset the force round flag
40  void setUserLimits( const ArrayD4& lim );
41 
42  ArrayD4 getUserLimits() const { return userLim; };
43  /// query limits of given input limits with respect to the class attributes (intersection/union/dataset)
44 
45  /// \name CustomOptionType interface
46  ///@{
47  static const char * help();
48  static const char * syntax();
49  static bool exportsPythonType();
50  ///}@
51 
52  protected:
54  unsigned /*char*/ pixRef, limType;
55  bool forceRound;
56  };
57 }
58 
59 #endif //OPALS_GRID_LIMIT_HPP_INCLUDED