FastNodingValidator.h

00001 /**********************************************************************
00002  * $Id: SinglePassNoder.h 1820 2006-09-06 16:54:23Z mloskot $
00003  *
00004  * GEOS - Geometry Engine Open Source
00005  * http://geos.refractions.net
00006  *
00007  * Copyright (C) 2006      Refractions Research 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: noding/FastNodingValidator.java rev. ??? (JTS-1.8)
00017  *
00018  **********************************************************************/
00019 
00020 #ifndef GEOS_NODING_FASTNODINGVALIDATOR_H
00021 #define GEOS_NODING_FASTNODINGVALIDATOR_H
00022 
00023 #include <geos/noding/SingleInteriorIntersectionFinder.h> // for composition
00024 #include <geos/algorithm/LineIntersector.h> // for composition
00025 
00026 #include <cassert>
00027 #include <string>
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 
00114 };
00115 
00116 } // namespace geos.noding
00117 } // namespace geos
00118 
00119 #endif // GEOS_NODING_FASTNODINGVALIDATOR_H
00120 
00121 /**********************************************************************
00122  * $Log$
00123  **********************************************************************/

Generated on Fri Mar 27 04:52:42 2009 for GEOS by  doxygen 1.5.4