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

- File List

# BufferInputLineSimplifier.h

    00001 /**********************************************************************
    00002  * $Id: BufferInputLineSimplifier.h 2809 2009-12-06 01:05:24Z mloskot $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2009  Sandro Santilli <strk@keybit.net>
    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: operation/buffer/BufferInputLineSimplifier.java rev 1.6 (JTS-1.10)
    00017  *
    00018  **********************************************************************/
    00019
    00020 #ifndef GEOS_OP_BUFFER_BUFFERINPUTLINESIMPLIFIER_H
    00021 #define GEOS_OP_BUFFER_BUFFERINPUTLINESIMPLIFIER_H
    00022
    00023 #include <geos/geom/CoordinateSequence.h> // complete type required
    00024 #include <geos/algorithm/CGAlgorithms.h> // for enum
    00025
    00026 #include <memory>
    00027 #include <vector> // for composition
    00028
    00029
    00030 // Forward declarations
    00031 namespace geos {
    00032         namespace geom {
    00033                 class CoordinateSequence;
    00034                 //class PrecisionModel;
    00035         }
    00036 }
    00037
    00038 namespace geos {
    00039 namespace operation { // geos.operation
    00040 namespace buffer { // geos.operation.buffer
    00041
    00072 class BufferInputLineSimplifier
    00073 {
    00074
    00075 public:
    00076
    00089         static std::auto_ptr<geom::CoordinateSequence> simplify(
    00090                 const geom::CoordinateSequence& inputLine, double distanceTol);
    00091
    00092         BufferInputLineSimplifier(const geom::CoordinateSequence& input);
    00093
    00104         std::auto_ptr<geom::CoordinateSequence> simplify(double distanceTol);
    00105
    00106 private:
    00107
    00114         bool deleteShallowConcavities();
    00115
    00124         unsigned int findNextNonDeletedIndex(unsigned int index) const;
    00125
    00126         std::auto_ptr<geom::CoordinateSequence> collapseLine() const;
    00127
    00128         bool isDeletable(int i0, int i1, int i2, double distanceTol) const;
    00129
    00130         bool isShallowConcavity(const geom::Coordinate& p0,
    00131                                 const geom::Coordinate& p1,
    00132                                 const geom::Coordinate& p2,
    00133                                 double distanceTol) const;
    00134
    00148         bool isShallowSampled(const geom::Coordinate& p0,
    00149                               const geom::Coordinate& p2,
    00150                               int i0, int i2, double distanceTol) const;
    00151
    00152         bool isShallow(const geom::Coordinate& p0,
    00153                        const geom::Coordinate& p1,
    00154                        const geom::Coordinate& p2,
    00155                        double distanceTol) const;
    00156
    00157         bool isConcave(const geom::Coordinate& p0,
    00158                        const geom::Coordinate& p1,
    00159                        const geom::Coordinate& p2) const;
    00160
    00161         static const int NUM_PTS_TO_CHECK = 10;
    00162
    00163         static const int INIT = 0;
    00164         static const int DELETE = 1;
    00165         static const int KEEP = 1;
    00166
    00167         const geom::CoordinateSequence& inputLine;
    00168         double distanceTol;
    00169         std::vector<int> isDeleted;
    00170
    00171         int angleOrientation;
    00172
    00173     // Declare type as noncopyable
    00174     BufferInputLineSimplifier(const BufferInputLineSimplifier& other);
    00175     BufferInputLineSimplifier& operator=(const BufferInputLineSimplifier& rhs);
    00176 };
    00177
    00178
    00179 } // namespace geos.operation.buffer
    00180 } // namespace geos.operation
    00181 } // namespace geos
    00182
    00183
    00184 #endif // ndef GEOS_OP_BUFFER_BUFFERINPUTLINESIMPLIFIER_H
    00185
    00186 /**********************************************************************
    00187  * $Log$
    00188  **********************************************************************/
    00189