MeshKernel
Public Types | Public Member Functions | List of all members
meshkernel::PolygonalEnclosure Class Reference

A region enclosed by a polygonal permieter. More...

#include <PolygonalEnclosure.hpp>

Public Types

enum  Region { Region::None, Region::Exterior, Region::Interior }
 The part of the enclosure a point is found. More...
 

Public Member Functions

 PolygonalEnclosure (const std::vector< Point > &points, Projection projection)
 Constructor.
 
const PolygonOuter () const
 The outer perimeter polygon.
 
UInt NumberOfInner () const
 The number of inner hole regions.
 
const PolygonInner (size_t i) const
 Get an inner polygon.
 
UInt GetNumberOfNodes () const
 Get the number of nodes in the enclosure, both outer and all inner polygons. More...
 
bool Contains (const Point &pnt) const
 Determine if the point lies in the polygon. More...
 
Region ContainsRegion (const Point &pnt) const
 Determine in which part of the enclosure the point is.
 
UInt NumberOfPoints (const bool includeInterior) const
 Get the number of points making up the polygon, including interior if requested.
 
void SnapToLandBoundary (size_t startIndex, size_t endIndex, const LandBoundary &landBoundary)
 Snap all or part of the outer perimeter polygon to the land boundary.
 
std::vector< PointRefine (UInt startIndex, UInt endIndex, double refinementDistance) const
 Refine the polygon. More...
 
std::vector< PointLinearRefine (UInt startIndex, UInt endIndex) const
 Linear refine the outer polygon. More...
 
std::tuple< std::unique_ptr< PolygonalEnclosure >, std::unique_ptr< PolygonalEnclosure > > OffsetCopy (double distance, bool outwardsAndInwards) const
 Makes a new polygonal enclosure from an existing one, by offsetting it by a distance (copypol) More...
 

Detailed Description

A region enclosed by a polygonal permieter.

Each region is described by an outer perimeter polygon. It may contain 0 or more holes, each described by an inner polygon.

Member Enumeration Documentation

◆ Region

The part of the enclosure a point is found.

Enumerator
None 

The point is not contained with the enclosure.

Exterior 

The point is contained within the outer perimeter of the enclosure.

Interior 

The point is contained within one of the island, interior perimeters of the enclosure.

Member Function Documentation

◆ Contains()

bool meshkernel::PolygonalEnclosure::Contains ( const Point pnt) const

Determine if the point lies in the polygon.

If the point lies within the outer polygon but outside any inner polygons

◆ GetNumberOfNodes()

UInt meshkernel::PolygonalEnclosure::GetNumberOfNodes ( ) const

Get the number of nodes in the enclosure, both outer and all inner polygons.

Note
Does not include any separator nodes

◆ LinearRefine()

std::vector<Point> meshkernel::PolygonalEnclosure::LinearRefine ( UInt  startIndex,
UInt  endIndex 
) const

Linear refine the outer polygon.

Parameters
[in]startIndexThe start index of the sections to be refined
[in]endIndexThe end index of the sections to be refined
Returns
Points making the polygon with the sections indicated refined.

◆ OffsetCopy()

std::tuple<std::unique_ptr<PolygonalEnclosure>, std::unique_ptr<PolygonalEnclosure> > meshkernel::PolygonalEnclosure::OffsetCopy ( double  distance,
bool  outwardsAndInwards 
) const

Makes a new polygonal enclosure from an existing one, by offsetting it by a distance (copypol)

Parameters
[in]distanceThe offset distance
[in]outwardsAndInwardsOffset outwards only or both outwards and inwards
Note
Order of result is outward offset first, inward offset second, this may be nullptr.
Returns
The new offset polygon(s), may be nullptr if outwardsAndInwards is false, i.e. only outwards required.

◆ Refine()

std::vector<Point> meshkernel::PolygonalEnclosure::Refine ( UInt  startIndex,
UInt  endIndex,
double  refinementDistance 
) const

Refine the polygon.

Parameters
[in]startIndexThe start index of the sections to be refined
[in]endIndexThe end index of the sections to be refined
[in]refinementDistanceThe maximum distance between points.
Returns
Points making the polygon with the sections indicated refined.

The documentation for this class was generated from the following file: