RectangleContains.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************
*
* Last port: operation/predicate/RectangleContains.java rev 1.5 (JTS-1.10)
*
**********************************************************************/
#pragma once
#include <geos/export.h>
#include <geos/geom/Polygon.h> // for inlines
// Forward declarations
namespace geos {
namespace geom {
class Envelope;
class Geometry;
class Point;
class Coordinate;
class LineString;
//class Polygon;
}
}
namespace geos {
namespace operation { // geos::operation
namespace predicate { // geos::operation::predicate
class GEOS_DLL RectangleContains {
private:
const geom::Envelope& rectEnv;
bool isContainedInBoundary(const geom::Geometry& geom);
bool isPointContainedInBoundary(const geom::Point& geom);
bool isPointContainedInBoundary(const geom::CoordinateXY& pt);
bool isLineStringContainedInBoundary(const geom::LineString& line);
bool isLineSegmentContainedInBoundary(const geom::Coordinate& p0,
const geom::Coordinate& p1);
public:
static bool
contains(const geom::Polygon& rect, const geom::Geometry& b)
{
RectangleContains rc(rect);
return rc.contains(b);
}
RectangleContains(const geom::Polygon& rect)
:
rectEnv(*(rect.getEnvelopeInternal()))
{}
bool contains(const geom::Geometry& geom);
// Declare type as noncopyable
RectangleContains(const RectangleContains& other) = delete;
RectangleContains& operator=(const RectangleContains& rhs) = delete;
};
} // namespace geos::operation::predicate
} // namespace geos::operation
} // namespace geos
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:217
geos::geom::Envelope
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition Envelope.h:59
geos::geom::Geometry
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:196
geos::geom::LineString
Definition LineString.h:66
geos::geom::Point
Definition Point.h:61
geos::geom::Polygon
Represents a linear polygon, which may include holes.
Definition Polygon.h:61
geos::operation::predicate::RectangleContains
Optimized implementation of spatial predicate "contains" for cases where the first Geometry is a rect...
Definition RectangleContains.h:50
geos::operation::predicate::RectangleContains::RectangleContains
RectangleContains(const geom::Polygon &rect)
Definition RectangleContains.h:103
geos::geom
Definition Angle.h:26
geos::operation::predicate
Classes which implement topological predicates optimized for particular kinds of geometries.
Definition namespaces.h:236
geos::operation
Provides classes for implementing operations on geometries.
Definition CleanCoverage.h:34
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38