Coverage Report

Created: 2025-10-28 07:10

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/geos/include/geos/geom/prep/PreparedGeometryFactory.h
Line
Count
Source
1
/**********************************************************************
2
 *
3
 * GEOS - Geometry Engine Open Source
4
 * http://geos.osgeo.org
5
 *
6
 * Copyright (C) 2006 Refractions Research Inc.
7
 *
8
 * This is free software; you can redistribute and/or modify it under
9
 * the terms of the GNU Lesser General Public Licence as published
10
 * by the Free Software Foundation.
11
 * See the COPYING file for more information.
12
 *
13
 *
14
 **********************************************************************
15
 *
16
 * Last port: geom/prep/PreparedGeometryFactory.java rev. 1.4 (JTS-1.10)
17
 *
18
 **********************************************************************/
19
20
#pragma once
21
22
#include <geos/export.h>
23
#include <geos/geom/prep/PreparedGeometry.h>
24
25
#include <memory>
26
27
namespace geos {
28
namespace geom {
29
namespace prep {
30
class PreparedGeometry;
31
}
32
}
33
}
34
35
36
namespace geos {
37
namespace geom { // geos::geom
38
namespace prep { // geos::geom::prep
39
40
41
/**
42
 * \brief
43
 * A factory for creating {@link PreparedGeometry}s.
44
 *
45
 * It chooses an appropriate implementation of PreparedGeometry
46
 * based on the geoemtric type of the input geometry.
47
 * In the future, the factory may accept hints that indicate
48
 * special optimizations which can be performed.
49
 *
50
 * @author Martin Davis
51
 *
52
 */
53
class GEOS_DLL PreparedGeometryFactory {
54
public:
55
56
    /**
57
     * Creates a new {@link PreparedGeometry} appropriate for the argument {@link Geometry}.
58
     *
59
     * @param geom the geometry to prepare
60
     * @return the prepared geometry
61
     */
62
    static std::unique_ptr<PreparedGeometry>
63
    prepare(const geom::Geometry* geom)
64
0
    {
65
0
        PreparedGeometryFactory pf;
66
0
        return pf.create(geom);
67
0
    }
68
69
    /**
70
     * Destroys {@link PreparedGeometry} allocated with the factory.
71
     *
72
     * @param geom to be deallocated
73
     */
74
    static void
75
    destroy(const PreparedGeometry* geom)
76
0
    {
77
0
        delete geom;
78
0
    }
79
80
    /**
81
     * Creates a new {@link PreparedGeometry} appropriate for the argument {@link Geometry}.
82
     *
83
     * @param geom the geometry to prepare
84
     * @return the prepared geometry
85
     */
86
    std::unique_ptr<PreparedGeometry> create(const geom::Geometry* geom) const;
87
88
};
89
90
} // namespace geos::geom::prep
91
} // namespace geos::geom
92
} // namespace geos
93