Loading [MathJax]/extensions/tex2jax.js
MeshKernel
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages Concepts
LandBoundary.hpp
1//---- GPL ---------------------------------------------------------------------
2//
3// Copyright (C) Stichting Deltares, 2011-2021.
4//
5// This program is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation version 3.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16//
17// contact: delft3d.support@deltares.nl
18// Stichting Deltares
19// P.O. Box 177
20// 2600 MH Delft, The Netherlands
21//
22// All indications and logos of, and references to, "Delft3D" and "Deltares"
23// are registered trademarks of Stichting Deltares, and remain the property of
24// Stichting Deltares. All rights reserved.
25//
26//------------------------------------------------------------------------------
27
28#pragma once
29
30#include <vector>
31
32#include "MeshKernel/BoundingBox.hpp"
33#include "MeshKernel/Polygons.hpp"
34
35namespace meshkernel
36{
37
40 {
41 public:
43 explicit LandBoundary(const std::vector<Point>& landBoundary);
44
46 void FindNearestPoint(const Point& samplePoint,
47 const Projection& projection,
48 Point& nearestPoint,
49 double& minimumDistance,
50 UInt& segmentStartIndex,
51 double& scaledDistanceToStart) const;
52
54 Point FindNearestPoint(const Point& samplePoint,
55 const Projection& projection) const;
56
58 size_t GetNumNodes() const;
59
61 bool IsEmpty() const;
62
64 const Point& Node(const size_t i) const;
65
67 const std::vector<Point>& GetNodes() const;
68
70 void AddSegment(const Point& leftNode, const Point& rightNode);
71
73 Point ClosestPoint(const Point& point, const size_t point1Index, const size_t point2Index, const Projection projection) const;
74
76 BoundingBox GetBoundingBox(const size_t startIndex, const size_t endIndex) const;
77
80
82 std::vector<std::pair<UInt, UInt>> FindPolylineIndices() const;
83
85 std::vector<bool> GetNodeMask(const Polygons& polygons) const;
86
87 private:
89 std::vector<Point> m_nodes;
90 };
91
92} // namespace meshkernel
93
95{
96 return m_nodes.size();
97}
98
100{
101 return m_nodes.empty();
102}
103
104inline const meshkernel::Point& meshkernel::LandBoundary::Node(const size_t i) const
105{
106 return m_nodes[i];
107}
108
109inline const std::vector<meshkernel::Point>& meshkernel::LandBoundary::GetNodes() const
110{
111 return m_nodes;
112}
A class defining a bounding box.
Definition BoundingBox.hpp:40
A class containing the land boundary polylines.
Definition LandBoundary.hpp:40
BoundingBox GetBoundingBox(const size_t startIndex, const size_t endIndex) const
Get the bounding box for the section of the land boundary.
void FindNearestPoint(const Point &samplePoint, const Projection &projection, Point &nearestPoint, double &minimumDistance, UInt &segmentStartIndex, double &scaledDistanceToStart) const
Find the nearest point on the land boundary (toland)
size_t GetNumNodes() const
Gets the number of land boundary nodes.
Definition LandBoundary.hpp:94
BoundingBox GetBoundingBox() const
Get the bounding box for the whole land boundary.
void AddSegment(const Point &leftNode, const Point &rightNode)
Add a new land boundary polyline segment.
const Point & Node(const size_t i) const
Get the node at position i.
Definition LandBoundary.hpp:104
const std::vector< Point > & GetNodes() const
Get vector containing all land boundary nodes.
Definition LandBoundary.hpp:109
std::vector< bool > GetNodeMask(const Polygons &polygons) const
Get vector of Boolean values indicating a valid node.
Point FindNearestPoint(const Point &samplePoint, const Projection &projection) const
Find the nearest point on the land boundary (toland)
std::vector< std::pair< UInt, UInt > > FindPolylineIndices() const
Find all start-end positions of the individual poly-lines that make up the land boundary.
LandBoundary(const std::vector< Point > &landBoundary)
Construct with vector of points defining the land boundary.
bool IsEmpty() const
@ Determine if the land boundary object is empty
Definition LandBoundary.hpp:99
Point ClosestPoint(const Point &point, const size_t point1Index, const size_t point2Index, const Projection projection) const
Find the closest of two points to a given point.
A struct describing a point in a two-dimensional space.
Definition Point.hpp:41
A class containing a list of polygonaly enclosed regions.
Definition Polygons.hpp:45
Contains the logic of the C++ static library.
Definition AveragingInterpolation.hpp:37
Projection
Enumerator describing the supported projections.
Definition Definitions.hpp:43
std::uint32_t UInt
Integer type used when indexing mesh graph entities.
Definition Definitions.hpp:39