/src/geos/include/geos/noding/SegmentIntersector.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 | | #pragma once |
16 | | |
17 | | #include <cstddef> |
18 | | #include <geos/export.h> |
19 | | |
20 | | // Forward declarations |
21 | | namespace geos { |
22 | | namespace noding { |
23 | | class SegmentString; |
24 | | } |
25 | | } |
26 | | |
27 | | namespace geos { |
28 | | namespace noding { // geos.noding |
29 | | |
30 | | /** |
31 | | * \brief |
32 | | * Processes possible intersections detected by a Noder. |
33 | | * |
34 | | * The SegmentIntersector is passed to a Noder. |
35 | | * The addIntersections method is called whenever the Noder |
36 | | * detects that two SegmentStrings <i>might</i> intersect. |
37 | | * This class may be used either to find all intersections, or |
38 | | * to detect the presence of an intersection. In the latter case, |
39 | | * Noders may choose to short-circuit their computation by calling the |
40 | | * isDone method. |
41 | | * This class is an example of the <i>Strategy</i> pattern. |
42 | | * |
43 | | * @version 1.7 |
44 | | */ |
45 | | class GEOS_DLL SegmentIntersector { |
46 | | |
47 | | public: |
48 | | |
49 | | /** |
50 | | * This method is called by clients |
51 | | * of the SegmentIntersector interface to process |
52 | | * intersections for two segments of the SegmentStrings |
53 | | * being intersected. |
54 | | */ |
55 | | virtual void processIntersections( |
56 | | SegmentString* e0, std::size_t segIndex0, |
57 | | SegmentString* e1, std::size_t segIndex1) = 0; |
58 | | |
59 | | /** |
60 | | * \brief |
61 | | * Reports whether the client of this class |
62 | | * needs to continue testing all intersections in an arrangement. |
63 | | * |
64 | | * @return true if there is not need to continue testing segments |
65 | | * |
66 | | * The default implementation always return false (process all intersections). |
67 | | */ |
68 | | virtual bool |
69 | | isDone() const |
70 | 0 | { |
71 | 0 | return false; |
72 | 0 | } |
73 | | |
74 | | virtual |
75 | | ~SegmentIntersector() |
76 | 527k | { } |
77 | | |
78 | | protected: |
79 | | |
80 | 527k | SegmentIntersector() {} |
81 | | |
82 | | }; |
83 | | |
84 | | /// Temporary typedef for namespace transition |
85 | | typedef SegmentIntersector nodingSegmentIntersector; |
86 | | |
87 | | } // namespace geos.noding |
88 | | } // namespace geos |
89 | | |