GeometricOperations.hpp
1 #ifndef DM_GEOMETRIC_OPERATION_HPP_INCLUDED
2 #define DM_GEOMETRIC_OPERATION_HPP_INCLUDED
3 
4 #ifdef _MSC_VER
5  #pragma once
6 #endif
7 
8 #include "DM/config.hpp"
9 #include "DM/AutoLink.hpp"
10 #include "DM/IGeometry.hpp"
11 #include "DM/IPoint.hpp"
12 #include "DM/IPolyline.hpp"
13 #include "DM/IPolygon.hpp"
14 #include "DM/IWindow.hpp"
15 
16 
17 DM_NAMESPACE_BEGIN
18 
19 /// \brief provides a set of geometric operations for geometry objects (e.g. intersection, join, differences, etc. )
20 namespace GeometricOperations
21 {
22 
23  /// \brief Intersects a polyline with a polygon object (clipping)
24  /**
25  The intersection process is done in 2D. The heights of new points will be computed from the height information of the
26  corresponding intersecting segments. In case both segments have height information available, the height at the new point
27  will be averaged. This behavior can be changed by enabling or disabling the ignorePolygonHeights flag. If the flag is
28  disabled (=default behavior) height information of polygon vertices will be ignored for height computation of new points.
29  Hence, only the polyline height values will play a roll.
30 
31  \param[in] line polyline object to be clipped (object stays unchanged)
32  \param[in] polygon polygon object use for clipping
33  \param[in] keepPointOrder Flag if orientation of the resulting line should be preserved (e.g.
34  important for profiles). If the orientation is irrelevant disable the flag
35  to improve processing speed.
36  \param[in] ignorePolygonHeights enabling or disabling heights of polygon vertices for compute new points (see details)
37  \return clipped polyline object
38  */
39  PolylineHandle DM_API intersect(const IPolyline &line, const IPolygon &polygon,
40  bool keepPointOrder = false, bool ignorePolygonHeights = false);
41  PolylineHandle DM_API intersect(const IPolygon &polygon, const IPolyline &line,
42  bool keepPointOrder = false, bool ignorePolygonHeights = false); ///< see above
43 
44 
45  /// \brief intersection of two polygon objects (polygon1 'and' polygon2)
46  /// whereas polylines only represents the boundary, polygons represent the full area of closed regions. hence,
47  /// the intersection of two polygons resulting a polygon containing the overlapping area of the source polygons
48  PolygonHandle DM_API intersect(const IPolygon &polygon1, const IPolygon &polygon2);
49 
50  /// \brief intersection of two window objects (window1 'and' window2)
51  /// if the two windows do not intersect and empty handle is returned
52  WindowHandle DM_API intersect(const IWindow &window1, const IWindow &window2);
53 
54 
55  /// \brief join of two polygons (polygon1 'or' polygon2)
56  PolygonHandle DM_API join(const IPolygon &polygon1, const IPolygon &polygon2);
57 
58  /// \brief difference of two polygons (polygon1 \ polygon2)
59  PolygonHandle DM_API difference(const IPolygon &polygon1, const IPolygon &polygon2);
60 
61  /// \brief symmetric difference of two polygons ((polygon1 \ polygon2) 'or' (polygon2 \ polygon1))
62  PolygonHandle DM_API symmetric_difference(const IPolygon &polygon1, const IPolygon &polygon2);
63 
64 
65  /// point-in-polygon test
66  bool DM_API isIntersecting(const IPoint &pt, const IPolygon &polygon);
67  bool DM_API isIntersecting(const IPolygon &polygon, const IPoint &pt ); ///< see above
68 }
69 
70 DM_NAMESPACE_END
71 
72 
73 #endif //DM_GEOMETRIC_OPERATION_HPP_INCLUDED