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

# DouglasPeuckerLineSimplifier.h

    00001 /**********************************************************************
    00002  * $Id: DouglasPeuckerLineSimplifier.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 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 <vector>
    00024 #include <memory> // for auto_ptr
    00025
    00026 // Forward declarations
    00027 namespace geos {
    00028         namespace geom {
    00029                 class Coordinate;
    00030         }
    00031 }
    00032
    00033 namespace geos {
    00034 namespace simplify { // geos::simplify
    00035
    00040 class DouglasPeuckerLineSimplifier {
    00041
    00042 public:
    00043
    00044         typedef std::vector<short int> BoolVect;
    00045         typedef std::auto_ptr<BoolVect> BoolVectAutoPtr;
    00046
    00047         typedef std::vector<geom::Coordinate> CoordsVect;
    00048         typedef std::auto_ptr<CoordsVect> CoordsVectAutoPtr;
    00049
    00050
    00055         static CoordsVectAutoPtr simplify(
    00056                         const CoordsVect& nPts,
    00057                         double distanceTolerance);
    00058
    00059         DouglasPeuckerLineSimplifier(const CoordsVect& nPts);
    00060
    00069         void setDistanceTolerance(double nDistanceTolerance);
    00070
    00075         CoordsVectAutoPtr simplify();
    00076
    00077 private:
    00078
    00079         const CoordsVect& pts;
    00080         BoolVectAutoPtr usePt;
    00081         double distanceTolerance;
    00082
    00083         void simplifySection(size_t i, size_t j);
    00084 };
    00085
    00086 } // namespace geos::simplify
    00087 } // namespace geos
    00088
    00089 #endif // _GEOS_SIMPLIFY_DOUBGLASPEUCKERLINESIMPLIFIER_H_
    00090
    00091 /**********************************************************************
    00092  * $Log$
    00093  * Revision 1.4  2006/07/10 10:16:06  strk
    00094  * changed vector<bool> to vector<short int> (see bug#101)
    00095  *
    00096  * Revision 1.3  2006/06/12 11:29:23  strk
    00097  * unsigned int => size_t
    00098  *
    00099  * Revision 1.2  2006/04/13 10:39:12  strk
    00100  * Initial implementation of TaggedLinesSimplifier class
    00101  *
    00102  * Revision 1.1  2006/04/03 10:16:11  strk
    00103  * DouglasPeuckerLineSimplifier class port
    00104  *
    00105  **********************************************************************/