geomgraph/index/SegmentIntersector.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2005-2006 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions 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.
*
**********************************************************************/
#pragma once
#include <geos/export.h>
#include <array>
#include <vector>
#include <geos/geom/Coordinate.h> // for composition
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
#endif
// Forward declarations
namespace geos {
namespace algorithm {
class LineIntersector;
}
namespace geomgraph {
class Node;
class Edge;
}
}
namespace geos {
namespace geomgraph { // geos::geomgraph
namespace index { // geos::geomgraph::index
class GEOS_DLL SegmentIntersector {
private:
bool hasIntersectionVar;
bool hasProper;
bool hasProperInterior;
geom::Coordinate properIntersectionPoint;
algorithm::LineIntersector* li;
bool includeProper;
bool recordIsolated;
int numIntersections;
std::array<std::vector<Node*>*, 2> bdyNodes;
bool isTrivialIntersection(Edge* e0, std::size_t segIndex0, Edge* e1, std::size_t segIndex1);
bool isBoundaryPoint(algorithm::LineIntersector* p_li,
std::array<std::vector<Node*>*, 2>& tstBdyNodes)
{
return isBoundaryPoint(p_li, tstBdyNodes[0]) || isBoundaryPoint(p_li, tstBdyNodes[1]);
};
bool isBoundaryPoint(algorithm::LineIntersector* li,
std::vector<Node*>* tstBdyNodes);
public:
static bool isAdjacentSegments(std::size_t i1, size_t i2)
{
return (i1 > i2 ? i1 - i2 : i2 - i1) == 1;
};
// testing only
int numTests;
//SegmentIntersector();
virtual
~SegmentIntersector() {}
SegmentIntersector(algorithm::LineIntersector* newLi,
bool newIncludeProper, bool newRecordIsolated)
:
hasIntersectionVar(false),
hasProper(false),
hasProperInterior(false),
li(newLi),
includeProper(newIncludeProper),
recordIsolated(newRecordIsolated),
numIntersections(0),
bdyNodes{{nullptr, nullptr}},
numTests(0)
{}
void setBoundaryNodes(std::vector<Node*>* bdyNodes0,
std::vector<Node*>* bdyNodes1)
{
bdyNodes[0] = bdyNodes0;
bdyNodes[1] = bdyNodes1;
};
/*
* @return the proper intersection point, or <code>null</code>
* if none was found
*/
geom::Coordinate& getProperIntersectionPoint()
{
return properIntersectionPoint;
};
bool hasIntersection() const
{
return hasIntersectionVar;
};
bool hasProperIntersection() const
{
return hasProper;
};
bool hasProperInteriorIntersection() const
{
return hasProperInterior;
};
void addIntersections(Edge* e0, std::size_t segIndex0, Edge* e1, std::size_t segIndex1);
bool getIsDone() const
{
return false;
};
};
} // namespace geos.geomgraph.index
} // namespace geos.geomgraph
} // namespace geos
#ifdef _MSC_VER
#pragma warning(pop)
#endif
geos::algorithm::LineIntersector
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition LineIntersector.h:53
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:217
geos::geomgraph::Edge
Definition geomgraph/Edge.h:63
geos::geomgraph::Node
The node component of a geometry graph.
Definition geomgraph/Node.h:59
geos::geomgraph::index::SegmentIntersector::hasProperInteriorIntersection
bool hasProperInteriorIntersection() const
Definition geomgraph/index/SegmentIntersector.h:154
geos::geomgraph::index::SegmentIntersector::hasProperIntersection
bool hasProperIntersection() const
Definition geomgraph/index/SegmentIntersector.h:145
geos::geomgraph::index::SegmentIntersector::setBoundaryNodes
void setBoundaryNodes(std::vector< Node * > *bdyNodes0, std::vector< Node * > *bdyNodes1)
Parameters are externally owned. Make sure they live for the whole lifetime of this object.
Definition geomgraph/index/SegmentIntersector.h:117
geos::algorithm
Contains classes and interfaces implementing fundamental computational geometry algorithms.
Definition Angle.h:32
geos::geomgraph::index
Contains classes that implement indexes for performing noding on geometry graph edges.
Definition geomgraph/Edge.h:53
geos::geomgraph
Contains classes that implement topology graphs.
Definition Depth.h:31
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38