1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright 2009-2010 Sandro Santilli <strk@kbt.io>
7  * Copyright (C) 2019 Even Rouault <even.rouault@spatialys.com>
8  *
9  * This is free software; you can redistribute and/or modify it under
10  * the terms of the GNU Lesser General Public Licence as published
11  * by the Free Software Foundation.
12  * See the COPYING file for more information.
13  **********************************************************************
14  *
15  * Ported from rtgeom_geos.c from
16  *   rttopo - topology library
17  *   http://git.osgeo.org/gitea/rttopo/librttopo
18  * with relicensing from GPL to LGPL with Copyright holder permission.
19  *
20  **********************************************************************/
21 
22 #ifndef GEOS_OP_VALID_MAKEVALID_H
23 #define GEOS_OP_VALID_MAKEVALID_H
24 
25 #include <geos/export.h>
26 
27 #include <memory>
28 
29 #ifdef _MSC_VER
30 #pragma warning(push)
31 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
32 #endif
33 
34 // Forward declarations
35 namespace geos {
36 namespace geom {
37 class Geometry;
38 }
39 }
40 
41 namespace geos {
42 namespace operation { // geos::operation
43 namespace valid { // geos::operation::valid
44 
45 /** \brief  The function attempts to create a valid representation of a given
46  * invalid geometry without losing any of the input vertices.
47  *
48  * Already-valid geometries are returned without further intervention.
49  *
50  * Supported inputs are: POINTS, MULTIPOINTS, LINESTRINGS, MULTILINESTRINGS, POLYGONS, MULTIPOLYGONS and GEOMETRYCOLLECTIONS containing any mix of them.
51  *
52  * In case of full or partial dimensional collapses, the output geometry may be a collection of lower-to-equal dimension geometries or a geometry of lower dimension.
53  *
54  * Single polygons may become multi-geometries in case of self-intersections.
55  */
56 class GEOS_DLL MakeValid {
57 
58 public:
59 
60     /** \brief
61      * Create a MakeValid object.
62      */
63     MakeValid() = default;
64 
65     ~MakeValid() = default;
66 
67     /** \brief Return a valid version of the input geometry. */
68     std::unique_ptr<geom::Geometry> build(const geom::Geometry* geom);
69 };
70 
71 } // namespace geos::operation::valid
72 } // namespace geos::operation
73 } // namespace geos
74 
75 #ifdef _MSC_VER
76 #pragma warning(pop)
77 #endif
78 
79 #endif // GEOS_OP_VALID_MAKEVALID_H
80