FastNodingValidator.h

00001 /**********************************************************************
00002  *
00003  * GEOS - Geometry Engine Open Source
00004  * http://geos.osgeo.org
00005  *
00006  * Copyright (C) 2006      Refractions Research Inc.
00007  *
00008  * This is free software; you can redistribute and/or modify it under
00009  * the terms of the GNU Lesser General Public Licence as published
00010  * by the Free Software Foundation. 
00011  * See the COPYING file for more information.
00012  *
00013  **********************************************************************
00014  *
00015  * Last port: noding/FastNodingValidator.java rev. ??? (JTS-1.8)
00016  *
00017  **********************************************************************/
00018 
00019 #ifndef GEOS_NODING_FASTNODINGVALIDATOR_H
00020 #define GEOS_NODING_FASTNODINGVALIDATOR_H
00021 
00022 #include <geos/noding/SingleInteriorIntersectionFinder.h> // for composition
00023 #include <geos/algorithm/LineIntersector.h> // for composition
00024 
00025 #include <memory>
00026 #include <string>
00027 #include <cassert>
00028 
00029 // Forward declarations
00030 namespace geos {
00031         namespace noding {
00032                 class SegmentString;
00033         }
00034 }
00035 
00036 namespace geos {
00037 namespace noding { // geos.noding
00038 
00053 class FastNodingValidator 
00054 {
00055 
00056 public:
00057 
00058         FastNodingValidator(std::vector<noding::SegmentString*>& newSegStrings)
00059                 :
00060                 li(), // robust...
00061                 segStrings(newSegStrings),
00062                 segInt(),
00063                 isValidVar(true)
00064         {
00065         }
00066 
00073         bool isValid()
00074         {
00075                 execute();
00076                 return isValidVar;
00077         }
00078   
00085         std::string getErrorMessage() const;
00086   
00093         void checkValid();
00094 
00095 private:
00096 
00097         geos::algorithm::LineIntersector li;
00098 
00099         std::vector<noding::SegmentString*>& segStrings;
00100 
00101         std::auto_ptr<SingleInteriorIntersectionFinder> segInt;
00102 
00103         bool isValidVar;
00104         
00105         void execute()
00106         {
00107                 if (segInt.get() != NULL) return;
00108                 checkInteriorIntersections();
00109         }
00110 
00111         void checkInteriorIntersections();
00112   
00113     // Declare type as noncopyable
00114     FastNodingValidator(const FastNodingValidator& other);
00115     FastNodingValidator& operator=(const FastNodingValidator& rhs);
00116 };
00117 
00118 } // namespace geos.noding
00119 } // namespace geos
00120 
00121 #endif // GEOS_NODING_FASTNODINGVALIDATOR_H

Generated on 15 May 2014 for GEOS by  doxygen 1.4.7