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 Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
13 **********************************************************************
15 * Last port: noding/FastNodingValidator.java rev. ??? (JTS-1.8)
17 **********************************************************************/
19 #include <geos/noding/FastNodingValidator.h>
20 #include <geos/noding/MCIndexNoder.h> // for checkInteriorIntersections()
21 #include <geos/noding/SingleInteriorIntersectionFinder.h>
22 #include <geos/util/TopologyException.h> // for checkValid()
23 #include <geos/geom/Coordinate.h>
24 #include <geos/io/WKTWriter.h> // for getErrorMessage()
30 namespace noding
{ // geos.noding
34 FastNodingValidator::checkInteriorIntersections()
37 segInt
.reset(new SingleInteriorIntersectionFinder(li
));
39 noder
.setSegmentIntersector(segInt
.get());
40 noder
.computeNodes(&segStrings
);
41 if (segInt
->hasIntersection()) {
49 FastNodingValidator::getErrorMessage() const
51 using geos::io::WKTWriter
;
52 using geos::geom::Coordinate
;
54 if (isValidVar
) return std::string("no intersections found");
56 //return std::string("found non-noded intersection etc etc");
58 const std::vector
<Coordinate
>& intSegs
= segInt
->getIntersectionSegments();
59 assert(intSegs
.size() == 4);
60 return "found non-noded intersection between "
61 + WKTWriter::toLineString(intSegs
[0], intSegs
[1])
63 + WKTWriter::toLineString(intSegs
[2], intSegs
[3]);
67 FastNodingValidator::checkValid()
72 //std::cerr << "Not valid: " << getErrorMessage() << " interior intersection: " << segInt->getInteriorIntersection() << std::endl;
73 throw util::TopologyException(getErrorMessage(), segInt
->getInteriorIntersection());
77 } // namespace geos.noding
80 /**********************************************************************
82 **********************************************************************/