Transformation.hpp
1 #pragma once
2 
3 #include "DM/config.hpp"
4 #include "DM/Handle.hpp"
5 #include "DM/IGeometry.hpp"
6 #include "DM/Log.hpp"
7 
8 DM_NAMESPACE_BEGIN
9 
10 /// Interface for generic geometry object coordinate transformation
11 class DM_API ITrafo : public ObjectBase
12 {
13 public:
14  static ITrafo* New(const char* sourceCRS, const char* targetCRS, LogFn logFn=0);
15  static ITrafo* New(const char* sourceCRS, const char* targetCRS, const char *dbPath, LogFn logFn = 0);
16 
17 
18 protected:
19  virtual ~ITrafo() {}
20 
21 public:
22  /// \brief returns the dimension of transformation.
23  /// This info helps to optimize the actual transformation process of the geometry objects
24  ///
25  /// \return 1 if only z values are changed
26  /// \return 2 for 2d transformations
27  /// \return 3 if all coordinate values may be changed
28  virtual int trafoDim() const = 0;
29 
30  /// \brief returns flag if the chunked transform function should be use
31  /// the chunked transformation may results in high performance
32  virtual bool usedChunkedTrafo() const = 0;
33 
34  /// \brief performs single point coordinate transformation (mandatory interface)
35  /// please note that coordinates must not be changed if not effected by the transformation
36  ///
37  /// \param[in,out] x x-coordinate
38  /// \param[in,out] y y-coordinate
39  /// \param[in,out] z z-coordinate
40  /// \param[in] inv inversion flag if transformation should be inverted
41  virtual void transform(double &x, double &y, double &z, bool inv = false) const = 0;
42 
43  /// \brief performs chunked coordinate transformation (optional interface)
44  /// please note that coordinates must not be changed if not effected by the transformation
45  ///
46  /// \param[in] count number of points
47  /// \param[in,out] x x-coordinate array
48  /// \param[in,out] y y-coordinate array
49  /// \param[in,out] z z-coordinate array
50  /// \param[in] inv inversion flag if transformation should be inverted
51  virtual void transform(size_t count, double *x, double *y, double *z, bool inv = false) const = 0;
52 
53 };
54 
56 
57 /// \brief provides a generic framework for transforming geometry objects
58 void DM_API transform(const ITrafo &trafo, IGeometry &geom, bool inv = false);
59 
60 DM_NAMESPACE_END
Interface for generic geometry object coordinate transformation.
Definition: Transformation.hpp:11
void DM_API transform(const ITrafo &trafo, IGeometry &geom, bool inv=false)
provides a generic framework for transforming geometry objects
@ count
always last element
Base class of all geometry objects.
Definition: IGeometry.hpp:26
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