GEOS: DouglasPeuckerLineSimplifier.h Source File

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

# DouglasPeuckerLineSimplifier.h

    00001 /**********************************************************************
    00002  * $Id: DouglasPeuckerLineSimplifier.h 3255 2011-03-01 17:56:10Z 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 Licence as published
    00011  * by the Free Software Foundation.
    00012  * See the COPYING file for more information.
    00013  *
    00014  **********************************************************************
    00015  *
    00016  * Last port: simplify/DouglasPeuckerLineSimplifier.java rev. 1.4
    00017  *
    00018  **********************************************************************/
    00019
    00020 #ifndef GEOS_SIMPLIFY_DOUBGLASPEUCKERLINESIMPLIFIER_H
    00021 #define GEOS_SIMPLIFY_DOUBGLASPEUCKERLINESIMPLIFIER_H
    00022
    00023 #include <geos/export.h>
    00024 #include <vector>
    00025 #include <memory> // for auto_ptr
    00026
    00027 #ifdef _MSC_VER
    00028 #pragma warning(push)
    00029 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
    00030 #endif
    00031
    00032 // Forward declarations
    00033 namespace geos {
    00034         namespace geom {
    00035                 class Coordinate;
    00036         }
    00037 }
    00038
    00039 namespace geos {
    00040 namespace simplify { // geos::simplify
    00041
    00046 class GEOS_DLL DouglasPeuckerLineSimplifier {
    00047
    00048 public:
    00049
    00050         typedef std::vector<short int> BoolVect;
    00051         typedef std::auto_ptr<BoolVect> BoolVectAutoPtr;
    00052
    00053         typedef std::vector<geom::Coordinate> CoordsVect;
    00054         typedef std::auto_ptr<CoordsVect> CoordsVectAutoPtr;
    00055
    00056
    00061         static CoordsVectAutoPtr simplify(
    00062                         const CoordsVect& nPts,
    00063                         double distanceTolerance);
    00064
    00065         DouglasPeuckerLineSimplifier(const CoordsVect& nPts);
    00066
    00075         void setDistanceTolerance(double nDistanceTolerance);
    00076
    00081         CoordsVectAutoPtr simplify();
    00082
    00083 private:
    00084
    00085         const CoordsVect& pts;
    00086         BoolVectAutoPtr usePt;
    00087         double distanceTolerance;
    00088
    00089         void simplifySection(std::size_t i, std::size_t j);
    00090
    00091     // Declare type as noncopyable
    00092     DouglasPeuckerLineSimplifier(const DouglasPeuckerLineSimplifier& other);
    00093     DouglasPeuckerLineSimplifier& operator=(const DouglasPeuckerLineSimplifier& rhs);
    00094 };
    00095
    00096 } // namespace geos::simplify
    00097 } // namespace geos
    00098
    00099 #ifdef _MSC_VER
    00100 #pragma warning(pop)
    00101 #endif
    00102
    00103 #endif // GEOS_SIMPLIFY_DOUBGLASPEUCKERLINESIMPLIFIER_H
    00104
    00105 /**********************************************************************
    00106  * $Log$
    00107  * Revision 1.4  2006/07/10 10:16:06  strk
    00108  * changed vector<bool> to vector<short int> (see bug#101)
    00109  *
    00110  * Revision 1.3  2006/06/12 11:29:23  strk
    00111  * unsigned int => size_t
    00112  *
    00113  * Revision 1.2  2006/04/13 10:39:12  strk
    00114  * Initial implementation of TaggedLinesSimplifier class
    00115  *
    00116  * Revision 1.1  2006/04/03 10:16:11  strk
    00117  * DouglasPeuckerLineSimplifier class port
    00118  *
    00119  **********************************************************************/