1 /**********************************************************************
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
6 * Copyright (C) 2006 Refractions Research Inc.
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
13 **********************************************************************/
15 #ifndef GEOS_NODING_NODINGVALIDATOR_H
16 #define GEOS_NODING_NODINGVALIDATOR_H
18 #include <geos/export.h>
23 #include <geos/inline.h>
25 #include <geos/algorithm/LineIntersector.h>
26 //#include <geos/geom/Coordinate.h>
28 // Forward declarations
39 namespace noding
{ // geos.noding
42 * Validates that a collection of {@link SegmentString}s is correctly noded.
43 * Throws a TopologyException if a noding error is found.
45 * Last port: noding/NodingValidator.java rev. 1.6 (JTS-1.7)
48 class GEOS_DLL NodingValidator
{
50 algorithm::LineIntersector li
;
51 const std::vector
<SegmentString
*>& segStrings
;
54 * Checks if a segment string contains a segment
55 * pattern a-b-a (which implies a self-intersection)
57 void checkCollapses() const;
59 void checkCollapses(const SegmentString
& ss
) const;
61 void checkCollapse(const geom::Coordinate
& p0
, const geom::Coordinate
& p1
,
62 const geom::Coordinate
& p2
) const;
65 * Checks all pairs of segments for intersections at an
66 * interior point of a segment
68 void checkInteriorIntersections();
70 void checkInteriorIntersections(const SegmentString
& ss0
,
71 const SegmentString
& ss1
);
73 void checkInteriorIntersections(
74 const SegmentString
& e0
, unsigned int segIndex0
,
75 const SegmentString
& e1
, unsigned int segIndex1
);
78 * Checks for intersections between an endpoint of a segment string
79 * and an interior vertex of another segment string
81 void checkEndPtVertexIntersections() const;
83 void checkEndPtVertexIntersections(const geom::Coordinate
& testPt
,
84 const std::vector
<SegmentString
*>& segStrings
) const;
87 * @return true if there is an intersection point which is not an
88 * endpoint of the segment p0-p1
90 bool hasInteriorIntersection(const algorithm::LineIntersector
& aLi
,
91 const geom::Coordinate
& p0
, const geom::Coordinate
& p1
) const;
93 // Declare type as noncopyable
94 NodingValidator(const NodingValidator
& other
);
95 NodingValidator
& operator=(const NodingValidator
& rhs
);
99 NodingValidator(const std::vector
<SegmentString
*>& newSegStrings
):
100 segStrings(newSegStrings
)
103 ~NodingValidator() {}
110 } // namespace geos.noding
114 //# include "geos/noding/NodingValidator.inl"
117 #endif // GEOS_NODING_NODINGVALIDATOR_H
119 /**********************************************************************
121 * Revision 1.2 2006/03/24 09:52:41 strk
122 * USE_INLINE => GEOS_INLINE
124 * Revision 1.1 2006/03/09 16:46:49 strk
125 * geos::geom namespace definition, first pass at headers split
127 **********************************************************************/