GEOS 3.14.0dev
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
37namespace geos {
38namespace simplify { // geos::simplify
39
40
41class GEOS_DLL ComponentJumpChecker {
42 using Coordinate = geos::geom::Coordinate;
43 using Envelope = geos::geom::Envelope;
44 using LineSegment = geos::geom::LineSegment;
45
46private:
47
48 const std::vector<TaggedLineString*>& components;
49
50 static bool hasJumpAtComponent(
51 const Coordinate& compPt,
52 const TaggedLineString* line,
53 std::size_t start, std::size_t end,
54 const LineSegment& seg);
55
56 static bool hasJumpAtComponent(
57 const Coordinate& compPt,
58 const LineSegment* seg1, const LineSegment* seg2,
59 const LineSegment& seg);
60
61 static std::size_t crossingCount(
62 const Coordinate& compPt,
63 const LineSegment& seg);
64
65 static std::size_t crossingCount(
66 const Coordinate& compPt,
67 const LineSegment* seg1, const LineSegment* seg2);
68
69 std::size_t static crossingCount(
70 const Coordinate& compPt,
71 const TaggedLineString* line,
72 std::size_t start, std::size_t end);
73
74 static Envelope computeEnvelope(
75 const LineSegment* seg1, const LineSegment* seg2);
76
77 static Envelope computeEnvelope(
78 const TaggedLineString* line,
79 std::size_t start, std::size_t end);
80
81
82public:
83
84 ComponentJumpChecker(const std::vector<TaggedLineString*>& taggedLines)
85 : components(taggedLines)
86 {}
87
88 bool hasJump(
89 const TaggedLineString* line,
90 std::size_t start, std::size_t end,
91 const LineSegment& seg) const;
92
105 bool hasJump(
106 const TaggedLineString* line,
107 const LineSegment* seg1,
108 const LineSegment* seg2,
109 const LineSegment& seg) const;
110
111};
112
113} // namespace geos::simplify
114} // namespace geos
115
116
117
118
119
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