GEOS  3.6.2
EdgeNodingValidator.h
00001 /**********************************************************************
00002  *
00003  * GEOS - Geometry Engine Open Source
00004  * http://geos.osgeo.org
00005  *
00006  * Copyright (C) 2005-2006 Refractions Research Inc.
00007  * Copyright (C) 2001-2002 Vivid Solutions Inc.
00008  *
00009  * This is free software; you can redistribute and/or modify it under
00010  * the terms of the GNU Lesser General Public Licence as published
00011  * by the Free Software Foundation. 
00012  * See the COPYING file for more information.
00013  *
00014  **********************************************************************
00015  *
00016  * Last port: geomgraph/EdgeNodingValidator.java rev. 1.6 (JTS-1.10)
00017  *
00018  **********************************************************************/
00019 
00020 
00021 #ifndef GEOS_GEOMGRAPH_EDGENODINGVALIDATOR_H
00022 #define GEOS_GEOMGRAPH_EDGENODINGVALIDATOR_H
00023 
00024 #include <geos/export.h>
00025 #include <vector>
00026 
00027 #include <geos/noding/FastNodingValidator.h> // for composition
00028 
00029 #include <geos/inline.h>
00030 
00031 #ifdef _MSC_VER
00032 #pragma warning(push)
00033 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00034 #endif
00035 
00036 // Forward declarations
00037 namespace geos {
00038         namespace geom {
00039                 class CoordinateSequence;
00040         }
00041         namespace noding {
00042                 class SegmentString;
00043         }
00044         namespace geomgraph {
00045                 class Edge;
00046         }
00047 }
00048 
00049 namespace geos {
00050 namespace geomgraph { // geos.geomgraph
00051 
00057 class GEOS_DLL EdgeNodingValidator {
00058 
00059 private:
00060         std::vector<noding::SegmentString*>& toSegmentStrings(std::vector<Edge*>& edges);
00061 
00062         // Make sure this member is initialized *before*
00063         // the NodingValidator, as initialization of
00064         // NodingValidator will use toSegmentString(), that
00065         // in turn expects this member to be initialized
00066         std::vector<noding::SegmentString*> segStr;
00067 
00068         // Make sure this member is initialized *before*
00069         // the NodingValidator, as initialization of
00070         // NodingValidator will use toSegmentString(), that
00071         // in turn expects this member to be initialized
00072         std::vector<geom::CoordinateSequence*> newCoordSeq;
00073 
00074         noding::FastNodingValidator nv;
00075 
00076 public:
00077 
00089         static void checkValid(std::vector<Edge*>& edges)
00090         {
00091                 EdgeNodingValidator validator(edges);
00092                 validator.checkValid();
00093         }
00094 
00095         EdgeNodingValidator(std::vector<Edge*>& edges)
00096                 :
00097                 segStr(), 
00098                 newCoordSeq(),
00099                 nv(toSegmentStrings(edges))
00100         {}
00101 
00102         ~EdgeNodingValidator();
00103 
00104         void checkValid() { nv.checkValid(); }
00105 };
00106 
00107 
00108 } // namespace geos.geomgraph
00109 } // namespace geos
00110 
00111 #ifdef _MSC_VER
00112 #pragma warning(pop)
00113 #endif
00114 
00115 //#ifdef GEOS_INLINE
00116 //# include "geos/geomgraph/EdgeNodingValidator.inl"
00117 //#endif
00118 
00119 #endif // ifndef GEOS_GEOMGRAPH_EDGENODINGVALIDATOR_H