ISamplingStrategy.hpp
1 #pragma once
2 
3 #include "DM/config.hpp"
4 #include "DM/Handle.hpp"
5 #include "DM/ObjectBase.hpp"
6 #include "DM/StatFeature.hpp"
7 #include "DM/IAddInfoLayout.hpp"
8 #include "DM/IPoint.hpp"
9 
10 DM_NAMESPACE_BEGIN
11 
12 /// \brief Base class of all geometry objects
13 class DM_API ISamplingStrategy : public ObjectBase
14 {
15 public:
16  enum struct FeatureReference
17  {
18  null = 0,
19  coor_x = 1,
20  coor_y = 2,
21  coor_z = 3,
22  attribute = 4, ///< attribute defined by a single column layout
23  all = 5 ///< when selecting all points per cell
24  };
25 
26  /// creates an empty sampling strategy object
27  static ISamplingStrategy* New();
28 
29  /// sampling strategy for point based modules
30  static ISamplingStrategy* New(const double &cellsize, const IPoint &refPt,
31  const StatFeature &statsFeature, FeatureReference type = FeatureReference::coor_z, const AddInfoLayoutHandle &layout = AddInfoLayoutHandle(),
32  unsigned dim = 2);
33  static ISamplingStrategy* New(const double &cellsize, PointHandle refPt,
34  const StatFeature &statsFeature, FeatureReference type = FeatureReference::coor_z, const AddInfoLayoutHandle &layout = AddInfoLayoutHandle(),
35  unsigned dim = 2);
36 
37  /// sampling strategy for raster based modules
38  static ISamplingStrategy* New(const unsigned subdivsion,
39  const StatFeature &statsFeature, FeatureReference type = FeatureReference::coor_z, const AddInfoLayoutHandle &layout = AddInfoLayoutHandle(),
40  unsigned dim = 2);
41 
42 protected:
43  virtual ~ISamplingStrategy() {}
44 
45 public:
46  virtual ISamplingStrategy* clone() const = 0;
47 
48  virtual bool isRasterBased() const = 0;
49  virtual bool isPointBased() const = 0;
50 
51  virtual bool hasCellsize() const = 0;
52  virtual bool hasSubdivision() const = 0;
53  virtual bool hasRefPt() const = 0;
54  virtual bool hasFeature() const = 0;
55  virtual bool hasFeatureReference() const = 0;
56  virtual bool hasLayout() const = 0;
57 
58  virtual unsigned dimension() const = 0;
59 
60  // access function in raster based mode
61  /// get sub-sampling count per output cell
62  virtual unsigned subdivision() const = 0;
63  virtual void subdivision(unsigned subdiv) = 0;
64 
65  // access function in point based mode
66  /// get cell size for sub-sampling
67  virtual double cellsize() const = 0;
68  virtual void cellsize(double cs) = 0;
69  /// get reference point of sub-sampling raster (which is a corner of raster cell)
70  virtual const IPoint &refPt() const = 0;
71  virtual void refPt(const IPoint &refpt) = 0;
72 
73 
74  /// check if all point data within the tiles should be kept.
75  virtual bool sampleAll() const = 0;
76  /// force to sample all data point within tiles
77  virtual void sampleAll() = 0;
78 
79  /// if not all points should be kept, than the following statistics features will be applied
80  virtual const StatFeature &feature() const = 0;
81  virtual void feature(const StatFeature &feat) = 0;
82 
83  virtual FeatureReference featureReference() const = 0;
84  virtual void featureReference(const FeatureReference &featRef) = 0;
85 
86  virtual const AddInfoLayoutHandle &layout() const = 0;
87  virtual void layout(const AddInfoLayoutHandle &l) = 0;
88 
89  virtual const char *text() const = 0;
90 };
91 
92 typedef Handle< ISamplingStrategy > SamplingStrategyHandle;
93 
94 DM_NAMESPACE_END
Base class of all geometry objects.
Definition: ISamplingStrategy.hpp:13
Definition: Handle.hpp:427
FeatureReference
Definition: ISamplingStrategy.hpp:16
Definition: StatFeature.hpp:7
Smart pointer class using reference counting with support for DM objects (see ObjectBase)
Definition: Handle.hpp:75
Definition: M/c++_api/inc/DM/ObjectBase.hpp:8
3d point object
Definition: IPoint.hpp:14