Complete Note#1 in the http://wiki.osgeo.org/wiki/GEOS_Provenance_Review to get out...
[geos.git] / include / geos / geomgraph / EdgeNodingValidator.h
blob838995fced10cff20078bfeb205ce8e19c4d8f8a
1 /**********************************************************************
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
6 * Copyright (C) 2005-2006 Refractions Research Inc.
7 * Copyright (C) 2001-2002 Vivid Solutions Inc.
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
14 **********************************************************************
16 * Last port: geomgraph/EdgeNodingValidator.java rev. 1.6 (JTS-1.10)
18 **********************************************************************/
21 #ifndef GEOS_GEOMGRAPH_EDGENODINGVALIDATOR_H
22 #define GEOS_GEOMGRAPH_EDGENODINGVALIDATOR_H
24 #include <geos/export.h>
25 #include <vector>
27 #include <geos/noding/FastNodingValidator.h> // for composition
29 #include <geos/inline.h>
31 #ifdef _MSC_VER
32 #pragma warning(push)
33 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
34 #endif
36 // Forward declarations
37 namespace geos {
38 namespace geom {
39 class CoordinateSequence;
41 namespace noding {
42 class SegmentString;
44 namespace geomgraph {
45 class Edge;
49 namespace geos {
50 namespace geomgraph { // geos.geomgraph
52 /** \brief
53 * Validates that a collection of SegmentStrings is correctly noded.
55 * Throws an appropriate exception if an noding error is found.
57 class GEOS_DLL EdgeNodingValidator {
59 private:
60 std::vector<noding::SegmentString*>& toSegmentStrings(std::vector<Edge*>& edges);
62 // Make sure this member is initialized *before*
63 // the NodingValidator, as initialization of
64 // NodingValidator will use toSegmentString(), that
65 // in turn expects this member to be initialized
66 std::vector<noding::SegmentString*> segStr;
68 // Make sure this member is initialized *before*
69 // the NodingValidator, as initialization of
70 // NodingValidator will use toSegmentString(), that
71 // in turn expects this member to be initialized
72 std::vector<geom::CoordinateSequence*> newCoordSeq;
74 noding::FastNodingValidator nv;
76 public:
78 /** \brief
79 * Checks whether the supplied {@link Edge}s
80 * are correctly noded.
82 * Throws a {@link TopologyException} if they are not.
84 * @param edges a collection of Edges.
85 * @throws TopologyException if the SegmentStrings are not
86 * correctly noded
89 static void checkValid(std::vector<Edge*>& edges)
91 EdgeNodingValidator validator(edges);
92 validator.checkValid();
95 EdgeNodingValidator(std::vector<Edge*>& edges)
97 segStr(),
98 newCoordSeq(),
99 nv(toSegmentStrings(edges))
102 ~EdgeNodingValidator();
104 void checkValid() { nv.checkValid(); }
108 } // namespace geos.geomgraph
109 } // namespace geos
111 #ifdef _MSC_VER
112 #pragma warning(pop)
113 #endif
115 //#ifdef GEOS_INLINE
116 //# include "geos/geomgraph/EdgeNodingValidator.inl"
117 //#endif
119 #endif // ifndef GEOS_GEOMGRAPH_EDGENODINGVALIDATOR_H
121 /**********************************************************************
122 * $Log$
123 * Revision 1.2 2006/03/24 09:52:41 strk
124 * USE_INLINE => GEOS_INLINE
126 * Revision 1.1 2006/03/09 16:46:49 strk
127 * geos::geom namespace definition, first pass at headers split
129 **********************************************************************/