GEOS 3.13.1
ComponentJumpChecker.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://libgeos.org
5 *
6 * Copyright (C) 2006 Refractions Research Inc.
7 * Copyright (C) 2023 Martin Davis <mtnclimb@gmail.com>
8 * Copyright (C) 2023 Paul Ramsey <pramsey@cleverelephant.ca>
9 *
10 * This is free software; you can redistribute and/or modify it under
11 * the terms of the GNU Lesser General Licence as published
12 * by the Free Software Foundation.
13 * See the COPYING file for more information.
14 *
15 **********************************************************************/
16
17#pragma once
18
19#include <geos/export.h>
20#include <vector>
21#include <memory>
22
23
24// Forward declarations
25namespace geos {
26namespace geom {
27class Coordinate;
28class CoordinateSequence;
29class Envelope;
30class LineSegment;
31}
32namespace simplify {
33class TaggedLineString;
34}
35}
36
40
41namespace geos {
42namespace simplify { // geos::simplify
43
44
45class GEOS_DLL ComponentJumpChecker {
46
47private:
48
49 const std::vector<TaggedLineString*>& components;
50
51 static bool hasJumpAtComponent(
52 const Coordinate& compPt,
53 const TaggedLineString* line,
54 std::size_t start, std::size_t end,
55 const LineSegment& seg);
56
57 static bool hasJumpAtComponent(
58 const Coordinate& compPt,
59 const LineSegment* seg1, const LineSegment* seg2,
60 const LineSegment& seg);
61
62 static std::size_t crossingCount(
63 const Coordinate& compPt,
64 const LineSegment& seg);
65
66 static std::size_t crossingCount(
67 const Coordinate& compPt,
68 const LineSegment* seg1, const LineSegment* seg2);
69
70 std::size_t static crossingCount(
71 const Coordinate& compPt,
72 const TaggedLineString* line,
73 std::size_t start, std::size_t end);
74
75 static Envelope computeEnvelope(
76 const LineSegment* seg1, const LineSegment* seg2);
77
78 static Envelope computeEnvelope(
79 const TaggedLineString* line,
80 std::size_t start, std::size_t end);
81
82
83public:
84
85 ComponentJumpChecker(const std::vector<TaggedLineString*>& taggedLines)
86 : components(taggedLines)
87 {}
88
89 bool hasJump(
90 const TaggedLineString* line,
91 std::size_t start, std::size_t end,
92 const LineSegment& seg) const;
93
106 bool hasJump(
107 const TaggedLineString* line,
108 const LineSegment* seg1,
109 const LineSegment* seg2,
110 const LineSegment& seg) const;
111
112};
113
114} // namespace geos::simplify
115} // namespace geos
116
117
118
119
120
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:217
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition Envelope.h:59
Definition LineSegment.h:61
Basic namespace for all GEOS functionalities.
Definition geos.h:39