GEOS  3.3.3
FastNodingValidator.h
1 /**********************************************************************
2  * $Id: FastNodingValidator.h 2778 2009-12-03 19:44:00Z mloskot $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
7  * Copyright (C) 2006 Refractions Research Inc.
8  *
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.
13  *
14  **********************************************************************
15  *
16  * Last port: noding/FastNodingValidator.java rev. ??? (JTS-1.8)
17  *
18  **********************************************************************/
19 
20 #ifndef GEOS_NODING_FASTNODINGVALIDATOR_H
21 #define GEOS_NODING_FASTNODINGVALIDATOR_H
22 
23 #include <geos/noding/SingleInteriorIntersectionFinder.h> // for composition
24 #include <geos/algorithm/LineIntersector.h> // for composition
25 
26 #include <memory>
27 #include <string>
28 #include <cassert>
29 
30 // Forward declarations
31 namespace geos {
32  namespace noding {
33  class SegmentString;
34  }
35 }
36 
37 namespace geos {
38 namespace noding { // geos.noding
39 
55 {
56 
57 public:
58 
59  FastNodingValidator(std::vector<noding::SegmentString*>& newSegStrings)
60  :
61  li(), // robust...
62  segStrings(newSegStrings),
63  segInt(),
64  isValidVar(true)
65  {
66  }
67 
74  bool isValid()
75  {
76  execute();
77  return isValidVar;
78  }
79 
86  std::string getErrorMessage() const;
87 
94  void checkValid();
95 
96 private:
97 
99 
100  std::vector<noding::SegmentString*>& segStrings;
101 
102  std::auto_ptr<SingleInteriorIntersectionFinder> segInt;
103 
104  bool isValidVar;
105 
106  void execute()
107  {
108  if (segInt.get() != NULL) return;
109  checkInteriorIntersections();
110  }
111 
112  void checkInteriorIntersections();
113 
114  // Declare type as noncopyable
115  FastNodingValidator(const FastNodingValidator& other);
116  FastNodingValidator& operator=(const FastNodingValidator& rhs);
117 };
118 
119 } // namespace geos.noding
120 } // namespace geos
121 
122 #endif // GEOS_NODING_FASTNODINGVALIDATOR_H
123 
124 /**********************************************************************
125  * $Log$
126  **********************************************************************/