GEOS 3.14.0dev
Public Types | Public Member Functions | Static Public Member Functions | List of all members
geos::operation::intersection::Rectangle Class Reference

Clipping rectangle. More...

#include <Rectangle.h>

Public Types

enum  Position {
  Inside = 1 , Outside = 2 , Left = 4 , Top = 8 ,
  Right = 16 , Bottom = 32 , TopLeft = Top | Left , TopRight = Top | Right ,
  BottomLeft = Bottom | Left , BottomRight = Bottom | Right
}
 Position with respect to a clipping rectangle.
 

Public Member Functions

 Rectangle (double x1, double y1, double x2, double y2)
 Construct a clipping rectangle.
 
double xmin () const
 
double ymin () const
 
double xmax () const
 
double ymax () const
 
std::unique_ptr< geom::PolygontoPolygon (const geom::GeometryFactory &f) const
 
std::unique_ptr< geom::LinearRingtoLinearRing (const geom::GeometryFactory &f) const
 
Position position (double x, double y) const
 Establish position of coordinate with respect to a Rectangle.
 

Static Public Member Functions

static bool onEdge (Position pos)
 Test if the given position is on a Rectangle edge.
 
static bool onSameEdge (Position pos1, Position pos2)
 Test if the given positions are on the same Rectangle edge.
 
static Position nextEdge (Position pos)
 Next edge in clock-wise direction.
 

Detailed Description

Clipping rectangle.

A clipping rectangle defines the boundaries of the rectangle by defining the limiting x- and y-coordinates. The clipping rectangle must be non-empty. In addition, methods are provided for specifying the location of a given coordinate with respect to the clipping rectangle similarly to the Cohen-Sutherland clipping algorithm.

Constructor & Destructor Documentation

◆ Rectangle()

geos::operation::intersection::Rectangle::Rectangle ( double  x1,
double  y1,
double  x2,
double  y2 
)

Construct a clipping rectangle.

Parameters
x1x-coordinate of the left edge
y1y-coordinate of the bottom edge
x2x-coordinate of the right edge
y2y-coordinate of the right edge
Exceptions
IllegalArgumentExceptionif the rectangle is empty

Member Function Documentation

◆ nextEdge()

static Position geos::operation::intersection::Rectangle::nextEdge ( Position  pos)
inlinestatic

Next edge in clock-wise direction.

Parameters
posPosition
Returns
next Position in clock-wise direction

◆ onEdge()

static bool geos::operation::intersection::Rectangle::onEdge ( Position  pos)
inlinestatic

Test if the given position is on a Rectangle edge.

Parameters
posRectangle::Position
Returns
true, if the position is on an edge

◆ onSameEdge()

static bool geos::operation::intersection::Rectangle::onSameEdge ( Position  pos1,
Position  pos2 
)
inlinestatic

Test if the given positions are on the same Rectangle edge.

Parameters
pos1Position of first coordinate
pos2Position of second coordinate
Returns
true, if the positions are on the same edge

◆ position()

Position geos::operation::intersection::Rectangle::position ( double  x,
double  y 
) const
inline

Establish position of coordinate with respect to a Rectangle.

Parameters
xx-coordinate
yy-coordinate
Returns
Position of the coordinate

◆ toPolygon()

std::unique_ptr< geom::Polygon > geos::operation::intersection::Rectangle::toPolygon ( const geom::GeometryFactory f) const
Returns
the rectangle as a polygon geometry
Note
Ownership transferred to caller

◆ xmax()

double geos::operation::intersection::Rectangle::xmax ( ) const
inline
Returns
the maximum x-coordinate of the rectangle

◆ xmin()

double geos::operation::intersection::Rectangle::xmin ( ) const
inline
Returns
the minimum x-coordinate of the rectangle

◆ ymax()

double geos::operation::intersection::Rectangle::ymax ( ) const
inline
Returns
the maximum y-coordinate of the rectangle

◆ ymin()

double geos::operation::intersection::Rectangle::ymin ( ) const
inline
Returns
the minimum y-coordinate of the rectangle

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