NAVTOR SDK  v.3.0
Software Development Kit for fast and efficient development of ECDIS, ECS and generic marine applications
2d_geometry_path_utils_interface.h
Go to the documentation of this file.
1 #ifndef SDK_2D_GEOMETRY_PATH_UTILS_INTERFACE_H_
12 #define SDK_2D_GEOMETRY_PATH_UTILS_INTERFACE_H_
13 #pragma once
14 
15 #include <base/inc/platform.h>
16 #include <base/inc/base_types.h>
22 #include "2d_geometry_objects.h"
23 
24 namespace sdk {
25 namespace geometry {
26 
30 {
37 
41 class I2DGeometryPathUtils : public sdk::ISDKComponent
42 {
43 public:
45  virtual SDKResult SDK_CALLTYPE IsEmpty(bool& is_empty) const throw() = 0;
46 
48  virtual SDKResult SDK_CALLTYPE IsInfinite(
49  bool& is_infinite) const throw() = 0;
50 
53  virtual SDKResult SDK_CALLTYPE CalcBounds(
54  const SDKMatrix3X2& transformation_matrix,
55  SDKRectF2D& bounds) const throw() = 0;
56 
60  virtual SDKResult SDK_CALLTYPE FastCalcBounds(
61  const SDKMatrix3X2& transformation_matrix,
62  SDKRectF2D& bounds) const throw() = 0;
63 
66  virtual SDKResult SDK_CALLTYPE CalcPerimeter(
67  float& perimeter) const throw() = 0;
68 
71  virtual SDKResult SDK_CALLTYPE CalcArea(float& area) const throw() = 0;
72 
76  virtual SDKResult SDK_CALLTYPE CalcPointByDistance(const float& distance,
77  const SDKMatrix3X2& transformation_matrix, SDKPointF2D& point,
78  SDKPointF2D& tangent) const throw() = 0;
79 
82  virtual SDKResult SDK_CALLTYPE CompareWithPath(
83  const GeometryPathSP& input_path,
84  const SDKMatrix3X2& input_path_transformation_matrix,
85  GeometryPathCompareResult& compare_result) const throw() = 0;
86 
89  virtual SDKResult SDK_CALLTYPE IsPointInsideArea(const SDKPointF2D& point,
90  const SDKMatrix3X2& transformation_matrix,
91  bool& is_inside) const throw() = 0;
92 
95  virtual SDKResult SDK_CALLTYPE IsPointOnEdge(const SDKPointF2D& point,
96  const SDKMatrix3X2& transformation_matrix, const float& edge_width,
97  bool& is_on_edge) const throw() = 0;
98 
107  virtual SDKResult SDK_CALLTYPE ClipByRect(const SDKRectF2D& rect,
108  GeometryPathSP& clipped_path,
109  GeometryType clip_mode = kGMT_Surface,
110  GeometryPathCompareResult *clip_result = NULL) const throw() = 0;
111 
112  template <class Box>
113  SDKResult ClipByRect(const Box& box,
114  GeometryPathSP& clipped_path,
115  GeometryType clip_mode = kGMT_Surface,
116  GeometryPathCompareResult *clip_result = NULL) const throw()
117  {
118  const typename Box::point_type& p1 = box.min_corner();
119  const typename Box::point_type& p2 = box.max_corner();
120  SDKRectF2D rect =
121  {
122  static_cast<float>(p1.template get<0>()),
123  static_cast<float>(p1.template get<1>()),
124  static_cast<float>(p2.template get<0>() - p1.template get<0>()),
125  static_cast<float>(p2.template get<1>() - p1.template get<1>()),
126  };
127  return this->ClipByRect(rect, clipped_path, clip_mode, clip_result);
128  }
129 
137  virtual SDKResult SDK_CALLTYPE IsIntersect(const SDKRectF2D& rect,
138  GeometryType clip_mode = kGMT_Surface,
139  GeometryPathCompareResult *clip_result = NULL) const throw() = 0;
140 
141  template <class Box>
142  SDKResult IsIntersect(const Box& box,
143  GeometryType clip_mode = kGMT_Surface,
144  GeometryPathCompareResult *clip_result = NULL) const throw()
145  {
146  const typename Box::point_type& p1 = box.min_corner();
147  const typename Box::point_type& p2 = box.max_corner();
148  SDKRectF2D rect =
149  {
150  static_cast<float>(p1.template get<0>()),
151  static_cast<float>(p1.template get<1>()),
152  static_cast<float>(p2.template get<0>() - p1.template get<0>()),
153  static_cast<float>(p2.template get<1>() - p1.template get<1>()),
154  };
155  return this->IsIntersect(rect, clip_mode, clip_result);
156  }
157 
159  SDK_IMPLEMENT_IID(I2DGeometryPathUtils)
160  SDK_END_INTERFACE(I2DGeometryPathUtils)
161 };
162 SDK_DECLARE_IID(I2DGeometryPathUtils)
163 } // namespace geometry
164 } // namespace sdk
165 
166 #endif // SDK_2D_GEOMETRY_PATH_UTILS_INTERFACE_H_
sdk::geometry::I2DGeometryPathUtils::FastCalcBounds
virtual SDKResult SDK_CALLTYPE FastCalcBounds(const SDKMatrix3X2 &transformation_matrix, SDKRectF2D &bounds) const =0
Calculates the geometry path bounding rectangle Inaccurate, but fast algorithm, for exact bounds use ...
sdk::geometry::I2DGeometryPathUtils::IsInfinite
virtual SDKResult SDK_CALLTYPE IsInfinite(bool &is_infinite) const =0
Indicates whether this geometry is a plane with infinite borders.
geometry.h
Describes interfaces that manages a geometry objects.
base_types.h
SDK base types.
sdk::geometry::I2DGeometryPathUtils
Describes interface for 2D geometry path, which allows to get some different properties and use sever...
Definition: 2d_geometry_path_utils_interface.h:41
sdk::geometry::GeometryPathCompareResult_InputPathInside
@ GeometryPathCompareResult_InputPathInside
Passed input geometry path is fully inside given geometry path.
Definition: 2d_geometry_path_utils_interface.h:33
sdk::geometry::I2DGeometryPathUtils::CalcBounds
virtual SDKResult SDK_CALLTYPE CalcBounds(const SDKMatrix3X2 &transformation_matrix, SDKRectF2D &bounds) const =0
Calculates the geometry path bounding rectangle For infinite geometry the bounding rect has infinite ...
sdk::geometry::I2DGeometryPathUtils::CalcPerimeter
virtual SDKResult SDK_CALLTYPE CalcPerimeter(float &perimeter) const =0
Calculates the perimeter of geometry path For infinite geometry the SDK_MAX_FLOAT value will be retur...
SDKRectF2D
2D Rectangle
Definition: geometry_base_types.h:1295
sdk::geometry::GeometryPathCompareResult_Unknown
@ GeometryPathCompareResult_Unknown
Can't compare two geometry paths.
Definition: 2d_geometry_path_utils_interface.h:31
sdk_string_handler.h
Wrappers and helper functions for SDKString.
sdk::geometry::I2DGeometryPathUtils::CompareWithPath
virtual SDKResult SDK_CALLTYPE CompareWithPath(const GeometryPathSP &input_path, const SDKMatrix3X2 &input_path_transformation_matrix, GeometryPathCompareResult &compare_result) const =0
Compares the given geometry path with passed one Note, in case one of paths is infinite,...
SDKResult
SDKInt32 SDKResult
Type of all error or return codes which SDK functions can end with.
Definition: sdk_results.h:17
sdk::geometry::I2DGeometryPathUtils::IsIntersect
virtual SDKResult SDK_CALLTYPE IsIntersect(const SDKRectF2D &rect, GeometryType clip_mode=kGMT_Surface, GeometryPathCompareResult *clip_result=NULL) const =0
Quickly check is the geometry intersect the rectangle.
sdk::geometry::GeometryPathCompareResult_GivenPathInside
@ GeometryPathCompareResult_GivenPathInside
Given geometry path is fully inside passed input geometry path.
Definition: 2d_geometry_path_utils_interface.h:34
sdk::geometry::GeometryPathCompareResult
GeometryPathCompareResult
Possible results of geometry path compare methods.
Definition: 2d_geometry_path_utils_interface.h:29
sdk_component_interface.h
Common base SDK interfaces.
sdk::geometry::I2DGeometryPathUtils::ClipByRect
virtual SDKResult SDK_CALLTYPE ClipByRect(const SDKRectF2D &rect, GeometryPathSP &clipped_path, GeometryType clip_mode=kGMT_Surface, GeometryPathCompareResult *clip_result=NULL) const =0
Quickly clip the geometry by the rectangle.
SDKPointF2D
Single 2D point.
Definition: geometry_base_types.h:33
sdk::geometry::I2DGeometryPathUtils::CalcPointByDistance
virtual SDKResult SDK_CALLTYPE CalcPointByDistance(const float &distance, const SDKMatrix3X2 &transformation_matrix, SDKPointF2D &point, SDKPointF2D &tangent) const =0
Calculates the appropriate point position on path by using distance value from start No point positio...
sdk::geometry::I2DGeometryPathUtils::IsPointInsideArea
virtual SDKResult SDK_CALLTYPE IsPointInsideArea(const SDKPointF2D &point, const SDKMatrix3X2 &transformation_matrix, bool &is_inside) const =0
Checks, if point lays inside given path Point is always lays inside infinite path.
platform.h
Describes the platform constants.
sdk::geometry::GeometryPathCompareResult_NoIntersection
@ GeometryPathCompareResult_NoIntersection
Both of paths does not intersects at all.
Definition: 2d_geometry_path_utils_interface.h:32
matrix_base_types.h
Matrix base definitions.
geometry_base_types.h
Geometry base types.
kGMT_Surface
@ kGMT_Surface
A Surface is a collection of rings.
Definition: geometry.h:83
GeometryType
GeometryType
Available types of geometry objects.
Definition: geometry.h:73
sdk::geometry::I2DGeometryPathUtils::IsEmpty
virtual SDKResult SDK_CALLTYPE IsEmpty(bool &is_empty) const =0
Indicates whether this geometry contains any points.
sdk::geometry::I2DGeometryPathUtils::CalcArea
virtual SDKResult SDK_CALLTYPE CalcArea(float &area) const =0
Calculates the area of geometry path For infinite geometry the SDK_MAX_FLOAT value will be returned a...
sdk::geometry::GeometryPathCompareResult_Intersection
@ GeometryPathCompareResult_Intersection
Geometry paths intersects, but neither completely contains the other.
Definition: 2d_geometry_path_utils_interface.h:35
sdk::geometry::I2DGeometryPathUtils::IsPointOnEdge
virtual SDKResult SDK_CALLTYPE IsPointOnEdge(const SDKPointF2D &point, const SDKMatrix3X2 &transformation_matrix, const float &edge_width, bool &is_on_edge) const =0
Checks, if point lays on the edge on given path Point is always does not lays on infinite path edge.